/**
 * Livewellcraft Global Header Styles
 * Design System: DNA.md tokens
 * 
 * Color Strategy:
 * - Top state: Light semi-transparent bg for readability across hero variations
 * - Scrolled state: Solid white bg with full contrast
 * - Logo: Multi-color SVG (#1a1a2e navy + #d4a017 gold), works on light backgrounds
 */

/* ========================================
   CSS Custom Properties (Design Tokens)
   ======================================== */
:root {
    /* Brand Colors from DNA.md */
    --lwc-primary: #1A1A2E;
    --lwc-primary-950: #0E0E1A;
    --lwc-primary-800: #22223A;
    --lwc-primary-light: #2A2A45;
    
    --lwc-cta: #B8860B;
    --lwc-cta-hover: #9A7209;
    --lwc-cta-light: #D4A017;
    --lwc-cta-dark: #8B6914;
    
    --lwc-accent: #C07850;
    --lwc-accent-light: #D4956E;
    
    --lwc-neutral-50: #FAF9F7;
    --lwc-neutral-100: #F5F3F0;
    --lwc-neutral-200: #E8E4DF;
    --lwc-neutral-300: #D4CFC8;
    --lwc-neutral-400: #A09890;
    --lwc-neutral-500: #706860;
    --lwc-neutral-600: #554E48;
    --lwc-neutral-700: #3D3832;
    --lwc-neutral-800: #2A2520;
    
    /* Typography */
    --lwc-font-heading: 'Playfair Display', Georgia, serif;
    --lwc-font-body: 'DM Sans', system-ui, sans-serif;
    
    /* Header State Variables */
    --header-bg: rgba(255, 255, 255, 0.95);
    --header-fg: var(--lwc-primary);
    --header-fg-secondary: var(--lwc-neutral-600);
    --header-accent: var(--lwc-cta);
    --header-border: var(--lwc-neutral-200);
    --header-surface: var(--lwc-neutral-50);
    --header-logo-filter: none;
    
    /* Topbar Variables */
    --topbar-bg: var(--lwc-primary);
    --topbar-fg: rgba(255, 255, 255, 0.9);
    --topbar-fg-hover: #fff;
    --topbar-height: 44px;
    
    /* Main Header Variables */
    --header-main-height: 88px;
    --header-main-height-scrolled: 72px;
    
    /* Transitions */
    --header-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index layers */
    --z-header: 1000;
    --z-mega: 1001;
    --z-mobile-menu: 1002;
    --z-overlay: 999;
}

/* ========================================
   Base Header Structure
   ======================================== */
.lwc-header {
    position: relative;
    z-index: var(--z-header);
    font-family: var(--lwc-font-body);
}

.lwc-header[data-header-state="scrolled"] {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

.lwc-header-spacer {
    display: none;
    height: 0;
}

.lwc-header-spacer.is-active {
    display: block;
}

/* ========================================
   Top Bar
   ======================================== */
.lwc-topbar {
    background: var(--topbar-bg);
    color: var(--topbar-fg);
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    font-size: 13px;
    transition: 
        height var(--header-transition),
        opacity var(--header-transition),
        transform var(--header-transition);
    overflow: hidden;
}

.lwc-header[data-header-state="scrolled"] .lwc-topbar {
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.lwc-topbar__container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lwc-topbar__left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.lwc-topbar__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--topbar-fg);
    text-decoration: none;transition: color 0.2s ease;
}

.lwc-topbar__item:hover {
    color: var(--topbar-fg-hover);
}

.lwc-topbar__item--static {
    cursor: default;
}

.lwc-topbar__item i {
    font-size: 14px;
    opacity: 0.8;
}

.lwc-topbar__right {
    display: flex;
    align-items: center;
}

/* Language Switcher Wrapper */
.lwc-lang-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.lwc-lang-icon {
    font-size: 14px;
    opacity: 0.8;
}

/* WPML Language Switcher Styling */
.jcm-language-switcher {
    position: relative;
}

.jcm-language-switcher a {
    color: var(--topbar-fg);
    text-decoration: none;
    transition: color 0.2s ease;
}

