/* ============================================================================
   Momentum Simplicity — brand + document stylesheet
   Tokens mirror the Momentum brand (void/gold/cream · Cormorant + Montserrat).
   "The Instrument" polish pass: notarial luxury, editorial calm. All motion is
   transform/opacity, driven by state app.js already makes. Reveal-hiding only
   under html.js-polish + prefers-reduced-motion: no-preference (safety
   inversion: no JS / reduced motion => everything simply visible).
   ========================================================================== */
:root {
  --void: #060606;
  --void-2: #0a0a0a;
  --panel: #0e0e0f;
  --line: #1c1b19;
  --gold: #c9a84c;
  --gold-deep: #a8893d;
  --gold-light: #d4b85a;
  --cream: #e8e6e3;
  --cream-light: #f5f3ee;
  --muted: #b8b5b0;
  --muted-deep: #807c76;   /* ~4.6:1 on the void — AA for the small hint text it carries */
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Montserrat", "Trebuchet MS", system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px;
  /* instrument tokens (additive — existing names are canon, never retokened) */
  --gold-04: rgba(201, 168, 76, 0.04);
  --gold-08: rgba(201, 168, 76, 0.08);
  --gold-14: rgba(201, 168, 76, 0.14);
  --gold-26: rgba(201, 168, 76, 0.26);
  --line-warm: #2a2415;                       /* hairline that has "warmed" */
  --shadow-plate: 0 24px 80px rgba(0, 0, 0, 0.5);
  --shadow-panel: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 18px 50px rgba(0, 0, 0, 0.45);
  --hairline: linear-gradient(90deg, transparent, var(--line-warm) 18%, var(--line-warm) 82%, transparent);
  --ease-settle: cubic-bezier(0.34, 1.25, 0.64, 1); /* ONLY for seal stamps + page-settle: #prev-badge + license ignition + #doc.doc-arrived */
  --d-1: 160ms; --d-2: 280ms; --d-3: 520ms; --d-4: 900ms;
  --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px; --s7: 96px; --s8: 128px; --s9: 160px;
  /* app-surface tokens (whole-UI leg) — ember hexes MUST equal app.js's inline
     note('error') writes (#d98c6a etc.); tokens document them, never diverge */
  --ember: #d98c6a;
  --ember-deep: #a5654a;
  --ember-soft: #e0a184;
  --well: inset 0 1px 2px rgba(0, 0, 0, 0.4);   /* machined input well */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* the [hidden] attribute is app.js's show/hide contract — make it authoritative
   even over author display rules (flex/grid/inline-block on the same element),
   so hidden panels/badges truly hide and unhide-entry animations re-arm.
   (Pre-existing bug: #prev-badge[hidden] rendered because .badge's display
   overrode the UA rule once blockified as a flex item.) */
[hidden] { display: none !important; }
body {
  background: var(--void);
  color: var(--cream);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
a { color: var(--gold-light); text-decoration: none; }
a:hover { color: var(--gold); }
::selection { background: rgba(201, 168, 76, 0.28); color: var(--cream-light); }

/* whole-page drag spotlight scrim — lives on body so it can never swallow
   drag events (pointer-events: none); armed by app.js's own #drop.over */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 50;
  background: rgba(6, 6, 6, 0.55); opacity: 0; pointer-events: none;
  transition: opacity 180ms var(--ease);
}
body:has(#drop.over)::after { opacity: 1; transition-duration: 240ms; }
body:has(#drop.over) #drop { z-index: 60; }

/* ── layout shell ─────────────────────────────────────────────────────────── */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.site-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: rgba(6, 6, 6, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transition: padding 280ms var(--ease), background-color 280ms var(--ease), border-color 280ms var(--ease);
}
.site-header.scrolled {
  padding: 10px 24px;
  background: rgba(6, 6, 6, 0.88);
  border-bottom-color: rgba(168, 137, 61, 0.35);
}
/* reading-progress hairline — progressive enhancement; absent-behavior: nothing */
@supports (animation-timeline: scroll()) {
  .site-header::after {
    content: ""; position: absolute; left: 0; bottom: -1px; width: 100%; height: 1px;
    background: var(--gold); transform: scaleX(0); transform-origin: 0 50%;
    animation: ms-read-progress linear both; animation-timeline: scroll(root);
  }
  @keyframes ms-read-progress { from { transform: scaleX(0); opacity: 0.45; } to { transform: scaleX(1); opacity: 1; } }
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 26px; height: 26px; }
.brand .name {
  font-family: var(--display); font-size: 22px; letter-spacing: 0.14em;
  color: var(--cream-light); font-weight: 600;
}
.brand .name b { color: var(--gold); font-weight: 600; }
.nav { display: flex; gap: 22px; align-items: center; font-size: 13px; letter-spacing: 0.04em; color: var(--muted); }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--cream); }
/* nav / footer link microinteraction: 1px gold underline, origin-left */
.nav a:not(.btn), .footer-links a { position: relative; }
.nav a:not(.btn)::after, .footer-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px;
  background: var(--gold); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 240ms var(--ease);
}
.nav a:not(.btn):hover::after, .nav a:not(.btn):focus-visible::after,
.footer-links a:hover::after, .footer-links a:focus-visible::after { transform: scaleX(1); }
/* the trust door: Verify keeps a persistent deep-gold underline */
.nav .nav-verify::after { transform: scaleX(1); background: rgba(168, 137, 61, 0.4); }
.nav .nav-verify:hover::after, .nav .nav-verify:focus-visible::after { background: var(--gold); }
/* the gold CTA keeps its engraved-dark letters — .nav a's muted color must not
   bleed onto a gold ground (it was invisible there) */
.nav a.btn-gold, .nav a.btn-gold:hover { color: #1a1407; }

.eyebrow {
  font-size: 11px; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--gold); font-weight: 600;
}
.eyebrow::before {
  content: ""; display: inline-block; width: 20px; height: 1px;
  background: var(--gold-deep); vertical-align: middle; margin-right: 12px;
}

/* anchors land clear of the sticky header in both header states */
#main, #why, #trust, #convert, #agents, #pricing { scroll-margin-top: 88px; }

