/* ============================================================================
   Aadya Labs — warm-light "Aged Mithila Paper" design system (marketing front door)
   Implements products/AADYA_WEB_DESIGN_SYSTEM.md. Ink on aged paper, told quietly.
   Self-hosted fonts, zero external requests. Transform/opacity-only motion.
   ========================================================================== */

/* ---- fonts (self-hosted, variable) ------------------------------------- */
@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces-opsz-wght-normal-latin.woff2') format('woff2-variations');
  font-weight: 300 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/assets/fonts/hanken-grotesk-wght-normal-latin.woff2') format('woff2-variations');
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

/* ---- tokens ------------------------------------------------------------- */
:root {
  /* Parchment (light surface) */
  --paper:      #F4EFE6;
  --surface:    #FBF8F2;   /* raised card */
  --surface-2:  #EFE8DA;   /* inset well (code, demo results) — slightly deeper than paper */
  --ink:        #1F1B1A;   /* 14.6:1 on paper — AAA */
  --ink-muted:  #6B645B;   /* 5.1:1 on paper — AA */
  --hairline:   #D8CFBE;   /* decorative rules only, never a sole UI boundary */
  --hairline-strong: #C7BCA6; /* form-control borders / emphasized rules */
  /* Vault (used only for the handoff + the dark proof-room link) */
  --vault:        #1A1714;
  --vault-raised: #221E1A;
  --text-vault:   #E8E0D4;
  --text-vault-muted: #A79C8C;
  --hairline-vault:   #34302A;
  /* Geru — the one accent, split by use so it passes AA */
  --accent-win:  #C7522A;   /* graphic / large-display ONLY */
  --accent-text: #B5471F;   /* CTA fills + terracotta links/labels (4.8:1 on paper) */
  --on-accent:   #FFF7EA;   /* cream text on the terracotta CTA (5.04:1) */
  --accent-wash: rgba(199, 82, 42, 0.07); /* the faintest terracotta field — verified moments only */
  /* functional status inks (data semantics, kept inky so they never compete with geru) */
  --ok-ink:   #2E6E4E;      /* pass / verified small text (5.0:1 on paper) */
  --warn-ink: #7A5A10;      /* partial / caution small text (5.6:1 on paper) */
  --fail-ink: var(--accent-text); /* reject / error shares the geru text tint */

  /* type */
  --font-display: 'Fraunces', 'Newsreader', Georgia, serif;
  --font-body: 'Hanken Grotesk', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* modular type scale (quiet 1.25, base 18) — use these instead of raw px */
  --fs-xs:   12px;  /* mono micro-labels, chips */
  --fs-sm:   13px;  /* captions, fineprint, index numerals */
  --fs-body2:15px;  /* card body / secondary prose */
  --fs-base: 18px;  /* body */
  --fs-lede: 20px;  /* lead paragraphs */
  --fs-h4:   18px;
  --fs-h3:   22px;
  --fs-h2:   clamp(28px, 4vw, 44px);
  --fs-h1:   clamp(40px, 6vw, 76px);

  /* spacing (8px base) */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 40px; --s5: 64px; --s6: 104px; --s7: 168px;
  --measure: 66ch;
  --container: 1120px;

  /* radii */
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-pill: 999px;

  /* motion */
  --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-micro: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-win:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-breath: cubic-bezier(0.37, 0, 0.63, 1);
  --t-fast: 160ms; --t-med: 240ms; --t-slow: 500ms;

  /* warm material shadows (static, zero requests) — hairlines first, shadows quiet */
  --shadow-0: 0 1px 2px rgba(47,39,32,.05);
  --shadow-1: 0 1px 2px rgba(47,39,32,.05), 0 4px 12px -5px rgba(47,39,32,.09);
  --shadow-2: 0 1px 2px rgba(47,39,32,.05), 0 18px 40px -22px rgba(47,39,32,.16);

  --focus: 2px solid var(--ink);
  --focus-invert: 2px solid var(--text-vault); /* rings on dark/vault surfaces */
}

