/* ==========================================================================
   Snapra design system — "Press night"
   --------------------------------------------------------------------------
   The reference is the event itself: the step-and-repeat wall, the press pass
   on a lanyard, the tabloid front page the morning after, the red light on a
   camera. Black, white, and one red. Huge condensed capitals. Hard edges.

   Rules that keep it from looking generated:
     - no gradients, no glows, no blur, no glass, no grain, no drop shadows
     - no serifs, no italics-for-emphasis; emphasis is size, weight or red
     - square corners; 2px lines; thick black bars as dividers
     - red is for the one thing that matters on a screen (the action, "live")
     - motion is a strobe or a hard cut, not a float
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin-standard-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  /* --- ink ------------------------------------------------------------------ */
  --black: #0b0b0b;
  --white: #ffffff;
  --paper: #f2f0eb;          /* newsprint: the light surfaces              */
  --red:   #ff2e1f;          /* the flash / the REC light / the action     */
  --red-2: #d91c0f;          /* pressed                                     */

  /* Greys, sparingly. */
  --g-900: #151515;
  --g-800: #1f1f1f;
  --g-700: #2c2c2c;
  --g-500: #6d6d6d;
  --g-300: #b8b8b8;
  --g-200: #d9d7d2;

  --ok:   #1fbf5a;
  --warn: #ffb000;
  --bad:  var(--red);

  /* --- themeable roles (dark is the default: guest, Studio, TV) -------------- */
  --bg:     var(--black);
  --panel:  var(--g-900);
  --panel-2:var(--g-800);
  --fg:     var(--white);
  --fg-2:   #cfcfcf;
  --fg-3:   #8a8a8a;
  --line:   #333333;
  --line-2: #555555;
  --rule:   var(--white);    /* the thick divider bar */
  --accent: var(--red);
  --on-accent: var(--white);

  /* --- type ------------------------------------------------------------------ */
  --font: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --hed-stretch: 62%;         /* the tabloid condensed                      */
  --t-mega: clamp(64px, 13vw, 200px);
  --t-h1: clamp(46px, 8vw, 112px);
  --t-h2: clamp(34px, 5vw, 64px);
  --t-h3: clamp(22px, 2.6vw, 30px);
  --t-lede: clamp(17px, 1.5vw, 20px);
  --t-body: 16px;
  --t-small: 14px;
  --t-label: 12px;

  --stroke: 2px;
  --r: 0px;                   /* corners are square. Always. */

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur-1: 90ms;
  --dur-2: 180ms;
  --dur-3: 320ms;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* --- v3 aliases, so pages keep rendering while they migrate. Do not use. --- */
  --ink-0: var(--black); --ink-1: var(--bg); --ink-2: var(--panel); --ink-3: var(--panel-2); --ink-4: var(--g-700);
  --ivory: var(--fg); --ivory-2: var(--fg-2); --ivory-3: var(--fg-3); --ivory-4: var(--g-500);
  --gold: var(--red); --gold-2: var(--red); --gold-3: var(--red-2); --gold-ink: var(--white);
  --gold-glow: transparent; --gold-wash: rgba(255,46,31,0.12); --flash: var(--white);
  --live: var(--red); --live-wash: rgba(255,46,31,0.14);
  --ok-wash: rgba(31,191,90,0.14); --warn-wash: rgba(255,176,0,0.14); --bad-wash: rgba(255,46,31,0.14);
  --line-3: var(--line-2);
  --serif: var(--font); --sans: var(--font); --mono: var(--font);
  --r-1: 0px; --r-2: 0px; --r-3: 0px; --r-4: 0px; --r-pill: 0px;
  --shadow-1: none; --shadow-2: none; --shadow-3: none;
  --ease-out: var(--ease); --ease-in-out: var(--ease); --spring: var(--ease); --dur-4: 420ms;
}

/* The light theme: marketing site, print, anything that is "paper". */
.theme-paper {
  --bg: var(--paper);
  --panel: var(--white);
  --panel-2: #e8e5de;
  --fg: var(--black);
  --fg-2: #333333;
  --fg-3: #6b6b6b;
  --line: #cfccc5;
  --line-2: var(--black);
  --rule: var(--black);
  color-scheme: light;
}
.theme-dark { color-scheme: dark; }
:root { color-scheme: dark; }

