/* ==========================================================================
   Guides — page module for guides/ (the hub, every guide, and the 404)
   A guide loads it after article.css; the hub and the 404 after blog.css.
   It adds only what those two don't have: the breadcrumb, the short answer,
   the contents list, tables, callouts, message templates, the FAQ, sources,
   the glossary, and the hub's grouped index.
   ========================================================================== */

/* ---------- Breadcrumb ----------
   Rides in the article kicker, so it keeps the label recipe from base.css. */
.crumbs { display: flex; flex-wrap: wrap; align-items: baseline; }
.crumbs span { margin-inline: 0.55em; color: var(--ink-faint); }

/* ---------- The short answer ----------
   The first thing under the headline on every guide: the question answered in
   a paragraph, before any of the reasoning. Readers who stop here should
   leave with the right idea. */
.prose .answer {
  background: var(--paper-lift);
  border: 1px solid var(--line);
  border-left: 3px solid var(--thread);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-6);
  box-shadow: var(--hairline);
}
.prose .answer > * + * { margin-top: 0.8em; }
.prose .answer .answer-label {
  font-family: var(--font-sans);
  font-size: var(--fs-sm); letter-spacing: var(--tracking-label); text-transform: uppercase;
  line-height: 1.5; color: var(--thread-ink);
}
.prose .answer p { font-size: var(--fs-md); line-height: 1.65; }

/* ---------- In this guide ---------- */
.prose .toc {
  border-block: 1px solid var(--line);
  padding-block: var(--sp-5);
}
.prose .toc-label {
  font-family: var(--font-sans);
  font-size: var(--fs-sm); letter-spacing: var(--tracking-label); text-transform: uppercase;
  line-height: 1.5; color: var(--ink-faint);
  margin-bottom: var(--sp-3);
}
.prose .toc ol { list-style: none; padding-left: 0; counter-reset: toc; }
.prose .toc li {
  counter-increment: toc;
  font-size: var(--fs-ui); line-height: 1.45;
  margin-bottom: 0.45em;
  display: grid; grid-template-columns: 2.1em minmax(0, 1fr);
}
.prose .toc li::before {
  content: counter(toc, decimal-leading-zero);
  font-size: var(--fs-xs); color: var(--thread-ink); padding-top: 0.2em;
  font-variant-numeric: tabular-nums;
}
.prose .toc a { color: var(--ink-soft); text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .prose .toc a:hover { color: var(--thread); }
}

/* ---------- Links and small print inside the prose ---------- */
.prose li a { color: var(--thread); text-underline-offset: 3px; }
.prose .small { font-size: var(--fs-ui); color: var(--ink-soft); }

/* ---------- Tables ----------
   Wrapped so a wide table scrolls inside the column on a phone instead of
   pushing the page sideways. */
.prose .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--ink-faint);
}
.prose table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); line-height: 1.5; }
.prose caption {
  caption-side: bottom; text-align: left;
  font-family: var(--font-serif); font-style: italic; font-size: var(--fs-sm);
  color: var(--ink-faint); padding-top: var(--sp-3);
}
.prose th, .prose td {
  text-align: left; vertical-align: top;
  padding: 11px 14px 11px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-prose);
}
.prose thead th {
  font-weight: 500; font-size: var(--fs-sm); letter-spacing: 0.02em;
  color: var(--ink); white-space: nowrap;
}
.prose tbody th { font-weight: 500; color: var(--ink); }
.prose td.num, .prose th.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; padding-left: 14px; }
.prose tr.total td, .prose tr.total th { border-bottom: 0; border-top: 1px solid var(--ink-faint); font-weight: 500; color: var(--ink); }
/* Once there's room, a table steps out past the text column on both sides —
   still on the same centre line — so three columns aren't squeezed into a
   measure set for one. The article's wide rail has 12rem spare either side. */
@media (min-width: 1000px) {
  .prose .table-wrap { margin-inline: -6rem; }
}

/* ---------- Callout ---------- */
.prose .callout {
  background: var(--paper-warm);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-6);
}
.prose .callout > * + * { margin-top: 0.7em; }
.prose .callout p, .prose .callout li { font-size: var(--fs-base); line-height: 1.65; }
.prose .callout .callout-title {
  font-family: var(--font-sans); font-weight: 500;
  font-size: var(--fs-sm); letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--ink);
}

/* ---------- Message templates ----------
   Words somebody might actually send. Set like a note on a card rather than
   a quotation, because they're meant to be copied and changed. */
.prose .template {
  background: var(--paper-lift);
  border: 1px dashed var(--ink-faint);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-6);
}
.prose .template > * + * { margin-top: 0.75em; }
.prose .template .template-label {
  font-family: var(--font-sans);
  font-size: var(--fs-xs); letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--thread-ink); line-height: 1.5;
}
.prose .template p { font-family: var(--font-serif); font-size: var(--fs-md); line-height: 1.6; color: var(--ink); }

