/* ==========================================================================
   Base — content layer
   Article, hub, glossary and calculator pages. Loads AFTER site.css and reuses
   its nav, buttons, pills and type ramp; nothing here restyles those.

   One structural rule worth stating: measure is capped at 68 characters on
   prose and released on tables. A 1180px-wide paragraph is unreadable, and a
   68ch-wide comparison table is unusable.
   ========================================================================== */

/* -------------------------------------------------------------- shells --- */

.doc, .hub { padding-top: calc(var(--nav-h) + clamp(26px, 4vw, 48px)); padding-bottom: clamp(64px, 8vw, 110px); }
.doc__in { max-width: 1180px; }

.crumbs ol {
  display: flex; flex-wrap: wrap; gap: 8px;
  list-style: none; margin: 0 0 clamp(24px, 3vw, 38px); padding: 0;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line-2); }
.crumbs a { color: var(--ink-3); transition: color .2s ease; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink-2); }

.doc__head { max-width: 22ch; margin-bottom: clamp(28px, 3.5vw, 44px); }
.doc__head .tag { display: block; margin-bottom: 16px; }
.doc__head h1 { max-width: 17ch; }
.doc__meta { display: block; margin-top: 20px; }
@media (min-width: 900px) { .doc__head { max-width: none; } .doc__head h1 { max-width: 20ch; } }

/* ------------------------------------------------------- answer block ---- */

/* The first paragraph, promoted. Answer-first writing means this is the block
   an engine is most likely to quote, so it is visually separated and carries
   the `speakable` selector named in the page's structured data. */
.answer {
  max-width: 62ch;
  margin: 0 0 clamp(30px, 4vw, 46px);
  padding: clamp(20px, 2.4vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  border-radius: var(--r-md);
}
.answer .tag { display: block; margin-bottom: 12px; }
.answer p:last-child { margin: 0; font-size: 17px; line-height: 1.62; letter-spacing: -0.014em; }

/* ---------------------------------------------------------------- toc ---- */

.toc {
  max-width: 62ch;
  margin: 0 0 clamp(30px, 4vw, 44px);
  padding-block: 20px;
  border-block: 1px solid var(--line);
}
.toc .tag { display: block; margin-bottom: 14px; }
.toc ol {
  margin: 0; padding: 0; list-style: none;
  counter-reset: toc;
  display: grid; gap: 7px;
}
.toc li { counter-increment: toc; display: flex; gap: 12px; }
.toc li::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  padding-top: 3px; flex: none;
}
.toc a { font-size: 15px; color: var(--ink-2); transition: color .2s ease; }
.toc a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------- prose --- */

.prose { max-width: 68ch; }
.prose > * { max-width: 68ch; }

.md-p { margin: 0 0 1.15em; font-size: 16.5px; line-height: 1.68; color: #18181B; text-wrap: pretty; }
.prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; transition: text-decoration-color .2s ease; }
.prose a:hover { text-decoration-color: var(--ink); }

.md-h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(24px, 2.3vw, 31px); letter-spacing: -0.03em; line-height: 1.14;
  margin: clamp(40px, 4.6vw, 62px) 0 18px;
  scroll-margin-top: calc(var(--nav-h) + 24px);
  text-wrap: balance;
}
.md-h3 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(18px, 1.6vw, 21px); letter-spacing: -0.022em;
  margin: clamp(28px, 3vw, 38px) 0 12px;
  scroll-margin-top: calc(var(--nav-h) + 24px);
}
.md-h4 { font-size: 16px; font-weight: 600; margin: 26px 0 10px; }

.md-list { margin: 0 0 1.3em; padding-left: 1.25em; display: grid; gap: 9px; }
.md-list li { font-size: 16.5px; line-height: 1.62; color: #18181B; padding-left: 4px; }
.md-list li::marker { color: var(--ink-3); }

.md-quote {
  margin: clamp(26px, 3vw, 34px) 0;
  padding: 20px 24px;
  background: var(--tint-amber);
  border-radius: var(--r-md);
  font-size: 16.5px; line-height: 1.6; color: #2A2418;
}

.md-hr { height: 1px; background: var(--line); border: 0; margin: clamp(34px, 4vw, 48px) 0; }

.md-pre {
  margin: 0 0 1.4em;
  padding: 18px 20px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow-x: auto;
}
.md-pre code { font-family: var(--font-mono); font-size: 13px; line-height: 1.7; color: #27272A; white-space: pre; }
.prose code, .faq code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-2); padding: 2px 5px; border-radius: 5px; }
.md-pre code { background: none; padding: 0; }

