/*
 * Бинарность — каркас страницы: верхняя строка, шапка с мега-меню, мобильное меню,
 * шапка внутренних страниц, подвал.
 */

/* ---------- Логотип ---------- */
.logo { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.logo__mark { display: block; flex: none; }
.logo__mark .m-fill { fill: var(--accent); }
.logo__mark .m-line { fill: none; stroke: var(--ink); stroke-width: 1.25; }
.logo__text { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.logo__name { font-weight: 800; font-size: 17px; letter-spacing: .035em; color: var(--ink); }
.logo__tag { font-family: var(--font-mono); font-size: 9px; letter-spacing: .17em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Верхняя строка ---------- */
.topline { font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.topline__in { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 38px; }
.topline__group { display: flex; align-items: center; gap: 22px; min-width: 0; }
.topline__item { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.topline a { transition: color .15s; }
.topline a:hover { color: var(--ink); }
.topline .icon { color: var(--ink-3); }
.topline__phone { color: var(--ink); font-weight: 600; }
@media (max-width: 900px) { .topline__group--info .topline__item:not(:first-child) { display: none; } }
@media (max-width: 640px) { .topline__group--info { display: none; } .topline__in { justify-content: center; } .topline__mail { display: none; } }

/* ---------- Шапка ---------- */
.header { position: sticky; top: 0; z-index: 100; background: color-mix(in oklch, var(--bg) 84%, transparent); backdrop-filter: saturate(1.5) blur(16px); -webkit-backdrop-filter: saturate(1.5) blur(16px); border-bottom: 1px solid var(--line); transition: box-shadow .25s, background-color .25s; }
.header.is-scrolled { box-shadow: 0 10px 30px -18px oklch(0.25 0.06 264 / .35); }
.header__in { display: flex; align-items: center; gap: 22px; min-height: var(--header-h); }
.header__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.nav { display: flex; align-items: stretch; align-self: stretch; gap: 2px; }
/* пункт занимает всю высоту шапки — курсор доходит до выпадающей панели, не покидая пункт */
.nav__item { position: static; display: flex; align-items: center; }
.nav__item--drop { position: relative; }
.nav__link { display: inline-flex; align-items: center; gap: 5px; height: 40px; padding: 0 11px; border-radius: var(--r-sm); font-size: 14.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; transition: color .15s, background-color .15s; }
.nav__link:hover, .nav__item:hover > .nav__link, .nav__item.is-open > .nav__link { color: var(--ink); background: var(--surface-2); }
.nav__link.is-active { color: var(--ink); font-weight: 600; }
.nav__link .icon { color: var(--ink-3); transition: transform .2s var(--ease); }
.nav__item:hover > .nav__link .icon, .nav__item.is-open > .nav__link .icon { transform: rotate(180deg); }
.nav__mark { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-right: 2px; }

/* мега-меню «Услуги» */
.mega { position: absolute; left: 0; right: 0; top: 100%; padding-top: 1px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .18s, transform .22s var(--ease), visibility 0s .22s; pointer-events: none; }
.nav__item:hover > .mega, .nav__item:focus-within > .mega, .nav__item.is-open > .mega { opacity: 1; visibility: visible; transform: none; transition-delay: 0s, 0s, 0s; pointer-events: auto; }
.mega__panel { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r-xl) var(--r-xl); box-shadow: var(--shadow-lg); padding: 26px 28px 28px; display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr) minmax(250px, .95fr); gap: 30px; }
.mega__title { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; padding-left: 12px; }
.mega__list { display: grid; gap: 2px; }
.mega__list--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; }
.mega__link { display: flex; align-items: flex-start; gap: 13px; padding: 11px 12px; border-radius: var(--r); transition: background-color .15s; }
.mega__link:hover { background: var(--surface-2); }
.mega__link:hover .icon-tile { background: var(--accent); color: #fff; }
.mega__link .icon-tile { transition: background-color .15s, color .15s; margin-top: 1px; }
.mega__name { display: block; font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.mega__desc { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.4; color: var(--ink-3); }
.mega__promo { display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: var(--r-lg); background: var(--night); color: oklch(0.96 0.007 264); position: relative; overflow: hidden; }
.mega__promo::before { content: ""; position: absolute; inset: 0; background: radial-gradient(260px circle at 90% 0%, oklch(0.6 0.2 262 / .5), transparent 70%); pointer-events: none; }
.mega__promo > * { position: relative; }
.mega__promo h4 { font-size: 18px; line-height: 1.25; }
.mega__promo p { font-size: 13.5px; line-height: 1.5; color: oklch(0.8 0.02 264); }
.mega__promo .btn { margin-top: auto; align-self: flex-start; }

/* обычное выпадающее меню */
.drop { position: absolute; right: 0; top: 100%; padding-top: 10px; min-width: 240px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .18s, transform .22s var(--ease), visibility 0s .22s; pointer-events: none; }
.nav__item:hover > .drop, .nav__item:focus-within > .drop, .nav__item.is-open > .drop { opacity: 1; visibility: visible; transform: none; transition-delay: 0s, 0s, 0s; pointer-events: auto; }
.drop__panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 8px; display: grid; gap: 2px; }
.drop__link { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm); font-size: 14.5px; font-weight: 500; color: var(--ink); transition: background-color .15s; }
.drop__link:hover { background: var(--surface-2); }
.drop__link .icon { color: var(--ink-3); }

/* бинарный переключатель темы */
.theme { display: inline-flex; align-items: center; height: 34px; padding: 3px; border: 1px solid var(--line-2); border-radius: 999px; gap: 0; transition: border-color .15s; }
.theme:hover { border-color: var(--ink-3); }
.theme__opt { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink-3); transition: background-color .2s, color .2s; }
.theme__opt.is-on { background: var(--accent); color: #fff; }

/* Колонка с фиксированным шагом между линиями: при открытии крайние сходятся в центре и дают крестик. */
.burger { display: none; flex-direction: column; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink); transition: transform .25s var(--ease), opacity .2s; }
.burger span + span { margin-top: 5px; }
.header.is-drawer-open .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.header.is-drawer-open .burger span:nth-child(2) { opacity: 0; }
.header.is-drawer-open .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* На ноутбучных ширинах шапка сжимается, чтобы меню и кнопки помещались без прокрутки страницы. */
@media (min-width: 1241px) and (max-width: 1360px) {
  .header__in { gap: 16px; }
  .header .logo__tag { display: none; }
  .nav__link { padding: 0 9px; font-size: 14px; }
}

/* мобильное меню */
.drawer { display: none; }
@media (max-width: 1240px) {
  .nav { display: none; }
  .burger { display: flex; }
  .header__cta { display: none; }
  /* Привязано к шапке, а не к окну: backdrop-filter у шапки делает её контейнером для fixed-потомков.
     Высоту до низа экрана задаёт --drawer-top (ставит header_controller.js при открытии). */
  .drawer { display: block; position: absolute; left: 0; right: 0; top: 100%; height: calc(100dvh - var(--drawer-top, var(--header-h))); z-index: 99; background: var(--bg); border-top: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; padding: 12px 0 40px; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: opacity .2s, transform .25s var(--ease), visibility 0s .25s; }
  .header.is-drawer-open .drawer { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .header.is-drawer-open { background: var(--bg); }
}
.drawer__in { display: grid; gap: 4px; }
.drawer__group { border-bottom: 1px solid var(--line); }
.drawer__group > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 16px 0; font-size: 18px; font-weight: 600; cursor: pointer; }
.drawer__group > summary::-webkit-details-marker { display: none; }
.drawer__group > summary .icon { color: var(--ink-3); transition: transform .2s; }
.drawer__group[open] > summary .icon { transform: rotate(180deg); }
.drawer__sub { display: grid; gap: 2px; padding-bottom: 14px; }
.drawer__sub a { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 15.5px; color: var(--ink-2); }
.drawer__sub a .icon { color: var(--accent-text); }
.drawer__cap { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); padding: 8px 0 4px; }
.drawer__link { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; font-size: 18px; font-weight: 600; border-bottom: 1px solid var(--line); }
.drawer__foot { display: grid; gap: 12px; padding-top: 24px; }
.drawer__contacts { display: grid; gap: 8px; padding-top: 8px; font-size: 15px; color: var(--ink-2); }
.drawer__contacts a { display: inline-flex; align-items: center; gap: 10px; }
.drawer__contacts a:first-child { font-size: 20px; font-weight: 700; color: var(--ink); }

