/* IDEE Wealth Portal — base stylesheet.
 * Restrained academic / institutional. Warm paper background, deep
 * ink-blue accent. Light mode only. Two type families. */

/* ── Self-hosted fonts (no third-party traffic) ─────────────────────────
   Newsreader serif + IBM Plex Sans, Latin + Latin-ext subsets only.
   Variable-weight axis covers 400/500/600; one file per (family, subset).
   unicode-range lets the browser fetch latin-ext only when accented
   glyphs are actually rendered. */

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/newsreader-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/newsreader-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}


:root {
  --bg:           #faf8f3;
  --surface:      #ffffff;
  --surface-alt:  #f4f1ea;
  --text:         #1a1a1a;
  --muted:        #555148;
  --muted-soft:   #807a6e;
  --rule:         #d8d3c4;
  --rule-soft:    #e6e1d4;
  --row-hover:    #f7f4ed;

  --accent:       #1f3556;
  --accent-hover: #142440;
  --accent-fg:    #ffffff;
  --accent-soft:  #e7ecf3;

  --danger:       #8a2a2a;
  --warn:         #a36a13;
  --focus-ring:   #1f3556;

  --radius-sm:    1px;
  --radius-md:    2px;

  --container-max: 1600px;

  --font-serif:
    "Newsreader", "Literata", "Charter", "Iowan Old Style",
    "Palatino Linotype", "Palatino", "Georgia", serif;
  --font-sans:
    "IBM Plex Sans", "Public Sans", "Aptos", "Segoe UI",
    system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}


/* ── Base ──────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body { min-height: 100%; }

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* body is a flex column, so main.container is a flex item.
   - min-width: 0 stops a wide child (chart canvas, etc.) from forcing
     main wider than the viewport on that tab only.
   - width: 100% stops main from shrinking *below* the viewport when its
     content's intrinsic min-content is small (Wealth chart toggles,
     Classifications dl rows) — otherwise the page reads as a narrow
     column on those tabs. */
main.container { flex: 1; min-width: 0; width: 80%; }

/* Home / landing page reads better at a tighter column, with a
   pixel floor so the chart/table don't collapse on smaller viewports. */
body.page-home main.container { width: max(60%, 800px); }

img, svg, canvas { max-width: 100%; height: auto; display: block; }

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}


/* ── Typography ────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.2;
  margin: 0 0 0.65em;
  color: var(--text);
}

h1 { font-size: 2.05rem; letter-spacing: -0.012em; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem;  font-weight: 600; }
h4 { font-size: 1rem;    font-weight: 600; }

p { margin: 0 0 1rem; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-offset: 0.15em;
}

a:hover { color: var(--accent-hover); }

strong, b { font-weight: 600; }

code, kbd, samp, pre {
  font-family: ui-monospace, "Consolas", "Monaco", monospace;
  font-size: 0.92em;
}

.lede {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 2rem;
  line-height: 1.5;
}

.muted      { color: var(--muted); }
.muted-soft { color: var(--muted-soft); }
.small      { font-size: 0.875rem; }


/* ── Focus visibility ──────────────────────────────────────────────── */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}


/* ── Header ────────────────────────────────────────────────────────── */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

/* Three-track grid: brand | search | user-nav. Side tracks are equal width
   (both 1fr), so the auto-sized search column lands at the container's
   true horizontal center regardless of brand/user-nav text widths. */
.site-header .container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.site-header .brand        { justify-self: start; }
.site-header .header-search { justify-self: center; }
.site-header .user-nav     { justify-self: end; }

.header-search {
  display: flex;
  justify-content: center;
  width: 560px;
  /* Optical alignment: the serif brand text's visual center sits below the
     glyph's mathematical center, so a flex-centered input reads as "above"
     the brand text. Nudging the input down lines the input's visual center
     with the text's visual center. */
  position: relative;
  top: 12px;
}

.search-box--header {
  width: 100%;
  max-width: 560px;
  margin: 0;
}

