:root {
  /* Палитра референса match.jpg: тёмно-синяя сцена */
  --bg: #3a4f6b;            /* тон неба с референса match.jpg (loader) */
  --title: #3C3C54;         /* тёмные заголовки (не читаемы на тёмном — не используется) */
  --text: #ffffff;          /* основной текст */
  --muted: rgba(255, 255, 255, 0.6);
  --project-text: rgba(255, 255, 255, 0.78);
  --line: rgba(255, 255, 255, 0.22);
  --panel: rgba(12, 20, 36, 0.45);
  --accent: #3C3C54;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  width: 100%;
  min-height: 100%;
}

.click { cursor: pointer; }
a { color: inherit; }

/* ---------- 3D canvas ---------- */
.scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: pan-y;
}

/* ---------- Loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.7s ease, visibility 0.7s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__text {
  font-size: 13px;
  letter-spacing: 0.35em;
  color: var(--muted);
}

/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 28px;
  pointer-events: none;
}
.header a, .header button { pointer-events: auto; }

.header__logo {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--text);
  text-decoration: none;
}
.header__logo-dot { color: var(--muted); margin: 0 2px; }

.header__nav {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header__nav-label {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.header__link {
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s, color 0.25s;
}
.header__link:hover {
  border-color: var(--text);
  color: #8fd8ff;
}

.header__follow {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header__follow-label {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.header__social {
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s, color 0.25s;
}
.header__social:hover { border-color: var(--text); }

/* ---------- Scroll content ---------- */
.main {
  position: relative;
  z-index: 10;
  pointer-events: none; /* клики проходят на canvas, кроме интерактивных элементов */
}
.main a, .main button { pointer-events: auto; }

.section {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.section--hero {
  align-items: flex-end;
  /* Контент прижат к низу: БОЛЬШЕ padding-bottom = выше панель */
  padding-bottom: 40vh;
}

/* Меню-список прямо под рамкой манифеста (та же правая колонка) */
.hero__nav {
  width: min(420px, 88vw);
  margin: 16px clamp(10px, 2vw, 28px) 0 auto; /* та же правая граница, что у рамки */
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  padding: 14px 24px;
  /* подложка + NEON-КРАЯ: красное свечение по периметру (внешнее
     + внутреннее), при hover «замораживается» в сине-морозное */
  background: var(--panel);
  border: 1px solid rgba(255, 68, 51, 0.4);
  box-shadow:
    0 0 12px rgba(255, 42, 30, 0.25),
    0 0 34px rgba(255, 42, 30, 0.12),
    inset 0 0 16px rgba(255, 42, 30, 0.08);
  backdrop-filter: blur(6px);
  transition: border-color 0.4s, box-shadow 0.4s;
}
/* рамка всегда с КРАСНЫМ glow; при hover — только ярче */
.hero__nav:hover {
  border-color: rgba(255, 68, 51, 0.6);
  box-shadow:
    0 0 16px rgba(255, 42, 30, 0.35),
    0 0 48px rgba(255, 42, 30, 0.18),
    inset 0 0 20px rgba(255, 42, 30, 0.12);
}
/* Ссылки меню: hover = «сканлайн»-пробег + подчёркивание-протяжка
   + раскладка букв — всё на чистом CSS, без JS */
.hero__nav-link {
  position: relative;
  display: inline-block;
  overflow: hidden;
  font-size: 13px;
  letter-spacing: 0.3em;
  /* по умолчанию — «морозная» синева */
  color: #bfeaff;
  text-decoration: none;
  text-shadow: 0 0 6px rgba(143, 216, 255, 0.6), 0 0 18px rgba(120, 190, 255, 0.3);
  transition: letter-spacing 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.3s, text-shadow 0.3s;
}
/* сканлайн: световая полоса, пробегающая слева направо */
.hero__nav-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 110, 90, 0.35) 50%, transparent 100%);
  transform: translateX(-110%);
  transition: transform 0.65s cubic-bezier(0.3, 0, 0.2, 1);
  pointer-events: none;
}
/* длинное подчёркивание — ВСЕГДА видно (морозно-синее),
   при hover перекрашивается в красный */