/* ── hero ─────────────────────────────────────────────────────────────────── */
.hero { position: relative; min-height: 86vh; min-height: 86svh; overflow: hidden; display: flex; align-items: center;
  background: radial-gradient(120% 100% at 50% 8%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.38) 100%),
              radial-gradient(50% 64% at 76% 46%, #0b0a08 0%, #060606 60%); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr); align-items: center; }
.hero-inner { position: relative; z-index: 2; padding: 64px 0; max-width: 560px; grid-column: 1; }
/* film grain: hero-only, desktop-only, static, decorative, zero requests */
@media (min-width: 900px) {
  .hero::after {
    content: ""; position: absolute; inset: 0; z-index: 1; opacity: 0.025;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 160px 160px;
  }
}
/* hero eyebrow: flanked by two 24px gold hairlines */
.hero .eyebrow::before, .hero .eyebrow::after {
  content: ""; display: inline-block; width: 24px; height: 1px;
  background: var(--gold-deep); vertical-align: middle;
}
.hero .eyebrow::before { margin-right: 12px; }
.hero .eyebrow::after { margin-left: 12px; }
/* hero entrance — pure CSS, backwards fill, runs once, no FOUC gate needed */
.hero .eyebrow { animation: ms-rise-in 640ms var(--ease) backwards; }
.hero h1 { animation: ms-rise-in 640ms var(--ease) 80ms backwards; }
.hero .lede { animation: ms-rise-in 640ms var(--ease) 160ms backwards; }
.hero .cta-row { animation: ms-rise-in 640ms var(--ease) 240ms backwards; }
.hero-proof { animation: ms-rise-in 640ms var(--ease) 320ms backwards; }
.alien-stage { animation: ms-fade-in 900ms ease 200ms backwards; }

/* ── the alien stage (give → sign → yours) ───────────────────────────────── */
.alien-stage { position: relative; grid-column: 2; height: 78vh; height: 78svh; min-height: 460px; }
.alien-glow {
  position: absolute; left: 50%; top: 46%; width: 70%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(201,168,76,0.18) 0%, rgba(201,168,76,0) 62%);
  filter: blur(6px); pointer-events: none;
}
/* soft elliptical floor shadow — plain gradient, painted under the canvas */
.alien-glow::after {
  content: ""; position: absolute; left: 50%; top: 86%; width: 64%; height: 7%;
  transform: translate(-50%, 0);
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, 0.5), transparent 72%);
}
.alien {
  position: absolute; left: 50%; top: 46%; width: min(86%, 420px);
  transform: translate(-50%, -50%); transform-origin: 50% 50%;
  mix-blend-mode: screen; will-change: transform;
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none;
  -webkit-mask-image: radial-gradient(circle at 50% 47%, #000 56%, rgba(0,0,0,0.5) 70%, transparent 82%);
  mask-image: radial-gradient(circle at 50% 47%, #000 56%, rgba(0,0,0,0.5) 70%, transparent 82%);
}
.doc-card {
  position: absolute; left: 56%; top: 52%; width: 124px;
  transform: translate(-50%, -50%) scale(0.9); transform-origin: 50% 50%;
  background: #fbfaf7; border-radius: 5px; padding: 14px 14px 16px;
  box-shadow: 0 18px 46px rgba(0,0,0,0.55), 0 0 0 1px rgba(201,168,76,0.35);
  opacity: 0; will-change: transform, opacity; z-index: 3;
}
.doc-card .dc-bar { width: 42px; height: 5px; border-radius: 2px; background: var(--gold); margin-bottom: 8px; }
.doc-card .dc-title { font-family: var(--display); font-size: 15px; font-weight: 600; color: #14130f; margin-bottom: 9px; }
.doc-card .dc-line { height: 4px; border-radius: 2px; background: #e3ddd0; margin: 5px 0; }
.doc-card .dc-line.short { width: 62%; }
.doc-card .dc-sigline { height: 1px; background: #d8cdb4; margin: 16px 0 2px; }
.doc-card .dc-sig { position: absolute; left: 14px; bottom: 16px; width: 78px; height: 26px; overflow: visible; }
.doc-card .dc-sig path { fill: none; stroke: #16140d; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.doc-card .dc-seal { position: absolute; right: 12px; bottom: 12px; width: 30px; height: 30px; transform: scale(0); transform-origin: 50% 50%; }
.doc-card .dc-seal circle { fill: none; stroke: var(--gold); stroke-width: 3; }
.doc-card .dc-seal path { fill: none; stroke: var(--gold-deep); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.hero h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(46px, 6vw, 84px); line-height: 1.02; letter-spacing: -0.01em;
  margin: 18px 0 18px;
  color: var(--cream-light);
}
.hero h1 .g { color: var(--gold); font-style: italic; }
.hero p.lede {
  font-size: clamp(17px, 1.9vw, 21px); font-weight: 300; line-height: 1.7;
  color: var(--muted); max-width: 54ch; margin: 0 0 32px;
}
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }
/* static proof-line under the CTAs — the notarial promise, in micro caps */
.hero-proof {
  margin: 22px 0 0; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); font-weight: 400;
}
/* scroll cue at the hero base — a slow descending highlight on a gold line */
.hero-cue {
  position: absolute; left: 50%; bottom: 20px; width: 1px; height: 32px;
  background: var(--gold-26); overflow: hidden; z-index: 2;
}
.hero-cue::after {
  content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 12px;
  background: var(--gold);
  animation: ms-cue 2.4s var(--ease) infinite;
}
@keyframes ms-cue {
  0% { transform: translateY(-14px); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(36px); opacity: 0; }
}
.hero-caption {
  margin-top: 26px; min-height: 26px;
  font-family: var(--display); font-style: italic; font-size: 22px; letter-spacing: 0.01em;
  color: var(--gold-light); opacity: 0; transition: opacity 240ms var(--ease);
}
.hero-caption::before { content: "›"; color: var(--gold-deep); margin-right: 10px; font-style: normal; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--body); font-size: 14px; font-weight: 600; letter-spacing: 0.03em;
  padding: 13px 24px; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; transition: all 280ms var(--ease);
}
.btn-gold {
  background: var(--gold); color: #1a1407;
  position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); /* machined top lip */
}
.btn-gold::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-160%) skewX(-18deg); pointer-events: none;
}
.btn-gold:hover { background: var(--gold-light); transform: translateY(-1px); }
.btn-gold:hover::before { animation: ms-sheen 600ms var(--ease) 1 forwards; }
@keyframes ms-sheen { to { transform: translateX(360%) skewX(-18deg); } }
.btn-ghost { background: transparent; color: var(--cream); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold-deep); color: var(--gold-light); background: var(--gold-04); }
.btn:active:not(:disabled) { transform: scale(0.99); }
/* disabled = engraved into the metal, not grayed out */
.btn:disabled {
  opacity: 1; cursor: not-allowed; transform: none;
  background: var(--void-2); color: var(--muted-deep);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}
.btn:disabled::before { display: none; }   /* no sheen on dead metal */
.btn-gold:disabled { background: var(--void-2); color: var(--muted-deep); }  /* gold is EARNED */

/* ── sections ─────────────────────────────────────────────────────────────── */
section { padding: var(--s7) 0 72px; border-top: 1px solid var(--line); }
.hero { border-top: 0; padding-top: 0; }
/* editorial separators: centered gradient hairline + roman index, not a flat rule */
.sec { position: relative; border-top: 0; }
.sec::before {
  content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
  background: var(--hairline);
}
.sec-index {
  position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%);
  font-family: var(--display); font-style: italic; font-weight: 500; font-size: 14px;
  color: var(--gold-deep); letter-spacing: 0.2em;
  background: var(--void); padding: 0 6px; line-height: 1.6; z-index: 1;
}
.sec-index::before, .sec-index::after {
  content: ""; display: inline-block; width: 2px; height: 2px; border-radius: 50%;
  background: var(--gold-deep); vertical-align: middle;
}
.sec-index::before { margin-right: 10px; }
.sec-index::after { margin-left: 10px; }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head h2 { font-family: var(--display); font-size: clamp(32px, 4.4vw, 56px); line-height: 1.08; margin: 12px 0 10px; color: var(--cream-light); }
.section-head p { color: var(--muted); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
/* editorial plates — hairlines, not rounded cards */
.card {
  position: relative;
  background: rgba(14, 14, 15, 0.6);
  border: 0; border-top: 1px solid var(--line-warm);
  border-radius: var(--r-sm);
  padding: 32px 26px 28px;
  transition: border-color 280ms var(--ease), background-color 280ms var(--ease);
}
.card:hover { border-top-color: var(--gold-deep); background-color: rgba(14, 14, 15, 0.85); }
.card h3 { font-family: var(--display); font-size: 22px; margin: 10px 0 8px; color: var(--gold-light); }
.card p { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0; }
/* ghost numerals: the existing .num, at plate scale */
.card .num {
  font-family: var(--display); font-style: italic; font-size: 40px; line-height: 1;
  color: rgba(168, 137, 61, 0.55); letter-spacing: 0;
  transition: color 280ms var(--ease);
}
.card:hover .num { color: rgba(168, 137, 61, 0.8); }

/* ── why trust HTML (the thesis) ──────────────────────────────────────────── */
.trust-lead {
  position: relative;
  max-width: 720px; margin: 0 0 48px; padding-left: 26px; color: var(--cream);
  font-family: var(--display); font-weight: 500; font-style: italic;
  font-size: clamp(20px, 2.4vw, 27px); line-height: 1.55;
}
.trust-lead::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 1px;
  background: var(--gold-deep);
}
.trust-lead b { color: var(--gold-light); font-weight: 600; }
.reasons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 44px; }
.reason { position: relative; padding-left: 22px; }
.reason::before {
  content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 1px;
  background: linear-gradient(180deg, var(--gold) 0, var(--gold) 12px, var(--line-warm) 13px, var(--line-warm) 100%);
}
.reason::after { content: ""; position: absolute; left: 0; top: 2px; width: 2px; height: 12px; background: var(--gold); }
.reason h3 { font-family: var(--display); font-size: 21px; font-weight: 600; color: var(--gold-light); margin: 0 0 6px; }
.reason p { color: var(--muted); font-size: 14.5px; line-height: 1.65; margin: 0; }
.reason em { color: var(--cream); font-style: italic; }
/* colophon plate — void surface, full deep-gold hairline frame, centered */
.trust-close {
  margin: 56px auto 0; max-width: 700px; padding: 36px 40px; text-align: center;
  background: var(--void);
  border: 1px solid var(--gold-deep); border-radius: var(--r-sm);
  color: var(--cream-light); font-size: clamp(15px, 1.8vw, 18px); line-height: 1.7;
}
.trust-close b { color: var(--gold); font-weight: 600; }
.tc-seal { display: block; width: 34px; height: 34px; margin: 0 auto 16px; }
.tc-seal circle { fill: none; stroke: var(--gold-deep); stroke-width: 2; }
.tc-seal path { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 720px) { .reasons { grid-template-columns: 1fr; gap: 22px; } }

/* ── the app (convert / sign) ─────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px;
  box-shadow: var(--shadow-panel);
}
.panel h3 { font-family: var(--display); font-size: 22px; margin: 0 0 4px; color: var(--cream-light); }
.panel .hint { color: var(--muted-deep); font-size: 12px; margin: 0 0 16px; }
/* numbered step headings: numeral in Cormorant gold, label in tracked caps */
.panel h3 .step-n {
  font-family: var(--display); font-style: italic; font-weight: 600;
  font-size: 24px; color: var(--gold); margin-right: 12px;
  transition: color var(--d-2) var(--ease);
}
.panel h3 .step-t {
  font-family: var(--body); font-size: 12px; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--cream-light);
}
/* migrated inline styles — identical computed values */
#sign-panel, #export-panel, #ai-panel { margin-top: 18px; }
#export-plain, #export-signed, #export-zip { width: 100%; justify-content: center; }
#export-plain, #export-signed { margin-bottom: 8px; }
#draw-wrap { margin-top: 8px; }