.search-box--header input[type="search"] {
  padding: 0.32rem 0.75rem;
  font-size: 0.9rem;
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover { color: var(--text); }

.user-nav {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.92rem;
  min-width: 0;
}

.user-name {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.user-nav a {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.user-nav a:hover { text-decoration: underline; }


/* ── Main ──────────────────────────────────────────────────────────── */

main.container {
  padding-top: 2.25rem;
  padding-bottom: 3rem;
}


/* ── Landing page ──────────────────────────────────────────────────── */

h1.welcome {
  font-size: 1.4rem;
  font-weight: 500;
  margin: 0 0 1.5rem;
  color: var(--text);
}

.chart-card {
  margin: 2rem 0 2.5rem;
  padding: 1.25rem 1.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
}

.chart-card h2,
.chart-card .chart-card-title {
  font-size: 1.25rem;
  margin: 0 0 1rem;
}

.chart-card-subtitle {
  font-size: 0.9rem;
  font-weight: 400;
  margin: -0.9rem 0 1rem;
}

.top25-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.top25-table th,
.top25-table td {
  padding: 0.55rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
}

.top25-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.top25-table td.num,
.top25-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.top25-table tbody tr:hover { background: var(--row-hover); }
.top25-table tbody tr:last-child td { border-bottom: none; }

.top25-table .up   { color: #2f7d32; font-variant-numeric: tabular-nums; }
.top25-table .down { color: #8a2a2a; font-variant-numeric: tabular-nums; }


/* ── Rich list browser ─────────────────────────────────────────────── */

.lists-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 0;
}

.list-card {
  display: block;
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
}

.list-card:hover,
.list-card:focus-visible {
  background: var(--row-hover);
  border-color: var(--muted-soft);
}

.list-card h3 {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 1.1rem;
}

.list-card p { margin: 0; font-size: 0.92rem; }

.list-header { margin: 0 0 1.5rem; }
.list-header h1 { margin: 0 0 0.5rem; }
.list-header p { margin: 0 0 0.2rem; font-size: 0.92rem; }

.list-meta-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
}

.list-year-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.list-year-picker select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.list-table th,
.list-table td {
  padding: 0.5rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
}

.list-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  background: var(--bg);
  user-select: none;
}

.list-table th.sort-asc::after  { content: " ↑"; }
.list-table th.sort-desc::after { content: " ↓"; }

.list-table td.num,
.list-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.list-table tbody tr:hover { background: var(--row-hover); }
.list-table tbody tr:last-child td { border-bottom: none; }


/* ── Data Explorer (POC) ───────────────────────────────────────────── */

.page-explorer main.container { width: 95%; }  /* explorer wants the room */

.explorer-root { width: 100%; }

.explorer-stepper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.explorer-stepper .stage-num {
  display: inline-block;
  font-weight: 600;
  margin-right: 0.3rem;
  color: var(--accent);
}

.explorer-stepper .stage-sep { color: var(--muted-soft); }

.explorer-form {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  min-width: 0;
}

.explorer-sidebar { min-width: 0; }
.explorer-canvas { min-width: 0; }

.explorer-section { margin-bottom: 1.5rem; }

.explorer-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.var-category { margin-bottom: 0.75rem; }

.var-category-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0.4rem 0 0.25rem;
}

.var-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.var-list li label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.18rem 0;
  cursor: pointer;
}

.var-label { font-size: 0.94rem; }

.explorer-run {
  appearance: none;
  -webkit-appearance: none;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.5rem;
}

.explorer-run:hover { background: var(--accent-hover); }

.explorer-placeholder {
  margin: 2rem 0;
  font-size: 0.95rem;
}

.filter-widget { margin-bottom: 0.85rem; }

.filter-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.filter-widget input[type="text"],
.filter-widget input[type="number"] {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.filter-widget input[type="text"] { width: 100%; }
.filter-widget input[type="number"] { width: 5.5rem; }

.filter-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.92rem;
  cursor: pointer;
}