.jcm-language-switcher a:hover {
    color: var(--topbar-fg-hover);
}

.jcm-language-switcher ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.jcm-language-switcher .wpml-ls-legacy-dropdown {
    position: relative;
}

.jcm-language-switcher .wpml-ls-legacy-dropdown-click .wpml-ls-item-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.jcm-language-switcher .wpml-ls-legacy-dropdown-click .wpml-ls-item-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.jcm-language-switcher .wpml-ls-sub-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 140px;
    background: #fff;
    border: 1px solid var(--lwc-neutral-200);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    z-index: 10;
}

.jcm-language-switcher .wpml-ls-legacy-dropdown-click:hover .wpml-ls-sub-menu,
.jcm-language-switcher .wpml-ls-legacy-dropdown-click.wpml-ls-current-language:focus-within .wpml-ls-sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.jcm-language-switcher .wpml-ls-sub-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: var(--lwc-neutral-700);
    font-size: 13px;
    transition: background 0.15s ease;
}

.jcm-language-switcher .wpml-ls-sub-menu a:hover {
    background: var(--lwc-neutral-50);
    color: var(--lwc-primary);
}

.jcm-language-switcher .wpml-ls-flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
}

/* ========================================
   Main Header
   ======================================== */
.lwc-header-main {
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    height: var(--header-main-height);
    display: flex;
    flex-direction: column;
    transition: 
        height var(--header-transition),
        background var(--header-transition),
        box-shadow var(--header-transition);
}

.lwc-header[data-header-state="scrolled"] .lwc-header-main {
    height: var(--header-main-height-scrolled);
    background: #fff;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

.lwc-header__container {
    max-width: 1280px;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 32px;
}

/* ========================================
   Logo / Brand
   ======================================== */
.lwc-header__brand {
    display: flex;
    align-items: center;
}

.lwc-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.lwc-logo__image {
    height: 48px;
    width: auto;
    filter: var(--header-logo-filter);
    transition: 
        height var(--header-transition),
        filter var(--header-transition);
}

.lwc-header[data-header-state="scrolled"] .lwc-logo__image {
    height: 40px;
}

/* ========================================
   Primary Navigation
   ======================================== */
.lwc-nav {
    display: flex;
    justify-content: center;
}

.lwc-nav__list {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.lwc-nav__item {
    position: relative;
}

.lwc-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    color: var(--header-fg);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    transition: 
        color 0.2s ease,
        background 0.2s ease;
}

.lwc-nav__link:hover {
    color: var(--header-accent);
    background: rgba(184, 134, 11, 0.06);
}

.lwc-nav__item.is-active .lwc-nav__link {
    color: var(--header-accent);
}

.lwc-nav__item.is-active .lwc-nav__link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--header-accent);
    border-radius: 2px 2px 0 0;
}

.lwc-nav__arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.lwc-nav__item--has-mega[data-mega-open="true"] .lwc-nav__arrow {
    transform: rotate(180deg);
}

.lwc-nav__link--trigger {
    cursor: pointer;
}

/* ========================================
   Header Actions
   ======================================== */
.lwc-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

/* Primary Button */
.lwc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: var(--lwc-font-body);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lwc-btn--primary {
    background: var(--lwc-cta);
    color: #fff;
}

.lwc-btn--primary:hover {
    background: var(--lwc-cta-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.3);
}

.lwc-btn--primary i {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.lwc-btn--primary:hover i {
    transform: translateX(3px);
}

.lwc-btn--full {
    width: 100%;
}

/* Mobile Toggle */
.lwc-mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
}

.lwc-mobile-toggle__bar {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--header-fg);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.lwc-mobile-toggle[aria-expanded="true"] .lwc-mobile-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.lwc-mobile-toggle[aria-expanded="true"] .lwc-mobile-toggle__bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.lwc-mobile-toggle[aria-expanded="true"] .lwc-mobile-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ========================================
   Mega Menu
   ======================================== */
.lwc-mega {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--lwc-neutral-200);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: 
        opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.25s ease;
    z-index: var(--z-mega);
}

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

.lwc-mega__container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr 280px;
    gap: 40px;
}