/* ---- reset / base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base, 18px);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* wide content must scroll in its own container, never the body */
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: rgba(199, 82, 42, 0.16); }

:focus-visible { outline: var(--focus); outline-offset: 2px; border-radius: 2px; }
:focus:not(:focus-visible) { outline: none; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 460; line-height: 1.1; letter-spacing: -0.01em; margin: 0; font-optical-sizing: auto; }
h4 { font-family: var(--font-body); font-weight: 600; font-size: var(--fs-h4); line-height: 1.35; letter-spacing: -0.005em; margin: 0; }
p { margin: 0; }
strong { font-weight: 600; }
code, kbd, samp { font-family: var(--font-mono); font-size: 0.86em; }
:not(pre) > code {
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 1px 5px; white-space: nowrap;
}
hr { border: 0; border-top: 1px solid var(--hairline); margin: var(--s4) 0; }

/* skip link — first tabbable element on every page */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 16px;
  border-radius: 0 0 var(--r-md) 0; font-size: 14px; font-weight: 600; text-decoration: none;
}
.skip-link:focus-visible { left: 0; outline: var(--focus-invert); outline-offset: -4px; }

/* screen-reader-only text (for aria labelling of async regions) */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px;
  padding: 0; border: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ---- layout ------------------------------------------------------------- */
.wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--s4); }
.prose { max-width: var(--measure); }
.section { padding: var(--s6) 0; }
@media (max-width: 720px) { .section { padding: var(--s5) 0; } .wrap { padding: 0 var(--s3); } }

/* the kachni double-line — Madhubani's secular signature: two hairlines that draw themselves on */
.kachni { border: 0; height: 5px; margin: var(--s5) auto; max-width: var(--container); background: transparent; }
.kachni svg { width: 100%; height: 5px; display: block; overflow: visible; }
.kachni line { stroke: var(--hairline); stroke-width: 1; stroke-dasharray: 1000; stroke-dashoffset: 0; }
.kachni--short { max-width: 64px; margin-left: 0; }
html.js .kachni line { stroke-dashoffset: 1000; }
html.js .kachni.is-in .k1 { stroke-dashoffset: 0; transition: stroke-dashoffset 760ms var(--ease-enter); }
html.js .kachni.is-in .k2 { stroke-dashoffset: 0; transition: stroke-dashoffset 760ms var(--ease-enter) 90ms; }

/* index numeral — full opacity, muted ink (never opacity-dimmed) */
.idx { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.08em; color: var(--ink-muted); text-transform: uppercase; font-variant-numeric: tabular-nums slashed-zero; }

