/* House of Spades: the press sheet.
   Four inks only: vermilion, box black, foil gold, card ivory. Gold is for the Blinkit action.
   No gradients, glows, glass, blur, drop shadows or rounded cards. */

@font-face { font-family: "Chonburi"; src: url("../fonts/chonburi-400-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Hind"; src: url("../fonts/hind-400-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Hind"; src: url("../fonts/hind-600-latin.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --vermilion: #A61E1B;
  --black: #1C1A1B;
  --gold: #D9B15A;
  --ivory: #F4EAD2;
  --display: "Chonburi", Georgia, "Times New Roman", serif;
  --text: "Hind", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* gutters, header and slot clear the notch and home indicator (viewport-fit=cover); 0 on desktop */
  --safe-x: max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --safe-top: env(safe-area-inset-top, 0px);
  --gutter: max(24px, var(--safe-x));
  --bar-h: calc(69px + env(safe-area-inset-bottom, 0px));
  --slot-bottom: calc(44px + env(safe-area-inset-bottom, 0px));             /* the slot and the rail sit above the registration marks */
  --cart-h: 150px;                 /* the active cartouche's height on phones; set by main.js */
  /* where the first still draws the set: the stage 01 subject offset in assets/js/scene/story.js
     (fractions of the viewport, +x right, +y up) */
  --still-ox: 0.12;   /* wide viewports */
  --still-oy: 0;      /* tall viewports */
  /* the label frame: double ivory keyline, 3px apart, with scooped (concave) quarter-circle corners; nine-slice SVG */
  --frame: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='33' height='33' viewBox='0 0 33 33' fill='none' stroke='%23F4EAD2'%3E%3Cdefs%3E%3Cpath id='c' d='M16 .5H10.5A10 10 0 0 1 .5 10.5V16M16 4.5H12.87A13 13 0 0 1 4.5 12.87V16'/%3E%3C/defs%3E%3Cuse href='%23c'/%3E%3Cuse href='%23c' transform='matrix(-1 0 0 1 33 0)'/%3E%3Cuse href='%23c' transform='matrix(1 0 0 -1 0 33)'/%3E%3Cuse href='%23c' transform='matrix(-1 0 0 -1 33 33)'/%3E%3Cpath d='M16 .5H17M16 4.5H17M16 32.5H17M16 28.5H17M.5 16V17M4.5 16V17M32.5 16V17M28.5 16V17'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--vermilion);
  color: var(--ivory);
  scrollbar-color: var(--ivory) var(--black);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--vermilion);
  color: var(--ivory);
  font: 400 1rem/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ivory); color: var(--vermilion); }
.faq ::selection, .imprint ::selection { background: var(--ivory); color: var(--black); }
:focus-visible { outline: 2px solid var(--ivory); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
h1, h2, p { margin: 0; }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
img { max-width: 100%; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip {
  position: fixed; top: -80px; left: 12px; z-index: 20; min-height: 44px; padding: 10px 16px;
  background: var(--ivory); color: var(--vermilion); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---- logo -------------------------------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--ivory); }
.brand-icon { width: 30px; height: 35px; flex: none; }
.brand-word { width: 106px; height: 31px; flex: none; }

/* ---- store and shortcut buttons ----------------------------------------------------------------------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  min-height: 48px; padding: 0 1.25rem;
  border: 1px solid transparent; border-radius: 999px;
  font: 600 1rem/1 var(--text); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 0.15s linear, color 0.15s linear, border-color 0.15s linear;
}
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--black); }
.btn-gold:hover { background: var(--ivory); border-color: var(--ivory); }
.btn-line { background: transparent; border-color: var(--ivory); color: var(--ivory); }
.btn-line:hover { background: var(--ivory); color: var(--vermilion); }
.btn:active { transform: translateY(1px); }
.wm-blinkit { font-size: 1.16em; font-weight: 600; letter-spacing: -0.03em; }
.logo-amazon { width: 1.55em; height: 1.55em; margin-top: 0.12em; flex: none; }

/* ---- the story track --------------------------------------------------------------------- */
.story { position: relative; }

.still, .still-first, .marks { display: none; }
#scene { display: none; }

/* Without WebGL or JavaScript: an ordinary document, each stage still above its copy. */
html:not(.scene) .rail, html:not(.scene) .still-first { display: none; }
html:not(.scene) .stage { padding: 0 0 48px; }
html:not(.scene) .still { display: block; }
html:not(.scene) .still img { display: block; width: 100%; height: auto; max-height: 78svh; object-fit: contain; background: var(--vermilion); }
html:not(.scene) .copy { padding: 24px var(--gutter) 0; }
html:not(.scene) .still { margin-top: 24px; }
html:not(.scene) .cartouche { width: min(26rem, 100%); }
html:not(.scene) h1 { margin-bottom: 24px; }
/* wide stills have empty sheet above and below the subject: show only the band the subject fills
   (--y0 and --h are rows of the 1440 x 900 still, a 16px margin included), so the gap to the
   neighbouring copy stays under 96px */
@media (orientation: landscape) {
  html:not(.scene) .still img {
    width: min(100%, calc(78svh * 1440 / var(--h))); max-height: none; margin-inline: auto;
    aspect-ratio: 1440 / var(--h); object-fit: cover; object-position: 50% calc(var(--y0) / (900 - var(--h)) * 100%);
  }
  #stage-1 .still { --y0: 278; --h: 622; }
  #stage-2 .still { --y0: 95; --h: 784; }
  #stage-3 .still { --y0: 74; --h: 681; }
  #stage-4 .still { --y0: 77; --h: 745; }
  #stage-5 .still { --y0: 133; --h: 615; }
}

/* The scene: one fixed canvas behind five scroll sections. Each section's copy sits in one fixed
   slot and only the active one is shown. The track clips the fixed layers, so the FAQ rises over
   the canvas and everything on it. */
.scene .story { clip-path: inset(0); }
.scene #scene { display: block; position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.scene .stage { --k: 1.45; min-height: calc(var(--k) * 100svh); scroll-margin-top: calc((1 - var(--k)) * 50svh); }
.scene #stage-1 { --k: 1.45; }
.scene #stage-2 { --k: 1.35; }
.scene #stage-3 { --k: 1.17; }
.scene #stage-4 { --k: 1.13; }
.scene #stage-5 { --k: 1.13; }

/* first paint: the stage 01 still, placed where the canvas draws the set */
.scene .still-first {
  display: block; position: fixed; z-index: 1; pointer-events: none;
  top: 0; height: 100%; aspect-ratio: 1440 / 900;
  left: calc((0.5 + var(--still-ox)) * 100%);
  translate: calc(-100% * (0.5 + var(--still-ox))) 0;
}
.scene .still-first img { display: block; width: 100%; height: 100%; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: calc(36px + var(--safe-top)) var(--gutter) 0; }
.scene .top { position: fixed; inset: 0 0 auto 0; z-index: 5; pointer-events: none; }
.scene .top > * { pointer-events: auto; }
/* The header pair of store buttons (phones: the bottom bar) gives way while the purchase buttons in #buy are on
   screen (main.js sets buy-in-view), so the same buttons never show twice. The logo, which belongs to the sheet,
   is hidden once the black has covered it. */
.scene[data-past] .brand { visibility: hidden; }
.top-actions .btn-line:not(:hover) { background: var(--vermilion); }
.scene[data-past] .top-actions .btn-line:not(:hover) { background: var(--black); }
.buy-in-view .top-actions, .buy-in-view .buybar { visibility: hidden; }

/* the copy slot: every stage's copy is in the document and in the same fixed place; only the active
   one is shown (the others are clipped away, not faded out of existence). A swap is a 150 ms cross-fade. */
.scene .copy { position: fixed; inset: 0; z-index: 3; pointer-events: none; clip-path: inset(100% 0 0 0); }
.scene .copy.is-active, .scene .copy.is-leaving { clip-path: none; }
.scene .copy.is-active { animation: copy-in 0.15s linear; }
.scene .copy.is-leaving { animation: copy-out 0.15s linear forwards; }
html:not([data-stage]) .copy.is-active { animation: none; }
@keyframes copy-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes copy-out { from { opacity: 1; } to { opacity: 0; } }
.scene .copy.is-active .cartouche, .scene .copy.is-active h1 { pointer-events: auto; }
.scene .cartouche { position: absolute; left: var(--gutter); bottom: var(--slot-bottom); width: min(26rem, calc(100% - 2 * var(--gutter))); }
.scene h1 { position: absolute; left: var(--gutter); top: calc(84px + var(--safe-top)); }

/* ---- press-sheet furniture: registration targets, colour bar, trim marks (four inks, decorative) ----- */
.scene .marks { display: block; }
.marks > * { position: fixed; z-index: 2; pointer-events: none; }
.reg { width: 18px; height: 18px; border: 1px solid var(--ivory); border-radius: 50%; }
.reg::before, .reg::after { content: ""; position: absolute; background: var(--ivory); }
.reg::before { left: -4px; right: -4px; top: 50%; height: 1px; margin-top: -0.5px; }
.reg::after { top: -4px; bottom: -4px; left: 50%; width: 1px; margin-left: -0.5px; }
.reg.tl, .reg.bl { left: calc(26px + var(--safe-x)); }
.reg.tr, .reg.br { right: calc(26px + var(--safe-x)); }
.reg.tl, .reg.tr { top: calc(12px + var(--safe-top)); }
.reg.bl, .reg.br { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.colorbar { left: calc(56px + var(--safe-x)); top: calc(15px + var(--safe-top)); display: flex; gap: 2px; }
.colorbar i { display: block; width: 12px; height: 12px; }
.colorbar i:nth-child(1) { background: var(--vermilion); border: 1px solid var(--ivory); }
.colorbar i:nth-child(2) { background: var(--black); }
.colorbar i:nth-child(3) { background: var(--gold); }
.colorbar i:nth-child(4) { background: var(--ivory); }
.trim { width: 14px; height: 14px; }
.trim.tl { left: 4px; top: 4px; border-top: 1px solid var(--ivory); border-left: 1px solid var(--ivory); }
.trim.tr { right: 4px; top: 4px; border-top: 1px solid var(--ivory); border-right: 1px solid var(--ivory); }
.trim.bl { left: 4px; bottom: 4px; border-bottom: 1px solid var(--ivory); border-left: 1px solid var(--ivory); }
.trim.br { right: 4px; bottom: 4px; border-bottom: 1px solid var(--ivory); border-right: 1px solid var(--ivory); }

/* ---- headline ---------------------------------------------------------------------------- */
h1 {
  /* cap height is about 9% of the viewport height at 1440 x 900; it follows the smaller of width and height */
  font: 400 clamp(3rem, min(8vw, 12.9vh), 9rem) / 1 var(--display);
  letter-spacing: -0.01em;
  color: var(--ivory);
  max-width: 14em;
}
.br-t { display: none; }

/* ---- the label cartouche ----------------------------------------------------------------- */
.cartouche {
  position: relative;
  container-type: inline-size;                 /* stacked headings are sized in cqw of the text column */
  background: var(--vermilion);
  border: 16px solid transparent;
  border-image: var(--frame) 16 / 16px stretch;
  padding: 14px 10px 10px;
  color: var(--ivory);
}
.cartouche > * + * { margin-top: 12px; }
.num { font: 400 3.5rem / 0.95 var(--display); }
.cartouche h2 { font: 400 1.5rem / 1 var(--display); }
/* stacked label lettering: two lines, each sized so it is exactly as wide as the text column.
   --w is the line's advance width in em (Chonburi), so the size is column width / --w. */
.stack { margin: 0; }
.stack span { display: block; white-space: nowrap; line-height: 1; }
@container (min-width: 1px) { .cartouche .stack span { font-size: calc(99.5cqw / var(--w)); } }
.cartouche .stack { margin-bottom: 12px; }
.cartouche p { font-size: 1.0625rem; line-height: 1.55; text-wrap: pretty; }
.cartouche .num { margin-bottom: 4px; }
.cartouche .fact { font-size: 1.1875rem; font-weight: 600; line-height: 1.4; }
.note { font-size: 0.875rem !important; line-height: 1.45 !important; }

/* ---- stage rail (desktop) ---------------------------------------------------------------- */
.scene .rail { position: fixed; z-index: 4; right: max(16px, var(--safe-x)); bottom: var(--slot-bottom); }
.rail ol { position: relative; list-style: none; margin: 0; padding: 0; }
.rail ol::before { content: ""; position: absolute; right: 9px; top: 22px; bottom: 22px; width: 1px; background: var(--ivory); }
.rail a {
  position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  min-height: 44px; padding: 0 4px 0 12px;
  color: var(--ivory); text-decoration: none; font-size: 0.875rem; font-weight: 400; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.rail a::after { content: ""; flex: none; width: 11px; height: 11px; border: 1px solid var(--ivory); background: var(--vermilion); }
.rail a:hover .t { text-decoration: underline; text-underline-offset: 0.3em; }
.rail a[aria-current] { font-weight: 600; }
.rail a[aria-current]::after { background: var(--ivory); }
.rail .n { font-weight: 600; }

/* ---- FAQ and footer: solid box-black ground, over the canvas ----------------------------- */
.faq { position: relative; min-height: calc(100svh - 13rem); background: var(--black); color: var(--ivory); padding: 96px var(--gutter) 88px; }
.faq-grid { display: grid; gap: 40px; max-width: 1180px; margin: 0 auto; }
.faq-head { display: grid; gap: 16px; }
.faq-head h2 { font: 400 3.75rem / 1.05 var(--display); text-wrap: balance; }
.faq-head p { font-size: 1.0625rem; line-height: 1.6; }
/* the list is ruled with a single 1px ivory keyline between questions */
.faq-list { border-top: 1px solid var(--ivory); }
.faq details { border-bottom: 1px solid var(--ivory); }
.faq summary {
  position: relative; display: block; min-height: 44px; padding: 20px 56px 20px 0;
  font-size: 1.1875rem; font-weight: 600; line-height: 1.35; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before, .faq summary::after {
  content: ""; position: absolute; right: 8px; top: 50%; width: 16px; height: 2px; margin-top: -1px; background: var(--ivory);
}
.faq summary::after { transform: rotate(90deg); }
.faq details[open] summary::after { transform: none; }
.faq summary:focus-visible { outline-offset: -2px; }
.faq details p { max-width: 62ch; padding: 0 56px 24px 0; font-size: 1.0625rem; line-height: 1.6; text-wrap: pretty; }
@media (min-width: 900px) {
  .faq-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; align-items: start; }
}

.imprint {
  display: grid; justify-items: start; gap: 8px;
  background: var(--black); color: var(--ivory);
  padding: 40px var(--gutter) 56px; border-top: 1px solid var(--ivory);
  font-size: 0.9375rem;
}
.imprint .brand { margin-bottom: 16px; }
.imprint p { max-width: 62ch; }
@media (min-width: 900px) {
  .imprint { padding-inline: max(var(--gutter), calc((100% - 1180px) / 2)); }
  .faq { padding-inline: max(var(--gutter), calc((100% - 1180px) / 2)); }
  .faq-grid { max-width: none; margin: 0; }
}

/* purchase section (#buy): the only place the Blinkit and Amazon buttons appear */
.closing { display: grid; gap: 20px; max-width: 1180px; margin: 64px auto 0; padding-top: 40px; border-top: 1px solid var(--ivory); scroll-margin-top: 96px; }
.closing-head { display: grid; gap: 16px; justify-items: start; }
.closing-icon { width: 24px; height: 28px; color: var(--ivory); }
.closing-line { font: 400 clamp(2rem, 3.4vw, 2.75rem) / 1.1 var(--display); text-wrap: balance; }
.closing-sub { font-size: 1.0625rem; line-height: 1.6; max-width: 46ch; }
.closing .actions { margin-top: 20px; }
.closing .note { margin-top: 14px; max-width: 46ch; }
@media (min-width: 900px) {
  .closing { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; max-width: none; margin-left: 0; margin-right: 0; align-items: start; }
}

/* ---- phone buy bar: both store buttons, fixed to the bottom edge ------------------------- */
.buybar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; flex-wrap: nowrap; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--black); border-top: 1px solid var(--ivory);
}
.buybar .btn { flex: 1 1 0; min-width: 0; padding-inline: 8px; }

/* ---- tall viewports: phones, portrait tablets -------------------------------------------- */
@media (orientation: portrait) {
  :root { --gutter: max(16px, var(--safe-x)); }
  .buybar { display: flex; }
  .top-actions { display: none !important; }
  .faq-head h2 { font-size: 2.25rem; }
  .closing .actions { flex-direction: column; }
  .closing .btn { width: 100%; }
  .imprint { padding-bottom: calc(40px + var(--bar-h)); }
  html:not(.scene) body { padding-bottom: var(--bar-h); }

  .reg.bl, .reg.br, .trim.bl, .trim.br, .colorbar { display: none; }
  /* on phones the stack is set narrower than the text column (62%): full width would leave no room for the scene above the slot */
  .cartouche .stack span { font-size: calc(62cqw / var(--w)); }
  .cartouche .stack { margin-bottom: 10px; }
  /* the document without WebGL: each stage fits one phone screen, copy first, the still sized to what is left */
  html:not(.scene) .stage { display: flex; flex-direction: column; min-height: calc(100svh - var(--bar-h)); padding-bottom: 16px; }
  html:not(.scene) .stage .still { flex: 1 1 0; min-height: 140px; display: flex; margin-top: 16px; }
  html:not(.scene) .stage .still img { flex: 1; min-height: 0; width: 100%; height: 100%; max-height: none; object-fit: contain; }
  html:not(.scene) #stage-1 .still { flex: 0 0 auto; display: block; }
  html:not(.scene) #stage-1 .still img { height: auto; max-height: 42svh; }
  .br-w { display: none; }
  .br-t { display: inline; }
  h1 { font-size: clamp(2.5rem, 13.4vw, 4.25rem); line-height: 1.04; }
  .top { padding-top: calc(22px + var(--safe-top)); }
  .reg.tl, .reg.tr { top: calc(6px + var(--safe-top)); }
  .scene h1 { top: calc(80px + var(--safe-top)); right: var(--gutter); }
  .brand { gap: 8px; }
  .scene .brand-icon { width: 22px; height: 26px; }
  .scene .brand-word { width: 80px; height: 23.5px; }

  .scene #stage-1 { --k: 1.25; }
  .scene #stage-2 { --k: 1.1; }
  .scene #stage-3 { --k: 0.9; }
  .scene #stage-4 { --k: 0.85; }
  .scene #stage-5 { --k: 1.1; }

  /* the canvas is the largest viewport tall, so it keeps its size while the toolbar shows and hides */
  .scene #scene { height: 100lvh; }
  .scene .still-first {
    top: calc((0.5 - var(--still-oy)) * 100%); left: 0; width: 100%; height: auto; aspect-ratio: 390 / 844;
    translate: 0 calc(-100% * (0.5 - var(--still-oy)));
  }

  /* the panel is only as tall as its copy: 12px above the numeral, as on the sides */
  .scene .cartouche { left: var(--gutter); right: var(--gutter); width: auto; bottom: calc(var(--bar-h) + 16px); padding: 12px 4px 4px; }
  .cartouche { padding: 12px 4px 4px; }
  .cartouche .num { margin-bottom: 0; }
  .num { font-size: 2.5rem; }
  .cartouche p { font-size: 1rem; line-height: 1.5; }
  .cartouche .fact { font-size: 1.0625rem; }
  .note { font-size: 0.8125rem !important; }

  /* the stage rail becomes five ticks along the top edge of the cartouche */
  .scene .rail {
    left: var(--gutter); right: var(--gutter); top: auto;
    bottom: calc(var(--bar-h) + 16px + var(--cart-h) - 15px);   /* the ticks end 11px above the cartouche's outer edge */
  }
  .rail ol { display: flex; padding: 0 12px; }
  .rail ol::before { display: none; }
  .rail li { flex: 1 1 0; }
  .rail a { display: block; min-height: 44px; padding: 0; }
  .rail a::after { position: absolute; left: 4px; right: 4px; top: 13px; width: auto; height: 5px; }
  .rail .n, .rail .t {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}

/* short phones: a smaller numeral keeps the panel low */
@media (orientation: portrait) and (max-height: 720px) {
  .num { font-size: 2.125rem; }
}

/* small landscape screens: keep the display type inside the frame */
@media (orientation: landscape) and (max-height: 600px) {
  .scene h1 { top: 72px; }
  .num { font-size: 2.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
