/* =========================================
   HEADER & NAVIGATION
   ========================================= */
.header {
    position: fixed;
    width: 100%;
    height: 64px;
    top: 0;
    left: 0;
    padding: 0 48px;
    z-index: 200;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
}

/* Scrolled past hero — frosted white */
.header.scrolled {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    box-shadow: none;
}

/* Inside hero — transparent */
.header.in-hero {
    background: transparent;
    backdrop-filter: blur(10px);
}

/* Inner container */
.header-container {
    width: 100%;
    max-width: 1440px;
    height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* ── Logo ── */
.header-logo {
    display: block;
    flex: 0 0 auto;
    height: 24px;
    width: 127px;
    position: relative;
    transform-origin: center center;
    /* JS overrides this transition for FLIP animation */
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.logo-image {
    position: absolute;
    inset: -2.08% -0.39%;
    width: calc(100% + 0.78%);
    height: calc(100% + 4.16%);
    max-width: none;
}

/* ── Navigation ── */
.header-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 8px;
    /* Fellou-style animation: fades in as nav reveals */
    transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Nav item wrapper — stretches full header height so dropdown
   can use top:100% relative to the header bottom */
.nav-item {
    position: relative;
    align-self: stretch;
    display: flex;
    align-items: center;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    color: #1C5B5D;
    text-decoration: none;
    white-space: nowrap;
    padding: 10px 16px;
    border-radius: 360px;
}

.nav-link:hover {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.nav-link__chev {
    flex-shrink: 0;
    opacity: 0.75;
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.nav-item:hover .nav-link__chev {
    transform: rotate(180deg);
}

/* ── Dropdown ── */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 300;
    /* 8px transparent gap — keeps hover contiguous with nav link */
    padding-top: 8px;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.nav-item:hover .nav-dropdown {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-dropdown__card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 250px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid rgba(68, 117, 105, 0.25);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
    box-sizing: border-box;
    padding: 8px;
    overflow: hidden;
}

.nav-dropdown__item {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: #1C5B5D;
    text-decoration: none;
    white-space: nowrap;
}

.nav-dropdown__item:hover {
    background: rgba(3, 73, 75, 0.06);
}

/* ── Action Buttons ── */
.header-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Book a Demo — outlined */
.book-demo-btn-header {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 10px 16px;
    border: 1px solid #447569;
    border-radius: 360px;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: #1c4f44;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-sizing: border-box;
    /* Fellou-style animation: fades in alongside the nav */
    transition: opacity 0.3s ease;
}

.book-demo-btn-header:hover {
    background: rgba(68, 117, 105, 0.08);
    border-color: #1c4f44;
    transition: background 0.2s ease, border-color 0.2s ease;
}

/* Sign Up / Log In — gradient fill */
.signup-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 10px 16px;
    background: linear-gradient(93.6deg, #F99522 50%, #FEE478 100%);
    border-radius: 360px;
    border: none;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: #ffffff;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-sizing: border-box;
    transform-origin: center center;
    /* JS overrides this transition for FLIP animation */
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.signup-login-btn:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

/* ── Hero CTA button (separate from header) ── */
.book-demo-btn {
    min-width: 9.3125rem;
    height: var(--btn-height-sm);
    padding: 0 var(--space-md);
    background: linear-gradient(94.07deg, var(--color-gradient-start) 9.45%, var(--color-gradient-end) 135.58%);
    box-shadow: inset 0px -4px 10px rgba(255, 214, 93, 0.7);
    backdrop-filter: blur(25px);
    border-radius: 137px;
    border: none;
    font-style: normal;
    font-weight: 600;
    font-size: var(--text-xs);
    line-height: 1.22;
    color: #FFFFFF;
    cursor: pointer;
}

.book-demo-btn:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

/* ── Fellou.ai-style header animation ── */
/*
 * Logo & Sign Up are controlled entirely by JS (FLIP animation).
 * They start invisible; JS positions them over the hero pill
 * and animates them to their natural header positions on scroll.
 *
 * Nav is CSS-controlled via .nav-revealed class:
 *   - No .nav-revealed → nav invisible
 *   - .nav-revealed    → nav fades in
 */

/* Nav: hidden until scroll reveals it */
.header:not(.nav-revealed) .header-nav {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px) scale(0.96);
}

/* Nav: fades in (slight delay so logo/signup move first) */
.header.nav-revealed .header-nav {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition: opacity 0.35s ease 0.15s, transform 0.35s ease 0.15s;
}

/* ── Hamburger button (hidden on desktop) ── */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-hamburger__bar {
    display: block;
    width: 22px;
    height: 2px;
    background: #1C5B5D;
    border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.nav-hamburger.is-active .nav-hamburger__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-hamburger.is-active .nav-hamburger__bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.nav-hamburger.is-active .nav-hamburger__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile menu panel ── */
.mobile-menu {
    display: none; /* rendered by JS on mobile only */
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 199;
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
    padding: 16px 24px 28px;
    overflow-y: auto;
    max-height: calc(100vh - 64px);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.mobile-menu.is-open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.mobile-menu__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 20px;
}

.mobile-menu__item {
    display: block;
    padding: 12px 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    color: #1C5B5D;
    text-decoration: none;
    border-radius: 8px;
}

.mobile-menu__item--sub {
    font-weight: 400;
    font-size: 14px;
    color: #447569;
    padding: 8px 20px;
}

.mobile-menu__item:hover,
.mobile-menu__item--sub:hover {
    background: rgba(3, 73, 75, 0.05);
}

.mobile-menu__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid rgba(68, 117, 105, 0.15);
}

.mobile-menu__actions .book-demo-btn-header,
.mobile-menu__actions .signup-login-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
}

/* ── Dropdown wrapper for resource-hub.css pages ──
   Wrap <a class="nav-links__item"> in <div class="has-dropdown">
   to get the same hover-dropdown behaviour without replacing the
   existing site-header / navbar structure. */
.has-dropdown {
    position: relative;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
}
.has-dropdown:hover .nav-links__chev {
    transform: rotate(180deg);
    transition: transform 0.2s ease;
}
.has-dropdown:hover .nav-dropdown {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Responsive ── */

/* Tablet: slightly tighten nav before hamburger breakpoint */
@media screen and (max-width: 1200px) {
    .header { padding: 0 32px; }
    .header-nav { gap: 0; }
    .nav-link { font-size: 14px; padding: 8px 10px; }
}

/* ≤1024px: mobile layout — no nav, no hamburger */
@media screen and (max-width: 1024px) {
    .header { padding: 0 24px; }
    .header-nav { display: none; }
    /* Keep actions visible but hide Book Demo on mobile */
    .header-actions { display: flex; }
    .header-actions .book-demo-btn-header { display: none; }
    /* Hide only Book Demo on resource-hub.css pages; keep Sign Up / Log In */
    .site-header .nav-actions .btn-demo-outline { display: none; }
}

/* =========================================
   COMPONENT HEADER (site-header / navbar)
   Required CSS variables not in variables.css
   ========================================= */
:root {
    --site-header-h: 64px;
    --gutter-nav: 64px;
    --secondary: #1C5B5D;
    --frame-max: 1440px;
    --white: #fff;
}

@media (max-width: 1280px) {
    :root { --gutter-nav: max(20px, min(5vw, 56px)); }
}

@media (max-width: 900px) {
    :root { --gutter-nav: 20px; }
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background: linear-gradient(180deg, rgba(238, 245, 241, 1), rgba(238, 245, 241, 0) 100%);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}

.site-header--on-intro {
    position: relative;
    z-index: 2;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
}

.navbar {
    width: 100%;
    max-width: var(--frame-max);
    margin: 0 auto;
    height: var(--site-header-h);
    padding: 12px max(var(--gutter-nav), env(safe-area-inset-right, 0px)) 12px max(var(--gutter-nav), env(safe-area-inset-left, 0px));
    display: flex;
    align-items: center;
    gap: 24px;
    box-sizing: border-box;
}

.navbar--balanced { display: flex; align-items: center; gap: 0; }
.navbar--balanced > .navbar__logo { flex: 0 0 auto; }
.navbar--balanced > .nav-links { flex: 1 1 0%; justify-content: center; min-width: 0; gap: 4px; flex-shrink: 1; }
.navbar--balanced > .nav-actions { flex: 0 0 auto; justify-content: flex-end; }
.navbar__grow { flex: 1; min-width: 0; }

.navbar__logo {
    display: block;
    height: 24px;
    width: 127px;
    position: relative;
}

.navbar__logo img {
    position: absolute;
    inset: -2.08% -0.39%;
    width: calc(100% + 0.78%);
    height: calc(100% + 4.16%);
    max-width: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 48px;
    flex-shrink: 0;
}

.nav-links a {
    font-weight: 500;
    font-size: 15px;
    line-height: 20px;
    color: var(--secondary, #1C5B5D);
    white-space: nowrap;
    padding-inline: 16px;
    text-decoration: none;
}

.nav-links__item { display: inline-flex; align-items: center; gap: 4px; }
.nav-links__chev { flex-shrink: 0; opacity: 0.75; display: block; width: 16px; height: 16px; object-fit: contain; }
.nav-links__plain { display: inline-flex; align-items: center; }

.nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1;
}

.btn-demo-outline {
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: #1c4f44;
    padding: 0 16px;
    height: 40px;
    min-width: 80px;
    border-radius: 360px;
    border: 1px solid #447569;
    background: transparent;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    white-space: nowrap;
}

.btn-demo-outline:hover {
    background: rgba(68, 117, 105, 0.08);
    border-color: #1c4f44;
}

.btn-login {
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: var(--white, #fff);
    padding: 0 16px;
    height: 40px;
    min-width: 80px;
    border-radius: 360px;
    background: linear-gradient(93.6deg, rgb(249, 149, 34) 9.45%, rgb(254, 228, 120) 100%);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    white-space: nowrap;
}

a.btn-login { text-decoration: none; }

@media (max-width: 1200px) {
    .nav-links a { font-size: 14px; }
}

@media (max-width: 1150px) {
    .site-header .nav-links { display: none; }
    .site-header .navbar--balanced > .nav-actions { margin-left: auto; }
}

@media (max-width: 1024px) {
    .nav-links { display: none; }
    .navbar--balanced > .nav-actions { margin-left: auto; }
}
