/* Дизайн-система: «Midnight hardware gallery» (DESIGN.md).
   Чорна сцена-постамент для одного точно освітленого виробу, стримані підписи, синій — лише для дій. */
:root {
  /* Colors */
  --color-obsidian: #000000;
  --color-graphite: #0e0e0e;
  --color-carbon: #1d1d1f;
  --gradient-carbon: linear-gradient(#1d1d1f, #000000 288px);
  --color-steel: #333336;
  --color-slate: #6e6e73;
  --color-ash: #86868b;
  --color-porcelain: #f5f5f7;
  --color-white: #ffffff;
  --color-apple-blue: #0071e3;
  --color-electric-link: #2997ff;
  --color-cobalt-link: #0066cc;
  --color-optical-yellow: #ffd500;

  /* Typography: SF Pro → Inter (є і ї ґ) */
  --font-text: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Radius */
  --radius-cards: 28px;
  --radius-pills: 9999px;
  --radius-inputs: 980px;
  --radius-buttons: 170px;
  --radius-navigation: 20px;
  --radius-compact: 36px;

  /* Shadows = keylines */
  --shadow-subtle: rgb(40, 40, 40) 0 0 0 1px;
  --shadow-subtle-2: rgb(110, 110, 115) 0 0 0 1px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --bar-h: 0px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--color-obsidian); color: var(--color-porcelain);
  font: 400 17px/1.47 var(--font-text); letter-spacing: -0.374px; font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  transition: background-color .8s var(--ease);
  padding-bottom: var(--bar-h);
  overflow-x: clip;
}
a { color: var(--color-electric-link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 1px solid var(--color-apple-blue); outline-offset: 1px; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--color-apple-blue); color: #fff; padding: 8px 16px; border-radius: var(--radius-buttons); }
.skip:focus { top: 12px; }

/* Global utility navigation: 44px, compact 12px labels */
.top {
  position: fixed; inset: 0 0 auto; z-index: 20; height: 44px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 clamp(16px, 4vw, 48px);
  background: rgba(0, 0, 0, .8); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 1px 0 #282828;
  font-size: 12px; line-height: 1.33; letter-spacing: -0.12px;
}
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--color-porcelain); font: 600 14px/1 var(--font-display); letter-spacing: -0.224px; }
.logo:hover { text-decoration: none; }
.logo__mark { width: 16px; height: 16px; background:
  linear-gradient(#cccccc, #cccccc) 0 100% / 100% 45% no-repeat,
  linear-gradient(#cccccc, #cccccc) 50% 0 / 45% 55% no-repeat; }
.nav { display: none; gap: 32px; }
.nav a { color: rgba(255, 255, 255, .8); }
.nav a:hover { color: #fff; text-decoration: none; }
.top__tel { color: rgba(255, 255, 255, .8); font-weight: 500; white-space: nowrap; }
@media (min-width: 768px) { .nav { display: flex; } }

/* 3D stage: Obsidian */
.stage { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.poster, .poster img, #seq, .sys-still { position: absolute; inset: 0; width: 100%; height: 100%; }
.poster { background: var(--color-obsidian); }
.poster img, .sys-still { object-fit: cover; }
#seq { opacity: 0; }
.is-seq #seq { opacity: 1; }
.is-seq .poster { visibility: hidden; }
.sys-still { opacity: 0; transition: opacity .45s var(--ease); }
.sys-still.is-on { opacity: 1; }
.sys-still:not([src]) { display: none; }
.stage.is-off { visibility: hidden; }
/* текст поверх кадру: м'яке затемнення з боку тексту */
.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.82), rgba(0,0,0,.45) 32%, transparent 58%); }
.stage[data-side="right"]::after { background: linear-gradient(270deg, rgba(0,0,0,.82), rgba(0,0,0,.45) 32%, transparent 58%); }
/* телефон: ті ж медіа-умови, що й вибір кадрів у sequence.js */
@media (orientation: portrait) and (max-width: 767px) {
  .stage::after, .stage[data-side]::after { background: linear-gradient(180deg, transparent 38%, rgba(0,0,0,.8) 64%, #000 86%); }
}
#story .text, #story .note { color: rgba(245, 245, 247, .82); }
#story .text, #story .note, #story .fit-out { text-shadow: 0 1px 12px rgba(0, 0, 0, .9); }

main { position: relative; z-index: 1; }

/* Сцени-постаменти */
.scene {
  min-height: 100svh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  gap: 16px; padding: 96px clamp(20px, 6vw, 96px);
}
.scene > * { max-width: 30rem; }
.scene--right { align-items: flex-end; text-align: right; }
.scene--hero { justify-content: flex-end; padding-bottom: clamp(48px, 10svh, 120px); }
.scene--hero > .display { max-width: none; }

/* hero-product-name */
.eyebrow { margin: 0; font: 600 clamp(19px, 2.4vw, 32px)/1.13 var(--font-display); letter-spacing: .128px; color: var(--color-porcelain); }
/* display: 80/600, -1.2px; max 96 */
.display { margin: 0; font: 600 clamp(48px, 8vw, 96px)/1.04 var(--font-display); letter-spacing: -0.015em; }
.h2 { margin: 0; font: 600 clamp(40px, 5.6vw, 80px)/1.05 var(--font-display); letter-spacing: -0.015em; }
.lead { margin: 0; font-size: 21px; line-height: 1.38; letter-spacing: .231px; color: var(--color-porcelain); }
.text { margin: 0; color: var(--color-ash); }
.note { color: var(--color-ash); font-size: 14px; line-height: 1.43; letter-spacing: -0.224px; margin: 0; }
.label { margin: 0; color: var(--color-ash); font: 600 19px/1.21 var(--font-display); letter-spacing: .228px; }

.scene > :is(.h2, .text, .lead, .eyebrow) { text-shadow: 0 2px 24px rgba(0, 0, 0, .8); }

/* Підбір: Outlined Explore Pills */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.scene--right .chips { justify-content: flex-end; }
.chip {
  min-height: 36px; padding: 0 16px; border-radius: var(--radius-pills); border: 0; box-shadow: var(--shadow-subtle-2);
  background: transparent; color: var(--color-porcelain);
  font: 400 14px/1 var(--font-text); letter-spacing: -0.224px; cursor: pointer;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.chip:hover { background: rgba(255, 255, 255, .08); }
.chip[aria-pressed="true"] { background: var(--color-porcelain); color: var(--color-obsidian); box-shadow: none; }
.fit-out { margin: 0; }
.fit-out a { color: var(--color-electric-link); }

/* Feature stats */
.facts { list-style: none; margin: 8px 0 0; padding: 0; display: flex; gap: 24px 40px; flex-wrap: wrap; }
.scene--right .facts { justify-content: flex-end; }
.facts li { max-width: 12rem; }
.facts b { display: block; font: 600 clamp(28px, 4vw, 56px)/1 var(--font-display); letter-spacing: .196px; font-variant-numeric: tabular-nums; }
.facts span { color: var(--color-ash); font-size: 14px; line-height: 1.43; display: block; margin-top: 8px; }

/* Blue Purchase Pill */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px;
  border-radius: var(--radius-buttons); background: var(--color-apple-blue); color: #fff;
  border: 0; font: 400 17px/1 var(--font-text); letter-spacing: -0.374px; cursor: pointer;
  transition: background-color .3s var(--ease);
}
.btn:hover { background: #0077ed; text-decoration: none; }

/* Dark Pricing Capsule + pill */
.buy { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 32px; }
.capsule { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: var(--radius-compact);
  background: rgba(66, 66, 69, .72); color: rgba(255, 255, 255, .8); font-size: 14px; letter-spacing: -0.224px; }

/* Carbon bands + 28px panels */
.block { position: relative; background: var(--gradient-carbon); padding: clamp(48px, 7vw, 90px) clamp(12px, 3vw, 48px); }
.panel { background: var(--color-carbon); border-radius: var(--radius-cards); padding: clamp(24px, 5vw, 72px); display: grid; gap: 16px; }
.panel .text { max-width: 36rem; }

/* Feature Metric Tiles */
.tiles { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.tiles li { background: var(--color-obsidian); border-radius: var(--radius-cards); padding: 28px 24px; min-height: 140px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.tiles b { font: 600 clamp(22px, 2vw, 28px)/1.05 var(--font-display); letter-spacing: .196px; hyphens: auto; overflow-wrap: anywhere; }
.tiles span { color: var(--color-ash); font-size: 14px; letter-spacing: -0.224px; }

.lead-grid { gap: 40px; }
@media (min-width: 900px) { .lead-grid { grid-template-columns: 1fr 1fr; gap: 6vw; } }
.contacts { font-style: normal; display: grid; gap: 6px; margin-top: 24px; }
.contacts__tel { color: var(--color-porcelain); font: 600 clamp(28px, 3vw, 40px)/1.1 var(--font-display); letter-spacing: -0.12px; }
.contacts span { color: var(--color-ash); font-size: 14px; margin-bottom: 12px; }

/* Device Selector Inputs */
.form { display: grid; gap: 16px; max-width: 30rem; }
.form label { display: grid; gap: 8px; color: var(--color-ash); font-size: 14px; letter-spacing: -0.224px; }
.form small { font-size: 12px; }
.form :is(input:not([type=checkbox]), select) {
  min-height: 52px; padding: 0 45px 0 24px; border-radius: var(--radius-inputs); border: 1px solid var(--color-slate);
  background: rgba(255, 255, 255, .04); color: var(--color-porcelain); font: 400 17px var(--font-text); letter-spacing: -0.374px;
}
.form select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #86868b 50%), linear-gradient(135deg, #86868b 50%, transparent 50%);
  background-position: calc(100% - 26px) 50%, calc(100% - 20px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.form select option { background: var(--color-carbon); }
.form :is(input, select):focus-visible { outline: 1px solid var(--color-apple-blue); outline-offset: 1px; border-color: var(--color-apple-blue); }
.form .check { display: flex; gap: 10px; align-items: center; color: var(--color-ash); }
.form .check input { width: 20px; height: 20px; accent-color: var(--color-apple-blue); }
.form .btn { justify-self: start; }
.err { color: #ff6961; margin: 0; font-size: 14px; }
.done h3 { font: 600 40px/1.1 var(--font-display); margin: 0 0 8px; }
.done p { color: var(--color-ash); }

.foot { position: relative; z-index: 1; background: var(--color-carbon); color: var(--color-ash); padding: 24px clamp(20px, 6vw, 96px) 32px;
  font-size: 12px; line-height: 1.33; letter-spacing: -0.12px; box-shadow: 0 -1px 0 #333336; }
.foot p { margin: 0 0 6px; }
.foot a { color: var(--color-electric-link); }

/* Нижня панель — тільки телефон */
.bar { display: none; }
@media (max-width: 767px) {
  :root { --bar-h: 60px; }
  /* чипи систем: один рядок з горизонтальною прокруткою, щоб не закривати переріз */
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * clamp(20px, 6vw, 96px)); padding: 4px clamp(20px, 6vw, 96px); max-width: 100vw !important; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { min-height: 44px; flex: none; }
  .bar {
    position: fixed; inset: auto 8px 8px; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px;
    height: var(--bar-h); margin-bottom: env(safe-area-inset-bottom);
    background: rgba(14, 14, 14, .85); backdrop-filter: saturate(180%) blur(20px); border-radius: var(--radius-navigation); box-shadow: var(--shadow-subtle);
  }
  .bar a { display: grid; place-items: center; color: var(--color-porcelain); font-size: 14px; border-radius: 16px; min-height: 44px; }
  .bar a:last-child { background: var(--color-apple-blue); color: #fff; }
  .scene--right { align-items: flex-start; text-align: left; }
  .scene--right .facts, .scene--right .chips { justify-content: flex-start; }
  .scene { justify-content: flex-end; padding-bottom: calc(var(--bar-h) + 40px); gap: 12px; }
  body { padding-bottom: calc(var(--bar-h) + 16px); }
}

@supports (animation-timeline: view()) {
  .tier-static .h2 { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
}
@keyframes rise { from { opacity: 0; translate: 0 40px; } }

@media (prefers-reduced-motion: reduce) {
  /* зменшений рух: без зсувів і пролітів, але м'яке проявлення лишається (fade не викликає заколисування) */
  *, *::before, *::after { transition-duration: .01s !important; scroll-behavior: auto !important; }
  .tier-static .h2 { animation: none; }
}

/* ===== Появлення: hero при завантаженні, решта — при прокрутці (main.js ставить data-reveal) =====
   Лише transform/opacity/clip-path. Без JS усе видно одразу; з reduced-motion — тільки fade, без зсувів. */
@keyframes enter { from { opacity: 0; transform: translateY(26px); } }
@keyframes enter-fade { from { opacity: 0; } }
@keyframes curtain { from { opacity: 0; clip-path: inset(14% 3% 14% 3% round 28px); transform: translateY(48px) scale(.985); } }

.js-reveal .top { animation: enter-fade .9s var(--ease) both; }
.js-reveal .scene--hero > * { animation: enter 1.1s var(--ease) both; animation-delay: calc(.12s + var(--i, 0) * .11s); }
.scene--hero > :nth-child(2) { --i: 1; } .scene--hero > :nth-child(3) { --i: 2; }
.scene--hero > :nth-child(4) { --i: 3; } .scene--hero > :nth-child(5) { --i: 4; } .scene--hero > :nth-child(6) { --i: 5; }
.js-reveal .bar { animation: enter .8s var(--ease) .9s both; }

.js-reveal [data-reveal]:not(.is-in) { opacity: 0; }
.js-reveal [data-reveal].is-in { animation: enter .95s var(--ease) both; animation-delay: calc(var(--i, 0) * 75ms); }
.js-reveal [data-reveal="curtain"].is-in { animation: curtain 1.15s var(--ease) both; }
/* кнопка всередині картки/сцени з'являється слідом за текстом */
.js-reveal [data-reveal].is-in .btn { animation: enter .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 75ms + .28s); }

/* кнопки: підйом, світіння, натиск — через translate/scale, щоб не сперечатися з анімаціями появи */
.btn { transition: background-color .3s var(--ease), translate .35s var(--ease), box-shadow .35s var(--ease), scale .15s var(--ease); }
.btn:hover { translate: 0 -1px; box-shadow: 0 10px 28px -8px rgba(0, 113, 227, .55); }
.btn:active { scale: .97; }
.btn--ghost:hover { box-shadow: inset 0 0 0 1px var(--color-electric-link), 0 10px 28px -10px rgba(41, 151, 255, .4); }
.chip { transition: background-color .3s var(--ease), color .3s var(--ease), scale .15s var(--ease); }
.chip:active { scale: .96; }

/* варіант 2: постер ховається, поки діорама збирається на canvas */
.poster { transition: opacity .6s var(--ease); }
.intro .poster { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .js-reveal :is(.top, .bar, .scene--hero > *, [data-reveal].is-in, [data-reveal].is-in .btn) { animation-name: enter-fade !important; }
}
