/* ============================================================
   Лендинг-визитка «Дмитрий Куликов» — стили (SPEC §3, ADR-002)
   Тёмная премиум-тема #0A0F1E, акцент-градиент #4F8DFD → #22D3EE.
   ============================================================ */

/* ---------- Токены дизайн-системы (SPEC §3) ---------- */
:root {
  --bg: #0A0F1E;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-border: rgba(255, 255, 255, 0.08);
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --accent-1: #4F8DFD;
  --accent-2: #22D3EE;
  --accent-text: #7DD3FC;
  --radius: 20px;
  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --section-pad: clamp(80px, 12vw, 140px);
  --container-pad: clamp(20px, 5vw, 48px);
  --gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));
}

/* ---------- База ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* отступ под фиксированную шапку при переходе по якорям */
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0 0 0.6em;
}

p {
  margin: 0 0 1em;
}

p:last-child {
  margin-bottom: 0;
}

/* Видимые фокус-стили (SPEC §5 доступность) */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  fill: none;
}

/* Инлайн SVG-спрайт: скрыт визуально и из layout (валидная замена атрибуту hidden) */
.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

/* ---------- Типографика секций ---------- */
.overline {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin: 0 0 16px;
}

.hero .overline {
  color: var(--accent-text);
}

.section {
  padding-block: var(--section-pad);
}

/* Заголовки секций — одна строка на десктопе ≥1200px (SPEC v1.3):
   Unbounded исключительно широкий, поэтому потолок 2.6rem не вмещал
   40+ символов в контейнер 1104px. Рецепт: Manrope 700 (компактнее
   Unbounded при равном кегле ~ на 20-25%) + потолок 2.05rem.
   Перенос на мобиле — естественный (nowrap не используется). */
.section-title {
  font-family: var(--font-body);
  font-size: clamp(1.5rem, 2.6vw, 2.05rem);
  font-weight: 700;
  max-width: 1104px; /* контейнер 1200 − паддинги 2×48 */
  margin-bottom: clamp(32px, 5vw, 56px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  /* градиентный акцент на заголовках — тонко, читаемость прежде всего */
  background: linear-gradient(120deg, var(--text) 55%, var(--accent-text));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.section-sub {
  color: var(--text-muted);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  max-width: 640px;
  margin-top: -24px;
  margin-bottom: clamp(32px, 5vw, 56px);
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 700;
}

/* ---------- Шапка (glassmorphism, SPEC §4) ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  background: rgba(10, 15, 30, 0.75);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--surface-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 700;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--gradient);
  color: #0A0F1E;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
}

.logo-name {
  font-family: var(--font-display);
  font-size: 0.92rem;
}

.site-nav {
  display: flex;
  gap: clamp(16px, 2.5vw, 32px);
}

.site-nav a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 6px 2px;
}

.site-nav a:hover {
  color: var(--text);
}

/* Бургер: скрыт на десктопе */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  cursor: pointer;
}

.burger-line {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.burger[aria-expanded="true"] .burger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger[aria-expanded="true"] .burger-line:nth-child(2) {
  opacity: 0;
}

.burger[aria-expanded="true"] .burger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Hero (SPEC §4.1) ---------- */
.hero {
  position: relative;
  padding-block: clamp(140px, 18vh, 190px) var(--section-pad);
  overflow: hidden;
}

/* Фоновая декорация: тонкая сетка + радиальное свечение (CSS-only) */
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 60% 50% at 75% 20%, rgba(79, 141, 253, 0.16), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: auto, 64px 64px, 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 85%);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
}

.hero-sub {
  color: var(--text-muted);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  max-width: 560px;
  margin-bottom: 28px;
}

/* Строка целевых ролей (SPEC v1.6.4 §4.1): прижата к hero-sub, отделена от strip */
.hero-roles {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: -14px 0 24px;
}

/* Стрип мини-метрик */
.hero-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 36px;
}

.hero-strip li {
  padding: 7px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-text);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

/* CTA */
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--gradient);
  color: #0A0F1E;
}

.btn-primary:hover {
  box-shadow: 0 8px 32px rgba(79, 141, 253, 0.35);
}

.btn-ghost {
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent-text);
  color: var(--accent-text);
}

.btn .icon {
  width: 20px;
  height: 20px;
}