.explorer-result-summary {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.explorer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.explorer-table th,
.explorer-table td {
  padding: 0.5rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}

.explorer-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  background: var(--bg);
  white-space: nowrap;
}

.explorer-table tbody tr:hover { background: var(--row-hover); }


/* ── Search box + suggestion dropdown ──────────────────────────────── */

.search-box {
  position: relative;
  max-width: 540px;
  margin: 0 0 2rem;
}

.search-box input[type="search"] {
  width: 100%;
  font-size: 1rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: var(--radius-md);
}

.search-box input[type="search"]:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.suggest-wrap {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
}

.suggest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  max-height: 360px;
  overflow-y: auto;
}

.suggest-list li {
  border-bottom: 1px solid var(--rule-soft);
}

.suggest-list li:last-child { border-bottom: none; }

.suggest-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
  color: var(--text);
}

.suggest-list a:hover,
.suggest-list a:focus-visible {
  background: var(--row-hover);
  outline: none;
}

.suggest-name {
  font-weight: 500;
}

.suggest-meta {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.suggest-flag {
  display: inline-block;
  margin-left: 0.4em;
  width: 1.1em;
  height: 1.1em;
  border-radius: 50%;
  border: 1px solid var(--warn);
  color: var(--warn);
  font-size: 0.7rem;
  text-align: center;
  line-height: 1.1em;
  cursor: help;
}

.suggest-empty {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}


/* ── Landing cards ─────────────────────────────────────────────────── */

.landing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 0;
}

@media (max-width: 880px) {
  .landing-grid { grid-template-columns: 1fr; }
}

.landing-card {
  display: block;
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.landing-card:hover,
.landing-card:focus-visible {
  background: var(--row-hover);
  border-color: var(--muted-soft);
  color: var(--text);
}

.landing-card h3 {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1.25;
}

.landing-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}


/* ── Tables ────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  font-feature-settings: "tnum", "kern";
}

thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.75rem;
  border-bottom: 1.5px solid var(--text);
  white-space: nowrap;
}

tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}

tbody tr:hover td { background: var(--row-hover); }

td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  white-space: nowrap;
}


/* ── Forms / inputs / buttons ──────────────────────────────────────── */

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder,
textarea::placeholder { color: var(--muted-soft); }

.btn {
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  display: inline-block;
  padding: 0.55rem 1.1rem;
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  text-decoration: none;
  line-height: 1.2;
  transition: background-color 0.12s ease, color 0.12s ease,
              border-color 0.12s ease;
}

button { all: unset; }
button { /* re-apply .btn-like baseline on real button elements */
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  display: inline-block;
  padding: 0.55rem 1.1rem;
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  line-height: 1.2;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.btn:hover,
button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-fg);
}

.btn[disabled],
button[disabled] {
  background: var(--muted-soft);
  border-color: var(--muted-soft);
  cursor: not-allowed;
}

.btn-quiet {
  background: transparent;
  color: var(--accent);
  border-color: var(--rule);
}

.btn-quiet:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}


/* ── Login page ────────────────────────────────────────────────────── */

/* The login page is vertically centered. The header is suppressed on
   /login (see base.html), so the title page below carries the brand. */
body.page-login main.container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 6rem);
}

.login {
  max-width: 520px;
  margin: 0;
  text-align: left;
}

