/* ==========================================================================
   Micro Web Solution — Header / Primary Navigation
   Light brand theme: white + royal blue, red CTA.
   All colors come from css/pallete.css (load that first).
   ========================================================================== */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    /* site-wide circuit-dot tech texture on a cool periwinkle wash,
       with fixed brand corner glows for ambient depth */
    background-color: var(--bg);
    background-image:
        radial-gradient(1200px 620px at 92% 0%, rgba(52, 63, 192, .10), transparent 60%),
        radial-gradient(1000px 640px at -6% 100%, rgba(180, 56, 58, .06), transparent 55%),
        radial-gradient(rgba(52, 63, 192, .17) 1.6px, transparent 1.7px),
        linear-gradient(rgba(52, 63, 192, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(52, 63, 192, .06) 1px, transparent 1px);
    background-size: cover, cover, 44px 44px, 44px 44px, 44px 44px;
    background-position: center top, center bottom, 0 0, 0 0, 0 0;
    background-repeat: no-repeat, no-repeat, repeat, repeat, repeat;
    background-attachment: fixed, fixed, scroll, scroll, scroll;
}

/* ---- Header shell -------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    /* NOTE: no backdrop-filter here — it would make this header a containing
       block for the fixed mobile nav panel and collapse its height. */
    border-bottom: 1px solid var(--border);
    height: auto;
}

.header-inner {
    max-width: 2240px;
    margin: 0 auto;
    height: var(--header-h);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

/* ---- Brand --------------------------------------------------------------- */
.brand {
    display: flex;
    align-items: center;
    gap: 0px;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    height: 44px;
    
    flex-shrink: 0;
}

.brand-logo {
    display: block;
    height: 50px;
              
    transition: transform .2s ease;
}

.brand:hover .brand-logo { transform: scale(1.05); }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-head); font-size: 1.08rem; font-weight: 700; letter-spacing: .2px; color: var(--text); }
.brand-text small  { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1.6px; }

/* ---- Primary nav --------------------------------------------------------- */
.primary-nav { margin-left: auto; }

.nav-list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item { position: relative; }

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-size: .95rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    padding: 10px 14px;
    border: 0;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    transition: color .18s ease, background .18s ease;
}

.nav-link:hover,
.nav-link:focus-visible { color: var(--blue); background: var(--blue-soft); }

.nav-link .caret { transition: transform .2s ease; }
.has-dropdown.open .nav-link .caret { transform: rotate(180deg); }

/* ---- Dropdown ------------------------------------------------------------ */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    width: 360px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
}

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

/* bridge the gap so the menu doesn't close while the cursor travels */
.dropdown-menu::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}

/* group label inside the dropdown */
.dropdown-group {
    display: block;
    padding: 8px 12px 4px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--muted);
}
.dropdown-group + .dropdown-card { margin-top: 0; }
.dropdown-card + .dropdown-group { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 12px; }

.dropdown-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    transition: background .15s ease, transform .15s ease;
}

.dropdown-card:hover,
.dropdown-card:focus-visible { background: var(--blue-soft); transform: translateX(2px); }

.dropdown-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 9px;
    color: var(--blue);
    background: var(--blue-soft);
    border: 1px solid var(--border);
}

.dropdown-copy { display: flex; flex-direction: column; gap: 3px; }
.dropdown-copy strong { font-size: .92rem; }
.dropdown-copy small  { font-size: .78rem; color: var(--muted); line-height: 1.4; }

/* ---- CTA button ---------------------------------------------------------- */
.btn-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .92rem;
    font-weight: 700;
    letter-spacing: .2px;
    color: #ffffff;
    text-decoration: none;
    padding: 11px 20px;
    border-radius: 9px;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--red), var(--red-dk));
    box-shadow: 0 4px 14px rgba(220, 47, 141, .32);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.btn-cta:hover,
.btn-cta:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(220, 47, 141, .48);
    filter: brightness(1.05);
}

.btn-cta-desktop { flex-shrink: 0; }
.nav-cta-mobile { display: none; }

/* ---- Mobile toggle ------------------------------------------------------- */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
}

.nav-toggle-bar {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   Responsive — collapse to off-canvas panel
   ========================================================================== */
@media (max-width: 1250px) {
    .nav-toggle { display: flex; }
    .btn-cta-desktop { display: none; }

    .primary-nav {
        position: fixed;
        inset: var(--header-h) 0 0 auto;
        width: min(330px, 84vw);
        margin: 0;
        padding: 10px;
        background: var(--surface);
        border-left: 1px solid var(--border);
        box-shadow: var(--shadow);
        transform: translateX(100%);
        transition: transform .28s ease;
        overflow-y: auto;
    }

    .primary-nav.open { transform: translateX(0); }

    .nav-list { flex-direction: column; align-items: stretch; gap: 2px; }

    .nav-link { width: 100%; justify-content: space-between; padding: 14px 12px; font-size: 1rem; }

    /* dropdown becomes an inline accordion on mobile */
    .dropdown-menu {
        position: static;
        width: 100%;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 0;
        background: transparent;
        padding: 0 0 6px 8px;
        max-height: 0;
        overflow: hidden;
        transition: max-height .28s ease;
    }

    .has-dropdown.open .dropdown-menu { max-height: 520px; }
    .dropdown-menu::before { display: none; }

    .nav-cta-mobile { display: block; margin-top: 12px; }
    .nav-cta-mobile .btn-cta { width: 100%; padding: 14px; }
}

/* ---- Small phones: keep brand compact so the hamburger always fits ------ */
@media (max-width: 480px) {
    .header-inner { padding: 0 14px; gap: 12px; }

    /* let the brand shrink instead of pushing the toggle off-screen */
    .brand { flex: 1 1 auto; min-width: 0; gap: 0px; }
    .brand-logo { height: 38px; width:34px;}

    /* keep the name on one line, trim if it's too long */
    .brand-text { min-width: 0; }
    .brand-text strong {
        font-size: .95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .brand-text small { font-size: .62rem; letter-spacing: 1px; }

    /* the hamburger must never shrink or disappear */
    .nav-toggle { flex-shrink: 0; margin-left: 0; }
}

/* ---- Scrim behind mobile panel ------------------------------------------ */
.nav-scrim {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 15, .6);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s;
    z-index: 999;
}
.nav-scrim.show { opacity: 1; visibility: visible; }

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: .01ms !important; }
}
