/*
 * AchieveAI — Shared Site Header & Navigation
 * Used on homepage, blog, and other public theme surfaces.
 */

.landing-header,
.site-header {
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0.85rem 0;
    background: rgba(5, 8, 13, 0.78);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-bottom: 1px solid rgba(77, 124, 254, 0.12);
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

.site-header--fixed {
    position: fixed;
}

.site-header--sticky {
    position: sticky;
    z-index: 9999;
}

.landing-header.scrolled,
.site-header.scrolled {
    padding: 0.55rem 0;
    background: rgba(5, 8, 13, 0.92);
    border-bottom-color: rgba(77, 124, 254, 0.18);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.34);
}

/* Logo */
.landing-header .logo-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.85rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    line-height: 1;
    transition: font-size 0.3s ease;
}

.landing-header .logo-achieve { color: #ffffff; }

.landing-header .logo-ai {
    background: linear-gradient(135deg, #4D7CFE, #00ffa2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.landing-header.scrolled .logo-text { font-size: 1.5rem; }

.landing-logo-img {
    transition: width 0.3s ease, height 0.3s ease;
}

.landing-logo-copy {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 0.08rem;
    min-width: 0;
    line-height: 1;
}

.landing-logo-copy__name {
    color: var(--landing-text);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.landing-logo-copy__tagline {
    color: color-mix(in srgb, var(--landing-muted) 82%, transparent);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.015em;
    line-height: 1.12;
    white-space: nowrap;
}

.landing-header.scrolled .landing-logo-img {
    width: 1.75rem;
    height: 1.75rem;
}

/* Nav row */
.landing-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Nav links — identical treatment for <a> and <button> */
.landing-header .nav-link,
.site-header .nav-link {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2.25rem;
    height: 2.25rem;
    padding: 0 0.9rem;
    margin: 0;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: transparent;
    color: #94a3b8;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0;
    text-decoration: none;
    white-space: nowrap;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.landing-header .nav-link:hover,
.landing-header .nav-link:focus-visible,
.site-header .nav-link:hover,
.site-header .nav-link:focus-visible,
.nav-dropdown.is-open .nav-dropdown__trigger {
    color: #e7ecff;
    background: rgba(77, 124, 254, 0.1);
    border-color: rgba(77, 124, 254, 0.28);
    box-shadow: none;
    outline: none;
}

/* Blog dropdown */
.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.nav-dropdown__trigger {
    /* Keep button chrome identical to .nav-link anchors */
    font: inherit;
    color: inherit;
    background: transparent;
}

.nav-dropdown__chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.7rem;
    height: 0.7rem;
    font-size: 0.55rem;
    line-height: 1;
    transition: transform 0.22s ease;
    opacity: 0.7;
}

.nav-dropdown.is-open .nav-dropdown__chevron {
    transform: rotate(180deg);
}

.nav-dropdown__menu {
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    min-width: 13.5rem;
    padding: 0.4rem;
    border-radius: 1rem;
    background: rgba(8, 12, 19, 0.96);
    border: 1px solid rgba(77, 124, 254, 0.18);
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 20;
}

.nav-dropdown.is-open .nav-dropdown__menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown__item {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    padding: 0.7rem 0.8rem;
    border-radius: 0.72rem;
    color: #cbd5e1;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-dropdown__item:hover {
    color: #f8fbff;
    background: rgba(77, 124, 254, 0.1);
}

.nav-dropdown__item-title {
    font-size: 0.86rem;
    font-weight: 650;
    line-height: 1.2;
}

.nav-dropdown__item-desc {
    font-size: 0.72rem;
    color: #7f8ea3;
    font-weight: 500;
}

.nav-dropdown__item:hover .nav-dropdown__item-desc {
    color: #9fb0c7;
}

/* CTA — no countdown; same height family as nav pills */
.header-cta {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    height: 2.25rem;
    padding: 0 1.05rem;
    border: 1px solid rgba(203, 244, 232, 0.24);
    border-radius: 0.85rem;
    background: linear-gradient(135deg, rgba(0, 255, 162, 0.96) 0%, rgba(77, 124, 254, 0.95) 100%);
    color: #071017;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow:
        0 10px 24px rgba(77, 124, 254, 0.18),
        0 6px 16px rgba(0, 255, 162, 0.1);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.header-cta__label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 850;
    white-space: nowrap;
}

.header-cta:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, rgba(53, 255, 208, 1) 0%, rgba(111, 150, 255, 0.98) 100%);
    box-shadow:
        0 14px 32px rgba(77, 124, 254, 0.26),
        0 10px 24px rgba(0, 255, 162, 0.14);
}

.header-cta-countdown {
    display: none !important;
}

.mobile-menu-details,
.mobile-header-menu {
    display: none;
}

/* ── Mobile ──────────────────────────────────────── */

@media (max-width: 767px) {
    .landing-header,
    .site-header {
        padding: 0.66rem 0;
        background:
            linear-gradient(180deg, rgba(7, 11, 18, 0.88), rgba(7, 11, 18, 0.74)),
            radial-gradient(circle at 18% 0%, rgba(77, 124, 254, 0.14), transparent 34%),
            radial-gradient(circle at 86% 0%, rgba(0, 255, 162, 0.09), transparent 30%);
        border-bottom: 1px solid rgba(125, 151, 255, 0.14);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
        backdrop-filter: blur(20px) saturate(1.18);
        -webkit-backdrop-filter: blur(20px) saturate(1.18);
    }

    .landing-header.scrolled,
    .site-header.scrolled {
        padding: 0.56rem 0;
        background:
            linear-gradient(180deg, rgba(7, 11, 18, 0.94), rgba(7, 11, 18, 0.86)),
            radial-gradient(circle at 18% 0%, rgba(77, 124, 254, 0.12), transparent 34%);
        border-bottom-color: rgba(77, 124, 254, 0.16);
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
    }

    .landing-header__inner {
        position: relative;
        gap: var(--landing-space-md);
        min-height: 3rem;
    }

    .landing-header__inner::before {
        content: '';
        position: absolute;
        left: 1rem;
        right: 1rem;
        bottom: -0.55rem;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(77, 124, 254, 0.32), rgba(0, 255, 162, 0.18), transparent);
        pointer-events: none;
    }

    .landing-logo-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: var(--landing-touch-target);
        min-height: var(--landing-touch-target);
        flex-shrink: 0;
    }

    /*
     * The shared .nav-link rule is more specific than Tailwind's .hidden
     * utility. Hide desktop links explicitly so the compact CTA + menu
     * trigger remain inside the mobile viewport.
     */
    .landing-header .landing-header-actions > .nav-link,
    .site-header .landing-header-actions > .nav-link,
    .landing-header .landing-header-actions > .nav-dropdown,
    .site-header .landing-header-actions > .nav-dropdown {
        display: none !important;
    }

    .landing-header-actions {
        min-width: 0;
        margin-left: auto;
        gap: var(--landing-space-sm);
    }

    .landing-logo-img,
    .landing-header.scrolled .landing-logo-img {
        width: 2.05rem;
        height: 2.05rem;
    }

    .header-cta {
        flex: 0 1 auto;
        min-width: 0;
        min-height: var(--landing-touch-target);
        height: var(--landing-touch-target);
        padding: 0 var(--landing-space-lg);
        border-radius: var(--landing-radius-sm);
        font-size: var(--landing-font-small);
        overflow: hidden;
    }

    .header-cta__label {
        display: block;
        min-width: 0;
        overflow: hidden;
        font-size: var(--landing-font-small);
        text-overflow: ellipsis;
    }

    .mobile-menu-details {
        position: relative;
        display: block;
        flex: 0 0 auto;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: var(--landing-touch-target);
        min-height: var(--landing-touch-target);
        padding: 0;
        border-radius: var(--landing-radius-sm);
        color: var(--landing-text);
        background: color-mix(in srgb, var(--landing-blue) 8%, transparent);
        border: 1px solid color-mix(in srgb, var(--landing-blue) 18%, transparent);
        box-shadow: inset 0 1px 0 color-mix(in srgb, var(--landing-text) 4%, transparent);
        line-height: 1;
        transition: border-color 0.2s ease, background 0.2s ease;
        cursor: pointer;
        list-style: none;
    }

    .mobile-menu-toggle::-webkit-details-marker {
        display: none;
    }

    .mobile-menu-toggle .mobile-menu-icon--open {
        display: inline-block !important;
    }

    .mobile-menu-toggle .mobile-menu-icon--close {
        display: none !important;
    }

    .mobile-menu-details[open] .mobile-menu-toggle .mobile-menu-icon--open {
        display: none !important;
    }

    .mobile-menu-details[open] .mobile-menu-toggle .mobile-menu-icon--close {
        display: inline-block !important;
    }

    .mobile-menu-details[open] .mobile-menu-toggle {
        background: color-mix(in srgb, var(--landing-blue) 13%, transparent);
        border-color: color-mix(in srgb, var(--landing-green) 18%, transparent);
    }

    .mobile-header-menu {
        position: absolute;
        right: 0;
        top: calc(100% + var(--landing-space-md));
        width: min(78vw, 18.5rem);
        max-height: calc(100dvh - var(--landing-mobile-header-height) - var(--landing-space-lg));
        display: none;
        flex-direction: column;
        gap: 0;
        padding: var(--landing-space-sm);
        border-radius: var(--landing-radius-md);
        background: linear-gradient(180deg, var(--landing-bg-2), var(--landing-bg));
        border: 1px solid var(--landing-border-strong);
        box-shadow:
            var(--landing-shadow-soft),
            0 0 0 1px color-mix(in srgb, var(--landing-text) 2.5%, transparent) inset;
        overflow-y: auto;
        overscroll-behavior: contain;
        z-index: 2;
    }

    .mobile-menu-details[open] .mobile-header-menu {
        display: flex;
    }

    .mobile-header-menu a {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: var(--landing-touch-target);
        padding: var(--landing-space-sm) var(--landing-space-md);
        border-radius: var(--landing-radius-sm);
        color: color-mix(in srgb, var(--landing-text) 78%, var(--landing-muted));
        font-size: var(--landing-font-body);
        font-weight: 650;
        transition: background 0.2s ease, color 0.2s ease;
    }

    .mobile-header-menu a + a::before {
        content: '';
        position: absolute;
        top: 0;
        right: var(--landing-space-md);
        left: var(--landing-space-md);
        height: 1px;
        background: var(--landing-border);
        pointer-events: none;
    }

    .mobile-header-menu a:last-child {
        margin-top: var(--landing-space-xs);
    }

    .mobile-header-menu a:hover,
    .mobile-header-menu a:focus-visible {
        color: var(--landing-text);
        background: color-mix(in srgb, var(--landing-blue) 9%, transparent);
    }

    .mobile-header-menu a:focus-visible {
        outline: 2px solid color-mix(in srgb, var(--landing-green) 62%, transparent);
        outline-offset: -2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .landing-header,
    .site-header,
    .nav-link,
    .header-cta,
    .nav-dropdown__menu,
    .nav-dropdown__chevron {
        transition: none !important;
    }
}

/* Landing-page conversion header: cleaner section nav, no blog exits. */
.landing-header--conversion {
    background:
        linear-gradient(180deg, rgba(5, 8, 13, 0.9), rgba(5, 8, 13, 0.72)),
        radial-gradient(circle at 50% 0%, rgba(77, 124, 254, 0.08), transparent 34%);
    border-bottom-color: rgba(125, 151, 255, 0.16);
}

@media (min-width: 768px) {
    .landing-header--conversion .landing-logo-copy {
        display: flex;
    }

    .landing-header--conversion .landing-header__inner {
        min-height: 2.8rem;
    }

    .landing-header--conversion .landing-header-actions {
        gap: 0.68rem;
        padding: 0.22rem;
        border: 1px solid rgba(77, 124, 254, 0.12);
        border-radius: var(--landing-radius-pill);
        background: rgba(9, 14, 23, 0.42);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    }

    .landing-header--conversion .nav-link {
        height: 2.18rem;
        min-height: 2.18rem;
        padding: 0 0.72rem;
        border: 0;
        border-radius: var(--landing-radius-pill);
        background: transparent;
        color: color-mix(in srgb, var(--landing-text) 70%, var(--landing-muted));
        font-size: 0.8rem;
        font-weight: 650;
    }

    .landing-header--conversion .nav-link:hover,
    .landing-header--conversion .nav-link:focus-visible {
        color: var(--landing-text);
        background: rgba(77, 124, 254, 0.1);
    }

    .landing-header--conversion .nav-link--login {
        position: relative;
        margin-left: 0.38rem;
        padding-inline: 0.25rem;
        color: color-mix(in srgb, var(--landing-muted) 82%, transparent);
        font-weight: 600;
    }

    .landing-header--conversion .nav-link--login::before {
        content: '';
        position: absolute;
        left: -0.42rem;
        top: 50%;
        width: 1px;
        height: 1.25rem;
        transform: translateY(-50%);
        background: rgba(148, 163, 184, 0.2);
    }

    .landing-header--conversion .nav-link--login:hover,
    .landing-header--conversion .nav-link--login:focus-visible {
        color: color-mix(in srgb, var(--landing-text) 86%, var(--landing-muted));
        background: transparent;
    }

    .landing-header--conversion .header-cta {
        height: 2.38rem;
        min-height: 2.38rem;
        margin-left: 0.12rem;
        padding-inline: 1.12rem;
        border-radius: var(--landing-radius-pill);
    }
}

@media (max-width: 1080px) and (min-width: 768px) {
    .landing-header--conversion .landing-logo-copy__tagline {
        display: none;
    }

    .landing-header--conversion .nav-link {
        padding-inline: 0.55rem;
        font-size: 0.75rem;
    }

    .landing-header--conversion .header-cta {
        padding-inline: 0.85rem;
        font-size: 0.75rem;
    }
}
