/* ==========================================================================
   Income Investing AI — site styles.
   Editorial-meets-terminal: warm paper canvas, deep-green brand, gold accents,
   dense readable data tables. Three themes (light / dark / sepia) and two
   detail modes (guided / expert) driven by data-attributes on <html>.
   ========================================================================== */

:root {
  --bg: #f4f6f3;
  --bg-alt: #eef2ed;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --border: #dbe3dc;
  --border-strong: #c3cfc4;
  --ink: #12241c;
  --ink-soft: #476052;
  --ink-mute: #7b9186;
  --accent: #0a7a52;
  --accent-dark: #06563a;
  --accent-soft: #e4f2ea;
  --gold: #b07d19;
  --gold-soft: #fbf1dc;
  --up: #17794a;
  --down: #b3352c;
  --warn: #a76a09;
  --brand-bg: #0a7a52;
  --row-alt: #f7faf8;
  --row-hover: #eaf3ee;
  --thead-bg: #eef3ef;
  --shadow: 0 1px 2px rgba(16,36,28,.05), 0 8px 24px rgba(16,36,28,.05);
  --shadow-lg: 0 12px 40px rgba(16,36,28,.14);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1220px;
}

html[data-theme="dark"] {
  --bg: #0d1512;
  --bg-alt: #101b17;
  --surface: #131f1a;
  --surface-2: #17251f;
  --border: #22352c;
  --border-strong: #2f463a;
  --ink: #e8f0ea;
  --ink-soft: #a8bdb0;
  --ink-mute: #7e948a;
  --accent: #4ade9f;
  --accent-dark: #86efc0;
  --accent-soft: #163024;
  --gold: #e9be6a;
  --gold-soft: #2a2213;
  --up: #4ade9f;
  --down: #f4796d;
  --warn: #e9be6a;
  --brand-bg: #0e5b3e;
  --row-alt: #16241e;
  --row-hover: #1c2f26;
  --thead-bg: #17251f;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
}

html[data-theme="sepia"] {
  --bg: #f6f1e6;
  --bg-alt: #f0e9d9;
  --surface: #fffdf7;
  --surface-2: #faf5ea;
  --border: #e2d8c2;
  --border-strong: #cdbfa2;
  --ink: #2c2416;
  --ink-soft: #5f5341;
  --ink-mute: #8a7d68;
  --accent: #8a6a1f;
  --accent-dark: #6c5215;
  --accent-soft: #f4ebd6;
  --gold: #a8761a;
  --row-alt: #faf5ea;
  --row-hover: #f2e9d5;
  --thead-bg: #f2ead9;
  --brand-bg: #6c5215;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 .5em; }
h1 { font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 17px; font-weight: 650; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------------- Header ---------------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 60;
  box-shadow: 0 1px 0 rgba(16,36,28,.04);
}
.header-inner { display: flex; align-items: center; gap: 16px; padding: 11px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand:hover { text-decoration: none; }
.brand-logo svg { display: block; border-radius: 11px; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: var(--display); font-size: 21px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.brand-dot { color: var(--gold); }
.brand-tag { font-size: 11.5px; color: var(--ink-mute); letter-spacing: .01em; }

.search-wrap { position: relative; flex: 1 1 240px; max-width: 380px; margin-left: auto; }
.search-wrap input {
  width: 100%; padding: 9px 13px; font: inherit; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface-2); color: var(--ink);
}
.search-wrap input:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--surface); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 70;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 60vh; overflow: auto;
}
.search-results a { display: block; padding: 9px 13px; color: var(--ink); font-size: 14px; border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: var(--row-hover); text-decoration: none; }
.search-results .sr-kind { color: var(--ink-mute); font-size: 12px; margin-left: 6px; }

.nav-toggle { display: none; background: none; border: 1px solid var(--border-strong); border-radius: 9px; padding: 6px 11px; font-size: 17px; color: var(--ink); cursor: pointer; }

