/* Raklem website: foundation. Tokens are the game's front end ("Command Deck", src/fe/css/tokens.css):
   Barlow Condensed for display (tracked caps only for eyebrows and input prompts), Barlow for text,
   one accent (hazard amber = the player / action), one threat colour (hive magenta). Slate + bone.
   Section styles live in their own files (hero.css, skirmish.css, ...). */

@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-style: normal; font-display: swap; src: url('../assets/fonts/Barlow-Condensed-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-style: normal; font-display: swap; src: url('../assets/fonts/Barlow-Condensed-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-style: normal; font-display: swap; src: url('../assets/fonts/Barlow-Condensed-700.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 800; font-style: normal; font-display: swap; src: url('../assets/fonts/Barlow-Condensed-800.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 400; font-style: normal; font-display: swap; src: url('../assets/fonts/Barlow-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-style: normal; font-display: swap; src: url('../assets/fonts/Barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-style: normal; font-display: swap; src: url('../assets/fonts/Barlow-600.woff2') format('woff2'); }

:root {
  color-scheme: dark;

  --bg-0: #050607;
  --bg-1: #0a0c0e;
  --bg-2: #101317;
  --bg-3: #171b20;

  --bone: #ece6d9;
  --bone-2: #c3bcae;
  --bone-3: #948d81;
  --bone-4: #5f5a53;
  --bone-5: #34322f;

  --line: rgba(236, 230, 217, 0.08);
  --line-2: rgba(236, 230, 217, 0.15);
  --line-3: rgba(236, 230, 217, 0.30);

  --amber: #ffb12e;
  --amber-hi: #ffd27a;
  --amber-2: #e8930f;
  --amber-ink: #160f03;
  --amber-wash: rgba(255, 177, 46, 0.10);
  --amber-glow: rgba(255, 177, 46, 0.38);

  --flesh: #ff3f86;
  --flesh-2: #d0215f;
  --flesh-3: #5c0f2c;
  --flesh-wash: rgba(255, 63, 134, 0.10);
  --flesh-glow: rgba(255, 63, 134, 0.40);

  /* player colours (src/fe/data/players.js) */
  --p1: #d9c23c;
  --p2: #4a90d9;

  /* the game's own cursors (src/ui/cursor.js, painted by tools/render.mjs) */
  --cur-arrow: url('../assets/cursors/arrow.png') 3 2, default;
  --cur-select: url('../assets/cursors/select.png') 3 2, pointer;
  --cur-aim: url('../assets/cursors/aim.png') 16 16, crosshair;

  --f-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-text: 'Barlow', 'Segoe UI', system-ui, sans-serif;

  --t-hero: clamp(3.5rem, 11vw, 9.5rem);
  --t-h1: clamp(2.6rem, 6.4vw, 5.5rem);
  --t-h2: clamp(1.9rem, 3.6vw, 3rem);
  --t-h3: clamp(1.3rem, 2vw, 1.6rem);
  --t-lead: clamp(1.05rem, 1.5vw, 1.3rem);
  --t-body: 1rem;
  --t-small: 0.875rem;
  --t-micro: 0.75rem;

  --track-eyebrow: 0.2em;
  --track-prompt: 0.1em;

  --gutter: clamp(16px, 4.5vw, 72px);
  --wrap: 1320px;
  --section-y: clamp(88px, 12vw, 168px);

  --r-1: 2px; --r-2: 4px; --r-3: 8px;
  --cut: 12px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-snap: cubic-bezier(0.2, 0.9, 0.1, 1);
  --d-fast: 140ms;
  --d-med: 320ms;
  --d-slow: 720ms;
  --stagger: 70ms;

  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
/* in-page jumps are main.js's (smooth unless motion is reduced) */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--nav-h); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--bone);
  font-family: var(--f-text);
  font-size: var(--t-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  overflow-x: hidden;
  overflow-x: clip;
}
/* the game's cursors: the field arrow, the green select arrow over anything that acts */
html { cursor: url('../assets/cursors/arrow.png') 3 2, default; cursor: image-set(url('../assets/cursors/arrow.png') 1x, url('../assets/cursors/arrow@2x.png') 2x) 3 2, default; }
a, button, [role='button'], label, select, summary, [data-click] { cursor: url('../assets/cursors/select.png') 3 2, pointer; cursor: image-set(url('../assets/cursors/select.png') 1x, url('../assets/cursors/select@2x.png') 2x) 3 2, pointer; }
a *, button * { cursor: inherit; }
.cur-aim, .cur-aim * { cursor: url('../assets/cursors/aim.png') 16 16, crosshair; cursor: image-set(url('../assets/cursors/aim.png') 1x, url('../assets/cursors/aim@2x.png') 2x) 16 16, crosshair; }

img, canvas, svg, video { display: block; max-width: 100%; }
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
::selection { background: var(--amber); color: var(--amber-ink); }

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

/* a section main.js jumped to holds focus like an anchor target does: no ring */
.hero:focus, .section:focus { outline: none; }

.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;
}
.skip-link {
  position: fixed; left: 12px; top: -100px; z-index: 1000;
  padding: 10px 16px; background: var(--amber); color: var(--amber-ink);
  font-family: var(--f-display); font-weight: 700; letter-spacing: var(--track-prompt); text-transform: uppercase;
}
.skip-link:focus { top: 12px; }

