/* Kupon Plus — design system, components and scene choreography.
   One coloured object (the voucher card), ink on paper for everything else.
   Motion is a function of one variable, --p (0 = scene pinned, 1 = unpinned);
   outside the motion gate --p stays 1 and every scene is its final frame. */

@property --p { syntax: "<number>"; inherits: true; initial-value: 1; }

:root {
  --bg: #ffffff; --surface: #f6f6f6; --code-bg: #fafafa;
  --line: #e3e3e3; --line-strong: #c9c9c9;
  --ink: #111111; --ink-2: #4d4d4d; --ink-3: #6f6f6f;
  --accent: #0b7a3b; --accent-hover: #086530; --on-accent: #ffffff; --card: #0b7a3b; --focus: #111111;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --t-display: clamp(2.25rem, 1.25rem + 4.5vw, 4.5rem);
  --t-h2: clamp(1.5rem, 1rem + 2.2vw, 3rem);
  --t-h3: 1.25rem; --t-lead: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  --t-body: 1.0625rem; --t-small: 0.9375rem; --t-caption: 0.8125rem; --t-code: 0.9375rem;
  --t-code-xl: clamp(1.125rem, 0.75rem + 1.6vw, 1.75rem);
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;
  --r-1: 3px; --r-2: 8px;
  --wrap: 1248px; --gutter: 24px; --park-w: 120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0f; --surface: #171717; --code-bg: #141414; --line: #262626; --line-strong: #3a3a3a;
    --ink: #f2f2f2; --ink-2: #b8b8b8; --ink-3: #8c8c8c; --accent: #3dbe74; --accent-hover: #5bcb8a; --on-accent: #0f0f0f; --focus: #f2f2f2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f0f; --surface: #171717; --code-bg: #141414; --line: #262626; --line-strong: #3a3a3a;
  --ink: #f2f2f2; --ink-2: #b8b8b8; --ink-3: #8c8c8c; --accent: #3dbe74; --accent-hover: #5bcb8a; --on-accent: #0f0f0f; --focus: #f2f2f2;
  color-scheme: dark;
}
@media (prefers-contrast: more) { :root { --line: #6f6f6f; --ink-3: #4d4d4d; } }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--t-body)/1.55 var(--sans); font-synthesis: none; overflow-x: clip; }
h1, h2, h3, h4, p, ul, ol, dl, figure, pre, table { margin: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: var(--t-display); line-height: 1.04; letter-spacing: -0.025em; }
h2 { font-size: var(--t-h2); line-height: 1.1; }
h3 { font-size: var(--t-h3); line-height: 1.3; letter-spacing: -0.01em; }
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code, pre, kbd, var { font-family: var(--mono); font-style: normal; }
code { font-size: 0.92em; }
img, svg { display: block; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; padding: 8px 14px; background: var(--ink); color: var(--bg); border-radius: var(--r-1); z-index: 20; }
.skip:focus { top: 12px; }
.lead { font-size: var(--t-lead); line-height: 1.5; color: var(--ink-2); max-width: 36rem; }
.caption { font-size: var(--t-caption); line-height: 1.4; font-weight: 500; letter-spacing: 0.01em; color: var(--ink-3); }
.small { font-size: var(--t-small); }
.muted { color: var(--ink-3); }

/* ---------- header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-row { display: flex; align-items: center; gap: var(--s-5); min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 1.125rem; letter-spacing: -0.02em; }
.brand svg { width: 24px; height: 24px; transform: translateY(1px); }
.main-nav { flex: 1; }
.main-nav ul, .site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); }
.main-nav a { font-size: var(--t-small); font-weight: 500; text-decoration: none; color: var(--ink-2); padding: 10px 0; display: inline-block; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--ink); }
.main-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); }
.site-footer { border-top: 1px solid var(--line); margin-top: var(--s-9); color: var(--ink-3); font-size: var(--t-small); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3) var(--s-6); padding-block: var(--s-6); }
.site-footer a { color: var(--ink-3); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.lang-list a[aria-current="true"] { color: var(--ink); font-weight: 500; }
@media (max-width: 719px) {
  :root { --gutter: 16px; }
  .header-row { gap: var(--s-2) var(--s-4); padding-block: var(--s-2); }
  .main-nav { order: 3; flex-basis: 100%; }
  .main-nav ul { gap: 0 var(--s-4); }
  .main-nav a { padding: 8px 0; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: var(--r-1); font: 500 var(--t-small)/1 var(--sans); text-decoration: none; cursor: pointer; border: 1px solid transparent; background: var(--accent); color: var(--on-accent); transition: background-color 120ms, border-color 120ms; }
.btn:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-small { min-height: 36px; padding: 0 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.link-quiet, .link-button { color: var(--ink-3); font-size: var(--t-small); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; }
.link-quiet:hover, .link-button:hover { color: var(--ink); }
@media (max-width: 599px) { .btn-row { flex-direction: column; } .btn-row .btn { width: 100%; } }

/* ---------- code ---------- */
pre.code, .code-panel { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--r-2); padding: 16px 20px; font: 400 var(--t-code)/1.6 var(--mono); color: var(--ink); overflow-x: auto; overscroll-behavior-x: contain; tab-size: 2; white-space: pre; }
pre.code code { font-size: inherit; }
.tok { color: var(--ink-3); }
.hl { font-weight: 500; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface); font: 400 var(--t-small)/1 var(--mono); white-space: nowrap; }
.chip .k { color: var(--ink-2); }
.chip .v { font-variant-numeric: tabular-nums; letter-spacing: 0.08em; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.req { font: 400 var(--t-code)/1.5 var(--mono); }
.req .m { color: var(--ink-2); font-weight: 500; }
.req .h { color: var(--ink-3); }
.req .slot { display: inline-block; min-width: 9ch; text-align: left; font-weight: 500; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* ---------- voucher card ---------- */
.card { --w: 420px; --notch: calc(var(--w) * 0.022); width: var(--w); aspect-ratio: 5 / 3; background: var(--card); color: #fff; border-radius: calc(var(--w) * 0.02); position: relative; display: grid; grid-template-rows: 1fr auto; padding: calc(var(--w) * 0.07) calc(var(--w) * 0.08); -webkit-mask: radial-gradient(circle at 0 50%, transparent var(--notch), #000 calc(var(--notch) + 0.5px)); mask: radial-gradient(circle at 0 50%, transparent var(--notch), #000 calc(var(--notch) + 0.5px)); font-variant-numeric: tabular-nums; }
.card .f-code { align-self: center; font: 400 calc(var(--w) * 0.05) / 1 var(--mono); letter-spacing: 0.04em; display: inline-grid; grid-template-columns: repeat(16, 1ch); white-space: nowrap; }
.card .f-row { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.card .f-value { font: 500 calc(var(--w) * 0.042) / 1 var(--sans); }
.card .f-exp { font: 400 calc(var(--w) * 0.034) / 1 var(--sans); opacity: 0.85; }
.card .f-lab { display: block; font: 500 calc(var(--w) * 0.026) / 1 var(--sans); letter-spacing: 0.04em; opacity: 0.72; margin-bottom: calc(var(--w) * 0.02); text-transform: lowercase; }
.card--parked { --w: var(--park-w); }
.card--parked .f-lab, .card--parked .f-row, .card--inline .f-lab, .card--inline .f-row { display: none; }
.card--parked, .card--inline { grid-template-rows: 1fr; }
.card--parked .f-code { font-size: calc(var(--w) * 0.055); }
.card--inline { --w: 92px; }
.card--inline .f-code { font-size: calc(var(--w) * 0.055); }
/* glyph layers for scramble / resolve: .g holds a plain and a cipher layer */
.g { position: relative; display: inline-block; width: 1ch; }
.g .pl { position: relative; opacity: calc(1 - var(--g, 0)); }
.g .ci { position: absolute; left: 0; top: 0; opacity: var(--g, 0); }

/* ---------- hero ---------- */
.hero { padding-block: var(--s-9) var(--s-8); }
.hero__text { max-width: 44rem; }
.hero h1 { max-width: 20ch; }
.hero .lead { margin-top: var(--s-5); }
.hero .btn-row { margin-top: var(--s-6); }
.hero__card { margin-top: var(--s-8); display: grid; justify-content: center; }
.hero__card .card { transform-origin: 50% 0; }
@media (max-width: 599px) { .hero { padding-block: var(--s-7) var(--s-7); } .hero__card .card { --w: min(300px, 100%); } }

/* ---------- scenes ---------- */
.scene { position: relative; --runway: 3; }
.scene__pin { padding-block: var(--s-9); border-top: 1px solid var(--line); }
.scene__grid { display: grid; gap: var(--s-7); align-items: center; }
.scene__text h2 { max-width: 28ch; }
.scene__text .lead { margin-top: var(--s-4); }
.scene__text .caption, .scene__text .fixed-line { margin-top: var(--s-4); }
.scene__text .lead-caption { margin-top: var(--s-5); font-size: var(--t-small); color: var(--ink); max-width: 36rem; }
.scene__text .lead-caption strong { font-weight: 600; }
@media (min-width: 1024px) {
  .scene__grid { grid-template-columns: 5fr 7fr; gap: var(--s-8); }
}
@media (min-width: 720px) and (max-width: 1023px) { .stage { max-width: 640px; margin-inline: auto; } }

/* the stage: park rail · Till / trust line / Your system */
.stage { position: relative; display: grid; grid-template-columns: var(--park-w) minmax(0, 1fr); grid-template-rows: 1fr auto 1fr; min-height: 440px; }
.stage__park { grid-column: 1; grid-row: 1 / 4; align-self: center; }
.stage__top, .stage__bottom { grid-column: 2; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; position: relative; }
.stage__top { grid-row: 1; }
.stage__bottom { grid-row: 3; }
.stage__line { grid-column: 2; grid-row: 2; position: relative; height: 1px; background: repeating-linear-gradient(90deg, var(--ink-3) 0 2px, transparent 2px 7px); }
.stage__line .caption { position: absolute; right: 0; bottom: 8px; }
.stage__kp { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; }
.blk { background: var(--ink); color: var(--bg); border-radius: var(--r-2); width: 220px; height: 64px; display: grid; place-items: center; font: 500 var(--t-small)/1 var(--sans); }
.kp-blk { background: var(--bg); color: var(--ink); border: 1px solid var(--ink); border-radius: var(--r-2); height: 48px; padding: 0 18px; display: inline-flex; align-items: center; gap: 8px; font: 500 var(--t-small)/1 var(--sans); white-space: nowrap; }
.kp-blk svg { width: 16px; height: 16px; }
.stage .caption.at { position: absolute; }
figcaption.visually-hidden { }
@media (max-width: 599px) {
  .stage { --park-w: 88px; min-height: 380px; }
  .blk { width: 160px; height: 48px; }
}

/* motion gate: pinned scenes only with JS, no reduced-motion, viewport ≥ 640 px tall */
@media (prefers-reduced-motion: no-preference) and (min-height: 640px) {
  html.motion .scene--pin { height: calc(var(--runway) * 100svh); }
  html.motion .scene--pin .scene__pin { position: sticky; top: 0; height: 100svh; padding-block: 0; display: grid; align-content: center; overflow: hidden; contain: layout paint; }
  html.motion .scene--pin .stage { height: min(72svh, 640px); min-height: 0; overflow: hidden; }
  html.motion .is-near .stage { will-change: transform; }
  @supports (animation-timeline: view()) {
    html.motion.native .scene--pin { animation: progress linear both; animation-timeline: view(); animation-range: contain 0% contain 100%; }
    html.motion.native .hero__card .card { animation: hero-park linear both; animation-timeline: scroll(root); animation-range: 0 70vh; }
    html.motion.native .reveal { animation: settle linear both; animation-timeline: view(); animation-range: entry 30% entry 80%; }
  }
  html.motion.fallback .reveal { opacity: 0; transform: translateY(12px); transition: opacity 500ms cubic-bezier(.22,1,.36,1), transform 500ms cubic-bezier(.22,1,.36,1); }
  html.motion.fallback .reveal.is-in { opacity: 1; transform: none; }
  html.motion.fallback .hero__card .card { transform: scale(calc(1 - var(--hp, 0) * 0.6)) translateX(calc(var(--hp, 0) * -40%)); opacity: calc(1 - var(--hp, 0) * 0.9); }
}
@media (max-width: 1023px) and (min-height: 640px) and (prefers-reduced-motion: no-preference) {
  html.motion .scene--pin .stage { height: min(52svh, 480px); }
  html.motion .scene--pin .scene__grid { gap: var(--s-5); }
  html.motion .scene--pin .lead { font-size: var(--t-small); }
}
@keyframes progress { from { --p: 0; } to { --p: 1; } }
@keyframes hero-park { to { transform: scale(0.4) translateX(-60%); opacity: 0.1; } }
@keyframes settle { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* generic sub-progress helpers: elements declare --a (start) and --b (end) of --p */
.seg { --t: clamp(0, (var(--p) - var(--a, 0)) / (var(--b, 1) - var(--a, 0)), 1); }
.seg.settle { opacity: var(--t); transform: translateY(calc((1 - var(--t)) * 12px)); }
.seg.step { opacity: clamp(0, (var(--p) - var(--a, 0)) * 1000, 1); }
.seg.grow { transform: scaleX(var(--t)); transform-origin: left center; }

/* --- scene 2: the line --- */
.s2 .arrow { position: absolute; left: 50%; top: calc(25% + 32px); height: calc(50% - 64px); width: 24px; transform: translateX(-50%); z-index: 1; }
.s2 .arrow svg { width: 100%; height: 100%; overflow: visible; }
.s2 .arrow .shaft { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.s2 .arrow .head { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.s2 .arrow--draw { clip-path: inset(0 0 calc((1 - var(--t)) * 100%) 0); }
.s2 .strike { position: absolute; left: 50%; top: 50%; width: 28px; height: 2px; background: var(--ink); transform: translate(-50%, -50%) rotate(-45deg) scaleX(var(--t)); }
.s2 .cap-top { left: calc(50% + 130px); top: 50%; transform: translateY(-50%); white-space: nowrap; }
.s2 .cap-bottom { left: calc(50% + 130px); top: 50%; transform: translateY(-50%); white-space: nowrap; }
@media (max-width: 599px) { .s2 .cap-top { left: 50%; top: calc(50% + 34px); transform: translateX(-50%); } .s2 .cap-bottom { left: 50%; top: calc(50% - 48px); transform: translateX(-50%); } .s2 .arrow { top: calc(25% + 24px); height: calc(50% - 48px); } }

/* --- scene 3: encrypted before upload --- */
.browser { width: min(300px, 100%); border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg); overflow: hidden; position: relative; z-index: 2; }
.browser__bar { height: 26px; border-bottom: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; padding: 0 10px; font: 400 var(--t-caption)/1 var(--mono); color: var(--ink-3); }
.browser__body { padding: 16px 12px 14px; display: grid; gap: 10px; }
.csv { font: 400 0.875rem/1.4 var(--mono); white-space: nowrap; }
.csv .g { width: 1ch; }
.s3 .stage__bottom { align-items: end; }
.s3 .browser { margin-bottom: -12px; }
.s3 .lab { font-size: var(--t-caption); color: var(--ink-3); font-weight: 500; }
.s3 .csv-travel { position: absolute; left: 50%; top: 50%; transform: translate(calc(-50% + var(--t) * 150px), calc(-50% + 70px - var(--t) * 150px)) scale(calc(1 - var(--t) * 0.3)); opacity: calc(var(--t) * (1 - var(--t)) * 4); pointer-events: none; }
.stack { display: grid; gap: 6px; justify-items: start; }
.stack__key { color: var(--ink); }
.stack__sheets { display: grid; gap: 3px; }
.stack__sheets i { display: block; width: 96px; height: 10px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--bg); }
.stack__name { font: 400 var(--t-caption)/1 var(--mono); color: var(--ink-2); }
.stack__tiles { display: flex; gap: 4px; }
.stack__tiles i { display: block; width: 12px; height: 8px; background: var(--ink); border-radius: 1px; }
.s3 .stack-one { position: absolute; right: 0; top: calc(50% + 20px); }
.s3 .cap-side { left: calc(50% + 130px); bottom: 14px; white-space: nowrap; }
@media (max-width: 599px) { .s3 .stack-one { display: none; } .s3 .cap-side { display: none; } }

/* --- scene 4: the call --- */
.s4 .stage { grid-template-rows: auto auto 1fr; }
.s4 .stage__top { align-items: start; padding-top: 0; padding-bottom: 44px; }
.s4 .panel { width: 100%; max-width: 560px; display: grid; gap: var(--s-3); }
.s4 .panel .req-line { clip-path: inset(0 calc((1 - var(--t)) * 100%) 0 0); }
.s4 .resp { position: relative; }
.s4 .resp pre.code { padding: 12px 16px; font-size: 0.875rem; }
.s4 .resp--two pre.code { }
.s4 .card-cross { position: absolute; left: 0; top: 50%; transform: translate(calc(var(--t) * 120px), calc(-50% + var(--t) * -140px)) scale(calc(1 - var(--t) * 0.2)); opacity: calc(var(--t) * (1 - var(--t)) * 4); pointer-events: none; }
.s4 .missing { display: inline-block; border: 1px solid var(--line-strong); border-radius: var(--r-1); padding: 0 6px; color: var(--ink-3); font-size: 0.8em; vertical-align: middle; }
.s4 .stage__line { grid-row: 2; }
.s4 .stage__bottom { grid-row: 3; align-items: start; padding-top: 44px; }
html.motion .s4 .resp--one.dim { opacity: calc(1 - clamp(0, (var(--p) - 0.78) * 1000, 1) * 0.5); }

/* --- scene 5: decrypted where you decide --- */
.s5 .stops { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); margin-top: var(--s-5); }
.stop { display: grid; gap: var(--s-3); align-content: start; }
.stop__name { font-size: var(--t-small); font-weight: 500; color: var(--ink-2); }
.stop__name.on, html:not(.motion) .stop__name { color: var(--ink); }
.bars { display: grid; grid-template-columns: 9ch 1fr; gap: 6px 10px; align-items: center; }
.bars .caption { color: var(--ink-3); }
.bars i { display: block; height: 4px; background: var(--ink); width: var(--len); transform-origin: left center; }
.bars i.eff { background: var(--ink-3); }
.s5 .mini { position: relative; display: grid; grid-template-rows: 1fr auto 1fr; height: 180px; border: 1px solid var(--line); border-radius: var(--r-2); padding: 12px; }
.s5 .mini .row { display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; }
.s5 .mini .blk { width: 96px; height: 36px; font-size: var(--t-caption); }
.s5 .mini .line { height: 1px; background: repeating-linear-gradient(90deg, var(--ink-3) 0 2px, transparent 2px 7px); position: relative; }
.s5 .mini .kp-blk { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); height: 32px; padding: 0 10px; font-size: var(--t-caption); }
.s5 .glyph { width: 18px; height: 18px; color: var(--ink); }
.s5 .mini .card--inline { --w: 64px; }
.s5 .ciph-note { font-size: var(--t-caption); color: var(--ink-3); }
.s5 .stage-5 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); min-height: 0; align-content: center; }
html.motion .s5 .stop { opacity: calc(0.35 + var(--on) * 0.65); }
@media (max-width: 719px) { .s5 .stage-5, .s5 .stops { grid-template-columns: 1fr; } .s5 .mini { height: 150px; } }

/* --- scene 6: portability --- */
.s6 .stage-6 { display: grid; align-content: center; justify-items: start; gap: var(--s-5); min-height: 320px; }
.s6 .req-xl { font-size: var(--t-code-xl); line-height: 1.4; }
.s6 .req-xl .slot { min-width: 16ch; position: relative; display: inline-grid; }
.s6 .req-xl .slot span { grid-area: 1 / 1; }
.s6 .values { display: grid; gap: 4px; font: 400 var(--t-small)/1.5 var(--mono); color: var(--ink-2); }
.s6 .stacks { display: flex; gap: var(--s-6); flex-wrap: wrap; }
@media (max-width: 599px) { .req-2l { display: grid; } .req-2l .h { font-size: var(--t-caption); white-space: nowrap; } }

/* --- scene 7: on record --- */
.report { width: 100%; border-collapse: collapse; font: 400 var(--t-small)/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.report th { text-align: left; font-weight: 500; color: var(--ink-3); border-bottom: 1px solid var(--line-strong); padding: 8px 10px 8px 0; font-family: var(--mono); }
.report td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.report td:first-child { font-weight: 500; width: 2ch; }
.s7 .stage-7 { display: grid; align-content: center; gap: var(--s-5); min-height: 320px; }
.s7 .numerals { display: flex; gap: var(--s-7); flex-wrap: wrap; }
.s7 .numerals b { display: block; font: 500 var(--t-h3)/1 var(--sans); letter-spacing: -0.02em; }
.s7 .numerals span { font-size: var(--t-caption); color: var(--ink-3); }
@media (max-width: 599px) { .report .meta { display: none; } }

/* --- scene 8: proof --- */
.s8 .pair { display: grid; grid-template-columns: 4ch 1fr; gap: var(--s-3) var(--s-4); align-items: center; }
.s8 .pair .caption { color: var(--ink-3); }
.s8 .pair pre.code { font-size: 0.875rem; }
.scene--static .scene__pin { padding-block: var(--s-9); }

/* --- scene 9: go-live and doors --- */
.s9 .bars-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
.s9 .bar { display: grid; gap: var(--s-2); }
.s9 .bar span { font-size: var(--t-small); font-weight: 500; }
.s9 .bar i { display: block; height: 4px; background: var(--ink); transform-origin: left center; }
.doors { display: grid; gap: var(--s-4); margin-top: var(--s-8); }
.door { border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-6); display: grid; gap: var(--s-5); align-content: start; }
.door__title { font-size: var(--t-h3); font-weight: 600; letter-spacing: -0.01em; }
.door .btn-row { flex-direction: column; align-items: stretch; }
.quiet-line { margin-top: var(--s-5); font-size: var(--t-small); color: var(--ink-3); }
@media (min-width: 720px) { .doors { grid-template-columns: 1fr 1fr; } .door .btn-row { flex-direction: row; } }
@media (max-width: 599px) { .s9 .bars-3 { grid-template-columns: 1fr; } }

/* ---------- sub-pages (prose) ---------- */
.page-head { padding-block: var(--s-8) var(--s-7); border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: var(--t-h2); max-width: 24ch; }
.page-head .lead { margin-top: var(--s-4); }
.page-head .first-line { margin-top: var(--s-5); font-weight: 500; }
.prose { padding-block: var(--s-7) var(--s-8); display: grid; gap: var(--s-7); }
.prose section { display: grid; gap: var(--s-4); max-width: 42rem; scroll-margin-top: 24px; }
.prose h2 { font-size: var(--t-h3); }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 1.2em; display: grid; gap: var(--s-2); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose pre.code { max-width: 100%; }
.prose .models { max-width: none; }
.prose .btn-row { margin-top: var(--s-2); }
.toc { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--t-small); padding-block: var(--s-4); border-bottom: 1px solid var(--line); }
.toc a { color: var(--ink-3); text-decoration: none; }
.toc a:hover { color: var(--ink); text-decoration: underline; }
.copy-wrap { position: relative; }
.copy-wrap .copy { position: absolute; right: 10px; top: 8px; font: 500 var(--t-caption)/1 var(--sans); color: var(--ink-3); background: var(--code-bg); border: 0; padding: 8px; cursor: pointer; }
.copy-wrap .copy:hover { color: var(--ink); }

