/* GAME: the app's styles. These rules come from the UI catalog (references/ui-spec.md) and stay whatever the look. */

/* 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 { -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: an upright phone sees only this. UI-14. */
[data-rotate] { display: none; }
@media (orientation: portrait) and (max-width: 600px) {
  [data-rotate] { display: grid; place-items: center; position: fixed; inset: 0; z-index: 90; }
}

/* The board is clipped to its own frame; the camera moves [data-board] with a transform. UI-26, UI-89. */
[data-board-frame] { position: relative; overflow: clip; }
[data-board] { transform-origin: 0 0; will-change: transform; }

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

/* Type: Sorts Mill Goudy, the free Goudy Old Style revival (DESIGN.md, Type). Self-hosted, OFL. UI-53. */
@font-face { font-family: 'Sorts Mill Goudy'; src: url('../assets/fonts/sorts-mill-goudy-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sorts Mill Goudy'; src: url('../assets/fonts/sorts-mill-goudy-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }

/* Colours sampled from the components (DESIGN.md, Colour). Sizes from UI-PLAN.md, Phone layout. */
:root {
  --paper: #efe8da;
  --ink: #1f1a17;
  --ink-soft: rgba(31, 26, 23, 0.72);
  --gold: #d9a52c;
  --gold-deep: #a9731a;
  --site-frame: #f2e08a;
  --imperial: #6b3fa0;
  --bandit: #8a7a66;
  --shadow: 0 2px 4px rgba(31, 26, 23, 0.35), 0 8px 18px rgba(31, 26, 23, 0.25);
  --shadow-soft: 0 1px 2px rgba(31, 26, 23, 0.3), 0 4px 10px rgba(31, 26, 23, 0.18);
  --top: 56px;
  --prompt: 48px;
  --rail: 196px;
  --gap: 10px;
  font-family: 'Sorts Mill Goudy', 'Goudy Bookletter 1911', 'Goudy Old Style', Georgia, serif;
  color: var(--ink);
}
@media (max-height: 520px) {
  :root { --top: 44px; --prompt: 34px; --rail: 92px; --gap: 6px; }
}
* { box-sizing: border-box; }
html, body { background: var(--paper); }
body { font-size: 16px; line-height: 1.2; }
button { font: inherit; color: inherit; cursor: pointer; }

/* The stage: top strip, the map frame, the prompt row, the rail. Sheets and overlays sit over the frame. */
[data-stage] {
  display: grid;
  grid-template-rows: var(--top) minmax(0, 1fr) var(--prompt) var(--rail);
  grid-template-areas: 'top' 'frame' 'prompt' 'rail';
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
#top { grid-area: top; min-width: 0; }
#frame { grid-area: frame; min-height: 0; }
#light { position: absolute; inset: 0; pointer-events: none; }
#light > * { pointer-events: auto; }
#prompt-row { grid-area: prompt; min-width: 0; }
#rail { grid-area: rail; min-width: 0; }
#sheets, #overlay { grid-area: frame; position: relative; pointer-events: none; z-index: 10; }
#sheets > *, #overlay > * { pointer-events: auto; }
#overlay { z-index: 20; }

/* While a sequence plays, the decision's controls wait (UI-29, ui-pwa.md Events to motion). */
[data-stage][data-busy] [data-key], [data-stage][data-busy] [data-stamp] { pointer-events: none; }

[data-rotate] { background: var(--paper); font-size: 24px; font-style: italic; }
#update { position: fixed; left: 50%; bottom: calc(var(--rail) + 8px); transform: translateX(-50%); z-index: 95; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 8px; padding: 6px 12px; box-shadow: var(--shadow-soft); }
