:root {
  --yellow: #f7d133;
  --night: #050505;
  --ink: #0d0d0d;
  --paper: #ffffff;
  --muted: #737373;
  --line: #e0e0e0;
  --invert: 0; /* 0 → 1 наприкінці 3D-історії, виставляє main.js */
  --font-display: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(16px, 4vw, 56px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.035em; margin: 0; }
em { font-style: normal; color: var(--yellow); }

/* ——— шапка ——— */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px var(--gutter);
  color: #fff;
  transition: color 0.4s, background 0.4s;
}
.site-header.is-light { color: var(--ink); }
.site-header.is-solid {
  background: rgb(255 255 255 / 0.85);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; }
.brand__logo { display: block; height: 20px; width: auto; }
.site-nav { display: flex; align-items: center; gap: 28px; font-size: 14px; }
.site-nav a:not(.btn) { opacity: 0.7; transition: opacity 0.2s; }
.site-nav a:not(.btn):hover { opacity: 1; }

/* Кутові мітки-«видошукач»: 8 штрихів градієнтами, колір — --tick */
.btn::before,
.products__grid::before {
  content: "";
  --len: 7px;
  background:
    linear-gradient(var(--tick), var(--tick)) top left / var(--len) 1px,
    linear-gradient(var(--tick), var(--tick)) top left / 1px var(--len),
    linear-gradient(var(--tick), var(--tick)) top right / var(--len) 1px,
    linear-gradient(var(--tick), var(--tick)) top right / 1px var(--len),
    linear-gradient(var(--tick), var(--tick)) bottom left / var(--len) 1px,
    linear-gradient(var(--tick), var(--tick)) bottom left / 1px var(--len),
    linear-gradient(var(--tick), var(--tick)) bottom right / var(--len) 1px,
    linear-gradient(var(--tick), var(--tick)) bottom right / 1px var(--len);
  background-repeat: no-repeat;
}

