/* ============================================
   Layout - Header, Footer & Main Structure
   ============================================ */

/* ============================================
   Header
   ============================================ */

/* Хедер прилипает к верху на всех страницах. Сам тег — только прозрачная
   обёртка фиксированной высоты: фон, скругления и тень рисует .header-container.
   Высота вынесена в переменную, потому что на неё опирается отрицательный
   margin плиты hero на главной. */
header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0;
    border: none;
    background: none;
}

/* Белая панель-карточка. Раньше была только внутри плиты hero, на остальных
   страницах хедер шёл полосой с нижним бордером — теперь пилюля везде. */
.header-container {
    max-width: var(--plate-max);
    width: min(var(--plate-max), 100% - 40px);
    margin-inline: auto;
    height: 68px;
    padding: 0 26px;
    box-sizing: border-box;
    background: var(--bg-white);
    border-radius: 22px;
    box-shadow: 0 2px 10px rgba(43, 26, 94, 0.05);
    transition: box-shadow var(--transition-fast);
}

/* Отлипнув от верха страницы, пилюля едет по контенту: со штатной почти
   невидимой тенью она бы на белом фоне внутренних страниц пропадала.
   Класс вешает header.js. */
.header-container.is-stuck {
    box-shadow: 0 6px 22px rgba(43, 26, 94, 0.12);
}

.header-nav {
    /* gap задаётся здесь, а не инлайном: пункты — «пилюли» со своими
       отступами, между ними нужен маленький зазор. */
    gap: 6px;
}

.header-nav a {
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
    padding: 9px 15px;
    border-radius: 999px;
    /* без nowrap/flex-shrink пункты переносятся на второй ряд */
    white-space: nowrap;
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.header-nav a:hover {
    background: var(--plate-soft);
}

.header-nav a.is-active {
    background: var(--plate-soft);
}

.mobile-nav a.is-active {
    color: var(--accent);
}

.header-phone {
    font-weight: 800;
    font-size: 16px;
    color: var(--accent);
    margin-left: 10px;
}

/* На эталоне телефон без зелёной иконки */
.header-phone .fa-whatsapp {
    display: none;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    max-width: 35px;
    max-height: 35px;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-left: 70px;
}

.nav-links {
    display: flex;
    gap: 30px;
    font-size: var(--text-sm);
    font-weight: 500;
    margin-right: auto;
    margin-left: 100px;
}

.nav-links a {
    transition: color var(--transition-fast);
}

.nav-links a:hover {
    color: var(--primary-purple);
}

.contact-phone,
.header-phone,
.phone {
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.currency-switcher {
    display: flex;
    align-items: center;
}

.currency-switcher-label {
    display: none;
}

.lang-switcher {
    display: flex;
    align-items: center;
}

.lang-select,
.currency-select {
    appearance: none;
    min-width: 144px;
    height: 38px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-full);
    background-color: var(--bg-white);
    color: var(--text-dark);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-gray) 50%), linear-gradient(135deg, var(--text-gray) 50%, transparent 50%);
    background-position: calc(100% - 18px) 16px, calc(100% - 12px) 16px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.lang-select {
    min-width: 116px;
}

/* Кольцо рисует общее :focus-visible из base.css, здесь только подсветка
   рамки самого поля. Раньше стояло outline: none плюс тень на 12 %
   непрозрачности — это ~1.05:1 при норме 3:1, то есть переключатели языка
   и валюты с клавиатуры выглядели непрокликанными. */
.lang-select:focus-visible,
.currency-select:focus-visible {
    border-color: var(--primary-purple);
}

.lang-switcher--mobile {
    display: none;
}

.mobile-currency-switcher {
    display: none;
}

body.modal-open {
    overflow: hidden;
}

.consult-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
}

.consult-modal[hidden] {
    display: none;
}

.consult-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.52);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.consult-modal__dialog {
    position: relative;
    width: min(92vw, 460px);
    margin: min(12vh, 96px) auto 0;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 26px 80px rgba(15, 23, 42, 0.22);
    border: 1px solid color-mix(in srgb, var(--primary-purple) 14%, transparent);
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.consult-modal.is-open .consult-modal__backdrop {
    opacity: 1;
}

.consult-modal.is-open .consult-modal__dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.consult-modal__content {
    padding: 28px;
}

.consult-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary-purple) 8%, transparent);
    color: var(--primary-purple);
    cursor: pointer;
}

