/* ============================================================
   base.css — tokens, reset, shared bits, accessibility plumbing
   ============================================================ */

:root {
  /* The menu palette. The console's menu is a near-neutral silver, not blue —
     the colour all comes from the channels sitting on top of it. */
  --bg-1:      #f7f9fa;
  --bg-2:      #dde3e7;
  --paper:     #ffffff;
  --line:      #b9ccd6;
  --line-soft: #dce7ed;
  --ink:       #23323a;
  --ink-soft:  #576d78;
  --accent:    #1a92c9;
  --accent-lo: #63c2ea;
  --accent-hi: #0b6e99;
  --glow:      rgba(40, 165, 225, .45);

  --radius:    16px;
  --radius-sm: 9px;
  --bar-h:     clamp(74px, 11.5vh, 98px);

  /* One timing scale, so everything feels like the same machine.
     js/app.js zeroes these out when motion is reduced. */
  --t-fast: 120ms;
  --t-mid:  260ms;
  --t-slow: 460ms;
  --ease:   cubic-bezier(.22, .68, .32, 1);
  --ease-pop: cubic-bezier(.2, .9, .3, 1.2);

  --font: "Varela Round", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--font);
  font-size: clamp(15px, .5vw + 13.6px, 17px);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg-2);
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 400; }
p { margin: 0 0 1em; }
img, svg, video, iframe { max-width: 100%; }
img, video { height: auto; display: block; }

a { color: var(--accent-hi); }
a:hover { color: var(--accent); }

/* ---------- focus: always visible, never subtle ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.view--reel :focus-visible,
.view--video :focus-visible,
.lightbox :focus-visible { outline-color: #ffd45e; }

/* ---------- screen-reader + skip link ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 999;
  transform: translateY(-200%);
  background: var(--paper); color: var(--ink);
  padding: .7em 1.2em; border-radius: var(--radius-sm);
  border: 2px solid var(--accent); text-decoration: none;
  box-shadow: 0 6px 20px rgba(20, 50, 70, .25);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: .6em 1.4em;
  font: inherit; color: var(--ink);
  background: linear-gradient(#ffffff, #eef4f8);
  border: 2px solid var(--line);
  border-radius: 999px;
  cursor: pointer; text-decoration: none;
  transition: transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}
.btn:hover { border-color: var(--accent-lo); box-shadow: 0 0 0 4px var(--glow); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(var(--accent-lo), var(--accent));
  border-color: var(--accent-hi);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 30, 50, .35);
}
.btn--primary:hover { color: #fff; }

/* ============================================================
   NO-JS FALLBACK
   Without the .js class every section is simply a stacked page.
   Everything below only applies once app.js has flipped it on.
   ============================================================ */
.view {
  position: relative;
  z-index: 3; /* above the bubble layer, which is z-index 2 */
  padding: clamp(28px, 6vw, 72px) clamp(16px, 5vw, 48px);
  padding-bottom: calc(var(--bar-h) + 32px);
}
.view__inner { max-width: 1080px; margin-inline: auto; }

