/* ==========================================================================
   header.css — site masthead
   --------------------------------------------------------------------------
   Requires: tokens.css, base.css (in that order, before this file).
   Loaded on every page from header.php.

   This is the old inline <style> block from header.php, lifted out and
   tokenised. CLASS NAMES ARE UNCHANGED — .main-header, .nav-container,
   .logo-section, .nav-menu, .nav-cta, .mobile-toggle, .overlay, .top-bar —
   so anything in css/header-styles.css that targets them still applies.

   The old :root block that lived alongside these rules is GONE. It restated
   the same palette as tokens.css; two copies of one palette is a guarantee
   that they drift. Every colour below now resolves through tokens.

   Contents:
     1. Skip link
     2. Header shell
     3. Top bar
     4. Nav container & logo
     5. Nav menu
     6. Language selector
     7. Book CTA
     8. Mobile toggle & overlay
     9. Responsive
   ========================================================================== */


/* ==========================================================================
   1. Skip link
   ========================================================================== */
.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    z-index: 2000;
    padding: 10px var(--space-4);
    background: var(--color-action);
    color: var(--color-text-inverse);
    border-radius: 0 0 var(--radius-xs) 0;
    font-weight: var(--weight-bold);
    font-size: 14px;
}

.skip-link:focus { left: 0; }


/* ==========================================================================
   2. Header shell
   ========================================================================== */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-600) 55%, var(--navy-900) 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: box-shadow var(--duration-base) var(--ease);
}

.main-header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Garnet-to-brass rule along the bottom edge. */
.main-header::after {
    content: "";
    display: block;
    height: 2px;
    background: linear-gradient(90deg,
        var(--garnet-600) 0%,
        var(--garnet-600) 34%,
        var(--brass-500) 34%,
        var(--brass-500) 100%);
}


/* ==========================================================================
   3. Top bar
   Currently holds a commented-out contact/social block. The empty div still
   renders its padding + border — if you're not going to switch it on, drop
   the markup rather than shipping a 20px navy stripe.
   ========================================================================== */
.top-bar {
    padding: 10px 0;
    background: rgba(9, 17, 34, 0.98);
    border-bottom: 1px solid rgba(176, 141, 79, 0.28);
    font-size: 0.9rem;
}

.top-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-5);
    color: var(--color-text-inverse);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.top-bar-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-inverse);
    text-decoration: none;
    transition: color var(--duration-base) var(--ease);
}

.top-bar-item:hover { color: var(--color-accent-soft); }

.social-links {
    display: flex;
    gap: var(--space-4);
}

.social-links a {
    color: var(--color-text-inverse);
    font-size: 1.2rem;
    text-decoration: none;
    transition: transform var(--duration-base) var(--ease),
                color var(--duration-base) var(--ease);
}

.social-links a:hover {
    transform: translateY(-2px);
    color: var(--color-accent-soft);
}


/* ==========================================================================
   4. Nav container & logo
   ========================================================================== */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-5);
    color: var(--color-text-inverse);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    text-decoration: none;
    flex-shrink: 0;
}

.logo-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-round);
    border: 3px solid var(--color-accent);
    object-fit: cover;
    box-shadow: 0 0 15px rgba(176, 141, 79, 0.3);
    transition: transform var(--duration-base) var(--ease),
                box-shadow var(--duration-base) var(--ease);
}

.logo-img:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(176, 141, 79, 0.5);
}

.logo-text { color: var(--color-text-inverse); }

/* Site name is NOT an <h1> — each page keeps its own single content <h1>. */
.logo-text .logo-title {
    display: block;
    margin-bottom: 1px;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: var(--weight-semibold);
    line-height: 1.2;
}

.logo-text .logo-tag {
    margin: 0;
    font-size: 0.8rem;
    font-weight: var(--weight-normal);
    letter-spacing: 0.02em;
    opacity: 0.9;
}


/* ==========================================================================
   5. Nav menu
   ========================================================================== */
.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li { position: relative; }