.consult-modal__eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg-purple-light);
    color: var(--primary-purple);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.consult-modal__content h3 {
    margin-bottom: 10px;
    font-size: clamp(1.5rem, 2vw, 1.9rem);
}

.consult-modal__content p {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 20px;
}

.consult-modal__actions {
    display: grid;
    gap: 12px;
}

.consult-modal__option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 20px;
    text-decoration: none;
    border: 1px solid color-mix(in srgb, var(--primary-purple) 12%, transparent);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.consult-modal__option:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--primary-purple) 12%, transparent);
    border-color: color-mix(in srgb, var(--primary-purple) 24%, transparent);
}

.consult-modal__option-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.consult-modal__option--telegram .consult-modal__option-icon {
    background: rgba(34, 158, 217, 0.12);
    color: #229ed9;
}

.consult-modal__option--whatsapp .consult-modal__option-icon {
    background: rgba(37, 211, 102, 0.12);
    color: #25d366;
}

.consult-modal__option-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.consult-modal__option-copy strong {
    color: var(--text-primary);
    font-size: var(--text-base);
}

.consult-modal__option-copy span {
    color: var(--text-light);
    font-size: var(--text-sm);
}

/* Top Bar (for contacts page) */
.top-bar {
    background-color: #fbfbfd;
    padding: 15px 0;
    font-size: 14px;
    color: #888;
    overflow: hidden;
    white-space: nowrap;
}

.top-bar .container {
    display: flex;
    gap: 20px;
    align-items: center;
}

