/* Twist'n'Shout — shared design tokens + zine kit.

   Direction: "cut-and-paste gig zine". Ink-black canvas with thin gutters,
   loud flat colour blocks, newsprint paper scraps, halftone photo cutouts with
   white sticker borders, typewriter label strips, ransom-note headlines.
   See DESIGN.md for how the pieces are meant to be used.

   Fonts — load in each page <head>:
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Anton&family=Bricolage+Grotesque:opsz,wdth,wght@12..96,75..100,400..800&family=DM+Serif+Display&family=Special+Elite&display=swap" rel="stylesheet">
*/

:root {
  /* --- Canvas + paper ------------------------------------------------------ */
  --ink: #18181c;          /* canvas, gutters, text on light blocks */
  --ink-2: #24232a;        /* raised surface on ink (sheets, inputs on phone) */
  --ink-3: #36343e;        /* borders/hover on ink */
  --paper: #f6f3ec;        /* newsprint: label strips, scraps, spent cards */
  --paper-2: #e6e0d4;      /* shaded paper, paper borders */
  --paper-dim: #aba7a2;    /* secondary text on ink */
  --paper-mute: #7a7780;   /* tertiary text / disabled on ink */

  /* --- Colour blocks -------------------------------------------------------
     Sampled from a screen-printed poster series: chalky pastels (pink, lilac,
     sky, mint) against punchy violet, orange, raspberry red and a soft yellow. */
  --pink: #e3a6c6;
  --violet: #7050cd;
  --tangerine: #e46b33;
  --lemon: #f3e073;
  --mint: #a8ddcf;
  --red: #d04151;
  --lilac: #c3aef0;
  --sky: #8cc8e6;
  --peach: #e79557;
  --plum: #67549c;

  /* Category columns (board left to right). Text colour to use on each. */
  --cat-1: var(--pink);      --cat-1-ink: var(--ink);
  --cat-2: var(--violet);    --cat-2-ink: var(--paper);
  --cat-3: var(--tangerine); --cat-3-ink: var(--ink);
  --cat-4: var(--lemon);     --cat-4-ink: var(--ink);
  --cat-5: var(--sky);       --cat-5-ink: var(--ink);

  /* Roles */
  --accent: var(--lemon);    /* primary action, focus, points highlight */
  --ok: var(--mint);         /* connected / success */
  --bonus: var(--red);       /* bonuses, danger, live */

  /* --- Type ---------------------------------------------------------------- */
  --font-poster: 'Anton', 'Impact', 'Arial Narrow Bold', sans-serif;      /* points, headlines (caps) */
  --font-type: 'Special Elite', 'Courier New', ui-monospace, monospace;  /* typewriter label strips */
  --font-serif: 'DM Serif Display', Georgia, serif;                        /* ransom-note letters only */
  --font-ui: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif; /* body + UI */

  /* --- Shape ---------------------------------------------------------------
     Zine shapes are cut, not rounded: blocks have square corners; only
     interactive pills/buttons get a small radius. */
  --r-block: 2px;
  --r-ctl: 8px;
  --r-pill: 999px;

  /* Paper lying on paper: a hard offset shadow, like a scrap stuck down. */
  --stuck: 3px 4px 0 rgba(0, 0, 0, 0.35);
  --lifted: 6px 10px 0 rgba(0, 0, 0, 0.4);

  /* --- Textures --------------------------------------------------------------- */
  /* Newsprint grain (black noise, use as an overlay at low opacity). */
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  /* Halftone dot screen for colour blocks. */
  --dots: radial-gradient(rgba(0, 0, 0, 0.16) 1.1px, transparent 1.6px);
  --dots-size: 7px 7px;
  --dots-light: radial-gradient(rgba(255, 255, 255, 0.22) 1.1px, transparent 1.6px);

  /* --- Shapes (clip-path) ------------------------------------------------------ */
  --burst: polygon(50.0% 0.0%, 57.3% 17.8%, 71.7% 5.0%, 70.6% 24.2%, 89.1% 18.8%, 79.7% 35.7%, 98.7% 38.9%, 83.0% 50.0%, 98.7% 61.1%, 79.7% 64.3%, 89.1% 81.2%, 70.6% 75.8%, 71.7% 95.0%, 57.3% 82.2%, 50.0% 100.0%, 42.7% 82.2%, 28.3% 95.0%, 29.4% 75.8%, 10.9% 81.2%, 20.3% 64.3%, 1.3% 61.1%, 17.0% 50.0%, 1.3% 38.9%, 20.3% 35.7%, 10.9% 18.8%, 29.4% 24.2%, 28.3% 5.0%, 42.7% 17.8%);
  --torn: polygon(0.0% 0.0%, 2.5% 0.4%, 5.0% 2.4%, 7.5% 1.5%, 10.0% 1.7%, 12.5% 0.7%, 15.0% 0.2%, 17.5% 2.2%, 20.0% 2.2%, 22.5% 3.0%, 25.0% 1.2%, 27.5% 1.7%, 30.0% 2.7%, 32.5% 0.1%, 35.0% 0.2%, 37.5% 1.7%, 40.0% 2.1%, 42.5% 0.0%, 45.0% 1.2%, 47.5% 0.2%, 50.0% 1.3%, 52.5% 2.2%, 55.0% 1.9%, 57.5% 3.0%, 60.0% 2.7%, 62.5% 1.7%, 65.0% 0.3%, 67.5% 2.1%, 70.0% 1.3%, 72.5% 2.2%, 75.0% 2.9%, 77.5% 2.4%, 80.0% 0.8%, 82.5% 0.2%, 85.0% 2.4%, 87.5% 1.1%, 90.0% 2.0%, 92.5% 2.4%, 95.0% 3.2%, 97.5% 1.2%, 100.0% 0.8%, 100.0% 96.9%, 97.5% 97.7%, 95.0% 97.6%, 92.5% 97.9%, 90.0% 99.8%, 87.5% 98.0%, 85.0% 97.2%, 82.5% 99.1%, 80.0% 98.6%, 77.5% 97.5%, 75.0% 98.5%, 72.5% 99.2%, 70.0% 99.1%, 67.5% 98.9%, 65.0% 99.5%, 62.5% 98.4%, 60.0% 97.1%, 57.5% 97.1%, 55.0% 99.8%, 52.5% 97.1%, 50.0% 98.4%, 47.5% 98.3%, 45.0% 99.0%, 42.5% 96.8%, 40.0% 98.4%, 37.5% 99.1%, 35.0% 99.7%, 32.5% 97.0%, 30.0% 99.8%, 27.5% 98.4%, 25.0% 98.8%, 22.5% 99.1%, 20.0% 97.1%, 17.5% 98.3%, 15.0% 98.5%, 12.5% 97.0%, 10.0% 99.8%, 7.5% 97.6%, 5.0% 97.5%, 2.5% 97.4%, 0.0% 99.6%);
  --torn-bottom: polygon(0% 0%, 100% 0%, 100.0% 99.9%, 97.5% 97.2%, 95.0% 96.5%, 92.5% 97.5%, 90.0% 97.1%, 87.5% 97.1%, 85.0% 96.0%, 82.5% 96.4%, 80.0% 99.1%, 77.5% 98.8%, 75.0% 98.6%, 72.5% 97.9%, 70.0% 97.6%, 67.5% 96.6%, 65.0% 98.4%, 62.5% 96.6%, 60.0% 98.9%, 57.5% 98.3%, 55.0% 97.9%, 52.5% 98.1%, 50.0% 98.9%, 47.5% 99.3%, 45.0% 99.4%, 42.5% 97.7%, 40.0% 96.8%, 37.5% 99.9%, 35.0% 97.9%, 32.5% 98.0%, 30.0% 96.2%, 27.5% 97.0%, 25.0% 97.8%, 22.5% 96.4%, 20.0% 97.5%, 17.5% 96.6%, 15.0% 99.4%, 12.5% 99.1%, 10.0% 97.1%, 7.5% 99.5%, 5.0% 99.6%, 2.5% 98.9%, 0.0% 100.0%);

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-slam: cubic-bezier(0.2, 1.6, 0.4, 1); /* stickers slapped down */

  /* --- Legacy names (pre-zine CSS still refers to these; remove once migrated) --- */
  --lacquer: var(--ink);
  --lacquer-deep: #0e0e11;
  --panel: var(--ink-2);
  --panel-hi: var(--ink-3);
  --amber: var(--lemon);
  --amber-dim: #b5a43c;
  --label: var(--paper);
  --label-dim: var(--paper-dim);
  --mute: var(--paper-mute);
  --teal: var(--mint);
  --signal: var(--red);
  --font-display: var(--font-poster);
  --r-tile: var(--r-block);
  --r-sheet: 6px;
  --edge: var(--stuck);
  --grooves: var(--dots);

  color-scheme: dark;
}

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

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }

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