.nav-menu a {
    position: relative;
    display: block;
    padding: 10px var(--space-4);
    border-radius: var(--radius-sm);
    color: var(--color-text-inverse);
    font-size: 0.95rem;
    font-weight: var(--weight-medium);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--duration-base) var(--ease);
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255, 255, 255, 0.12);
}

/* Brass underline. .active is now emitted by PHP alongside aria-current, so
   there's no post-paint flash while JS works out which page you're on. */
.nav-menu a::after {
    content: "";
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: width var(--duration-base) var(--ease);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 58%;
}


/* ==========================================================================
   6. Language selector
   --------------------------------------------------------------------------
   Sits in the nav as the last item before the CTA. It used to render in a
   white strip below the whole header, because each page injected its own
   <div class="lang"> at the top of its content — it read as a stray bar
   rather than a control.
   ========================================================================== */
.nav-lang {
    display: flex;
    align-items: center;
    margin-left: var(--space-2);
}

.nav-lang select {
    padding: 7px var(--space-2);
    border: 1px solid rgba(176, 141, 79, 0.45);
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text-inverse);
    font-family: var(--font-body);
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color var(--duration-base) var(--ease);
}

.nav-lang select:hover { border-color: var(--color-accent); }

/* The option list is drawn by the OS — without this it's dark-on-dark and
   unreadable in several browsers. */
.nav-lang select option {
    background: var(--white);
    color: var(--navy-800);
}


/* ==========================================================================
   7. Book CTA
   ========================================================================== */
.nav-cta {
    margin-left: var(--space-3);
    padding: 10px var(--space-5) !important;
    background: var(--color-action);
    border: 1px solid var(--color-action);
    border-radius: var(--radius-xs);
    font-weight: var(--weight-bold) !important;
    letter-spacing: 0.02em;
    box-shadow: 0 3px 10px rgba(125, 31, 43, 0.28);
}

.nav-cta:hover {
    background: var(--color-action-bright);
    color: var(--color-text-inverse);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(125, 31, 43, 0.4);
}

.nav-cta::after { display: none; }


/* ==========================================================================
   8. Mobile toggle & overlay
   ========================================================================== */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    z-index: 1001;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-toggle span {
    display: block;
    width: 30px;
    height: 3px;
    background: var(--color-text-inverse);
    border-radius: 3px;
    transition: transform var(--duration-base) var(--ease),
                opacity var(--duration-base) var(--ease);
}

.mobile-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(8px, 8px); }
.mobile-toggle.active span:nth-child(2) { opacity: 0; }
.mobile-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(8px, -8px); }

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.5);
}

.overlay.active { display: block; }


/* ==========================================================================
   9. Responsive
   ========================================================================== */
@media (max-width: 968px) {
    .top-bar { padding: 8px 0; }

    .top-bar-content {
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
    }

    .top-bar-left {
        flex-direction: column;
        gap: var(--space-2);
    }

    .logo-text .logo-title { font-size: 1.2rem; }
    .logo-text .logo-tag { font-size: 0.72rem; }
    .logo-img { width: 50px; height: 50px; }

    .mobile-toggle { display: flex; }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        z-index: 1000;
        width: 290px;
        height: 100vh;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 100px var(--space-7) var(--space-7);
        background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
        transition: right var(--duration-base) var(--ease);
    }

    .nav-menu.active { right: 0; }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-menu a {
        width: 100%;
        padding: var(--space-4) 10px;
    }

    .nav-lang {
        margin: var(--space-4) 0 0;
        border-bottom: none;
    }

    .nav-lang select { width: 100%; }

    .nav-cta {
        margin: var(--space-5) 0 0;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .top-bar-item span { display: none; }
    .logo-section { gap: 10px; }
}

/* No JS: the off-canvas menu can never open, so don't hide it off-screen. */
.no-js .nav-menu {
    position: static;
    right: auto;
    width: auto;
    height: auto;
    padding: 0;
    box-shadow: none;
    background: none;
}

.no-js .mobile-toggle { display: none; }