/* ============================================================
   BOE Header Plugin — Styles
   ============================================================ */

/* Wrapper */
.boe-header-wrapper {
    position: relative;
    width: 100%;
    background: #06142f;
    padding-top: 64px;
}

@media (max-width: 768px) {
    .boe-header-wrapper {
        padding-top: 56px;
    }
}

/* ============================================================
   Carousel
   ============================================================ */

.boe-carousel {
    position: relative;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    /* height is set inline by PHP */
    transition: transform 0.45s ease, opacity 0.45s ease, height 0.45s ease;
}

.boe-carousel.boe-collapsed {
    transform: translateY(-60px);
    opacity: 0;
    height: 0 !important; /* collapses DOM space, overrides inline height */
    pointer-events: none;
}

/* Each slide: fills the carousel, fades in/out */
.boe-carousel-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    opacity: 0;
    transition: opacity var(--boe-fade-speed, 1200ms) ease-in-out;
    will-change: opacity;
}

.boe-carousel-slide.boe-active {
    opacity: 1;
}

/* Dark overlay above the slides */
.boe-carousel-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, var(--boe-overlay-opacity, 0.2));
    pointer-events: none;
}

/* ============================================================
   Sticky Header
   ============================================================ */

.boe-sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
    background: var(--boe-sticky-bg, #ffffff);
    color: var(--boe-sticky-color, #333333);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

html[data-boe-theme="dark"] .boe-sticky-header {
    background: #06142f;
    color: #f0f4ff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

/* Push sticky header below the WP admin bar when logged in */
.admin-bar .boe-sticky-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .boe-sticky-header {
        top: 46px;
    }
}

.boe-sticky-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
}

/* Logo */
.boe-sticky-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.boe-sticky-logo img {
    max-height: 44px;
    width: auto;
    display: block;
}

/* Show only the logo matching the current theme. The dark logo is the default
   (no [data-boe-theme] attribute yet = pre-hydration = dark), so we only need
   to hide the light variant by default and swap when the theme is light. */
.boe-sticky-logo .boe-logo-light {
    display: none;
}
html[data-boe-theme="light"] .boe-sticky-logo .boe-logo-dark {
    display: none;
}
html[data-boe-theme="light"] .boe-sticky-logo .boe-logo-light {
    display: block;
}

.boe-sticky-site-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--boe-sticky-color, #333333);
    text-decoration: none;
}

/* Nav menu */
.boe-sticky-nav .boe-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 28px;
}

.boe-sticky-nav .boe-nav-list li {
    margin: 0;
    padding: 0;
}

.boe-sticky-nav .boe-nav-list a {
    color: var(--boe-sticky-color, #333333);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

/* Theme-scoped nav link color — overrides the inline --boe-sticky-color on
   .boe-sticky-header so menu items stay legible against either bg. */
html[data-boe-theme="dark"] .boe-sticky-nav .boe-nav-list a,
html:not([data-boe-theme]) .boe-sticky-nav .boe-nav-list a {
    color: #ffffff;
}
html[data-boe-theme="light"] .boe-sticky-nav .boe-nav-list a {
    color: #06142f;
}

.boe-sticky-nav .boe-nav-list a:hover {
    opacity: 0.7;
}

/* Theme toggle button */
.boe-theme-toggle {
    appearance: none;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 16px;
    padding: 0;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
    flex-shrink: 0;
}

.boe-theme-toggle:hover {
    background: rgba(127, 127, 127, 0.12);
}

.boe-theme-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
}

.boe-theme-toggle .boe-icon-sun { display: none; }
.boe-theme-toggle .boe-icon-moon { display: block; }
html[data-boe-theme="dark"] .boe-theme-toggle .boe-icon-sun { display: block; }
html[data-boe-theme="dark"] .boe-theme-toggle .boe-icon-moon { display: none; }

/* ============================================================
   Mega-menu dropdown (hover)
   ============================================================ */

.boe-sticky-nav .boe-nav-list > li.menu-item-has-children {
    position: static;
}

.boe-sticky-nav .boe-nav-list .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 18px 24px;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--boe-sticky-bg, #ffffff);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 10000;
}

.boe-sticky-nav .boe-nav-list > li.menu-item-has-children:hover > .sub-menu,
.boe-sticky-nav .boe-nav-list > li.menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.boe-sticky-nav .boe-nav-list .sub-menu > li {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 12px;
    text-align: center;
    box-sizing: border-box;
}

.boe-sticky-nav .boe-nav-list .sub-menu > li > a {
    display: block;
    padding: 8px 4px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--boe-sticky-color, #333333);
    text-decoration: none;
    white-space: normal;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.boe-sticky-nav .boe-nav-list .sub-menu > li > a:hover {
    opacity: 1;
    border-bottom-color: currentColor;
}

@media (max-width: 768px) {
    .boe-sticky-nav .boe-nav-list .sub-menu {
        position: static;
        flex-direction: column;
        box-shadow: none;
        padding: 8px 0;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .boe-sticky-inner {
        padding: 0 16px;
        height: 56px;
    }

    .boe-sticky-nav .boe-nav-list {
        gap: 16px;
    }

    .boe-sticky-nav .boe-nav-list a {
        font-size: 0.875rem;
    }

    .boe-sticky-logo img {
        max-height: 36px;
    }
}
