/* ============================================================
   Иван Лушников — v3
   Тёмная база + вращающийся тессеракт (Three.js) + частицы.
   Структура v2: каждая цифра принадлежит своей компании.
   ============================================================ */

:root {
  --bg:          #0a0a0f;
  --bg-2:        #11111a;
  --fg:          #e7e7ee;
  --fg-dim:      #9b9bb0;
  --fg-faint:    #8b8b9f;
  --accent:      #3b82f6;
  --accent-2:    #60a5fa;
  --accent-glow: rgba(59, 130, 246, .4);
  --line:        rgba(255, 255, 255, .09);
  --line-soft:   rgba(255, 255, 255, .05);
  --glass:       rgba(255, 255, 255, .035);
  --glass-2:     rgba(255, 255, 255, .06);
  /* Панель под текстом. Главное правило читаемости:
     анимация живёт в полях и за заголовками, но НЕ под буквами.
     Без этого линии тессеракта идут сквозь текст. */
  --panel:       rgba(13, 14, 21, .9);
  --panel-edge:  rgba(255, 255, 255, .10);
  --award:       #fbbf24;
  --award-wash:  rgba(251, 191, 36, .12);

  --serif: "PT Serif", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  --wrap: 1120px;
  --sec-y: clamp(60px, 8.5vw, 116px);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  -webkit-text-size-adjust: 100%;
  /* clip, а не hidden: не создаёт лишний скролл-контейнер */
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Фон ─── */
/* Фон — украшение. Приглушаем, чтобы он спорил с текстом
   только в пустых местах, а не под буквами. */
#bg {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none; opacity: .5;
}

/* Затемнение: по краям слабее (там видна анимация),
   в центре плотнее — там живёт текст. */
.bg-overlay {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 45% at 50% 50%, rgba(10,10,15,.86) 0%, rgba(10,10,15,.4) 70%, transparent 100%),
    linear-gradient(180deg, rgba(10,10,15,.45) 0%, rgba(10,10,15,.6) 50%, rgba(10,10,15,.8) 100%);
}

/* Полоса прогресса чтения */
.scroll-progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
  z-index: 100; pointer-events: none;
  transition: width .05s linear;
}

/* ─── Появление при скролле ─── */
.js-ready .reveal { opacity: 0; transform: translateY(18px); }
.js-ready .reveal.is-visible {
  opacity: 1; transform: none;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js-ready .reveal { opacity: 1 !important; transform: none !important; }
}

/* ─── Типографика ─── */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 48px);
}

