/* LARCH SITE BASE: type scale, layout, and the components every page shares.
   Reads only semantic tokens from tokens.css. Direction pages add their own art direction on top. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.6 var(--font-sans); -webkit-font-smoothing: antialiased; overflow-x: clip; transition: background-color .3s ease, color .3s ease; }
h1, h2, h3, p, figure, pre { margin: 0; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
.mono { font-family: var(--font-mono); }
.ic { font-family: "Material Symbols Rounded"; font-weight: 400; font-style: normal; line-height: 1; display: inline-block; font-variation-settings: "FILL" 0, "wght" 400, "opsz" 20; -webkit-font-smoothing: antialiased; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; border-radius: 8px; }

/* type scale: tracking tightens as size grows, leading falls with it */
:root {
  --t-display: clamp(2.75rem, 1.2rem + 5.6vw, 5.75rem);
  --t-h2: clamp(2rem, 1.2rem + 2.6vw, 3.25rem);
  --t-h3: 1.375rem;
  --t-lede: clamp(1.0625rem, .98rem + .35vw, 1.25rem);
  --t-body: 1rem;
  --t-small: .875rem;
  --t-mono: .8125rem;
  --wrap: 1240px;
  --gut: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(.16, 1, .3, 1);
  /* critically damped spring, response .3s (Apple: damping 1.0, no overshoot), x(t)=1-(1+wt)e^-wt sampled over .42s */
  --spring: linear(0, 0.0401, 0.1313, 0.2431, 0.3577, 0.4656, 0.562, 0.6452, 0.7154, 0.7736, 0.821, 0.8594, 0.89, 0.9144, 0.9336, 0.9487, 0.9605, 0.9696, 0.9767, 0.9822, 0.9864, 0.9896, 0.9921, 0.994, 0.9955, 0.9966, 0.9974, 0.998, 1);
}
.display { font-size: var(--t-display); line-height: .98; letter-spacing: -.048em; font-weight: 600; text-wrap: balance; }
.h2 { font-size: var(--t-h2); line-height: 1.04; letter-spacing: -.036em; font-weight: 600; text-wrap: balance; }
.h3 { font-size: var(--t-h3); line-height: 1.25; letter-spacing: -.018em; font-weight: 600; }
.lede { font-size: var(--t-lede); line-height: 1.55; color: var(--mute); letter-spacing: -.006em; max-width: 34em; text-wrap: pretty; }
.body { font-size: var(--t-body); line-height: 1.62; color: var(--mute); max-width: 36em; text-wrap: pretty; }
.label { font-family: var(--font-mono); font-size: var(--t-mono); color: var(--mute); letter-spacing: 0; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gut); }

/* lockup: the brand SVG from brand/final/L9a, referenced only through --lockup-url in tokens.css. Swap the file, not the markup. */
.wm { display: block; flex: none; width: 112px; height: 30px; background: var(--lockup-url) left center / contain no-repeat; color: transparent; font-size: 0; overflow: hidden; text-decoration: none; }

/* nav: translucent material, content scrolls under it */
.nav { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 70%, transparent); }
.nav-in { height: 64px; display: flex; align-items: center; gap: 36px; }
.nav-links { display: flex; gap: 28px; font-size: .9375rem; font-weight: 500; color: var(--mute); }
.nav-links a { text-decoration: none; transition: color .2s var(--ease); }
.nav-links a:hover { color: var(--ink); }
.nav-r { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tt { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--mute); display: grid; place-items: center; cursor: pointer; transition: background-color .2s, color .2s; }
.tt:hover { background: var(--soft); color: var(--ink); }
.tt .ic { font-size: 20px; }
.tt .dk { display: none; }
:root[data-theme="dark"] .tt .lt { display: none; } :root[data-theme="dark"] .tt .dk { display: inline-block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tt .lt { display: none; } :root:not([data-theme="light"]) .tt .dk { display: inline-block; } }
@media (max-width: 860px) { .nav-links { display: none; } .nav-in { gap: 12px; } }

/* buttons: ink primary (app rule), feedback on press */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px; border-radius: 10px; border: 0; background: var(--btn); color: var(--btnink); font: 500 .9375rem/1 var(--font-sans); letter-spacing: -.005em; text-decoration: none; white-space: nowrap; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .08); transition: transform .1s ease-out, background-color .2s, box-shadow .2s; }
.btn:active { transform: scale(.97); }
.btn.sm { height: 36px; padding: 0 14px; font-size: .875rem; border-radius: 9px; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line2); }
.btn.ghost:hover { background: var(--soft); }
.btn .ic { font-size: 18px; }
.arr { transition: transform .2s var(--ease); }
@media (hover: hover) { .btn:hover .arr { transform: translateX(3px); } }
.fine { font-size: var(--t-small); color: var(--mute); }
.fine a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line2); }

