/* ============================================================
   HighThree — Modern Fintech
   Cream + deep green, warm, charts-forward, editorial polish.
   ============================================================ */

:root {
  /* Core palette */
  --bg: #fbfaf7;
  --bg-soft: #f3efe8;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-deep: #1a2420;

  --ink: #1a2420;
  --ink-2: #4a4e5c;
  --ink-3: #8a8e9b;
  --ink-dim: #a8acb8;

  --line: #e6e1d7;
  --line-2: #f0ece3;
  --line-subtle: #f7f3eb;

  --accent: #2d5f4e;           /* deep green */
  --accent-2: #3d8370;
  --accent-3: #4ba38d;
  --accent-soft: rgba(45, 95, 78, 0.08);
  --accent-bg: rgba(45, 95, 78, 0.04);
  --accent-bg-2: #1e3f33;
  --accent-ink: #fbfaf7;

  --warm: #c28a3f;             /* warm amber */
  --warm-soft: rgba(194, 138, 63, 0.1);
  --berry: #9a4854;            /* muted berry */
  --berry-soft: rgba(154, 72, 84, 0.08);

  --positive: #2d5f4e;
  --warning: #c28a3f;
  --danger: #9a4854;

  --shadow-sm: 0 1px 2px rgba(26, 36, 32, 0.04);
  --shadow-md: 0 8px 30px rgba(26, 36, 32, 0.06);
  --shadow-lg: 0 24px 60px -20px rgba(26, 36, 32, 0.15);

  --radius: 10px;
  --radius-lg: 18px;
  --radius-xl: 28px;

  --font-sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: "Instrument Serif", "Charter", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Roboto Mono", ui-monospace, monospace;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 0.4em 0;
  line-height: 1.1;
}

h1 { font-size: clamp(2.4rem, 4.8vw, 3.8rem); line-height: 1.02; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.75rem, 3vw, 2.4rem); line-height: 1.1; }
h3 { font-size: 1.35rem; font-weight: 500; }
h4 { font-size: 1rem; font-weight: 500; font-family: var(--font-sans); }

p { margin: 0 0 1em 0; color: var(--ink-2); font-size: 1rem; line-height: 1.65; }

code, .mono, .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout ---------- */
.container { max-width: 1320px; margin: 0 auto; padding: 0 28px; }
.container-narrow { max-width: 840px; margin: 0 auto; padding: 0 28px; }

/* ---------- Nav ---------- */
.site-nav {
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: -0.015em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-block;
  border-radius: 10px;
  object-fit: contain;
}
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a {
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 6px 0;
}
.nav-links a.active { color: var(--accent); }
.nav-links a:hover { color: var(--ink); text-decoration: none; }

/* Nav dropdown ("More") */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--ink-2); font-weight: 500; font-size: 0.92rem;
  padding: 6px 0; cursor: pointer; background: none; border: none;
  font: inherit; white-space: nowrap;
}
.nav-dropdown-toggle::after {
  content: ''; display: inline-block; width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid var(--ink-3); margin-left: 2px;
  transition: transform 0.15s ease;
}
.nav-dropdown.is-open .nav-dropdown-toggle::after { transform: rotate(180deg); }
.nav-dropdown-toggle:hover { color: var(--ink); }
.nav-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 0; min-width: 160px;
  box-shadow: var(--shadow-md); z-index: 60;
}
.nav-dropdown.is-open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block; padding: 9px 18px; color: var(--ink-2);
  font-weight: 500; font-size: 0.88rem; white-space: nowrap;
}
.nav-dropdown-menu a:hover { color: var(--ink); background: var(--bg-soft); text-decoration: none; }
.nav-dropdown.has-active .nav-dropdown-toggle { color: var(--accent); }
.nav-dropdown-menu a.active { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 100px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-card);
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { border-color: var(--ink); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
  padding: 8px 14px;
}
.btn-ghost:hover { color: var(--ink); background: var(--bg-soft); text-decoration: none; }

/* Dark CTA buttons */
.factors-cta .btn-secondary { background: transparent; }
.factors-cta .btn-secondary:hover { background: rgba(251,250,247,0.08); }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.card-hero { box-shadow: var(--shadow-md); }