/* ---------- developer reference: knižnica HelloWebu openapi-reference (plán 21) ----------
   Štýly referencie dodáva knižnica (načíta sa pred site.css); tu sú len úpravy webu nižšie. */

/* ---------- print ---------- */
@media print {
  .site-header nav, .header-tools, .site-footer ul, .skip { display: none !important; }
  .scene--pin { height: auto !important; }
  .scene__pin { position: static !important; height: auto !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
}

/* ---------- fixes after first build ---------- */
.stage__kp { left: 50%; top: 50%; }
.s2 .arrow, .s2 .strike { left: calc(var(--park-w) + (100% - var(--park-w)) / 2); }
.s3 .csv.enc .g { --g: clamp(0, (var(--ts) - var(--i) * 0.05) / 0.12, 1); }
.s3 .card--parked .g, .s4 .card--parked .g, .s4 .card-cross .g, .s5 .card--inline:not(.dec) .g { --g: 1; }
.s5 .dec .g { --g: calc(1 - clamp(0, (var(--ts) - var(--i) * 0.05) / 0.12, 1)); }
html.motion .s5 .bars i { transform: scaleX(var(--ts)); transform-origin: left center; }
html.motion .s5 .stop__name { color: color-mix(in srgb, var(--ink) calc(var(--on) * 100%), var(--ink-2)); }
.win { opacity: calc(clamp(0, (var(--p) - var(--a)) * 1000, 1) - clamp(0, (var(--p) - var(--b)) * 1000, 1)); }
html.motion .s4 .resp--one.dim { opacity: calc(1 - (clamp(0, (var(--p) - .78) * 1000, 1) - clamp(0, (var(--p) - .98) * 1000, 1)) * .5); }
.s4 .resp pre.code { font-size: 0.8125rem; line-height: 1.5; }
@media (prefers-reduced-motion: no-preference) and (min-height: 640px) {
  @supports (animation-timeline: view()) {
    html.motion.native .hero__card .card { animation-range: 0px 70vh; }
  }
}
@media (max-width: 599px) {
  /* phones: pinned scenes are their final frames, stacked; the diagrams need the room */
  html.motion .scene--pin { height: auto !important; animation: none !important; --p: 1; }
  html.motion .scene--pin .scene__pin { position: static; height: auto; overflow: visible; padding-block: var(--s-8); display: block; }
  html.motion .scene--pin .stage { height: auto; min-height: 380px; overflow: visible; }
  html.motion .s5 .mini { display: grid; }
}
@media (max-width: 719px) {
  html.motion .s5 .mini { display: none; }
}

/* ---------- fixes after second build ---------- */
.scene__grid > * { min-width: 0; }
.stage, .stage__top, .stage__bottom, .stage-6, .stage-7 { min-width: 0; }
.s4 .panel { max-width: min(560px, 100%); min-width: 0; }
pre.code { max-width: 100%; }
.stage-7 { overflow-x: auto; }
@media (min-width: 1024px) {
  .hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s-8); }
  .hero__card { margin-top: 0; }
}

