/* ==========================================================================
   base.css — БАЗОВЫЕ СТИЛИ И СТРУКТУРА
   (сбросы, типографика, фон, шапка/футер, базовая раскладка, утилиты)
   ========================================================================== */

/* --- Дизайн-переменные локально для layout-а (высота шапки и т.п.) --- */
:root {
    /* Высота фиксированной шапки на десктопе.
       Меняешь здесь — подхватит и отступ main. */
    --header-h: 100px;
}

/* --- Сброс/бокс-модель и плавная прокрутка --- */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Нужны для корректной флекс-раскладки BODY и «не короче экрана» */
html, body {
    height: 100%;
}

/* --- Базовые стили страницы и флекс-раскладка (header → main → footer) --- */
body {
    margin: 0; /* убираем дефолтные 8px */
    display: flex; /* делаем колонку всей страницы */
    flex-direction: column;
    min-height: 100dvh; /* минимум высота экрана (без прыжков на мобиле) */

    font-family: var(--font-family), sans-serif;
    background: var(--color-bg, #0f1b33); /* однотонный фон; fallback #16213e */
    color: var(--color-fg);

    overflow-x: hidden; /* защита от горизонтального скролла */
    opacity: 0; /* для анимации появления (см. JS) */
    transition: opacity .2s ease;
}

.header-container,
.footer-grid,
.footer-divider,
.footer-bottom {
    max-width: var(--content-max-width);
}

/* --- Основной контент --- */
.main-content {
    flex: 1 0 auto; /* растягивается, чтобы футер был внизу */
    display: flex; /* включаем флекс-режим */
    justify-content: center; /* центр по горизонтали */
    align-items: center; /* центр по вертикали */

    padding-top: var(--header-h);
    padding-bottom: 2rem;
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Утилита для страниц, где хочется центрировать контент и по X, и по Y */
.centered {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Контейнерные запросы (задел на будущее) --- */
.container, .hero-section, .menu-grid {
    container-type: inline-size;
}

/* ==========================================================================
   Шапка сайта (header) и навигация
   ========================================================================== */
.site-header {
    position: fixed; /* фиксируем сверху на десктопе */
    top: 0;
    left: 0;
    right: 0;
    background: rgba(12, 12, 12, .95); /* полупрозрачная плашка */
    backdrop-filter: blur(var(--header-blur));
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 1rem 2rem;
    z-index: 1000; /* выше контента */
    transition: all .3s ease;
}

/* Более крупный шрифт в шапке */
:root {
    --nav-font-size: 20px;
}

/* выбери 17–20px под вкус */
@media (max-width: 900px) {
    :root {
        --nav-font-size: 16px;
    }
}

.site-header .nav a {
    font-size: var(--nav-font-size); /* перекрывает 16px */
    font-weight: 600; /* опционально: пожирнее */
    letter-spacing: .01em; /* опционально: микро-кернинг */
}

/*.header-container {*/
/*    display: flex;*/
/*    justify-content: space-between;*/
/*    align-items: center;*/
/*    max-width: var(--content-max-width);
/*    margin: 0 auto;*/
/*}*/
/* Контейнер шапки по тем же рельсам, что и контент */
.header-container {
    max-width: var(--container-max); /* было var(--content-max-width) */
    margin: 0 auto;
    /*padding: 0 2.5rem;                   !* как у контентных блоков *!*/
    display: flex;
    align-items: center;
    justify-content: center; /* было flex-start по левому краю окна контента */
    gap: 1.5rem; /* расстояние между логотипом и меню */
}

.logo {
    display: inline-block;
    text-decoration: none;
}

.logo-img {
    height: 50px;
    transition: transform .3s ease;
}

.logo-img:hover {
    transform: scale(1.05);
}

/* --- Навигация --- */
.nav {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav a {
    color: var(--color-fg);
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: all .3s ease;
    position: relative;
}

.nav a:hover {
    color: var(--color-accent);
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(45deg, var(--color-accent), var(--color-accent-2));
    transition: width .3s ease;
}

.nav a:hover::after {
    width: 100%;
}

/* --- Бургер-меню (скрыто на десктопе) --- */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
}

/* ==========================================================================
   Футер — синхронизируем ширину с шапкой через переменную
   ========================================================================== */
.site-footer {
    background: var(--color-footer, rgba(12, 12, 12, .95));
    color: var(--color-fg-muted);
    padding: 2rem 1rem;
    margin-top: auto;
    flex-shrink: 0;
    border-top: 1px solid var(--color-border-subtle);
    --footer-title-line-width: 96px; /* длина линии */
    --footer-title-line-height: 3px; /* толщина */
    --footer-title-line-color: var(--color-accent); /* цвет линии */
}

/* Сетка футера - используем переменную */
.footer-grid {
    max-width: var(--content-max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2rem;
}

.footer-col {
    min-width: 160px;
}

.footer-title {
    font-size: 1rem;
    font-weight: 700;
    position: relative;
    margin-bottom: .6rem; /* чуть меньше, т.к. добавится линия */
    text-transform: uppercase;
    letter-spacing: .02em;
    color: #fff;
}

.footer-title::after {
    content: "";
    display: block;
    width: var(--footer-title-line-width);
    height: var(--footer-title-line-height);
    background: var(--footer-title-line-color);
    margin-top: .35rem;
    border-radius: 999px; /* аккуратные кончики */
}

/* Ссылки */
.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;

}

.footer-links li {
    margin: 0.3rem 0;
}

.footer-links a {
    color: var(--color-fg-muted);
    text-decoration: none;
    transition: color .2s ease;
}

.footer-links a:hover {
    color: var(--color-accent);
}

/* «Ещё…» */
.footer-more details > summary {
    cursor: pointer;
    list-style: none;
    color: var(--color-accent);
    font-weight: 600;
}

.footer-more details > summary::-webkit-details-marker {
    display: none;
}

.footer-more details > ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

.footer-more details > ul li {
    margin: 0.3rem 0;
}

/* Соцсети */
.footer-social {
    display: flex;
    gap: .75rem;
    margin-top: 1rem;
}

.footer-social img {
    width: 28px;
    height: 28px;
    opacity: .9;
    transition: transform .2s ease, opacity .2s ease;
}

.footer-social a:hover img {
    transform: translateY(-2px);
    opacity: 1;
}

/* Разделительная линия - используем переменную */
.footer-divider {
    max-width: var(--content-max-width);
    margin: 1.75rem auto 1rem;
    border: 0;
    height: 1px;
    background: var(--color-border-subtle);
}

/* Нижняя полоса - используем переменную */
.footer-bottom {
    max-width: var(--content-max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-copy {
    font-size: .9rem;
    color: var(--color-fg-dim);
}

.footer-bottom-links {
    display: flex;
    gap: .5rem;
    font-size: .9rem;
}

.footer-bottom-links a {
    color: var(--color-fg-muted);
    text-decoration: none;
}

.footer-bottom-links a:hover {
    color: var(--color-accent);
}

.footer-bottom .dot {
    opacity: .6;
}

/* Адаптив - плавные переходы от 8 колонок */
@media (max-width: 1600px) {
    .footer-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

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

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

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

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

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

@media (max-width: 400px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

.site-footer .footer-legal {
    margin-top: 1rem;
    border-top: 1px solid var(--color-border-subtle);
    padding: .75rem 0;
    color: var(--color-fg-dim);
}

.footer-legal__inner {
    max-width: var(--container-max, 1200px);
    margin: 0 auto;
    padding: 0 1rem;

    display: flex; /* вместо grid */
    align-items: center;
    justify-content: center; /* центрируем по ширине */
    gap: .6rem; /* интервал между частями */
    text-align: center; /* центр текста на малых ширинах */
    flex-wrap: wrap; /* можно переносить на очень узких экранах */
}

/* Опционально: разделитель-точка между копирайтом и ремаркой */
.footer-legal__note::before {
    content: "•";
    margin: 0 .5rem;
    opacity: .55;
}

/* Стили ссылок оставляем аккуратными */
.footer-legal a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}


/* ==========================================================================
   Адаптивность
   ========================================================================== */
@media (max-width: 768px) {
    /* На мобилках шапка «едет» вместе со страницей — убираем fixed */
    .site-header {
        position: static;
    }

    /* И тогда отступ сверху больше не нужен */
    .main-content {
        padding-top: 0;
    }

    /* Включаем бургер; прячем меню до клика */
    .menu-toggle {
        display: block;
    }

    .nav {
        display: none;
        flex-direction: column;
        gap: 1rem;
        position: absolute;
        top: 70px;
        right: 20px;
        background: rgba(12, 12, 12, .95);
        padding: 1rem 1.5rem;
        border-radius: var(--radius-md);
    }

    .nav.active {
        display: flex;
    }

    /* Уплотняем боковые отступы */
    .main-content {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 480px) {
    /* Предотвращаем зум на iOS при фокусе полей */
    input[type="text"], input[type="email"], textarea {
        font-size: 16px;
    }
}

/* ==========================================================================
   Анимированный фон (частицы, на заднем плане)
   ========================================================================== */
.particles {
    position: fixed;
    inset: 0; /* растянуть на весь экран */
    z-index: -1; /* под контентом */
    opacity: .1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: float 20s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(100vh) translateX(0) rotate(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) translateX(100px) rotate(360deg);
        opacity: 0;
    }
}

/* ==========================================================================
   Утилиты анимаций появления
   ========================================================================== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp .8s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.delay-1 {
    animation-delay: .2s;
}

.delay-2 {
    animation-delay: .4s;
}

.delay-3 {
    animation-delay: .6s;
}

.delay-4 {
    animation-delay: .8s;
}

/* Мобилка: логотип слева, бургер справа */
@media (max-width: 768px) {
    .site-header .header-container {
        position: relative;
        justify-content: space-between;
        padding: 0 1rem;
    }

    .site-header .menu-toggle {
        display: block;
    }

    .site-header .nav {
        display: none;
        position: absolute;
        top: calc(100% + .5rem);
        right: 1rem;
        left: auto;
        flex-direction: column;
        gap: 1rem;
        background: rgba(12, 12, 12, .95);
        padding: 1rem 1.25rem;
        border-radius: var(--radius-md);
    }

    .site-header .nav.active {
        display: flex;
    }
}

/* Мобилка: контент не центрируем по вертикали, чтобы не «плавал» */
@media (max-width: 768px){
  .main-content{
    align-items: stretch; /* вместо center */
  }
}