/* Mega Menu Groups */
.lwc-mega__group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lwc-mega__group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--lwc-cta-light);
    font-family: var(--lwc-font-heading);
    font-size: 16px;
    font-weight: 600;
    color: var(--lwc-primary);
}

.lwc-mega__group-icon {
    color: var(--lwc-cta);
    font-size: 18px;
}

.lwc-mega__columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/* Category Blocks */
.lwc-mega__category {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lwc-mega__cat-title {
    font-family: var(--lwc-font-heading);
    font-size: 15px;
    font-weight: 600;
    color: var(--lwc-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.lwc-mega__cat-title:hover {
    color: var(--lwc-cta);
}

.lwc-mega__cat-desc {
    font-size: 12px;
    color: var(--lwc-neutral-500);
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.lwc-mega__links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lwc-mega__links li a {
    display: inline-block;
    padding: 4px 0;
    font-size: 13px;
    color: var(--lwc-neutral-600);
    text-decoration: none;
    transition: color 0.15s ease, padding-left 0.15s ease;
}

.lwc-mega__links li a:hover {
    color: var(--lwc-cta);
    padding-left: 4px;
}

.lwc-mega__view-all a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--lwc-cta);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lwc-mega__view-all a:hover {
    padding-left: 0;
}

.lwc-mega__view-all i {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.lwc-mega__view-all a:hover i {
    transform: translateX(3px);
}

/* Support Column */
.lwc-mega__support {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-left: 32px;
    border-left: 1px solid var(--lwc-neutral-200);
}

.lwc-mega__support-card {
    background: var(--lwc-neutral-50);
    border: 1px solid var(--lwc-neutral-200);
    border-radius: 8px;
    padding: 24px;
}

.lwc-mega__support-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    background: rgba(184, 134, 11, 0.1);
    border-radius: 8px;
    color: var(--lwc-cta);
    font-size: 20px;
}

.lwc-mega__support-card h4 {
    margin: 0 0 8px 0;
    font-family: var(--lwc-font-heading);
    font-size: 16px;
    font-weight: 600;
    color: var(--lwc-primary);
}

.lwc-mega__support-card p {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: var(--lwc-neutral-600);
    line-height: 1.5;
}

.lwc-mega__support-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--lwc-cta);
    text-decoration: none;
    transition: gap 0.2s ease;
}

.lwc-mega__support-link:hover {
    gap: 10px;
}

.lwc-mega__support-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.lwc-mega__stat {
    text-align: center;
    padding: 16px 8px;
    background: var(--lwc-primary);
    border-radius: 6px;
}

.lwc-mega__stat-value {
    display: block;
    font-family: var(--lwc-font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--lwc-cta-light);
}

.lwc-mega__stat-label {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   Mobile Menu
   ======================================== */
.lwc-mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 380px;
    background: #fff;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: var(--z-mobile-menu);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.lwc-mobile-menu.is-open {
    transform: translateX(0);
}

.lwc-mobile-menu__inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 80px 24px 32px;
}

/* Mobile Navigation */
.lwc-mobile-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lwc-mobile-nav__item {
    border-bottom: 1px solid var(--lwc-neutral-200);
}

.lwc-mobile-nav__item > a,
.lwc-mobile-nav__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--lwc-primary);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
}

.lwc-mobile-nav__item.is-active > a,
.lwc-mobile-nav__item.is-active > .lwc-mobile-nav__toggle {
    color: var(--lwc-cta);
}

.lwc-mobile-nav__toggle i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.lwc-mobile-nav__toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Mobile Submenu */
.lwc-mobile-nav__submenu {
    display: none;
    padding: 0 0 16px 0;
}

.lwc-mobile-nav__item--expandable.is-expanded .lwc-mobile-nav__submenu {
    display: block;
}

.lwc-mobile-nav__group {
    margin-bottom: 16px;
}

.lwc-mobile-nav__group:last-child {
    margin-bottom: 0;
}