/* plan toggle: a segmented control, thumb on a spring, digits roll */
.plan-toggle { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); isolation: isolate; }
.plan-toggle::before { content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px; background: var(--page); box-shadow: 0 0 0 .5px var(--line2), 0 1px 2px rgba(10, 12, 20, .08), 0 4px 10px -2px rgba(10, 12, 20, .1); transition: transform .42s var(--spring); }
.plan-toggle[data-active="annual"]::before { transform: translateX(100%); }
.plan-toggle button { appearance: none; border: 0; background: none; height: 36px; padding: 0 18px; border-radius: 9px; font: 500 .875rem/1 var(--font-sans); color: var(--mute); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; transition: color .2s; }
.plan-toggle button[aria-checked="true"] { color: var(--ink); }
.plan-toggle button:active { transform: scale(.97); }
.plan-toggle .save { font: 500 .75rem/1 var(--font-mono); color: var(--acc); }
.price { display: flex; align-items: baseline; gap: 10px; }
.price .amt { font-size: clamp(3.5rem, 2.6rem + 3vw, 5rem); font-weight: 600; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; display: inline-flex; }
.price .per { font-size: 1rem; color: var(--mute); }
.dg { display: inline-block; height: 1em; overflow: hidden; position: relative; vertical-align: top; }
.dg > span { display: block; height: 1em; line-height: 1; }
.dg.roll > span { animation: dg-in .52s var(--spring) both; animation-delay: calc(var(--i) * 28ms); }
.dg.roll.down > span { animation-name: dg-in-down; }
.dg.roll > .was { position: absolute; inset: 0; }
@keyframes dg-in { from { transform: translateY(100%); } to { transform: translateY(-100%); } }
@keyframes dg-in-down { from { transform: translateY(-100%); } to { transform: translateY(100%); } }
.dg.roll > span:not(.was) { animation-name: dg-new; }
.dg.roll.down > span:not(.was) { animation-name: dg-new-down; }
@keyframes dg-new { from { transform: translateY(100%); } to { transform: none; } }
@keyframes dg-new-down { from { transform: translateY(-100%); } to { transform: none; } }
.dg.roll > .was { animation-name: dg-out; }
.dg.roll.down > .was { animation-name: dg-out-down; }
@keyframes dg-out { from { transform: none; } to { transform: translateY(-100%); } }
@keyframes dg-out-down { from { transform: none; } to { transform: translateY(100%); } }

/* FAQ: native details, one hairline between questions */
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 22px 0; font-size: 1.0625rem; font-weight: 500; letter-spacing: -.01em; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ic { color: var(--mute); font-size: 22px; transition: transform .3s var(--ease); }
.faq details[open] summary .ic { transform: rotate(45deg); }
.faq details p { padding: 0 0 24px; color: var(--mute); max-width: 40em; line-height: 1.62; }

/* footer */
.foot { padding: 48px 0 56px; font-size: var(--t-small); color: var(--mute); }
.foot-in { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.foot-l { display: flex; align-items: center; gap: 10px 24px; flex-wrap: wrap; }
.foot nav { display: flex; gap: 24px; flex-wrap: wrap; }
.foot a { text-decoration: none; } .foot a:hover { color: var(--ink); }

/* the Markdown file surface */
.s-file { background: var(--page); border-radius: 12px; box-shadow: var(--sh-float); overflow: hidden; }
.s-file-bar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; font: 400 11.5px/1 var(--font-mono); color: var(--mute); box-shadow: inset 0 -1px 0 var(--line); background: var(--paper); white-space: nowrap; overflow: hidden; }
.s-file-bar .ic { font-size: 16px; color: var(--acc); }
.s-file-body { padding: 18px 20px 22px; font: 400 12.5px/1.7 var(--font-mono); color: var(--ink); white-space: pre; overflow: hidden; }
.s-file-body .fm { color: var(--faint); } .s-file-body .h { font-weight: 600; }
.s-file-body .t { color: var(--faint); } .s-file-body b { font-weight: 600; } .s-file-body .c1 { color: var(--s1); } .s-file-body .c2 { color: var(--s2); }

/* reveals: transform + opacity only */
@media (prefers-reduced-motion: no-preference) {
  [data-rv="pre"] { opacity: 0; transform: translateY(20px); }
  [data-rv="in"] { opacity: 1; transform: none; transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--rd, 0s); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: 150ms !important; } }
@media (prefers-reduced-transparency: reduce) { .nav { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (prefers-contrast: more) { :root { --mute: var(--ink); --line: var(--line2); } }

/* guideline pass: skip link, touch, tap highlight */
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; border-radius: 10px; background: var(--btn); color: var(--btnink); font-weight: 500; text-decoration: none; transition: top .2s var(--ease); }
.skip:focus-visible { top: 12px; }
a, button, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.tape, .score { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

[id] { scroll-margin-top: 84px; }