/* ---- nav ---------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s3) var(--s4);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(8px);
}
.nav { box-shadow: 0 1px 0 color-mix(in srgb, var(--hairline) 62%, transparent); }
.nav__mark { font-family: var(--font-display); font-weight: 500; font-size: 20px; letter-spacing: -0.01em; text-decoration: none; font-variation-settings: "opsz" 22; }
.nav__mark .dot { color: var(--accent-text); }
/* canonical nav link row (pages may extend; identical across polished pages) */
.nav__links { display: flex; gap: var(--s3); align-items: center; }
.nav__links a {
  font-size: 14px; color: var(--ink-muted); text-decoration: none;
  padding: 4px 2px; min-height: 24px; display: inline-flex; align-items: center;
  transition: color var(--t-fast) var(--ease-micro);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a[aria-current="page"] { color: var(--ink); box-shadow: 0 1px 0 var(--ink-muted); }
@media (max-width: 860px) {
  /* mobile nav: links stay reachable as a full-width, horizontally-scrollable
     second row beneath the mark + CTA (no hamburger JS needed, works everywhere) */
  .nav { flex-wrap: wrap; row-gap: 8px; }
  .nav__links {
    order: 3; width: 100%; padding-top: 8px;
    border-top: 1px solid var(--hairline);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav__links::-webkit-scrollbar { display: none; }
  .nav__links a { white-space: nowrap; }
}

/* ---- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  padding: 12px 20px; border-radius: 6px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: transform 200ms var(--ease-micro), background 200ms var(--ease-micro);
  min-height: 24px;
}
.btn--primary {
  background: linear-gradient(180deg, #B5471F 0%, #A23F1B 100%); color: var(--on-accent);
  box-shadow: inset 0 1px 0 rgba(255,247,234,.16), var(--shadow-1); position: relative; overflow: hidden;
}
.btn--primary:hover { transform: translateY(-1px); background: linear-gradient(180deg, #AE431C 0%, #963A18 100%); }
.btn--primary:active { transform: translateY(0); }
.btn--primary:focus-visible { outline: var(--focus); outline-offset: 3px; }
.btn--primary > * { position: relative; z-index: 1; }
@media (prefers-contrast: more) { .btn--primary { background: #A23F1B; } }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--hairline-strong); }
.btn--ghost:hover { transform: translateY(-1px); background: var(--surface); border-color: var(--ink-muted); }
.btn--ghost:active { transform: translateY(0); }
.btn--small { padding: 8px 14px; font-size: 13px; border-radius: var(--r-md); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none !important; }
.link-quiet { color: var(--ink-muted); text-decoration: none; border-bottom: 1px solid var(--hairline); padding-bottom: 1px; transition: color 200ms var(--ease-micro), border-color 200ms var(--ease-micro); }
.link-quiet:hover { color: var(--ink); border-color: var(--ink-muted); }
.link-accent { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent-text) 40%, transparent); }
.link-accent:hover { border-color: var(--accent-text); }

/* ---- hero --------------------------------------------------------------- */
.hero { padding: clamp(80px, 14vh, 168px) 0 var(--s6); }
.hero h1 {
  font-size: clamp(40px, 6vw, 76px); font-weight: 420; line-height: 1.04;
  letter-spacing: -0.014em; max-width: 14ch;
  font-variation-settings: "opsz" 128;
  font-variant-ligatures: common-ligatures contextual; text-wrap: balance;
}
.hero__sub { margin-top: var(--s3); font-size: 20px; color: var(--ink-muted); max-width: 46ch; line-height: 1.5; }
.hero__cta { margin-top: var(--s4); display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }

/* ---- generic section heading ------------------------------------------- */
.beat { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); align-items: start; }
.beat__head { display: flex; align-items: baseline; gap: var(--s2); }
.beat h2 { font-size: clamp(28px, 4vw, 44px); font-weight: 440; max-width: 18ch; letter-spacing: -0.012em; font-variation-settings: "opsz" 60; text-wrap: balance; }
.beat__body { font-size: 19px; color: var(--ink); max-width: 56ch; }
.beat__body .muted { color: var(--ink-muted); }

/* ---- framed object (QR / marks sit in a crisp kachni frame) ------------- */
.frame {
  position: relative; padding: var(--s4); border-radius: 8px; background: var(--surface);
  display: inline-flex; flex-direction: column; align-items: center; gap: var(--s2);
  box-shadow: var(--shadow-1);
}
.frame::before, .frame::after {
  content: ""; position: absolute; inset: 6px; border-radius: 4px; pointer-events: none;
}
.frame::before { border: 1px solid var(--hairline); }
.frame::after  { inset: 10px; border: 1px solid var(--hairline); }
.frame__qr { width: 168px; height: 168px; }
.frame__cap { font-size: 14px; color: var(--ink-muted); }

/* ---- the win (the one moment of colour) -------------------------------- */
.win {
  display: inline-flex; flex-direction: column; gap: var(--s2);
  padding: var(--s4); border-radius: 8px; background: var(--surface);
  border: 1px solid var(--hairline); box-shadow: var(--shadow-2);
}
.win__pass { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 480; font-size: clamp(28px, 4vw, 40px); color: var(--accent-win); font-variation-settings: "opsz" 56; }
.win__check { width: 30px; height: 30px; flex: none; }
.win__label { font-size: 14px; color: var(--ink-muted); font-family: var(--font-mono); letter-spacing: 0.04em; font-variant-numeric: tabular-nums slashed-zero; }

/* the one felt colour moment: bloom + geru glow + the check writing itself */
.win { position: relative; }
.win__pass { position: relative; z-index: 1; }
.win.is-revealed .win__pass { animation: bloom 700ms var(--ease-win) both; }
@keyframes bloom { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.win::before {
  content: ""; position: absolute; left: var(--s4); top: 50%; width: 180px; height: 180px;
  border-radius: 50%; z-index: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(199,82,42,.16), transparent 70%);
  opacity: 0; transform: translateY(-50%) scale(.5);
}
.win.is-revealed::before { animation: winglow 1100ms var(--ease-win) 140ms forwards; }
@keyframes winglow {
  0% { opacity: 0; transform: translateY(-50%) scale(.5); }
  45% { opacity: .85; }
  100% { opacity: 0; transform: translateY(-50%) scale(1.18); }
}
html.js .win__check circle, html.js .win__check path { stroke-dasharray: 100; stroke-dashoffset: 100; }
html.js .win.is-revealed .win__check circle { stroke-dashoffset: 0; transition: stroke-dashoffset 520ms var(--ease-enter) 220ms; }
html.js .win.is-revealed .win__check path { stroke-dashoffset: 0; transition: stroke-dashoffset 300ms var(--ease-enter) 640ms; }

/* ---- receipt / empty box ----------------------------------------------- */
.receipt { background: var(--surface); border: 1px solid var(--hairline); border-radius: 8px; padding: var(--s4); max-width: 380px; box-shadow: var(--shadow-1); }
.receipt__row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.receipt__row + .receipt__row { border-top: 1px solid var(--hairline); }
.receipt__k { font-size: 15px; color: var(--ink-muted); }
.receipt__v { font-size: 15px; }
.receipt__v.win-text { color: var(--accent-win); font-weight: 600; }
.receipt__box { width: 84px; height: 22px; border: 1px dashed var(--hairline); border-radius: 3px; }
.receipt__foot { margin-top: var(--s2); font-size: 13px; color: var(--ink-muted); }

/* ---- two marks ---------------------------------------------------------- */
.marks { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.mark { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mark__glyph { width: 72px; height: 72px; }
.mark__site { font-size: 13px; color: var(--ink-muted); font-family: var(--font-mono); }
.marks__cut { flex: 1; min-width: 60px; height: 1px; background: repeating-linear-gradient(90deg, var(--hairline) 0 8px, transparent 8px 16px); }

/* ---- manifesto ---------------------------------------------------------- */
.manifesto p {
  font-family: var(--font-display); font-weight: 380; font-size: clamp(22px, 3vw, 27px);
  line-height: 1.7; max-width: 32ch; font-variation-settings: "opsz" 30;
  font-variant-ligatures: common-ligatures contextual; text-wrap: pretty; hanging-punctuation: first last;
}
.manifesto p + p { margin-top: var(--s3); }
.manifesto .em { font-style: italic; }
.manifesto__lead {
  font-style: italic; font-size: clamp(25px, 3.4vw, 31px); line-height: 1.4;
  font-variation-settings: "opsz" 36; color: var(--ink); margin-bottom: var(--s3);
}
.manifesto__open::first-letter {
  font-family: var(--font-display); font-weight: 400; color: var(--ink);
  font-variation-settings: "opsz" 72; margin-right: .07em;
  -webkit-initial-letter: 3; initial-letter: 3;
}
@supports not (initial-letter: 3) {
  .manifesto__open::first-letter { float: left; font-size: 3.05em; line-height: .8; padding: .04em .08em 0 0; }
}

/* ---- accordion (progressive disclosure, kachni affordance) ------------- */
.accordion { border-top: 1px solid var(--hairline); }
.acc { border-bottom: 1px solid var(--hairline); }
.acc__btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  background: none; border: 0; padding: var(--s3) 0; cursor: pointer; text-align: left;
  font-family: var(--font-body); color: var(--ink);
}
.acc__num { font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); width: 3ch; flex: none; font-variant-numeric: tabular-nums slashed-zero; }
.acc__title { font-size: 18px; font-weight: 500; flex: 1; }
.acc__sign { font-family: var(--font-mono); color: var(--ink-muted); transition: transform 200ms var(--ease-micro); }
.acc[open] .acc__sign { transform: rotate(45deg); }
.acc__body { overflow: hidden; }
.acc__body p { font-size: 17px; color: var(--ink-muted); max-width: 60ch; padding: 0 0 var(--s3) calc(3ch + var(--s2)); line-height: 1.6; }

/* ---- substance row ------------------------------------------------------ */
.substance { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
@media (max-width: 720px) { .substance { grid-template-columns: 1fr; } }
.stat__n { font-family: var(--font-display); font-size: 36px; font-weight: 460; font-variation-settings: "opsz" 40; font-variant-numeric: lining-nums tabular-nums; }
.stat__l { font-size: 14px; color: var(--ink-muted); margin-top: 4px; }
.scope { font-size: 15px; color: var(--ink-muted); line-height: 1.55; }

/* ---- compliance wordmarks (quiet footer row) --------------------------- */
.compliance { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.compliance span { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--ink-muted); text-transform: uppercase; }
.compliance span + span::before { content: "·"; margin-right: var(--s3); color: var(--hairline); }

/* ---- footer ------------------------------------------------------------- */
.foot { padding: var(--s5) 0; color: var(--ink-muted); border-top: 1px solid var(--hairline); margin-top: var(--s5); }
.foot__grid { display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; align-items: flex-end; }
.foot__colophon { font-size: 13px; max-width: 38ch; line-height: 1.5; }
.foot__mark { font-family: var(--font-display); font-size: 18px; color: var(--ink); font-variation-settings: "opsz" 20; }
.signup { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.signup input { font-family: var(--font-body); font-size: 15px; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: 6px; background: var(--surface); color: var(--ink); min-width: 220px; }
.signup input::placeholder { color: var(--ink-muted); }
.signup__note { font-size: 12px; color: var(--ink-muted); flex-basis: 100%; }

/* ---- reveal-on-scroll (no-JS-safe: visible by default; only HIDDEN once JS
   is confirmed active, so content can never get stuck invisible) ---------- */
.reveal { opacity: 1; transform: none; }
html.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 500ms var(--ease-enter), transform 500ms var(--ease-enter); }
html.js .reveal.is-in { opacity: 1; transform: none; }

/* marketing → /try: ONE opacity cross-fade to the exact /try warm-black. */
.bridge-veil { position: fixed; inset: 0; z-index: 9999; background: var(--vault);
  opacity: 0; pointer-events: none; display: grid; place-items: center;
  transition: opacity 480ms var(--ease-micro); }
.bridge-veil__beat { font-family: var(--font-display); font-weight: 380; font-size: 18px;
  letter-spacing: .01em; color: var(--text-vault); opacity: 0;
  transition: opacity 220ms var(--ease-micro) 180ms; }
body.is-leaving .bridge-veil { opacity: 1; pointer-events: auto; }
body.is-leaving .bridge-veil__beat { opacity: .72; }
/* returning FROM /try: born under the warm-black veil, lift to parchment */
html.from-try::before { content: ""; position: fixed; inset: 0; z-index: 9999;
  background: var(--vault); opacity: 1; pointer-events: none; }
html.from-try.is-rising::before { opacity: 0; transition: opacity 480ms var(--ease-micro); }
@media (prefers-reduced-motion: reduce) { html.from-try::before { display: none; } }

/* ---- M3 · intra-group reveal stagger ----------------------------------- */
html.js [data-stagger] > .r { opacity: 0; transform: translateY(12px);
  transition: opacity 500ms var(--ease-enter), transform 500ms var(--ease-enter); }
html.js [data-stagger].is-in > .r { opacity: 1; transform: none; transition-delay: calc(var(--i,0) * 60ms); }

/* ---- M4 · the one ambient: framed-QR single slow breath ---------------- */
.frame__qr { transform-origin: center; }
.frame__qr.is-breathing { animation: qrbreath 5s var(--ease-breath) infinite; will-change: transform; }
@keyframes qrbreath { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.015); } }

