/* =========================================================================
   GameWise — Homepage  ·  cinematic scrollytelling  («Сапфир»)
   Scene layout + scroll reveals. Reusable widgets (StoryCard, Stat, Tag,
   Badge) live in components.css, which this page also loads. Full motion
   (intro loader, custom cursor, inertial scroll, zoom, rail) is the motion step.
   ========================================================================= */

/* ── Scene scaffolding ──────────────────────────────────────────────── */
.scene {
  position: relative;
  z-index: 1;
  min-height: 100vh; min-height: 100svh;
  padding: clamp(96px, 13vh, 168px) var(--measure-gutter);
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
}

/* Ambient background canvases (built by home-ambient.js) — behind all content */
.gw-ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 1; transition: opacity .8s var(--ease-out-soft); }
#gw-stars { opacity: 0; }
body.gw-field-active #gw-digits { opacity: 0; }
body.gw-field-active #gw-stars { opacity: 1; }
.scene--flow { min-height: auto; }
.scene__in { width: 100%; max-width: var(--container); margin-inline: auto; position: relative; z-index: 2; }
.scene__grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: var(--grain-opacity); z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ── Reveal helpers (toggled by .is-in on the [data-scene] ancestor) ── */
.reveal-line { overflow: hidden; display: block; }
.reveal-line > span { display: block; transform: translateY(115%); transition: transform var(--dur-reveal) var(--ease-out-expo); }
.is-in .reveal-line > span { transform: translateY(0); }
.fade-up { opacity: 0; transform: translateY(28px); transition: opacity var(--dur-slow) var(--ease-out-soft), transform var(--dur-slow) var(--ease-out-expo); transition-delay: var(--d, .15s); }
.is-in .fade-up { opacity: 1; transform: none; }

/* ── HERO ───────────────────────────────────────────────────────────── */
.hero__glow { position: absolute; right: -10%; top: 12%; width: 60vw; height: 60vw; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, var(--copper-glow), transparent 60%); filter: blur(40px); opacity: .55; }
.hero__head { font-family: var(--font-display); font-weight: var(--weight-medium); color: var(--text-strong);
  font-size: clamp(2.75rem, 8vw, 7.5rem); line-height: .96; letter-spacing: -.03em; margin: var(--space-5) 0 0; max-width: 15ch; }
.hero__head em { font-style: italic; color: var(--accent); }
.hero__sub { margin-top: var(--space-6); max-width: 52ch; font-size: var(--text-lg); color: var(--text-body); line-height: 1.5; }
.hero__actions { margin-top: var(--space-7); display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.hero__note { margin-top: var(--space-6); font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: var(--tracking-wide);
  text-transform: uppercase; color: var(--text-muted); display: inline-flex; align-items: center; gap: 10px; }
.hero__note::before { content: ""; width: 28px; height: 1px; background: var(--copper-600); }

/* Link-style button with animated bar (hero) */
.gw-btn--link { background: transparent; color: var(--accent); padding-left: 0; padding-right: 0; border-radius: 0; }
.gw-btn--link:hover:not([disabled]) { color: var(--accent-hover); background: transparent; }
.gw-btn--link .gw-btn__bar { display: block; height: 1px; width: 18px; background: currentColor; transition: width var(--dur-base) var(--ease-out-expo); }
.gw-btn--link:hover:not([disabled]) .gw-btn__bar { width: 30px; }

/* ── THE EDGE (stat scene) ──────────────────────────────────────────── */
.edge { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(40px, 6vw, 96px); align-items: center; }
.edge__big { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: var(--weight-medium);
  font-size: clamp(4rem, 12vw, 11rem); line-height: .85; color: var(--text-strong); letter-spacing: -.04em; }
.edge__big em { color: var(--signal-loss); font-style: normal; }
.edge__lead { max-width: 36ch; margin-top: var(--space-5); }
.edge__list { display: flex; flex-direction: column; gap: var(--space-6); }
@media (max-width: 860px) { .edge { grid-template-columns: 1fr; gap: var(--space-7); } }

/* ── THE FIELD (constellation map) ──────────────────────────────────── */
.field__lead { max-width: 46ch; margin: var(--space-4) 0 var(--space-7); }
.map { position: relative; width: 100%; max-width: 1100px; margin: 0 auto; aspect-ratio: 16 / 9; }
.map__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map__svg line { transition: stroke var(--dur-base) var(--ease-out-soft), stroke-width var(--dur-base) var(--ease-out-soft), opacity var(--dur-base) var(--ease-out-soft); }
.map__node { position: absolute; transform: translate(-50%, -50%); text-decoration: none; }
.node__dot { width: 18px; height: 18px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 50% 42%, #FCEFDB, var(--copper-400) 46%, var(--copper-700) 82%);
  box-shadow: 0 0 12px 3px var(--copper-glow), 0 0 4px 1px rgba(217,133,60,.55);
  transition: transform var(--dur-base) var(--ease-out-expo), box-shadow var(--dur-base) var(--ease-out-soft);
  animation: gw-planet 4.5s var(--ease-in-out) infinite; animation-delay: var(--pd, 0s); }
.node__dot::after { content: ""; position: absolute; inset: -8px; border: 1px solid rgba(199,123,58,.4); border-radius: 50%; transition: all var(--dur-base) var(--ease-out-soft); }
.map__node:hover .node__dot, .map__node:focus-visible .node__dot, .map__node[data-on="true"] .node__dot { transform: scale(1.35); box-shadow: 0 0 28px 8px var(--copper-glow); animation: none; }
.map__node:hover .node__dot::after, .map__node:focus-visible .node__dot::after { inset: -13px; border-color: var(--copper-500); }
.node__label { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); white-space: nowrap;
  font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); transition: color var(--dur-base) var(--ease-out-soft); }
