/* Homepage nav: liquid-glass pill header, Resources mega menu and card-style mobile menu.
   Loaded after styles.css and lang-switcher.css on the homepage only (kleyton.html keeps the old header).

   Glass recipe: a low-alpha tint + heavy blur/saturate and a soft inner glow, no borders. The pill's blur sits on a ::before layer, not on .header-container
   itself: an element with backdrop-filter stops its descendants from blurring the page, and the
   mega panel needs to blur the page on its own. */

:root {
    --glass-tint: rgba(22, 26, 31, 0.38);
    --glass-tint-strong: rgba(22, 26, 31, 0.62);
    --glass-blur: blur(26px) saturate(185%) brightness(1.04);
    --glass-edge: rgba(255, 255, 255, 0.14);
    --glass-shine: inset 0 0 24px rgba(255, 255, 255, 0.04);
    --glass-drop: 0 10px 40px rgba(0, 0, 0, 0.3);
    --glass-chip: rgba(255, 255, 255, 0.08);
    --glass-chip-hover: rgba(255, 255, 255, 0.14);
    --nav-line: rgba(255, 255, 255, 0.1);
    --nav-muted: #a7adb3;
    --nav-cream: #f4f1ea;
    --nav-radius: 28px;
    --nav-tile: radial-gradient(120% 85% at 50% 0%, rgba(246, 174, 45, 0.32), rgba(246, 174, 45, 0.03) 70%), rgba(255, 255, 255, 0.05);
}

/* Small glass chips: language pill, menu/close buttons, link hover bubble */
.desktop-nav .lang-switcher-btn,
.mobile-menu-btn,
.close-mobile-menu {
    background: var(--glass-chip);
    border: 1px solid transparent;
}

/* ── Floating pill ─────────────────────────────────────────── */
header {
    padding: 12px 12px 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
}

header.scrolled {
    background: transparent;
    border-bottom: none;
    box-shadow: none;
}

.header-container {
    isolation: isolate;
    gap: 8px;
    max-width: 1200px;
    padding: 8px 8px 8px 20px;
    border: 1px solid transparent;
    border-radius: var(--nav-radius);
    box-shadow: var(--glass-drop);
    transition: box-shadow 0.25s ease, border-radius 0.2s ease;
}

.header-container::before {
    content: '';
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: inherit;
    background: var(--glass-tint);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--glass-shine);
    transition: background 0.25s ease;
}

header.scrolled .header-container {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

header.scrolled .header-container::before {
    background: var(--glass-tint-strong);
}

.header-container .logo-text-img {
    height: 30px;
}

/* The header no longer has its own background, so let the hero image run under it */
.hero-bg {
    top: 0;
}

/* CTA pill: always visible, sits next to the menu button on mobile */
#navDesktopCta,
.mobile-menu-cta {
    box-shadow: inset 0 1px 0 #fff, inset 0 -2px 6px rgba(0, 0, 0, 0.08), 0 4px 14px rgba(0, 0, 0, 0.25);
}

#navDesktopCta {
    display: inline-flex !important;
    align-items: center;
    margin-left: auto;
    padding: 12px 20px;
    border-radius: 999px;
    background: var(--nav-cream);
    color: #111;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.2s ease;
}

#navDesktopCta:hover {
    background: #fff;
    transform: translateY(-1px);
}