.hero__nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: #8fd8ff;
  box-shadow: 0 0 8px rgba(143, 216, 255, 0.8);
  transform-origin: left center;
  transition: background 0.3s, box-shadow 0.3s;
}
.hero__nav-link:hover::after {
  background: #ff6a55;
  box-shadow: 0 0 8px rgba(255, 90, 60, 0.85);
}
/* hover — красный неон */
.hero__nav-link:hover {
  color: #ff8f7f;
  letter-spacing: 0.45em;
  text-shadow: 0 0 8px rgba(255, 90, 60, 0.95), 0 0 26px rgba(255, 60, 35, 0.55);
}
.hero__nav-link:hover::before { transform: translateX(110%); }

@media (prefers-reduced-motion: reduce) {
  .hero__nav-link, .hero__nav-link::before, .hero__nav-link::after {
    transition: none;
  }
  .hero__nav-link::before { display: none; }
}

.section__inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Manifesto ----------
   Колонка в правой части экрана; тёмный полупрозрачный фон (как у
   .co__head), чтобы буквы не сливались со сценой; стиль текста — как у
   «Click to explore» (13px, letter-spacing 0.3em), но без мигания */
.manifesto {
  width: min(420px, 88vw);
  margin: 0 clamp(10px, 2vw, 28px) 0 auto; /* у правого края, вровень с шапкой */
  padding: 20px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.manifesto__title {
  display: block;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin-bottom: 14px;
}
.manifesto__text {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.3em;
  line-height: 1.9;
  color: var(--text);
  /* max-width: 38ch УБРАН — он обрезал фразу посреди строки;
     теперь каждая фраза умещается в ширину панели целиком */
  margin: 0;
}

/* ---------- Portfolio cards ---------- */
.co {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}
/* обе статьи по правому краю — см. .co__body (margin-left: auto) */

.co__head {
  display: inline-flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(4px);
}
.co__title {
  font-size: 13px;
  letter-spacing: 0.25em;
  color: var(--text);
  text-transform: uppercase;
}
.co__date {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
  white-space: nowrap;
}

/* Статья — аккуратно в правой части экрана (машина слева, текст справа) */
.co__body {
  width: min(480px, 88vw);
  margin-left: auto;
  margin-right: clamp(18px, 4vw, 72px);
  padding: 26px 4px 32px;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

/* Буквы-спаны для эффекта «разлёта» при наведении */
.ltr-word {
  display: inline-block;
  white-space: nowrap; /* перенос — только между словами */
}
.ltr {
  display: inline-block;
  transition: transform 0.6s cubic-bezier(0.22, 0.9, 0.28, 1), opacity 0.6s ease;
}
.co__body.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.co__section-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--text);
  margin: 0 0 12px;
}
.co__section-title--mt { margin-top: 28px; }

.co__text {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--project-text);
  margin: 0 0 16px;
}

.co__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}
.co__links a {
  font-size: 13px;
  letter-spacing: 0.15em;
  color: var(--text);
  text-decoration: none;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s;
}
.co__links a:hover { border-color: var(--text); }

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 28px;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
  pointer-events: none;
}

/* ---------- Hint ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.hint.is-hidden { opacity: 0; }
.hint__main {
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--text);
  animation: pulse 2.4s ease-in-out infinite;
}
.hint__sub {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- Explode button ---------- */
.explode-btn {
  position: fixed;
  right: 28px;
  bottom: 26px;
  z-index: 20;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px 18px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: border-color 0.25s, background 0.25s;
}
.explode-btn:hover { border-color: var(--text); }
.explode-btn[aria-pressed="true"] {
  background: rgba(143, 216, 255, 0.18);
  border-color: rgba(143, 216, 255, 0.8);
}

/* ---------- Fallback ---------- */
body.no-webgl::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 60%, #6f87ac 0 18%, transparent 19%),
    radial-gradient(circle at 50% 75%, #2c3c58 0 40%, transparent 41%);
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .header { padding: 16px 18px; }
  .header__follow-label, .header__nav-label { display: none; }
  .section__inner, .co { padding: 0 18px; }
  .co__body, .manifesto, .hero__nav { width: 88vw; margin-right: 0; }
  /* на узких экранах сжимаем трекинг, чтобы фразы не ломались */
  .manifesto__text { font-size: 11px; letter-spacing: 0.2em; }
  .section--hero { padding-bottom: 50vh; }
  .explode-btn { right: 18px; bottom: 18px; }
  .hint { bottom: 74px; }
  .footer { padding: 20px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hint__main { animation: none; }
}
