/* WebCult — shared base: reset, preloader, reveal engine, cursor. */

:root {
  --bg: #131318;
  --acid: #C6FF3E;
  --acid-rgb: 198,255,62;
  --ink: #F2F2F0;
  --dim: #8B8B95;
  --ink-soft: #c9c9cf;
  --ink-on-acid: #05060a;
  --surface: #17171d;
  --surface-2: #202028;
  --border: #26262f;
  --border-strong: #383843;
  --danger: #ff6b6b;
  --glass-border: rgba(255,255,255,.08);
  --glass-bg: rgba(0,0,0,.45);
  --shadow: rgba(0,0,0,.5);
  --header-bg: rgba(19,19,24,.72);
  --dim-2: #4a4a54;
}

[data-theme="light"] {
  --bg: #F7F7F2;
  --acid: #4CAF50;
  --acid-rgb: 76,175,80;
  --ink: #101014;
  --dim: #6b6b74;
  --ink-soft: #52525b;
  --ink-on-acid: #05060a;
  --surface: #ffffff;
  --surface-2: #efefe8;
  --border: #e3e3dc;
  --border-strong: #d3d3c9;
  --danger: #c0392b;
  --glass-border: rgba(0,0,0,.08);
  --glass-bg: rgba(255,255,255,.6);
  --shadow: rgba(20,20,30,.08);
  --header-bg: rgba(255,255,255,.78);
  --dim-2: #9a9aa2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: var(--acid); color: var(--ink-on-acid); }

/* grain overlay */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
[data-theme="light"] body::after { opacity: 0.15; mix-blend-mode: soft-light; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); }
::-webkit-scrollbar-thumb:hover { background: var(--acid); }

/* ---------- PRELOADER ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(24px, 6vw, 90px);
  transition: opacity .6s ease, transform .8s cubic-bezier(.77,0,.175,1);
}
.preloader.is-done { opacity: 0; pointer-events: none; transform: translateY(-14px); }
.preloader::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(var(--acid-rgb),.03) 2px 3px);
}
.preloader__head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim);
  margin-bottom: 34px; position: relative; z-index: 2;
}
.preloader__status { display: inline-flex; align-items: center; gap: 10px; }
.preloader__status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acid); animation: bootPulse 1s infinite; }
@keyframes bootPulse { 50% { opacity: .3; } }
.preloader__log { position: relative; z-index: 2; max-width: 760px; }
.preloader__line {
  display: block; font-size: clamp(12px, 1.3vw, 15px); line-height: 2;
  color: var(--dim); white-space: nowrap; overflow: hidden;
  opacity: 0; transform: translateY(4px); animation: bootLn .1s forwards;
}
.preloader__line b { color: var(--acid); font-weight: 400; }
@keyframes bootLn { to { opacity: 1; transform: none; } }
.preloader__logo {
  font-family: 'Unbounded', sans-serif; font-weight: 800;
  font-size: clamp(56px, 11vw, 150px); line-height: .92; letter-spacing: -.04em;
  margin: 26px 0 18px; position: relative; z-index: 2;
  opacity: 0; animation: bootBig .5s 1.3s forwards;
}
.preloader__logo i { color: var(--acid); font-style: normal; }
.preloader__caret { display: inline-block; width: .09em; height: .82em; background: var(--acid); vertical-align: -3%; margin-left: .04em; animation: bootBlink .8s steps(2) infinite; }
@keyframes bootBig { to { opacity: 1; } }
@keyframes bootBlink { 50% { opacity: 0; } }
.preloader__meter { position: relative; z-index: 2; margin-top: 22px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); opacity: 0; animation: bootBig .5s 1.5s forwards; }
.preloader__meter-track { height: 2px; background: var(--border); position: relative; overflow: hidden; }
.preloader__meter-track i { position: absolute; inset: 0; width: 0; background: var(--acid); animation: bootFill 1.5s 1.3s cubic-bezier(.77,0,.175,1) forwards; }
@keyframes bootFill { to { width: 100%; } }
.preloader__meter-value { color: var(--acid); }
.preloader__foot { position: absolute; bottom: 26px; left: clamp(24px,6vw,90px); right: clamp(24px,6vw,90px);
  display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); z-index: 2; }
@media (max-width: 640px) { .preloader__line { white-space: normal; } .preloader__foot { display: none; } }

/* app fade-in */
.site { opacity: 0; transition: opacity .7s ease; }
.site.is-visible { opacity: 1; }