/* vertical progress rail — nodes ignite purely via each panel's own
   :not([hidden]) render state (a hidden panel paints no node at all) */
@media (min-width: 901px) {
  .app-steps { position: relative; }
  .app-steps::before {
    content: ""; position: absolute; top: 22px; bottom: 22px; left: -14px; width: 1px;
    background: linear-gradient(180deg, transparent, var(--line-warm) 8%, var(--line-warm) 92%, transparent);
  }
  .app-steps .panel { position: relative; }
  .app-steps .panel::before {
    content: ""; position: absolute; left: -17px; top: 30px; width: 7px; height: 7px;
    border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px rgba(201, 168, 76, 0.5);
  }
}

/* the machine's mouth */
.drop {
  position: relative; min-height: 180px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: var(--r-md);
  padding: 34px 18px; text-align: center; color: var(--muted);
  cursor: pointer;
  background-repeat: no-repeat;
  background-image:
    linear-gradient(var(--gold-deep), var(--gold-deep)), linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)), linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)), linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)), linear-gradient(var(--gold-deep), var(--gold-deep));
  background-size: 8px 1px, 1px 8px, 8px 1px, 1px 8px, 8px 1px, 1px 8px, 8px 1px, 1px 8px;
  background-position:
    10px 10px, 10px 10px,
    calc(100% - 10px) 10px, calc(100% - 10px) 10px,
    10px calc(100% - 10px), 10px calc(100% - 10px),
    calc(100% - 10px) calc(100% - 10px), calc(100% - 10px) calc(100% - 10px);
  transition: border-color 240ms var(--ease), background-color 240ms var(--ease),
    background-size 240ms var(--ease), color 240ms var(--ease);
}
.drop:hover, .drop:focus-visible, .drop.over {
  border-color: var(--gold); color: var(--cream); background-color: var(--gold-04);
  background-size: 14px 1px, 1px 14px, 14px 1px, 1px 14px, 14px 1px, 1px 14px, 14px 1px, 1px 14px;
}
.drop.over { border-style: solid; background-color: var(--gold-14); }
.drop.over::after {
  content: "Release — it converts right here";
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 6, 6, 0.82); border-radius: var(--r-md);
  font-family: var(--display); font-style: italic; font-size: 19px; color: var(--gold-light);
}
/* magnetic pull: polish.js writes --mx/--my; default 0 = perfectly inert */
.drop > * {
  transform: translate(calc(var(--mx, 0) * 8px), calc(var(--my, 0) * 8px));
  transition: transform 400ms var(--ease);
}
.drop .drop-lead { color: var(--cream-light); display: block; font-size: 15px; margin-bottom: 4px; }
.drop .drop-formats { display: block; font-size: 12px; }
.drop small { display: block; margin-top: 8px; font-size: 11px; color: var(--muted-deep); letter-spacing: 0.04em; }
/* conversion theater: one bracket pulse while the machine is working */
.drop.is-converting { animation: ms-brackets 600ms var(--ease) 1; }
@keyframes ms-brackets {
  50% { background-size: 16px 1px, 1px 16px, 16px 1px, 1px 16px, 16px 1px, 1px 16px, 16px 1px, 1px 16px; }
}
.try-sample { margin: 12px 0 0; font-size: 12px; }
.try-sample a { color: var(--gold-light); }

/* meta = provenance ledger: micro-caps key + gold tabular value */
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 16px;
  padding-top: 12px; border-top: 1px solid var(--line); }
.meta-row span { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-deep); }
.meta-row b { color: var(--gold-light); font-weight: 600; font-size: 12px;
  letter-spacing: 0.02em; text-transform: none; font-variant-numeric: tabular-nums; margin-left: 2px; }
/* warns = status ledger. app.js note() owns the inline color — never set color
   on .warns descendants; the tone tick reads it back via currentColor */
.warns { font-size: 11px; line-height: 1.65; letter-spacing: 0.02em;
  color: var(--muted-deep); font-variant-numeric: tabular-nums; }
.warns:empty { display: none; }
.warns:not(:empty) {
  position: relative; margin-top: 14px; padding: 10px 0 2px 14px;
  border-top: 1px solid var(--line);
  animation: ms-rise-6 320ms var(--ease) backwards;
}
.warns:not(:empty)::before {   /* tone tick — inherits app.js's inline color */
  content: ""; position: absolute; left: 0; top: 12px; bottom: 4px; width: 2px;
  background: currentColor; opacity: 0.55;
}

.field { margin-top: 16px; }
.field label { display: block; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; transition: color 240ms var(--ease); }
.field:focus-within > label { color: var(--gold-light); }
.field input, .field select {
  width: 100%; background: var(--void-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--cream); font-family: var(--body); font-size: 14px; padding: 10px 12px;
  box-shadow: var(--well);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.field input:hover, .field select:hover { border-color: var(--line-warm); }
.field input:focus, .field select:focus {
  outline: none; border-color: var(--gold-deep); box-shadow: var(--well), 0 0 0 3px var(--gold-26);
}
.field label.check { display: flex; align-items: flex-start; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--muted); cursor: pointer; margin-bottom: 0; }
/* crypto-sign checkbox, machined: appearance-none well + clip-path gold check */
.field label.check input {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; flex: none; margin: 2px 0 0;
  background: var(--void-2); border: 1px solid var(--line); border-radius: 3px;
  box-shadow: var(--well); display: inline-grid; place-content: center; cursor: pointer;
  transition: border-color var(--d-1) var(--ease), background-color var(--d-1) var(--ease);
}
.field label.check input::before {
  content: ""; width: 9px; height: 9px; background: var(--gold);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0); transition: transform var(--d-1) var(--ease);
}
.field label.check input:checked { border-color: var(--gold-deep); background: var(--gold-08); }
.field label.check input:checked::before { transform: scale(1); }
.field label.check input:hover { border-color: var(--gold-deep); }
.field label.check:hover { color: var(--cream); }
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.seg button { flex: 1; background: var(--void-2); color: var(--muted); border: 0; padding: 9px; font-size: 12px; cursor: pointer;
  transition: background-color 240ms var(--ease), color 240ms var(--ease); }
.seg button.active { background: var(--gold); color: #1a1407; font-weight: 600; }

#sigpad {
  width: 100%; height: 130px; background-color: #fbfaf7; border-radius: var(--r-sm); touch-action: none; cursor: crosshair;
  /* baseline rule + "x" start-mark — CSS background only; the bitmap app.js
     reads/writes sits above it and exported signature bytes are unaffected */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M3 3 L11 11 M11 3 L3 11' stroke='%23d8cdb4' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E"),
    linear-gradient(#e3dcc9, #e3dcc9);
  background-repeat: no-repeat, no-repeat;
  background-size: 14px 14px, calc(100% - 28px) 1px;
  background-position: 14px calc(100% - 30px), 14px calc(100% - 26px);
}
.sig-actions { display: flex; gap: 8px; margin-top: 8px; }
.sig-actions .btn { padding: 8px 14px; font-size: 12px; }
.sig-actions .btn:active { transform: scale(0.97); }

/* micro-caption under the signed-export button while it is still locked */
.unlock-note {
  display: block; margin: -2px 0 8px; text-align: center;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-deep);
}
#export-signed:not(:disabled) + .unlock-note { display: none; }
/* enable shimmer: fires the instant app.js removes disabled — the unlock */
#export-signed { position: relative; overflow: hidden; }
#export-signed:not(:disabled) { border-color: var(--gold); color: var(--gold-light); }
#export-signed:not(:disabled)::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, var(--gold-14) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: ms-unlock 700ms var(--ease) 1 both;
}
@keyframes ms-unlock { to { transform: translateX(120%); } }

/* ── document preview frame ──────────────────────────────────────────────── */
.preview-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-panel);
  transition: border-color var(--d-2) var(--ease); }