.card-title {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin: 0 0 8px 0;
  font-weight: 500;
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-2);
}
.field .hint {
  font-size: 0.76rem;
  color: var(--ink-3);
  font-weight: 400;
}
.input, .select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg-card);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.num, .input.mono { font-family: var(--font-mono); }

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.input-group .prefix, .input-group .suffix {
  position: absolute;
  color: var(--ink-3);
  font-size: 0.9rem;
  pointer-events: none;
  font-family: var(--font-mono);
}
.input-group .prefix { left: 14px; }
.input-group .suffix { right: 14px; }
.input-group .input.with-prefix { padding-left: 28px; }
.input-group .input.with-suffix { padding-right: 32px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-card); }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
table.data th {
  text-align: right;
  font-weight: 500;
  color: var(--ink-3);
  background: var(--bg-soft);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--font-mono);
  color: var(--ink);
  font-size: 0.85rem;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr.highlight td {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}
table.data tr:hover td { background: var(--bg-soft); }
table.data tr.highlight:hover td { background: var(--accent-soft); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  margin-top: 80px;
  font-size: 0.88rem;
  color: var(--ink-3);
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--ink-3); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Callout ---------- */
.callout {
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.95rem;
  color: var(--ink-2);
  line-height: 1.6;
}
.callout strong { color: var(--ink); font-weight: 500; }
.callout code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.85em;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: 100px;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-accent { background: var(--accent-bg); color: var(--accent); border-color: transparent; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: 100px;
  margin-bottom: 20px;
  width: fit-content;
}
.tab {
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-3);
  background: transparent;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.tab.active { color: var(--ink); background: var(--bg-card); box-shadow: var(--shadow-sm); }
.tab:hover:not(.active) { color: var(--ink); }

/* ---------- Grid utilities ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Stat / metric ---------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.stat-sub {
  font-size: 0.85rem;
  color: var(--ink-3);
}

/* ---------- Range slider ---------- */
.slider-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.slider-head .label { font-weight: 500; color: var(--ink-2); font-size: 0.95rem; }
.slider-head .value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -0.015em;
}
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--bg);
  box-shadow: 0 2px 8px rgba(45, 95, 78, 0.3);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--bg);
}

/* ---------- Global jargon tooltips ---------- */
.jargon {
  border-bottom: 1px dashed var(--accent-3);
  cursor: pointer;
  position: relative;
  text-decoration: none;
  color: inherit;
}
.jargon[href]:hover { color: var(--accent); }
.jargon.tooltip-open::after { opacity: 1; transition-delay: 0s; }
.jargon::after {
  content: attr(data-def);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 400;
  width: max-content;
  max-width: 300px;
  white-space: normal;
  line-height: 1.45;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  transition-delay: 0s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  font-family: var(--font-sans);
}
.jargon:hover::after { opacity: 1; transition-delay: 0.4s; }
.jargon.tooltip-open:hover::after { transition-delay: 0s; }

/* ---------- Table header tooltips ---------- */
.th-tip {
  cursor: help;
  position: relative;
}
.th-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 400;
  width: max-content;
  max-width: 280px;
  white-space: normal;
  line-height: 1.45;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  transition-delay: 0s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  font-family: var(--font-sans);
  text-align: left;
}
.th-tip:hover::after { opacity: 1; transition-delay: 0.5s; }
.th-tip-popup {
  position: fixed;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 400;
  max-width: 280px;
  white-space: normal;
  line-height: 1.45;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  font-family: var(--font-sans);
  text-align: left;
}

/* ---------- Print stylesheet ---------- */
@media print {
  .site-nav, .nav-hamburger, .input-panel, .side-panel, .btn,
  .disclaimer, .desktop-notice, .export-row, .tabs,
  .longevity-card, .survivor-grid, .factors-toc, .alpha-nav,
  .input-panel-toggle { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .container, .container-narrow { max-width: 100%; padding: 0 12px; }
  .app-layout, .be-layout, .tm-layout, .sc-layout, .method-layout, .wr-layout {
    display: block !important; grid-template-columns: unset !important;
  }
  .content-area, main { max-width: 100% !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc; }
  .table-wrap { overflow: visible !important; }
  table.data, table.tm-table, table.sc-table, table.wr-table { font-size: 9pt; }
  .site-footer { margin-top: 20px; }
  a[href]::after { content: none; }
}

/* ---------- Disclaimer footer ---------- */
.disclaimer {
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  padding: 14px 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-3);
}

