.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: var(--header-h);
    background: var(--bg-header-footer);
    position: relative;
    z-index: 30;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
    color: white;
    transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1);
}

/* Пропорциональное масштабирование: размеры жестко привязаны к высоте шапки var(--header-h) */
/* Это позволяет динамически уменьшать/увеличивать весь UI при смене высоты контейнера */
.logo {
    display: block;
    height: auto;
    width: calc(var(--header-h) * 2.51);
    margin-top: calc(var(--header-h) * 0.154);
    transform-origin: top center;
    transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1), 
                margin 0.7s cubic-bezier(0.65, 0, 0.35, 1), 
                opacity 0.6s ease-out 0.2s;
    animation: breathingGlow 4s ease-in-out infinite;
    will-change: transform, filter; /* Подсказка для GPU */
}

.header .slogan {
    display: block;
    height: auto;
    width: calc(var(--header-h) * 1.475);
    margin-top: auto;
    margin-bottom: calc(var(--header-h) * 0.151);
    transform-origin: center;
    transition: opacity 0.3s ease, transform 0.7s cubic-bezier(0.65, 0, 0.35, 1), margin 0.7s cubic-bezier(0.65, 0, 0.35, 1);
}

.header .slogan-gallery {
    display: none;
    height: auto;
    width: calc(var(--header-h) * 1.475);
    margin-top: auto;
    margin-bottom: calc(var(--header-h) * 0.151);
    transform-origin: center;
    transition: opacity 0.3s ease, transform 0.7s cubic-bezier(0.65, 0, 0.35, 1), margin 0.7s cubic-bezier(0.65, 0, 0.35, 1);
}

/* --- ФУТЕР (FOOTER) --- */
.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: var(--footer-h);
    background: var(--bg-header-footer);
    z-index: 30;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.6);
    display: flex;
    /* space-evenly гарантирует абсолютно одинаковые отступы между всеми элементами */
    justify-content: space-evenly;
    /* Уменьшаем паддинг, так как space-evenly сам создает отступы по бокам */
    padding: 0 4%; 
    align-items: center;
    transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.3s ease;
}

/* Сброс стилей для ссылок в футере (иконки и телефон) */
.footer a {
    text-decoration: none;
    color: inherit;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Капсула (подложка) номера телефона */
.phone-group {
    display: flex;
    align-items: center;
    justify-content: center; /* Центрируем содержимое внутри пилюли */
    gap: 3px; /* Сближаем иконку и номер */
    background: rgba(0, 12, 46, 0.2);
    border: 1.5px solid #ffde83;
    border-radius: 50px;
    padding: 10px 10px;
    height: auto;
}

.phone-number {
    color: var(--color-phone);
    font-family: 'DIN Round Pro', sans-serif;
    font-weight: bold;
    font-size: 0.95rem; /* Уменьшен размер */
    white-space: nowrap;
    line-height: 1;
}

/* Мини-иконка трубки внутри капсулы */
.phone-group .social-icon {
    height: 16px;
    width: 16px;
    min-width: auto; /* Снимаем ограничение 24px для компактности */
}

/* --- ОБЩИЕ СТИЛИ ИКОНОК --- */
.social-icon {
    height: 24px;
    /* min-width позволяет прямоугольным иконкам (почта) сохранять пропорции */
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-icon img {
    height: 85%; /* Создаем "воздух" вокруг иконки */
    width: auto;
}

.header .city-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    transform: translateY(50%);
    display: flex;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease, transform 0.7s cubic-bezier(0.65, 0, 0.35, 1);
}

/* ЛИНИЯ ФУТТЕРА */
.header .city-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 5%;
    /* Отступ как в футере */
    right: 5%;
    /* Отступ как в футере */
    height: 2px;
    background-color: #ffde83;
    border-radius: 2px;
    /* Скругление как в футере */
    transform: translateY(-50%);
    z-index: -1;
}

/* ПЛАШКА ПОД ГОРОДОМ */
.city-tag {
    background: #ffde83;
    color: #10252E;
    font-family: 'DIN Round Pro', sans-serif;
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
    /* Сброс радиуса и применение маски */
    border-radius: 0;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20' preserveAspectRatio='none'%3E%3Cpath d='M0 10 L10 2 Q13 0 18 0 H82 Q87 0 90 2 L100 10 L90 18 Q87 20 82 20 H18 Q13 20 10 18 Z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20' preserveAspectRatio='none'%3E%3Cpath d='M0 10 L10 2 Q13 0 18 0 H82 Q87 0 90 2 L100 10 L90 18 Q87 20 82 20 H18 Q13 20 10 18 Z' fill='black'/%3E%3C/svg%3E");
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    
    font-size: calc(var(--header-h) * 0.07);
    /* Увеличен боковой padding (с 0.10 до 0.14), чтобы текст не заходил на скосы */
    padding: calc(var(--header-h) * 0.01) calc(var(--header-h) * 0.14);
}

/* ЛИНИЯ ФУТТЕРА */
.footer-divider {
    position: absolute;
    top: 0;
    left: 5%;
    width: 90%;
    height: 2px;
    background: #ffde83;
    border-radius: 2px;
    z-index: 11;
}

/* Добавляем паттерн в шапку и футер */
header,
.header,
footer,
.footer {
    /* Используем абсолютный путь к новому холсту */
    background-image: url('/assets/ui/background_head.svg');

    /* Чтобы узор не размножался и стоял по центру */
    background-repeat: no-repeat;
    background-position: center;

    /* Настраиваем заполнение — cover растянет узор на всю площадь блока */
    background-size: cover;
}

/* Дыхание логотипа (Breathing Glow) */
@keyframes breathingGlow {
    0%, 100% {
        filter: drop-shadow(0 0 2px rgba(153, 255, 153, 0.15));
        transform: scale(1);
    }
    50% {
        /* Мягкое свечение фирменным цветом и микро-увеличение */
        filter: drop-shadow(0 0 14px rgb(183, 0, 255));
        transform: scale(1.02);
    }
}

/* --- СТЕЙТ-МАШИНА (Layout) --- */
body.state-gallery .header {
    transform: translateY(-60%);
    cursor: pointer; /* Делаем выступающую шапку кликабельной для возврата */
}

body.state-gallery .logo {
    opacity: 0;
    pointer-events: none;
    /* Логотип улетает выше границы шапки, создавая эффект параллакса */
    transform: translateY(-150%) scale(0.9);
}

body.state-gallery .slogan {
    display: none;
}

body.state-gallery .slogan-gallery {
    display: block;
    transform: scale(1.1);
    opacity: 1;
}

body.state-gallery .city-divider {
    opacity: 1;
    pointer-events: none;
    transform: translateY(50%) scale(1);
}

body.state-gallery .city-tag {
    opacity: 0;
}

body.state-gallery .footer {
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.2s ease-in, opacity 0.2s ease-in;
}

/* Toast Notification */
#copy-toast {
    position: fixed;
    bottom: calc(var(--footer-h) + 2dvh);
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    color: #333333;
    font-family: sans-serif;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    text-align: center;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    white-space: nowrap;
}
#copy-toast.show {
    opacity: 1;
}

/* --- APP WRAPPER LOGIC (DESKTOP SCALING) --- */
@media (min-width: 481px) and (pointer: fine) {
    .phone-group {
        padding: 6px 20px;
        border: 2px solid #ffde83;
        gap: 6px;
    }
    .phone-number {
        font-size: 1.33rem;
    }
    .social-icon {
        height: 34px;
        min-width: 34px;
    }
    .phone-group .social-icon {
        height: 22px;
        width: 22px;
    }
}