/* ---------- fixes after third build (phones) ---------- */
@media (max-width: 599px) {
  .s2 .cap-top, .s2 .cap-bottom { background: var(--bg); padding: 0 6px; z-index: 2; }
  .s3 .stage { min-height: 540px; }
  .kp-blk { height: 36px; padding: 0 10px; font-size: var(--t-caption); }
  .stage__line .caption { bottom: 22px; }
  .req-2l > span:last-child { overflow-wrap: anywhere; }
  .report .d { display: none; }
  .browser__body .csv { font-size: 0.75rem; }
}

/* ---------- front page, version 2 (head of retail) ---------- */
.hero__quiet { margin-top: var(--s-4); font-size: var(--t-small); }
.header-tools .link-quiet { white-space: nowrap; }
/* scene 2: paper stock in the till */
.papers { position: absolute; left: 50%; top: calc(50% + 40px); transform: translateX(-50%); display: flex; gap: 4px; }
.papers i { display: block; width: 26px; height: 36px; border: 1px solid var(--ink-2); border-radius: 2px; background: var(--bg); background-image: repeating-linear-gradient(0deg, transparent 0 6px, var(--line) 6px 7px); transform: translateY(calc((1 - var(--t, 1)) * 0px)); }
.sp .cap-top { top: calc(50% + 90px); left: 50%; transform: translateX(-50%); }
.sp .cap-bottom { left: calc(50% + 130px); top: 50%; transform: translateY(-50%); white-space: nowrap; }
.sp .stage { grid-template-rows: 1.4fr auto 1fr; }
@media (max-width: 599px) { .sp .cap-bottom { left: 50%; top: calc(50% + 34px); transform: translateX(-50%); background: var(--bg); padding: 0 6px; } }
/* scene 3: three labelled fields instead of CSV syntax */
.row3 { display: flex; gap: 14px; align-items: end; }
.row3 > span { display: grid; gap: 2px; }
.row3 small { font: 500 10px/1 var(--sans); letter-spacing: 0.04em; color: var(--ink-3); text-transform: lowercase; }
.row3 code { font: 400 0.8125rem/1.3 var(--mono); white-space: nowrap; }
.row3 b { font: 500 0.8125rem/1.3 var(--sans); white-space: nowrap; }
.row3.enc .g { --g: clamp(0, (var(--ts) - var(--i) * 0.05) / 0.12, 1); }
.row3 .g { width: 1ch; }
.s3 .browser { width: min(320px, 100%); }
/* scene 4b: bundle struck, one card crosses */
.s4b .bundle { position: absolute; left: 50%; top: 50%; transform: translate(calc(-50% - 0px), calc(-50% - var(--t) * 90px)); display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; width: 72px; opacity: calc(1 - clamp(0, (var(--p) - .36) * 8, 1) * .55); }
.s4b .bundle i { display: block; height: 16px; background: var(--card); border-radius: 2px; }
.s4b .strike { position: absolute; left: 50%; top: 0; width: 28px; height: 2px; background: var(--ink); transform: translate(-50%, -50%) rotate(-45deg) scaleX(var(--t)); z-index: 3; }
.s4b .card-up { position: absolute; left: 0; bottom: 25%; transform: translate(calc(var(--t) * 150px), calc(var(--t) * -320px)); opacity: calc(var(--t) * (1 - var(--t)) * 4); z-index: 3; pointer-events: none; }
.s4b .at-till { position: absolute; left: calc(50% + 125px); top: 50%; transform: translateY(-50%); }
.s4b .chips-till { position: absolute; left: 50%; top: calc(50% + 44px); transform: translateX(-50%); white-space: nowrap; }
.chip--word { font-family: var(--sans); font-weight: 500; font-size: var(--t-caption); }
.s4b .cap-side { left: calc(50% + 130px); top: 50%; transform: translateY(-50%); white-space: nowrap; bottom: auto; }
.s4b .stage__park .card .g, .s4b .card-up .g, .s4b .at-till .g { --g: 0; }
@media (max-width: 599px) { .s4b .at-till { left: auto; right: 0; } .s4b .cap-side { left: 50%; top: calc(50% + 40px); transform: translateX(-50%); } }
/* scene 5b: merchant tiles and switches */
.stage--control { grid-template-rows: 1.2fr auto 1fr; }
.tiles { display: flex; gap: var(--s-3); align-items: start; }
.tile { position: relative; display: grid; gap: 6px; padding: 10px 12px 14px; border: 1px solid var(--ink); border-radius: var(--r-2); background: var(--bg); min-width: 104px; }
.tile b { font-size: var(--t-small); font-weight: 600; }
.tile .vals { display: flex; gap: 4px; }
.tile .vals i { font: 500 11px/1 var(--mono); padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: 3px; }
.tile .flow { position: absolute; left: 50%; bottom: -34px; width: 1px; height: 34px; background: var(--ink); }
.tile .flow::after { content: ""; position: absolute; left: -3px; top: -1px; width: 7px; height: 7px; border-left: 1px solid var(--ink); border-top: 1px solid var(--ink); transform: rotate(45deg); }
.tile--off { opacity: calc(1 - var(--off, 0) * .6); border-style: solid; }
.tile--off .flow { opacity: calc(1 - var(--off, 0)); }
html:not(.motion) .tile--off { --off: 1; }
.browser--wide { width: min(320px, 100%); }
.switchrow { display: flex; justify-content: space-between; align-items: center; font-size: var(--t-caption); padding: 4px 0; border-bottom: 1px solid var(--line); }
.sw { position: relative; width: 30px; height: 16px; border-radius: 999px; background: var(--ink-3); }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transform: translateX(calc(14px * (1 - var(--off, 1)))); }
.sw.on { background: var(--ink); --off: 0; }
.sw:not(.on) { background: color-mix(in srgb, var(--ink) calc((1 - var(--off, 1)) * 100%), var(--line-strong)); }
html:not(.motion) .sw:not(.on) { --off: 1; }
.stage--control .stage__bottom { align-items: start; padding-top: var(--s-5); }
/* scene 6: plain-word report */
.report--plain { font-family: var(--sans); }
.report--plain td:nth-child(2), .report--plain td:nth-child(3), .report--plain td:nth-child(4), .report--plain td:nth-child(5) { font-family: var(--mono); }
.report--plain th { font-family: var(--sans); }
.report--plain td:first-child { width: auto; }
/* scene 7: stacks */
.stacks--big { gap: var(--s-7); }
.stack--new .stack__sheets i { border-style: dashed; }
/* scene 8: networks */
.nets { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); align-content: center; min-height: 320px; }
.nets ul { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; gap: 2px; }
.nets li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); padding: 9px 0; border-bottom: 1px solid var(--line); font-size: var(--t-small); }
.nets li b { font-weight: 600; }
.nets li span { font-family: var(--mono); font-size: var(--t-caption); color: var(--ink-3); }
.nets__proof { margin-top: var(--s-6); display: grid; gap: var(--s-2); justify-items: start; }
.nets__proof .card--inline { --w: 120px; }
.nets__proof .card--inline + .card--inline { margin-top: -2px; }
.nets__proof .g { --g: 0; }
@media (max-width: 599px) { .nets { grid-template-columns: 1fr; } }
/* scene 9: handover card */
.door--it { gap: var(--s-4); }
.note { border: 1px solid var(--line); border-radius: var(--r-1); padding: 10px 12px; }
.note summary { cursor: pointer; font-weight: 600; font-size: var(--t-small); }
.note__text { margin: var(--s-3) 0; padding: 12px; background: var(--surface); border-radius: var(--r-1); font: 400 var(--t-caption)/1.5 var(--sans); white-space: pre-wrap; color: var(--ink-2); }
.note .btn-row { flex-direction: row !important; }
.note .btn-row .btn { width: auto !important; }
/* v2 polish */
.browser .lab { font-size: var(--t-caption); color: var(--ink-3); font-weight: 500; }
.papers i { width: 34px; height: 46px; }
.papers { top: calc(50% + 44px); }
.sp .cap-top { top: calc(50% + 104px); }
.s4b .bundle { left: calc(50% - 150px); }
.s4b .strike { left: calc(50% - 150px); }
.stacks--big .stack__sheets i { width: 120px; height: 12px; }
.stacks--big .stack__tiles i { width: 14px; height: 9px; }
@media (max-width: 599px) { .s4b .bundle, .s4b .strike { left: calc(50% - 90px); } .tiles { flex-wrap: wrap; } }
@media (max-width: 599px) {
  .s4b .stage { min-height: 560px; grid-template-rows: 1.5fr auto 1fr; }
  .s4b .at-till { left: 50%; right: auto; top: calc(50% + 36px); transform: translateX(-50%); }
  .s4b .chips-till { top: calc(50% + 96px); }
  .s4b .bundle, .s4b .strike { left: calc(50% - 110px); }
  .s4b .cap-side { top: calc(50% + 40px); }
  .s5b .stage { min-height: 600px; }
}
@media (max-width: 599px) {
  html .scene--pin.s4b .stage { min-height: 600px; grid-template-rows: 1.6fr auto 1fr; }
  html .scene--pin.s5b .stage { min-height: 600px; }
  .s4b .chips-till { white-space: normal; justify-content: center; width: 220px; }
}