/* Round two-line menu button */
.mobile-menu-btn {
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.mobile-menu-btn:hover {
    background: var(--glass-chip-hover);
}

.mobile-menu-btn span {
    width: 18px;
    border-radius: 2px;
}

.mobile-menu-btn:hover span {
    background-color: #f8f8f9;
}

/* ── Desktop ───────────────────────────────────────────────── */
@media (min-width: 1024px) {
    .header-container {
        padding-left: 28px;
    }

    .desktop-nav {
        flex: 1;
        gap: 8px;
    }

    .nav-links {
        gap: 4px;
        margin: 0 auto;
    }

    .nav-links > li > a,
    .nav-dropdown-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 11px 18px;
        border-radius: 999px;
        color: rgba(248, 248, 249, 0.85);
        font-size: 0.95rem;
        font-weight: 500;
        transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    }

    .nav-links > li > a:hover,
    .nav-dropdown:hover .nav-dropdown-toggle,
    .nav-dropdown:focus-within .nav-dropdown-toggle,
    .nav-dropdown.is-open .nav-dropdown-toggle {
        background: var(--glass-chip);
        color: #fff;
    }

    .desktop-nav .lang-switcher {
        margin-left: 0;
    }

    .desktop-nav .lang-switcher-btn {
        padding: 13px 16px;
        border-radius: 999px;
    }

    .desktop-nav .lang-switcher-btn:hover {
        background: var(--glass-chip-hover);
        border-color: transparent;
    }

    /* Mega menu: the pill opens downward into a full-width glass panel */
    .nav-dropdown {
        position: static;
    }

    .header-container:has(.nav-dropdown:hover),
    .header-container:has(.nav-dropdown:focus-within),
    .header-container:has(.nav-dropdown.is-open) {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .header-container:has(.nav-dropdown:hover)::before,
    .header-container:has(.nav-dropdown:focus-within)::before,
    .header-container:has(.nav-dropdown.is-open)::before {
        background: var(--glass-tint-strong);
        box-shadow: none;
    }

    .nav-dropdown-menu {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 270px;
        top: 100%;
        left: -1px;
        right: -1px;
        min-width: 0;
        margin-top: 0;
        padding: 12px 20px 24px;
        background: var(--glass-tint-strong);
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
        border: none;
        border-radius: 0 0 var(--nav-radius) var(--nav-radius);
        box-shadow: inset 0 -20px 40px rgba(255, 255, 255, 0.02), 0 30px 60px rgba(0, 0, 0, 0.45);
        transform: translateY(-6px);
    }

    .nav-dropdown:hover .nav-dropdown-menu,
    .nav-dropdown:focus-within .nav-dropdown-menu,
    .nav-dropdown.is-open .nav-dropdown-menu {
        transform: translateY(0);
    }

    /* Bridge covers the gap between the toggle and the panel */
    .nav-dropdown-menu::before {
        top: -26px;
        height: 26px;
    }

    .nav-dropdown-menu::after {
        display: none;
    }

    .nav-mega-tools {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px 8px;
        padding-right: 20px;
    }

    .nav-dropdown-menu a {
        white-space: normal;
    }

    .nav-dropdown-item {
        align-items: flex-start;
        gap: 16px;
        padding: 12px;
        border-radius: 20px;
        transition: background 0.2s ease, box-shadow 0.2s ease;
    }

    .nav-dropdown-item:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    .nav-dropdown-icon {
        flex: 0 0 64px;
        width: 64px;
        height: 80px;
        border-radius: 18px;
        background: var(--nav-tile);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -8px 16px rgba(0, 0, 0, 0.15);
        font-size: 1.4rem;
        transition: border-color 0.2s ease;
    }

    .nav-dropdown-item:hover .nav-dropdown-icon {
        border-color: rgba(246, 174, 45, 0.5);
    }

    .nav-dropdown-text {
        gap: 6px;
        min-width: 0;
        padding-top: 4px;
    }

    .nav-dropdown-text strong {
        font-size: 0.9rem;
        font-weight: 700;
        line-height: 1.2;
    }

    .nav-dropdown-text small {
        color: var(--nav-muted);
        font-size: 0.82rem;
        line-height: 1.45;
    }

    .nav-mega-side {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding-left: 20px;
        border-left: 1px solid var(--nav-line);
    }

    .nav-mega-link {
        display: flex;
        flex-direction: column;
        gap: 3px;
        padding: 12px 14px;
        border-radius: 16px;
        text-decoration: none;
        transition: background 0.2s ease, box-shadow 0.2s ease;
    }

    .nav-mega-link:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    .nav-mega-link strong {
        color: #f8f8f9;
        font-size: 1.02rem;
        font-weight: 500;
        transition: color 0.2s ease;
    }

    .nav-mega-link:hover strong {
        color: #F6AE2D;
    }

    .nav-mega-link small {
        color: var(--nav-muted);
        font-size: 0.82rem;
        font-weight: 400;
        line-height: 1.4;
    }
}

@media (min-width: 1024px) and (max-width: 1180px) {
    .nav-mega-tools {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ── Mobile menu: floating glass card ──────────────────────── */
/* The menu button stays in place under the overlay so the header doesn't shift */
@media (max-width: 1023px) {
    #mobileMenuBtn {
        display: flex !important;
    }
}

/* Plain dim, no backdrop-filter here: it would stop the card from blurring the page */
.mobile-menu-overlay {
    padding: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(0, 0, 0, 0.35);
}

.mobile-menu-content {
    position: relative;
    justify-content: flex-start;
    height: auto;
    max-width: 560px;
    margin: 0 auto;
    padding: 8px 8px 16px;
    background: var(--glass-tint-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--nav-radius);
    box-shadow: var(--glass-shine), 0 30px 80px rgba(0, 0, 0, 0.55);
    transform: translateY(-12px) scale(0.98);
    transform-origin: top center;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: none;
}

.mobile-menu-header {
    margin-bottom: 14px;
    padding-left: 12px;
}

.mobile-menu-header .logo-text-img {
    height: 30px;
}

.mobile-menu-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-menu-cta {
    padding: 12px 20px;
    border-radius: 999px;
    background: var(--nav-cream);
    color: #111;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.mobile-menu-cta:hover {
    background: #fff;
}

.close-mobile-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(246, 174, 45, 0.75);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 0 3px rgba(246, 174, 45, 0.14);
}

.mobile-menu-eyebrow {
    margin: 4px 12px 10px;
    color: #F6AE2D;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Swipeable tool cards, bleeding to the card edge */
.mobile-tool-cards {
    display: flex;
    gap: 10px;
    margin: 0 -8px;
    padding: 0 20px 4px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 20px;
    scrollbar-width: none;
}

.mobile-tool-cards::-webkit-scrollbar {
    display: none;
}

.mobile-tool-cards li {
    flex: 0 0 148px;
    scroll-snap-align: start;
}

.mobile-tool-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
}

.mobile-tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 160px;
    margin-bottom: 6px;
    border-radius: 22px;
    background: var(--nav-tile);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -12px 24px rgba(0, 0, 0, 0.15);
    color: #F6AE2D;
    font-size: 2.3rem;
}

