/* Guides: article pages and the guides hub. Built on the tokens in /styles.css.
   Motif: ledger paper. Ruled lines in the hero, single rule over totals and a double rule under them. */

/* ---------- hero ---------- */
.g-hero { position: relative; overflow: clip; padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(2.5rem, 6vw, 4rem); }
.g-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 31px, rgb(255 255 255 / .05) 31px 32px);
  -webkit-mask-image: linear-gradient(100deg, transparent 20%, #000 75%);
  mask-image: linear-gradient(100deg, transparent 20%, #000 75%);
}
.g-hero::after { content: ""; position: absolute; inset: -30% -15% auto 45%; height: 140%; background: radial-gradient(closest-side, rgb(94 224 168 / .13), transparent); pointer-events: none; }
.g-hero .wrap { position: relative; z-index: 1; }
.g-hero .wrap > * { animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
.g-hero .wrap > :nth-child(2) { animation-delay: 60ms; }
.g-hero .wrap > :nth-child(3) { animation-delay: 120ms; }
.g-hero .wrap > :nth-child(4) { animation-delay: 180ms; }
.g-hero .wrap > :nth-child(5) { animation-delay: 240ms; }

.crumbs ol { list-style: none; margin: 0 0 clamp(1rem, 3vw, 1.75rem); padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 .5rem; font-size: .875rem; color: var(--band-ink-3); }
.crumbs li + li::before { content: "/"; margin-right: .5rem; color: #55554f; }
.crumbs a { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--band-ink-2); text-decoration: none; font-weight: 600; }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--band-ink-3); }

