/* ============================================================
   layout.css — каркас: контейнер, ритм секций, шапка,
   липкая панель покупки, подвал.
   ============================================================ */

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.section { padding-block: var(--space-section); }
.section--alt { background: var(--c-bg-alt); }
.section--dark {
  background: var(--c-clover);
  color: var(--c-on-dark);
}
.section--dark h2 { color: #fff; }
/* надзаголовок на тёмном фоне: шалфей не читается, берём жёлтый */
.section--dark .eyebrow { color: var(--c-sun); }
.section--dark .eyebrow::before { background: var(--c-sun); }
.section-head { margin-bottom: var(--space-block); }

/* ---------- Шапка ----------
   Поверх первого экрана шапка прозрачная и не мешает заголовку.
   После прокрутки — плотный фон (иначе текст просвечивает сквозь неё)
   и уезжает вверх при движении вниз, освобождая экран телефона. */
.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--header-h);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: transform .32s var(--ease-out), background-color .3s,
              border-color .3s, box-shadow .3s;
}
.header.is-scrolled {
  background: var(--c-bg);
  border-color: var(--c-line);
  box-shadow: 0 4px 18px rgba(52, 52, 52, .06);
}
.header.is-hidden { transform: translateY(-100%); }
/* при работе с клавиатуры шапка не прячется */
.header:focus-within { transform: none; }

.header__in {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo { display: flex; align-items: center; flex: none; padding-block: .35rem; }
/* логотип клиники — рекламный носитель, поэтому крупнее обычного.
   Исходник 420×181: до 88px растёт без потери резкости даже на retina */
.logo__img {
  width: auto;
  height: 55px;
}
@media (min-width: 900px) { .logo__img { height: 60px; } }

/* ---------- Кнопка «меню» на телефоне ---------- */
.burger {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  margin-right: -.7rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-ink);
}
/* без JS кнопка ничего не откроет — прячем, разделы есть в подвале */
.no-js .burger { display: none; }
.burger__box { position: relative; width: 22px; height: 14px; }
.burger__box span {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .3s var(--ease-out), opacity .2s;
}
.burger__box span:nth-child(1) { top: 0; }
.burger__box span:nth-child(2) { top: 6px; }
.burger__box span:nth-child(3) { top: 12px; }
.burger[aria-expanded='true'] .burger__box span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded='true'] .burger__box span:nth-child(2) { opacity: 0; }
.burger[aria-expanded='true'] .burger__box span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Меню ---------- */
.menu {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 99;
  display: grid;
  align-content: start;
  padding: 1rem clamp(1rem, 4vw, 2rem) 2rem;
  background: var(--c-bg);
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out),
              visibility .25s;
}
.menu.is-open { opacity: 1; visibility: visible; transform: none; }
/* пока меню открыто, страница под ним не прокручивается */
html.menu-open, html.menu-open body { overflow: hidden; }
/* и шапка не может быть прозрачной — под ней было бы видно первый экран */
html.menu-open .header {
  background: var(--c-bg);
  border-color: var(--c-line);
}

.nav { display: grid; }
.nav a {
  display: flex;
  align-items: center;
  min-height: 56px;
  border-bottom: 1px solid var(--c-line);
  color: var(--c-ink);
  text-decoration: none;
  font-family: var(--f-display);
  font-size: 1.2rem;
  font-weight: 600;
}
.nav a:hover { color: var(--c-accent-text); }
.menu .header__cta { margin-top: 1.5rem; justify-content: center; }

/* второстепенные ссылки внизу меню */
.menu__extra {
  display: grid;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--c-line);
}
.menu__extra a {
  display: flex;
  align-items: center;
  min-height: 48px;
  color: var(--c-ink-soft);
  text-decoration: none;
  font-size: .98rem;
}
.menu__extra a:hover { color: var(--c-accent-text); }

@media (min-width: 940px) {
  .burger { display: none; }
  .menu {
    position: static;
    display: flex;
    align-items: center;
    gap: 1.6rem;
    padding: 0;
    background: none;
    overflow: visible;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .nav { display: flex; gap: 1.6rem; }
  .nav a {
    min-height: 44px;
    border-bottom: 0;
    font-family: var(--f-body);
    font-size: .95rem;
  }
  .menu .header__cta { margin-top: 0; }
  .menu__extra { display: none; } /* на десктопе эти ссылки есть в подвале */
}

/* ---------- Липкая панель покупки на телефоне ---------- */
.buybar {
  position: fixed;
  inset: auto 0 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
  background: var(--c-surface);
  box-shadow: 0 -6px 24px rgba(52, 52, 52, .12);
  transform: translateY(110%);
  transition: transform .35s var(--ease-out);
}
.buybar.is-shown { transform: none; }
.buybar__price { line-height: 1.25; font-size: .82rem; color: var(--c-ink-soft); }
.buybar__price b {
  display: block;
  font-size: 1.05rem;
  color: var(--c-ink);
}
@media (min-width: 940px) { .buybar { display: none; } }

/* ---------- Подвал ---------- */
.footer {
  background: var(--c-ink);
  color: var(--c-on-ink);
  /* снизу оставляем место под липкую панель покупки, иначе она
     закрывает последнюю строку с реквизитами */
  padding-block: 3rem calc(2.25rem + 74px + env(safe-area-inset-bottom));
  font-size: var(--fs-small);
}
@media (min-width: 940px) { .footer { padding-bottom: 2.25rem; } }
.footer a { color: #fff; text-decoration: none; }
.footer a:hover { color: var(--c-sun); text-decoration: underline; }

.footer__grid {
  display: grid;
  gap: 2rem;
  margin-bottom: 2.25rem;
}
@media (min-width: 700px) { .footer__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .footer__grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; } }

.footer__logo {
  width: auto;
  height: 56px;
  /* логотип цветной на тёмном — подсветим подложкой */
  background: #fff;
  padding: .5rem .7rem;
  border-radius: 12px;
}
.footer__about { margin-top: 1rem; line-height: 1.6; }

.footer__title {
  font-family: var(--f-display);
  font-size: 1rem;
  color: #fff;
  margin-bottom: .8rem;
}
/* подпись над контактами: чей это телефон */
.footer__note {
  margin: -.5rem 0 .3rem;
  font-size: .85rem;
  opacity: .72;
}
.footer__list { list-style: none; padding: 0; display: grid; gap: .15rem; }
/* ссылки в подвале — крупная площадь нажатия на телефоне */
.footer__list a {
  display: inline-block;
  padding-block: .65rem;
}

/* ---------- Соцсети иконками ---------- */
.socials {
  list-style: none;
  padding: 0;
  margin-top: .9rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.footer .social {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 50%;
  color: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .3);
  transition: background .2s, box-shadow .2s, transform .2s var(--ease-out);
}
.social svg { width: 22px; height: 22px; }
/* знак MAX плотнее остальных: на общей сетке он смотрелся крупнее */
.social--max svg { width: 20px; height: 20px; }
/* перебиваем общее правило подчёркивания ссылок в подвале */
.footer .social:hover,
.footer .social:focus-visible {
  background: var(--c-accent);
  box-shadow: inset 0 0 0 1.5px var(--c-accent);
  color: #fff;
  text-decoration: none;
  transform: translateY(-2px);
}

.footer__legal {
  border-top: 1px solid rgba(255, 255, 255, .14);
  padding-top: 1.5rem;
  color: var(--c-on-ink-soft);
  font-size: .8rem;
  line-height: 1.7;
}
/* телефон и почта в юридической строке — крупнее площадь нажатия */
.footer__legal a { display: inline-block; padding-block: .4rem; }
