/* ============================================================
   Main Header — header-only styles ported from ah-theme
   ============================================================
   Enqueued only when Site Settings → Header → Header Template is
   "Main Header". Loads AFTER styles.css, so it only carries the rules
   the main-header markup adds; brand tokens, .container, .btn-pill*
   and typography all come from styles.css and are shared.
   ============================================================ */

/* styles.css styles .site-header for the one-row product header.
   Neutralise those before the main header's own rules land. */
.site-header {
    padding: 0;
    box-shadow: none;
}

/* ---------- Top contact bar ---------- */
.top-bar {
    background: var(--ah-navy);
    color: #fff;
    font-size: var(--fs-sm);
    padding: 8px 0;
}
.top-bar .container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-5);
    align-items: center;
    justify-content: space-between;
}
.top-bar .contact-list,
.top-bar .social-list {
    display: flex;
    gap: var(--sp-5);
    align-items: center;
    flex-wrap: wrap;
}
.top-bar a { color: #fff; }
.top-bar .flag { font-size: 14px; }
.social-list a {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    transition: background 0.15s ease;
}
.social-list a:hover { background: var(--ah-pink); }
.social-list svg { width: 14px; height: 14px; fill: #fff; }

/* ---------- Header (logo row + menu row, with shrink-on-scroll) ---------- */
/* The sticky header collapses .header-top on scroll; that above-viewport height
   change would trigger scroll anchoring, which fights a slow scroll and makes the
   header flicker at the trigger point. Opt the page scroller out of anchoring. */
html,
body { overflow-anchor: none; }

.site-header {
    position: sticky;     /* whole header pinned so nav stays visible on scroll */
    top: 0;
    background: #fff;
    z-index: 50;
}

/* Top contact bar collapses on scroll */
.top-bar {
    overflow: hidden;
    max-height: 60px;
    transition: max-height 0.3s ease, padding 0.3s ease;
}
.site-header.is-scrolled .top-bar {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Row 2: logo (left) + cta cluster + book a demo (right) — collapses on scroll */
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-5);
    padding: 16px var(--sp-5);
    overflow: hidden;
    max-height: 120px;
    transition: max-height 0.3s ease, padding 0.3s ease;
    margin-bottom: var(--sp-7);
}
.site-header.is-scrolled .header-top {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: var(--sp-6);
}
.logo { display: inline-flex; }
.logo img { height: 64px; width: auto; transition: height 0.3s ease; }
.header-top-right {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

/* Row 3: menu bar — v2 white styling; sticky behaviour handled by .site-header parent */
.header-nav-row {
    background: #fff;
    transition: box-shadow 0.3s ease;
    position: absolute;
    content: "";
    width: 100%;
    z-index: 99;
    background: transparent;
    left: 0;
    margin-top: -35px;
}
.site-header.is-scrolled .header-nav-row {
    box-shadow: var(--shadow-md);
}
.nav-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    padding: 10px 0;
    transition: max-width 0.3s ease, padding 0.3s ease, border-color 0.3s ease;
    position: relative;
    max-width: 1350px;
    padding: 15px;
    margin: 0 auto;
    background: #fff;
    border-radius: 10px;
}

.container.nav-bar:before {
    position: absolute;
    content: "";
    width: 100%;
    height: 100%;
    top: 6px;
    left: 6px;
    background: #fff;
    z-index: -2;
    border-radius: 10px;
    opacity: 0.3;
}

.container.nav-bar:after {
    position: absolute;
    content: "";
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: var(--color-white);
    z-index: -1;
    border-radius: 10px;
    box-shadow: 0px 0px 40px 0px rgba(0,0,0,.09);
}
/* Sticky state: break out of the 1240px container, span full width, hide content-width borders */
.site-header.is-scrolled .nav-bar.container {
    max-width: none;
    padding: 10px var(--sp-7);
    border-top-color: transparent;
    border-bottom-color: transparent;
    border-radius: 0;
}

/* Menu items: left-aligned, natural width (NOT stretched edge-to-edge) */
.nav-list {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    flex: 0 1 auto;
}

/* Mini-logo: hidden by default, becomes visible on scroll (sits left of menu) */
.logo--mini {
    display: none;
    align-items: center;
    margin-right: var(--sp-5);
    flex-shrink: 0;
}
.logo--mini img { height: 50px; width: auto; }

/* Scroll-state CTA: pushed to far right when visible */
.nav-cta--scroll {
    display: none;
    margin-left: auto;
    padding: 8px 18px;
    font-size: 14px;
    flex-shrink: 0;
}
.site-header.is-scrolled .logo--mini { display: inline-flex; }
.site-header.is-scrolled .nav-cta--scroll { display: inline-flex; }
.nav-item { position: relative; }
.nav-item > a {
    color: var(--ah-navy);
    font-weight: 700;
    font-size: 14px;
    padding: 10px 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
}
.nav-item > a:hover { color: var(--ah-blue); text-decoration: none; }
.nav-item .caret { font-size: 10px; }

.dropdown {
    position: absolute;
    top: calc(100% + 0px);
    left: 0;
    min-width: 240px;
    background: #fff;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-3);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 60;
}
.nav-item:hover > .dropdown,
.nav-item.open > .dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.dropdown a {
    display: block;
    padding: 8px 12px;
    color: var(--ah-navy);
    font-size: var(--fs-sm);
    border-radius: var(--r-sm);
}
.dropdown a:hover { background: var(--c-bg-soft); color: var(--ah-blue); text-decoration: none; }

.nav-cta { margin-left: auto; }

/* Floating green CTA cluster (per v2 JPG) */
.cta-cluster {
    display: flex;
    gap: 6px;
    margin-left: var(--sp-3);
}
.cta-cluster a {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--ah-green);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.15s ease;
}
.cta-cluster a:hover { transform: translateY(-2px); background: #6ec434; }
.cta-cluster svg { width: 20px; height: 20px; fill: #fff; }

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: var(--ah-navy);
}
.menu-toggle svg { width: 24px; height: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .nav-list { display: none; }
    .nav-list.is-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        padding: var(--sp-4);
        box-shadow: var(--shadow-lg);
        align-items: stretch;
        gap: 0;
        z-index: 60;
    }
    .nav-list.is-open .nav-item { width: 100%; border-bottom: 1px solid var(--c-border); padding: 8px 0; }
    .nav-list.is-open .dropdown { position: static; opacity: 1; pointer-events: auto; transform: none; box-shadow: none; padding-left: var(--sp-4); background: transparent; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .header-nav-row .nav-bar { position: relative; }
}
@media (max-width: 860px) {
    .logo img { height: 48px; }
    .header-top-right .cta-cluster { display: none; }
}
@media (max-width: 520px) {
    .top-bar .container { justify-content: center; text-align: center; }
}