/* Tables break the measure on purpose — a comparison table squeezed to 68
   characters is a table nobody can read. */
.md-tablewrap { max-width: none; margin: 0 0 1.5em; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.md-table { border-collapse: collapse; width: 100%; min-width: 460px; font-size: 15px; }
.md-table th, .md-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.md-table th {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
  border-bottom-color: var(--line-2); white-space: nowrap;
}
.md-table tbody tr:last-child td { border-bottom: 0; }
.md-table td { line-height: 1.5; color: #18181B; }
.md-table strong { font-weight: 600; }

/* ----------------------------------------------------------------- faq --- */

.faq { max-width: 68ch; margin-top: clamp(46px, 5vw, 68px); }
.faq__item { padding: 22px 0; border-top: 1px solid var(--line); }
.faq__item:last-child { border-bottom: 1px solid var(--line); }
.faq__q { font-size: 17px; font-weight: 600; letter-spacing: -0.018em; margin-bottom: 9px; }
.faq__a { margin: 0; font-size: 16px; line-height: 1.62; color: var(--ink-2); }

/* ------------------------------------------------------------- cta band -- */

.cta-band {
  margin: clamp(52px, 6vw, 84px) 0 0;
  padding: clamp(30px, 4vw, 48px);
  background: var(--tint-blue);
  border-radius: var(--r-xl);
}
.cta-band__in { max-width: 54ch; }
.cta-band .lede { margin: 14px 0 0; color: #3F4A5F; }
.cta-band__row { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px; }

/* ------------------------------------------------------------- related --- */

.rel { margin-top: clamp(46px, 5vw, 68px); }
.rel .tag { display: block; margin-bottom: 18px; }
.rel__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.rel__card {
  display: block; padding: 22px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .2s ease, transform .2s cubic-bezier(.22,1,.36,1);
}
.rel__card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.rel__card .tag { margin-bottom: 12px; }
.rel__title { margin: 0 0 8px; font-size: 16px; font-weight: 600; letter-spacing: -0.016em; line-height: 1.32; }
.rel__desc { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
@media (max-width: 820px) { .rel__grid { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------------- hub --- */

.hub__head { max-width: 24ch; margin-bottom: clamp(36px, 4.5vw, 60px); }
.hub__head .tag { display: block; margin-bottom: 16px; }
.hub__head h1 { max-width: 18ch; }
.hub__head .lede { margin-top: 18px; max-width: 56ch; }
@media (min-width: 900px) { .hub__head { max-width: none; } }

.hub__group { margin-bottom: clamp(36px, 4vw, 56px); }
.hub__group h2 { margin-bottom: 18px; }
.hub__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.hub__list li { border-bottom: 1px solid var(--line); }
.hub__list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: clamp(12px, 2.4vw, 40px);
  align-items: baseline;
  padding: clamp(17px, 2vw, 24px) 0;
  transition: background .22s ease, padding-inline .22s ease;
}
.hub__list a:hover { background: rgba(9,9,11,.02); padding-inline: 12px; }
.hub__title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.hub__desc { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
@media (max-width: 760px) { .hub__list a { grid-template-columns: 1fr; gap: 8px; } }

/* ------------------------------------------------------------ glossary --- */

.gl__index { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 24px; }
.gl__index a {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-2);
  transition: border-color .2s ease, color .2s ease;
}
.gl__index a:hover { border-color: var(--ink); color: var(--ink); }

.gl__group { margin-bottom: clamp(30px, 3.5vw, 46px); }
.gl__group h2 { margin-bottom: 16px; scroll-margin-top: calc(var(--nav-h) + 24px); color: var(--ink-3); }
.gl__item { padding: 20px 0; border-top: 1px solid var(--line); max-width: 74ch; scroll-margin-top: calc(var(--nav-h) + 24px); }
.gl__term { font-size: 17px; font-weight: 600; letter-spacing: -0.018em; margin-bottom: 8px; }
.gl__short { margin: 0; font-size: 16px; line-height: 1.6; }
.gl__long { margin: 10px 0 0; font-size: 15px; line-height: 1.62; color: var(--ink-2); }
.gl__see { margin: 10px 0 0; }
.gl__see a { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.gl__see a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* --------------------------------------------------------- calculators --- */

.calcbox {
  max-width: 68ch;
  margin: 0 0 clamp(36px, 4vw, 52px);
  padding: clamp(22px, 2.6vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  display: grid; gap: 16px;
}
.calcbox__field { display: grid; gap: 6px; }
.calcbox__label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.calcbox input, .calcbox select {
  font: inherit; font-size: 16px;
  height: 44px; padding: 0 13px;
  background: var(--bg);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  width: 100%;
}
.calcbox input:focus, .calcbox select:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.calcbox__hint { font-size: 12.5px; color: var(--ink-3); }
.calcbox__out { display: block; margin-top: 6px; padding-top: 20px; border-top: 1px solid var(--line); }
.calcbox__note { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-3); }

@media (min-width: 640px) {
  .calcbox { grid-template-columns: 1fr 1fr; }
  .calcbox__out, .calcbox__note { grid-column: 1 / -1; }
}

.calcout__big {
  margin: 0 0 18px;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 4vw, 48px); letter-spacing: -0.04em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.calcout__big span { font-family: var(--font-ui); font-size: 15px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink-3); }

.calcout__table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.calcout__table td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.calcout__table tr:last-child td { border-bottom: 0; }
.calcout__table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; padding-inline: 14px; }
.calcout__table .hint { color: var(--ink-3); font-size: 13px; line-height: 1.45; }

.calcout__note { margin: 16px 0 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.calcout__note--warn { color: #8A4B1E; }
.calcout__err { margin: 0; font-size: 15px; color: #8A2E1E; }

.calcout__verdict { margin: 0 0 16px; font-size: 15px; line-height: 1.55; padding: 12px 15px; border-radius: var(--r-sm); }
.calcout__verdict--good { background: var(--tint-green); color: #1E4A2E; }
.calcout__verdict--ok   { background: var(--tint-blue);  color: #23385E; }
.calcout__verdict--warn { background: var(--tint-amber); color: #6E4A12; }
.calcout__verdict--low  { background: var(--tint-amber); color: #6E4A12; }
.calcout__verdict--high { background: #FBF0EE; color: #7A2E1C; }

/* -------------------------------------------------------------- footer --- */

.foot { padding: clamp(48px, 6vw, 76px) 0 clamp(30px, 4vw, 44px); border-top: 1px solid var(--line); background: var(--surface); }
.foot__grid { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: clamp(24px, 3vw, 48px); margin-bottom: clamp(34px, 4vw, 50px); }
.foot__brand .lede { margin: 16px 0 14px; max-width: 30ch; font-size: 15px; }
.foot__col .tag { display: block; margin-bottom: 14px; }
.foot__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.foot__col a { font-size: 14.5px; color: var(--ink-2); transition: color .2s ease; }
.foot__col a:hover { color: var(--ink); }
.foot__legal { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; padding-top: 22px; }
@media (max-width: 860px) { .foot__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .foot__grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ dark mode -- */

/* The landing page is light-only by design (`color-scheme: light` in base.css).
   Content pages inherit that. What they do add is a print stylesheet, because
   a 2,000-word reference page is a thing people print and hand to a coach. */
@media print {
  .nav, .cta-band, .rel, .foot, .skip-link, .toc { display: none !important; }
  .doc, .hub { padding-top: 0; }
  .prose, .answer { max-width: none; }
  .md-h2, .md-h3 { break-after: avoid; }
  .md-tablewrap, .md-pre, .faq__item { break-inside: avoid; }
  a[href^="/"]::after { content: " (trybase.app" attr(href) ")"; font-size: .8em; color: #666; }
}
