/* =================================================================
   Custom site header — replaces parent (avanam) header.
   Tokens come from tokens.css (--cjw-*).
   ================================================================= */

.cjw-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--cjw-color-border, #e5e5e5);
    font-family: var(--cjw-font-base, 'Jost', sans-serif);
}

.cjw-header__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    padding: 14px clamp(20px, 4vw, 64px);
    max-width: 1480px;
    margin: 0 auto;
}

/* ---------- Brand ---------- */
.cjw-header__brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    width: -moz-fit-content;
    width: fit-content;
}

.cjw-header__logo {
    display: block;
    height: clamp(48px, 5vw, 64px);
    width: auto;
}

/* ---------- Primary nav (desktop) ---------- */
.cjw-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.cjw-nav__link {
    color: var(--cjw-color-text, #000);
    text-decoration: none;
    padding: 8px 0;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.cjw-nav__toggle {
    white-space: nowrap;
}

.cjw-nav__link:hover,
.cjw-nav__link:focus-visible {
    color: var(--cjw-color-text-body, #555);
    text-decoration: none;
}

/* ---------- Submenu (desktop hover) ---------- */
.cjw-nav__item--has-submenu {
    position: relative;
}

.cjw-nav__toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.cjw-nav__caret {
    transition: transform 0.2s ease;
}

.cjw-nav__submenu {
    position: absolute;
    top: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    padding: 8px 0;
    background: #fff;
    border: 1px solid var(--cjw-color-border, #e5e5e5);
    border-radius: 6px;
    box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s;
    z-index: 1;
}

/* Invisible bridge — keeps hover state continuous between trigger and menu */
.cjw-nav__submenu::before {
    content: "";
    position: absolute;
    top: -14px;
    left: 0;
    right: 0;
    height: 14px;
}

.cjw-nav__item--has-submenu:hover .cjw-nav__submenu,
.cjw-nav__item--has-submenu:focus-within .cjw-nav__submenu,
.cjw-nav__item--has-submenu.is-open .cjw-nav__submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cjw-nav__item--has-submenu.is-open .cjw-nav__caret {
    transform: rotate(180deg);
}

.cjw-nav__item--has-submenu:hover .cjw-nav__caret,
.cjw-nav__item--has-submenu:focus-within .cjw-nav__caret {
    transform: rotate(180deg);
}

.cjw-nav__sublink {
    display: block;
    padding: 9px 18px;
    font-size: 14px;
    color: var(--cjw-color-text, #000);
    text-decoration: none;
    transition: background 0.15s ease;
}

.cjw-nav__sublink:hover,
.cjw-nav__sublink:focus-visible {
    background: var(--cjw-color-bg-muted, #f0f0f0);
    text-decoration: none;
}

/* ---------- Actions ---------- */
.cjw-header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

.cjw-header__account {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--cjw-color-text, #000);
    border: 1px solid var(--cjw-color-border, #e5e5e5);
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.cjw-header__account:hover {
    background: var(--cjw-color-text, #000);
    color: #fff;
    border-color: var(--cjw-color-text, #000);
}

/* WhatsApp = primary header CTA (filled green pill with label) */
.cjw-header__wa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--cjw-color-wa, #25D366);
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1;
    border: 1px solid var(--cjw-color-wa, #25D366);
    transition: filter 0.18s ease, transform 0.15s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.cjw-header__wa:hover,
.cjw-header__wa:focus-visible {
    filter: brightness(1.08);
    color: #fff;
    text-decoration: none;
}

.cjw-header__wa-icon {
    flex-shrink: 0;
}

/* Demoted auth — small utility links, kept left of WhatsApp so WA pill is dominant CTA */
.cjw-header__authlink {
    color: #8a8a8a;
    font-size: 12px;
    font-weight: 400;
    text-decoration: none;
    padding: 4px 2px;
    transition: color 0.18s ease;
    white-space: nowrap;
}

.cjw-header__authlink + .cjw-header__authlink {
    margin-left: 2px;
}

.cjw-header__authlink:hover,
.cjw-header__authlink:focus-visible {
    color: var(--cjw-color-text, #000);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cjw-header__authsep {
    display: none;
}

/* ---------- Buttons ---------- */
.cjw-header .cjw-btn,
.cjw-drawer .cjw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    border: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}

/* Icon-in-button (mobile only) */
.cjw-btn__icon {
    display: none;
}
.cjw-btn__label {
    display: inline;
}

.cjw-btn--ghost {
    color: var(--cjw-color-text, #000);
    background: #fff;
    border-color: var(--cjw-color-accent, #1A5EDD);
}

.cjw-btn--ghost:hover {
    background: var(--cjw-color-accent-tint, #f0f5ff);
    color: var(--cjw-color-text, #000);
    border-color: var(--cjw-color-accent, #1A5EDD);
}

.cjw-btn--solid {
    color: #fff;
    background: var(--cjw-color-accent, #1A5EDD);
    border-color: var(--cjw-color-accent, #1A5EDD);
}

.cjw-btn--solid:hover {
    background: #1149b8;
    border-color: #1149b8;
    color: #fff;
}

/* ---------- Burger (mobile only, no border, no hover bg) ---------- */
.cjw-header__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    gap: 5px;
    color: var(--cjw-color-text, #000);
}

.cjw-header__burger:hover,
.cjw-header__burger:focus,
.cjw-header__burger:active {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none;
    color: var(--cjw-color-text, #000);
}

.cjw-header__burger:focus-visible {
    outline: 2px solid var(--cjw-color-text, #000);
    outline-offset: 4px;
}

.cjw-header__burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ---------- Drawer ---------- */
.cjw-drawer {
    position: fixed;
    inset: 0;
    z-index: 1100;
    pointer-events: none;
    visibility: hidden;
    font-family: var(--cjw-font-base, 'Jost', sans-serif);
}

.cjw-drawer.is-open {
    pointer-events: auto;
    visibility: visible;
}

.cjw-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.cjw-drawer.is-open .cjw-drawer__backdrop {
    opacity: 1;
}

.cjw-drawer__panel {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: min(86%, 380px);
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(.2, .7, .2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 6px 0 32px -8px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.cjw-drawer.is-open .cjw-drawer__panel {
    transform: translateX(0);
}

.cjw-drawer__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 8px;
}

.cjw-drawer__brand {
    display: inline-flex;
}

.cjw-drawer__brand img {
    display: block;
    height: 64px;
    width: auto;
    max-width: 240px;
}

.cjw-drawer__close {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 6px;
    cursor: pointer;
    color: var(--cjw-color-text, #000);
    line-height: 0;
}

.cjw-drawer__nav {
    display: flex;
    flex-direction: column;
    padding: 16px 22px 8px;
    gap: 4px;
}

.cjw-drawer__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 0;
    font-size: 17px;
    font-weight: 500;
    color: var(--cjw-color-text, #000);
    text-decoration: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    line-height: inherit;
    letter-spacing: normal;
    text-transform: none;
}

.cjw-drawer__link:hover,
.cjw-drawer__link:focus,
.cjw-drawer__link:active {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none;
    color: var(--cjw-color-text-body, #555);
    text-decoration: none;
}

.cjw-drawer__link:focus-visible {
    outline: 2px solid var(--cjw-color-text, #000);
    outline-offset: 2px;
}

.cjw-drawer__group {
    display: flex;
    flex-direction: column;
}

.cjw-drawer__caret {
    transition: transform 0.2s ease;
    color: var(--cjw-color-text, #000);
}

.cjw-drawer__group-toggle[aria-expanded="true"] .cjw-drawer__caret {
    transform: rotate(180deg);
}

.cjw-drawer__sublist {
    display: flex;
    flex-direction: column;
    padding: 4px 0 8px 18px;
}

.cjw-drawer__sublist[hidden] {
    display: none;
}

.cjw-drawer__sublink {
    display: block;
    padding: 11px 0;
    font-size: 16px;
    color: var(--cjw-color-text, #000);
    text-decoration: none;
}

.cjw-drawer__sublink:hover {
    color: var(--cjw-color-text-body, #555);
    text-decoration: none;
}

/* Lock body scroll while drawer open */
body.cjw-drawer-open {
    overflow: hidden;
}

/* ---------- Breakpoints ---------- */
/* Intermediate: nav fits but cramped — shrink gap/font, drop WA label */
@media (max-width: 1280px) {
    .cjw-header__inner {
        gap: 16px;
        padding: 12px clamp(16px, 3vw, 32px);
    }
    .cjw-nav {
        gap: 16px;
        font-size: 13px;
    }
    .cjw-header__logo {
        height: clamp(44px, 4vw, 56px);
    }
    .cjw-header__wa {
        padding: 0 12px;
        gap: 0;
    }
    .cjw-header__wa-label {
        display: none;
    }
}

@media (max-width: 960px) {
    .cjw-header__inner {
        grid-template-columns: auto 1fr auto;
        gap: 12px;
        padding: 12px clamp(14px, 4vw, 24px);
    }
    .cjw-nav {
        display: none;
    }
    .cjw-header__burger {
        display: inline-flex;
    }
    .cjw-header__brand {
        justify-content: center;
    }
    .cjw-header__logo {
        height: 48px;
    }
    .cjw-header__actions {
        gap: 8px;
    }
    /* Auth links move into drawer on mobile to save real estate */
    .cjw-header__authlink,
    .cjw-header__authsep {
        display: none;
    }
    /* WhatsApp stays visible — collapse label, keep icon pill compact */
    .cjw-header__wa {
        height: 38px;
        padding: 0 12px;
        gap: 0;
    }
    .cjw-header__wa-label {
        display: none;
    }
    .cjw-header__wa-icon {
        width: 20px;
        height: 20px;
    }
}

/* ---------- Drawer auth (mobile) ---------- */
.cjw-drawer__auth {
    margin-top: auto;
    padding: 18px 22px 24px;
    border-top: 1px solid var(--cjw-color-border, #e5e5e5);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cjw-drawer__auth-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 16px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border: 1.5px solid var(--cjw-color-text, #000);
    color: var(--cjw-color-text, #000);
    background: #fff;
    transition: background 0.18s ease, color 0.18s ease;
}

.cjw-drawer__auth-link--solid {
    background: var(--cjw-color-text, #000);
    color: #fff;
}

.cjw-drawer__auth-link:hover,
.cjw-drawer__auth-link:focus-visible {
    text-decoration: none;
}