.location-pin {
    color: var(--primary-purple);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

/* ============================================
   Footer
   ============================================ */

footer {
    background-color: var(--bg-light);
    padding: 60px 0 20px;
    margin-top: 60px;
    border-top: 1px solid var(--border-light);
    font-size: var(--text-sm);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.footer-col h4 {
    font-weight: 600;
    margin-bottom: 20px;
    font-size: var(--text-base);
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col ul li a {
    color: var(--text-gray);
    transition: color var(--transition-fast);
}

.footer-col ul li a:hover {
    color: var(--primary-purple);
}

/* Footer Contact Info */
.footer-contact {
    margin-bottom: 20px;
}

.footer-phone {
    font-size: var(--text-xl);
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
}

.footer-email {
    font-weight: 600;
    margin-bottom: 15px;
    display: block;
}

.footer-license {
    font-size: var(--text-xs);
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.4;
}

/* Social Links */
.social-links,
.social-row {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    font-size: var(--text-lg);
}

.social-links a {
    color: var(--text-dark);
    transition: color var(--transition-fast);
}

.social-links a:hover {
    color: var(--primary-purple);
}

/* Footer Links Grid (for body.css style) */
.footer-links-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.footer-links-grid a,
.footer-menu a {
    display: block;
    margin-bottom: 12px;
    color: var(--text-dark);
}

/* Footer Bottom */
.footer-bottom {
    border-top: 1px solid var(--border-light);
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: var(--text-xs);
    flex-wrap: wrap;
    gap: 20px;
}

/* Rating Widget */
.rating-widget,
.rating-box,
.rating {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating-score,
.rating-num {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-dark);
}

.stars {
    color: #FBBF24;
}

/* Tag NEW */
.tag-new {
    background: #e9d5ff;
    color: #6b21a8;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    margin-left: 5px;
    font-weight: 600;
}

/* Medical Link Badge */
.medical-link {
    border: 1px solid var(--primary-purple);
    color: var(--primary-purple);
    padding: 4px 10px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 20px;
    font-size: var(--text-xs);
}

/* Developer Logo */
.developer-logo {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ============================================
   Hero Section Base
   ============================================ */

.hero {
    padding: 40px 0;
    overflow: hidden;
    position: relative;
}

.hero h1 {
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-copyright-mark {
    display: inline-block;
    margin-left: 0.12em;
    font-size: 0.88em;
    line-height: 1;
    vertical-align: top;
}

.hero-copyright-note {
    margin-top: -10px;
    margin-bottom: 20px;
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-medium);
}

.hero-subtext,
.hero-desc {
    color: var(--text-gray);
    margin-bottom: 30px;
    max-width: 90%;
}

.hero-actions,
.hero-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* ============================================
   Hamburger Button (hidden on desktop)
   ============================================ */

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    z-index: var(--z-menu);
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-dark);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger → X animation */
.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   Mobile Menu (hidden on desktop)
   ============================================ */

/* Меню существует только на телефоне; на десктопе его не показываем вовсе,
   а не прячем нулевой высотой — иначе оно остаётся flex-ребёнком шапки. */
.mobile-menu {
    display: none;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
}

.mobile-nav a {
    display: block;
    padding: 14px 0;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-dark);
    text-decoration: none;
    border-bottom: 1px solid var(--border-light);
    transition: color var(--transition-fast);
}

.mobile-nav a:hover {
    color: var(--primary-purple);
}

.mobile-phone {
    display: block;
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}

/* Низ панели прижат к нижней кромке экрана: сверху список разделов,
   снизу — связаться. */
.mobile-menu__foot {
    margin-top: auto;
    padding-top: 24px;
}

.mobile-menu__note {
    margin: 0 0 14px;
    font-size: var(--text-sm);
    line-height: 1.45;
    color: var(--ink-body);
}

.mobile-menu__chats {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.mobile-menu__chat {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--plate-soft);
    color: var(--accent);
    font-size: 20px;
    text-decoration: none;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.mobile-menu__chat:hover {
    background: var(--pill);
    transform: translateY(-2px);
}

.mobile-menu__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--plate-soft);
    color: var(--ink);
    font-size: 18px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mobile-menu__close:hover {
    background: var(--pill);
}

/* ============================================
   Menu Backdrop
   ============================================ */

.menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: var(--z-backdrop);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.menu-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-links-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Header: show hamburger, hide desktop nav.
       position тут намеренно не переопределяем: relative убил бы sticky. */
    header {
        height: var(--header-h-mobile);
    }

    .header-container {
        width: calc(100% - 32px);
        height: 58px;
        padding: 0 16px;
        border-radius: 18px;
    }

    .hamburger {
        display: flex;
    }

    /* Override inline styles on desktop nav and phone */
    .header-nav {
        display: none !important;
    }

    .header-phone {
        display: none !important;
    }

    .currency-switcher--desktop,
    .lang-switcher--desktop {
        display: none !important;
    }

    .header-left {
        gap: 0 !important;
    }

    .header-actions {
        margin-left: auto;
    }

    /* Меню — панель, выезжающая справа поверх страницы. Раньше это был
       аккордеон внутри шапки, но шапка теперь flex фиксированной высоты,
       и меню вставало в строку рядом с логотипом вместо раскрытия вниз.
       Фикс-позиционирование заодно решает исходную проблему: список больше
       не ограничен высотой шапки. */
    .mobile-menu {
        position: fixed;
        top: 0;
        right: 0;
        z-index: var(--z-menu);
        display: flex;
        flex-direction: column;
        width: min(340px, 86vw);
        height: 100vh;
        height: 100dvh;
        padding: 68px 24px 28px;
        box-sizing: border-box;
        overflow-y: auto;
        background: var(--bg-white);
        box-shadow: -14px 0 44px rgba(43, 26, 94, 0.16);
        transform: translateX(100%);
        transition: transform 0.32s ease;
    }

    .mobile-menu.active {
        transform: translateX(0);
    }

    /* Layout */
    .header-inner {
        flex-wrap: wrap;
        gap: 15px;
    }

    .nav-links {
        gap: 15px;
        margin-left: 0;
        font-size: var(--text-xs);
    }

    .logo {
        margin-left: 0;
    }

    .mobile-currency-switcher {
        display: block;
        padding: 16px 0 0;
    }

    .mobile-currency-switcher .currency-select {
        width: 100%;
        min-width: 0;
    }

    .lang-switcher--mobile {
        display: block;
        padding: 16px 0 0;
    }

    .lang-switcher--mobile .lang-select {
        width: 100%;
        min-width: 0;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .footer-links-grid {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .social-links,
    .social-row {
        justify-content: center;
    }

    .hero h1 {
        font-size: calc(var(--text-4xl) * 0.95);
    }

    .hero-subtext,
    .hero-desc {
        max-width: 100%;
    }

    .hero-copyright-note {
        margin-top: -6px;
        margin-bottom: 18px;
    }

    .hero-actions,
    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 576px) {
    .hero h1 {
        font-size: calc(var(--text-h2) * 0.95);
    }

    .hero-copyright-note {
        font-size: var(--text-xs);
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }
}