/* ---------- film grain over the whole page (never takes input). Still on purpose: moving it made the
   browser recomposite the whole window several times a second. ---------- */
.grain {
  position: fixed; inset: 0; z-index: 900; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.section { position: relative; padding: var(--section-y) 0; }
.section + .section { border-top: 1px solid var(--line); }

/* section head: eyebrow (index + label), display title, one short line */
.sec-head { display: grid; gap: 14px; margin-bottom: clamp(36px, 5vw, 64px); max-width: 760px; }
.sec-head--center { margin-left: auto; margin-right: auto; text-align: center; justify-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--f-display); font-weight: 600; font-size: var(--t-micro);
  letter-spacing: var(--track-eyebrow); text-transform: uppercase; color: var(--bone-3);
}
.eyebrow b { color: var(--amber); font-weight: 700; }
.eyebrow::after { content: ''; width: 48px; height: 1px; background: var(--line-3); }
.sec-head--center .eyebrow::before, .footer__cta .eyebrow::before { content: ''; width: 48px; height: 1px; background: var(--line-3); }
.title {
  font-family: var(--f-display); font-weight: 800; font-size: var(--t-h1); line-height: 0.92;
  letter-spacing: 0.01em; text-transform: uppercase; color: var(--bone);
}
.title em { font-style: normal; color: var(--amber); }
.title .flesh { color: var(--flesh); }
.lead { font-size: var(--t-lead); color: var(--bone-2); max-width: 46ch; }
.sec-head--center .lead { margin: 0 auto; }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--amber); --btn-fg: var(--amber-ink);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 52px; padding: 0 26px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.06em; text-transform: uppercase;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  transition: background var(--d-fast) ease, color var(--d-fast) ease, transform var(--d-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:hover { --btn-bg: var(--amber-hi); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn--ghost {
  --btn-bg: rgba(236, 230, 217, 0.06); --btn-fg: var(--bone); --btn-line: var(--line-2);
  /* the hairline, along the cut diagonals too */
  background: linear-gradient(to bottom left, transparent 50%, var(--btn-line) 0 calc(50% + 1px), transparent 0) 100% 0 / var(--cut) var(--cut) no-repeat,
    linear-gradient(to top right, transparent 50%, var(--btn-line) 0 calc(50% + 1px), transparent 0) 0 100% / var(--cut) var(--cut) no-repeat, var(--btn-bg);
  box-shadow: inset 0 0 0 1px var(--btn-line);
}
.btn--ghost:hover { --btn-bg: rgba(236, 230, 217, 0.12); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: 0.95rem; --cut: 8px; }
.btn[aria-disabled='true'] { cursor: default; }
/* clip-path cuts off anything outside the box, so the focus ring sits inside */
.btn:focus-visible { outline: 2px solid var(--amber-ink); outline-offset: -6px; }
.btn--ghost:focus-visible { outline-color: var(--amber); }

/* the game's round amber arrow (START CAMPAIGN) */
.btn-round {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--amber); color: var(--amber-ink); flex: none;
  box-shadow: 0 0 0 0 var(--amber-glow); transition: box-shadow var(--d-med) var(--ease-out), transform var(--d-fast) var(--ease-out);
}
.btn-round svg { width: 20px; height: 20px; }
a:hover > .btn-round, button:hover > .btn-round, .btn-round:hover { box-shadow: 0 0 0 8px var(--amber-wash); transform: translateX(2px); }

/* key chips (input prompts) */
.key {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px;
  border: 1px solid var(--line-3); border-bottom-width: 2px; border-radius: var(--r-2);
  font-family: var(--f-display); font-weight: 700; font-size: 0.8rem; letter-spacing: var(--track-prompt);
  text-transform: uppercase; color: var(--bone); background: rgba(236, 230, 217, 0.04);
}
.prompt { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-display); font-weight: 600; font-size: 0.85rem; letter-spacing: var(--track-prompt); text-transform: uppercase; color: var(--bone-3); }

