/* ════════════════════════════════════════════════════════════════════════
   NEXMILE · сайт v2 — «Перший рейс»
   tokens.css — ЄДИНЕ джерело значень + структурний каркас сцени.
   ДНК продукту (Meridian · «Реєстр»): графіт, один індиго-акцент,
   колір = стадія рейсу, Geist. Але це вітрина, а не адмінка:
   більший шрифт, справжня глибина, світло.
   Власник файла — оркестратор. Модулі сцени/столу/пульта сюди не пишуть.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Шрифти (self-hosted, variable) ─────────────────────────────────────── */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-cyrillic-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-mono-cyrillic-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-mono-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;

  /* ── Площини (Relief): глибина = заливка + тінь, без рамок ───────────── */
  --void: #06070a;          /* простір за сценою */
  --canvas: #0b0c0f;        /* полотно сторінки */
  --sunken: #141518;        /* втоплені зони, голова аркуша */
  --surface: #1a1c1f;       /* тіло таблиці й аркушів */
  --frame: #222429;         /* хром: вкладки, шапка колонок, підсумок */
  --raised: #282a30;
  --overlay: #2e3036;
  --fill-1: #23262b;        /* нейтральні ступені: спокій · об'єкт · наведення */
  --fill-2: #2c2f35;
  --fill-3: #363940;
  --line: #2a2c2f;          /* сітка таблиці */
  --line-2: #34363a;

  /* ── Чорнило ─────────────────────────────────────────────────────────── */
  --ink-1: #eceef2;
  --ink-2: #b8bdc6;
  --ink-3: #858b96;
  --ink-4: #5b616b;

  /* ── Єдиний акцент — індиго ──────────────────────────────────────────── */
  --accent: #7981f2;
  --accent-solid: #6f7ae6;
  --accent-deep: #4d54e0;
  --accent-ink: #b8befa;
  --accent-glow: rgba(121, 129, 242, 0.34);

  /* ── Класична палітра «Реєстру»: тон · чорнило. Колір = стадія/сигнал ── */
  --crimson: #d2584f;    --crimson-ink: #f0a39b;     /* вхідні · тривога */
  --cobalt: #5b8fdb;     --cobalt-ink: #a9c6f1;      /* в дорозі */
  --slate: #8892a3;      --slate-ink: #c3c9d3;       /* завантаження CMR */
  --raspberry: #dd5385;  --raspberry-ink: #f7a3bf;   /* виставлення на оплату */
  --copper: #d78730;     --copper-ink: #f6be7f;      /* увага · «скоро» */
  --gold: #cba635;       --gold-ink: #ebcf7d;
  --petrol: #34a7ba;     --petrol-ink: #88d5e2;      /* відправка на оплату */
  --amethyst: #9a7fdc;   --amethyst-ink: #c9b8f3;    /* підтвердження оплати · відлік */
  --emerald: #4caf78;    --emerald-ink: #94d7af;     /* оплачено */
  --indigo: #7981f2;     --indigo-ink: #b8befa;      /* документ · позначка */

  /* ── Папір (злеценя, CMR, фактура) ───────────────────────────────────── */
  --paper: #fbfbf8;
  --paper-2: #f1f2ee;
  --paper-ink: #1d1e20;
  --paper-ink-2: #5a5e66;
  --paper-line: #d9dbe0;
  --paper-blue: #2b3fae;

  /* ── Форма ───────────────────────────────────────────────────────────── */
  --r-xs: 5px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 12px;
  --r-card: 14px;
  --r-window: 18px;
  --r-pill: 999px;

  /* ── Тіні (дозовані на площину) ──────────────────────────────────────── */
  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.32);
  --sh-pop: 0 10px 30px rgba(0, 0, 0, 0.5), 0 3px 10px rgba(0, 0, 0, 0.38);
  --sh-sheet: 0 30px 80px rgba(0, 0, 0, 0.62), 0 10px 26px rgba(0, 0, 0, 0.45);
  --sh-window: 0 60px 140px rgba(0, 0, 0, 0.7), 0 18px 44px rgba(0, 0, 0, 0.5);

  /* ── Шрифт ───────────────────────────────────────────────────────────── */
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --fs-display: clamp(2.5rem, 6.1vw, 6.25rem);
  --fs-title: clamp(1.75rem, 3.4vw, 3.25rem);
  --fs-lead: clamp(1rem, 1.25vw, 1.25rem);
  --fs-body: 0.9375rem;
  --fs-micro: 0.6875rem;

  /* ── Рух: вихід швидший за вхід, жодних пружин «заради пружин» ───────── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-back: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-fast: 120ms;
  --t: 180ms;
  --t-slow: 280ms;
  --t-move: 520ms;
  --t-scene: 820ms;

  /* ── Каркас сцени (виставляє js/core.js) ─────────────────────────────── */
  --nav-h: 60px;
  --desk-w: 1200px;         /* проєктний розмір вікна столу */
  --desk-h: 690px;
  --desk-fit: 1;            /* масштаб, з яким стіл уміщається в екран */
  --intro: 0;               /* 0 — хіро, 1 — стіл розгорнуто */
  --vh: 1vh;                /* стабільна висота екрана, px (без стрибків адресного рядка) */
}

/* ── Основа ─────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  background: var(--void);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-width: none;
}
html::-webkit-scrollbar {
  display: none;
}
body {
  margin: 0;
  background: var(--void);
  color: var(--ink-1);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
a {
  color: inherit;
  text-decoration: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
::selection {
  background: rgba(121, 129, 242, 0.4);
}
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.tnum {
  font-variant-numeric: tabular-nums;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Каркас подорожі: висока секція + липка сцена ───────────────────────── */
#journey {
  position: relative;
  /* висоту в px виставляє core.js (--journey-h); запасне значення — без JS */
  height: var(--journey-h, 100vh);
}
.pin {
  position: sticky;
  top: 0;
  height: calc(var(--vh) * 100);
  overflow: hidden;
  isolation: isolate;
  background: var(--void);
  contain: layout paint;
}
#space {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}
#docs {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
/* Сцена столу. Власник трансформації #desk — js/scene.js (через змінні нижче).
   Вміст столу живе в #desk > .desk-window (js/desk.js) і САМ #desk не трансформує. */
#stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  perspective: 1800px;
  perspective-origin: 50% 38%;
  pointer-events: none;
}
#desk {
  position: relative;
  flex: none;
  width: var(--desk-w);
  height: var(--desk-h);
  pointer-events: auto;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  transform: translate3d(var(--desk-x, 0px), var(--desk-y, 0px), var(--desk-z, 0px))
    rotateX(var(--desk-rx, 0deg)) rotateY(var(--desk-ry, 0deg)) rotateZ(var(--desk-rz, 0deg))
    scale(var(--desk-s, var(--desk-fit)));
  will-change: transform;
}
#hero {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
#hero > * {
  pointer-events: auto;
}
#hud {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
#fx {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}
#nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 10;
}
#finale {
  position: relative;
  z-index: 1;
  min-height: calc(var(--vh) * 100);
  background: var(--void);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    /* саме 0s, а не 1ms: типове transition-property — all, тож будь-яка тривалість > 0
       змусила б «переходити» кожну властивість (зокрема висоту #journey під час розкладки) */
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}