.g-title { max-width: 22ch; margin-bottom: 1.25rem; font-size: clamp(2.2rem, 1.35rem + 3.4vw, 3.75rem); font-weight: 800; line-height: 1; letter-spacing: -0.045em; text-wrap: balance; }
.g-hero .lede { max-width: 42rem; margin-bottom: 1.75rem; }
.g-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin: 0; padding-top: 1.1rem; border-top: 3px double #3a3a37; font-size: .875rem; color: var(--band-ink-3); max-width: 42rem; }
.g-meta > span { display: inline-flex; align-items: center; white-space: pre; }
.g-meta svg { margin-right: .45rem; width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.g-meta .chip { font-size: .75rem; }

/* ---------- layout: table of contents + article ---------- */
.g-layout { display: grid; gap: 1.75rem; padding-top: clamp(1.75rem, 5vw, 3.5rem); }
@media (min-width: 1040px) {
  .g-layout { grid-template-columns: 15.5rem minmax(0, 1fr); gap: 4.5rem; align-items: start; }
  .g-toc { position: sticky; top: 5.75rem; max-height: calc(100dvh - 7rem); overflow-y: auto; }
}

.g-toc { padding: 1.1rem 1.25rem .6rem; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); font-size: .92rem; }
@media (min-width: 1040px) { .g-toc { padding: 0 0 0 1.1rem; border-radius: 0; background: none; box-shadow: none; border-left: 1px solid var(--line-strong); } }
.g-toc-h { margin: 0 0 .25rem; font: 700 .75rem/1.2 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.g-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.g-toc li { counter-increment: toc; }
.g-toc a { display: flex; align-items: center; gap: .7rem; min-height: 2.75rem; padding-block: .3rem; color: var(--ink-2); text-decoration: none; line-height: 1.3; }
.g-toc a::before { content: counter(toc, decimal-leading-zero); flex: none; width: 1.4rem; font: 800 .75rem/1 var(--font-display); color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.g-toc a:hover { color: var(--ink); }
.g-toc li + li a { border-top: 1px solid var(--line); }
@media (min-width: 1040px) { .g-toc li + li a { border-top: 0; } }

/* ---------- article typography ---------- */
.g-article { min-width: 0; max-width: 68ch; font-size: 1.0625rem; line-height: 1.7; counter-reset: sec; }
.g-article > p, .g-article li { color: var(--ink-2); }
.g-article strong { color: var(--ink); font-weight: 700; }
.g-article a:not(.btn) { color: var(--accent-strong); font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.g-article a:not(.btn):hover { text-decoration-thickness: 2px; }
.g-article > h2 { margin: 3.25rem 0 1rem; font-size: clamp(1.6rem, 1.3rem + 1.1vw, 2.1rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.035em; scroll-margin-top: 6rem; text-wrap: balance; }
.g-article > h2:first-child { margin-top: 0; }
.g-article > h2::before { counter-increment: sec; content: counter(sec, decimal-leading-zero); display: block; margin-bottom: .55rem; font: 800 .85rem/1 var(--font-display); letter-spacing: 0; color: var(--accent-strong); }
.g-article h3 { margin: 2.1rem 0 .6rem; font-size: 1.25rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.025em; scroll-margin-top: 6rem; }
.g-article > ul:not([class]), .g-article > ol:not([class]) { margin: 0 0 1.25rem; padding-left: 1.3rem; }
.g-article > ul:not([class]) li, .g-article > ol:not([class]) li { margin-bottom: .45rem; padding-left: .2rem; }
.g-article > ul:not([class]) li::marker { color: var(--accent-strong); }
.g-article > ol:not([class]) li::marker { color: var(--accent-strong); font-weight: 700; }
.g-article code { padding: .1rem .35rem; border-radius: 6px; background: var(--card-2); font-size: .88em; }
.g-article .lead-in { font-size: 1.15rem; color: var(--ink); }

/* numbered steps with a big figure in the gutter */
.g-steps { list-style: none; margin: 1.25rem 0 1.75rem; padding: 0; counter-reset: step; display: grid; gap: .75rem; }
.g-steps > li { counter-increment: step; position: relative; padding: 1.1rem 1.2rem 1.1rem 3.6rem; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); color: var(--ink-2); }
.g-steps > li::before { content: counter(step); position: absolute; left: 1.15rem; top: .95rem; font: 800 1.6rem/1 var(--font-display); letter-spacing: -0.04em; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.g-steps > li > strong:first-child { display: block; margin-bottom: .15rem; font-family: var(--font-display); font-size: 1.05rem; letter-spacing: -0.015em; }

/* checklist: empty boxes, for the reader to tick */
.g-check { list-style: none; margin: 1rem 0 1.75rem; padding: 1rem 1.25rem; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.g-check li { position: relative; margin: 0; padding: .55rem 0 .55rem 2.1rem; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.g-check li:last-child { border-bottom: 0; }
.g-check li::before { content: ""; position: absolute; left: 0; top: .9rem; width: 1.15rem; height: 1.15rem; border: 2px solid var(--accent-strong); border-radius: 5px; }

/* ---------- tables: ledger style ---------- */
.g-fig { margin: 1.5rem 0 1.75rem; }
.g-tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.gt { width: 100%; border-collapse: collapse; font-size: .82rem; line-height: 1.4; font-variant-numeric: tabular-nums; }
.gt caption { padding: 1rem 1rem .35rem; text-align: left; font: 700 .95rem/1.3 var(--font-display); letter-spacing: -0.01em; color: var(--ink); }
.gt caption span { display: block; margin-top: .2rem; font: 500 .78rem/1.4 var(--font-sans); letter-spacing: 0; color: var(--ink-3); }
.gt th, .gt td { padding: .6rem .55rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.gt th:first-child, .gt td:first-child { padding-left: 1rem; text-align: left; }
.gt th:last-child, .gt td:last-child { padding-right: 1rem; }
.gt thead th { font-size: .72rem; font-weight: 700; color: var(--ink-3); vertical-align: bottom; }
.gt tbody th { font-weight: 500; white-space: normal; min-width: 6.5rem; color: var(--ink); }
.gt td { color: var(--ink-2); }
.gt .e { color: var(--elim); }
.gt td.e { background: var(--elim-soft); }
.gt td.c { color: var(--ink); font-weight: 700; }
.gt .l { text-align: left; white-space: normal; }
.gt tr.sub > * { font-weight: 700; color: var(--ink); }
/* totals: a single rule above, a double rule below, as on a ledger */
.gt tr.t > * { font-weight: 700; color: var(--ink); border-top: 1px solid var(--ink-3); border-bottom: 3px double var(--ink-3); }
.gt tr.t td.e { color: var(--elim); }
.gt tr.low > * { background: var(--elim-soft); }
.gt tr.low td:last-child { color: var(--elim); font-weight: 700; }
.gt tbody tr:last-child:not(.t) > * { border-bottom: 0; }
@media (min-width: 560px) {
  .gt { font-size: .92rem; }
  .gt th, .gt td { padding: .7rem .8rem; }
  .gt th:first-child, .gt td:first-child { padding-left: 1.25rem; }
  .gt th:last-child, .gt td:last-child { padding-right: 1.25rem; }
  .gt caption { padding: 1.15rem 1.25rem .4rem; }
  .gt tbody th { min-width: 8.5rem; }
}
.g-fignote { margin: .6rem .25rem 0; font-size: .85rem; line-height: 1.5; color: var(--ink-3); }

/* ---------- callouts ---------- */
.g-note, .g-warn, .g-hk { margin: 1.75rem 0; padding: 1.1rem 1.25rem 1.15rem; border-radius: 18px; font-size: 1rem; }
.g-note > :last-child, .g-warn > :last-child, .g-hk > :last-child { margin-bottom: 0; }
.g-label { margin: 0 0 .35rem; font: 700 .8rem/1.2 var(--font-sans); letter-spacing: .02em; }
.g-note { background: var(--accent-soft); }
.g-note .g-label { color: var(--accent-strong); }
.g-note p { color: var(--ink-2); }
.g-warn { background: var(--elim-soft); }
.g-warn .g-label { color: var(--elim); }
.g-warn p { color: var(--ink-2); }
.g-hk { position: relative; padding-left: 4rem; background: var(--card); box-shadow: var(--shadow); }
.g-hk::before { content: "h"; position: absolute; left: 1.2rem; top: 1.1rem; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 9px; background: var(--accent); color: #111; font: 800 1.1rem/1 var(--font-display); }
.g-hk .g-label { color: var(--accent-strong); }
.g-hk p { color: var(--ink-2); }
.g-hk p a, .g-note p a, .g-warn p a { color: var(--accent-strong); font-weight: 600; text-underline-offset: 3px; }
.g-legal { margin: 0 0 2rem; padding: .9rem 1.1rem; border: 1px dashed var(--line-strong); border-radius: 14px; font-size: .92rem; color: var(--ink-2); }

/* ---------- CTA box ---------- */
.g-cta { position: relative; overflow: clip; margin: 3.25rem 0 0; padding: clamp(1.6rem, 4vw, 2.5rem); border-radius: var(--radius); }
.g-cta::before { content: ""; position: absolute; inset: -40% -30% auto 30%; height: 160%; background: radial-gradient(closest-side, rgb(94 224 168 / .16), transparent); pointer-events: none; }
.g-cta > * { position: relative; }
.g-cta h2 { margin-bottom: .75rem; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); font-weight: 800; letter-spacing: -0.04em; text-wrap: balance; }
.g-cta p { max-width: 36rem; color: var(--band-ink-2); }
.g-cta .cta-row { margin: 1.4rem 0 0; }
.g-cta .fineprint { margin-top: .9rem; }

/* ---------- guide cards (hub + related) ---------- */
.g-grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .g-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .g-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; } .g-grid-hub > :first-child { grid-column: span 2; } }
@media (min-width: 720px) and (max-width: 1039.98px) { .g-grid-hub > :first-child { grid-column: 1 / -1; } }
.g-card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 1.6rem; }
.g-card-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.g-no { font: 800 2.4rem/1 var(--font-display); letter-spacing: -0.05em; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.g-card .tag { font-size: .75rem; }
.g-card h2, .g-card h3 { margin-bottom: .6rem; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.12; text-wrap: balance; }
.g-card h2 a, .g-card h3 a { text-decoration: none; }
.g-card h2 a::after, .g-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.g-card h2 a:focus-visible, .g-card h3 a:focus-visible { outline: none; }
.g-card:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
.g-card p { margin-bottom: 1.25rem; color: var(--ink-2); }
.g-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .85rem; font-weight: 600; color: var(--ink-3); }
.g-arrow { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--card-2); color: var(--ink); transition: background-color .2s, color .2s, transform .2s; }
.g-arrow svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) {
  .g-card { transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
  .g-card:hover { transform: translateY(-4px); }
  .g-card:hover .g-arrow { background: var(--accent); color: var(--accent-ink); transform: translateX(3px); }
}
.g-grid-hub > :first-child { background: var(--band); color: var(--band-ink); --focus: var(--accent); }
.g-grid-hub > :first-child .g-no { color: var(--accent); }
.g-grid-hub > :first-child p { color: var(--band-ink-2); max-width: 40rem; }
.g-grid-hub > :first-child .g-card-foot { border-color: var(--band-line); color: var(--band-ink-3); }
.g-grid-hub > :first-child .tag { background: #2a2a27; color: var(--band-ink-2); }
.g-grid-hub > :first-child .g-arrow { background: #2a2a27; color: var(--band-ink); }
.g-grid-hub > :first-child h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); max-width: 24ch; }

.g-more { padding-bottom: clamp(4rem, 9vw, 6rem); }
.g-more .section-head { margin-bottom: 1.5rem; }
.g-hub-cta { padding-bottom: clamp(4rem, 9vw, 6rem); }
.g-hub-cta .g-cta { margin: 0; }