.map__node:hover .node__label, .map__node:focus-visible .node__label { color: var(--text-strong); }
.node__panel { position: absolute; left: 24px; top: calc(50% + 16px); width: 240px; opacity: 0; transform: translateY(6px); pointer-events: none; transition: all var(--dur-base) var(--ease-out-soft);
  background: var(--panel-bg); backdrop-filter: blur(10px); border: var(--hairline); border-radius: var(--radius-sm); padding: 14px 16px; }
.map__node:hover .node__panel, .map__node:focus-visible .node__panel { opacity: 1; transform: translateY(0); }
.node__panel h3 { font-family: var(--font-display); margin: 0 0 6px; font-size: var(--text-lg); color: var(--text-strong); font-weight: var(--weight-medium); }
.node__panel p { margin: 0; font-size: var(--text-sm); color: var(--text-body); line-height: 1.4; }
.node__panel .gw-data { display: inline-block; margin-top: 8px; color: var(--accent); font-size: var(--text-sm); }

/* Planet twinkle — glow pulse (staggered per node via --pd on the base rule) */
@keyframes gw-planet {
  0%, 100% { box-shadow: 0 0 10px 2px var(--copper-glow), 0 0 4px 1px rgba(217,133,60,.5); }
  50%      { box-shadow: 0 0 22px 6px var(--copper-glow), 0 0 7px 2px rgba(217,133,60,.75); }
}

/* vertical tags row (also the mobile navigation) — Tag styles in components.css */
.field__tags { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: var(--space-7); }

/* ── THE NEAR MISS (peel) ───────────────────────────────────────────── */
.peel { position: relative; width: 100%; max-width: 1000px; margin: var(--space-7) auto 0; aspect-ratio: 16 / 8;
  border: var(--hairline); border-radius: var(--radius-sm); overflow: hidden; }
