/**
 * Header / nav chrome.
 *
 * USE CASE: Logo, main menu, dropdown spacing, mobile menu, and sticky
 * translucent header once the user scrolls past the natural header position.
 * Behaviour paired with assets/js/header.js and Views/partials/header.php.
 */
.dwch .dwch-header-slot { position: relative; }
.dwch .dwch-header-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 1px; pointer-events: none; }
.dwch .dwch-header { border-bottom: 1px solid var(--dwch-line-soft); background: #FFFFFF; }
.dwch .dwch-header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; padding-top: 14px; padding-bottom: 14px; }
.dwch .dwch-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.dwch .dwch-logo img { display: block; height: 48px; width: auto; }
.dwch .dwch-logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--dwch-accent); color: var(--dwch-accent); font-weight: 700; font-size: 18px; }
.dwch .dwch-logo-text { font-weight: 700; font-size: 20px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--dwch-strong); }
.dwch .dwch-menu-btn { display: none; }
.dwch .dwch-menu-btn .dwch-icon { width: 20px; height: 20px; }
.dwch .dwch-nav { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.dwch .dwch-nav-item { position: relative; }
.dwch .dwch-nav-row { display: inline-flex; align-items: center; }

/* Top-level links + dropdown parents share one pill look */
.dwch .dwch-nav > .dwch-nav-item > a,
.dwch .dwch-nav > .dwch-nav-item > .dwch-nav-toggle.dwch-nav-parent,
.dwch .dwch-nav-row > .dwch-nav-parent {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: var(--dwch-radius-box);
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--dwch-text);
    text-decoration: none;
    cursor: pointer;
    text-align: left;
}

.dwch .dwch-nav > .dwch-nav-item > a:hover,
.dwch .dwch-nav > .dwch-nav-item > .dwch-nav-toggle.dwch-nav-parent:hover,
.dwch .dwch-nav-has-children:hover > .dwch-nav-toggle.dwch-nav-parent,
.dwch .dwch-nav-has-children:hover > .dwch-nav-row > .dwch-nav-parent {
    background: #F4F4F4;
    color: var(--dwch-strong);
}

.dwch .dwch-nav > .dwch-nav-item > a[aria-current="page"],
.dwch .dwch-nav > .dwch-nav-item > .dwch-nav-toggle.dwch-nav-parent.is-active,
.dwch .dwch-nav-row > .dwch-nav-parent[aria-current="page"] {
    background: var(--dwch-accent);
    color: #FFFFFF;
}

.dwch .dwch-nav-chevron {
    width: 16px;
    height: 16px;
    flex: none;
    transition: transform 0.2s ease;
}

/* Desktop: no separate chevron control — hover opens submenu; hide chevron */
.dwch .dwch-nav-toggle:not(.dwch-nav-parent) {
    display: none;
}
.dwch .dwch-nav-chevron {
    display: none;
}
.dwch .dwch-nav-item.dwch-sub-open > .dwch-nav-toggle.dwch-nav-parent .dwch-nav-chevron,
.dwch .dwch-nav-item.dwch-sub-open > .dwch-nav-row .dwch-nav-chevron {
    transform: rotate(180deg);
}

.dwch .dwch-nav-sub {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 40;
    min-width: 240px;
    margin: 0;
    padding: 8px;
    list-style: none;
    background: #FFFFFF;
    border: 1px solid var(--dwch-line-soft);
    border-radius: var(--dwch-radius-box);
    box-shadow: var(--dwch-shadow);
}
.dwch .dwch-nav-has-children:hover > .dwch-nav-sub,
.dwch .dwch-nav-has-children:focus-within > .dwch-nav-sub {
    display: block;
}
.dwch .dwch-nav-sub > li + li {
    margin-top: 6px;
}
.dwch .dwch-nav-sub a {
    display: inline-flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--dwch-text);
    text-decoration: none;
    white-space: nowrap;
}
.dwch .dwch-nav-sub a:hover {
    background: #F4F4F4;
    color: var(--dwch-strong);
}
.dwch .dwch-nav-sub a[aria-current="page"] {
    background: var(--dwch-accent);
    color: #FFFFFF;
}

/* Compact sticky nav after scrolling past the natural header */
.dwch .dwch-header.dwch-header-stuck {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
    animation: dwch-header-slide-in 0.28s ease;
}
.dwch .dwch-header.dwch-header-stuck .dwch-header-inner {
    justify-content: space-between;
    padding-top: 8px;
    padding-bottom: 8px;
}
.dwch .dwch-header.dwch-header-stuck .dwch-logo img { height: 40px; }
.dwch .dwch-header.dwch-header-stuck .dwch-nav > .dwch-nav-item > a,
.dwch .dwch-header.dwch-header-stuck .dwch-nav > .dwch-nav-item > .dwch-nav-toggle.dwch-nav-parent {
    min-height: 40px;
}

@keyframes dwch-header-slide-in {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .dwch .dwch-header.dwch-header-stuck { animation: none; }
}

@media (max-width: 900px) {
    .dwch .dwch-menu-btn { display: inline-flex; }
    .dwch .dwch-header-nav { display: none; width: 100%; }
    .dwch .dwch-header.dwch-nav-open .dwch-header-nav { display: block; }
    /* Long menus (e.g. Previous Finals) must scroll inside the open mobile header */
    .dwch .dwch-header.dwch-nav-open {
        max-height: 100vh;
        max-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    .dwch .dwch-header.dwch-header-stuck.dwch-nav-open {
        max-height: 100vh;
        max-height: 100dvh;
    }
    .dwch .dwch-nav { flex-direction: column; gap: 2px; }
    .dwch .dwch-nav > .dwch-nav-item > a,
    .dwch .dwch-nav > .dwch-nav-item > .dwch-nav-toggle.dwch-nav-parent,
    .dwch .dwch-nav-row > .dwch-nav-parent {
        width: 100%;
    }

    /* Show chevron inside the single parent control */
    .dwch .dwch-nav-chevron {
        display: block;
        margin-left: auto;
    }

    /* Linked parents: one row, chevron is decorative on the link; hide extra toggle */
    .dwch .dwch-nav-row {
        display: flex;
        width: 100%;
    }
    .dwch .dwch-nav-row > .dwch-nav-parent {
        flex: 1;
    }
    .dwch .dwch-nav-row > .dwch-nav-parent .dwch-nav-chevron {
        display: block;
    }
    .dwch .dwch-nav-toggle:not(.dwch-nav-parent) {
        display: none;
    }

    .dwch .dwch-nav-has-children:hover > .dwch-nav-sub,
    .dwch .dwch-nav-has-children:focus-within > .dwch-nav-sub {
        display: none;
    }
    .dwch .dwch-nav-item.dwch-sub-open > .dwch-nav-sub {
        display: block;
    }
    .dwch .dwch-nav-sub {
        position: static;
        min-width: 0;
        margin: 0 0 4px;
        padding: 0 0 0 12px;
        border: 0;
        box-shadow: none;
        background: transparent;
    }
    .dwch .dwch-nav-sub a { min-height: 40px; font-size: 14px; }

    .dwch .dwch-header.dwch-header-stuck .dwch-logo img { height: 36px; }
}
@media (max-width: 600px) {
    .dwch .dwch-logo img { height: 36px; }
    .dwch .dwch-nav > .dwch-nav-item > a,
    .dwch .dwch-nav > .dwch-nav-item > .dwch-nav-toggle.dwch-nav-parent {
        padding: 0 12px;
        font-size: 15px;
    }
    .dwch .dwch-header { border-top: 0; }
}