.drawer__login { display: none; }
@media (max-width: 560px) {
  .logo__tag { display: none; }
  .header__login span { display: none; }
  .header__login { padding: 0 11px; }
}
/* На узких телефонах шапка уплотняется, а на самых узких вход переезжает в меню:
   логотип, тема и бургер должны помещаться в строку. */
@media (max-width: 400px) {
  .header__in { gap: 12px; }
  .header__actions { gap: 8px; }
}
@media (max-width: 380px) {
  .header__login { display: none; }
  .drawer__login { display: inline-flex; }
}
@media (max-width: 340px) {
  .header .logo { gap: 9px; }
  .header .logo__name { font-size: 15px; }
}

/* ---------- Шапка внутренних страниц ---------- */
.page-hero { position: relative; overflow: hidden; padding-block: clamp(36px, 5vw, 64px) clamp(48px, 6.5vw, 88px); isolation: isolate; }
.page-hero::before { content: ""; position: absolute; inset: 0; z-index: -2; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 56px 56px; background-position: center top; mask-image: radial-gradient(120% 90% at 78% 0%, #000 0%, transparent 72%); -webkit-mask-image: radial-gradient(120% 90% at 78% 0%, #000 0%, transparent 72%); }
.page-hero::after { content: ""; position: absolute; z-index: -1; width: 780px; height: 780px; right: -220px; top: -420px; border-radius: 50%; background: radial-gradient(closest-side, oklch(0.58 0.21 262 / .42), transparent); pointer-events: none; }
.page-hero__in { display: grid; gap: 22px; }
.page-hero__in--split { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(32px, 5vw, 72px); align-items: end; }
@media (max-width: 940px) { .page-hero__in--split { grid-template-columns: minmax(0, 1fr); } }
.page-hero__main { display: grid; gap: 22px; justify-items: start; min-width: 0; }
.page-hero h1 { font-size: clamp(34px, 4.7vw, 60px); line-height: 1.04; letter-spacing: -0.036em; max-width: 19ch; }
.page-hero h1.is-long { max-width: 24ch; font-size: clamp(30px, 3.9vw, 50px); }
.page-hero .lead { max-width: 60ch; }
.page-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.page-hero__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); }
.page-hero__meta .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--line-2); }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-3); }
.crumbs a { transition: color .15s; }
.crumbs a:hover { color: var(--ink); }
.crumbs__sep { opacity: .5; }
.crumbs [aria-current] { color: var(--ink-2); }