/* Фото в маске + градиентное свечение */
.hero-photo {
  position: relative;
  justify-self: center;
  width: min(100%, 420px);
}

.hero-photo::before {
  content: "";
  position: absolute;
  inset: -24px;
  border-radius: calc(var(--radius) + 24px);
  background: var(--gradient);
  opacity: 0.35;
  filter: blur(48px);
  z-index: 0;
}

.hero-photo img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  aspect-ratio: 1080 / 1350; /* CLS = 0 (SPEC §5) */
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ---------- Карточки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: clamp(24px, 3vw, 36px);
  transition: transform 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(125, 211, 252, 0.35);
  background: rgba(255, 255, 255, 0.06);
}

.card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.cards-grid {
  display: grid;
  gap: clamp(16px, 2.5vw, 28px);
}

.cards-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* v1.6.3 §4.2: 4 карточки «О себе» — сетка 2×2 */
.cards-grid-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ---------- Метрики (SPEC §4.3) ---------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.5vw, 28px);
  margin-bottom: 28px;
}

.metric {
  position: relative;
  overflow: hidden;
}

/* градиентная линия сверху карточки-метрики */
.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--gradient);
  opacity: 0.8;
}

.metric-value {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 12px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* фиксируем ширину цифр: не прыгает при count-up */
  font-variant-numeric: tabular-nums;
}

.metric-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* нижняя строка-плашка 4 шт. */
.mini-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 20px);
  list-style: none;
  padding: clamp(20px, 3vw, 28px);
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
}

.mini-strip li {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.mini-strip strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

/* ---------- Кейсы (SPEC §4.4) ---------- */
.case-tag {
  display: inline-block;
  padding: 5px 14px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: rgba(79, 141, 253, 0.12);
  border: 1px solid rgba(125, 211, 252, 0.25);
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* мелкая подпись-верификация на карточке кейса (SPEC §4.4, v1.5) */
.case-note {
  margin-top: 12px;
  margin-bottom: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* список в карточке кейса (v1.6.7): компактные отступы, единые с .case-note 12px;
   последний пункт — без нижнего отступа;
   v1.6.7 follow-up: цвет/размер однотипны с текстом карточек (.card p);
   доводка владельца: без буллетов — сами строки и визуальные переносы
   (li margin-bottom) остаются, маркеры и отступ под них убраны */
.case-list {
  margin: 0 0 12px;
  padding-left: 0;
  list-style: none;
}

.case-list li {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.case-list li:last-child {
  margin-bottom: 0;
}

/* v1.6.7 типографика: без «висячих» слов (text-wrap: pretty — прогрессивное
   улучшение, старые браузеры игнорируют) и без переносов внутри слов
   (hyphens: none явно — по умолчанию их и нет, фиксируем требование владельца). */
.card p,
.case-list li,
.timeline-item p,
.metric-label,
.case-note {
  text-wrap: pretty;
  hyphens: none;
}

.case-note + .text-link,
.text-link + .case-note {
  margin-top: 12px;
}

/* ---------- Таймлайн (SPEC §4.5) ---------- */
/* v1.6.7: двухколоночная раскладка позиции — мета+должность слева (~300px),
   текст справа до края контейнера; пустой правой трети больше нет
   (замечание владельца), ширина строки текста сохранена ~720px (читаемость). */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 clamp(24px, 3vw, 36px);
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-1), var(--accent-2), transparent);
}

.timeline-item {
  position: relative;
  padding-bottom: clamp(28px, 4vw, 44px);
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  column-gap: clamp(24px, 4vw, 48px);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

/* точка на оси */
.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1 * clamp(24px, 3vw, 36px) - 6px);
  top: 8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent-1);
  box-shadow: 0 0 14px rgba(79, 141, 253, 0.5);
}

.timeline-meta {
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  grid-column: 1;
  grid-row: 1;
}

.timeline-item h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
  grid-column: 1;
  grid-row: 2;
  align-self: start;
}

/* :not(.timeline-meta) обязателен: мета — тоже <p>, и селектор .timeline-item p
   (специфичность 0,1,1) перебивал .timeline-meta (0,1,0) — мета попадала
   в ячейку текста (grid-column: 2, row 1 / span 2) → наслоение текстов (v1.6.7 bugfix) */
.timeline-item > p:not(.timeline-meta) {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: none;
  grid-column: 2;
  grid-row: 1 / span 2;
}