.eyebrow {
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.section { padding-block: var(--sec-y); position: relative; z-index: 2; }
.section + .section { border-top: 1px solid var(--line-soft); }

.sec-head {
  margin-bottom: clamp(34px, 5vw, 60px);
  max-width: 640px;
  padding: 26px 30px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

.sec-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.14;
  letter-spacing: -.015em;
  text-wrap: balance;
}

a { color: var(--accent-2); text-decoration-color: rgba(96, 165, 250, .35); text-underline-offset: 3px; }
a:hover { color: #93c5fd; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 12px 18px; z-index: 100;
  border-radius: 0 0 6px 0; font-size: 15px;
}
.skip:focus { left: 0; }

/* ─── Панель ─── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 10, 15, .72);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background-color .25s ease;
}
body.scrolled .topbar { border-bottom-color: var(--line-soft); background: rgba(10, 10, 15, .88); }

.topbar-in { display: flex; align-items: center; gap: 20px; min-height: 62px; }

.brand {
  font-family: var(--serif); font-size: 17px;
  color: var(--fg); text-decoration: none; white-space: nowrap;
}

.nav { display: flex; gap: 26px; margin-left: auto; }
.nav a {
  font-size: 15px; color: var(--fg-dim); text-decoration: none;
  padding-block: 4px; border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.nav a:hover { color: var(--fg); border-bottom-color: var(--accent-2); }

@media (max-width: 760px) {
  .nav { display: none; }
  .topbar-in { justify-content: space-between; }
}

/* ─── Кнопки ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid transparent;
  font-family: var(--sans); font-size: 15px; font-weight: 500; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.btn-solid {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 4px 20px rgba(59, 130, 246, .28);
}
.btn-solid:hover { transform: translateY(-1px); box-shadow: 0 7px 26px rgba(59, 130, 246, .4); color: #fff; }

.btn-quiet { background: var(--glass); color: var(--fg); border-color: var(--line); }
.btn-quiet:hover { background: var(--glass-2); border-color: rgba(96, 165, 250, .45); color: var(--fg); }

/* ─── Первый экран ─── */
.hero { padding-block: clamp(52px, 8vw, 96px) clamp(44px, 6vw, 76px); position: relative; z-index: 2; }

/* Мягкий скрим под текстом первого экрана: гасит анимацию
   ровно настолько, чтобы имя читалось, но оставляет её видимой. */
.hero::before {
  content: "";
  position: absolute;
  inset: -20% 0 0 0;
  background: radial-gradient(ellipse 65% 60% at 42% 42%, rgba(10,10,15,.9) 0%, rgba(10,10,15,.6) 55%, transparent 82%);
  pointer-events: none;
  z-index: -1;
}

.hero-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  column-gap: clamp(32px, 5vw, 72px);
  row-gap: 0;
  align-items: start;
}
.hero-in > *:not(.hero-photo) { grid-column: 1; }

.hero-name {
  margin-bottom: 22px;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(44px, 8vw, 84px); line-height: 1.02; letter-spacing: -.025em;
  text-shadow: 0 2px 40px rgba(10, 10, 15, .9);
}

.hero-lead {
  margin-bottom: 26px; max-width: 30ch;
  font-family: var(--serif);
  font-size: clamp(20px, 2.5vw, 27px); line-height: 1.34; letter-spacing: -.01em;
  text-wrap: pretty;
  text-shadow: 0 2px 24px rgba(10, 10, 15, .9);
}

.hero-now { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 34px; color: var(--fg-dim); }

.hero-now-tag, .path-row.is-now .path-company::after {
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(59, 130, 246, .14);
  border: 1px solid rgba(96, 165, 250, .3);
  border-radius: 5px; padding: 3px 8px;
}

.hero-metrics {
  display: flex; flex-wrap: wrap; gap: 14px 44px;
  padding-top: 26px; border-top: 1px solid var(--line); margin-bottom: 34px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-photo { grid-column: 2; grid-row: 1 / span 6; }
.hero-photo img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.hero-photo figcaption { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--fg-faint); }

@media (max-width: 860px) {
  .hero-in { grid-template-columns: 1fr; }
  .hero-photo { grid-column: 1; grid-row: auto; max-width: 240px; }
  .hero-lead { max-width: 100%; }
}

/* ─── Метрика ─── */
.metric { display: flex; flex-direction: column; gap: 4px; }

.metric-val {
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 30px); line-height: 1.12; letter-spacing: -.015em;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--fg); white-space: nowrap;
  text-shadow: 0 2px 22px rgba(10, 10, 15, .85);
}

.metric-label { font-size: 13px; line-height: 1.4; color: var(--fg-faint); max-width: 22ch; }

.metric-val.is-award {
  font-family: var(--sans); font-size: 15px; font-weight: 600; letter-spacing: 0;
  color: var(--award); background: var(--award-wash);
  border: 1px solid rgba(251, 191, 36, .3);
  border-radius: 5px; padding: 4px 10px; align-self: flex-start; white-space: normal;
  text-shadow: none;
}

/* ─── Путь ─── */
.path { list-style: none; }

.path-row {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(20px, 4vw, 56px);
  padding: 30px 28px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.path-row:first-child { margin-bottom: 16px; }

.path-meta { display: flex; flex-direction: column; gap: 5px; }

.path-period {
  font-size: 13px; font-weight: 500; letter-spacing: .04em;
  color: var(--fg-faint); font-variant-numeric: tabular-nums;
}

.path-company {
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 28px); line-height: 1.15; letter-spacing: -.015em;
  color: var(--fg);
}

