/* ═══════════════════════════════════════════════════════════════
   AVatar Сайты · Направление A «Рабочий цех» (ДНК 18) · Apple-гештальт hero
   neutral · section-alt · grotesk-display · catalog-grid · media high
   Manrope (display, жирный гротеск) + Rubik (body) + IBM Plex Mono (метки)
   ═══════════════════════════════════════════════════════════════ */

/* ── Шрифты (self-hosted, кириллица + латиница раздельно) ── */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('fonts/manrope-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('fonts/manrope-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2116, U+2122, U+2212;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('fonts/rubik-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('fonts/rubik-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2116, U+2122, U+2212;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/plexmono-cyrillic-500.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/plexmono-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2116, U+2122, U+2212;
}

/* ── Токены ─────────────────────────────────────────────────── */
:root {
  /* палитра 60/30/10 — провенанс в манифесте */
  --paper: #F4F4F2;      /* 60% фон, «рабочая бумага» */
  --card: #E9E9E5;       /* поверхность на светлом, на тон глубже */
  --coal: #1B1B1A;       /* 30% тёмный разворот, нейтральный уголь */
  --coal-2: #242423;     /* поверхность карточки на угле */
  --ink: #1C1C1B;        /* текст на светлом */
  --paper-ink: #F1F1EF;  /* текст на угле */
  --muted: #5E5E58;      /* вторичный текст на светлом, 5.93:1 */
  --muted-dark: #A8A8A2; /* моно-метки на угле, 7.21:1 */
  --mono-light: #6E6E67; /* моно-метки на светлом, 4.66:1 */
  --steel: #386890;      /* 10% акцент: CTA + активные. 4.86..5.91:1 */
  --steel-2: #7FA8CB;    /* акцент на тёмном развороте, 6.87:1 */
  --steel-deep: #315D82; /* hover-ступень стали; на veil worst-case 4.83:1 */
  --hairline: rgba(28, 28, 27, 0.14);
  --hairline-dark: rgba(241, 241, 239, 0.16);
  --veil: rgba(244, 244, 242, 0.88); /* липкая шапка: полупрозрачная «бумага» + blur (Apple-nav) */

  /* типографика: шкала ×1.25, база 17px */
  --fs-0: 0.8125rem;   /* 13 — моно-метки (служебные) */
  --fs-1: 1.0625rem;   /* 17 — body */
  --fs-2: 1.328rem;    /* 21.25 */
  --fs-3: 1.66rem;     /* 26.6 */
  --fs-4: 2.076rem;    /* 33.2 */
  --fs-5: 2.594rem;    /* 41.5 */
  --fs-6: 3.243rem;    /* 51.9 */
  --fs-7: 4.054rem;    /* 64.9 — плакатный display (афишный H1 hero), та же шкала ×1.25 */

  /* 8pt-сетка */
  --s-1: 8px;  --s-2: 16px; --s-3: 24px; --s-4: 32px;
  --s-5: 40px; --s-6: 48px; --s-8: 64px; --s-10: 80px; --s-12: 96px;

  --radius: 8px;             /* единый радиус ДНК ≤8px — карточки, рамки, поверхности */
  --radius-pill: 999px;      /* пилюли: только интерактивные капсулы (CTA, чипы, табы) */
  --ease: cubic-bezier(0.33, 0.9, 0.35, 1);  /* одна кривая на сайт */
  --shell-max: 1520px;
}

/* ── База ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Rubik', 'Segoe UI', sans-serif;
  font-size: var(--fs-1);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
a { color: var(--steel); }

h1, h2, h3 {
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
p { text-wrap: pretty; }

::selection { background: var(--steel); color: var(--paper); }

:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 3px;
  border-radius: 4px;
}
.cases :focus-visible { outline-color: var(--steel-2); }

.shell {
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 56px);
}

.mono-label {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: var(--fs-0);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.kicker {
  text-transform: uppercase;
  color: var(--mono-light);
  margin-bottom: var(--s-2);
}
.kicker--dark { color: var(--muted-dark); }

.skip-link {
  position: absolute;
  left: 16px; top: -64px;
  z-index: 30;
  background: var(--coal);
  color: var(--paper-ink);
  padding: 8px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.16s var(--ease);
}
.skip-link:focus-visible { transform: translateY(80px); }

/* ── Кнопки ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 28px;
  border: 0;
  border-radius: var(--radius-pill);
  font-family: 'Rubik', sans-serif;
  font-size: var(--fs-1);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s var(--ease), background-color 0.16s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary { background: var(--steel); color: var(--paper); }
.btn--primary:hover { background: var(--steel-deep); }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--hairline);
}
.btn--ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }

.btn--light { background: var(--paper); color: var(--ink); }
.btn--light:hover { background: #FBFBF9; }

.btn--lg { min-height: 56px; padding: 16px 36px; }

/* ── Шапка ──────────────────────────────────────────────────── */
/* Липкая полупрозрачная строка бренда с blur (Apple-nav);
   топбар с фактами — вне header, уходит при скролле */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--veil);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: var(--paper); }
}

.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
}
.topbar__row {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  padding-block: 8px;
}
.topbar__item { color: var(--mono-light); }

.header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding-block: var(--s-2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}
.brand__mark {
  width: 14px; height: 14px;
  background: var(--steel);
  border-radius: 4px;
}
.brand__word {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: var(--fs-2);
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}
.nav__link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  padding-block: 8px;
  transition: color 0.16s var(--ease);
}
.nav__link:hover { color: var(--steel-deep); }
.nav__cta { min-height: 44px; padding: 12px 24px; }

/* бургер */
.burger {
  display: none;
  width: 48px; height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: transparent;
  border: 0;
  cursor: pointer;
  border-radius: var(--radius);
}
.burger__line {
  width: 24px; height: 2px;
  background: var(--ink);
  transition: transform 0.2s var(--ease);
}
.burger[aria-expanded="true"] .burger__line:first-child { transform: translateY(4.5px) rotate(45deg); }
.burger[aria-expanded="true"] .burger__line:last-child { transform: translateY(-4.5px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--paper);
  overflow-y: auto;
}
.mobile-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--s-2);
  border-bottom: 1px solid var(--hairline);
  width: 100%;
}
.mobile-menu__close {
  width: 48px; height: 48px;
  background: transparent;
  border: 0;
  font-size: var(--fs-2);
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--radius);
}
.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding-block: var(--s-4);
  width: 100%;
}
.mobile-menu__link {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: var(--fs-3);
  color: var(--ink);
  text-decoration: none;
  padding-block: var(--s-2);
  border-bottom: 1px solid var(--hairline);
}
.mobile-menu__link--cta { color: var(--steel); border-bottom: 0; }

/* ── Hero (светлый разворот, Apple-гештальт) ────────────────── */
/* центрированная афиша: кикер → плакатный H1 → короткий лид → CTA-пилюли →
   ПОД ними кадр-герой во всю ширину контента; воздух щедрый, apple-интервалы */
.hero { padding-block: clamp(48px, 6vw, 88px) clamp(80px, 9vw, 144px); }

.hero__copy {
  text-align: center;
  max-width: 62rem;
  margin-inline: auto;
}

.hero__title {
  /* афишный display-кегль: потолок --fs-7 (64.9px) — 2 сбалансированные строки на 1440 */
  font-size: clamp(2.594rem, 1.3rem + 3.6vw, 4.054rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.024em;
  margin-bottom: var(--s-3);
}

.hero__lead {
  font-size: clamp(1.328rem, 1.1rem + 0.8vw, 1.66rem);
  line-height: 1.4;
  color: var(--muted);
  max-width: 38em;
  margin-inline: auto;
  margin-bottom: var(--s-5);
}

.chip {
  background: var(--card);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 0.875rem;
  color: var(--ink);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
}

.hero__anchors {
  display: flex;
  justify-content: center;
  gap: clamp(40px, 6vw, 96px);
  border-top: 1px solid var(--hairline);
  margin-top: clamp(48px, 6vw, 80px);
  padding-top: var(--s-4);
  max-width: 56rem;
  margin-inline: auto;
}
.anchor { max-width: 15em; text-align: center; }
.anchor__num {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: var(--fs-5);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
}
.anchor__label {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-top: 4px;
}

/* плита кадра — браузерная рамка */
.browser-frame {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(28, 28, 27, 0.06), 0 12px 24px -8px rgba(28, 28, 27, 0.18);
}
.browser-frame__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
}
.browser-frame__dot {
  width: 8px; height: 8px;
  border-radius: 4px;
  background: rgba(28, 28, 27, 0.22);
}
.browser-frame__url {
  margin-left: 8px;
  color: var(--muted);
  background: var(--paper);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  letter-spacing: 0.02em;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.browser-frame__body { aspect-ratio: 16 / 10; background: var(--coal); }
.browser-frame__body img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
}

.browser-frame--dark {
  background: #2E2E2C;
  box-shadow: 0 1px 2px rgba(56, 104, 144, 0.10), 0 12px 24px -8px rgba(127, 168, 203, 0.12);
}
.browser-frame--dark .browser-frame__dot { background: rgba(241, 241, 239, 0.24); }
.browser-frame__body--card { aspect-ratio: 16 / 11; }

/* device-рамка телефона: мобильная версия того же сайта */
.phone-frame {
  position: absolute;
  background: var(--coal);
  border-radius: 16px;
  padding: 4px;
  box-shadow: 0 1px 2px rgba(28, 28, 27, 0.08), 0 12px 24px -8px rgba(28, 28, 27, 0.24);
}
.phone-frame img {
  border-radius: 12px;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.phone-frame__notch {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 32%; height: 8px;
  background: var(--coal);
  border-radius: 0 0 8px 8px;
  z-index: 1;
}
.plate-stack { position: relative; }
.hero__plate {
  /* кадр-герой под текстом: во всю ширину контента, по центру */
  max-width: 1120px;
  margin-inline: auto;
  margin-top: clamp(48px, 6vw, 80px);
}
.phone-frame--hero {
  width: clamp(104px, 12vw, 168px);
  aspect-ratio: 375 / 780;
  right: clamp(-16px, -1vw, -8px);
  bottom: 24px;
}
.phone-frame--card {
  width: 88px;
  aspect-ratio: 375 / 780;
  right: var(--s-2);
  top: 96px;
}

.hero__plate-caption {
  /* деликатно: тихая моно-строка по центру под кадром */
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-2);
  color: var(--mono-light);
  text-align: center;
}
.plate-counter { color: var(--ink); white-space: nowrap; }

.plate-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-1);
  margin-top: var(--s-3);
}
.plate-tab {
  border: 0;
  background: var(--card);
  color: var(--ink);
  font-family: 'Rubik', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 12px 20px;
  min-height: 44px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
}
.plate-tab:hover { transform: translateY(-2px); }
.plate-tab[aria-pressed="true"] { background: var(--steel); color: var(--paper); }

/* кроссфейд кадра при переключении */
#plate-img.is-fading { opacity: 0; }
#plate-img { transition: opacity 0.24s var(--ease); }

/* ── Каталог работ (тёмный разворот) ────────────────────────── */
.cases {
  background: var(--coal);
  color: var(--paper-ink);
  scroll-margin-top: 80px; /* якорный переход не прячется под липкой шапкой */
  padding-block: clamp(72px, 9vw, 136px);
}

.cases__head {
  /* эпплизированный ритм: центрированная афиша секции (кикер → H2 с точкой → интро) */
  text-align: center;
  margin-bottom: var(--s-8);
}
.cases__title {
  /* афишный кегль разворота — на ступень выше */
  font-size: clamp(2.076rem, 1.2rem + 2.4vw, 3.243rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--paper-ink);
}
.cases__intro {
  color: var(--muted-dark);
  max-width: 36em;
  margin-inline: auto;
  margin-top: var(--s-2);
}

.rail-wrap { position: relative; }

.rail-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}
.rail-dots { display: flex; gap: 10px; }
.rail-dot {
  width: 24px; height: 24px;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  border-radius: 12px;
}
.rail-dot::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 4px;
  background: var(--hairline-dark);
  transition: background-color 0.16s var(--ease), transform 0.16s var(--ease);
}
.rail-dot[aria-current="true"]::after { background: var(--steel-2); transform: scale(1.3); }

.rail-arrows { display: flex; gap: var(--s-1); }
.rail-arrow {
  width: 48px; height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--coal-2);
  color: var(--paper-ink);
  font-size: var(--fs-3);
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.16s var(--ease), transform 0.16s var(--ease);
}
.rail-arrow:hover { background: #2E2E2C; transform: translateY(-2px); }

.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(300px, 31vw, 470px);
  gap: var(--s-3);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-inline: max(clamp(20px, 4vw, 56px), calc((100vw - var(--shell-max)) / 2 + clamp(20px, 4vw, 56px)));
  padding-bottom: var(--s-2);
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.case-card {
  position: relative;
  scroll-snap-align: start;
  background: var(--coal-2);
  border-radius: var(--radius);
  padding: var(--s-3);
  padding-top: var(--s-5);
  transition: transform 0.16s var(--ease), background-color 0.16s var(--ease);
}
.case-card:hover { transform: translateY(-2px); background: #292928; }

.case-card__index {
  position: absolute;
  top: var(--s-2);
  left: var(--s-3);
  color: var(--muted-dark);
}
.case-card__index::after {
  content: '';
  display: inline-block;
  width: 40px; height: 1px;
  background: var(--hairline-dark);
  vertical-align: middle;
  margin-left: 12px;
}

.case-card__title {
  font-size: var(--fs-2);
  font-weight: 600;
  color: var(--paper-ink);
  margin-top: var(--s-2);
  margin-bottom: 4px;
}
.case-card__line {
  color: var(--muted-dark);
  font-size: 0.9375rem;
  margin-bottom: var(--s-2);
}
.case-card__tag { color: var(--steel-2); letter-spacing: 0.1em; }

/* SEO-чипы — перенесены из hero вниз, в коммерчески плотный разворот */
.cases__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-1);
  margin-top: var(--s-6);
}
.chip--dark {
  background: var(--coal-2);
  color: var(--paper-ink); /* #F1F1EF на #242423 — 13.74:1, AA ✓ */
}

.cases__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-8);
  border-top: 1px solid var(--hairline-dark);
  padding-top: var(--s-4);
}
.cases__foot-line {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: var(--fs-3);
  color: var(--paper-ink);
  text-wrap: balance;
}

/* ── Единая система reveal секций (0 КБ, scroll-driven) ─────── */
@supports (animation-timeline: view()) {
  .reveal {
    animation: rise linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 24%;
  }
}
@keyframes rise {
  from { opacity: 0.01; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

/* ── Межстраничные переходы (View Transitions, MPA opt-in) ──── */
/* На сборке многостраничника — <ClientRouter /> Astro; здесь — нативный opt-in */
@view-transition { navigation: auto; }

/* ── prefers-reduced-motion: отключить всё ──────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ── Адаптив ────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .nav { display: none; }
  .burger { display: flex; }
}

@media (max-width: 599px) {
  .topbar__right { display: none; }
  .hero { padding-block: var(--s-5) var(--s-10); }
  .hero__lead { font-size: var(--fs-2); }
  .hero__plate { margin-top: var(--s-5); }
  .hero__anchors {
    gap: var(--s-4);
    margin-top: var(--s-6);
    justify-content: flex-start;
  }
  .hero__actions .btn { flex: 1 1 auto; }
  .phone-frame--hero { right: 8px; bottom: 16px; }
  .rail { grid-auto-columns: min(84vw, 360px); }
  .cases__foot { flex-direction: column; align-items: stretch; text-align: center; }
}