.preview-bar {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--void-2);
  transition: border-color var(--d-2) var(--ease);
}
.preview-bar .t { font-size: 11px; color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; }
.preview-bar .t b { color: var(--gold-light); }
/* conversion theater: indeterminate gold sweep while converting */
.preview-wrap.is-converting .preview-bar::after {
  content: ""; position: absolute; top: 0; left: 0; width: 40%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: ms-sweep 1.1s linear infinite;
}
@keyframes ms-sweep { from { transform: translateX(-100%); } to { transform: translateX(350%); } }
.preview-scroll {
  max-height: 78vh; max-height: 78svh; overflow: auto; padding: 8px;
  background: radial-gradient(140% 120% at 50% 0%, #14140f 55%, #100f0b 100%);
  scrollbar-width: thin; scrollbar-color: var(--gold-deep) #14140f;
}
.preview-scroll::-webkit-scrollbar { width: 8px; }
.preview-scroll::-webkit-scrollbar-track { background: #14140f; }
.preview-scroll::-webkit-scrollbar-thumb { background: var(--gold-deep); border-radius: 4px; }
/* arrival: the document settles into the felt (class re-armed by polish.js) */
#doc.doc-arrived { animation: ms-doc-settle 460ms var(--ease-settle); }
@keyframes ms-doc-settle { from { opacity: 0; transform: translateY(12px) scale(0.992); } }
/* fresh children fade in — gated off .editing so typing never re-animates */
#preview .momentum-doc:not(.editing) > * { animation: ms-fade-in 300ms ease backwards; }

/* ── Templates (start from a clean document) ─────────────────────────────── */
.template-row { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tpl-select {
  width: 100%; background: var(--void-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--cream); font-family: var(--body); font-size: 14px; padding: 10px 34px 10px 12px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: var(--well);
  transition: border-color 160ms var(--ease);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1 L5 5 L9 1' fill='none' stroke='%23a8893d' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.tpl-select:hover { border-color: var(--gold-deep); }
.tpl-select:focus-visible { outline: none; border-color: var(--gold-deep); box-shadow: var(--well), 0 0 0 3px var(--gold-26); }

/* ── Preview-bar actions (Edit / Share to sign) ──────────────────────────── */
.pv-actions { display: flex; align-items: center; gap: 8px; }
.pv-btn {
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--muted); font-family: var(--body); font-size: 11px; letter-spacing: 0.06em;
  padding: 6px 13px; cursor: pointer; white-space: nowrap; transition: all 160ms var(--ease);
}
.pv-btn:hover { border-color: var(--gold-deep); color: var(--gold-light); }
.pv-btn:focus-visible { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px var(--gold-26); }
.pv-btn[aria-pressed="true"] { border-color: var(--gold-deep); color: var(--gold); background: var(--gold-08); box-shadow: inset 0 -2px 0 var(--gold-deep); }

/* the document while it is being edited in place */
.momentum-doc.editing { outline: 2px solid var(--gold); outline-offset: 6px; cursor: text; }
.momentum-doc.editing:focus { outline-color: var(--gold-light); }

/* ── Share-to-sign output (the self-sovereign signing link) ──────────────── */
.share-out { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-warm); }   /* the issued ticket's perforation */
.share-lead { font-size: 12px; color: var(--muted); line-height: 1.55; margin-bottom: 10px; }
.share-linkrow { display: flex; gap: 8px; }
.share-linkrow input {
  flex: 1; min-width: 0; background: var(--void-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--cream); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px;
  letter-spacing: 0.01em; padding: 9px 11px;
  box-shadow: var(--well);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.share-linkrow input:hover { border-color: var(--line-warm); }
.share-linkrow input:focus { outline: none; border-color: var(--gold-deep); box-shadow: var(--well), 0 0 0 3px var(--gold-26); }
.share-linkrow .btn { white-space: nowrap; min-width: 96px; justify-content: center; }
.share-warn { font-size: 12px; color: var(--muted-deep); line-height: 1.55; }

/* the converted document itself (also inlined into exported files) */
.momentum-doc {
  background: #fbfaf7; color: #1b1a17; max-width: 820px; margin: 28px auto; padding: 64px 72px;
  font-family: "Montserrat", system-ui, sans-serif; font-size: 16px; line-height: 1.72;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5); border-radius: 2px;
}
.momentum-doc h1, .momentum-doc h2, .momentum-doc h3, .momentum-doc h4 {
  font-family: "Cormorant Garamond", Georgia, serif; color: #14130f; line-height: 1.15; font-weight: 600;
}
.momentum-doc h1, .momentum-doc .doc-title { font-size: 36px; margin: 0 0 6px; }
.momentum-doc .doc-subtitle { color: #6b6660; font-style: italic; margin-top: 0; }
.momentum-doc h2 { font-size: 26px; margin: 32px 0 10px; padding-bottom: 6px; border-bottom: 1px solid #e7e2d8; }
.momentum-doc h3 { font-size: 20px; margin: 24px 0 8px; }
.momentum-doc p { margin: 0 0 14px; }
.momentum-doc a { color: #9a7d2e; }
.momentum-doc blockquote { margin: 16px 0; padding: 6px 20px; border-left: 3px solid var(--gold); color: #4a463f; font-style: italic; }
.momentum-doc code { background: #efece3; padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }
.momentum-doc pre { background: #14140f; color: #e8e6e3; padding: 16px 18px; border-radius: 6px; overflow: auto; }
.momentum-doc pre code { background: none; padding: 0; color: inherit; }
.momentum-doc table.doc-table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; }
.momentum-doc table.doc-table th, .momentum-doc table.doc-table td { border: 1px solid #ddd6c8; padding: 8px 12px; text-align: left; }
.momentum-doc table.doc-table th { background: #f1ece0; }
.momentum-doc img { max-width: 100%; height: auto; border-radius: 3px; }
.momentum-doc hr { border: 0; border-top: 1px solid #e2dccf; margin: 28px 0; }

/* signature block inside a signed document */
.momentum-sig {
  margin-top: 48px; padding-top: 18px; border-top: 1px solid #e2dccf;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
}
.momentum-sig .who { font-size: 13px; color: #4a463f; }
.momentum-sig .who b { display: block; font-size: 16px; color: #14130f; font-family: "Cormorant Garamond", serif; }
.momentum-sig img.ink { height: 64px; }
.momentum-sig .typed { font-family: "Cormorant Garamond", cursive, serif; font-size: 34px; color: #14130f; }
.momentum-seal {
  margin-top: 18px; font-size: 10.5px; color: #8a8478; letter-spacing: 0.03em; line-height: 1.5;
  border-top: 1px dashed #d8d1c2; padding-top: 10px; word-break: break-all;
}
.momentum-seal b { color: #6b6660; }

/* ── footer ───────────────────────────────────────────────────────────────── */
.site-footer { position: relative; padding: 48px 24px 40px; border-top: 0; color: var(--muted-deep); font-size: 12px; }
.site-footer::before {
  content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
  background: var(--hairline);
}
.site-footer::after {
  content: ""; position: absolute; top: 0; left: 50%; width: 24px; height: 1px;
  transform: translate(-50%, -50%); background: var(--gold-deep);
}
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.creed { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted-deep); }

/* the ceremonial seal badge — stamps on arrival, re-arms when it hides */
.badge {
  display: inline-block; position: relative; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold); border: 1px solid var(--gold-deep); border-radius: 999px; padding: 3px 10px;
}
#prev-badge:not([hidden]) { animation: ms-stamp 380ms var(--ease-settle) backwards; }
#prev-badge:not([hidden])::after {
  content: ""; position: absolute; inset: -2px; border-radius: 999px;
  border: 1px solid var(--gold); opacity: 0; pointer-events: none;
  animation: ms-seal-ring 620ms var(--ease) 80ms 1 both;
}
@keyframes ms-stamp { from { opacity: 0; transform: scale(1.35) rotate(-6deg); } }
@keyframes ms-seal-ring { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.8); } }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  /* section links (incl. Verify) live in the .nav-rail deed index ≤900px;
     the header row keeps brand + gold CTA only */
  .nav a:not(.btn) { display: none; }
  .hero { min-height: 0; }   /* content defines hero height on mobile — no dead void */
  .hero .wrap { display: block; }
  .hero-inner { max-width: 100%; }
  .alien-stage { height: 34vh; height: 34svh; min-height: 240px; margin-top: 12px; }
  /* 16px kills iOS Safari's focus auto-zoom on the signing inputs */
  .field input, .field select, .tpl-select, .share-linkrow input { font-size: 16px; }
}
@media (max-width: 600px) {
  .alien-stage { height: 26vh; height: 26svh; min-height: 180px; }
  /* let the preview bar wrap so Edit + Share never overflow a narrow phone */
  .preview-bar { flex-wrap: wrap; gap: 8px; }
  /* keep the sticky header within the viewport on narrow phones */
  .site-header { padding: 12px 16px; }
  .site-header.scrolled { padding: 9px 16px; }
  .nav { gap: 12px; }
  .brand .name { font-size: 18px; letter-spacing: 0.08em; }
  .brand .mark { width: 22px; height: 22px; }
  .btn-cta { padding: 10px 14px; }
  .wrap { padding: 0 16px; }
}
@media (max-width: 400px) {
  /* very narrow: tighten the brand/CTA so the header never overflows
     (Verify rides the .nav-rail at every mobile width) */
  .brand .name { font-size: 15px; }
  .btn-cta { padding: 9px 12px; font-size: 12px; }
}

/* ── 3D alien hero canvas: fills the right column, transparent so the page's
   gold radial gradient shows through; above .alien-glow, never grabs input ── */
.alien-stage canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; pointer-events: none; background: transparent; z-index: 2;
}

/* ── accessibility helpers ────────────────────────────────────────────────── */
.skip-link {
  position: absolute; left: -9999px; top: auto;
  background: var(--gold); color: #1a1407; padding: 10px 16px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; text-decoration: none; z-index: 100;
}
.skip-link:focus { left: 16px; top: 16px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.fld-label { display: block; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
kbd {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85em;
  background: var(--void-2); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; color: var(--cream);
}

/* visible keyboard focus everywhere (mouse users keep the clean look) */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible,
input:focus-visible, .drop:focus-visible, .seg button:focus-visible {
  outline: 2px solid var(--gold-light); outline-offset: 2px; border-radius: var(--r-sm);
}
.drop:focus-visible { border-color: var(--gold); }

/* header CTA (was an inline style) + guaranteed tap targets */
.btn-cta { padding: 11px 18px; min-height: 44px; }
.seg button { min-height: 44px; }
.sig-actions .btn { min-height: 44px; }

/* ── intelligence chip row (local, no-network document analysis) ──────────── */
.intel-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: 0.04em; color: var(--muted);
  background: var(--void-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
  transition: border-color 200ms var(--ease);
}
.chip:hover { border-color: var(--gold-deep); }
.chip-action {
  cursor: pointer; color: #1a1407; background: var(--gold); border-color: var(--gold-deep); font-weight: 600;
}
.chip-action:hover { background: var(--gold-light); }

/* ── calibrated inference chips (human-centered: show how sure + why, never a bare fact) ── */
.chip-infer { cursor: help; }
.chip-infer .chip-conf-txt {
  font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 999px; font-weight: 600;
}
.chip-conf-high  .chip-conf-txt { color: #1a1407; background: var(--gold); }
.chip-conf-medium .chip-conf-txt { color: var(--gold-light); background: rgba(201,168,76,0.16); }
.chip-conf-low   .chip-conf-txt { color: var(--muted); background: rgba(255,255,255,0.06); }
/* a faint left tick so confidence reads without relying on colour alone (a11y)
   — the left-tick colour system is FROZEN, hover warms the other sides only */
.chip-infer { border-left-width: 3px; }
.chip-conf-high, .chip-conf-high:hover  { border-left-color: var(--gold); }
.chip-conf-medium, .chip-conf-medium:hover { border-left-color: var(--gold-deep); }
.chip-conf-low, .chip-conf-low:hover   { border-left-color: var(--line); }

/* provenance: what the conversion changed (never a silent black box) */
.meta-changes { cursor: help; color: var(--muted-deep); }
.meta-changes b { color: var(--gold-light); font-weight: 600; }

/* ── batch (multi-file) result list ───────────────────────────────────────── */
.batch-list { margin-top: 14px; display: grid; gap: 6px; }
.batch-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--void-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--cream); font-family: var(--body); font-size: 12px; padding: 9px 12px; cursor: pointer;
  transition: border-color 200ms var(--ease);
}
.batch-item:hover:not(:disabled) { border-color: var(--gold-deep); }
.batch-item:disabled { cursor: default; opacity: 0.75; }
.batch-item .mk { flex: none; width: 16px; text-align: center; font-weight: 600; }
/* the only green in the system is retired: success ink is gold, failure is ember */
.batch-item.ok .mk { color: var(--gold); }
.batch-item.bad .mk { color: var(--ember); }
.batch-item .bn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: transform 200ms var(--ease); }
.batch-item:hover:not(:disabled) .bn { transform: translateX(2px); }
.batch-item .be { color: var(--muted-deep); font-size: 11px; }

/* ── AI Intelligence Layer panel (Velocity, opt-in) ───────────────────────── */
.ai-panel { border-color: var(--gold-deep); background: linear-gradient(180deg, rgba(201,168,76,0.05), var(--panel) 60%); }
.ai-tag {
  font-family: var(--body); font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  color: #1a1407; background: var(--gold); border-radius: 999px; padding: 2px 8px; vertical-align: middle; margin-left: 6px;
}
.ai-tasks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ai-task {
  font-family: var(--body); font-size: 12px; letter-spacing: 0.02em; color: var(--cream);
  background: var(--void-2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer;
  min-height: 36px; transition: border-color 200ms var(--ease), color 200ms var(--ease);
}
.ai-task:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-light); }
.ai-task.active { background: var(--gold); color: #1a1407; border-color: var(--gold-deep); font-weight: 600; }
.ai-task:disabled { opacity: 0.55; cursor: default; }
.ai-out { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.ai-answer { font-size: 14px; line-height: 1.6; color: var(--cream); white-space: normal; }
.ai-answer.ai-err { color: var(--ember); font-size: 13px; }
.ai-meta { margin-top: 10px; font-size: 11px; letter-spacing: 0.03em; color: var(--gold-light); }
.ai-trust { margin-top: 6px; font-size: 11px; line-height: 1.5; color: var(--muted-deep); border-top: 1px dashed var(--line); padding-top: 6px; }
.ai-thinking { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.ai-spin {
  width: 13px; height: 13px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); border-top-color: var(--gold); animation: ai-spin 0.7s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ai-spin { animation-duration: 2s; } }

/* ── footer links ─────────────────────────────────────────────────────────── */
.footer-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--gold-light); }
.footer-links .dot-sep { color: var(--muted-deep); }

/* ── resilience skin: calm notices, fallbacks, diagnostics ─────────────────── */
.ms-toast-region {
  position: fixed; right: 16px; bottom: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(92vw, 380px); pointer-events: none;
}
.ms-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--muted-deep);
  border-radius: var(--r-md); padding: 12px 14px; color: var(--cream);
  font-size: 13px; line-height: 1.5; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  animation: ms-toast-in 260ms var(--ease);
}
.ms-toast-error { border-left-color: var(--ember); }
.ms-toast-ok { border-left-color: var(--gold); }
.ms-toast-info { border-left-color: var(--gold-deep); }
.ms-toast-msg { flex: 1; min-width: 0; }
.ms-toast-btn {
  flex: none; background: transparent; border: 1px solid var(--gold-deep); border-radius: var(--r-sm);
  color: var(--gold-light); font-family: var(--body); font-size: 12px; padding: 4px 10px; cursor: pointer;
}
.ms-toast-btn:hover { background: rgba(201,168,76,0.1); }
.ms-toast-x {
  flex: none; background: transparent; border: 0; color: var(--muted-deep);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.ms-toast-x:hover { color: var(--cream); }
.ms-toast-out { animation: ms-toast-out 240ms var(--ease) forwards; }
@keyframes ms-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ms-toast-out { to { opacity: 0; transform: translateY(8px); } }

.ms-fallback {
  padding: 20px; border: 1px dashed var(--line); border-radius: var(--r-md);
  color: var(--muted); font-size: 14px; text-align: center;
}
/* empty-conversion card — rendered inside the light document sheet */
.ms-empty-doc { text-align: center; padding: 48px 20px; }
.ms-empty-doc h2 { font-family: var(--display); color: #1b1a17; margin: 0 0 12px; border: 0; padding: 0; }
.ms-empty-doc p { color: #4a463f; max-width: 480px; margin: 0 auto; line-height: 1.6; }
.ms-whitescreen {
  max-width: 480px; margin: 80px auto; padding: 32px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel);
}
.ms-whitescreen h2 { font-family: var(--display); color: var(--cream-light); margin: 0 0 10px; }
.ms-whitescreen p { color: var(--muted); margin: 0 0 20px; }
.ms-reload {
  background: var(--gold); color: #1a1407; border: 0; border-radius: var(--r-sm);
  font-family: var(--body); font-weight: 600; padding: 10px 22px; cursor: pointer;
}
.ms-reload:hover { background: var(--gold-light); }

.ms-health-wrap {
  position: fixed; inset: 5vh 5vw auto; max-height: 82vh; z-index: 10000;
  background: var(--void-2); border: 1px solid var(--gold-deep); border-radius: var(--r-md);
  overflow: auto; box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.ms-health { margin: 0; padding: 18px; color: var(--cream); font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.ms-health-x {
  position: sticky; bottom: 0; width: 100%; background: var(--gold); color: #1a1407;
  border: 0; font-family: var(--body); font-weight: 600; padding: 10px; cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .ms-toast { animation: none; }
  .ms-toast-out { animation: none; opacity: 0; }
}
@media (max-width: 480px) {
  .ms-toast-region { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* ── pricing (roadmap E) ───────────────────────────────────────────────────── */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
.tier {
  display: flex; flex-direction: column; position: relative;
  background: var(--panel);
  border: 1px solid var(--line); border-top-color: var(--line-warm);
  border-radius: var(--r-sm);
  padding: 26px 24px;
  box-shadow: var(--shadow-panel);
  transition: border-color 280ms var(--ease);
}
.tier:hover { border-top-color: var(--gold-deep); }
.tier-featured {
  border-color: var(--gold-deep);
  background:
    radial-gradient(80% 40% at 50% 0%, rgba(201, 168, 76, 0.09), transparent 70%),
    var(--panel);
}
.tier-flag {
  position: absolute; top: -11px; left: 24px; background: var(--gold); color: #1a1407;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 2px;
}
.tier-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.tier-head h3 { font-family: var(--display); font-size: 22px; margin: 0; color: var(--gold-light); }
.tier-price { font-family: var(--display); font-size: 26px; color: var(--cream-light); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tier-price span { font-family: var(--body); font-size: 12px; color: var(--muted-deep); }
.tier-lead { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin: 0 0 14px; }
.tier-feat { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 9px; }
.tier-feat li { position: relative; padding-left: 22px; color: var(--cream); font-size: 13.5px; line-height: 1.5; }
.tier-feat li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--gold); font-weight: 400; }
.tier-feat li b { color: var(--gold-light); font-weight: 600; }
.tier-feat code, .tier-lead code, .api-note code {
  background: var(--void-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 1px 5px; font-size: 12px; color: var(--gold-light);
}
.tier-cta { margin-top: auto; width: 100%; justify-content: center; }

/* the license vault */
.redeem {
  margin-top: 30px; padding: 24px 26px; background: var(--void);
  border: 1px solid var(--line-warm); border-radius: var(--r-sm);
}
.redeem-lead h3 { font-family: var(--display); font-size: 22px; margin: 0 0 6px; color: var(--cream-light); }
.redeem-lead p { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; max-width: 620px; }
.redeem-lead p b { color: var(--gold-light); font-weight: 600; }
.redeem-row { display: flex; gap: 10px; align-items: stretch; max-width: 620px; }
.redeem-row input {
  flex: 1; min-width: 0; background: var(--void); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--cream); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; padding: 10px 12px;
  box-shadow: var(--well);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.redeem-row input:hover { border-color: var(--line-warm); }
.redeem-row input:focus { outline: none; border-color: var(--gold-deep); box-shadow: var(--well), 0 0 0 3px var(--gold-26); }
.redeem-row .btn { flex: none; }
.redeem-out { margin-top: 12px; font-size: 13px; padding: 10px 12px; border-radius: var(--r-sm); }
.redeem-out:not([hidden]) { animation: ms-rise-6 320ms var(--ease) backwards; }
.redeem-ok { background: rgba(201,168,76,0.1); border: 1px solid var(--gold-deep); color: var(--gold-light); }
.redeem-err { background: rgba(217,140,106,0.08); border: 1px solid var(--ember-deep); color: var(--ember-soft); }
.lic-badge { margin-top: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--cream); }
.lic-badge b { color: var(--gold-light); font-weight: 600; letter-spacing: 0.04em; }
.lic-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold);
  animation: ms-breathe 3s ease-in-out infinite; }
@keyframes ms-breathe { 50% { opacity: 0.55; transform: scale(0.85); } }
.lic-grace { color: var(--muted-deep); }
.lic-clear {
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--muted); font-family: var(--body); font-size: 12px; padding: 5px 12px; cursor: pointer; margin-left: 4px;
  display: inline-flex; align-items: center;
}
.lic-clear:hover { border-color: var(--gold-deep); color: var(--gold-light); }
.lic-clear:active { transform: scale(0.97); }

.api-quick { margin-top: 26px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.api-quick summary { cursor: pointer; padding: 14px 18px; color: var(--gold-light); font-size: 14px; font-weight: 600; list-style: none; }
.api-quick summary::-webkit-details-marker { display: none; }
.api-quick summary::before { content: "▸ "; color: var(--gold); }
.api-quick[open] summary::before { content: "▾ "; }
.api-quick[open] pre, .api-quick[open] .api-note { animation: ms-fade-in 240ms var(--ease) backwards; }
.api-quick pre {
  margin: 0 18px; background: var(--void); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; color: var(--cream);
}
.api-quick code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.api-note { color: var(--muted); font-size: 13px; line-height: 1.55; padding: 12px 18px 16px; margin: 0; }

@media (max-width: 860px) { .price-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .redeem-row { flex-direction: column; }
  .redeem-row input { font-size: 16px; }
  .api-quick pre { margin: 0 10px; }
}

/* ── contract-driven entry choreography (zero JS): [hidden] → rendered
   restarts these automatically; they can never fire while hidden ─────────── */
#sign-panel:not([hidden]), #export-panel:not([hidden]), #ai-panel:not([hidden]) {
  animation: ms-rise-in 480ms var(--ease) backwards;
}
#sign-panel:not([hidden]) > *, #export-panel:not([hidden]) > *, #ai-panel:not([hidden]) > * {
  animation: ms-rise-6 420ms var(--ease) backwards;
}
#sign-panel:not([hidden]) > :nth-child(2), #export-panel:not([hidden]) > :nth-child(2), #ai-panel:not([hidden]) > :nth-child(2) { animation-delay: 60ms; }
#sign-panel:not([hidden]) > :nth-child(3), #export-panel:not([hidden]) > :nth-child(3), #ai-panel:not([hidden]) > :nth-child(3) { animation-delay: 120ms; }
#sign-panel:not([hidden]) > :nth-child(4), #export-panel:not([hidden]) > :nth-child(4), #ai-panel:not([hidden]) > :nth-child(4) { animation-delay: 180ms; }
#sign-panel:not([hidden]) > :nth-child(5), #export-panel:not([hidden]) > :nth-child(5), #ai-panel:not([hidden]) > :nth-child(5) { animation-delay: 240ms; }
#sign-panel:not([hidden]) > :nth-child(6), #export-panel:not([hidden]) > :nth-child(6), #ai-panel:not([hidden]) > :nth-child(6) { animation-delay: 300ms; }
#meta:not([hidden]), #intel:not([hidden]), #batch:not([hidden]), #share-out:not([hidden]) {
  animation: ms-rise-6 360ms var(--ease) backwards;
}
/* insertion pop-ins: innerHTML-inserted chips / tasks / batch rows */
#intel .chip, #ai-tasks .ai-task, #batch .batch-item {
  animation: ms-pop 240ms var(--ease) backwards;
}
#intel .chip:nth-child(2), #ai-tasks .ai-task:nth-child(2), #batch .batch-item:nth-child(2) { animation-delay: 50ms; }
#intel .chip:nth-child(3), #ai-tasks .ai-task:nth-child(3), #batch .batch-item:nth-child(3) { animation-delay: 100ms; }
#intel .chip:nth-child(4), #ai-tasks .ai-task:nth-child(4), #batch .batch-item:nth-child(4) { animation-delay: 150ms; }
#intel .chip:nth-child(5), #ai-tasks .ai-task:nth-child(5), #batch .batch-item:nth-child(5) { animation-delay: 200ms; }
#intel .chip:nth-child(n+6), #ai-tasks .ai-task:nth-child(n+6), #batch .batch-item:nth-child(n+6) { animation-delay: 250ms; }

/* ══════════════════════════════════════════════════════════════════════════
   APP SURFACES — whole-UI leg ("The Instrument, interior")
   Every rule keys off state app.js already writes (hidden / disabled /
   .active / .ok / .bad / .redeem-ok / :checked / innerHTML re-creation).
   No app.js selector renamed or restructured. Motion = transform/opacity/
   border-color only; no !important on motion; inert under the global
   reduced-motion override. One gold primary per panel; the one NEW ceremony
   this leg is the license ignition.
   ══════════════════════════════════════════════════════════════════════════ */

/* — tap targets: real 44px size where fingers are; desktop keeps jewel scale — */
@media (pointer: coarse) { .pv-btn, .lic-clear { min-height: 44px; padding: 10px 14px; } }

/* — sign panel · sigmode sliding thumb (:has-gated; degrade = today's exact
   solid-fill behavior in non-:has browsers) — */
@supports selector(:has(*)) {
  .seg { position: relative; background: var(--void-2); }
  .seg::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 50%;
    background: var(--gold); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transform: translateX(0); transition: transform 200ms var(--ease);
  }
  .seg:has(> button:last-child.active)::before { transform: translateX(100%); }
  .seg button { position: relative; z-index: 1; background: transparent; }
  .seg button.active { background: transparent; }   /* the thumb carries the gold */
}
.seg button:focus-visible { outline-offset: -3px; }  /* seat the ring inside the overflow:hidden shell */

/* — sigpad in a registered frame. HARD RULE: the canvas itself NEVER gets a
   border (border-box rect vs content-box bitmap = ink offset); the frame
   carries all chrome, sign.js re-measures via getBoundingClientRect — */
.sig-frame {
  position: relative; padding: 7px; margin-top: 2px;
  background: var(--void-2); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--well); transition: border-color var(--d-2) var(--ease);
}
.sig-frame::before {   /* corner registration marks — 6px gold-deep ticks at 3px insets */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  opacity: 0.55; transition: opacity var(--d-2) var(--ease);
  background-repeat: no-repeat;
  background-image:
    linear-gradient(var(--gold-deep), var(--gold-deep)), linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)), linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)), linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)), linear-gradient(var(--gold-deep), var(--gold-deep));
  background-size: 6px 1px, 1px 6px, 6px 1px, 1px 6px, 6px 1px, 1px 6px, 6px 1px, 1px 6px;
  background-position:
    3px 3px, 3px 3px,
    calc(100% - 3px) 3px, calc(100% - 3px) 3px,
    3px calc(100% - 3px), 3px calc(100% - 3px),
    calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) calc(100% - 3px);
}
.sig-frame:hover, .sig-frame:focus-within { border-color: var(--gold-deep); }
.sig-frame:hover::before, .sig-frame:focus-within::before { opacity: 1; }
.sig-frame:active { border-color: var(--gold); }   /* pointerdown bubbles: ink is flowing */
#sigpad { display: block; }