.lwc-mobile-nav__group-label {
    display: block;
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--lwc-neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lwc-mobile-nav__sublink {
    display: block;
    padding: 10px 0 10px 12px;
    font-size: 14px;
    color: var(--lwc-neutral-600);
    text-decoration: none;
    border-left: 2px solid var(--lwc-neutral-200);
    transition: 
        color 0.2s ease,
        border-color 0.2s ease;
}

.lwc-mobile-nav__sublink:hover {
    color: var(--lwc-cta);
    border-color: var(--lwc-cta);
}

/* Mobile Contact */
.lwc-mobile-menu__contact {
    margin-top: auto;
    padding-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lwc-mobile-menu__contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--lwc-neutral-50);
    border-radius: 6px;
    font-size: 14px;
    color: var(--lwc-neutral-700);
    text-decoration: none;
    transition: background 0.2s ease;
}

.lwc-mobile-menu__contact-item:hover {
    background: var(--lwc-neutral-100);
}

.lwc-mobile-menu__contact-item i {
    font-size: 16px;
    color: var(--lwc-cta);
}

/* Mobile CTA */
.lwc-mobile-menu__cta {
    margin-top: 24px;
}

/* Overlay */
.lwc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: 
        opacity 0.3s ease,
        visibility 0.3s ease;
    z-index: var(--z-overlay);
}

.lwc-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   Responsive Styles
   ======================================== */

/* Tablet */
@media (max-width: 1024px) {
    :root {
        --header-main-height: 76px;
        --header-main-height-scrolled: 64px;
    }
    
    .lwc-header__container {
        grid-template-columns: auto 1fr auto;
        gap: 24px;
    }
    
    .lwc-nav {
        display: none;
    }
    
    .lwc-mobile-toggle {
        display: flex;
    }
    
    .lwc-mega {
        display: none;
    }
    
    .lwc-logo__image {
        height: 40px;
    }
    
    .lwc-header[data-header-state="scrolled"] .lwc-logo__image {
        height: 36px;
    }
    
    .lwc-btn--primary span {
        display: none;
    }
    
    .lwc-btn--primary {
        padding: 12px 14px;
    }
    
    .lwc-btn--primary i {
        margin: 0;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --topbar-height: 40px;
        --header-main-height: 68px;
        --header-main-height-scrolled: 60px;
    }
    
    .lwc-topbar__container {
        padding: 0 16px;
    }
    
    .lwc-topbar__left {
        gap: 16px;
    }
    
    .lwc-topbar__item span {
        display: none;
    }
    
    .lwc-topbar__item i {
        font-size: 16px;
    }
    
    .lwc-topbar__item--static {
        display: none;
    }
    
    .lwc-header__container {
        padding: 0 16px;
        gap: 16px;
    }
    
    .lwc-logo__image {
        height: 36px;
    }
    
    .lwc-header[data-header-state="scrolled"] .lwc-logo__image {
        height: 32px;
    }
    
    .lwc-mobile-menu {
        max-width: 100%;
    }
    
    .lwc-mobile-menu__inner {
        padding: 72px 20px 24px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .lwc-topbar__left {
        gap: 12px;
    }
    
    .lwc-header__actions .lwc-btn--primary {
        display: none;
    }
    
    .lwc-mobile-toggle {
        width: 40px;
        height: 40px;
    }
}

/* ========================================
   Accessibility & Focus States
   ======================================== */
.lwc-nav__link:focus-visible,
.lwc-btn:focus-visible,
.lwc-mobile-toggle:focus-visible,
.lwc-mobile-nav__toggle:focus-visible,
.lwc-mobile-nav__item > a:focus-visible,
.lwc-mobile-nav__sublink:focus-visible {
    outline: 2px solid var(--lwc-cta);
    outline-offset: 2px;
}

.lwc-mega__cat-title:focus-visible,
.lwc-mega__links li a:focus-visible,
.lwc-mega__support-link:focus-visible {
    outline: 2px solid var(--lwc-cta);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .lwc-header {
        position: relative !important;
        box-shadow: none !important;
    }
    
    .lwc-topbar,
    .lwc-mobile-toggle,
    .lwc-mega,
    .lwc-mobile-menu,
    .lwc-overlay {
        display: none !important;
    }
}