/* ---------- Worked example: a number and what it means ---------- */
.prose .worked {
  border-left: 2px solid var(--thread);
  padding-left: var(--sp-5);
}
.prose .worked > * + * { margin-top: 0.6em; }

/* ---------- FAQ ---------- */
.prose .faq-item { border-top: 1px solid var(--line); padding-top: var(--sp-5); margin-top: var(--sp-5); }
.prose .faq-item > * + * { margin-top: 0.7em; }
.prose .faq-item h3 { margin-top: 0; margin-bottom: 0; font-size: var(--fs-lg); }
.prose .faq-item p { font-size: var(--fs-base); line-height: 1.7; }

/* ---------- Sources ---------- */
.prose .sources { border-top: 1px solid var(--line); padding-top: var(--sp-5); margin-top: var(--sp-8); }
.prose .sources h2 {
  font-family: var(--font-sans); font-weight: 500;
  font-size: var(--fs-sm); letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--ink-faint); margin-top: 0;
}
.prose .sources li { font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-soft); }
.prose .sources a { color: var(--ink-soft); word-break: break-word; }

/* ---------- Glossary ---------- */
.prose dl.glossary dt {
  font-family: var(--font-serif); font-weight: 400;
  font-size: var(--fs-xl); line-height: 1.25; letter-spacing: -0.01em;
  margin-top: 1.9em; margin-bottom: 0.35em;
  scroll-margin-top: calc(var(--nav-h) + var(--sp-5));
}
.prose dl.glossary dd { font-size: var(--fs-md); line-height: 1.7; color: var(--ink-prose); }
.prose dl.glossary dd a { color: var(--thread); text-underline-offset: 3px; }
.prose dl.glossary dd + dd { margin-top: 0.6em; }
.prose .glossary-index { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); list-style: none; padding-left: 0; }
.prose .glossary-index li { font-size: var(--fs-ui); margin: 0; }

/* ---------- Read next: the heading is an h2 for the outline, sized as a label */
.read-next h2.rn-head { font-family: var(--font-sans); font-weight: 400; }

/* ---------- The hub ---------- */
.guide-groups { padding-block: var(--sp-7) var(--section); }
/* The groups already end on a full section of air; the call to action's own
   top margin, right for the end of an article, would double it here. */
.guide-groups + .end-cta { margin-top: 0; }
.guide-group {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 2fr);
  gap: var(--sp-6) clamp(32px, 5vw, 88px);
  padding-block: var(--sp-8);
  border-top: 1px solid var(--line);
}
.guide-group:first-child { border-top: 0; }
.gg-head h2 {
  font-weight: 300; font-size: var(--d-3);
  line-height: 1.1; letter-spacing: -0.02em;
  margin-bottom: var(--sp-4);
}
.gg-head p { font-size: var(--fs-base); line-height: 1.6; color: var(--ink-soft); max-width: 34ch; }
.guide-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-7) clamp(28px, 3vw, 48px);
}
.guide-card {
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  border-top: 2px solid var(--ink);
  padding-top: var(--sp-4);
}
.guide-card .c-meta { color: var(--thread-ink); margin-bottom: var(--sp-3); }
.guide-card h3 {
  font-weight: 400; font-size: var(--fs-xl);
  line-height: 1.2; letter-spacing: -0.012em;
  margin-bottom: var(--sp-3); transition: color .25s ease;
}
.guide-card p:last-child { font-size: var(--fs-ui); line-height: 1.6; color: var(--ink-soft); }
@media (hover: hover) and (pointer: fine) {
  .guide-card:hover { border-top-color: var(--thread); }
  .guide-card:hover h3 { color: var(--thread); }
}

/* ---------- The 404 ---------- */
.not-found { border-bottom: 0; min-height: calc(70svh - var(--nav-h)); }
.nf-links { list-style: none; margin-top: var(--sp-7); max-width: 40rem; border-top: 1px solid var(--line); }
.nf-links li {
  display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); gap: var(--sp-2) var(--sp-5);
  padding-block: var(--sp-4); border-bottom: 1px solid var(--line);
  font-size: var(--fs-ui); line-height: 1.5;
}
.nf-links a { color: var(--ink); font-weight: 500; text-decoration: none; }
.nf-links span { color: var(--ink-soft); }
@media (hover: hover) and (pointer: fine) {
  .nf-links a:hover { color: var(--thread); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .guide-group { grid-template-columns: minmax(0, 1fr); }
  .gg-head p { max-width: 54ch; }
}
@media (max-width: 620px) {
  /* A table of four or more columns can't share a phone's width without
     breaking every cell into single words, so it holds a readable width and
     scrolls inside its wrapper instead. Narrower tables still fit the column. */
  .prose table:has(tr > :nth-child(4)) { min-width: 36rem; }
  .guide-list { grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); }
  .prose .answer,
  .prose .callout,
  .prose .template { padding: var(--sp-4) var(--sp-5); }
  .nf-links li { grid-template-columns: minmax(0, 1fr); }
}