/* — typed signature: the input BECOMES the preview. 26px Cormorant 400, never
   italic/bold — it must show the exported .momentum-sig .typed truth.
   Double-id outranks .field input everywhere incl. the mobile 16px rule — */
#type-wrap input#typed {
  height: 84px; padding: 8px 18px 26px;
  background-color: #fbfaf7; color: #14130f; caret-color: var(--gold-deep);
  font-family: var(--display); font-size: 26px; font-weight: 400; letter-spacing: 0.01em;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background-image: linear-gradient(#e3dcc9, #e3dcc9);
  background-repeat: no-repeat;
  background-size: calc(100% - 36px) 1px;
  background-position: 18px calc(100% - 20px);
  box-shadow: none;                    /* paper is exempt from the dark well */
}
#type-wrap input#typed::placeholder {
  font-family: var(--body); font-size: 13px; font-style: normal; font-weight: 400;
  color: #8a8478; letter-spacing: 0.02em;
}
#type-wrap input#typed:focus {
  outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px var(--gold-26);
}

/* — license vault: THE new ceremony (ignition + seal ring on the persistent
   badge; [hidden] display-restart re-arms it; scale/opacity only) — */
#lic-badge:not([hidden]) { animation: ms-ignite 420ms var(--ease-settle) backwards; }
@keyframes ms-ignite { from { opacity: 0; transform: scale(1.18); } }
.lic-dot { position: relative; }
#lic-badge:not([hidden]) .lic-dot::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--gold); opacity: 0; pointer-events: none;
  animation: ms-seal-ring 620ms var(--ease) 140ms 1 both;
}