.path-role { font-size: 15px; line-height: 1.45; color: var(--fg-dim); }

.path-row.is-now .path-company::after {
  content: "сейчас"; display: inline-block; vertical-align: middle;
  margin-left: 10px; position: relative; top: -3px;
}

.path-body p {
  margin-bottom: 20px; max-width: 60ch; color: var(--fg-dim); text-wrap: pretty;
  text-shadow: 0 1px 16px rgba(10, 10, 15, .8);
}
.path-body strong { color: var(--fg); font-weight: 600; }

.path-row.is-plain .path-body p { margin-bottom: 0; font-size: 16px; color: var(--fg-faint); }

.row-metrics {
  display: flex; flex-wrap: wrap; gap: 20px 40px;
  padding-top: 20px; border-top: 1px solid var(--line-soft); margin-bottom: 18px;
}

.textlink {
  font-size: 14px; font-weight: 500; color: var(--accent-2); text-decoration: none;
  border-bottom: 1px solid rgba(96, 165, 250, .38); padding-bottom: 1px;
  transition: border-color .18s ease, color .18s ease;
}
.textlink:hover { border-bottom-color: var(--accent-2); color: #93c5fd; }

@media (max-width: 780px) {
  .path-row { grid-template-columns: 1fr; gap: 16px; padding-block: 32px; }
  .path-meta { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
  .path-period { order: 1; } .path-company { order: 2; }
  .path-role { order: 3; flex-basis: 100%; }
}

/* ─── Кейсы ─── */
.case {
  padding: clamp(26px, 3.5vw, 40px);
  margin-bottom: clamp(20px, 3vw, 28px);
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .35);
}
.case:first-of-type { margin-bottom: clamp(20px, 3vw, 28px); }
.case + .case { margin-top: 0; }

.case-head { margin-bottom: 28px; max-width: 780px; }

.case-co {
  margin-bottom: 12px; font-size: 13px; font-weight: 500;
  letter-spacing: .04em; color: var(--accent-2);
}

.case-title {
  margin-bottom: 12px;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(25px, 3.4vw, 36px); line-height: 1.16; letter-spacing: -.018em;
  text-wrap: balance;
}

.case-sub { font-size: 16px; color: var(--fg-dim); max-width: 62ch; }

.case-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 3.5vw, 48px); margin-bottom: 28px;
}

.case-col h4 {
  margin-bottom: 12px; font-size: 12px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--fg-faint);
}

.case-col p { font-size: 16px; line-height: 1.6; color: var(--fg-dim); text-wrap: pretty; }

.case-col ul { list-style: none; }
.case-col li {
  position: relative; padding-left: 18px; margin-bottom: 10px;
  font-size: 16px; line-height: 1.55; color: var(--fg-dim);
}
.case-col li:last-child { margin-bottom: 0; }
.case-col li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 6px; height: 1px; background: var(--accent-2);
}

.case-metrics {
  display: flex; flex-wrap: wrap; gap: 20px 44px;
  padding: 24px 26px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

@media (max-width: 900px) { .case-grid { grid-template-columns: 1fr; gap: 26px; } }

/* ─── Публично ─── */
.media-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px); align-items: start; margin-bottom: 40px;
}

