/* House Regrets — base kit. Family aesthetic: warm paper, charcoal ink, and the
   family's carbon blue (#0043ce — same brand blue as wallstreetregrets).
   Tokens are law across the site. Mono for every readout and number. */
:root {
  --paper: #f6f3ee;
  --card: #ffffff;
  --ink: #17191c;
  --ink-soft: #3c4148;
  --ink-faint: #62676f;   /* 4.5:1+ on the warm paper — #6b7280 measured 4.37 */
  --line: #e0d9cf;
  --accent: #0043ce;
  --accent-ink: #ffffff;
  --good: #0b7a3b;
  --bad: #b3261e;
  --dark: #171310;
  --dark-ink: #e8eaed;
  --dark-soft: #9aa3ac;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 1060px; margin: 0 auto; padding: 0 1.25rem; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; margin: 2.4rem 0 0.9rem; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; margin: 1.6rem 0 0.5rem; }
p { margin: 0.6rem 0; max-width: 70ch; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); }
.fine { font-size: 0.8rem; color: var(--ink-faint); }

/* header */
.site-head {
  display: flex; align-items: baseline; gap: 2rem; flex-wrap: wrap;
  max-width: 1060px; margin: 0 auto; padding: 1.1rem 1.25rem;
}
.brand { color: var(--ink); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-sub { margin-left: 0.6rem; font-weight: 500; color: var(--ink-faint); font-size: 0.85rem; white-space: nowrap; }
/* the favicon badge, not a bare glyph: white serif $ on the accent square */
/* the badge IS the favicon: same svg markup inlined, so the two can never drift */
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 1.35em; height: 1.35em; background: transparent; margin-right: 0.45rem; vertical-align: -0.32em; /* measured optical center vs the wordmark (live sweep 2026-08-21: svg has no text baseline, so the box bottom sits ON the baseline — at 0.06em the badge rode 7px high; -0.32em measures -0.04px) */ }
.brand-mark svg { display: block; width: 100%; height: 100%; }
.site-head nav { display: flex; gap: 1.2rem; margin-left: auto; }
.site-head nav a { color: var(--ink-soft); font-size: 0.95rem; }
.site-head nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }

/* hero */
.hero { padding: 2.2rem 0 1.6rem; }
.hero h1 { max-width: 22ch; }
.hero .sub { color: var(--ink-soft); font-size: 1.05rem; max-width: 60ch; }

/* readout strip — the house signature */
.readout { background: var(--dark); color: var(--dark-ink); border-radius: 10px; margin: 1.2rem 0; padding: 0.2rem 0; }
.readout .mono { display: flex; flex-wrap: wrap; }
.readout .cell { display: flex; flex-direction: column; padding: 0.9rem 1.2rem; min-width: 8rem; border-right: 1px solid rgba(255,255,255,0.08); }
.readout .cell:last-child { border-right: none; }
.readout .k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--dark-soft); }
.readout .v { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.readout .v.up { color: #5fd08a; }
.readout .v.down { color: #f28b82; }

/* calculator */
.calc-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.4rem; align-items: stretch; }
/* three equal cards on wide screens; never a 2+1 orphan row */
.trio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; align-items: stretch; }
@media (max-width: 900px) { .trio-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .calc-grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem 1.3rem; }
.card h2 { margin-top: 0; font-size: 1.15rem; }
.field { margin: 0.9rem 0; }
.field label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.05em; }
.field input, .field select {
  /* 1rem = 16px minimum: below that, iOS Safari zooms the page on focus and the
     form appears to jump/misalign. */
  width: 100%; padding: 0.55rem 0.7rem; font: inherit; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.field input:focus-visible, .field select:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.field .hint { font-size: 0.75rem; color: var(--ink-faint); margin-top: 0.2rem; }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 8px; padding: 0.65rem 1.3rem; font: inherit; font-weight: 700; cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.filter-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.8rem 0; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 0.35rem 0.8rem; font-size: 0.85rem; color: var(--ink-soft); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* suggestion box */
.suggest { position: relative; }
.suggest-list { position: absolute; z-index: 10; background: #fff; border: 1px solid var(--line); border-radius: 8px; width: 100%; max-height: 16rem; overflow-y: auto; display: none; }
.suggest-list.open { display: block; }
.suggest-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0.5rem 0.7rem; cursor: pointer; font: inherit; font-size: 0.92rem; }
.suggest-list button:hover, .suggest-list button.sel { background: #eef1f8; }
.suggest-list .sym { font-family: var(--mono); font-weight: 700; margin-right: 0.5rem; }

/* tables */
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 0.9rem 0; }
table.data th, table.data td { padding: 0.55rem 0.7rem; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.data th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); border-bottom: 2px solid var(--ink); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td.mono, table.data .num { font-family: var(--mono); }
.pos { color: var(--good); }
.neg { color: var(--bad); }

/* year grid */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.6rem; margin: 1rem 0; }
.year-cell { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.18rem; color: var(--ink); }
.year-cell:hover { text-decoration: none; border-color: var(--accent); }
.year-cell .y { font-weight: 700; font-size: 0.95rem; }
.year-cell .v { font-family: var(--mono); font-size: 0.82rem; line-height: 1.35; color: var(--ink-soft); font-variant-numeric: tabular-nums; margin-top: auto; }

