/* RenderPlate — the run, rendered as a page.
   Visual world inherited from Print Twin Studio (scripts/printTwin/studio/studioUi.mjs):
   deep navy work surface, one sky-blue accent, one-pixel technical rules, flat panels. */

@font-face {
  font-family: 'Archivo';
  src: url('font/archivo-latin-var.woff2') format('woff2-variations');
  font-weight: 400 800;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'InterVar';
  src: url('font/inter-latin-var.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #070B0F;
  --ground: #0B1016;
  --panel: #121A23;
  --panel-2: #17222D;
  --panel-3: #1B2836;
  --rule: #293746;
  --rule-soft: #1C2833;
  --text: #F1F6FA;
  --muted: #9BADBD;
  --dim: #74899B;
  --accent: #8AC7FF;
  --accent-strong: #3D9CE8;
  --accent-wash: #12293C;
  --ok: #8CE0A4;
  --warn: #FFD080;

  --display: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  --ui: 'InterVar', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Cascadia Code', 'SF Mono', ui-monospace, Consolas, monospace;

  /* The small end of the type ramp. Seven ad-hoc values between 0.84 and
     0.95rem had accumulated here, which is drift rather than a scale; these
     four steps are the whole vocabulary below body size. */
  --fs-base: 1rem;
  --fs-md: 0.94rem;   /* dense body, buttons, list items */
  --fs-sm: 0.88rem;   /* secondary and supporting text */
  --fs-data: 0.72rem; /* instrument data */
  --fs-data-sm: 0.6rem;

  --gut: clamp(1.25rem, 4vw, 3.5rem);
  --max: 1360px;
  --r: 4px;
  --lift: 0 24px 60px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* height:auto is load-bearing. The width/height attributes every <img> here
   carries map to CSS presentation hints, and a hint beats `auto` — so without
   this, `height` stays pinned to the attribute and any aspect-ratio below is
   ignored, which stretched the macro plate into a portrait crop. */
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }

:where(a, button, summary, input):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

.wrap {
  width: min(var(--max), 100%);
  margin-inline: auto;
  padding-inline: var(--gut);
}

/* ---------- typography ---------- */

.display {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
  margin: 0;
}

h1.display { font-size: clamp(2.6rem, 6.4vw, 5rem); }
h2.display { font-size: clamp(2rem, 4.2vw, 3.4rem); }
h3.display { font-size: clamp(1.3rem, 2vw, 1.7rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }

.lede {
  max-width: 62ch;
  font-size: clamp(1.02rem, 1.35vw, 1.2rem);
  line-height: 1.62;
  color: var(--muted);
  margin: 1.1rem 0 0;
  text-wrap: pretty;
}

.prose { max-width: 68ch; color: var(--muted); text-wrap: pretty; }
.prose strong { color: var(--text); font-weight: 600; }

.data {
  font-family: var(--mono);
  font-size: var(--fs-data);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.data b { color: var(--accent); font-weight: 500; }

/* ---------- masthead ---------- */

.masthead {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid var(--rule-soft);
  background: var(--ink);
}
.masthead-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 66px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 112%;
  font-size: 1.06rem;
  letter-spacing: -0.028em;
}
.brand svg { flex: none; }
.brand em { font-style: normal; color: var(--accent); }

.nav { display: flex; align-items: center; gap: 0.35rem; }
.nav a {
  padding: 0.45rem 0.7rem;
  color: var(--muted);
  font-size: var(--fs-sm);
  text-decoration: none;
  border-radius: var(--r);
}
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a[aria-current='page'] { color: var(--accent); background: var(--accent-wash); }
/* .nav a beats .btn-primary on specificity, which silently rendered the header
   call to action as muted grey on light blue. Restate the button here. */
.nav a.btn { margin-left: 0.4rem; padding: 0.55rem 0.95rem; font-size: var(--fs-sm); }
.nav a.btn-primary,
.nav a.btn-primary:hover,
.nav a.btn-primary[aria-current='page'] { color: #06111B; background: var(--accent); }
.nav a.btn-primary:hover { background: #A6D6FF; }
@media (max-width: 720px) {
  .nav a.hide-sm { display: none; }
}

/* ---------- stage rail ---------- */

.rail {
  position: sticky;
  top: 0;
  z-index: 15;
  background: rgba(7, 11, 15, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule-soft);
}
.rail ol {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}
.rail.rail-5 ol { grid-template-columns: repeat(5, 1fr); }
.rail li { border-left: 1px solid var(--rule-soft); }
.rail li:first-child { border-left: 0; }
.rail a {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.62rem 0.9rem;
  color: var(--dim);
  text-decoration: none;
  font-family: var(--mono);
  font-size: var(--fs-data);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-top: 2px solid transparent;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.rail a:hover { color: var(--muted); background: var(--panel); }
.rail a.on { color: var(--accent); border-top-color: var(--accent); background: var(--accent-wash); }
.rail a.done { color: var(--ok); }
.rail .n { color: inherit; opacity: 0.6; }
@media (max-width: 640px) {
  .rail a { flex-direction: column; gap: 0.1rem; padding: 0.5rem 0.55rem; font-size: var(--fs-data-sm); }
  .rail .n { font-size: var(--fs-data-sm); }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.82rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.btn:hover { background: var(--panel-3); border-color: var(--dim); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06111B;
  font-weight: 700;
}
.btn-primary:hover { background: #A6D6FF; border-color: #A6D6FF; }
.btn-lg { padding: 1rem 1.6rem; font-size: var(--fs-base); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.9rem; }

/* ---------- hero / job ticket ---------- */

.job {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  align-items: stretch;
  border-bottom: 1px solid var(--rule-soft);
}
.job-ticket {
  padding: clamp(2.5rem, 5vw, 4.6rem) clamp(1.25rem, 4vw, 3.5rem) clamp(2.5rem, 5vw, 4rem);
  padding-left: max(var(--gut), calc((100vw - var(--max)) / 2 + var(--gut)));
  border-right: 1px solid var(--rule-soft);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.job-ticket h1 { margin-top: 1.4rem; }
.ticket-id {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  align-self: flex-start;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--panel);
}
.ticket-id .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(138, 199, 255, 0.16);
}
.spec-line {
  margin: 1.6rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule-soft);
}

.job-plate {
  position: relative;
  min-height: clamp(320px, 46vw, 620px);
  background: var(--ink);
  overflow: hidden;
}
.job-plate img { width: 100%; height: 100%; object-fit: cover; }
.plate-strip {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  padding: 0.6rem clamp(0.9rem, 2vw, 1.4rem);
  background: linear-gradient(transparent, rgba(7, 11, 15, 0.92) 42%);
  padding-top: 3rem;
}
@media (max-width: 900px) {
  .job { grid-template-columns: 1fr; }
  .job-ticket { border-right: 0; border-bottom: 1px solid var(--rule-soft); padding-left: var(--gut); }
}

/* ---------- sections ---------- */

.stage { border-bottom: 1px solid var(--rule-soft); scroll-margin-top: 42px; }
.stage-in { padding-block: clamp(3.4rem, 7vw, 6.4rem); }
.stage-head { display: grid; gap: 0.9rem; margin-bottom: clamp(2rem, 4vw, 3.2rem); }
.stage-head .lede { margin-top: 0.3rem; }

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  overflow: hidden;
}
.pair figure { margin: 0; background: var(--ink); display: flex; flex-direction: column; }
.pair img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.pair figcaption { padding: 0.75rem 0.95rem; background: var(--panel); }
.pair figcaption strong { display: block; font-size: var(--fs-sm); margin-bottom: 0.2rem; }
@media (max-width: 700px) { .pair { grid-template-columns: 1fr; } }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.6rem, 3.5vw, 3.4rem);
  align-items: start;
}
.split-center { align-items: center; }
.split-wide { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 860px) { .split, .split-wide { grid-template-columns: 1fr; } }

.frame {
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  background: var(--ink);
  overflow: hidden;
}
/* Pin the box before the bytes arrive. Without an explicit ratio an unloaded
   image falls back to its literal height attribute, which stretched the macro
   into a portrait crop; object-fit then had nothing to correct. */
.frame img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.frame svg { display: block; width: 100%; height: auto; }
.frame figcaption { padding: 0.7rem 0.95rem; border-top: 1px solid var(--rule-soft); background: var(--panel); }
figure.frame { margin: 0; }

/* spec list — the profile datasheet */
.specs { border-top: 1px solid var(--rule); margin: 0; }
.specs > div {
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
  gap: 0.4rem 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.specs dt { font-family: var(--mono); font-size: var(--fs-data); letter-spacing: 0.07em; text-transform: uppercase; color: var(--dim); padding-top: 0.2rem; }
.specs dd { margin: 0; color: var(--text); }
.specs dd small { display: block; color: var(--muted); font-size: var(--fs-sm); margin-top: 0.15rem; }
@media (max-width: 620px) { .specs > div { grid-template-columns: 1fr; } }

/* character control rows */
.chars { display: grid; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.chars li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5rem;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  background: var(--panel);
  font-size: var(--fs-md);
}
.meter { height: 4px; background: var(--panel-3); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent-strong); }
@media (max-width: 520px) { .chars li { grid-template-columns: 1fr; gap: 0.5rem; } }

/* Contact sheet: a fixed 4-up plate with the hero occupying a 2x2 block.
   auto-fit was resolving to five tracks against a two-column span, which left
   the sheet full of holes — the grid has to be counted, not guessed. */
.sheet {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 1px;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  overflow: hidden;
}
.sheet figure { margin: 0; display: flex; flex-direction: column; background: var(--ink); min-width: 0; }
.sheet img { width: 100%; flex: 1; min-height: 0; aspect-ratio: 4 / 3; object-fit: cover; }
.sheet figcaption { padding: 0.6rem 0.8rem; background: var(--panel); }
.sheet .lead { grid-column: span 2; grid-row: span 2; }
.sheet .lead img { aspect-ratio: auto; height: 100%; }
@media (max-width: 900px) {
  .sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet .lead { grid-row: span 1; }
  .sheet .lead img { aspect-ratio: 8 / 5; height: auto; }
}
@media (max-width: 460px) {
  .sheet { grid-template-columns: 1fr; }
  .sheet .lead { grid-column: span 1; }
}

/* ---------- trial band ---------- */

.trial {
  background:
    linear-gradient(180deg, rgba(18, 41, 60, 0.55), rgba(11, 16, 22, 0)) ,
    var(--ink);
  border-bottom: 1px solid var(--rule-soft);
  scroll-margin-top: 42px;
}
.runs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 0.85rem;
  margin: 2.4rem 0 0;
  padding: 0;
  list-style: none;
}
.run {
  padding: 1.05rem 1.1rem 1.15rem;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--panel);
}
.run-free { border-color: #2C4E68; background: linear-gradient(180deg, var(--accent-wash), var(--panel)); }
.run-locked { border-style: dashed; border-color: var(--rule); background: transparent; }
.run h3 { margin: 0.55rem 0 0.3rem; font-family: var(--display); font-size: 1.12rem; font-weight: 700; letter-spacing: -0.02em; }
.run p { margin: 0; font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
.run-locked h3, .run-locked .data b { color: var(--warn); }
.tick { display: inline-flex; align-items: center; gap: 0.4rem; }

/* ---------- ledger (pricing) ---------- */

.ledger {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  overflow: hidden;
}
.ledger > section { background: var(--panel); padding: clamp(1.3rem, 2.6vw, 2rem); }
.ledger > section:last-child { background: var(--panel-2); }
.ledger h3 { margin: 0 0 0.35rem; }
.ledger ul { margin: 1.1rem 0 0; padding: 0; list-style: none; display: grid; gap: 0.7rem; }
.ledger li { display: grid; grid-template-columns: 1.1rem 1fr; gap: 0.7rem; font-size: var(--fs-md); color: var(--muted); line-height: 1.5; }
.ledger li b { color: var(--text); font-weight: 600; }
.ledger svg { margin-top: 0.35rem; }
@media (max-width: 760px) { .ledger { grid-template-columns: 1fr; } }

/* licence ticket */
.licence {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--lift);
}
.licence > * { background: var(--panel); padding: clamp(1.5rem, 3vw, 2.4rem); }
.licence-buy { background: var(--panel-2); display: flex; flex-direction: column; justify-content: center; }
.price { display: flex; align-items: baseline; gap: 0.5rem; margin: 0.4rem 0 0; }
.price .amt {
  font-family: var(--display);
  font-size: clamp(3.2rem, 7vw, 4.6rem);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.045em;
  line-height: 1;
}
.price .per { color: var(--muted); font-size: var(--fs-md); }
.buy-note { margin: 0.9rem 0 0; font-size: var(--fs-sm); color: var(--dim); line-height: 1.5; }
.buy-msg { margin: 0.9rem 0 0; font-size: var(--fs-sm); line-height: 1.5; min-height: 1.2em; }
.buy-msg[data-state='error'] { color: var(--warn); }
.buy-msg[data-state='working'] { color: var(--accent); }
@media (max-width: 760px) { .licence { grid-template-columns: 1fr; } }

/* ---------- notices ---------- */

.notice {
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--panel);
  padding: clamp(1.2rem, 2.4vw, 1.8rem);
}
.notice-warn { border-color: #5C4A2A; background: #191507; }
.notice h3 { margin: 0 0 0.5rem; }
.notice p { margin: 0.6rem 0 0; color: var(--muted); }
.notice p:first-of-type { margin-top: 0; }

/* faq */
.faq { border-top: 1px solid var(--rule); margin-top: 2.4rem; }
.faq > div { padding: 1.3rem 0; border-bottom: 1px solid var(--rule-soft); display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: 0.6rem 2.5rem; }
.faq dt { font-weight: 600; color: var(--text); }
.faq dd { margin: 0; color: var(--muted); }
@media (max-width: 760px) { .faq > div { grid-template-columns: 1fr; } }

/* ---------- close + footer ---------- */

.close-band { background: var(--ink); border-bottom: 1px solid var(--rule-soft); }
.close-in { padding-block: clamp(3.6rem, 7vw, 6rem); text-align: center; display: grid; justify-items: center; }
.close-in .lede { margin-inline: auto; }
.close-in .btn-row { justify-content: center; }

.foot { padding-block: 2.4rem 3rem; }
.foot-in { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: flex-start; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.3rem; }
.foot-links a { color: var(--muted); font-size: var(--fs-sm); text-decoration: none; }
.foot-links a:hover { color: var(--text); text-decoration: underline; }
.foot .data { max-width: 46ch; text-transform: none; letter-spacing: 0.01em; line-height: 1.6; }

/* ---------- motion: one authored moment ---------- */

@media (prefers-reduced-motion: no-preference) {
  .rise {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.62s cubic-bezier(0.16, 1, 0.3, 1), transform 0.62s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .rise.in { opacity: 1; transform: none; }
  .rise:nth-child(2) { transition-delay: 0.06s; }
  .rise:nth-child(3) { transition-delay: 0.12s; }
  .rise:nth-child(4) { transition-delay: 0.18s; }
}

/* ---------- layout utilities ---------- */
/* These exist because the deployed CSP is `style-src 'self'`, which blocks
   inline style attributes outright. The local preview server sends no
   _headers, so inline spacing worked locally and silently collapsed in
   production; keeping every declaration in this file is what makes the two
   agree. Do not reintroduce a style="" attribute here. */

.mt-block   { margin-top: clamp(2rem, 4vw, 3rem); }
.mt-block-l { margin-top: clamp(2.2rem, 4vw, 3.4rem); }
.mt-lg      { margin-top: 1.6rem; }
.mt-md      { margin-top: 1.4rem; }
.mt-sm      { margin-top: 1.3rem; }
.mt-xs      { margin-top: 1.1rem; }
.mt-xxs     { margin-top: 0.8rem; }
.mt-tight   { margin-top: 0.5rem; }
.text-sm    { font-size: var(--fs-md); }
.full       { width: 100%; }
.plain-case { text-transform: none; }

/* the numbered activation list on the receipt page */
.steps { margin: 1rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.7rem; }

/* the order reference, which must wrap rather than overflow its panel */
.order-ref {
  margin: 0.5rem 0 0;
  font-size: clamp(var(--fs-sm), 2.4vw, 1.05rem);
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--text);
  word-break: break-all;
}

/* Character-control meter fills. Nine fixed illustrative positions; a width
   set through a style attribute would be blocked by the CSP like any other. */
.f22 { width: 22%; } .f28 { width: 28%; } .f30 { width: 30%; }
.f34 { width: 34%; } .f40 { width: 40%; } .f46 { width: 46%; }
.f50 { width: 50%; } .f55 { width: 55%; } .f62 { width: 62%; }

/* the sliced-layer diagram */
.slice-diagram { width: 100%; height: auto; background: var(--ink); }