.js .view {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* auto margins centre short channels and collapse to nothing on tall ones —
   unlike justify-content: center, they never clip the top when it overflows */
.js .view__inner { margin-block: auto; width: 100%; }
.js .view[hidden] { display: none; }

/* The zoom-out-of-the-tile entrance. Purely transform + opacity. */
.js .view.is-opening { animation: view-in var(--t-slow) var(--ease) both; }
.js .view.is-closing { animation: view-out var(--t-mid) var(--ease) both; }

@keyframes view-in {
  from { opacity: 0; transform: translate(var(--ox, 0px), var(--oy, 0px)) scale(var(--os, .22)); }
  to   { opacity: 1; transform: translate(0, 0) scale(1); }
}
@keyframes view-out {
  from { opacity: 1; transform: translate(0, 0) scale(1); }
  to   { opacity: 0; transform: translate(var(--ox, 0px), var(--oy, 0px)) scale(var(--os, .22)); }
}

/* ---------- shared media player ---------- */
.player { position: relative; }

.facade {
  display: block; position: relative; width: 100%; padding: 0;
  border: 0; background: #0b1116; cursor: pointer;
  border-radius: var(--radius-sm); overflow: hidden;
  aspect-ratio: 16 / 9;
}
.facade img { width: 100%; height: 100%; object-fit: cover; }
.facade__play {
  position: absolute; inset: 0; display: grid; place-items: center;
  transition: transform var(--t-mid) var(--ease-pop);
}
.facade__play svg { width: clamp(56px, 9vw, 84px); height: auto; }
.facade:hover .facade__play,
.facade:focus-visible .facade__play { transform: scale(1.12); }
.facade__time {
  position: absolute; right: 10px; bottom: 10px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
  color: #fff; background: rgba(8, 14, 20, .8);
  padding: 3px 7px; border-radius: 4px;
}
.player iframe, .player video {
  display: block; width: 100%; aspect-ratio: 16 / 9; height: auto;
  border: 0; border-radius: var(--radius-sm); background: #000;
}

/* ---------- forms ---------- */
.field { display: grid; gap: .35em; margin-bottom: 1em; }
.field label { font-size: .92em; color: var(--ink-soft); }
.field input, .field textarea {
  font: inherit; color: var(--ink);
  padding: .65em .85em;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  min-height: 46px;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { border-color: var(--accent); }

/* ---------- notices: the draft strip, the opened-from-disk note ---------- */
.notice {
  position: fixed;
  left: 50%;
  top: 10px;
  z-index: 80;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: min(720px, calc(100vw - 24px));
  padding: 9px 14px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink);
  background: linear-gradient(#fff8e2, #fdefc0);
  border: 2px solid #fff;
  border-radius: 12px;
  box-shadow: 0 0 0 1px #e2c56a, 0 8px 24px rgba(60, 50, 10, .18);
}
.notice[hidden] { display: none; }
.notice--soft { background: linear-gradient(#fff, #eef4f8); box-shadow: 0 0 0 1px var(--line), 0 8px 24px rgba(30, 60, 85, .16); }
.notice code { font-family: var(--mono); font-size: 12px; background: rgba(255, 255, 255, .7); padding: 1px 5px; border-radius: 4px; }
.notice__btn {
  font: inherit; font-size: 13px;
  min-height: 32px; padding: 0 .9em;
  color: #fff; background: linear-gradient(#4bb0e0, #1a8ac4);
  border: 1px solid #12719f; border-radius: 8px; cursor: pointer;
}
.notice__btn--quiet { color: var(--ink); background: linear-gradient(#fff, #eaf0f4); border-color: #b6c8d3; }
/* the game's HUD sits at the top too; give it the corner and the strip the middle */
html.has-draft .combo { top: 64px; }

/* ---------- reduced motion: global off-switch ----------
   Both the OS setting and the in-page toggle land here. */
@media (prefers-reduced-motion: reduce) {
  :root { --t-fast: 1ms; --t-mid: 1ms; --t-slow: 1ms; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
html.reduce-motion { --t-fast: 1ms; --t-mid: 1ms; --t-slow: 1ms; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
  scroll-behavior: auto !important;
}

/* ---------- stronger borders when the OS asks for contrast ---------- */
@media (prefers-contrast: more) {
  :root { --line: #5c7683; --ink-soft: #3b4c56; --accent: #0a6f9c; }
  .chan { border-width: 3px !important; }
}

/* ============================================================
   PRINT — Ctrl+P gives a clean CV, not a screenshot of a console
   ============================================================ */
@media print {
  .bar, .hand, .options, .lightbox, .menu, .skip-link, .viewfinder,
  .facade, .player, .menu__hint { display: none !important; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .js .view { position: static !important; display: block !important; overflow: visible !important; }
  .js .view[hidden] { display: none !important; }
  .view { padding: 0; }
  .manual__paper { box-shadow: none !important; border: 0 !important; max-width: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; }
}