/* pills: stance and status, in the game's colours (src/fe/css/components.css cd-pill): defending is the
   player's amber, attacking is neutral; flesh is the hive's alone */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  font-family: var(--f-display); font-weight: 700; font-size: 0.78rem; letter-spacing: var(--track-prompt); text-transform: uppercase;
  border-radius: var(--r-1); background: rgba(236, 230, 217, 0.08); color: var(--bone-2);
}
.pill--defend, .pill--amber { background: var(--amber-wash); color: var(--amber); box-shadow: inset 0 0 0 1px rgba(255, 177, 46, 0.4); }
.pill--attack { background: rgba(236, 230, 217, 0.06); color: var(--bone); box-shadow: inset 0 0 0 1px var(--line-3); }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* panel: cut corner + hairline */
.panel {
  position: relative; background: linear-gradient(180deg, rgba(23, 27, 32, 0.92), rgba(10, 12, 14, 0.92));
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.panel::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  border: 1px solid var(--line-2);
  background: linear-gradient(to bottom left, transparent 50%, var(--line-2) 0 calc(50% + 1px), transparent 0) 100% 0 / var(--cut) var(--cut) no-repeat border-box,
    linear-gradient(to top right, transparent 50%, var(--line-2) 0 calc(50% + 1px), transparent 0) 0 100% / var(--cut) var(--cut) no-repeat border-box;
  clip-path: inherit;
}

/* dashed meter (difficulty / threat) */
.meter { display: inline-flex; gap: 3px; }
.meter i { width: 10px; height: 4px; background: var(--bone-5); }
.meter i.on { background: var(--bone); }
.meter--flesh i.on { background: var(--flesh); }
.meter--amber i.on { background: var(--amber); }

/* ---------- top bar ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 500; height: var(--nav-h);
  display: flex; align-items: center;
  transition: background var(--d-med) ease, box-shadow var(--d-med) ease, transform var(--d-med) var(--ease-out);
}
.nav.is-solid { background: rgba(7, 8, 10, 0.94); box-shadow: 0 1px 0 var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 28px; }
.nav__brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.nav__brand svg { height: 22px; width: auto; }
.nav__links { display: flex; gap: 26px; }
.nav__links a {
  position: relative; font-family: var(--f-display); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--bone-3); transition: color var(--d-fast) ease; padding: 8px 0;
}
.nav__links a::after { content: ''; position: absolute; left: 0; right: 100%; bottom: 2px; height: 2px; background: var(--amber); transition: right var(--d-med) var(--ease-out); }
.nav__links a:hover, .nav__links a[aria-current='true'] { color: var(--bone); }
.nav__links a[aria-current='true']::after { right: 0; }
.nav__tools { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-2);
  color: var(--bone-3); box-shadow: inset 0 0 0 1px var(--line-2); transition: color var(--d-fast), box-shadow var(--d-fast);
}
.icon-btn:hover { color: var(--bone); box-shadow: inset 0 0 0 1px var(--line-3); }
.icon-btn[aria-pressed='true'] { color: var(--amber); box-shadow: inset 0 0 0 1px rgba(255, 177, 46, 0.5); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn[hidden] { display: none; }
/* toggles: the glyph changes with the state (speaker with waves or a cross), not just the colour */
.icon-btn[aria-pressed='false'] .ico-on, .icon-btn[aria-pressed='true'] .ico-off { display: none; }
.nav__menu { display: none; }