.peel__layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 8%; text-align: center; }
.peel__seen { background: linear-gradient(135deg, #1a2236, #0b0f1c); }
.peel__truth { background: linear-gradient(135deg, #2a1a10, #0b0f1c); clip-path: circle(0px at 50% 50%); }
.peel__kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; position: absolute; top: 18px; left: 20px; }
.peel__seen .peel__kicker { color: var(--text-muted); }
.peel__truth .peel__kicker { color: var(--accent); }
.peel__layer h3 { font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 3rem); line-height: 1.05; margin: 0; font-weight: var(--weight-medium); max-width: 22ch; }
.peel__seen h3 { color: var(--text-body); }
.peel__truth h3 { color: var(--text-strong); }
.peel__truth h3 em { color: var(--accent); font-style: italic; }
.peel__hint { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-family: var(--font-mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-faint); }

/* ── THE FILES (stories grid) — StoryCard styles in components.css ──── */
.stories { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: var(--space-7); }
@media (max-width: 900px) { .stories { grid-template-columns: 1fr; } }

/* ── CLOSING ────────────────────────────────────────────────────────── */
.closing__glow { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 70vw; height: 50vw; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, var(--copper-glow), transparent 62%); filter: blur(50px); opacity: .4; }
.closing__head { font-family: var(--font-display); font-weight: var(--weight-medium); color: var(--text-strong); font-size: var(--display-l); line-height: var(--leading-display); letter-spacing: -.02em; margin: var(--space-4) 0 0; max-width: 18ch; }
.closing__head em { font-style: italic; color: var(--accent); }
.closing__lede { margin: var(--space-5) 0 0; max-width: 52ch; }
.closing__actions { margin-top: var(--space-6); display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.closing__badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: var(--space-6); }

/* ── Mobile: drop the constellation, keep the tag navigation ────────── */
@media (max-width: 720px) {
  .map { display: none; }
  .field__tags { justify-content: flex-start; }
}

/* ── Reduced motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .reveal-line > span, .fade-up { transition: none !important; transform: none !important; opacity: 1 !important; }
  .peel__truth { clip-path: circle(150% at 50% 50%) !important; }
  .peel__hint { display: none; }
  .map__svg line { transition: none; }
  .map__node .node__dot { animation: none; }
}

/* ── Touch: no hover to reveal — show the truth, hide hint ──────────── */
@media (hover: none) {
  .peel__truth { clip-path: circle(150% at 50% 50%); }
  .peel__hint { display: none; }
}

/* ═══════════════════ MOTION CHROME (built by home-motion.js) ═══════════
   Intro loader · custom cursor · progress rail · scroll cue. Homepage only;
   none of it renders unless home-motion.js runs (and most yields to reduced-motion). */
body.gw-loading { overflow: hidden; height: 100vh; }
@media (hover: hover) and (pointer: fine) { body.gw-cursor, body.gw-cursor * { cursor: none !important; } }

/* Intro loader */
.intro { position: fixed; inset: 0; z-index: 9500; background: var(--bg-page); display: flex; flex-direction: column; justify-content: space-between; padding: clamp(24px, 5vw, 64px); will-change: transform; }
.intro__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.intro__count { font-family: var(--font-display); font-weight: 500; font-size: clamp(5rem, 22vw, 20rem); line-height: .8; color: var(--text-strong); letter-spacing: -.04em; display: flex; align-items: flex-end; gap: .1em; }
.intro__count sup { font-size: .28em; color: var(--accent); font-family: var(--font-mono); }
.intro__bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.intro__status { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--text-muted); }
.intro__status b { color: var(--accent); font-weight: 500; }
.intro__bar { height: 1px; background: var(--border-strong); position: relative; flex: 1; max-width: 50%; }
.intro__bar i { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: var(--accent); display: block; }
.shutter { position: fixed; inset: 0; z-index: 9400; pointer-events: none; display: grid; grid-template-columns: repeat(5, 1fr); }
.shutter span { background: var(--bg-page); transform: translateY(0); }

/* Progress rail (right) */
.rail { position: fixed; right: clamp(16px, 3vw, 40px); top: 50%; transform: translateY(-50%); z-index: 200; display: flex; flex-direction: column; gap: 14px; }
.rail button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.rail .dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--text-faint); transition: all var(--dur-base) var(--ease-out-soft); }
.rail .num { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); opacity: 0; transform: translateX(6px); transition: all var(--dur-base) var(--ease-out-soft); text-transform: uppercase; letter-spacing: .04em; }
.rail button:hover .num, .rail button[data-on="true"] .num { opacity: 1; transform: translateX(0); }
.rail button[data-on="true"] .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 12px var(--copper-glow); }
@media (max-width: 720px) { .rail { display: none; } }

/* Scroll cue */
.scroll-cue { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 200; font-family: var(--font-mono); font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 10px; transition: opacity var(--dur-base) var(--ease-out-soft); }
.scroll-cue::after { content: ""; width: 1px; height: 40px; background: linear-gradient(var(--copper-500), transparent); animation: gw-cue 2s var(--ease-in-out) infinite; }
@keyframes gw-cue { 0%, 100% { opacity: .3; transform: scaleY(.6); transform-origin: top; } 50% { opacity: 1; transform: scaleY(1); } }
@media (max-width: 720px) { .scroll-cue { display: none; } }

/* Custom cursor */
.cursor { position: fixed; top: 0; left: 0; z-index: 9000; pointer-events: none; mix-blend-mode: difference; }
.cursor__ring { position: absolute; width: 38px; height: 38px; border: 1px solid #fff; border-radius: 50%; transform: translate(-50%, -50%); transition: width var(--dur-base) var(--ease-out-expo), height var(--dur-base) var(--ease-out-expo), background var(--dur-fast); }
.cursor__dot { position: absolute; width: 5px; height: 5px; background: #fff; border-radius: 50%; transform: translate(-50%, -50%); }
.cursor[data-variant="link"] .cursor__ring { width: 64px; height: 64px; background: rgba(255,255,255,.12); }
.cursor[data-variant="reveal"] .cursor__ring { width: 90px; height: 90px; }
.cursor__label { position: absolute; transform: translate(-50%, -50%); font-family: var(--font-mono); font-size: 9px; letter-spacing: .15em; text-transform: uppercase; color: #fff; opacity: 0; transition: opacity var(--dur-fast); white-space: nowrap; }
.cursor[data-variant="reveal"] .cursor__label { opacity: 1; }

@media (prefers-reduced-motion: reduce) { .scroll-cue::after { animation: none; } }