/* ======================================================================
   Jednotný vizuál s predajným webom (2026-11-07, Michal: žltá a čierna)
   For merchants a Developers majú tú istú hlavičku, úvod, tlačidlá a pätu
   ako ostatné stránky (sales.css): čierna #0b0b0d, jantár #ffb020 → #f08a1c.
   Farby metód v referencii (GET, POST…) ostávajú podľa zvyklosti Swaggeru.
   ====================================================================== */
:root, :root[data-theme="light"] {
  --accent: #ffb020; --accent-hover: #ffc04d; --on-accent: #0b0b0d; --card: #ffb020;
  --amber: #ffb020; --amber-2: #f08a1c; --amber-ink: #8a4b00;
  --night: #0b0b0d; --on-night: #f5f5f7; --on-night-2: #a1a1aa; --on-night-3: #6e6e78;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --accent: #ffb020; --accent-hover: #ffc04d; --on-accent: #0b0b0d; --amber-ink: #ffb020; }
}
:root[data-theme="dark"] { --accent: #ffb020; --accent-hover: #ffc04d; --on-accent: #0b0b0d; --amber-ink: #ffb020; }

/* hlavička */
.site-header { position: sticky; top: 0; z-index: 40; background: rgb(11 11 13 / 94%); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px); border-bottom: 1px solid rgb(255 255 255 / 8%); color: var(--on-night); }
.site-header .header-row { min-height: 60px; }
.site-header .brand { color: var(--on-night); font-weight: 700; gap: 10px; }
.brand-mark { flex: none; width: 26px; height: 26px; border-radius: 22%; background: url("mark.svg") center / cover no-repeat; } /* ikona F (štvorec s výrezom a mriežkou 1/0), plans/17-prototyp/icon-proposals */
.site-header .main-nav a { color: var(--on-night-2); }
.site-header .main-nav a:hover, .site-header .main-nav a[aria-current="page"] { color: var(--on-night); }
.site-header .main-nav a[aria-current="page"] { text-decoration-color: var(--amber); text-decoration-thickness: 2px; }
.site-header .btn-secondary { background: var(--amber); border-color: var(--amber); color: var(--night); }
.site-header .btn-secondary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--night); }

