/*
 * Header styles
 */

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-normal),
                border-color var(--transition-normal);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}


/* ============================================================
   LOGO
   ============================================================ */
.header-logo a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color var(--transition-fast);
    white-space: nowrap;
}

.header-logo a:hover {
    color: var(--primary);
}


/* ============================================================
   DESKTOP NAVIGATION
   ============================================================ */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.header-nav a {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--r-sm);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.header-nav a:hover {
    color: var(--text-main);
    background: var(--bg-surface-alt);
}

.header-nav a[aria-current="page"],
.header-nav .current-menu-item > a {
    color: var(--primary);
    background: var(--primary-soft);
}


/* ============================================================
   HEADER ACTIONS
   ============================================================ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


/* ============================================================
   THEME TOGGLE
   ============================================================ */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
}

.theme-toggle:hover {
    color: var(--text-main);
    border-color: var(--border-strong);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: flex; }

[data-theme="dark"] .theme-toggle .icon-sun  { display: flex; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }


/* ============================================================
   HAMBURGER BUTTON
   ============================================================ */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    cursor: pointer;
    padding: 0;
    transition: all var(--transition-fast);
}

.mobile-menu-toggle:hover {
    border-color: var(--border-strong);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 18px;
    height: 18px;
    gap: 4px;
}

.hamburger-icon span {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 1px;
    transition: all 0.25s ease;
    transform-origin: center;
}

/* Hamburger → X при открытии */
.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}


/* ============================================================
   TABLET
   ============================================================ */
@media (max-width: 1024px) {
    .header-nav a {
        padding: 0.5rem 0.625rem;
        font-size: 0.8125rem;
    }
}


/* ============================================================
   MOBILE — dropdown меню сверху вниз
   ============================================================ */
@media (max-width: 768px) {

    .mobile-menu-toggle {
        display: flex;
    }

    .header-nav {
        /* Позиция: прямо под хедером, на всю ширину */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 0.5rem 1rem;
        gap: 0.125rem;
        box-shadow: var(--shadow-lg);
        z-index: 95;

        /* Скрыто по умолчанию */
        display: none;
        opacity: 0;
        transform: translateY(-8px);
    }

    .header-nav.is-open {
        display: flex;
        opacity: 1;
        transform: translateY(0);
        animation: menuDropdown 0.2s ease forwards;
    }

    @keyframes menuDropdown {
        from {
            opacity: 0;
            transform: translateY(-8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .header-nav a {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        width: 100%;
        border-radius: var(--r-md);
    }

}

@media (max-width: 380px) {
    .header-inner {
        padding: 0 1rem;
    }

    .header-logo a {
        font-size: 0.8125rem;
    }
}