/* ---------------- Mega nav ---------------- */
.topnav { display: flex; gap: 4px; flex-basis: 100%; border-top: 1px solid var(--border); padding-top: 6px; }
.navgroup { position: relative; }
.navgroup-head {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 13px; border-radius: 999px; font-size: 14.5px; font-weight: 600; color: var(--ink-soft);
}
.navgroup-head:hover, .navgroup:focus-within .navgroup-head { background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; }
.navgroup-head.current { color: var(--accent-dark); background: var(--accent-soft); }
.caret { font-size: 10px; opacity: .7; }
.navmenu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 80;
  min-width: 290px; padding: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .12s ease, transform .12s ease;
}
.navgroup:hover .navmenu, .navgroup:focus-within .navmenu { opacity: 1; visibility: visible; transform: none; }
.navmenu-blurb { font-size: 12px; color: var(--ink-mute); margin: 0 0 8px; padding: 0 8px; }
.navmenu ul { list-style: none; margin: 0; padding: 0; }
.navmenu a { display: block; padding: 7px 9px; border-radius: var(--radius-sm); color: var(--ink); }
.navmenu a:hover { background: var(--row-hover); text-decoration: none; }
.navmenu a strong { display: block; font-size: 14px; font-weight: 600; }
.navmenu a span { display: block; font-size: 12px; color: var(--ink-mute); }
.navmenu a.current { background: var(--accent-soft); }

/* ---------------- Layout ---------------- */
.layout { display: block; padding-top: 26px; padding-bottom: 44px; }
.layout.has-rail { display: grid; grid-template-columns: minmax(0,1fr) 296px; gap: 30px; align-items: start; }
.rail { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 16px; }
.rail-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.rail-box h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-mute); margin-bottom: 9px; }
.rail-box ul { margin: 0; padding-left: 17px; }
.rail-box li { margin: 5px 0; font-size: 14px; }

.crumbs { font-size: 13px; color: var(--ink-mute); margin-bottom: 12px; }
.crumbs a { color: var(--ink-soft); }

/* ---------------- Page head ---------------- */
.page-head { margin-bottom: 22px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
.page-lede { font-size: 17.5px; color: var(--ink-soft); max-width: 74ch; margin-bottom: .5em; }
.page-meta, .asof, .fineprint { font-size: 12.5px; color: var(--ink-mute); }
.fineprint { max-width: 80ch; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 32px 0 14px; }
.section-head h2 { margin: 0; }
.section-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-mute); }
.see-all { font-size: 13.5px; font-weight: 600; white-space: nowrap; }

/* ---------------- Hero ---------------- */
.hero {
  background: linear-gradient(160deg, var(--brand-bg) 0%, #063d2a 100%);
  color: #eaf7f0; border-radius: 20px; padding: 40px 38px; margin-bottom: 30px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -90px; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(242,193,78,.28) 0%, rgba(242,193,78,0) 70%);
}
.hero h1 { color: #fff; font-size: 42px; max-width: 18ch; margin-bottom: 12px; }
.hero p { color: #c9e6d7; font-size: 17.5px; max-width: 62ch; }
.hero .btn { background: #f2c14e; color: #12241c; border-color: transparent; }
.hero .btn:hover { background: #ffd479; }
.hero .btn-ghost { background: transparent; color: #eaf7f0; border-color: rgba(255,255,255,.35); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; position: relative; z-index: 1; }

/* ---------------- Buttons / chips ---------------- */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-dark); }
.btn-sm { padding: 7px 14px; font-size: 13.5px; }

.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-soft); }
.chip-mech { background: var(--accent-soft); border-color: transparent; color: var(--accent-dark); }
.chip-passive { background: var(--accent-soft); border-color: transparent; color: var(--accent-dark); }
.chip-semi { background: var(--gold-soft); border-color: transparent; color: var(--gold); }
.badge { position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gold); }

/* ---------------- Cards ---------------- */
.card-grid { display: grid; gap: 15px; grid-template-columns: repeat(auto-fill, minmax(min(280px,100%),1fr)); }
.card-grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(min(360px,100%),1fr)); }
.card-grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(min(220px,100%),1fr)); }
.card {
  position: relative; display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 17px 18px; box-shadow: var(--shadow); color: var(--ink);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-lg); text-decoration: none; }
.card h3 { margin: 0 0 6px; color: var(--accent-dark); }
.card p { margin: 0; font-size: 14px; color: var(--ink-soft); }
.card-meta { display: block; margin-top: 9px; font-size: 12.5px; color: var(--ink-mute); }
.card-more { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--accent); }

