/* GAME: the app's styles. These rules come from the UI catalog (references/ui-spec.md) and stay whatever the look.
   The shared tokens are here; the stage grid and each view's place are in layout.css (docs/ui/layout-lead.md). */

/* The fonts that stand in for the printed faces (SOURCES.md): Bowlby One for El Grande, Nunito Sans for Mingler,
   Jost for Brandon Grotesque, Fredoka for Riffic, Caveat Brush for CC Sign Language. */
@font-face { font-family: 'Bowlby One'; font-weight: 400; font-display: swap; src: url('../assets/fonts/BowlbyOne-400.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 400; font-display: swap; src: url('../assets/fonts/NunitoSans-400.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 400; font-style: italic; font-display: swap; src: url('../assets/fonts/NunitoSans-400i.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 700; font-display: swap; src: url('../assets/fonts/NunitoSans-700.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 700; font-style: italic; font-display: swap; src: url('../assets/fonts/NunitoSans-700i.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 800; font-display: swap; src: url('../assets/fonts/NunitoSans-800.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-weight: 800; font-display: swap; src: url('../assets/fonts/Jost-800.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-display: swap; src: url('../assets/fonts/Fredoka-700.woff2') format('woff2'); }
@font-face { font-family: 'Caveat Brush'; font-weight: 400; font-display: swap; src: url('../assets/fonts/CaveatBrush-400.woff2') format('woff2'); }

/* DESIGN.md's colours and type, one name each. Views use these and never a second copy of a value. */
:root {
  --paper: #f4f4ec; --ink: #343434; --head: #444444; --orange: #d46434; --outline: #2c2c2c; --cream: #ece4d4;
  --frame: #4c642c; --grass: #bcbc3c; --fboard: #2c1c14; --tray: #b44424; --itinerary: #bc4c24; --res-tray: #54545c;
  --band: #accccc; --tan: #dcdccc; --sage: #bcccac; --lav: #c4b4cc; --step: #348cac; --solo: #744494;
  --hh: #3c7c4c; --instant: #e45424; --cond: #1c8ca4; --gold: #ecb434; --table: #2e2e30;
  /* The table everything lies on: the demo mod's own table, a charcoal felt (source-tts/3592126512, TableURL;
     app/assets/table/source.json). User callout, 2026-11-27: "There's no background, everything is white". UI-112. */
  /* the table: the Founder Board's wood brown, smooth, lighter under the play and darker to the edges. It replaced a
     speckled felt photo (user, 2026-11-28: "the random raised textures etc. are a bit weird"; picked C, wood brown) */
  --felt: radial-gradient(ellipse at 50% 45%, #4a3124 0%, #34221a 60%, #22150f 100%) #34221a;
  /* What lies on the felt casts a shadow on it: a board a broad one, a card a tighter one with its cardboard edge.
     User callout, 2026-11-27: "there's no depth to things". UI-45. */
  --lift-board: 0 2px 0 #0009, 0 6px 10px #0007, 0 18px 36px #0008;
  --lift-card: 0 1px 0 #000c, 0 3px 6px #0007, 0 8px 16px #0005;
  --display: 'Bowlby One', Impact, sans-serif;
  --body: 'Nunito Sans', 'Trebuchet MS', sans-serif;
  --badge: 'Jost', Futura, sans-serif;
  --vp: 'Fredoka', 'Arial Black', sans-serif;
  --script: 'Caveat Brush', cursive;
  /* a torn paper strip, as on the rulebook's callouts */
  --torn: polygon(0 8%, 3% 0, 22% 4%, 48% 0, 71% 5%, 97% 0, 100% 10%, 99% 52%, 100% 90%, 96% 100%, 70% 95%, 44% 100%, 20% 96%, 2% 100%, 0 88%, 1% 46%);
  /* the smallest tap and the smallest printed name on a phone (UI-18, UI-113) */
  --tap: 44px; --name-min: 11px;
}

/* Netlify's hosting badge, added to every page on the free plan, stays out of the game. sw.js also answers its
   script with an empty one. UI-12. */
#nl-badge-frame, #nl-hud-frame { display: none !important; }

/* A native app's feel: no text selection or iOS callouts on a press, no page scroll. UI-16, UI-24. */
html, body { height: 100%; margin: 0; overflow: clip; overscroll-behavior: none; }
body { background: var(--felt); color: var(--ink); font: 500 15px/1.2 var(--body); }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
img, svg, [data-key], [data-previewable] { -webkit-touch-callout: none; -webkit-user-drag: none; }
[data-stage] { position: fixed; inset: 0; overflow: clip; touch-action: none; }
[data-rulebook], [data-journal], [data-credits] { -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }

/* Phones play upright (docs/UI-PLAN.md, Phone layout): a phone on its side sees only this. Tablets and desktops,
   which are taller than 500 px in landscape, never do. UI-14. The art (a Building card back with a Helping Hand
   turning) is the kit's; until it lands the screen is the District Board's frame with the words. */
[data-rotate] { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  [data-rotate] { display: flex; align-items: center; justify-content: center; gap: 28px; position: fixed; inset: 0; z-index: 1000;   /* over every layer, the tutorial's notes included */
    background: var(--felt); color: var(--paper); font: 400 24px/1.1 var(--display); text-transform: uppercase; text-align: left;
    padding: 24px; text-shadow: 2px 2px 0 #0008; }
  [data-rotate] p { margin: 0; max-width: 9em; }
  /* a Building card turning from its side to upright, as the phone should */
  [data-rotate] .rot-card { flex: none; width: 96px; aspect-ratio: 1; border-radius: 6%; overflow: hidden; box-shadow: var(--lift-card);
    animation: rot-turn 2.4s ease-in-out infinite; }
  [data-rotate] .rot-card img { display: block; width: 100%; height: 100%; }
  @keyframes rot-turn { 0%, 25% { transform: rotate(-90deg); } 55%, 100% { transform: rotate(0deg); } }
  @media (prefers-reduced-motion: reduce) { [data-rotate] .rot-card { animation: none; } }
}

/* The board is clipped to its own frame; the camera moves [data-board] with a transform. UI-26, UI-89.
   No standing will-change: it keeps the whole board one composited layer at the device's pixel ratio, which for a
   board many screens wide is more memory than an iPhone gives a tab (Oath gap 121: about 1.5 GB of layers, Safari
   killed the page; 47 MB without it). A motion may set will-change for its own duration only. UI-135. */
[data-board-frame] { position: relative; overflow: clip; }
[data-board] { transform-origin: 0 0; }

/* A legal target's glow inside the board: its outline's colour pulses, paint only. Never fade it by opacity or scale
   it there: a composited loop inside a board bigger than the screen keeps a board-size layer at the phone's pixel
   ratio for every lit target (Oath gap 121: 50 MB each, 300 MB on one region tab, iPhone Safari killed the page).
   For anything bigger than an outline, draw it in a screen-space overlay above the board instead. UI-125, UI-135.
   The pulse steps (three repaints a beat) rather than easing (a repaint every frame): the same glow for the eye, about a
   tenth of the raster, which on a phone is battery and dropped frames (polish pass, 2026-11-28). */
[data-legal] { outline: 3px solid var(--legal, #f5c542); outline-offset: 2px; animation: legal-glow .9s steps(3, jump-none) infinite alternate; }
@keyframes legal-glow { from { outline-color: var(--legal, #f5c542); } to { outline-color: #f5c54233; } }
@media (prefers-reduced-motion: reduce) { [data-legal] { animation: none; } }

/* Reduced motion keeps short fades: never cut durations to zero. anim.js reads the same setting. UI-59. */


/* An on/off control is a plain switch: a track with a knob that slides, the track orange when on, and the word On or
   Off beside it, so the state reads at a glance (user, 2026-11-28: "this is completely unclear what's selected and
   what's not; it's way to clever. Just a toggle for any of these on/off controls"). FF-13. Used by setup (Short
   game), the title and the menu (Sound, Music). The button around it carries role=switch and aria-checked. */
.ff-switch { display: inline-flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 4px; border: 0; background: none;
  color: inherit; cursor: pointer; font: inherit; }
.ff-switch .ff-label { font: 400 15px/1 var(--display); text-transform: uppercase; }
.ff-track { position: relative; flex: none; width: 56px; height: 32px; border-radius: 16px; background: #8a8378;
  box-shadow: inset 0 0 0 2px var(--outline); transition: background .15s ease-out; }
.ff-knob { position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--paper);
  box-shadow: 0 0 0 2px var(--outline), 0 2px 3px #0006; transition: transform .15s ease-out; }
.ff-switch[aria-checked="true"] .ff-track { background: var(--orange); }
.ff-switch[aria-checked="true"] .ff-knob { transform: translateX(24px); }
.ff-state { min-width: 2.2em; font: 800 14px/1 var(--body); text-transform: uppercase; }
.ff-switch:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { .ff-track, .ff-knob { transition: none; } }