.facade {
  position: relative; display: block; width: 100%; padding: 0;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--bg-2); cursor: pointer; line-height: 0;
  transition: border-color .2s ease, transform .2s ease;
}
.facade:hover { border-color: rgba(96, 165, 250, .5); transform: translateY(-2px); }
.facade img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.facade-play {
  position: absolute; inset: 0; margin: auto;
  width: 66px; height: 66px; border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 4px 26px rgba(0, 0, 0, .5);
  transition: transform .2s var(--ease), background-color .2s ease;
}
.facade-play::after {
  content: ""; position: absolute; top: 50%; left: 54%;
  border-left: 17px solid #0a0a0f;
  border-top: 11px solid transparent; border-bottom: 11px solid transparent;
  transform: translate(-50%, -50%);
}
.facade:hover .facade-play { transform: scale(1.08); background: #fff; }

/* Плеер заменяет кнопку, поэтому селектор не может быть
   вложенным в .facade — иначе после подмены правила отваливаются
   и iframe остаётся стандартного размера 300×150. */
.facade iframe, .media-video iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 12px;
  background: var(--bg-2);
}

.media-caption { margin-top: 14px; }
.media-title { margin-bottom: 3px; font-size: 17px; font-weight: 600; }
.media-sub { font-size: 14px; color: var(--fg-faint); }

.media-fallback { margin-top: 10px; font-size: 14px; }
.media-fallback a { color: var(--fg-faint); text-decoration-color: rgba(255,255,255,.2); transition: color .18s ease; }
.media-fallback a:hover { color: var(--accent-2); }

.media-list { list-style: none; display: grid; gap: 8px; }
.media-list li {
  display: grid; grid-template-columns: 78px minmax(0, 1fr);
  gap: 4px 14px;
  padding: 15px 18px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.media-list li:first-child { padding-top: 15px; }

.media-kind {
  grid-row: span 2; align-self: start; padding-top: 2px;
  font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--fg-faint);
}

.media-list a {
  font-size: 16px; font-weight: 500; color: var(--fg); text-decoration: none;
  transition: color .18s ease;
}
.media-list a:hover { color: var(--accent-2); }

.media-when { font-size: 14px; color: var(--fg-faint); }

@media (max-width: 880px) { .media-grid { grid-template-columns: 1fr; } }

.award-shot { max-width: 560px; }
.award-shot img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
}
.award-shot figcaption { margin-top: 12px; font-size: 14px; line-height: 1.55; color: var(--fg-faint); max-width: 56ch; }

/* ─── Стек ─── */
.stack { display: grid; gap: 10px; }
.stack > div {
  display: grid; grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px 32px;
  padding: 20px 26px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.stack dt { font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--fg-faint); padding-top: 3px; }
.stack dd { font-size: 16px; line-height: 1.6; color: var(--fg-dim); }

@media (max-width: 700px) { .stack > div { grid-template-columns: 1fr; gap: 6px; } }

/* ─── Контакты ─── */
.section-contact { padding-bottom: clamp(52px, 7vw, 88px); }

.contact-lead {
  margin-bottom: 34px; max-width: 62ch;
  font-size: clamp(17px, 2vw, 19px); line-height: 1.58; color: var(--fg-dim);
}

.contact-list { list-style: none; display: grid; gap: 10px; }
.contact-list a {
  display: grid; grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px 24px; align-items: baseline;
  padding: 20px 26px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-decoration: none; color: var(--fg);
  transition: border-color .18s ease, transform .18s var(--ease), background-color .18s ease;
}
.contact-list a:hover {
  transform: translateX(4px);
  border-color: rgba(96, 165, 250, .45);
  background: rgba(20, 24, 38, .88);
}

.contact-kind { font-size: 13px; font-weight: 500; letter-spacing: .04em; color: var(--fg-faint); }
.contact-val {
  font-family: var(--serif);
  font-size: clamp(19px, 2.4vw, 24px); letter-spacing: -.01em;
  color: var(--fg); word-break: break-word;
}

@media (max-width: 640px) { .contact-list a { grid-template-columns: 1fr; gap: 4px; } }

/* ─── Подвал ─── */
.footer { border-top: 1px solid var(--line-soft); background: rgba(10, 10, 15, .6); position: relative; z-index: 2; }
.footer-in {
  display: flex; flex-wrap: wrap; gap: 8px 32px;
  justify-content: space-between; padding-block: 28px;
}
.footer p { font-size: 13px; color: var(--fg-faint); }