.btn {
  --tick: var(--ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-radius: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.btn::before {
  content: "";
  position: absolute;
  inset: -5px;
  pointer-events: none;
  opacity: 0.3;
  transition: inset 0.25s, opacity 0.25s;
}
.btn::after { content: "→"; transition: transform 0.25s; }
.btn:hover::before { inset: -8px; opacity: 1; }
.btn:hover::after { transform: translateX(3px); }
.btn--primary { background: var(--yellow); color: var(--ink); }
.btn--sm { gap: 8px; padding: 9px 14px; font-size: 11px; }
.site-header:not(.is-light) .btn { --tick: #fff; }

/* ——— 3D-історія ——— */
.story { position: relative; height: 380vh; }
/* Доки content.js не підставив тексти з адмінки — ховаємо їх і пункти меню, щоб не блимали старі значення */
.cms-pending [data-cms],
.cms-pending .site-nav a:not(.btn) { visibility: hidden; }
/* Продукти вимкнені в адмінці: без карток, кадру з логотипами й пунктів меню (жовта кнопка лишається) */
.no-products .site-nav a:not(.btn),
.no-products .products,
.no-products .story__step--under { display: none; }
/* Без продуктів сайт (прозорий) заїжджає на сцену ще під час переходу в білий — без порожнього білого кадру.
   Наскільки саме він заходить на сцену (margin-top), рахує main.js. */
.no-products .site { background: transparent; }
.story__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--night);
  perspective: 900px; /* точка сходу — центр кадру, як у потоку частинок */
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.story__stage.is-idle { background: var(--paper); }
.story__stage.is-idle #scene { visibility: hidden; }

/* Тексти внизу кадру, щоб не перекривати кільце й кулі в центрі */
.story__step {
  position: absolute;
  left: var(--gutter);
  bottom: 10vh;
  max-width: 760px;
  color: #fff;
  pointer-events: none;
  visibility: hidden;
}
.story__step--center { left: 0; right: 0; bottom: auto; top: 50%; translate: 0 -50%; margin: 0 auto; text-align: center; max-width: 900px; padding: 0 16px; }
.story__step--right { left: auto; right: var(--gutter); text-align: right; }
.story__step--bottom { left: 0; right: 0; margin: 0 auto; text-align: center; }
.story__step--ink { color: var(--ink); }
.story__step--kicker {
  left: 0;
  right: 0;
  bottom: calc(50% + var(--signal-top, 12vh) + 16px);
  margin: 0 auto;
  padding: 0 16px;
  text-align: center;
}

/* Під трьома логотипами з частинок; --logos-bottom рахує main.js */
.story__step--under {
  left: 0;
  right: 0;
  bottom: auto;
  top: calc(50% + var(--logos-bottom, 12vh) + clamp(40px, 8vh, 88px));
  max-width: none;
  margin: 0 auto;
  padding: 0 16px;
  text-align: center;
}
.story .story__step--under h2 { font-size: clamp(28px, 3.6vw, 52px); }

/* Фрази з глибини: кожне слово рухається по z окремо, тож 3D має доходити до нього */
[data-depth] { transform: rotateY(var(--tilt-y, 0)) rotateX(var(--tilt-x, 0)); }
[data-depth], [data-depth] * { transform-style: preserve-3d; }
[data-depth] .w { display: inline-block; will-change: transform, opacity, filter; }

.story h1 { font-size: clamp(48px, 9vw, 128px); line-height: 0.95; }
.story h2 { font-size: clamp(32px, 5vw, 64px); line-height: 1.05; text-wrap: balance; }
.lede { margin: 20px 0 0; font-size: clamp(16px, 1.6vw, 20px); color: #c7c7c7; }

.scroll-hint {
  display: inline-block;
  margin-top: 48px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.5;
}
.scroll-hint::after {
  content: "";
  display: block;
  width: 1px;
  height: 40px;
  margin: 12px auto 0;
  background: currentColor;
  animation: hint 1.8s ease-in-out infinite;
}
@keyframes hint {
  0%, 100% { transform: scaleY(0.3); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
}

/* ——— білий сайт ——— */
.site { position: relative; background: var(--paper); }

/* Фінальний кадр сцени. --reveal (0..1) виставляє main.js: тексти карток проступають,
   а іконки вмикаються лише тоді, коли точкові логотипи вже лягли на їхні місця (--swap). */
.story__anchor { position: absolute; bottom: 0; height: 100vh; height: 100svh; pointer-events: none; }
.products {
  --reveal: 0;
  --swap: 0;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 88px var(--gutter) 40px;
  color: var(--ink);
  visibility: hidden;
}
.products.is-on { visibility: visible; }
/* Підпис під картками — проступає останнім, коли картки вже на місці */
.story .products__title {
  margin-top: clamp(32px, 7vh, 72px);
  text-align: center;
  font-size: clamp(28px, 3.6vw, 52px);
  opacity: var(--reveal);
  translate: 0 calc((1 - var(--reveal)) * 16px);
}
/* Картки прозорі: під ними на canvas якраз сідають точкові логотипи. Лінії — бордерами, а не фоном сітки. */
.product + .product { border-left: 1px solid rgb(224 224 224 / var(--reveal)); }
.product > :not(.product__logo) { opacity: var(--reveal); translate: 0 calc((1 - var(--reveal)) * 12px); }
.product__logo { opacity: var(--swap); }
.products__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgb(224 224 224 / var(--reveal));
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
}
.products__grid::before { position: absolute; inset: -9px; pointer-events: none; --tick: var(--muted); --len: 10px; opacity: var(--reveal); }
.product {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 36px 32px;
  background: transparent;
  transition: background 0.3s;
}
.product:hover { background: rgb(0 0 0 / 0.02); }

.product__logo { width: 56px; height: 56px; margin-bottom: 20px; transition: transform 0.3s; }
.product:hover .product__logo { transform: scale(1.08) rotate(-4deg); }
.product h3 { font-size: 36px; }
.product__lead { margin: 0; font-size: 18px; font-weight: 500; }
.product p:not([class]) { margin: 0; color: var(--muted); flex: 1; }
.link {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--yellow);
  align-self: flex-start;
  padding-bottom: 3px;
}
.link::after { content: "→"; display: inline-block; margin-left: 8px; transition: transform 0.25s; }
.link:hover::after { transform: translateX(3px); }

.approach {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  padding: 96px var(--gutter);
  max-width: 1280px;
  margin: 0 auto;
}
.approach h2 { font-size: clamp(36px, 5vw, 64px); line-height: 1.05; }
.approach__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: step; }
.approach__steps li { position: relative; padding: 24px 0 24px 56px; border-top: 1px solid var(--line); color: var(--muted); counter-increment: step; }
.approach__steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 30px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.approach__steps li:last-child { border-bottom: 1px solid var(--line); }
.approach__steps .step__label { display: block; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 4px; }

/* Ледь помітна сітка точок, що згасає до країв */
.cta { position: relative; isolation: isolate; text-align: center; padding: 120px var(--gutter); }
.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle, #d4d4d4 1px, transparent 1.2px) center / 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%);
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%);
}
.cta h2 { font-size: clamp(40px, 7vw, 96px); margin-bottom: 40px; }
.caret {
  display: inline-block;
  width: 0.08em;
  height: 0.8em;
  margin-left: 0.08em;
  background: var(--yellow);
  vertical-align: baseline;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ——— backed by / built by (як на wallchain.xyz) ——— */
.trust {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px 32px;
}
.story__step--trust { left: 0; right: 0; bottom: 28px; max-width: none; padding: 0 var(--gutter); }
.story__step--bottom { bottom: calc(10vh + 56px); }
.trust__item { display: flex; align-items: center; gap: 16px; }
.trust__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8a8a;
  white-space: nowrap;
}
.trust__logo { display: block; height: 20px; width: auto; opacity: 0.7; transform: translateY(-1px); }
.trust__link { pointer-events: auto; display: block; }
.trust__link .trust__logo { transition: opacity 0.2s ease; }
.trust__link:hover .trust__logo, .trust__link:focus-visible .trust__logo { opacity: 1; }
.trust__divider { width: 1px; height: 20px; background: rgba(163, 163, 163, 0.5); }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 32px var(--gutter);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

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