.login-kicker {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.login-title {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

/* Layout extras on top of .btn — markup is class="btn google-button". */
.google-button {
  display: inline-block;
  margin: 0.5rem 0 0;
  padding: 0.65rem 1.4rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.login-notice {
  margin: 2.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted-soft);
  text-align: left;
}


/* ── Person profile ────────────────────────────────────────────────── */

.person-header {
  margin: 0 0 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.person-header h1 {
  margin: 0 0 0.6rem;
}

.person-facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem 2rem;
  margin: 0;
}

.person-facts > div { margin: 0; }

.person-facts dt {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.person-facts dd {
  margin: 0;
  font-size: 0.98rem;
}

.source-badge {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.78rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-md);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--rule);
  margin: 0 0 1.5rem;
}

.tab {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0.55rem 0.9rem;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

.tab[aria-disabled="true"],
.tab:disabled {
  background: transparent;
  color: var(--muted-soft);
  cursor: default;
  pointer-events: none;
  opacity: 1;
}

.tab-panel {
  padding-top: 1.25rem;
  min-width: 0;
}

.bio-source-block {
  margin-bottom: 2rem;
}

.bio-source-header {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}

.bio-source-tag {
  font-size: 0.8rem;
  font-weight: 400;
}

.bio-subhead {
  font-size: 0.95rem;
  margin: 1.25rem 0 0.4rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.bio-list {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
}

.bio-list li { margin-bottom: 0.25rem; }

.bio-milestone-year {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
  margin-right: 0.35rem;
}

.bio-prose {
  margin: 0 0 0.5rem;
  /* Readable measure when there's room; never wider than the parent. */
  max-width: min(75ch, 100%);
  min-width: 0;
  overflow-wrap: break-word;
  line-height: 1.55;
}

.bio-quote {
  margin: 0 0 0.75rem;
  padding-left: 0.85rem;
  border-left: 3px solid var(--rule);
  font-style: italic;
  color: var(--muted);
}

.wealth-controls {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.series-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.series-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.25;
}

.series-name {
  font-weight: 500;
}

.series-meta {
  font-size: 0.85rem;
}


.swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
}

.swatch-forbes    { background: #1f3556; }
.swatch-bloomberg { background: #8a6a2a; }

.wealth-range {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.75rem 0 0.75rem;
  font-size: 0.9rem;
}

.wealth-range-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.range-label {
  min-width: 4rem;
}

.range-date {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.2rem 0.4rem;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
}

.range-btn {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.2rem 0.55rem;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.range-btn:hover {
  color: var(--text);
  background: var(--row-hover);
}

.range-btn.active {
  color: var(--text);
  border-color: var(--accent);
  background: transparent;
  font-weight: 500;
}

.wealth-chart-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 360px;
}


/* ── Error pages ───────────────────────────────────────────────────── */

.error-page {
  max-width: 480px;
  margin: 4rem auto;
  text-align: center;
}

.error-page h1 { margin-bottom: 0.6rem; }


/* ── Dev-mode bypass ───────────────────────────────────────────────── */

.dev-bypass {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--surface-alt);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-md);
}

.dev-bypass h3 {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.6rem;
}

.dev-bypass ul { margin: 0; padding: 0; list-style: none; }
.dev-bypass li { margin: 0.2rem 0; font-size: 0.9rem; }
.dev-bypass a  { color: var(--accent); text-decoration: none; }
.dev-bypass a:hover { text-decoration: underline; }


/* ── Prose (long-form pages) ───────────────────────────────────────── */

.prose {
  max-width: 68ch;
  line-height: 1.7;
}

.prose h2 { margin-top: 2.2rem; }
.prose h3 { margin-top: 1.8rem; }
.prose p, .prose ul, .prose ol { margin-bottom: 1.1em; }

.prose blockquote {
  margin: 1.25rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
  font-family: var(--font-serif);
  font-style: italic;
}


/* ── Footer ────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  background: var(--surface);
}

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  background: var(--surface);
}

.site-footer .container {
  padding-top: 0.9rem;
  padding-bottom: 1rem;
}

.site-footer p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted-soft);
}


/* ── Narrow viewports ──────────────────────────────────────────────── */

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }

  .container { padding: 0 1.1rem; }

  .site-header .container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .site-header .brand,
  .site-header .header-search,
  .site-header .user-nav { justify-self: stretch; width: 100%; }

  .header-search { width: 100%; }
  .search-box--header { max-width: none; }
  .user-nav { width: 100%; justify-content: space-between; }
  .user-name { max-width: 100%; }

  main.container { padding-top: 2rem; }
}


/* ── Reduced motion ────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