/* ---------------- Stats ---------------- */
.stat-row { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(min(170px,100%),1fr)); margin: 18px 0 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 13px 15px; box-shadow: var(--shadow); }
.stat-label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-mute); }
.stat-value { display: block; font-family: var(--mono); font-size: 22px; font-weight: 600; margin-top: 3px; letter-spacing: -.02em; }
.stat-note { display: block; font-size: 12px; color: var(--ink-mute); margin-top: 3px; }
.stat.tone-gold { border-left-color: var(--gold); }
.stat.tone-warn { border-left-color: var(--warn); }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data caption { text-align: left; padding: 12px 15px 0; font-size: 13px; color: var(--ink-mute); }
table.data th, table.data td { padding: 9px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data thead th { background: var(--thead-bg); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); position: sticky; top: 0; }
table.data.sortable thead th { cursor: pointer; user-select: none; }
table.data.sortable thead th::after { content: "↕"; opacity: .25; margin-left: 5px; font-size: 10px; }
table.data.sortable thead th.asc::after { content: "↑"; opacity: .8; }
table.data.sortable thead th.desc::after { content: "↓"; opacity: .8; }
table.data tbody tr:nth-child(even) { background: var(--row-alt); }
table.data tbody tr:hover { background: var(--row-hover); }
table.data td.right, table.data th.right { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.center, table.data th.center { text-align: center; }
table.data td.num, table.data td.right { font-family: var(--mono); font-size: 13.2px; }
table.data td.up { color: var(--up); }
table.data td.down { color: var(--down); }
table.data td.wrap { white-space: normal; min-width: 220px; }
.empty { color: var(--ink-mute); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 20px; text-align: center; }

/* ---------------- Rate list ---------------- */
.rate-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.rate-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: baseline; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.rate-row:last-child { border-bottom: 0; }
.rate-label { font-weight: 550; }
.rate-value { font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--accent-dark); }
.rate-date { font-size: 12px; color: var(--ink-mute); min-width: 128px; text-align: right; }

/* ---------------- Callouts ---------------- */
.callout { border-radius: var(--radius-sm); padding: 13px 16px; margin: 18px 0; border: 1px solid var(--border); background: var(--surface-2); font-size: 14.5px; }
.callout-title { display: block; margin-bottom: 4px; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-risk { background: color-mix(in srgb, var(--down) 8%, var(--surface)); border-color: color-mix(in srgb, var(--down) 30%, var(--border)); }
.callout-tax { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 35%, var(--border)); }
.callout-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }

/* ---------------- Guided vs Expert ----------------
   Two genuinely different views of the same page, not a label.

   Guided  — fewer columns, explained. Specialist columns are dropped, the ones
             that stay get a plain-language gloss, and the beginner notes appear.
             Roomier, because the reader is reading rather than scanning.
   Expert  — everything, tight. Every column present, denser rows, no notes.

   Default is Expert (set in base.html), so the site a first-time visitor meets
   is the complete one; Guided is the deliberate step down in density. */
.guided-note { display: none; font-size: 13.5px; color: var(--ink-soft); background: var(--accent-soft); border-radius: var(--radius-sm); padding: 9px 13px; margin: -4px 0 16px; }
html[data-mode="guided"] .guided-note { display: block; }

/* Specialist columns: present for an expert, hidden for a guided reader. */
html[data-mode="guided"] .col-expert { display: none; }

/* Column glosses: the plain-language line under a header, guided only. */
.col-gloss { display: none; }
html[data-mode="guided"] .col-gloss {
  display: block; margin-top: 3px; font-size: 11px; font-weight: 400;
  text-transform: none; letter-spacing: 0; color: var(--ink-mute); max-width: 22ch; white-space: normal;
}

/* Density. Expert packs more rows onto the screen; Guided gives them air. */
html[data-mode="expert"] table.data th,
html[data-mode="expert"] table.data td { padding: 6px 11px; font-size: 13.4px; }
html[data-mode="guided"] table.data th,
html[data-mode="guided"] table.data td { padding: 12px 15px; font-size: 15px; }
html[data-mode="guided"] table.data td.num,
html[data-mode="guided"] table.data td.right { font-size: 14.5px; }

/* Guided readers get the lede and callouts at a comfortable reading size; an
   expert scanning tables does not need the extra weight. */
html[data-mode="guided"] .page-lede { font-size: 18.5px; }
html[data-mode="expert"] .page-lede { font-size: 16.5px; }

/* ---------------- Prose ---------------- */
.prose { max-width: 74ch; }
.prose h2 { margin-top: 34px; }
.prose h3 { margin-top: 24px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose blockquote { margin: 18px 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--accent); color: var(--ink-soft); }
.takeaways { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: var(--radius-sm); padding: 14px 18px; margin: 22px 0; }
.takeaways h2, .takeaways h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-mute); margin-bottom: 8px; }
.takeaways ul { margin: 0; padding-left: 18px; }
.takeaways li { margin: 5px 0; }