/* ---- M5 · two marks stagger, then the connector severs (one-shot) ------- */
html.js .marks .mark { opacity: 0; transform: translateY(10px);
  transition: opacity 500ms var(--ease-enter), transform 500ms var(--ease-enter); }
html.js .marks.is-in .mark { opacity: 1; transform: none; }
html.js .marks.is-in .mark:nth-child(1) { transition-delay: 0ms; }
html.js .marks.is-in .mark:nth-child(3) { transition-delay: 110ms; }
.marks__cut { transform: scaleX(0); transform-origin: center; opacity: 0; }
html.js .marks.is-in .marks__cut { animation: sever 1500ms var(--ease-enter) 300ms forwards; }
@keyframes sever { 0% { opacity: 0; transform: scaleX(0); } 42% { opacity: 1; transform: scaleX(.9); }
  100% { opacity: .55; transform: scaleX(.6); } }
.mark__site { font-variant-numeric: tabular-nums slashed-zero; }

/* ---- M6 · widow/orphan control ----------------------------------------- */
h2, .win__pass { text-wrap: balance; }
.hero__sub, .beat__body, .acc__body p, .scope, .foot__colophon, .receipt__foot { text-wrap: pretty; }
.prose { hanging-punctuation: first last; }

/* ---- M10 · paper grain (composites behind content; contrast untouched) -- */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .035; mix-blend-mode: multiply; }
@media (prefers-contrast: more) { body::before { display: none; } }