/* — sign → unlock arc: the export step numeral warms with the unlock — */
.panel:has(#export-signed:not(:disabled)) h3 .step-n { color: var(--gold-light); }
/* — sealed state tints the preview plate: a state lamp, not an animation — */
.preview-wrap:has(#prev-badge:not([hidden])) { border-color: rgba(168, 137, 61, 0.5); }
.preview-wrap:has(#prev-badge:not([hidden])) .preview-bar { border-bottom-color: rgba(168, 137, 61, 0.35); }

/* — batch: true selected state (polish.js writes aria-current on click) +
   engraved failure spine — */
.batch-item[aria-current="true"] { border-color: var(--gold-deep); background: var(--gold-04); }
.batch-item[aria-current="true"] .bn { color: var(--gold-light); }
.batch-item[aria-current="true"]::after {
  content: "viewing"; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold-deep); flex: none;
}
.batch-item:active:not(:disabled) { transform: scale(0.995); }
.batch-item.bad { border-left: 2px solid var(--ember-deep); padding-left: 11px; }

/* — share-out: copy flash at the exact copy moment (.btn-gold already has
   position:relative + overflow:hidden; app.js's Copy→Copied stays the
   semantic confirmation) — */
#share-out .btn-gold:focus::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: rgba(255, 255, 255, 0.3); opacity: 0;
  animation: ms-flash 200ms var(--ease) 1;
}
@keyframes ms-flash { from { opacity: 0.5; } to { opacity: 0; } }

/* — sample link: the missing instance of the nav-underline grammar — */
.try-sample a { position: relative; }
.try-sample a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px;
  background: var(--gold); transform: scaleX(0); transform-origin: 0 50%; transition: transform 240ms var(--ease); }