/* ---------- Utility ---------- */
.text-muted { color: var(--ink-3); }
.text-accent { color: var(--accent); }
.text-right { text-align: right; }
.text-sm { font-size: 0.88rem; }
.serif { font-family: var(--font-display); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 12px; }
.mt-2 { margin-top: 24px; }
.mt-3 { margin-top: 40px; }
.mt-4 { margin-top: 64px; }
.mb-1 { margin-bottom: 12px; }
.mb-2 { margin-bottom: 24px; }

/* ============================================================
   MOBILE / RESPONSIVE
   ============================================================ */

/* Hamburger button — hidden on desktop */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  color: var(--ink);
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  flex-shrink: 0;
}
.nav-hamburger:hover { background: var(--bg-soft); }
.nav-hamburger .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

@media (max-width: 820px) {
  /* Prevent horizontal scroll from any overflowing content */
  /* Note: only body, not html — html overflow-x:hidden blocks child scroll containers on iOS Safari */
  body { overflow-x: hidden; }

  /* Tighter horizontal gutters */
  .container, .container-narrow { padding: 0 16px; }

  /* Nav: hamburger replaces inline links */
  .nav-hamburger { display: flex; }
  .site-nav { position: relative; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(251, 250, 247, 0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    padding: 8px 20px 18px;
    z-index: 100;
    box-shadow: var(--shadow-md);
  }
  .nav-links.is-open { display: flex; }
  .nav-links a {
    padding: 13px 0;
    border-bottom: 1px solid var(--line-2);
    font-size: 1rem;
    color: var(--ink-2);
  }
  .nav-links a:last-of-type { border-bottom: none; }
  .nav-dropdown { position: static; }
  .nav-dropdown-toggle {
    padding: 13px 0; border-bottom: 1px solid var(--line-2);
    font-size: 1rem; width: 100%; justify-content: flex-start;
  }
  .nav-dropdown-toggle::after { margin-left: auto; }
  .nav-dropdown-menu {
    display: none; position: static; border: none;
    box-shadow: none; padding: 0 0 0 16px; min-width: 0;
    background: transparent;
  }
  .nav-dropdown.is-open .nav-dropdown-menu { display: block; }
  .nav-dropdown-menu a { padding: 11px 0; border-bottom: 1px solid var(--line-2); }
  .nav-dropdown-menu a:last-child { border-bottom: none; }
  .nav-links .btn {
    margin-top: 10px;
    width: 100%;
    justify-content: center;
    border-radius: var(--radius);
  }

  /* Tabs: horizontal scroll instead of overflow */
  .tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: 8px 14px; font-size: 0.82rem; }

  /* Panel grids: single column */
  .panel-grid { grid-template-columns: 1fr !important; }
  .panel-grid .full { grid-column: 1 !important; }

  /* Summary band: 2-up on tablet */
  .summary-band { grid-template-columns: 1fr 1fr !important; }

  /* Reduce card padding slightly */
  .card { padding: 20px; }

  /* Footer stacks */
  .site-footer .container { flex-direction: column; gap: 10px; }
}

@media (max-width: 520px) {
  /* Summary band: 1-col on very small phones */
  .summary-band { grid-template-columns: 1fr !important; }

  /* Smaller card padding */
  .card { padding: 16px; }

  /* Reduce page-head h1 */
  h1 { font-size: clamp(1.75rem, 7vw, 2.4rem) !important; }

  /* Prevent button text overflow */
  .btn { white-space: normal; word-break: break-word; }
}

/* ============================================================
   VISUAL ENHANCEMENTS — grain, motion, hover, dark footer
   ============================================================ */

/* Branded text selection */
::selection {
  background: rgba(45, 95, 78, 0.13);
  color: var(--accent);
}

/* Subtle grain texture — adds tactile depth to the cream background */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* Nav scroll shadow — JS adds .is-scrolled when window.scrollY > 8 */
.site-nav { transition: box-shadow 0.3s ease; }
.site-nav.is-scrolled { box-shadow: 0 2px 28px rgba(26, 36, 32, 0.1); }

