/* Layout */

section[id] {
    scroll-margin-top: var(--hero-header-offset);
}

/* Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    opacity: 1;
    box-sizing: border-box;
    min-height: var(--header-height);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.header-container {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: clamp(12px, 2vw, 24px);
    width: 100%;
    box-sizing: border-box;
    padding: 0 5%;
    min-height: 0;
}

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

.lang-switcher {
    margin: 0;
    position: relative;
}

/* Language dropdown */
.lang-dropdown {
    position: relative;
    display: inline-block;
}

.lang-dropdown__summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin: 0;
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--nav-link);
    background: transparent;
    border: none;
    border-radius: var(--cta-radius);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.lang-dropdown__summary::-webkit-details-marker {
    display: none;
}

.lang-dropdown__summary::marker {
    content: '';
}

.lang-dropdown__summary:hover {
    color: var(--nav-link-hover);
    background-color: rgba(13, 27, 42, 0.06);
}

.lang-dropdown[open]>.lang-dropdown__summary {
    color: var(--nav-link-hover);
    background-color: rgba(13, 27, 42, 0.06);
}

.lang-dropdown__current {
    max-width: 4.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lang-dropdown__chevron {
    display: inline-block;
    width: 0.45em;
    height: 0.45em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-top: -0.2em;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.lang-dropdown[open] .lang-dropdown__chevron {
    transform: rotate(225deg);
    margin-top: 0.1em;
}

.lang-dropdown__panel {
    position: absolute;
    z-index: 1100;
    right: 0;
    top: calc(100% + 8px);
    min-width: 100%;
    width: max-content;
    max-width: min(240px, calc(100vw - 24px));
    padding: 6px;
    margin: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    border: 1px solid var(--header-border);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(13, 27, 42, 0.18);
    box-sizing: border-box;
}

.lang-dropdown__option {
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: left;
    color: var(--nav-link);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-dropdown__option:hover {
    color: var(--nav-link-hover);
    background: rgba(13, 27, 42, 0.06);
}

.lang-dropdown__option--active {
    color: var(--nav-link-hover);
    background: rgba(13, 27, 42, 0.08);
}

.lang-dropdown__option+.lang-dropdown__option {
    margin-top: 2px;
}

.lang-dropdown__summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.lang-dropdown__option:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Higher specificity than .cta-button for padding — font-size/letter-spacing come from .cta-button (0.85rem, 3px) */
.main-header .cta-button.header-book-cta {
    padding: 10px 18px;
    white-space: nowrap;
}

.main-header .lang-dropdown__summary {
    font-size: 0.85rem;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.header-logo-img {
    height: 52px;
    width: auto;
    display: block;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* center + gap: avoids space-between pinning first/last to edges (less side padding = wider row = more stretch) */
.nav-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px clamp(22px, 2.6vw, 34px);
    justify-self: stretch;
    width: 100%;
    min-width: 0;
    padding-inline: clamp(5%, 9vw, 14%);
    box-sizing: border-box;
}

.nav-menu a {
    position: relative;
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--nav-link);
    margin: 0;
    letter-spacing: 2px;
    font-family: var(--font-sans);
    transition: color 0.2s ease;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -0.32em;
    width: 0;
    height: 1px;
    background-color: var(--nav-link-hover);
    transition: width 0.3s ease;
}

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

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

/* Mobile burger (hidden on desktop) */
.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    justify-self: end;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease;
}

.mobile-nav-toggle:hover {
    background-color: rgba(13, 27, 42, 0.06);
}

.mobile-nav-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.mobile-nav-toggle__bar {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 1px;
    background-color: var(--nav-link);
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.mobile-nav-toggle--open .mobile-nav-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle--open .mobile-nav-toggle__bar:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle--open .mobile-nav-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Full-screen drawer (shown only ≤768px via media query below) */
.mobile-nav {
    display: none;
}

.mobile-nav__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(13, 27, 42, 0.4);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.mobile-nav--open .mobile-nav__backdrop {
    opacity: 1;
}

.mobile-nav__panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: max(12px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
    background: var(--bg-page-base);
    box-sizing: border-box;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: auto;
}

.mobile-nav--open .mobile-nav__panel {
    transform: translateX(0);
}

.mobile-nav__top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.mobile-nav__logo-link {
    text-decoration: none;
}

.mobile-nav__close {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--nav-link);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav__close:hover {
    background-color: rgba(13, 27, 42, 0.06);
}

.mobile-nav__close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.mobile-nav__links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    flex: 1 1 auto;
    padding: clamp(24px, 6vw, 40px) 0 clamp(20px, 4vw, 32px);
}

.mobile-nav__link {
    position: relative;
    display: block;
    width: 100%;
    padding: 14px 0;
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    color: var(--nav-link);
    border: none;
    background: none;
    text-align: left;
    transition: color 0.2s ease;
}

.mobile-nav__link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 10px;
    width: 0;
    height: 1px;
    background-color: var(--nav-link-hover);
    transition: width 0.3s ease;
}

.mobile-nav__link:hover,
.mobile-nav__link:focus-visible {
    color: var(--nav-link-hover);
}

.mobile-nav__link:hover::after,
.mobile-nav__link:focus-visible::after {
    width: 100%;
}

.mobile-nav__bottom {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 12px 16px;
    flex-shrink: 0;
    padding-top: 20px;
    border-top: 1px solid rgba(13, 27, 42, 0.08);
}

.mobile-nav__bottom .lang-switcher {
    margin-left: auto;
}

.mobile-nav__cta {
    flex: 0 0 auto;
}

.mobile-nav .lang-dropdown__panel {
    right: 0;
    left: auto;
}

/* Footer */
.main-footer {
    position: relative;
    width: 100%;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--footer-bg);
    border-top: 1px solid var(--footer-border);
    color: var(--footer-text);
    padding: 20px 5%;
    text-align: center;
    box-sizing: border-box;
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.footer-logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: 6px;
    margin-bottom: 5px;
    color: var(--footer-text);
}

.main-footer p {
    font-size: 0.8rem;
    color: var(--footer-text-muted);
    margin: 0;
}

@media (max-width: 768px) {
    /* Single row: logo + burger; nav/actions in full-screen drawer */
    .main-header {
        min-height: auto;
    }

    .header-container {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto;
        align-items: center;
        padding: calc(12px * 1.03) 5%;
        gap: 12px;
    }

    .logo {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        grid-column: 2;
        grid-row: 1;
    }

    .nav-menu--desktop {
        display: none !important;
    }

    .header-actions--desktop {
        display: none !important;
    }

    .mobile-nav {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 2000;
        visibility: hidden;
        pointer-events: none;
    }

    .mobile-nav.mobile-nav--open {
        visibility: visible;
        pointer-events: auto;
    }

    .header-logo-img {
        height: 40px;
    }
}

@media (min-width: 769px) {
    .mobile-nav-toggle {
        display: none !important;
    }

    .mobile-nav {
        display: none !important;
    }
}

body.mobile-nav-open {
    overflow: hidden;
    touch-action: none;
}

@media (max-width: 480px) {
    .header-container {
        padding: calc(10px * 1.03) 4%;
    }

    .header-logo-img {
        height: 36px;
    }

    .nav-menu a {
        font-size: 0.7rem;
        padding: 5px 8px;
    }

    .main-footer {
        min-height: 80px;
        padding: 15px 4%;
    }

    .footer-logo {
        font-size: 1.2rem;
        letter-spacing: 4px;
    }

    .main-footer p {
        font-size: 0.75rem;
    }
}