.try-sample a:hover::after, .try-sample a:focus-visible::after { transform: scaleX(1); }

/* ── shared motion keyframes (all transform/opacity only) ─────────────────── */
@keyframes ms-rise-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes ms-rise-6 { from { opacity: 0; transform: translateY(6px); } }
@keyframes ms-fade-in { from { opacity: 0; } }
@keyframes ms-pop { from { opacity: 0; transform: scale(0.96); } }

/* ── scroll-reveal (dual-gated: requires BOTH working JS/IO and motion OK;
   otherwise everything is simply visible; opacity/transform only) ─────────── */
@media (prefers-reduced-motion: no-preference) {
  html.js-polish .rv {
    opacity: 0; transform: translateY(16px);
    transition: opacity 640ms var(--ease), transform 640ms var(--ease);
  }
  html.js-polish .rv.in { opacity: 1; transform: none; }
  /* grid stagger, 80ms steps, capped at 6 */
  html.js-polish .grid-3 > .rv:nth-child(2),
  html.js-polish .reasons > .rv:nth-child(2),
  html.js-polish .price-grid > .rv:nth-child(2) { transition-delay: 80ms; }
  html.js-polish .grid-3 > .rv:nth-child(3),
  html.js-polish .reasons > .rv:nth-child(3),
  html.js-polish .price-grid > .rv:nth-child(3) { transition-delay: 160ms; }
  html.js-polish .reasons > .rv:nth-child(4) { transition-delay: 240ms; }
  html.js-polish .reasons > .rv:nth-child(5) { transition-delay: 320ms; }
  html.js-polish .reasons > .rv:nth-child(n+6) { transition-delay: 400ms; }
  /* section hairlines are drafted as you read */
  html.js-polish .sec::before { transform: scaleX(0); transition: transform 900ms var(--ease); }
  html.js-polish .sec.in::before { transform: scaleX(1); }
  /* reasons: the border draws first, the copy fades 80ms later */
  html.js-polish .reason.rv { transform: none; transition-duration: 420ms; }
  html.js-polish .reason.rv::before, html.js-polish .reason.rv::after {
    transform: scaleY(0); transform-origin: 50% 0; transition: transform 420ms var(--ease);
  }
  html.js-polish .reason.rv.in { transition-delay: 80ms; }
  html.js-polish .reason.rv.in::before, html.js-polish .reason.rv.in::after { transform: scaleY(1); }
}

/* ── reduced motion: honour the OS setting across all CSS transitions ──────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .btn-gold:hover, .card:hover { transform: none; }
  .hero-cue { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   BEYOND — leg 3 ("The Living Hero"): the page becomes alive, with restraint.
   1) the hero dust field (canvas created by engine/hero.js);
   2) scroll-scrubbed section choreography (pure CSS, zero JS scroll work,
      doubly gated: reduced-motion media + @supports animation-timeline);
   3) the ONE new ceremony — page-settle terminus on the preview plate.
   Sacred surfaces untouched; the only sacred-id CSS reference is
   #doc.doc-arrived, which the baseline already styles.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── LEG 3 · living-hero dust field (canvas created by engine/hero.js as the
   first child of .hero; sized to the hero stage only, never full-page) ────── */
.hero-field { position: absolute; inset: 0; z-index: 0; pointer-events: none; }

/* ── LEG 3 · scroll-scrubbed choreography. Structurally inside the motion
   gate: the global !important duration override cannot stop timeline
   animations (progress-based), so this media gate IS the off-switch.
   Non-supporting browsers (Firefox stable) keep the leg-2 IO draw exactly. ── */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    /* hero exhale on exit — copy settles away; the canvas fades ONLY
       (no translate: dust targets are anchored to .alien-stage geometry) */
    .hero-inner { animation: ms-hero-exit linear both;
      animation-timeline: view(); animation-range: exit 0% exit 90%; }
    .hero-field { animation: ms-hero-exit-fade linear both;
      animation-timeline: view(); animation-range: exit 0% exit 90%; }
    /* section hairlines draw themselves as they enter (animation beats the
       IO transition on the same property; fill both holds pre-entry state) */
    .sec::before { animation: ms-draw-x linear both;
      animation-timeline: view(); animation-range: cover 0% cover 35%; }
    /* roman numerals settle into their seat, trailing the hairline */
    .sec-index { animation: ms-numeral-settle linear both;
      animation-timeline: view(); animation-range: cover 5% cover 40%; }
    /* app progress rail warms with reading depth (rail pseudo exists ≥901px
       only; node ignition stays 100% panel-state-driven — no collision) */
    .app-steps::before { animation: ms-rail-warm linear both;
      animation-timeline: view(); animation-range: entry 0% cover 40%; }
    /* footer: hairline draws, the centre gold tick strikes last —
       completing exactly at max scroll */
    .site-footer::before { animation: ms-draw-x linear both;
      animation-timeline: view(); animation-range: entry 0% entry 70%; }
    .site-footer::after { animation: ms-tick-strike linear both;
      animation-timeline: view(); animation-range: entry 40% entry 100%; }
    /* colophon seal settles into the plate */
    .trust-close .tc-seal { animation: ms-seal-settle linear both;
      animation-timeline: view(); animation-range: cover 0% cover 30%; }

    @keyframes ms-hero-exit { to { opacity: 0.1; transform: translateY(-34px); } }
    @keyframes ms-hero-exit-fade { to { opacity: 0.1; } }
    @keyframes ms-draw-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
    @keyframes ms-numeral-settle {
      from { opacity: 0; transform: translate(-50%, calc(-50% - 8px)); }
      to   { opacity: 1; transform: translate(-50%, -50%); } }
    @keyframes ms-rail-warm { from { opacity: 0.35; } to { opacity: 1; } }
    @keyframes ms-tick-strike {
      from { transform: translate(-50%, -50%) scaleX(0); }
      to   { transform: translate(-50%, -50%) scaleX(1); } }
    @keyframes ms-seal-settle {
      from { opacity: 0.3; transform: scale(0.88); }
      to   { opacity: 1; transform: scale(1); } }
  }
}