/* ---- Page entry animations ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up   { animation: fadeUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both; }
.fade-up-1 { animation: fadeUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.07s both; }
.fade-up-2 { animation: fadeUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.16s both; }
.fade-up-3 { animation: fadeUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.26s both; }
.fade-up-4 { animation: fadeUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.38s both; }
.fade-up-5 { animation: fadeUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.50s both; }

/* Reduce motion: respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .fade-up, .fade-up-1, .fade-up-2, .fade-up-3, .fade-up-4, .fade-up-5 {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ---- Section head decorative accent line ---- */
.section-head::before {
  content: '';
  display: block;
  width: 28px;
  height: 2px;
  background: var(--accent);
  margin: 0 auto 22px;
  border-radius: 2px;
}

/* ---- Tool-card top accent bar slides in on hover ---- */
.tool-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.tool-card:hover::after { transform: scaleX(1); }

/* ---- Enhanced btn-primary hover glow ---- */
.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(45, 95, 78, 0.24);
}

/* ---- Dark footer ---- */
.site-footer {
  border-top: none;
  background: var(--bg-deep);
  margin-top: 0;
  padding: 72px 0 44px;
  font-size: 0.88rem;
  color: rgba(251, 250, 247, 0.44);
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}
.site-footer a { color: rgba(251, 250, 247, 0.44); }
.site-footer a:hover { color: var(--accent-3); text-decoration: none; }
.site-footer strong { color: var(--accent-ink) !important; }

/* Disclaimer sits below the dark footer — keep it light */
.disclaimer {
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  padding: 14px 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-3);
}

/* ============================================================
   SHARED CONTENT PAGE COMPONENTS
   Used across all fers-*.html, tsp-guide.html, etc.
   ============================================================ */

/* --- Content page hero (shared across 17+ pages) --- */
.factors-hero {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 80% 20%, rgba(45, 95, 78, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 15% 85%, rgba(194, 138, 63, 0.03) 0%, transparent 50%),
    var(--bg);
}
.factors-hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--accent); font-weight: 500;
  margin-bottom: 20px; padding: 5px 12px;
  background: var(--accent-bg); border-radius: 100px;
}
.factors-hero h1 { margin-bottom: 18px; }
.factors-hero h1 em { color: var(--accent); font-style: italic; }
.factors-hero .lede {
  font-size: 1.12rem; color: var(--ink-2); max-width: 680px;
  line-height: 1.65; margin-bottom: 0;
}

/* --- Content page layout (sidebar ToC + main) --- */
.factors-layout {
  padding: 56px 0 80px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: start;
}
.factors-toc {
  position: sticky;
  top: 70px;
  font-size: 0.88rem;
}
.factors-toc h4 {
  font-family: var(--font-sans);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); margin: 0 0 12px 0;
}
.factors-toc a {
  display: block; padding: 6px 0 6px 14px;
  color: var(--ink-2); border-left: 2px solid var(--line);
  font-size: 0.85rem; line-height: 1.4;
}
.factors-toc a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.factors-toc a.active { color: var(--accent); border-color: var(--accent); font-weight: 500; }

/* --- Content sections --- */
.factor-section {
  max-width: 820px;
  scroll-margin-top: 80px;
  margin-bottom: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line-2);
}
.factor-section:last-child { border-bottom: none; margin-bottom: 0; }

.factor-header {
  display: flex; align-items: flex-start; gap: 20px; margin-bottom: 24px;
}
.factor-num {
  font-family: var(--font-mono); font-size: 0.76rem; color: var(--accent);
  font-weight: 600; letter-spacing: 0.06em; white-space: nowrap;
  margin-top: 6px;
}
.factor-title-block h2 {
  font-size: 1.55rem; margin-bottom: 8px; color: var(--ink);
  font-family: var(--font-display); font-weight: 400; letter-spacing: -0.015em;
  line-height: 1.15;
}
.factor-title-block .tagline {
  font-family: var(--font-display); font-style: italic;
  font-size: 1rem; color: var(--ink-3);
}
.factor-body { color: var(--ink-2); font-size: 1rem; line-height: 1.7; }
.factor-body p { margin: 0 0 16px; }
.factor-body p:last-child { margin-bottom: 0; }
.factor-body strong { color: var(--ink); font-weight: 500; }
.factor-body ul { padding-left: 20px; margin: 0 0 16px; }
.factor-body li { margin-bottom: 6px; }
.factor-body li::marker { color: var(--accent); }

/* --- Inline components --- */
.example-box {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 20px;
  margin: 20px 0;
  font-size: 0.95rem;
}
.example-box .ex-label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent); margin-bottom: 8px;
}
.example-box p { margin: 0; color: var(--ink-2); }
.example-box strong { color: var(--ink); }