/* ---------------- Partners ---------------- */
.partners { margin: 34px 0; }
.partner-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(250px,100%),1fr)); }
.partner { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); }
.partner-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.partner p { font-size: 13.5px; color: var(--ink-soft); }
.partner-hl { font-family: var(--mono); font-size: 13px; color: var(--accent-dark); }
.spon { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; padding: 1px 7px; }

/* ---------------- FAQ ---------------- */
.faq { margin: 34px 0; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 9px; box-shadow: var(--shadow); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: 8px; }

/* ---------------- Prompt cards ---------------- */
.prompt-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 17px; margin-bottom: 15px; }
.prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.prompt-head h3 { margin: 0; }
.copy-btn { background: var(--accent-soft); color: var(--accent-dark); border: 1px solid transparent; border-radius: 999px; padding: 5px 13px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.copy-btn:hover { background: var(--accent); color: #fff; }
.copy-btn.copied { background: var(--accent); color: #fff; }
.prompt-text { white-space: pre-wrap; font-family: var(--mono); font-size: 13px; line-height: 1.55; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; margin: 11px 0 0; color: var(--ink-soft); overflow-x: auto; }
.fill { background: var(--gold-soft); color: var(--gold); border-radius: 4px; padding: 0 3px; font-weight: 600; }

/* Forms */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(200px,100%),1fr)); margin: 18px 0; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field .hint { font-size: 12px; color: var(--ink-mute); margin-top: 3px; }

/* Link list */
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.link-list li:last-child { border-bottom: 0; }
.link-list span { color: var(--ink-mute); font-size: 13.5px; }

.ad-slot { margin: 26px 0; min-height: 90px; }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 34px 0 26px; margin-top: 30px; font-size: 14px; }
.footer-cols { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(min(180px,100%),1fr)); }
.footer-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-mute); margin-bottom: 9px; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin: 5px 0; }
.footer-links a { color: var(--ink-soft); font-size: 13.5px; }
.footer-signup { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 26px 0 20px; padding: 15px 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.footer-signup label { font-weight: 600; font-size: 14px; }
.footer-signup input { flex: 1 1 220px; padding: 9px 13px; font: inherit; font-size: 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--ink); }
.footer-signup button { padding: 9px 20px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.signup-note { flex-basis: 100%; font-size: 12px; color: var(--ink-mute); }
.disclaimer, .attributions, .affiliate-disclosure, .copyright { font-size: 12px; color: var(--ink-mute); max-width: 100ch; }
.copyright { margin-top: 14px; }

/* ---------------- Rails ---------------- */
.rails { position: fixed; right: 14px; bottom: 14px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.view-rail, .theme-rail { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; box-shadow: var(--shadow-lg); font-size: 12px; color: var(--ink-mute); }
.mt-switch { display: flex; gap: 2px; background: var(--surface-2); border-radius: 999px; padding: 2px; }
.mt-switch button { border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-mute); padding: 4px 11px; border-radius: 999px; cursor: pointer; }
.mt-switch button.active { background: var(--accent); color: #fff; }
.mt-thumb { display: none; }
.theme-rail button { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border-strong); cursor: pointer; }
.theme-rail button.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.sw-light { background: #f4f6f3; }
.sw-dark { background: #0d1512; }
.sw-sepia { background: #f6f1e6; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1000px) {
  .layout.has-rail { grid-template-columns: 1fr; }
  .rail { position: static; flex-direction: row; flex-wrap: wrap; }
  .rail-box { flex: 1 1 260px; }
}
@media (max-width: 760px) {
  h1 { font-size: 27px; }
  .hero { padding: 28px 22px; }
  .hero h1 { font-size: 30px; }
  .nav-toggle { display: block; order: 3; }
  .search-wrap { order: 4; max-width: none; flex-basis: 100%; margin-left: 0; }
  .topnav { display: none; flex-direction: column; gap: 2px; }
  .topnav.open { display: flex; }
  .navmenu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 8px 10px; min-width: 0; }
  .navmenu-blurb { display: none; }
  .navgroup-head { width: 100%; justify-content: space-between; }
  /* The rails stay on phones — hiding the View rail there made Guided mode,
     and every beginner explainer written for it, unreachable on mobile. */
  .rails { right: 8px; bottom: 8px; left: 8px; flex-direction: row; flex-wrap: wrap;
           justify-content: flex-end; gap: 6px; }
  .view-rail, .theme-rail { padding: 5px 10px; font-size: 11px; }
  .vr-label, .tr-label { display: none; }
  table.data th, table.data td { padding: 8px 10px; font-size: 13px; }
}

/* Language switcher — sits with the theme/view rails, appears only when a
   second language catalog exists. */
.lang-rail { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px;
  box-shadow: var(--shadow-lg); font-size: 12px; color: var(--ink-mute); }
.lang-rail select { font: inherit; font-size: 12px; border: 0; background: none;
  color: var(--ink); cursor: pointer; max-width: 140px; }
html[dir="rtl"] .rails { right: auto; left: 14px; align-items: flex-start; }
html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] .stat, html[dir="rtl"] .takeaways { border-left: 0; border-right: 3px solid var(--accent); }
html[dir="rtl"] table.data td.right, html[dir="rtl"] table.data th.right { text-align: left; }

/* Site-wide staleness alert: shown only when the daily refresh has missed more
   than two days, so it means something when it appears. */
.data-alert { background: var(--gold-soft); border-bottom: 1px solid var(--gold);
  color: var(--ink); font-size: 13.5px; padding: 9px 0; }
.data-alert strong { color: var(--gold); }

/* ---------------- Trust strip, Saved, portfolio strip ---------------- */
.trust-strip {
  display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 18px; margin: 0 0 22px; box-shadow: var(--shadow);
  font-size: 13.5px; color: var(--ink-soft);
}
.trust-item strong { color: var(--ink); font-weight: 650; }

.nav-saved {
  display: inline-flex; align-items: center; gap: 6px; margin-left: auto;
  padding: 8px 13px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  color: var(--ink-soft);
}
.nav-saved:hover { background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; }
.saved-badge {
  min-width: 19px; padding: 1px 6px; border-radius: 999px; text-align: center;
  background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700;
}

/* The star is a control, not decoration: it needs a real hit area and a focus
   ring, and it must read as pressed when the row is saved. */
.save-star {
  background: none; border: 0; cursor: pointer; line-height: 1;
  font-size: 17px; padding: 3px 6px; border-radius: 6px;
  color: var(--ink-mute); opacity: .55; transition: opacity .12s ease, color .12s ease;
}
.save-star:hover { opacity: 1; color: var(--gold); }
.save-star:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; opacity: 1; }
.save-star[aria-pressed="true"], .save-star.is-saved { opacity: 1; color: var(--gold); }
table.data th.save-col, table.data td.save-col { width: 34px; padding-left: 8px; padding-right: 4px; }