/* tlačidlá: oblé, hlavné jantárové, vedľajšie s obrysom */
.btn { border-radius: 999px; font-weight: 600; }
.btn:not(.btn-secondary) { color: var(--night); }

/* úvod stránky tmavý ako page-hero predajného webu */
.page-head, .dev-head { background: var(--night); color: var(--on-night); border-bottom: 0; padding-block: clamp(56px, 7vw, 96px); }
.page-head .lead, .dev-head .lead, .dev-head .muted, .dev-head li { color: var(--on-night-2); }
.page-head .first-line { color: var(--amber); }
.dev-head a { color: var(--amber); }
.dev-head code { color: var(--on-night); background: rgb(255 255 255 / 8%); border-radius: 4px; padding: 0.05em 0.35em; }
.dev-head .meta-row { color: var(--on-night-3); }
.dev-head strong { color: var(--on-night); }

/* pás bezpečnosti v modeloch: jantár, námaha sivá */
.bars i { background: linear-gradient(90deg, var(--amber), var(--amber-2)); }
.bars i.eff { background: var(--ink-3); }

/* referencia API: ovládanie čiernou, potvrdenie jantárom (jantár na bielom nemá kontrast) */
.btn-auth, .btn-try { border-color: currentColor; color: var(--ink); }
.btn-auth.is-authorized, .btn-execute { background: var(--accent); border-color: var(--accent); color: var(--night); }
.swg-auth-status { color: var(--amber-ink); }

/* päta tmavá ako na predajnom webe */
.site-footer { background: var(--night); color: var(--on-night-3); border-top: 0; }
.site-footer a { color: var(--on-night-2); text-decoration: none; }
.site-footer a:hover { color: var(--on-night); }
.site-footer .muted { color: var(--on-night-3); }
.dev-head h1 { max-width: 20ch; }
.dev-head .lead { margin-top: var(--s-5); max-width: 40rem; }
.dev-head .small { margin-top: var(--s-4); }
.dev-head ol { margin: var(--s-6) 0 0; padding-left: 1.25em; display: grid; gap: var(--s-2); max-width: 48rem; }
/* zoznam volaní API v úvode: je v HTML aj bez JavaScriptu, tvarom ako kroky nad ním;
   cesta v <code> je URL, nezalamuje sa; na telefóne sa posúva len ona, nie stránka */
.dev-head ol + p { margin-top: var(--s-6); max-width: 48rem; color: var(--on-night-2); }
.dev-head ul { margin: var(--s-3) 0 0; padding-left: 1.25em; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); max-width: 48rem; }
.dev-head ul code { white-space: nowrap; display: inline-block; max-width: 100%; overflow-x: auto; vertical-align: bottom; }
.dev-head .meta-row { margin-top: var(--s-6); display: flex; flex-wrap: wrap; gap: var(--s-2); font-size: var(--t-small); }
/* telefón: dlhé príkazy curl roztiahli stĺpec prózy na ~620 px a body ho orezalo;
   stĺpec smie byť užší než obsah, blok kódu sa posúva sám */
.prose, .prose section { grid-template-columns: minmax(0, 1fr); }
.copy-wrap { min-width: 0; }

/* Textúra plôch (assets/texture.js): canvas za obsahom kapitoly, vždy na výšku okna */
.tex-canvas { position: absolute; left: 0; top: 0; width: 100%; z-index: -1; pointer-events: none; }
@media print { .tex-canvas { display: none; } }
