/* AISI PRO — шапка, мега-меню (компьютер) и пошаговое меню (телефон, планшет). */
:root { --header-height: 104px; --ap-ink: #15181d; --ap-muted: #5d6570; --ap-accent: #a81c0c; --ap-accent-hover: #c52a18; }

.ap-header {
  position: fixed; top: 12px; left: 16px; right: 16px; z-index: 1000;
  max-width: 1440px; margin-inline: auto; font-family: var(--font, Inter, "Segoe UI", Arial, sans-serif);
}
.ap-header__bar {
  height: 80px; box-sizing: border-box; padding: 0 12px 0 22px;
  display: flex; align-items: center; gap: 10px;
  border-radius: 20px; color: #fff;
  background: rgba(17, 20, 25, .62);
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: background .25s ease, box-shadow .25s ease;
}
.ap-header.is-scrolled .ap-header__bar { background: rgba(17, 20, 25, .82); box-shadow: 0 14px 40px rgba(0, 0, 0, .35); }

.ap-logo { display: flex; align-items: center; flex: none; margin-right: 14px; }
.ap-logo img { width: auto; max-width: none; filter: brightness(1.2) contrast(1.1); }
.ap-logo .ap-logo__full { display: block; height: 35px; }
.ap-logo .ap-logo__compact { display: none; height: 34px; }

.ap-nav { display: flex; justify-content: flex-end; gap: 2px; flex: 1; min-width: 0; margin-right: 14px; }
.ap-nav__btn {
  height: 44px; padding: 0 12px; border: 0; border-radius: 12px; display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.ap-nav__btn svg { width: 12px; height: 12px; transition: transform .2s ease; }
.ap-nav__btn:hover, .ap-nav__btn[aria-expanded="true"] {
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .06));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 18px rgba(0, 0, 0, .18);
  -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5);
}
.ap-nav__btn[aria-expanded="true"] { background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .09)); color: #fff; }
.ap-nav__btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.ap-nav__btn:focus-visible { outline: 2px solid rgba(255, 255, 255, .6); outline-offset: 2px; }
.ap-dir:focus-visible, .ap-row:focus-visible, .ap-burger:focus-visible, .ap-icon-btn:focus-visible { outline: 2px solid #ff8a7a; outline-offset: 2px; }

.ap-header__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.ap-header .ap-icon-btn { width: 44px; height: 44px; flex: 0 0 44px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .16); }
.ap-header .ap-icon-btn:hover { border-color: rgba(255, 255, 255, .4); }
.ap-cta {
  height: 48px; padding: 0 22px; border: 0; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ap-accent); color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background .18s ease, transform .18s ease;
}
.ap-cta:hover { background: var(--ap-accent-hover); transform: translateY(-1px); }
.ap-cta--block { width: 100%; height: 52px; }
.ap-burger {
  display: none; height: 44px; padding: 0 14px 0 12px; border-radius: 12px; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .16); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.ap-burger svg { width: 22px; height: 22px; }

