/* Townsfolk Tussle: the app's base styles. These rules come from the UI catalog (references/ui-spec.md) and stay
   whatever the look. The stage grid and each view's place are in css/layout.css; each view's own styles are in
   css/view-<view>.css. */

/* DESIGN.md's colours and type, sampled from the rulebook. A view reads these and never writes a hex of its own. */
:root {
  --paper: #f6f6ec; --card-face: #faf8ed; --callout: #e2dfcb; --callout-strong: #c5bfa0; --ink: #3c3933; --film-black: #202020;
  --grass: #a8b050; --grass-shade: #689848; --feature-green: #709858; --feature-green-text: #4f7a3c; --obstacle-brown: #885028;
  --order-bar-wood: #703830; --order-bar-wood-deep: #4f2f27; --peddler-teal: #388888; --peddler-teal-text: #2b6f73;
  --feat-red: #bc452e; --ruffian-plum: #803860; --unique-gold: #a87820; --coin-gold: #e4a72c; --starting-gray: #707068;
  /* Legal targets and ghosts: a bright cream that reads on grass, wood and teal alike (DESIGN.md, Colour). */
  --legal: #fff6c9;
  /* The stage's sizes, gaps and layers are in css/layout.css. */
  --font-heading: "Titan One", "Rockwell Extra Bold", Georgia, serif;
  --font-title: Fredoka, "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --font-body: Figtree, "Century Gothic", Futura, "Trebuchet MS", sans-serif;
}
body { background: var(--film-black); color: var(--paper); font-family: var(--font-body); }

/* 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; }
/* iPhone Safari on its side enlarges text it judges too small unless told not to (CO-48: the user's tray, card and
   result ran large and spilled at sizes that fit in every check). Every size here is the designed one. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
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; }

/* Landscape only (docs/UI-PLAN.md, Phone layout: Orientation: landscape): an upright phone sees only this. UI-14.
   Safari can't hold a page on its side, so the screen is the game's own: the main board under a vignette, the box's
   logo, and the words on a torn note with a phone turning on it (CO-47). */
[data-rotate] { display: none; color: var(--kit-ink, #1d1b18); text-align: center; }
@media (orientation: portrait) and (max-width: 600px) {
  [data-rotate] { display: grid; place-content: center; justify-items: center; gap: 28px; position: fixed; inset: 0; z-index: 90; box-sizing: border-box;
    padding: max(24px, env(safe-area-inset-top, 0px)) 24px max(24px, env(safe-area-inset-bottom, 0px));
    background: radial-gradient(ellipse at 50% 45%, #0000 25%, #000000c7 100%), url(../assets/board/main-board.jpg) 50% 50% / cover no-repeat, var(--film-black); }
}
[data-rotate] > img { width: min(78vw, 340px); height: auto; filter: drop-shadow(0 10px 18px #00000073); }
[data-rotate] > p { display: flex; align-items: center; gap: 14px; margin: 0; padding: 16px 30px 15px; font: 400 21px/1.15 var(--font-heading);
  background: url(../assets/kit/note-4.png) center / 100% 100% no-repeat; filter: drop-shadow(0 6px 0 #00000040); }
[data-rotate] [data-rotate-phone] { flex: none; width: 22px; height: 36px; border: 3px solid currentColor; border-radius: 5px; box-sizing: border-box;
  box-shadow: inset 0 -5px 0 -2px currentColor; animation: rotate-hint 2.6s ease-in-out infinite; }
@keyframes rotate-hint { 0%, 20% { rotate: 0deg; } 50%, 80% { rotate: -90deg; } 100% { rotate: 0deg; } }
@media (prefers-reduced-motion: reduce) { [data-rotate] [data-rotate-phone] { animation: none; rotate: -90deg; } }

/* 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. */
[data-legal] { outline: 3px solid var(--legal, #f5c542); outline-offset: 2px; animation: legal-glow 1.6s ease-in-out infinite; }
@keyframes legal-glow { 50% { outline-color: transparent; } }
@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. */