.warn-box {
  background: var(--warm-soft);
  border-left: 3px solid var(--warning);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 0.95rem;
  color: var(--ink-2);
}
.warn-box strong { color: #8a5a1f; }

.big-stat {
  display: inline-flex; flex-direction: column; gap: 2px;
  background: var(--accent-bg); border: 1px solid rgba(45,95,78,0.12);
  border-radius: var(--radius); padding: 14px 20px; margin: 16px 0;
}
.big-stat .num {
  font-family: var(--font-display); font-size: 2.2rem;
  color: var(--accent); letter-spacing: -0.025em; line-height: 1;
}
.big-stat .lbl { font-size: 0.8rem; color: var(--ink-3); font-weight: 500; }

.yos-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.92rem; }
.yos-table th {
  text-align: left; padding: 8px 12px; background: var(--bg-soft);
  border-bottom: 2px solid var(--line); color: var(--ink-3); font-size: 0.76rem;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.yos-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--line-2);
  font-family: var(--font-mono); color: var(--ink);
}
.yos-table td:first-child { font-family: var(--font-sans); color: var(--ink-2); }
.yos-table tr:last-child td { border-bottom: none; }
.yos-table tr.highlight td { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

/* Guide navigation grid (FERS Guide hub) */
.guide-grid {
  max-width: 900px;
  margin: 0 0 48px;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.guide-grid h2 {
  font-family: var(--font-display);
  font-size: 1.45rem; font-weight: 400; color: var(--ink); margin-bottom: 8px;
}
.guide-grid > p { color: var(--ink-2); margin: 0 0 20px; line-height: 1.6; }
.guide-card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.guide-card {
  display: block; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-soft); color: var(--ink-2); line-height: 1.45;
  transition: border-color 0.18s, transform 0.18s;
}
.guide-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.guide-card strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }

/* CTA strip */
.factors-cta {
  margin-top: 56px; padding: 36px 40px;
  background: var(--bg-deep); color: var(--bg);
  border-radius: var(--radius-xl);
  display: flex; justify-content: space-between; align-items: center; gap: 32px;
  flex-wrap: wrap;
}
.factors-cta h3 {
  font-family: var(--font-display); font-size: 1.5rem; color: var(--bg);
  margin-bottom: 8px; font-weight: 400; letter-spacing: -0.015em;
}
.factors-cta p { font-size: 0.95rem; color: rgba(251,250,247,0.7); margin: 0; }
.factors-cta-btns { display: flex; gap: 12px; flex-wrap: wrap; flex-shrink: 0; }
.factors-cta .btn-secondary { background: transparent; }
.factors-cta .btn-secondary:hover { background: rgba(251,250,247,0.08); }

/* Responsive for content pages */
@media (max-width: 900px) {
  .factors-layout { grid-template-columns: 1fr; gap: 24px; }
  .factors-toc { display: none; }
}
@media (max-width: 820px) {
  .factors-hero { padding: 40px 0 32px; }
  .factor-header { flex-direction: column; gap: 8px; }
  .factor-num { margin-top: 0; }
  .guide-card-list { grid-template-columns: 1fr; }
  .factors-cta { padding: 28px 24px; flex-direction: column; align-items: flex-start; }
  .factors-cta-btns .btn { width: 100%; justify-content: center; }
}
@media (max-width: 520px) {
  .factors-layout { padding: 32px 0 56px; }
  .factor-section { margin-bottom: 32px; padding-bottom: 32px; }
  .factor-title-block h2 { font-size: 1.3rem; }
}

/* Auto fade-up for content page heroes — no HTML class required */
.factors-hero .container > *,
.article-hero .container > * {
  animation: fadeUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.factors-hero .container > *:nth-child(2),
.article-hero .container > *:nth-child(2) { animation-delay: 0.09s; }
.factors-hero .container > *:nth-child(3),
.article-hero .container > *:nth-child(3) { animation-delay: 0.19s; }
.factors-hero .container > *:nth-child(4),
.article-hero .container > *:nth-child(4) { animation-delay: 0.29s; }
@media (prefers-reduced-motion: reduce) {
  .factors-hero .container > *,
  .article-hero .container > * { animation: none; opacity: 1; transform: none; }
}