/* ── LEG 3 · page-settle terminus (the ONE new ceremony's resolution): one
   full sweep that fades as it exits, after the document lands. The
   :not(.is-converting) guard is LOAD-BEARING: without it this rule's
   specificity (1,3,1) outranks .preview-wrap.is-converting (0,3,1) and its
   finished, held-at-0 animation would permanently suppress the indeterminate
   conversion sweep from the second conversion onward. Non-:has browsers
   degrade to the settle alone; inert under the global reduce override. ──── */
.preview-wrap:not(.is-converting):has(#doc.doc-arrived) .preview-bar::after {
  content: ""; position: absolute; top: 0; left: 0; width: 40%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: ms-settle-sweep 520ms var(--ease) 1 both;
}
@keyframes ms-settle-sweep {
  from { transform: translateX(-100%); opacity: 1; }
  to   { transform: translateX(350%); opacity: 0; }
}

/* ══════════════════════════════════════════════════════════════════════════
   POCKET — leg 4 ("The Instrument in the pocket"): deed-index nav rail,
   tap-first touch language, safe-area registration, 44px touch law, narrow
   plate + rhythm compression. Sacred surfaces untouched — the only id
   references are #preview / #drop-adjacent / #sigpad, all CSS-bound already.
   Cascade note: this block deliberately overrides earlier media rules by
   source order — never move it above the existing media queries.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── deed-index rail: the section index, machined into the masthead.
   ≤900px only; ≥901px it is display:none (one nav per viewport class — no
   duplicate AT landmarks). Rides the sticky header: no new z-index, no new
   composited surface. ────────────────────────────────────────────────────── */
.nav-rail { display: none; }
@media (max-width: 900px) {
  /* grid, not flex-wrap: row 1 keeps the baseline brand/CTA squeeze exactly
     (wrap would push the CTA to its own row), row 2 is the rail's alone */
  .site-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .nav-rail {
    display: flex; align-items: stretch; gap: 26px;
    grid-column: 1 / -1; min-width: 0;
    margin: 12px -24px 0; padding: 0 32px 0 24px;
    border-top: 1px solid var(--line);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* right-edge fade = "there is more"; the 32px padding-right lets the last
       entry clear it at full scroll */
    -webkit-mask-image: linear-gradient(90deg, #000, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(90deg, #000, #000 calc(100% - 32px), transparent);
  }
  .nav-rail::-webkit-scrollbar { display: none; }
  .nav-rail a {
    flex: none; display: inline-flex; align-items: center; min-height: 44px;
    position: relative; white-space: nowrap;
    font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--muted);
  }
  .nav-rail a:hover, .nav-rail a:focus-visible { color: var(--cream); }
  .nav-rail a:active { color: var(--gold-light); }
  /* active-section lamp — polish.js writes aria-current="location" (semantic,
     registered before its reduced-motion bail; rail navigates fully without it) */
  .nav-rail a[aria-current] { color: var(--gold); }
  .nav-rail a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 9px; height: 1px;
    background: var(--gold); transform: scaleX(0); transform-origin: 0 50%;
    transition: transform 240ms var(--ease);
  }
  .nav-rail a[aria-current]::after, .nav-rail a:focus-visible::after { transform: scaleX(1); }
  /* the trust door keeps its persistent deep-gold underline, rail edition */
  .nav-rail .rail-verify::after { transform: scaleX(1); background: rgba(168, 137, 61, 0.4); }
  /* two-row header → anchors land clear of it (tallest band: ~136px at 601-900) */
  #main, #why, #trust, #convert, #agents, #pricing { scroll-margin-top: 136px; }
}
@media (max-width: 600px) {
  .nav-rail { margin: 8px -16px 0; padding: 0 32px 0 16px; gap: 22px; }
}

/* ── hero, stacked: content-driven height (min-height edit above), no
   pointless cue, no orphaned eyebrow ─────────────────────────────────────── */
@media (max-width: 900px) {
  .hero-inner { padding: 48px 0 8px; }
  .alien-stage { margin-top: 0; }
  .hero-cue { display: none; }   /* below the fold on phones — layout removal, not motion */
  .hero-caption { margin-top: 18px; }
}
@media (max-width: 400px) {
  /* the flanked eyebrow orphan-wraps at 320: drop the flanks, tighten tracking */
  .hero .eyebrow { letter-spacing: 0.26em; }
  .hero .eyebrow::before, .hero .eyebrow::after { display: none; }
}

/* ── safe areas (notch / home bar / status bar; viewport-fit=cover is set in
   index.html). Longhands beat the earlier shorthands by source order at equal
   specificity; .scrolled variants included so its shorthand can't strip them.
   Browsers without env() drop these declarations and keep the originals. ──── */
.site-header, .site-header.scrolled {
  padding-left: calc(24px + env(safe-area-inset-left, 0px));
  padding-right: calc(24px + env(safe-area-inset-right, 0px));
}
.site-header { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
.site-header.scrolled { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
@media (max-width: 600px) {
  .site-header, .site-header.scrolled {
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
  }
  .site-header { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .site-header.scrolled { padding-top: calc(9px + env(safe-area-inset-top, 0px)); }
}
.site-footer {
  padding-left: calc(24px + env(safe-area-inset-left, 0px));
  padding-right: calc(24px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}
.ms-toast-region { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 480px) {
  .ms-toast-region { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}
/* installed PWA: firmer plate under the OS status bar (inert in a browser tab) */
@media (display-mode: standalone) {
  .site-header { background: rgba(6, 6, 6, 0.9); }
}

/* ── touch language: tap-first. .pf = fine-pointer copy (default), .pc =
   coarse. display:none keeps exactly one meaningful string in the AT tree.
   #drop's aria-label is already pointer-neutral and stays untouched. ──────── */
.pc { display: none; }
@media (pointer: coarse) {
  .pf { display: none; }
  .pc { display: inline; }
  /* the whole-page drag-spotlight scrim is drag choreography — irrelevant to a
     finger (and one fixed full-viewport layer fewer). The in-zone release
     caption (.drop.over::after) stays: iPadOS supports real touch drag, and it
     only ever renders mid-drag — exactly when it is true. */
  body::after { display: none; }
}

/* ── 44px touch law — the full sweep (extends the leg-2 .pv-btn/.lic-clear
   rule). Actionable surfaces only: informational .chip keeps ledger scale.
   `.field > input` (child combinator) deliberately excludes the 16px machined
   checkbox inside label.check — its whole 44px label row is the tap surface. */
@media (pointer: coarse) {
  .footer-links a, .try-sample a { display: inline-flex; align-items: center; min-height: 44px; }
  .ai-task { min-height: 44px; padding: 10px 16px; }
  .chip-action, .chip-sign { min-height: 44px; padding: 10px 16px; }
  .field > input, .tpl-select, .redeem-row input, .share-linkrow input { min-height: 44px; }
  .field label.check { min-height: 44px; }
  /* finger ink needs more vertical room than a mouse (130px baseline); sign.js
     re-renders CSS-pixel strokes on resize — never wipes or offsets ink */
  #sigpad { height: 160px; }
  .sig-actions .btn { flex: 1; justify-content: center; }
}

/* ── the document sheet at phone width — PREVIEW only (#preview-scoped).
   Exports carry their own inlined stylesheet (sign.js DOC_CSS), which already
   compresses at ≤640px — intentional divergence, never sync (sign.js sacred). */
@media (max-width: 720px) {
  #preview .momentum-doc { padding: 40px 28px; margin: 16px auto; }
  #preview .momentum-doc h1, #preview .momentum-doc .doc-title { font-size: clamp(26px, 7.5vw, 36px); }
  #preview .momentum-doc h2 { font-size: clamp(20px, 6vw, 26px); }
}
@media (max-width: 480px) {
  #preview .momentum-doc { padding: 28px 18px; font-size: 15px; }
  #preview .momentum-sig img.ink { height: 52px; }
}

/* ── section rhythm, compressed for the short page ────────────────────────── */
@media (max-width: 600px) {
  section { padding: var(--s6) 0 var(--s5); }     /* 96/72 → 64/48 */
  .section-head { margin-bottom: 28px; }
  .sec::before, .site-footer::before { left: 16px; right: 16px; }  /* hairlines meet the 16px gutter */
  .trust-close { margin-top: 40px; padding: 28px 20px; }
  .redeem { padding: 20px 16px; }
}

/* ── tighter reveal travel for shorter scroll distances (inside the motion gate) ── */
@media (prefers-reduced-motion: no-preference) {
  @media (max-width: 600px) {
    html.js-polish .rv { transform: translateY(10px); }
  }
}