/* ==========================================================================
   ELEVATION LAYER — shared premium components (additive; page <style> blocks
   loaded after this file still win, so existing pages are safe).
   ========================================================================== */

/* ---- text utilities ------------------------------------------------------ */
.eyebrow {
  font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-muted);
  font-variant-numeric: tabular-nums slashed-zero;
}
.lede { font-size: var(--fs-lede); line-height: 1.55; color: var(--ink); max-width: 56ch; text-wrap: pretty; }
.muted { color: var(--ink-muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums slashed-zero; }
.small { font-size: var(--fs-body2); }
.fineprint { font-size: var(--fs-sm); color: var(--ink-muted); line-height: 1.5; max-width: 70ch; text-wrap: pretty; }
.smallnote { font-size: var(--fs-sm); color: var(--ink-muted); line-height: 1.5; }
.hero__note { margin-top: var(--s2); font-size: 14px; color: var(--ink-muted); max-width: 60ch; line-height: 1.55; text-wrap: pretty; }

/* prose lists — quiet editorial bullets */
.prose ul, .prose ol { margin: var(--s2) 0 0; padding-left: 1.2em; }
.prose li { margin-top: var(--s1); line-height: 1.6; }
.prose li::marker { color: var(--ink-muted); }
.prose a { color: var(--ink); text-decoration-color: var(--hairline-strong); text-underline-offset: 3px; transition: text-decoration-color var(--t-fast) var(--ease-micro); }
.prose a:hover { text-decoration-color: var(--ink-muted); }

/* ---- cards & grids ------------------------------------------------------- */
.grid { display: grid; gap: var(--s3); }
/* Grid children must be allowed to use the available track width. Long proof
   labels and machine-readable tokens otherwise set an intrinsic minimum that
   can widen the page on a narrow viewport. */
.grid > * { min-width: 0; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid--2, .grid--3 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: var(--s4); box-shadow: var(--shadow-0);
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  transition: box-shadow var(--t-med) var(--ease-micro), border-color var(--t-med) var(--ease-micro);
}
.card:hover { box-shadow: var(--shadow-1); }
.card--tight { padding: var(--s3); }
.card--well { background: var(--surface-2); box-shadow: none; }
.card__kicker { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.card__title { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 480; font-variation-settings: "opsz" 30; line-height: 1.2; text-wrap: balance; }
.card__body { font-size: var(--fs-body2); color: var(--ink-muted); line-height: 1.55; }
.card__foot { margin-top: auto; padding-top: var(--s1); font-size: 14px; }
/* Cryptographic/error identifiers are useful evidence, but never a reason to
   make a mobile card wider than its viewport. */
.card .mono, .card code { overflow-wrap: anywhere; }
/* an interactive card (whole card is one link) */
a.card { text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--hairline-strong); transform: translateY(-1px); transition: box-shadow var(--t-med) var(--ease-micro), border-color var(--t-med) var(--ease-micro), transform var(--t-med) var(--ease-micro); }

/* ---- tables (wide data scrolls in its own container) --------------------- */
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--hairline); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-0); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-body2); line-height: 1.5; }
.table th {
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 400; text-align: left;
  padding: 14px var(--s2); border-bottom: 1px solid var(--hairline-strong);
  white-space: nowrap;
}
.table td { padding: 12px var(--s2); border-bottom: 1px solid var(--hairline); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast) var(--ease-micro); }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }

/* ---- code blocks ---------------------------------------------------------- */
.codeblock {
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: var(--s3); overflow-x: auto; max-width: 100%;
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.65; color: var(--ink);
  tab-size: 2; margin: 0;
}
.codeblock code { background: none; border: 0; padding: 0; white-space: pre; font-size: inherit; }

/* ---- chips / claim references --------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em;
  color: var(--ink-muted); background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--r-pill);
  padding: 2px 9px; white-space: nowrap; text-decoration: none;
  font-variant-numeric: tabular-nums slashed-zero;
}
a.chip:hover { border-color: var(--hairline-strong); color: var(--ink); }
.claimref { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); letter-spacing: 0.04em; font-variant-numeric: tabular-nums slashed-zero; }
a.claimref { text-decoration: none; border-bottom: 1px dotted var(--hairline-strong); }
a.claimref:hover { color: var(--ink); border-bottom-color: var(--ink-muted); }

/* ---- badges & pills (status, never color-alone — always carries text) ----- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: 3px 8px; color: var(--ink-muted); background: var(--surface);
  white-space: nowrap;
}
.badge--ok   { color: var(--ok-ink);   border-color: color-mix(in srgb, var(--ok-ink) 30%, var(--hairline)); }
.badge--warn { color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn-ink) 30%, var(--hairline)); }
.badge--fail { color: var(--fail-ink); border-color: color-mix(in srgb, var(--fail-ink) 30%, var(--hairline)); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.05em;
  border: 1px solid var(--hairline); border-radius: var(--r-pill);
  padding: 3px 10px; color: var(--ink-muted); background: var(--surface); white-space: nowrap;
}
.pill--pass    { color: var(--ok-ink); }
.pill--partial { color: var(--warn-ink); }
.pill--fail    { color: var(--fail-ink); }
@media (max-width: 480px) {
  /* Status labels retain their text at small widths instead of forcing a
     horizontal page scroll. */
  .badge, .pill, .chip { max-width: 100%; white-space: normal; text-wrap: pretty; }
}

