:root {
  --ink: #000;
  --paper: #fff;
  --fg: #fff;
  --bg: #000;
  --muted: rgba(255, 255, 255, 0.56);
  --line: rgba(255, 255, 255, 0.18);
  --accent: #ff4d00;
  --pad: clamp(16px, 2.6vw, 40px);
  --font: 'Inter Tight', system-ui, sans-serif;
  --ease: cubic-bezier(0.7, 0, 0.2, 1);
}
.light {
  --fg: #000;
  --bg: #fff;
  --muted: rgba(0, 0, 0, 0.55);
  --line: rgba(0, 0, 0, 0.14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  body, a, button { cursor: none; }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* WebGL */
.gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 1; }

/* Зерно поверх всего: делает 3D менее «компьютерным» */
.grain {
  position: fixed; inset: -50%; z-index: 60; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); } 75% { transform: translate(-1%, 3%); } 100% { transform: translate(3%, -1%); }
}

/* Подложка под шапкой: отдельный слой, потому что у самой шапки режим difference */
.nav-shade { position: fixed; top: 0; left: 0; right: 0; height: calc(var(--pad) * 2 + 96px); z-index: 39; pointer-events: none;
  background: linear-gradient(180deg, #000 0%, rgba(0,0,0,.92) 45%, rgba(0,0,0,0) 100%); }

/* Навигация */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: var(--pad); mix-blend-mode: difference; color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: -0.04em; }
.brand svg { width: 30px; height: 30px; }
.brand .dot { display: inline-block; width: 0.2em; height: 0.2em; background: currentColor; margin: 0 0.02em; }
.nav-links { display: flex; gap: 28px; font-size: 15px; font-weight: 500; }
.nav-links a { position: relative; overflow: hidden; display: inline-block; height: 1.2em; line-height: 1.2em; }
.nav-links a span { display: block; transition: transform 0.5s var(--ease); }
.nav-links a span::after { content: attr(data-t); display: block; }
.nav-links a:hover span { transform: translateY(-50%); }
.nav-right { justify-self: end; display: flex; align-items: center; gap: 24px; font-size: 15px; font-weight: 500; }
.clock { font-variant-numeric: tabular-nums; opacity: 0.7; }
.pill {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 20px;
  border: 1px solid currentColor; border-radius: 44px; font-weight: 500;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
.pill:hover { background: #fff; color: #000; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* Курсор */
.cursor, .cursor-ring { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; mix-blend-mode: difference; }
.cursor { width: 8px; height: 8px; margin: -4px 0 0 -4px; background: #fff; border-radius: 50%; }
.cursor-ring {
  width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 1px solid #fff; border-radius: 50%;
  display: grid; place-items: center; color: #000; font-size: 12px; font-weight: 600;
  transition: width 0.45s var(--ease), height 0.45s var(--ease), margin 0.45s var(--ease), background 0.45s var(--ease);
}
.cursor-ring span { opacity: 0; transition: opacity 0.3s; white-space: nowrap; }
.cursor-ring.is-hover { width: 96px; height: 96px; margin: -48px 0 0 -48px; background: #fff; }
.cursor-ring.is-hover span { opacity: 1; }
.cursor-ring.is-drag { width: 120px; height: 120px; margin: -60px 0 0 -60px; }
@media (hover: none), (pointer: coarse) { .cursor, .cursor-ring { display: none; } }

/* Прелоадер */
.loader {
  position: fixed; inset: 0; z-index: 90; background: #000; color: #fff;
  display: flex; align-items: flex-end; justify-content: space-between; padding: var(--pad);
}
.loader-count { font-size: clamp(80px, 18vw, 280px); font-weight: 800; letter-spacing: -0.05em; line-height: 0.8; font-variant-numeric: tabular-nums; }
.loader-mark { width: 64px; height: 64px; }
.loader-note { font-size: 15px; opacity: 0.6; max-width: 240px; text-align: right; }

/* Переключатель вариантов (служебный, только для согласования) */
.variants {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50;
  display: flex; gap: 4px; padding: 4px; border-radius: 40px;
  background: rgba(20, 20, 20, 0.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: #fff; font-size: 13px; font-weight: 500;
}
.variants a { padding: 9px 14px; border-radius: 30px; opacity: 0.6; transition: opacity 0.3s, background 0.3s; white-space: nowrap; }
.variants a:hover { opacity: 1; }
.variants a.on { background: #fff; color: #000; opacity: 1; }

/* Текстовые маски для появления строк */
.line-mask { overflow: hidden; display: block; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.line-mask > * { display: block; }

.scroll-hint { display: inline-flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.scroll-hint b { width: 1px; height: 40px; background: var(--line); position: relative; overflow: hidden; }
.scroll-hint b::after {
  content: ''; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--fg);
  animation: drip 1.8s var(--ease) infinite;
}
@keyframes drip { to { top: 100%; } }

@media (max-width: 860px) {
  .nav { grid-template-columns: 1fr auto; }
  .nav-links, .clock { display: none; }
  .variants { font-size: 12px; bottom: 12px; }
  .variants a { padding: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .scroll-hint b::after { animation: none; }
}