/* --- reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--t-body)/1.5 var(--font);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; border-radius: 0; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--red); color: var(--white); }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* --- type -------------------------------------------------------------------- */
/* The headline: tabloid condensed capitals. Tight, heavy, no nonsense. */
.hed, .display, .h1, .h2 {
  font-family: var(--font);
  font-stretch: var(--hed-stretch);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  line-height: 0.86;
}
.mega, .display { font-size: var(--t-mega); line-height: 0.82; }
.h1 { font-size: var(--t-h1); }
.h2 { font-size: var(--t-h2); line-height: 0.9; }
.h3 { font: 800 var(--t-h3)/1.05 var(--font); font-stretch: 75%; text-transform: uppercase; }
.lede { font-size: var(--t-lede); line-height: 1.45; color: var(--fg-2); font-weight: 450; }
.small { font-size: var(--t-small); }
.muted { color: var(--fg-3); }
.dim { color: var(--fg-2); }
.red, .gold { color: var(--red); }
.num { font-stretch: 62%; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.tnum, .mono { font-variant-numeric: tabular-nums; }
/* Legacy class names from v3 resolve to plain type; migrate away from them. */
.serif { font-family: var(--font); }
.italic { font-style: normal; }
em.accent, .accent-em { font-style: normal; color: var(--red); }

/* The label: bold condensed caps behind a red block. Not a letter-spaced mono. */
.kicker, .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font: 800 var(--t-label)/1 var(--font);
  font-stretch: 85%;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg);
}
.kicker::before, .eyebrow::before {
  content: ""; width: 9px; height: 9px; background: var(--red); flex: none;
}
.kicker.plain::before, .eyebrow.plain::before { display: none; }

/* Thick bars: the tabloid's dividers. */
.bar { height: 8px; background: var(--rule); border: 0; margin: 0; }
.bar.thin { height: var(--stroke); }
.bar.red { background: var(--red); }
.rule { height: var(--stroke); background: var(--rule); border: 0; margin: 0; }

/* --- wordmark ------------------------------------------------------------- */
/* SNAPRA in condensed black caps, then a red square: the camera's flash lamp. */
.wordmark {
  display: inline-flex; align-items: center; gap: 0.12em;
  font: 900 26px/1 var(--font);
  font-stretch: 62%;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
}
.wordmark i { display: block; width: 0.42em; height: 0.42em; background: var(--red); transform: translateY(-0.22em); }

/* --- buttons ----------------------------------------------------------------- */
.btn {
  --h: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding: 0 20px;
  border: var(--stroke) solid var(--fg);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: 800 15px/1 var(--font);
  font-stretch: 80%;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1), transform var(--dur-1);
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn:active { transform: translate(1px, 1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn[disabled], .btn.is-disabled { opacity: 0.35; pointer-events: none; }

.btn.primary, .btn.red { background: var(--red); border-color: var(--red); color: var(--white); }
.btn.primary:hover, .btn.red:hover { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.btn.light, .btn.solid { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.btn.light:hover, .btn.solid:hover { background: var(--red); border-color: var(--red); color: var(--white); }
.btn.ghost { background: transparent; }
.btn.quiet { border-color: transparent; color: var(--fg-2); padding: 0 12px; }
.btn.quiet:hover { background: var(--panel-2); color: var(--fg); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red); color: var(--white); }
.btn.live { background: var(--red); border-color: var(--red); color: var(--white); }

.btn.sm { --h: 36px; padding: 0 14px; font-size: 13px; }
.btn.lg { --h: 58px; padding: 0 28px; font-size: 18px; }
.btn.xl { --h: 70px; padding: 0 34px; font-size: 22px; font-stretch: 70%; }
.btn.block { display: flex; width: 100%; }
.btn.icon { width: var(--h); height: var(--h); padding: 0; }

/* --- fields ------------------------------------------------------------------- */
.field { display: grid; gap: 6px; }
.field > span, .label {
  font: 800 12px/1.2 var(--font); font-stretch: 85%;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg);
}
.input, .select, .textarea {
  width: 100%; height: 50px; padding: 0 14px;
  background: var(--panel);
  border: var(--stroke) solid var(--line-2);
  border-radius: 0;
  color: var(--fg);
  font: 500 16px/1.2 var(--font);
  -webkit-appearance: none; appearance: none;
  transition: border-color var(--dur-1);
}
.textarea { height: auto; min-height: 120px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--fg-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--red); }
.select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff2e1f' stroke-width='3' stroke-linecap='square'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.hint { font-size: 13px; color: var(--fg-3); }

.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border: var(--stroke) solid var(--fg); background: transparent; }
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  background: var(--fg); transition: transform var(--dur-2) var(--ease);
}
.switch input:checked + i { background: var(--red); border-color: var(--red); }
.switch input:checked + i::after { transform: translateX(20px); background: var(--white); }

/* --- surfaces -------------------------------------------------------------------- */
.card, .panel {
  background: var(--panel);
  border: var(--stroke) solid var(--line-2);
  border-radius: 0;
}
.card.pad, .panel.pad { padding: 22px; }
.card.glass { background: var(--panel); }         /* v3 alias: glass is gone */
.boxed { border: var(--stroke) solid var(--fg); }

/* The press pass: a badge with a punched slot. For "you" moments. */
.pass {
  position: relative; background: var(--white); color: var(--black);
  border: var(--stroke) solid var(--black); padding: 26px 18px 16px;
}
.pass::before {
  content: ""; position: absolute; top: 9px; left: 50%; width: 40px; height: 8px;
  transform: translateX(-50%); background: var(--bg); border: var(--stroke) solid var(--black);
}
.pass .pass-tag {
  display: block; background: var(--red); color: var(--white); text-align: center;
  font: 900 20px/1 var(--font); font-stretch: 62%; text-transform: uppercase; padding: 6px 0; margin: 0 -18px 12px;
}