/* ---- callout / note (quiet aside with a kachni-weight left rule) ---------- */
.callout {
  border-left: 2px solid var(--hairline-strong); padding: var(--s1) 0 var(--s1) var(--s3);
  max-width: var(--measure);
}
.callout__kicker { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); display: block; margin-bottom: 6px; }
.callout p { font-size: var(--fs-body2); color: var(--ink-muted); line-height: 1.6; text-wrap: pretty; }
.callout p strong { color: var(--ink); }

/* ---- key/value rows (receipts, payload inspectors) ------------------------ */
.kv { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-muted); word-break: break-all; line-height: 1.6; }
.kv b, .kv strong { color: var(--ink); font-weight: 500; }

/* ---- demo panels (restyle-safe: wiring/JS untouched) ----------------------
   Structure: .demo-panel holds a result; .demo-status announces async state
   (give it role="status" aria-live="polite" in markup); verdicts carry TEXT. */
.demo-panel {
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: var(--s3); overflow-x: auto; max-width: 100%;
}
.demo-panel[hidden] { display: none; }
.demo-status { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-muted); }
.demo-status.err, .demo-status.is-err { color: var(--fail-ink); }
.verdict { font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: 0.04em; }
.verdict.ok, .verdict--ok { color: var(--ok-ink); font-weight: 500; }
.verdict.no, .verdict--no { color: var(--fail-ink); font-weight: 500; }
/* the verified/accept moment — the ONE place terracotta may wash a panel */
.demo-panel.is-verified { border-color: color-mix(in srgb, var(--accent-win) 32%, var(--hairline)); background: linear-gradient(0deg, var(--accent-wash), var(--accent-wash)), var(--surface); }
/* inline working indicator (pair with visible text like "proving…") */
.spinner {
  display: inline-block; width: 13px; height: 13px; flex: none; vertical-align: -2px;
  border: 2px solid var(--hairline-strong); border-top-color: var(--ink-muted);
  border-radius: 50%; animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- stats row (extends .substance/.stat_*) -------------------------------- */
.stat__ref { display: block; margin-top: 6px; }

/* ---- form controls ---------------------------------------------------------- */
.input, .runner input[type="date"], .runner input[type="text"], .runner select {
  font-family: var(--font-body); font-size: var(--fs-body2); padding: 10px 12px;
  border: 1px solid var(--hairline-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); min-height: 24px;
  transition: border-color var(--t-fast) var(--ease-micro);
}
.input:hover, .runner input:hover { border-color: var(--ink-muted); }
.input::placeholder { color: var(--ink-muted); }

/* ---- section head pattern (eyebrow + h2 + optional note) ------------------- */
.section-head { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s4); }
.section-note { font-size: var(--fs-body2); color: var(--ink-muted); max-width: 60ch; line-height: 1.55; text-wrap: pretty; }