/* ---------- Подвал ---------- */
.footer { background: var(--bg); color: var(--ink-2); border-top: 1px solid var(--line); font-size: 14.5px; }
.footer__top { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(4, minmax(0, 1fr)); gap: 40px 32px; padding-block: clamp(48px, 6vw, 80px) clamp(36px, 4vw, 56px); }
.footer__brand { display: grid; gap: 18px; align-content: start; max-width: 340px; }
.footer__brand p { line-height: 1.6; color: var(--ink-3); }
.footer__contacts { display: grid; gap: 8px; }
.footer__contacts a { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); transition: color .15s; }
.footer__contacts a:hover { color: var(--accent-text); }
.footer__contacts .icon { color: var(--ink-3); }
.footer__phone { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.footer__col h3 { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 16px; }
.footer__col ul { display: grid; gap: 10px; }
.footer__col a { color: var(--ink-2); transition: color .15s; }
.footer__col a:hover { color: var(--ink); }
.footer__bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 28px; padding-block: 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.footer__legal { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer__legal a:hover { color: var(--ink); }
.footer__status { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 12px; }
@media (max-width: 1040px) { .footer__top { grid-template-columns: repeat(3, minmax(0, 1fr)); } .footer__brand { grid-column: 1 / -1; max-width: 460px; } }
@media (max-width: 640px) { .footer__top { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 400px) { .footer__top { grid-template-columns: minmax(0, 1fr); } }