/* Мега-меню */
.ap-mega {
  position: absolute; top: calc(100% + 10px); left: 0; right: 0;
  visibility: hidden; opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
.ap-mega.is-open { visibility: visible; opacity: 1; transform: none; pointer-events: auto; }
.ap-mega__inner {
  display: flex; min-height: 420px; max-height: calc(100vh - 130px); overflow: hidden;
  border-radius: 24px; color: var(--ap-ink);
  background: rgba(246, 248, 250, .8);
  backdrop-filter: blur(28px) saturate(170%); -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .65); box-shadow: 0 30px 80px rgba(9, 13, 18, .35);
}
.ap-mega__panel { flex: 1; display: flex; min-width: 0; }
.ap-mega__panel[hidden] { display: none; }
.ap-mega__eyebrow { margin: 0; padding: 6px 14px 10px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ap-muted); }
.ap-mega__dirs { width: 320px; flex: none; padding: 20px 12px; box-sizing: border-box; border-right: 1px solid rgba(21, 24, 29, .08); display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.ap-dir {
  min-height: 46px; width: 100%; padding: 0 14px; border: 0; border-radius: 12px; display: flex; align-items: center; gap: 10px;
  background: transparent; color: var(--ap-ink); font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; text-decoration: none; box-sizing: border-box;
}
.ap-dir span { flex: 1; }
.ap-dir b { font-size: 13px; color: var(--ap-muted); font-weight: 600; }
.ap-dir svg { width: 14px; height: 14px; flex: none; }
.ap-dir:hover { background: rgba(255, 255, 255, .6); color: var(--ap-ink); }
.ap-dir[aria-expanded="true"] { background: rgba(255, 255, 255, .9); color: var(--ap-accent); box-shadow: 0 4px 14px rgba(9, 13, 18, .08); }
.ap-mega__all { margin: 12px 14px 4px; font-size: 14px; font-weight: 700; color: var(--ap-accent); text-decoration: none; }
.ap-mega__panes, .ap-flat { flex: 1; min-width: 0; padding: 28px 36px; box-sizing: border-box; overflow-y: auto; }
.ap-pane[hidden] { display: none; }
.ap-pane__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ap-pane__title { font-size: 28px; font-weight: 800; line-height: 1.15; color: var(--ap-ink); text-decoration: none; }
.ap-pane__overview { font-size: 14px; font-weight: 700; color: var(--ap-accent); text-decoration: none; }
.ap-pane__links, .ap-flat__grid { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; }
.ap-flat__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ap-pane__links a, .ap-flat__grid a {
  display: block; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .55); color: var(--ap-ink);
  font-size: 15px; font-weight: 500; line-height: 1.3; text-decoration: none; transition: background .15s ease, color .15s ease;
}
.ap-flat__grid a { padding: 16px 18px; font-weight: 600; }
.ap-pane__links a:hover, .ap-flat__grid a:hover { background: #fff; color: var(--ap-accent); }
.ap-header [aria-current="page"] { color: var(--ap-accent) !important; font-weight: 700; }
.ap-mega__cta {
  width: 290px; flex: none; margin: 16px; padding: 24px; box-sizing: border-box; border-radius: 18px;
  background: #15181d; color: #fff; display: flex; flex-direction: column; gap: 12px;
}
.ap-mega__cta .ap-mega__eyebrow { padding: 0; color: #d8dde1; }
.ap-mega__cta-title { margin: 0; font-size: 21px; font-weight: 800; line-height: 1.25; }
.ap-mega__cta-text { margin: 0 0 auto; font-size: 14px; line-height: 1.5; color: #d8dde1; }
.ap-mega__cta-links { display: flex; gap: 14px; flex-wrap: wrap; }
.ap-mega__cta-links a { color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; }
.ap-mega__cta-links a:hover { color: #ff9d8f; }

/* Пошаговое меню для телефона и планшета */
.ap-drawer { position: fixed; inset: 0; z-index: 1900; visibility: hidden; pointer-events: none; overflow: hidden; }
.ap-drawer.is-open { visibility: visible; pointer-events: auto; }
.ap-drawer__backdrop { position: absolute; inset: 0; background: rgba(9, 13, 18, .45); opacity: 0; transition: opacity .25s ease; }
.ap-drawer.is-open .ap-drawer__backdrop { opacity: 1; }
.ap-drawer__sheet {
  position: absolute; top: 10px; right: 10px; bottom: 10px; width: min(460px, calc(100% - 20px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 26px; color: var(--ap-ink);
  background: rgba(244, 246, 248, .86);
  backdrop-filter: blur(30px) saturate(170%); -webkit-backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .6); box-shadow: 0 30px 90px rgba(0, 0, 0, .45);
  transform: translateX(calc(100% + 20px)); transition: transform .3s cubic-bezier(.22, .61, .36, 1);
  font-family: var(--font, Inter, "Segoe UI", Arial, sans-serif);
}
.ap-drawer.is-open .ap-drawer__sheet { transform: none; }
.ap-drawer__head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.ap-drawer__titles { flex: 1; min-width: 0; }
.ap-drawer__crumbs { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--ap-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 16px; }
.ap-drawer__title { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.2; }
.ap-drawer__icon { width: 44px; height: 44px; flex: none; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .85); color: var(--ap-ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ap-drawer__icon[hidden] { display: none; }
.ap-drawer__icon svg { width: 20px; height: 20px; }
.ap-drawer__body { position: relative; flex: 1; overflow: hidden; }
.ap-level {
  position: absolute; inset: 0; overflow-y: auto; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 6px;
  transform: translateX(100%); opacity: 0; visibility: hidden; transition: transform .28s ease, opacity .2s ease, visibility .28s;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.ap-level.is-active { transform: none; opacity: 1; visibility: visible; }
.ap-level.is-past { transform: translateX(-30%); }
.ap-row {
  min-height: 54px; width: 100%; box-sizing: border-box; padding: 10px 14px 10px 16px; border: 0; border-radius: 16px;
  display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, .62); color: var(--ap-ink);
  font: inherit; font-size: 16px; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer;
}
.ap-row--group { font-weight: 700; min-height: 62px; }
.ap-row--main { background: rgba(168, 28, 12, .1); color: var(--ap-accent); font-weight: 700; }
.ap-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ap-row small { font-size: 12.5px; font-weight: 500; color: var(--ap-muted); }
.ap-row b { min-width: 28px; height: 24px; padding: 0 8px; box-sizing: border-box; border-radius: 12px; background: rgba(168, 28, 12, .12); color: var(--ap-accent); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.ap-row svg { width: 16px; height: 16px; flex: none; }
.ap-row:active { background: #fff; }
.ap-row.is-current, .ap-row[aria-current="page"] { box-shadow: inset 3px 0 0 var(--ap-accent); }
.ap-drawer__foot { padding: 14px 16px 16px; border-top: 1px solid rgba(21, 24, 29, .08); display: flex; flex-direction: column; gap: 12px; }
.ap-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ap-chips a { padding: 9px 14px; border-radius: 999px; background: rgba(255, 255, 255, .85); color: var(--ap-ink); font-size: 14px; font-weight: 600; text-decoration: none; }

/* Тёмная тема сайта */
[data-theme="dark"] .ap-mega__inner, [data-theme="dark"] .ap-drawer__sheet { background: rgba(24, 30, 39, .84); color: #edf1f5; border-color: rgba(255, 255, 255, .14); }
[data-theme="dark"] .ap-dir, [data-theme="dark"] .ap-pane__title, [data-theme="dark"] .ap-row, [data-theme="dark"] .ap-drawer__icon, [data-theme="dark"] .ap-chips a { color: #edf1f5; }
[data-theme="dark"] .ap-pane__links a, [data-theme="dark"] .ap-flat__grid a { background: rgba(255, 255, 255, .06); color: #edf1f5; }
[data-theme="dark"] .ap-pane__links a:hover, [data-theme="dark"] .ap-flat__grid a:hover, [data-theme="dark"] .ap-dir:hover { background: rgba(255, 255, 255, .12); color: #fff; }
[data-theme="dark"] .ap-dir[aria-expanded="true"] { background: rgba(255, 255, 255, .14); color: #ff9d8f; }
[data-theme="dark"] .ap-row, [data-theme="dark"] .ap-drawer__icon, [data-theme="dark"] .ap-chips a { background: rgba(255, 255, 255, .07); }
[data-theme="dark"] .ap-row--main { background: rgba(218, 65, 46, .17); color: #ff9d8f; }
[data-theme="dark"] .ap-mega__dirs, [data-theme="dark"] .ap-drawer__foot { border-color: rgba(255, 255, 255, .1); }
[data-theme="dark"] .ap-mega__eyebrow, [data-theme="dark"] .ap-row small, [data-theme="dark"] .ap-drawer__crumbs, [data-theme="dark"] .ap-dir b { color: #acb6c3; }

[data-theme="dark"] .ap-header [aria-current="page"], [data-theme="dark"] .ap-pane__overview, [data-theme="dark"] .ap-mega__all { color: #ff9d8f !important; }

@media (max-width: 1240px) {
  .ap-logo .ap-logo__full { height: 32px; }
  .ap-nav__btn { padding: 0 9px; font-size: 14px; }
  .ap-mega__cta { display: none; }
}
@media (max-width: 1100px) {
  :root { --header-height: 92px; }
  .ap-header { top: 10px; left: 10px; right: 10px; }
  .ap-header__bar { height: 70px; padding: 0 10px 0 16px; }
  .ap-nav, .ap-mega { display: none; }
  .ap-burger { display: inline-flex; }
  .ap-logo .ap-logo__full { height: 33px; }
}
@media (max-width: 640px) {
  :root { --header-height: 80px; }
  .ap-header { top: 8px; left: 8px; right: 8px; }
  .ap-header__bar { height: 62px; padding: 0 8px 0 14px; border-radius: 18px; gap: 6px; }
  .ap-logo .ap-logo__full { height: 29px; }
  .ap-logo { margin-right: auto; }
  .ap-header__actions { gap: 6px; margin-left: 0; }
  .ap-burger { padding: 0 12px 0 10px; }
  .ap-header__actions .ap-cta { display: none; }
  .ap-drawer__sheet { top: 8px; right: 8px; bottom: 8px; left: 8px; width: auto; border-radius: 22px; }
}
@media (max-width: 380px) {
  .ap-logo .ap-logo__full { height: 25px; }
  .ap-burger span { display: none; }
  .ap-burger { padding: 0 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-mega, .ap-drawer__sheet, .ap-level, .ap-drawer__backdrop { transition: none; }
}

/* Карточка «Быстрый расчёт» в мега-меню: фон — картинка со страницы расчёта */
.ap-mega__cta {
  position: relative; overflow: hidden; isolation: isolate;
  background: #15181d url("/images/nerzha-raschet/nerzha-raschet-2.webp") 58% center / cover no-repeat;
}
.ap-mega__cta::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(13,16,20,.92) 0%, rgba(13,16,20,.74) 38%, rgba(13,16,20,.28) 62%, rgba(13,16,20,.86) 100%);
}
[data-theme="dark"] .ap-mega__cta { background-color: #15181d; }

/* Кнопка поиска в шапке */
.ap-header .ap-search-btn svg { width: 22px; height: 22px; }

/* Поиск по сайту: модальное окно по центру, матовое стекло */
.ap-search { position: fixed; inset: 0; z-index: 2100; display: flex; align-items: center; justify-content: center; padding: 16px; font-family: var(--font, Inter, "Segoe UI", Arial, sans-serif); }
.ap-search[hidden] { display: none; }
.ap-search__backdrop { position: absolute; inset: 0; background: rgba(9, 13, 18, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s ease; }
.ap-search__panel {
  position: relative; width: min(680px, 100%); max-height: min(78vh, 680px); display: flex; flex-direction: column; overflow: hidden;
  border-radius: 26px; color: var(--ap-ink); background: rgba(244, 246, 248, .82);
  backdrop-filter: blur(30px) saturate(170%); -webkit-backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .65); box-shadow: 0 30px 90px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .2s ease, transform .2s ease;
}
.ap-search.is-open .ap-search__backdrop { opacity: 1; }
.ap-search.is-open .ap-search__panel { opacity: 1; transform: none; }
.ap-search__field { display: flex; align-items: center; gap: 12px; margin: 14px; padding: 0 8px 0 18px; height: 58px; border-radius: 18px; background: rgba(255, 255, 255, .9); border: 1px solid rgba(21, 24, 29, .08); }
.ap-search__field > svg { width: 22px; height: 22px; flex: none; color: var(--ap-muted); }
.ap-search__field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; color: var(--ap-ink); font: inherit; font-size: 17px; }
.ap-search__field input::-webkit-search-cancel-button { display: none; }
.ap-search__close { width: 44px; height: 44px; flex: none; border: 0; border-radius: 12px; background: transparent; color: var(--ap-ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ap-search__close:hover { background: rgba(21, 24, 29, .06); }
.ap-search__close svg { width: 20px; height: 20px; }
.ap-search__hint { margin: 0; padding: 0 26px 8px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ap-muted); min-height: 15px; }
.ap-search__list { list-style: none; margin: 0; padding: 0 10px 12px; overflow-y: auto; overscroll-behavior: contain; }
.ap-search__item { display: flex; align-items: center; gap: 14px; padding: 8px 12px 8px 8px; border-radius: 16px; color: var(--ap-ink); text-decoration: none; }
.ap-search__item[aria-selected="true"], .ap-search__item:focus-visible { background: rgba(255, 255, 255, .92); box-shadow: 0 4px 14px rgba(9, 13, 18, .08); outline: none; }
.ap-search__thumb { width: 64px; height: 64px; flex: none; border-radius: 12px; overflow: hidden; background: #2a2f36; }
.ap-search__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-search__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ap-search__title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.ap-search__title mark { background: rgba(168, 28, 12, .14); color: inherit; border-radius: 4px; padding: 0 2px; }
.ap-search__sec { font-size: 13px; color: var(--ap-muted); }
.ap-search__item > svg { width: 16px; height: 16px; flex: none; color: var(--ap-muted); }
.ap-search__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 6px 6px; }
.ap-search__chips a { padding: 9px 14px; border-radius: 999px; background: rgba(255, 255, 255, .85); color: var(--ap-ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.ap-search__chips a:hover { color: var(--ap-accent); }
.ap-search__empty { padding: 18px 16px 22px; font-size: 15px; line-height: 1.5; color: var(--ap-muted); }
.ap-search__empty a { color: var(--ap-accent); font-weight: 700; }
[data-theme="dark"] .ap-search__panel { background: rgba(24, 30, 39, .86); color: #edf1f5; border-color: rgba(255, 255, 255, .14); }
[data-theme="dark"] .ap-search__field { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .12); }
[data-theme="dark"] .ap-search__field input, [data-theme="dark"] .ap-search__close, [data-theme="dark"] .ap-search__item, [data-theme="dark"] .ap-search__chips a { color: #edf1f5; }
[data-theme="dark"] .ap-search__item[aria-selected="true"] { background: rgba(255, 255, 255, .1); }
[data-theme="dark"] .ap-search__chips a { background: rgba(255, 255, 255, .08); }
[data-theme="dark"] .ap-search__hint, [data-theme="dark"] .ap-search__sec, [data-theme="dark"] .ap-search__empty { color: #acb6c3; }
[data-theme="dark"] .ap-search__title mark { background: rgba(255, 120, 100, .22); }
@media (max-width: 640px) {
  .ap-search { padding: 10px; }
  .ap-search__panel { max-height: 82vh; border-radius: 22px; }
  .ap-search__field { margin: 10px; height: 54px; }
  .ap-search__thumb { width: 56px; height: 56px; }
  .ap-burger span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ap-burger { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) { .ap-search__panel, .ap-search__backdrop { transition: none; } }
/* Фиксируем страницу по горизонтали на телефонах и планшетах */
html, body { overflow-x: clip; }
@supports not (overflow: clip) { body { overflow-x: hidden; } }
@media (max-width: 1100px) { html, body { max-width: 100%; touch-action: pan-x pan-y pinch-zoom; overscroll-behavior-x: none; } }
