:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --panel: #141414;
  --ink: #f0f0f0;
  --muted: #9ca3af;
  --line: #2a2a2a;
  --gold: #f5b731;
  --gold-dark: #d49a20;
  --gold-soft: rgba(245, 183, 49, 0.15);
  --green: #4ecdc4;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 3px solid rgba(245, 183, 49, 0.5);
  outline-offset: 4px;
}

.site-header, .section, .site-footer {
  width: min(1160px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 18px 0;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand, .nav { display: flex; align-items: center; }
.brand { gap: 12px; font-weight: 800; letter-spacing: 0.04em; }
.brand-logo {
  height: 48px;
  width: auto;
}
.nav {
  gap: 8px; padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.72);
  position: relative;
}
.nav a {
  padding: 10px 16px; border-radius: 999px;
  color: var(--muted); font-weight: 600;
}
.nav a:hover { color: var(--gold); background: var(--gold-soft); }

/* Dropdown */
.nav .dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}
/* Невидимый мост между кнопкой и меню, чтобы hover не терялся при переходе мыши */
.nav .dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 20px;
}
.nav .dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 300px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(20, 20, 20, 0.97);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
}
.nav .dropdown:hover .dropdown-menu,
.nav .dropdown:focus-within .dropdown-menu {
  display: flex;
}
.nav .dropdown-menu a {
  display: block;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.94rem;
  white-space: nowrap;
  transition: color 150ms ease, background 150ms ease;
}
.nav .dropdown-menu a:hover {
  color: var(--gold);
  background: var(--gold-soft);
}

/* Скрыто визуально, но доступно скринридеру */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Кнопка-бургер мобильного меню: на десктопе скрыта,
   показывается в @media (max-width: 920px) */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 48px; height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(20, 20, 20, 0.72);
  cursor: pointer;
}
.nav-toggle-icon {
  position: relative;
  width: 20px; height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: background 200ms ease;
}
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 20px; height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: top 200ms ease, transform 200ms ease;
}
.nav-toggle-icon::before { top: -7px; }
.nav-toggle-icon::after { top: 7px; }
/* Открытое состояние: бургер превращается в крестик */
.nav-open .nav-toggle-icon { background: transparent; }
.nav-open .nav-toggle-icon::before { top: 0; transform: rotate(45deg); }
.nav-open .nav-toggle-icon::after { top: 0; transform: rotate(-45deg); }

.section { padding: 76px 0; }

.divider {
  width: min(1160px, calc(100% - 40px));
  height: 1px;
  background: var(--gold);
  opacity: 0.3;
  margin-inline: auto;
}

/* Hero — SCOPE AR style */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  min-height: auto;
  padding-top: 100px;
  padding-bottom: 76px;
}
.hero-content {
  display: flex;
  flex-direction: column;
  padding: clamp(32px, 6vw, 72px);
  border-radius: 40px;
  width: 100%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  align-self: flex-start;
}
.eyebrow {
  margin: 0 0 20px;
  color: var(--gold);
  font-size: 0.82rem; font-weight: 800;
  letter-spacing: 0.16em; text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  width: 100%; margin-bottom: 24px;
  font-size: clamp(2.5rem, 5vw, 5rem);
  line-height: 0.92; letter-spacing: -0.07em;
  color: #fff;
}
h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1; letter-spacing: -0.05em;
}
#cta-title {
  margin-bottom: 40px;
}
#contacts-title {
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  letter-spacing: -0.02em;
  text-align: center;
  align-self: center;
}

.contacts .section-heading {
  align-items: center;
}
.contacts .eyebrow {
  margin-bottom: 0;
}
h3 {
  margin-bottom: 12px;
  font-size: 1.28rem; line-height: 1.18;
}
.hero-text {
  margin-bottom: 34px;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  width: 100%;
}
.hero-actions, .contact-grid { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 14px 22px;
  border-radius: 999px; font-weight: 800;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.button:hover { transform: translateY(-2px); }
.button.primary {
  color: var(--bg);
  background: var(--gold);
  box-shadow: 0 18px 40px rgba(245, 183, 49, 0.3);
}
.button.primary:hover { background: var(--gold-dark); }
.button.secondary {
  color: var(--gold);
  background: var(--gold-soft);
}

/* Intro section */
.intro, .section-heading {
  display: grid; grid-template-columns: 0.78fr 1fr;
  gap: 36px; align-items: end;
}
.intro p:last-child { margin: 0; color: var(--muted); font-size: 1.18rem; }

/* Cards */
.cards {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px; margin-top: 34px;
}
.card {
  min-height: 260px; padding: 28px;
  border-radius: 24px;
  border: 6px solid var(--gold);
  background: rgba(25, 25, 25, 0.85);
}
.card h3 { color: #fff; }
.card-number {
  display: inline-flex; margin-bottom: 48px;
  color: var(--gold); font-weight: 900;
}
.card p { margin-bottom: 0; color: var(--muted); }

.card.modal-trigger {
  cursor: pointer; transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 220px; position: relative; padding-top: 0;
}
.card.modal-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(245, 183, 49, 0.8), 0 0 40px rgba(245, 183, 49, 0.5);
  filter: brightness(1.2);
}
.card.modal-trigger::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(45deg, transparent 0px, transparent 8px, rgba(245, 183, 49, 0.35) 8px, rgba(245, 183, 49, 0.35) 10px) 0 0 / 50px 50px no-repeat,
    repeating-linear-gradient(-45deg, transparent 0px, transparent 8px, rgba(245, 183, 49, 0.35) 8px, rgba(245, 183, 49, 0.35) 10px) 100% 0 / 50px 50px no-repeat,
    repeating-linear-gradient(45deg, transparent 0px, transparent 8px, rgba(245, 183, 49, 0.35) 8px, rgba(245, 183, 49, 0.35) 10px) 0 100% / 50px 50px no-repeat,
    repeating-linear-gradient(-45deg, transparent 0px, transparent 8px, rgba(245, 183, 49, 0.35) 8px, rgba(245, 183, 49, 0.35) 10px) 100% 100% / 50px 50px no-repeat;
  pointer-events: none;
}
.card.modal-trigger .card-number {
  position: absolute; top: 20px; left: 50%;
  transform: translateX(-50%);
}
.card.modal-trigger h3 {
  text-align: center; width: 100%; padding: 0 20px;
  margin: 40px 0 0 0; font-size: 2rem; color: var(--ink);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}


/* Process steps */
.process { padding-top: 48px; }
.steps {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px; margin: 34px 0 0; padding: 0; list-style: none;
}
.steps li {
  min-height: 260px; padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px; background: var(--panel);
}
.steps span {
  display: grid; width: 42px; height: 42px; margin-bottom: 42px;
  place-items: center; border-radius: 50%;
  color: var(--bg); background: var(--gold); font-weight: 900;
}
.steps p { margin-bottom: 0; color: var(--muted); }

/* CTA */
.cta {
  padding: 44px 0;
}

/* Contacts */
.contacts { padding-bottom: 54px; }
.contact-grid {
  display: grid; grid-template-columns: 0.78fr 1fr;
  margin-top: 34px;
}
.contact-card, .requisites {
  padding: 28px; border-radius: 24px;
  border: 1px solid var(--line); background: var(--panel);
}
/* Карточка контактов и реквизиты — общий дизайн (dl, div > dt/dd, сепараторы) */
.contact-card, .requisites {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px; margin: 0;
}
.contact-card div, .requisites div { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.contact-card div:last-child, .requisites div:last-child { grid-column: 1 / -1; }
.contact-card dt, .requisites dt { color: var(--muted); font-size: 0.86rem; font-weight: 750; text-transform: uppercase; }
.contact-card dd, .requisites dd { margin: 6px 0 0; font-weight: 800; }
.contact-card a { color: var(--ink); }
.contact-card a:hover { color: var(--gold); }

/* Footer */
.site-footer {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 28px 0 38px; color: var(--muted);
}
.site-footer a:hover { color: var(--gold); }

/* Modal */
.modal { display: none; position: fixed; inset: 0; z-index: 100; }
.modal.active { display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(4px); }
.modal-content {
  position: relative; max-width: 920px; width: calc(100% - 40px);
  max-height: 85vh; overflow-y: auto;
  background: var(--panel); border-radius: var(--radius);
  padding: clamp(28px, 5vw, 54px);
  box-shadow: var(--shadow); z-index: 1;
}
.modal-close {
  position: absolute; top: 20px; right: 24px;
  width: 40px; height: 40px; border: none;
  border-radius: 50%; background: var(--bg);
  color: var(--ink); font-size: 1.1rem; font-weight: 700;
  cursor: pointer; transition: background 180ms ease;
}
.modal-close:hover { background: var(--line); }
.modal-content h2 { margin-bottom: 20px; color: var(--gold); }
.modal-intro {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 1.02rem;
}
.modal-more {
  display: inline-flex;
  margin-top: 28px;
}
.modal-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.modal-section h3 { color: var(--gold); margin-bottom: 8px; font-size: 1.1rem; }
.modal-section p { color: var(--ink); margin: 0; font-size: 0.95rem; }
.modal-content img {
  display: block; width: 100%; margin-top: 24px;
  border-radius: 16px;
}

/* Stack page */
.stack-page .stack-section { padding-top: 48px; }
.stack-heading p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 46ch;
  justify-self: end;
  align-self: end;
}
/* Блок «О компании»: заголовок по центру высоты относительно описания */
.stack-heading--about { align-items: center; }
.stack-heading--about > div { align-self: center; }
.stack-heading--about p:last-child { align-self: center; }
/* Десктоп: левый край описаний .stack-heading — по левому краю навигации
   (откуда начинается «Продукты»). Ширина правой колонки = ширине .nav,
   которую измеряет assets/js/stack-align.js (переменная --nav-width). */
@media (min-width: 921px) {
  .stack-heading { grid-template-columns: 1fr var(--nav-width, 1fr); }
  .stack-heading p:last-child {
    max-width: none;
    width: 100%;
    text-align: left;
  }
}
.stack-group { margin-top: 44px; }
.stack-group h3 {
  margin: 0 0 18px;
  padding-bottom: 10px;
  color: var(--gold);
  font-size: 0.92rem; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
/* Сепаратор внутри .section: его 100% отсчитывается от ширины секции,
   а не вьюпорта, поэтому .divider получается уже контента на 40px.
   Растягиваем на всю ширину контента, чтобы края совпали с h3 выше
   и блоком контактов ниже. Отступ 44px сверху равен padding-top
   .stack-contacts снизу — линия ровно посередине зазора. */
.stack-divider { width: 100%; margin-top: 44px; }

/* Services page */
.services-list {
  margin: 0; padding: 0; list-style: none;
  display: grid; gap: 14px;
}
.services-list li {
  position: relative;
  padding: 18px 22px 18px 44px;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel);
}
.services-list li::before {
  content: '';
  position: absolute; left: 20px; top: 26px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold);
}
.services-list li span {
  color: var(--muted);
  font-size: 1.02rem;
}
.stack-row {
  display: flex; flex-wrap: wrap;
  gap: 18px; margin: 0; padding: 0; list-style: none;
}
.stack-row li {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  width: 132px; padding: 22px 14px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--panel);
  transition: transform 180ms ease, border-color 180ms ease;
}
.stack-row li:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
}
.stack-row img {
  width: 64px; height: 64px;
  object-fit: contain;
}
.stack-row span {
  color: var(--muted);
  font-size: 0.86rem; font-weight: 600;
  text-align: center;
}
/* Карточка без иконки */
.stack-row li.no-icon {
  justify-content: center;
  min-height: 108px;
}
.stack-row li.no-icon span {
  color: var(--ink);
  font-size: 1.05rem; font-weight: 750;
}
/* Блок контактов на странице /stack/ (дублирование главного блока контактов) */
.stack-contacts { padding-top: 44px; }

.page-note {
  margin: 48px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}
.cost-block {
  margin-top: 56px; padding: 28px;
  border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: 20px; background: var(--panel);
}
.cost-block h3 {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.92rem; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.cost-block p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem; line-height: 1.6;
}
/* Страница ИТ-аккредитации */
/* Заголовок без описания: вся ширина, чтобы «ИТ-аккредитация» не разбивалось */
.stack-heading--accr { grid-template-columns: 1fr; }
.accr-preamble {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 0.98rem; line-height: 1.65;
}
/* Блок «Контакты и реквизиты» на странице /it-accreditation/ —
   идентичный макету блока .contacts на главной */
.accr-contacts { margin-top: 56px; }
.accr-list {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.accr-list li {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 20px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.95rem; line-height: 1.6;
}
.accr-code {
  display: block;
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 1.5rem; font-weight: 900;
  letter-spacing: 0.04em;
}
.accr-text {
  color: var(--muted);
  font-size: 0.95rem; line-height: 1.6;
}
.nav a[aria-current="page"] {
  color: var(--gold);
  background: var(--gold-soft);
}

/* Card Pages */
.card-page .modal-content {
  position: static;
  max-height: none;
  overflow: visible;
  margin: 40px auto;
}
.card-page .back-to-main {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
  transition: color 150ms ease;
}
.card-page .back-to-main:hover {
  color: var(--gold-dark);
}
.card-page .card-number {
  display: none;
}

/* Responsive */
@media (max-width: 920px) {
  .cards, .steps, .contact-grid, .intro, .section-heading {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stack-heading--accr { grid-template-columns: 1fr; }
  /* «О компании» и «Наш стек разработки» на мобильном:
     заголовок по центру, описание под ним на всю ширину.
     :not(--accr), чтобы не задеть заголовок /it-accreditation/,
     который тоже живёт в .stack-section */
  .stack-heading--about,
  .stack-section .stack-heading:not(.stack-heading--accr) {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .stack-heading--about h2,
  .stack-section .stack-heading:not(.stack-heading--accr) h2 {
    text-align: center;
  }
  .stack-heading--about p:last-child,
  .stack-section .stack-heading:not(.stack-heading--accr) p:last-child {
    width: 100%;
    max-width: none;
    justify-self: stretch;
    align-self: stretch;
  }
  /* Главная: заголовки вида «eyebrow + h2» («Продукты → Что разрабатываем»,
     «Подход → Как строим работу», контакты) — на мобильном стакаем:
     h2 не уезжает в правую колонку, а стоит под меткой на всю ширину.
     Шрифт не уменьшаем: на всю ширину заголовок влезает в одну строку. */
  #solutions .section-heading,
  #process .section-heading,
  #contacts .section-heading {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  #solutions .section-heading .eyebrow,
  #process .section-heading .eyebrow,
  #contacts .section-heading .eyebrow {
    margin-bottom: 12px;
  }
  /* Блок контактов центрированный — метку тоже по центру */
  #contacts .section-heading .eyebrow {
    text-align: center;
  }
  .contact-card { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .hero { min-height: auto; padding-top: 36px; padding-bottom: 48px; }

  /* Мобильное меню: вместо горизонтальной ленты навигации —
     выпадающая панель под шапкой, открывается кнопкой-бургером */
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 20px 20px;
    background: rgba(14, 14, 14, 0.97);
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
    overflow-y: auto;
    max-height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px);
  }
  .site-header.nav-open .nav { display: flex; }
  .nav a {
    padding: 14px 16px;
    border-radius: 14px;
  }
  /* «Продукты»: не hover-меню, а постоянный отступленный под-список
     (на тач-устройствах hover недоступен) */
  .nav .dropdown {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: static;
  }
  .nav .dropdown::after { display: none; }
  .nav .dropdown-menu {
    position: static;
    display: flex;
    min-width: 0;
    padding: 0 0 6px 16px;
    border: 0;
    border-radius: 0;
    background: none;
    backdrop-filter: none;
    box-shadow: none;
    z-index: auto;
  }
  .nav .dropdown-menu a {
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    /* длинные пункты меню переносим, чтобы не вылезали за панель */
    white-space: normal;
  }
}
@media (max-width: 640px) {
  .site-header, .section, .site-footer { width: min(100% - 28px, 1160px); }
  .section { padding: 48px 0; }
  .hero-content, .card, .contact-card, .requisites, .cta, .steps li { border-radius: 20px; }
  .hero-content { padding: 24px; }
  .hero-actions, .cta, .site-footer { align-items: stretch; flex-direction: column; }
  .button { width: 100%; }
  .cards, .steps, .requisites, .contact-grid { grid-template-columns: 1fr; }
  .card, .steps li { min-height: auto; }
  .card-number, .steps span { margin-bottom: 28px; }
  .hero-content { text-align: center; }
  .hero-actions { justify-content: center; }
}