/* faq */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { padding: 0.8rem 0; cursor: pointer; font-weight: 700; font-size: 0.98rem; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::after { content: "+"; font-family: var(--mono); color: var(--accent); font-size: 1.2rem; padding-left: 1rem; }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { margin: 0 0 0.8rem; color: var(--ink-soft); max-width: 66ch; }

/* related list */
.related ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.6rem; }
.related li { display: flex; }
.related li a { display: flex; width: 100%; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.75rem; color: var(--ink); font-size: 0.9rem; line-height: 1.4; }
.related li a:hover { border-color: var(--accent); text-decoration: none; }

/* methodology / legal prose */
.methodology { background: #eceeeb; border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.3rem; margin: 1.6rem 0; }
.methodology h2 { margin-top: 0; }
.methodology p { font-size: 0.92rem; color: var(--ink-soft); }
.prose h2 { margin-top: 1.8rem; }
.prose ul { margin: 0.6rem 0 0.6rem 1.4rem; max-width: 70ch; }

/* story pages */
/* stories hub — neat equal-height card grid */
.story-grid { list-style: none; margin: 1.4rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.8rem; }
.story-grid li { display: flex; }
.story-card { display: flex; flex-direction: column; gap: 0.4rem; width: 100%; padding: 0.95rem 1.05rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; transition: border-color 0.15s ease, transform 0.15s ease; }
.story-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.story-card .sym { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); }
.story-card .story-title { font-weight: 600; line-height: 1.3; color: var(--ink); }

.story-hero { background: var(--dark); color: var(--dark-ink); border-radius: 10px; padding: 1.6rem 1.5rem; margin: 1.4rem 0; }
.story-hero h1 { color: var(--dark-ink); }
.story-hero .kicker { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; color: var(--dark-soft); margin-bottom: 0.6rem; }
.story-hero p { color: var(--dark-soft); }

/* share card */
.share-card { margin: 0.9rem 0; display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
/* Unstyled inputs fall back to the browser's 13px default; under 16px iOS zooms
   the page on focus. Flexes into the row so long URLs never overflow it. */
/* the url gets its own row; the three buttons wrap together beneath it */
.share-card input { flex: 1 1 100%; min-width: 0; font: inherit; font-size: 1rem; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.share-card canvas { display: none; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.story-card { display: block; color: var(--ink); text-decoration: none; }
.story-card:hover { text-decoration: none; border-color: var(--accent); }
.story-card h2 { margin: 0 0 0.5rem; font-size: 1.05rem; line-height: 1.35; }
.share-card .note { font-size: 0.8rem; color: var(--ink-faint); }

/* capital disclaimer strip */
.disclaimer {
  font-size: 0.8rem; color: var(--ink-faint); border-top: 1px solid var(--line);
  margin-top: 2.4rem; padding: 1rem 0; max-width: 100%;
}

/* footer */
.site-footer { max-width: 1060px; margin: 2.5rem auto 0; padding: 1.4rem 1.25rem 2.5rem; border-top: 1px solid var(--line); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 0.9rem; }
.site-footer nav a { color: var(--ink-soft); font-size: 0.9rem; }
.site-footer .fine { margin: 0.25rem 0; }

/* ad slots — shipped disabled; reserved, zero CLS */
.ad-slot { display: none; }

/* accessibility */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--accent); color: #fff; padding: 0.6rem 1rem; z-index: 100; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; }
::selection { background: var(--accent); color: #fff; }

/* interactive tables — progressive enhancement via kit/table.js */
.th-sort { display: inline-flex; align-items: center; gap: 0.35em; width: 100%; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: inherit; cursor: pointer; }
.th-sort:hover { color: var(--accent); }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
/* Touch devices get a taller sort target (WCAG 2.5.8 wants >=24px); desktop keeps its density. */
@media (pointer: coarse) { .th-sort { min-height: 28px; } }
.th-arrow::before { content: "\2195"; opacity: 0.3; font-size: 0.85em; font-family: var(--mono); }
[aria-sort="ascending"] .th-arrow::before { content: "\2191"; opacity: 1; color: var(--accent); }
[aria-sort="descending"] .th-arrow::before { content: "\2193"; opacity: 1; color: var(--accent); }
.table-filter { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.6rem; }
.table-filter input { font: inherit; padding: 0.35rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); max-width: 14rem; }
.table-filter input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.table-filter-count { font-size: 0.85em; color: var(--ink-faint); font-variant-numeric: tabular-nums; font-family: var(--mono); }

/* amount + currency selector row */
.amount-row { display: flex; gap: 0.5rem; }
.amount-row input { flex: 1 1 auto; min-width: 0; }
/* width:auto is load-bearing: .field select sets width:100%, and flex-basis:auto
   resolves to that width — a shrink-0 select at 100% basis fills the whole row and
   collapses the amount input to a sliver (the 2026-08-20 mobile bug report). */
.amount-row select { flex: 0 0 auto; width: auto; font: inherit; padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
.amount-row select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }