/* ==========================================================================
   style.css — fixed 2048×1536 stage, layers, chrome, slide components.
   All positions inside .stage are Illustrator artboard pixels.
   ========================================================================== */

:root {
  --stage-w: 2048px;
  --stage-h: 1536px;
  --scale: 0.5;                 /* set by main.js to fit the viewport */

  --letterbox: #3d000a;
  --ink: #231f20;
  --blue: #1a7fe0;
  --red: #e30613;

  --font-ui: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;

  /* Motion — navigation.js reads --slide-duration for its fallback timer */
  --slide-duration: 950ms;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--letterbox);
}

body {
  font-family: var(--font-ui);
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

button, input, textarea { font: inherit; color: inherit; }
img { display: block; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

:focus-visible { outline: 6px solid #8fd0ff; outline-offset: 6px; }

/* ---------- Viewport + scaled stage ---------- */
.viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  /* letterbox: echo the deck's radial glow so bars don't look dead */
  background: radial-gradient(ellipse at 50% 50%, #6e0014 0%, var(--letterbox) 70%);
}

.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--stage-w);
  height: var(--stage-h);
  overflow: hidden;
  transform: translate(-50%, -50%) scale(var(--scale));
  transform-origin: 50% 50%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  contain: layout paint;
}

/* Any full-artboard image */
.layer {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--stage-w);
  height: var(--stage-h);
  pointer-events: none;
}

/* ---------- Deck ---------- */
.deck {
  position: absolute;
  inset: 0;
}

/* Notebook: pages are stacked; navigation.js shows the current one and,
   during a turn, clips the top page along the fold line. */
.book {
  position: absolute;
  inset: 0;
  touch-action: pan-y;
  cursor: grab;
}
.deck.is-dragging .book { cursor: grabbing; }

.page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
}
.page.is-shown { visibility: visible; }
.page.is-top   { z-index: 1; }

.slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.page > .slide:first-of-type { pointer-events: none; }

.curl {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: var(--stage-w);
  height: var(--stage-h);
  pointer-events: none;
  visibility: hidden;
}
.curl.is-shown { visibility: visible; }
.curl__edge {                 /* soft shadow along the loose edge of the paper */
  fill: none;
  stroke: rgba(0, 0, 0, 0.16);
  stroke-width: 34;
  stroke-linejoin: round;
}

/* ---------- HOME / REF ---------- */
.nav-btn {
  position: absolute;
  z-index: 10;
  top: 1389px;
  width: 92px;
  height: 92px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease-spring), filter 0.25s var(--ease-out);
}
.nav-btn::after {             /* 132px touch target */
  content: "";
  position: absolute;
  inset: -20px;
  border-radius: 50%;
}
.nav-btn img { width: 92px; height: 92px; }
.nav-btn--home { left: 144px; }
.nav-btn--ref  { left: 1812px; }
@media (hover: hover) {
  .nav-btn:hover { transform: scale(1.08); filter: brightness(1.12); }
}
.nav-btn:active { transform: scale(0.88); transition-duration: 0.08s; }
.nav-btn.is-current { filter: drop-shadow(0 0 14px rgba(143, 208, 255, 0.9)); }

/* ---------- Image buttons (Submit / Close) ---------- */
.img-btn {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 999px;
  filter: drop-shadow(0 10px 10px rgba(40, 0, 6, 0.45));
  transition: transform 0.22s var(--ease-spring), filter 0.22s var(--ease-out);
}
@media (hover: hover) { .img-btn:hover { transform: translateY(-3px); filter: drop-shadow(0 14px 14px rgba(40,0,6,.5)) brightness(1.08); } }
.img-btn:active { transform: scale(0.94); filter: drop-shadow(0 4px 5px rgba(40, 0, 6, 0.45)); transition-duration: 0.08s; }
.img-btn[disabled] { opacity: 0.6; pointer-events: none; }

.form-status {
  position: absolute;
  margin: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 34px;
  font-weight: 600;
  min-height: 1.3em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.form-status[data-state="error"] { color: #ffd2d8; }
.form-status[data-state="ok"]    { color: #bfe6ff; }

/* ==========================================================================
   OPENING PAGE — cover artwork + details form
   The panel sits on the left so the doctor and headline stay visible.
   ========================================================================== */
.start {
  position: absolute;
  inset: 0;
  z-index: 20;
  transition: opacity 0.6s var(--ease-out), visibility 0s linear 0s;
}
.start.is-done {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s var(--ease-out), visibility 0s linear 0.6s;
}
.lead {
  position: absolute;
  left: 52px;
  top: 590px;
  width: 600px;
  display: flex;
  flex-direction: column;
  padding: 30px 36px 14px;
  border: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 36px;
  background: rgba(86, 0, 16, 0.9);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
}
.lead__label {
  margin-bottom: 6px;
  font-size: 36px;
  font-weight: 700;
  text-transform: uppercase;
}
.lead__field {
  width: 100%;
  height: 78px;
  margin-bottom: 20px;
  padding: 0 22px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 38px;
  font-weight: 600;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.lead__field:focus { box-shadow: 0 0 0 6px rgba(143, 208, 255, 0.85); }
.lead__field.is-invalid { box-shadow: 0 0 0 6px rgba(255, 120, 140, 0.95); }
.lead__actions {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}
.lead__btn { position: relative; }
.lead__btn img { width: 246px; height: auto; }
.lead__status {
  min-height: 1.4em;
  margin: 12px 0 0;
  text-align: center;
  font-size: 30px;
  font-weight: 600;
  color: #ffd2d8;
}

/* Opening form (red screen). The labels are artwork: start-art.webp */
.field {
  position: absolute;
  left: 950px;
  width: 549px;
  height: 70px;
  padding: 0 22px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 36px;
  font-weight: 600;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.2s var(--ease-out);
}
.field:focus { box-shadow: 0 0 0 6px rgba(143, 208, 255, 0.8); }
.field.is-invalid { box-shadow: 0 0 0 6px rgba(255, 120, 140, 0.9); }
.field--se  { top: 489px; }
.field--hq  { top: 624px; }
.field--doc { top: 759px; }

.img-btn--clear  { left: 706px;  top: 944px; }
.img-btn--submit { left: 1060px; top: 944px; }
.start__status   { top: 1068px; }

/* ==========================================================================
   PLEDGE (slides 5 & 6)
   ========================================================================== */
.pledge {
  position: absolute;
  inset: 0;
  pointer-events: none;
  --kx: 854.5px;            /* knob centre x (artboard px) — set by Pledge */
}
.pledge__fx {               /* clip box = inner rounded panel of the artwork */
  position: absolute;
  left: 186px;
  top: 776px;
  width: 1676px;
  height: 428px;
  border-radius: 48px;
  overflow: hidden;
}
.pledge__cells { position: absolute; inset: 0; }

.cell {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
}
.cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.cell__red { opacity: 0; transform: scale(0.6); }
.cell.is-red .cell__red   { opacity: 1; transform: none; }
.cell.is-red .cell__white { opacity: 0; transform: scale(1.25); }
.cell--fixed .cell__red   { opacity: 1; transform: none; }

.pledge__track {
  position: absolute;
  left: 600px;
  top: 1078px;
  width: 856px;
  height: 74px;
}
.pledge__track img { position: absolute; inset: 0; }
.pledge__track-on {
  /* reveal width = knob centre − track left */
  clip-path: inset(0 calc(856px - (var(--kx) - 600px)) 0 0 round 37px);
}

.pledge__zone {
  position: absolute;
  left: 540px;
  top: 1000px;
  width: 980px;
  height: 470px;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}
.pledge.is-dragging .pledge__zone { cursor: grabbing; }
.pledge.is-locked .pledge__zone { pointer-events: none; }

.pledge__knob {
  position: absolute;
  top: 1052px;
  left: calc(var(--kx) - 78.5px);
  width: 157px;
  height: 157px;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}
.pledge__knob::after {        /* larger hit area for fingers */
  content: "";
  position: absolute;
  inset: -30px;
  border-radius: 50%;
}
.pledge__knob img { width: 157px; height: 157px; }
.pledge.is-dragging .pledge__knob { cursor: grabbing; }
.pledge.is-locked .pledge__knob { pointer-events: none; }

.pledge__hand {
  position: absolute;
  top: 1027px;
  left: calc(var(--kx) - 163.5px);
  width: 442px;
  height: 509px;
}

.pledge__mark {
  position: absolute;
  left: 1480px;
  top: 885px;
  width: 370px;
  height: 205px;
  opacity: 0;
  transform: scale(0.6) rotate(-6deg);
}
.pledge.is-complete .pledge__mark { opacity: 1; transform: none; }

/* ==========================================================================
   FEEDBACK (slide 7)
   ========================================================================== */
.feedback__input {
  position: absolute;
  left: 265px;
  top: 462px;
  width: 1518px;
  height: 624px;
  padding: 40px 48px;
  border: 2px solid var(--ink);
  border-radius: 44px;
  background: #fff;
  color: var(--ink);
  font-size: 40px;
  line-height: 1.45;
  resize: none;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
  transition: box-shadow 0.2s var(--ease-out);
}
.feedback__input:focus { box-shadow: 0 0 0 8px rgba(143, 208, 255, 0.75), 0 30px 60px -30px rgba(0, 0, 0, 0.6); }
.feedback__submit { left: 862px; top: 1180px; }
.feedback__status { top: 1296px; }

/* ==========================================================================
   REFERENCE (slide 8)
   ========================================================================== */
.ref__close {
  left: 1694px;
  top: 393px;
  border-radius: 50%;
}
.ref__close img { width: 76px; height: 76px; }
.ref__close::after { content: ""; position: absolute; inset: -22px; border-radius: 50%; }