/* ---------- Компетенции (SPEC §4.6) ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 2.5vw, 28px);
}

.skill {
  text-align: left;
}

.skill-icon {
  width: 32px;
  height: 32px;
  color: var(--accent-text);
  margin-bottom: 16px;
}

.skill h3 {
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
  color: var(--text);
}

/* ---------- Экспертность (SPEC §4.7) ---------- */
.card-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-text);
  margin-bottom: 16px;
}

.expertise-item p {
  margin-bottom: 12px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.text-link:hover {
  color: var(--text);
}

/* ---------- Контакты (SPEC §4.8, редизайн v1.2) ----------
   Единственная «перевёрнутая» секция: градиент --accent-1 → --accent-2,
   тёмный текст #0A0F1E (контраст ≥ 4,5:1 на обоих концах градиента). */
.section-contacts {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #0A0F1E;
}

/* фокус-стиль: тёмный контур заметнее на градиенте, чем циановый */
.section-contacts :focus-visible {
  outline-color: #0A0F1E;
}

.contacts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
}

.contacts-overline {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(10, 15, 30, 0.85);
  margin: 0 0 18px;
}

.contacts-title {
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  font-weight: 700;
  color: #0A0F1E;
  margin: 0 0 20px;
}

.contacts-title em {
  font-style: italic;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-decoration-color: rgba(10, 15, 30, 0.35);
  text-underline-offset: 10px;
}

.contacts-sub {
  color: rgba(10, 15, 30, 0.85);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  max-width: 560px;
  margin: 0 0 32px;
}

.contacts-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(16px, 3vw, 28px);
}

/* крупная тёмная пилюля — главная кнопка секции */
.btn-dark {
  background: #0A0F1E;
  color: var(--text);
  border-radius: 999px;
  padding: 18px 36px;
  font-size: 1.05rem;
}

.btn-dark:hover {
  box-shadow: 0 14px 40px rgba(10, 15, 30, 0.35);
}

/* Вторичная компактная ghost-кнопка email (SPEC v1.3):
   тонкая тёмная обводка на градиенте, прозрачный фон; hover — тёмная
   заливка. Контраст: #0A0F1E на #4F8DFD ≈ 5.6:1, на #22D3EE ≈ 7.6:1;
   hover: #22D3EE на #0A0F1E ≈ 9.8:1 — все ≥ 4.5:1 (SPEC §5). */
.btn-ghost-dark {
  border: 1.5px solid rgba(10, 15, 30, 0.65);
  background: transparent;
  color: #0A0F1E;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.95rem;
}

.btn-ghost-dark:hover {
  background: #0A0F1E;
  border-color: #0A0F1E;
  color: var(--accent-2);
}

.contacts-social {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
}

.social-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(10, 15, 30, 0.12);
  border: 1px solid rgba(10, 15, 30, 0.28);
  color: #0A0F1E;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.social-btn:hover {
  background: #0A0F1E;
  color: var(--accent-2);
  transform: translateY(-2px);
}

.social-btn .icon {
  width: 20px;
  height: 20px;
}

/* декоративная «искра» (8-лучевой астериск) + подпись */
.contacts-decor {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  text-align: right;
}

.spark {
  width: clamp(90px, 10vw, 150px);
  height: auto;
  color: rgba(10, 15, 30, 0.85);
  animation: spark-spin 24s linear infinite;
}

@keyframes spark-spin {
  to {
    transform: rotate(360deg);
  }
}

.contacts-caption {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1.6;
  color: rgba(10, 15, 30, 0.85);
  max-width: 220px;
  margin: 0;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--surface-border);
  padding-block: 40px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-copy {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(12px, 2vw, 24px);
}

.footer-nav a {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-nav a:hover {
  color: var(--text);
}

/* ---------- MAX-виджет (ADR-006, SPEC §4.8/§5) ----------
   Поповер по центру вьюпорта с подложкой; открытие/закрытие — класс .is-open
   (вешает JS на #open-max-widget / #max-widget). Без JS виджет скрыт
   (visibility:hidden) — прогрессивное улучшение не нарушается.
   prefers-reduced-motion: переходы гасятся глобальным правилом ниже. */
.max-widget {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 32px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.3s;
}

.max-widget.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease;
}

.max-widget-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 20, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.max-widget-card {
  position: relative;
  z-index: 1;
  width: min(100%, 380px);
  background: #101A32;
  border: 1px solid var(--surface-border);
  border-radius: 24px;
  padding: 40px 28px 28px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  transform: translateY(16px) scale(0.96);
  transition: transform 0.25s ease;
}

.max-widget.is-open .max-widget-card {
  transform: none;
}

.max-widget-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.max-widget-close:hover {
  color: var(--text);
  border-color: var(--accent-text);
}

.max-widget-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 14px;
  border: 2px solid rgba(125, 211, 252, 0.4);
}

.max-widget-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.max-widget-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 22px;
}

.max-widget-cta {
  width: 100%;
  justify-content: center;
}

.max-widget-alt {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.max-widget-alt:hover {
  color: var(--accent-text);
}

/* блокировка прокрутки фона при открытом виджете (класс вешает JS) */
body.modal-open {
  overflow: hidden;
}

/* География проектов (SPEC v1.6 §4.5.1, ADR-007: ноль JS).
   Панель 16/10 = viewBox SVG 1600x1000; точки в --x/--y;
   метрики подписей в cqw масштабируются с панелью. */
.geo-lead {
  color: var(--text-muted);
  max-width: 720px;
  margin-bottom: 32px;
}

.geo-panel {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  container-type: inline-size; /* cqw ниже = процент ширины панели */
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Декоративная сетка в стиле .hero-bg (CSS-only) */
.geo-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 60% 50% at 75% 20%, rgba(79, 141, 253, 0.12), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: auto, 64px 64px, 64px 64px;
}

.geo-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.geo-route {
  fill: none;
  stroke: var(--accent-1);
  stroke-width: 1.5;
  stroke-opacity: 0.5;
  vector-effect: non-scaling-stroke;
}

.geo-route--arc {
  stroke-dasharray: 6 6;
  stroke-opacity: 0.35;
}

.geo-points {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Точка: якорь нулевого размера в --x/--y панели */
.geo-point {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 0;
  height: 0;
}

.geo-dot {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.65);
  animation: geo-drift 8s ease-in-out infinite;
}

.geo-point--base .geo-dot {
  top: -9px;
  left: -9px;
  width: 18px;
  height: 18px;
  background: var(--gradient);
  box-shadow: 0 0 0 4px rgba(79, 141, 253, 0.22), 0 0 22px rgba(79, 141, 253, 0.6);
  animation-duration: 11s;
}

/* Дрейф: только transform/opacity (SPEC v1.6 §5) */
@keyframes geo-drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }

  50% {
    transform: translate3d(1.5px, -2.5px, 0) scale(1.12);
    opacity: 0.85;
  }
}

/* Подписи городов: тёмная подложка держит контраст не ниже 4.5:1,
   даже если маршрут проходит под ней (SVG в DOM раньше точек).
   Фолбэк px до cqw: cqw = процент ширины панели (container query). */
.geo-label {
  position: absolute;
  left: 20px;
  left: 1.8cqw;
  top: 24px;
  top: 2.2cqw;
  padding: 6px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  background: rgba(10, 15, 30, 0.88);
  white-space: nowrap;
  pointer-events: none;
}

/* СПб: выше точки (маршруты уходят от базы вниз) */
.geo-label--up {
  left: 35px;
  left: 3.2cqw;
  top: -46px;
  top: -4.2cqw;
}

/* Усть-Луга: ниже-влево, у левого края панели */
.geo-label--below-left {
  left: -108px;
  left: -9.8cqw;
  top: 26px;
  top: 2.4cqw;
}

/* Ростов: под точкой со сдвигом влево */
.geo-label--below {
  top: 22px;
  top: 2cqw;
  transform: translateX(-60%);
}

/* Избербаш · Сергокала: слева от точки, приподнята (не обрезается краем) */
.geo-label--left {
  top: 0;
  transform: translate(calc(-100% - 24px), -80%);
  transform: translate(calc(-100% - 2cqw), -80%);
}

.geo-name {
  color: var(--accent-text);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Облако «Инфраструктурные монополии» (НЕ «партнёры», SPEC §4.5.1) */
.geo-orgs {
  margin-top: 32px;
}

.geo-orgs-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
}

/* Облако «Инфраструктурные монополии» (v1.6.6): рассредоточенная планетарная система
   ВНУТРИ панели карты (SPEC §4.5.1, ADR-007 — CSS-only, 0 JS). ul.geo-chips —
   absolute-слой на всю панель; центр орбиты чипа — --cx/--cy (% панели, inline в HTML).
   Остальные параметры как в v1.6.5: --rx — радиус орбиты, --k — сжатие эллипса
   (инвариант rx·k ≤ 20px — чип не выходит за свою ячейку), --dur/--delay — период
   и фаза обращения, --s — масштаб слоя, --d — глубина (0..1, ближний слой = 1).

   Компенсация матриц: li описывает эллипс (scale(1,--k) сплющивает окружность,
   rotate+translateX(--rx) — движение по орбите), span вращается в противофазе
   (rotate(-1turn)) и восстанавливает вертикальный масштаб (scale(1,1/--k)).
   Суммарная линейная часть матриц на span = scale(--s): без поворота и
   искажения — текст ВСЕГДА горизонтален, «пилюля» не деформируется.
   Анимируется ТОЛЬКО transform; opacity/filter — статичные функции глубины --d. */
.geo-chips {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Бейдж-заголовок облака: в углу панели, подложка/цвет — как у подписей городов */
.geo-chips-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: rgba(10, 15, 30, 0.88);
  color: var(--accent-text);
  font-size: 0.8rem;
  font-weight: 600;
}

.geo-chips li {
  position: absolute;
  left: var(--cx, 50%);
  top: var(--cy, 50%);
  white-space: nowrap;
  animation: geo-chips-orbit var(--dur, 60s) linear infinite;
  animation-delay: var(--delay, 0s);
  opacity: calc(0.55 + 0.45 * var(--d, 0.7));
  filter: blur(calc((1 - var(--d, 0.7)) * 1.5px));
}

/* Стилевая «пилюля» — на span (он не искажается благодаря компенсации матриц);
   подложка светлая и СПЛОШНАЯ (#2F3441 = «стекло 16%» поверх панели): отличает
   летающие монополии от тёмных подписей городов; непрозрачность обязательна —
   чипы летают поверх маршрутов, полупрозрачный фон провалил бы контраст
   (расчёт: стекло alpha 0.12–0.2 над линией = 2.0–2.4:1, #2F3441 = 4.85:1) */
.geo-chips li span {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: #2f3441;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  animation: geo-chips-spin var(--dur, 60s) linear infinite;
  animation-delay: var(--delay, 0s);
}

/* Орбита li: центрирование точки в центре облака, масштаб слоя --s,
   сплющивание в эллипс, поворот + сдвиг по радиусу = равномерное движение */
@keyframes geo-chips-orbit {
  from {
    transform: translate(-50%, -50%) scale(var(--s, 1)) scale(1, var(--k, 0.4)) rotate(0turn) translateX(var(--rx, 150px));
  }

  to {
    transform: translate(-50%, -50%) scale(var(--s, 1)) scale(1, var(--k, 0.4)) rotate(1turn) translateX(var(--rx, 150px));
  }
}

/* Противовращение span: rotate(-1turn) гасит поворот li, scale(1, 1/--k)
   восстанавливает вертикальный масштаб — пара «li+span» даёт на тексте
   только scale(--s), без поворота и искажения */
@keyframes geo-chips-spin {
  from {
    transform: rotate(0turn) scale(1, calc(1 / var(--k, 0.4)));
  }

  to {
    transform: rotate(-1turn) scale(1, calc(1 / var(--k, 0.4)));
  }
}

/* ---------- Анимации появления (ADR-004) ----------
   Привязаны к классу .js (вешается скриптом).
   Без JS контент видим сразу — прогрессивное улучшение (SPEC §5). */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- prefers-reduced-motion (SPEC §5) ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  /* Гео-точки: дрейф отключается; облако чипов (v1.6.5): пауза ОБЕИХ анимаций
     (orbit + spin) сразу — пары замирают на одной фазе, компенсация матриц
     сохраняется при любом угле остановки (SPEC §4.5.1) */
  .geo-dot {
    animation: none;
  }

  .geo-chips li,
  .geo-chips li span {
    animation-play-state: paused;
  }
}

/* ============================================================
   Адаптив (SPEC §5): брейкпойнты 1200 / 768 / 360
   ============================================================ */