.mobile-tool-card strong {
    color: #f8f8f9;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.15;
}

.mobile-tool-card small {
    color: var(--nav-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

/* Big uppercase rows with arrows */
.mobile-nav {
    display: block;
    flex: none;
    margin-top: 18px;
    padding: 0 12px;
}

.mobile-nav-links {
    text-align: left;
}

.mobile-nav-links li {
    margin: 0;
    border-top: 1px solid var(--nav-line);
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 2px;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.1;
}

.mobile-nav-link svg {
    font-size: 1.05rem;
    transition: transform 0.2s ease;
}

.mobile-nav-link:hover svg {
    transform: translateX(3px);
}

.mobile-menu-lang-switcher {
    margin: 0 12px;
    padding: 16px 0;
    border-top: 1px solid var(--nav-line);
}

.mobile-menu-lang-switcher .lang-switcher-btn {
    background: var(--glass-chip);
    border-color: var(--glass-edge);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

@media (max-width: 1023px) {
    .mobile-menu-lang-switcher {
        display: flex;
    }
}

.mobile-menu-footer {
    padding: 0 12px;
}

.mobile-menu-footer .mobile-download-btn {
    width: 100%;
    padding: 16px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -3px 8px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(246, 174, 45, 0.25);
}

/* Phones: fit logo + CTA + round button in one row */
@media (max-width: 480px) {
    .header-container {
        padding-left: 16px;
    }

    .header-container .logo-text-img,
    .mobile-menu-header .logo-text-img {
        height: 24px;
    }

    .mobile-menu-header {
        padding-left: 8px;
    }

    #navDesktopCta,
    .mobile-menu-cta {
        padding: 11px 15px;
        font-size: 0.82rem;
    }
}

/* Very narrow phones: drop the header CTAs, the menu still has one at the bottom */
@media (max-width: 359px) {
    #navDesktopCta,
    .mobile-menu-cta {
        display: none !important;
    }

    .mobile-menu-btn {
        margin-left: auto;
    }
}

/* No blur support: fall back to a solid tint so text stays readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .header-container::before,
    .nav-dropdown-menu,
    .mobile-menu-content {
        background: rgba(22, 26, 31, 0.96);
    }
}