/* Step-and-repeat: the media-wall pattern. Set --repeat to a data-URI SVG tile
   (repeatTile() in ds.js makes one from any text), or use the default. */
.repeat {
  background-color: var(--bg);
  background-image: var(--repeat, none);
  background-size: var(--repeat-size, 220px 90px);
}

/* --- chips, badges, dots ----------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: var(--stroke) solid var(--fg); border-radius: 0;
  background: transparent; color: var(--fg);
  font: 800 13px/1 var(--font); font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.02em;
  white-space: nowrap;
}
.chip:hover { background: var(--panel-2); }
.chip[aria-pressed="true"], .chip.on { background: var(--fg); color: var(--bg); }
.chip .n { font-weight: 600; opacity: 0.7; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 7px;
  background: var(--fg); color: var(--bg);
  font: 900 11px/1 var(--font); font-stretch: 75%; letter-spacing: 0.04em; text-transform: uppercase;
}
.badge.red, .badge.gold, .badge.live { background: var(--red); color: var(--white); }
.badge.ok { background: var(--ok); color: var(--black); }
.badge.warn { background: var(--warn); color: var(--black); }
.badge.bad { background: var(--red); color: var(--white); }
.badge.outline { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 var(--stroke) var(--fg); }

/* Status lamps are squares, like the indicator on a camera. */
.dot { width: 9px; height: 9px; background: var(--g-500); flex: none; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--red); }
.dot.warn { background: var(--warn); }
.dot.live { background: var(--red); animation: ds-rec 1s steps(2, jump-none) infinite; }
@keyframes ds-rec { 50% { opacity: 0.15; } }

.kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px;
  font: 800 11px/1 var(--font); border: var(--stroke) solid var(--fg); color: var(--fg);
}

/* --- toast ----------------------------------------------------------------------- */
.ds-toasts {
  position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%);
  display: grid; gap: 6px; z-index: 1000; pointer-events: none; width: min(94vw, 440px);
}
.ds-toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--white); color: var(--black);
  border: var(--stroke) solid var(--black);
  font: 700 15px/1.3 var(--font);
  animation: ds-cut-in var(--dur-2) var(--ease) both;
  pointer-events: auto;
}
.ds-toast svg { width: 18px; height: 18px; flex: none; color: var(--red); }
.ds-toast.bad { background: var(--red); color: var(--white); border-color: var(--red); }
.ds-toast.bad svg { color: var(--white); }
.ds-toast.ok svg { color: var(--ok); }
.ds-toast.out { animation: ds-cut-out var(--dur-1) linear both; }
@keyframes ds-cut-in { from { transform: translateY(10px); opacity: 0; } }
@keyframes ds-cut-out { to { opacity: 0; } }

/* --- loading ---------------------------------------------------------------------- */
.skeleton { background: var(--panel-2); animation: ds-blink 1.2s steps(2, jump-none) infinite; }
@keyframes ds-blink { 50% { opacity: 0.55; } }
.spinner {
  width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--red);
  animation: ds-spin 0.7s linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* --- the flash: a hard strobe, the way a speedlight actually fires ----------- */
.ds-flash { position: fixed; inset: 0; pointer-events: none; z-index: 2000; background: var(--white); opacity: 0; }
.ds-flash.fire { animation: ds-strobe 260ms linear both; }
@keyframes ds-strobe { 0% { opacity: 1; } 18% { opacity: 1; } 100% { opacity: 0; } }

/* --- entrances: hard cuts, staggered with --i ------------------------------------ */
.rise, .fade, .cut { animation: ds-cut-in var(--dur-3) var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.slam { animation: ds-slam 360ms cubic-bezier(0.3, 1.5, 0.5, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes ds-slam { from { transform: scale(1.25); opacity: 0; } }

/* --- dialogs ---------------------------------------------------------------------- */
dialog.sheet, dialog.modal {
  padding: 0; color: var(--fg); background: var(--bg);
  border: var(--stroke) solid var(--fg); border-radius: 0; box-shadow: none;
}
dialog.sheet { margin: auto auto 0; width: min(100%, 560px); max-height: 88vh; border-bottom: 0; }
dialog.modal { width: min(94vw, 560px); }
dialog[open] { animation: ds-cut-in var(--dur-2) var(--ease) both; }
dialog::backdrop { background: rgba(0, 0, 0, 0.78); }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-bottom: var(--stroke) solid var(--fg); } }

/* --- misc --------------------------------------------------------------------------- */
.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;
}
.no-select { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.icon { width: 18px; height: 18px; flex: none; }
.grain::after { display: none; }                  /* v3 alias: grain is gone */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
  .ds-flash.fire { animation: none; }
}