/* ============================================================================
   Zine kit — small, composable classes. Pages add their own layout on top.
   ============================================================================ */

/* Newsprint grain over anything (needs position: relative/absolute on the host). */
.grain { position: relative; isolation: isolate; }
.grain::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-image: var(--grain);
  opacity: 0.16;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;
}

/* Halftone dot screen on a colour block. */
.dotted { background-image: var(--dots); background-size: var(--dots-size); }
.dotted-light { background-image: var(--dots-light); background-size: var(--dots-size); }

/* A scrap of newsprint. */
.paper {
  background-color: var(--paper);
  color: var(--ink);
}

/* Typewriter label strip, like text typed on a slip and glued down.
   Use on inline elements; wraps line by line. */
.typestrip {
  display: inline;
  font-family: var(--font-type);
  font-weight: 400;
  background: var(--paper);
  color: var(--ink);
  padding: 0.12em 0.4em;
  line-height: 1.75;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.typestrip.is-ink { background: var(--ink); color: var(--paper); }
.typestrip.is-lemon { background: var(--lemon); }

/* Masking-tape strip; put on a positioned parent with .taped. */
.taped { position: relative; }
.taped::before {
  content: '';
  position: absolute;
  top: -0.6em;
  left: 50%;
  width: 4.2em;
  height: 1.2em;
  transform: translateX(-50%) rotate(-4deg);
  background: rgba(246, 243, 236, 0.72);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  clip-path: polygon(0 8%, 6% 0, 12% 10%, 20% 2%, 30% 9%, 42% 0, 55% 8%, 68% 1%, 80% 9%, 92% 2%, 100% 10%, 100% 92%, 93% 100%, 82% 90%, 70% 99%, 58% 91%, 45% 100%, 32% 92%, 20% 100%, 9% 91%, 0 100%);
  z-index: 2;
}

/* Torn-paper edges (clip-path). */
.torn { clip-path: var(--torn); }
.torn-bottom { clip-path: var(--torn-bottom); }

/* Starburst shape. Give it a background colour; content is centred. */
.burst {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  clip-path: var(--burst);
  text-align: center;
}

/* Photo cutout with a white paper border (works on transparent PNGs and SVGs). */
.sticker {
  filter:
    drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff)
    drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff)
    drop-shadow(3px 5px 0 rgba(0, 0, 0, 0.32));
}
/* Photo stickers (assets/stickers/*.png) have their white cut-out border baked
   in, so they only get the stuck-down shadow, not a second outline. */
.zs-photo.sticker { filter: drop-shadow(3px 5px 0 rgba(0, 0, 0, 0.32)); }
.sticker.is-thick {
  filter:
    drop-shadow(4px 0 0 #fff) drop-shadow(-4px 0 0 #fff)
    drop-shadow(0 4px 0 #fff) drop-shadow(0 -4px 0 #fff)
    drop-shadow(5px 8px 0 rgba(0, 0, 0, 0.32));
}

/* Ransom-note headline built by zine.js ransom(): each letter is a cut-out. */
.ransom { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.06em; line-height: 1; }
.ransom-word { display: inline-flex; gap: 0.04em; margin-right: 0.28em; }
.ransom-word:last-child { margin-right: 0; }
.ransom-ch {
  display: inline-grid;
  place-items: center;
  min-width: 0.72em;
  padding: 0.06em 0.12em 0.02em;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- generated: flex gap fallback for old TV browsers (no-flexgap set by legacy-polyfills.js) --- */
.no-flexgap .ransom > * + * { margin-left: 0.06em; }
.no-flexgap .ransom > * { margin-bottom: 0.06em; }
.no-flexgap .ransom-word > * + * { margin-left: 0.04em; }