@media (max-width: 1023px) {
  .nav .wrap { gap: 20px; }
  .nav__links { gap: 18px; }
}
@media (max-width: 900px) {
  .nav__links {
    position: fixed; inset: var(--nav-h) 0 auto; flex-direction: column; gap: 0; padding: 8px var(--gutter) 20px;
    max-height: calc(100vh - var(--nav-h)); max-height: calc(100svh - var(--nav-h)); overflow-y: auto; overscroll-behavior: contain;
    background: rgba(5, 6, 7, 0.97);
    box-shadow: 0 1px 0 var(--line); transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity var(--d-med) var(--ease-out), transform var(--d-med) var(--ease-out), visibility 0s linear var(--d-med);
  }
  .nav.is-open .nav__links { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
  .nav.is-open { background: rgba(5, 6, 7, 0.96); }
  .nav__links a { padding: 14px 0; font-size: 1.2rem; border-bottom: 1px solid var(--line); }
  .nav__links a::after { display: none; }
  .nav__menu { display: inline-grid; }
  .nav__cta { display: none; }
}

/* ---------- reveal on scroll (js adds .is-in; without js everything is visible) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 800ms var(--ease-out), transform 900ms var(--ease-out); transition-delay: calc(var(--i, 0) * var(--stagger)); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- voice subtitles (lib/voice.js): words appear as Reyes says them, like the briefing ---------- */
.sub-line .w { display: inline-block; opacity: 0; filter: blur(3px); transform: translateY(4px); transition: opacity 240ms ease, filter 340ms var(--ease-out), transform 340ms var(--ease-out); }
.sub-line .w.on { opacity: 1; filter: none; transform: none; }

/* ---------- Col. Reyes (lib/reyes.js) ---------- */
.reyes { position: relative; width: 100%; -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent 98%); mask-image: linear-gradient(180deg, #000 82%, transparent 98%); }
.reyes img { position: absolute; display: block; max-width: none; }
.reyes__base { inset: 0; width: 100%; height: 100%; }
.reyes__mouth { opacity: 0; }

/* ---------- stats strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(40px, 6vw, 72px); border-top: 1px solid var(--line); }
.stats li { display: grid; gap: 6px; padding: 26px 20px 0 0; }
.stats li + li { padding-left: 22px; border-left: 1px solid var(--line); }
.stats b { font-family: var(--f-display); font-weight: 800; font-size: clamp(2.6rem, 5vw, 4rem); line-height: 0.9; color: var(--bone); font-variant-numeric: tabular-nums; }
.stats span { color: var(--bone-3); font-size: var(--t-small); }
@media (max-width: 700px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats li:nth-child(3) { padding-left: 0; border-left: 0; }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: 22px; }
}

/* ---------- footer ---------- */
.footer { position: relative; padding: clamp(80px, 10vw, 140px) 0 40px; border-top: 1px solid var(--line); overflow: hidden; }
.footer__cta { display: grid; justify-items: center; text-align: center; gap: 22px; }
.footer__cta .title { font-size: clamp(2.8rem, 8vw, 6.5rem); }
.footer__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: clamp(64px, 8vw, 110px); padding-top: 22px; border-top: 1px solid var(--line); color: var(--bone-3); font-size: var(--t-small); }
.footer__row nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer__row a:hover { color: var(--bone); }

/* ---------- motion: a section out of view holds its CSS animations (main.js marks it); reduced motion
   (the OS setting, or the Motion toggle: data-motion="off") stills the page ---------- */
[data-offscreen], [data-offscreen]::before, [data-offscreen]::after,
[data-offscreen] *, [data-offscreen] *::before, [data-offscreen] *::after { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
:root[data-motion='off'] [data-reveal] { opacity: 1; transform: none; transition: none; }
:root[data-motion='off'] *, :root[data-motion='off'] *::before, :root[data-motion='off'] *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