/* ==========================================================================
   ACCENT RULE (structural) — terracotta appears NOWHERE at rest.
   The ONLY terracotta accept-moment is `.demo-panel.is-verified` (wash +
   border, above) plus the `.win` bloom/glow/check on a cryptographic accept.
   Journey pages therefore use `.btn--ink` for demo run buttons (never
   `.btn--primary`) and `.link-quiet` for in-journey links (never
   `.link-accent`). Small verdict text keeps its status inks (`--ok-ink`,
   `--fail-ink`) — text semantics, never a wash or bloom. Legacy terracotta
   classes (`.btn--primary`, `.link-accent`, `.nav__mark .dot`) are kept for
   old pages but must not appear in the journey; use `.nav__mark--ink` for a
   quiet wordmark dot. Additive only — nothing removed or renamed.
   ========================================================================== */

/* ink-fill run button: the visitor's action is ink; the accept is terracotta */
.btn--ink {
  background: var(--ink); color: var(--paper);
  box-shadow: inset 0 1px 0 rgba(244, 239, 230, 0.08), var(--shadow-1);
}
.btn--ink:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--ink) 86%, var(--paper)); }
.btn--ink:active { transform: translateY(0); }
.btn--ink:focus-visible { outline: var(--focus); outline-offset: 3px; }
@media (prefers-contrast: more) { .btn--ink { background: var(--ink); } }

/* quiet wordmark variant: dot in muted ink instead of terracotta */
.nav__mark--ink .dot { color: var(--ink-muted); }

/* ---- reduced motion (consolidated) ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  [data-stagger] > .r { opacity: 1 !important; transform: none !important; }        /* M3 */
  .kachni line { stroke-dashoffset: 0 !important; }                                 /* M8 drawn */
  .frame__qr.is-breathing { animation: none !important; }                          /* M4 still */
  .win::before { display: none !important; }                                       /* M2 no glow */
  .win__check circle, .win__check path { stroke-dashoffset: 0 !important; }         /* M2 drawn */
  .marks .mark { opacity: 1 !important; transform: none !important; }               /* M5 */
  .marks__cut { opacity: .55 !important; transform: scaleX(.6) !important; }        /* M5 severed end-state */
}