/* Невисокий екран: опис ховаємо, щоб кадр не вилазив за висоту сцени */
@media (max-height: 760px) {
  .product p:not([class]) { display: none; }
  .product { gap: 8px; padding: 28px 28px; }
  .product h3 { font-size: 30px; }
}

@media (max-width: 860px) {
  /* Картки — рядками: іконка ліворуч, текст праворуч; опис ховаємо */
  .products { padding-top: 80px; }
  .story .products__title { margin-top: 24px; font-size: 26px; }
  .products__grid { grid-template-columns: 1fr; }
  .product + .product { border-left: 0; border-top: 1px solid rgb(224 224 224 / var(--reveal)); }
  .product { display: grid; grid-template-columns: 48px 1fr; column-gap: 20px; row-gap: 4px; padding: 22px 20px; }
  .product > :not(.product__logo) { grid-column: 2; }
  .product__logo { grid-row: 1 / span 3; width: 48px; height: 48px; margin: 0; }
  .product h3 { font-size: 26px; }
  .product__lead { font-size: 15px; }
  .product p:not([class]) { display: none; }
  .product .link { margin-top: 8px; }
  .approach { grid-template-columns: 1fr; }
  .site-nav a:not(.btn) { display: none; }
  .story__step--right { right: var(--gutter); left: var(--gutter); }
  .site-footer { flex-direction: column; }
  .trust { flex-direction: column; gap: 14px; }
  .trust__item { flex-direction: column; gap: 6px; }
  .trust__item { max-width: 100%; }
  .trust__logo { max-width: 100%; height: auto; }
  .story__step--bottom { bottom: calc(10vh + 120px); }
  .trust__divider { display: none; }
}
@media (max-width: 480px) {
  /* Довге лого «Wallchain Labs»: менше лого й кнопка в один рядок, щоб не налазили */
  .site-header { gap: 16px; }
  .brand__logo { height: 15px; }
  .site-header .btn { white-space: nowrap; padding: 12px 16px; }
}
@media (max-width: 360px) {
  .site-header { gap: 12px; }
  .brand__logo { height: 12px; }
  .site-header .btn { padding: 10px 12px; gap: 8px; letter-spacing: 0.06em; }
}