/* ---------- VEIL: быстрая шторка для повторных заходов и внутренних страниц ---------- */
.veil {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: transform .5s cubic-bezier(.77,0,.175,1), visibility 0s .5s;
}
.veil::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(var(--acid-rgb),.03) 2px 3px);
}
.veil__logo {
  font-family: 'Unbounded', sans-serif; font-weight: 800;
  font-size: clamp(28px, 4.4vw, 44px); letter-spacing: -.04em; color: var(--ink);
  opacity: 0; transform: translateY(10px);
  animation: veilLogo .35s .05s cubic-bezier(.22,1,.36,1) forwards;
}
.veil__logo i { color: var(--acid); font-style: normal; }
@keyframes veilLogo { to { opacity: 1; transform: none; } }
.veil__bar { width: min(180px, 40vw); height: 2px; background: var(--border); overflow: hidden; border-radius: 1px; }
.veil__bar i { display: block; height: 100%; width: 100%; background: var(--acid); transform: scaleX(0); transform-origin: left; animation: veilFill .45s .1s cubic-bezier(.77,0,.175,1) forwards; }
@keyframes veilFill { to { transform: scaleX(1); } }
.veil__chart { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.veil__chart path {
  fill: none; stroke: var(--acid); stroke-width: .5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 200; stroke-dashoffset: 200;
  filter: drop-shadow(0 0 6px rgba(var(--acid-rgb),.5));
  animation: veilChart .6s .05s cubic-bezier(.22,1,.36,1) forwards;
}
@keyframes veilChart { to { stroke-dashoffset: 0; } }
.veil.is-done { transform: translateY(-100%); visibility: hidden; }
/* полный boot скрывается при повторном визите; шторка на главной — наоборот */
.is-return-visit .preloader { display: none; }
.home-veil { display: none; }
.is-return-visit .home-veil { display: flex; }

/* ---------- REVEAL UTILITIES ---------- */
[data-reveal] { opacity: 0; transform: translateY(40px); transition: opacity .9s cubic-bezier(.22,1,.36,1), transform .9s cubic-bezier(.22,1,.36,1); }
[data-reveal].is-visible { opacity: 1; transform: none; }
[data-reveal="fade"] { transform: none; }
[data-reveal="left"] { transform: translateX(-50px); }
[data-reveal="left"].is-visible { transform: none; }
[data-reveal="scale"] { transform: scale(.94); }
[data-reveal="scale"].is-visible { transform: none; }
[data-stagger] > * { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.22,1,.36,1), transform .7s cubic-bezier(.22,1,.36,1); }
[data-stagger] > *.is-visible { opacity: 1; transform: none; }

/* line-mask reveal for headings */
.heading-mask__line { display: block; overflow: hidden; padding-bottom: .06em; }
.heading-mask__text { display: block; transform: translateY(105%); transition: transform 1s cubic-bezier(.77,0,.175,1); }
.is-booted .heading-mask__text, .site.is-visible .heading-mask__text { transform: none; }
.heading-mask__line--1 .heading-mask__text { transition-delay: .05s; }
.heading-mask__line--2 .heading-mask__text { transition-delay: .15s; }

/* word rotator */
.word-rotator__word { display: inline-block; transition: opacity .4s, transform .4s; }
.word-rotator__word.is-leaving { opacity: 0; transform: translateY(-40%); }
.word-rotator__word.is-visible { animation: rotIn .5s cubic-bezier(.22,1,.36,1); }
@keyframes rotIn { from { opacity: 0; transform: translateY(40%); } to { opacity: 1; transform: none; } }

/* custom cursor — кольцо с примагничиванием к кнопкам */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--acid); background: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: width .3s cubic-bezier(.22,1,.36,1), height .3s cubic-bezier(.22,1,.36,1),
              border-radius .3s cubic-bezier(.22,1,.36,1), background .3s, border-color .3s, opacity .3s;
}
.cursor::before {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%;
  background: var(--acid); transition: opacity .3s;
}
.cursor.is-magnet { background: rgba(var(--acid-rgb), .1); }
.cursor.is-active { width: 96px; height: 96px; background: var(--acid); border-color: var(--acid); }
.cursor.is-active::before { opacity: 0; }
.cursor__label { font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-on-acid); opacity: 0; transition: opacity .2s; text-align: center; }
.cursor.is-active .cursor__label { opacity: 1; }

/* прячем системный курсор, когда включён кастомный (только для мыши) */
@media (pointer: fine) {
  .has-cursor, .has-cursor * { cursor: none; }
  .has-cursor input, .has-cursor textarea, .has-cursor select, .has-cursor [contenteditable="true"] { cursor: text; }
}

/* type caret */
.typewriter__caret { display: inline-block; width: .55em; height: 1.05em; background: var(--acid); vertical-align: -12%; margin-left: 2px; animation: bootBlink .8s steps(2) infinite; }

/* theme toggle */
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--ink);
  transition: border-color .2s, color .2s;
}
.theme-toggle:hover { border-color: var(--acid); color: var(--acid); }
.theme-toggle__icon { width: 16px; height: 16px; }
.theme-toggle__icon--moon { display: block; }
.theme-toggle__icon--sun { display: none; }
[data-theme="light"] .theme-toggle__icon--moon { display: none; }
[data-theme="light"] .theme-toggle__icon--sun { display: block; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  [data-reveal], [data-stagger] > *, .heading-mask__text { opacity: 1 !important; transform: none !important; }
}