/* ≤ 1200px: компактнее */
@media (max-width: 1200px) {
  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ≤ 1023px (v1.6.6): чипы уплотняются относительно ширины панели —
   container query (cqw) от .geo-panel (container-type: inline-size) */
@media (max-width: 1023px) {
  .geo-chips li span {
    font-size: 1.9cqw;
    padding: 0.4em 1em;
  }
}

/* ≤ 768px: метрики 3×2 → 2×3; hero — фото НАД текстом (SPEC §5) */
@media (max-width: 768px) {
  .hero {
    padding-top: 120px;
  }

  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-photo {
    order: -1;
    width: min(100%, 320px);
  }

  .hero-bg {
    display: none; /* декорации скрываются на мобиле (SPEC §5) */
  }

  .metrics-grid,
  .cards-grid-3,
  .cards-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Таймлайн: мета+должность+текст в одну колонку по порядку DOM
     (v1.6.7; grid-row: auto — не держать строки 1/2 двухколоночной сетки) */
  .timeline-item {
    grid-template-columns: 1fr;
    column-gap: 0;
  }

  .timeline-item > p:not(.timeline-meta) {
    grid-column: 1;
    grid-row: auto;
  }

  /* География: схема превращается в вертикальные карточки
     (ЕДИНЫЙ DOM, SPEC v1.6 §4.5.1) */
  .geo-panel {
    aspect-ratio: auto;
    overflow: visible;
    border: none;
    border-radius: 0;
    background: none;
    container-type: normal;
  }

  .geo-grid,
  .geo-lines,
  .geo-dot {
    display: none;
  }

  /* Облако чипов (v1.6.5): статичная переносная лента — орбиты, прозрачность
     и блюр глубины отключаются (SPEC §4.5.1) */
  .geo-chips {
    position: static;
    height: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .geo-chips li {
    position: static;
    animation: none;
    opacity: 1;
    filter: none;
  }

  .geo-chips li span {
    animation: none;
    transform: none;
    background: var(--surface);
    font-size: 0.85rem;
    padding: 8px 16px;
  }

  /* Бейдж облака (v1.6.6): обычная строка над лентой (панель на мобиле в потоке);
     размер/отступы чипов возвращены к базовым — на мобиле у .geo-panel
     container-type: normal, cqw отработал бы как vw (~7px) */
  .geo-chips-badge {
    position: static;
    margin: 0 0 12px;
  }

  .geo-points {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .geo-point {
    position: static;
    width: auto;
    height: auto;
    padding: 12px 14px;
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    background: var(--surface);
  }

  .geo-point--base {
    border-color: rgba(79, 141, 253, 0.45);
  }

  .geo-label {
    position: static;
    max-width: none;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    transform: none;
  }

  /* Контакты: декор-колонка скрывается, контент — на всю ширину */
  .contacts-layout {
    grid-template-columns: 1fr;
  }

  .contacts-decor {
    display: none;
  }

  /* --- Бургер-меню (скрывается только при работающем JS — SPEC §5) --- */
  .burger {
    display: flex;
  }

  html:not(.js) .burger {
    display: none;
  }

  /* Без JS навигация видна статичной колонкой — все ссылки доступны */
  html:not(.js) .site-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 12px var(--container-pad) 20px;
    background: rgba(10, 15, 30, 0.97);
    border-bottom: 1px solid var(--surface-border);
  }

  /* С JS — выпадающая панель под шапкой, скрыта до открытия */
  html.js .site-nav {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 12px var(--container-pad) 20px;
    background: rgba(10, 15, 30, 0.97);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--surface-border);
    display: none;
  }

  html.js .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 14px 4px;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--surface-border);
  }

  .site-nav a:last-child {
    border-bottom: none;
  }
}

/* ≤ 480px: метрики и контакты в 1 колонку */
@media (max-width: 480px) {
  .metrics-grid,
  .cards-grid-3,
  .cards-grid-4,
  .cards-grid-2,
  .skills-grid,
  .mini-strip {
    grid-template-columns: 1fr;
  }

  .hero-strip li {
    font-size: 0.78rem;
    padding: 7px 12px;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ≥ 1920px: фон не «расползается» */
@media (min-width: 1920px) {
  body {
    background:
      radial-gradient(ellipse 80% 60% at 50% -10%, rgba(79, 141, 253, 0.07), transparent 70%),
      var(--bg);
  }
}
