/* ===================================================================
   SHARED HEADER — DESKTOP NAVIGATION (global/partials/header.ejs, header-nav.js)
   Linked by the header partial next to header.css; the --hd-* tokens this file reads are declared
   in the critical inline CSS of head-with-css-tracking.ejs, so they resolve before the first paint.
   The list is the frame of the sliding pill (li.nav-pill); the item links are scoped as direct
   children so the panel content keeps its own link styles. The Ratgeber mega menu content lives in
   header-mega-menu.css.
   =================================================================== */
.desktop-navigation {
    position: relative;
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.desktop-navigation li {
    margin: 0 1px;
}

.desktop-navigation li:last-child {
    margin-right: 0;
}

.desktop-navigation > li > a {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    height: 38px;
    text-decoration: none;
    color: var(--hd-ink-2);
    border-radius: 999px;
    transition: color 0.18s;
    font-size: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 500;
    white-space: nowrap;
}

.desktop-navigation > li > a:hover,
.desktop-navigation > li.is-open > a {
    color: var(--hd-accent);
}

.desktop-navigation > li > a.selected-nav-item {
    color: var(--hd-accent);
    font-weight: 600;
}

.desktop-navigation > li > a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--hd-focus-ring);
}

/* The pill: header-nav.js sets its width and translate; it fades in once measured. */
.desktop-navigation .nav-pill {
    position: absolute;
    top: 50%;
    left: 0;
    z-index: 0;
    width: 0;
    height: 38px;
    margin: 0;
    border-radius: 999px;
    background: var(--hd-mint);
    opacity: 0;
    transform: translate(0, -50%);
    pointer-events: none;
}
.desktop-navigation.nav-initialized .nav-pill {
    transition: transform 0.26s var(--hd-ease), width 0.26s var(--hd-ease), opacity 0.18s;
}

/* The icon wrapper is sized to its SVG, so the flex centring of the link centres the icon on the
   label; an inline SVG would otherwise sit on the text baseline above the line box's descender. */
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 16px;
    height: 16px;
    line-height: 0;
    color: var(--hd-grey-ink);
    transition: color 0.18s;
}

.nav-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.desktop-navigation > li > a:hover .nav-icon,
.desktop-navigation > li.is-open > a .nav-icon,
.desktop-navigation > li > a.selected-nav-item .nav-icon {
    color: var(--hd-accent);
}

.dropdown-arrow {
    display: block;
    flex: none;
    opacity: 0.55;
    transition: transform 0.22s var(--hd-ease), opacity 0.18s;
}

.has-dropdown.is-open .dropdown-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* Phone CTA Button (Desktop) — needs .desktop-navigation prefix for specificity */
.desktop-navigation .nav-phone {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    font-size: 13px;
    color: var(--hd-accent);
    font-weight: 600;
    padding: 0 16px 0 14px;
    margin-left: 10px;
    border: 1.5px solid var(--hd-accent);
    border-radius: 999px;
    transition: background-color 0.18s, color 0.18s, border-color 0.18s;
    text-decoration: none;
}

.desktop-navigation .nav-phone svg {
    display: block;
    flex: none;
}

.desktop-navigation .nav-phone:hover {
    background: var(--hd-accent);
    color: #fff;
    border-color: var(--hd-accent);
}

/* ===================================================================
   DROPDOWN PANELS (Desktop): the Ratgeber mega menu and the provider dropdown share the frame.
   header-nav.js opens an item with `.is-open` on its li and arms the transitions with
   `.nav-initialized` on the list after the first paint.
   =================================================================== */
.has-dropdown {
    position: relative;
}

.has-dropdown .nav-dropdown-panel {
    position: absolute;
    top: calc(100% + 9px);
    left: 50%;
    max-width: calc(100vw - 40px);
    background: white;
    border: 1px solid var(--hd-line);
    border-radius: 18px;
    box-shadow: var(--hd-panel-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 6px) scale(0.985);
    transform-origin: 50% 0;
    z-index: 1001;
    padding: 0;
    margin-top: 0;
    pointer-events: none;
}

.nav-initialized .has-dropdown .nav-dropdown-panel {
    transition: opacity 0.18s var(--hd-ease), transform 0.22s var(--hd-ease), visibility 0s linear 0.22s;
}

/* Hover bridge between the trigger and the panel */
.has-dropdown .nav-dropdown-panel::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
}

.has-dropdown.is-open .nav-dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0) scale(1);
    pointer-events: auto;
}

.nav-initialized .has-dropdown.is-open .nav-dropdown-panel {
    transition: opacity 0.18s var(--hd-ease), transform 0.22s var(--hd-ease), visibility 0s;
}

/* ===================================================================
   PROVIDER DROPDOWN (Desktop)
   =================================================================== */

.provider-dropdown {
    width: 600px;
}

/* Heading inside the dropdown */
.provider-dropdown-header {
    padding: 16px 24px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.provider-dropdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 6px;
    padding: 18px 18px 14px;
}

.provider-dropdown .provider-dropdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 12px 8px 10px;
    height: 90px;
    box-sizing: border-box;
    border-radius: 12px;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.18s var(--hd-ease);
}

.provider-dropdown .provider-dropdown-item:hover {
    background-color: var(--hd-mint);
    transform: translateY(-1px);
}

.provider-dropdown .provider-dropdown-item:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--hd-focus-ring);
}

.provider-dropdown .provider-dropdown-logo {
    width: 72px;
    height: 41px;
    min-height: 41px;
    max-height: 41px;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.provider-dropdown .provider-dropdown-item:hover .provider-dropdown-logo {
    opacity: 1;
}

.provider-dropdown .provider-dropdown-name {
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    text-align: center;
    line-height: 1.3;
    transition: color 0.2s ease;
}

.provider-dropdown .provider-dropdown-item:hover .provider-dropdown-name {
    color: var(--hd-accent);
}

.provider-dropdown-all {
    display: block;
    text-align: center;
    padding: 14px 0;
    border-top: 1px solid var(--hd-line);
    border-radius: 0 0 18px 18px;
    background: var(--hd-cream);
    font-size: 13px;
    font-weight: 600;
    color: var(--hd-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.provider-dropdown-all:hover {
    color: var(--hd-accent-hover);
}

.provider-dropdown-all:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--hd-focus-ring);
}

/* Responsive: the desktop list gives way to the burger menu (header.css). This rule lives here,
   in the file that owns .desktop-navigation, so it always follows the display: flex above. */
@media (max-width: 768px) {
    .desktop-navigation {
        display: none;
    }

    .has-provider-dropdown .provider-dropdown {
        display: none !important;
    }

    .has-provider-dropdown .dropdown-arrow {
        display: none;
    }

    .has-provider-dropdown {
        position: static;
    }
}

/* ===================================================================
   REDUCED MOTION (for the selectors this file owns)
   =================================================================== */
@media (prefers-reduced-motion: reduce) {
    .desktop-navigation.nav-initialized .nav-pill,
    .nav-initialized .has-dropdown .nav-dropdown-panel,
    .nav-initialized .has-dropdown.is-open .nav-dropdown-panel,
    .dropdown-arrow,
    .provider-dropdown .provider-dropdown-item {
        transition: none;
    }

    .provider-dropdown .provider-dropdown-item:hover {
        transform: none;
    }
}