.portfolio-strip { margin: 22px 0 6px; padding-top: 18px; border-top: 1px solid var(--border); }
.portfolio-strip .ps-label {
  display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-mute); margin-bottom: 9px;
}
.portfolio-strip ul {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
}
.portfolio-strip a {
  display: block; padding: 9px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink);
}
.portfolio-strip a:hover { border-color: var(--accent); text-decoration: none; }
.portfolio-strip strong { display: block; font-size: 14px; font-weight: 600; }
.portfolio-strip span { display: block; font-size: 12.5px; color: var(--ink-mute); }

@media (max-width: 760px) {
  .nav-saved { margin-left: 0; }
  .trust-strip { font-size: 12.5px; gap: 6px 14px; }
}

/* Standalone nav tabs (AI Agents, Ask the Data, News) — same weight as a group
   head, but no dropdown, because each is a single destination. */
.navtab {
  display: inline-flex; align-items: center;
  padding: 8px 13px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; color: var(--ink-soft);
}
.navtab:hover { background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; }
.navtab.current { color: var(--accent-dark); background: var(--accent-soft); }

/* Outbound marker on a table row that leaves for a sibling property. */
table.data .ext { margin-left: 4px; font-size: 11px; color: var(--ink-mute); }

/* Pointer to a sibling property that covers a subject more deeply. */
.sibling-note {
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--gold); border-radius: var(--radius-sm);
  padding: 13px 16px; margin: 20px 0; max-width: 80ch;
}
.sibling-note p { margin: 0; font-size: 14.5px; }
.sibling-note .fineprint { margin-top: 5px; }

/* Section banner. Full-width of the content column, modest height, never a
   barrier to the first line of text. */
.section-banner {
  display: block; width: 100%; height: auto; max-height: 200px; object-fit: cover;
  border-radius: var(--radius); margin: 0 0 18px; box-shadow: var(--shadow);
}
@media (max-width: 760px) { .section-banner { max-height: 120px; margin-bottom: 14px; } }
