/* ============================================================================
   Site header — ported verbatim from mockup/nose-surgery-pillar-v2.html.
   Hardcoded nav (mega-menus + SVG icons + descriptions kept as designed).
   Loaded globally (see inc/enqueue.php). Class names (.site-header / .mobile-nav)
   are intentionally distinct from the legacy .header/.nav so the old frozen
   header CSS no longer applies. JS: assets/js/site-header.js.
   ============================================================================ */

:root {
  --color-primary: #DDA678;
  --color-primary-dark: #C4915F;
  --color-primary-light: #E8C4A8;
  --color-primary-subtle: rgba(221, 166, 120, 0.08);
  --color-black: #1A1A1A;
  --color-text: #2D2D2D;
  --color-text-secondary: #6B6B6B;
  --color-text-tertiary: #999999;
  --color-border: #E5E5E5;
  --color-border-light: #F0F0F0;
  --color-surface: #FAFAFA;
  --color-white: #FFFFFF;
  --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --content-width: 720px;
  --content-width-wide: 960px;
  --content-width-full: 1120px;
  --topbar-height: 52px;
  --navbar-height: 52px;
  --header-height: 104px;
}

/* Scoped reset: the mockup relied on a global *{box-sizing:border-box;margin:0}
   reset. Re-establish it just for the header so the theme's legacy global CSS
   can't bleed in. :where() keeps specificity at 0 so the ported rules below
   always win. */
.site-header, .mobile-nav,
.site-header *, .site-header *::before, .site-header *::after,
.mobile-nav *, .mobile-nav *::before, .mobile-nav *::after { box-sizing: border-box; }
.site-header :where(ul), .mobile-nav :where(ul) { margin: 0; padding: 0; list-style: none; }
.site-header :where(li), .mobile-nav :where(li) { margin: 0; }
.site-header :where(a), .mobile-nav :where(a) { color: inherit; text-decoration: none; }
.site-header :where(p), .mobile-nav :where(p),
.site-header :where(h3), .mobile-nav :where(h3) { margin: 0; }
.site-header :where(button), .mobile-nav :where(button) { font-family: inherit; cursor: pointer; border: none; background: none; }
.site-header :where(img), .mobile-nav :where(img) { max-width: 100%; height: auto; display: block; }

/* Fixed-header offset (replaces the legacy .header_blank spacer). Tracks
   --header-height, which the max-width:1024px block below shrinks to the navbar
   height once the topbar is hidden. */
.site-header-spacer { height: var(--header-height); }

/* ===== Ported header styles (mockup lines 2686-3168) ===== */
    .site-header {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 1000;
      background: var(--color-white);
      transition: box-shadow 0.3s ease;
      font-family: var(--font-sans);
    }

    .header-topbar {
      height: var(--topbar-height);
      border-bottom: 1px solid var(--color-border-light);
    }

    .topbar-inner {
      max-width: var(--content-width-full);
      margin: 0 auto;
      padding: 0 1.5rem;
      height: var(--topbar-height);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .header-logo {
      flex-shrink: 0;
      display: flex;
      align-items: center;
    }

    .header-logo-img {
      height: 37px;
      width: auto;
      display: block;
    }

    .topbar-right {
      display: flex;
      align-items: center;
      gap: 1rem;
    }

    .lang-flags {
      display: flex;
      align-items: center;
      gap: 0.625rem;
    }

    .lang-flag-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 26px;
      height: 26px;
      border-radius: 50%;
      overflow: hidden;
      border: 2px solid var(--color-border);
      transition: border-color 0.2s ease, transform 0.15s ease;
      padding: 0;
    }

    .lang-flag-btn:hover { transform: scale(1.1); }
    .lang-flag-btn.active { border-color: var(--color-primary); }

    .lang-flag-btn img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 50%;
    }

    .topbar-links {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      font-size: 0.875rem;
      color: var(--color-text-secondary);
    }

    .topbar-links a {
      transition: color 0.2s;
      white-space: nowrap;
    }

    .topbar-links a:hover { color: var(--color-primary-dark); }

    .topbar-divider {
      width: 1px;
      height: 12px;
      background: var(--color-border);
    }

    .header-cta {
      display: inline-flex;
      align-items: center;
      gap: 0.375rem;
      padding: 0.375rem 1rem;
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--color-white);
      background: var(--color-primary-dark);
      border-radius: 6px;
      transition: background 0.2s ease, transform 0.15s ease;
      white-space: nowrap;
    }

    .header-cta:hover {
      background: #B5824E;
      transform: translateY(-1px);
    }

    .header-cta svg { width: 12px; height: 12px; }

    .header-navbar {
      height: var(--navbar-height);
      border-bottom: 1px solid var(--color-border-light);
      background: var(--color-white);
    }

    .navbar-inner {
      max-width: var(--content-width-full);
      margin: 0 auto;
      padding: 0 1.5rem;
      height: 100%;
      display: flex;
      align-items: center;
      gap: 0;
    }

    .navbar-logo {
      display: none;
      flex-shrink: 0;
      align-items: center;
    }

    .header-nav {
      flex: 1;
      display: flex;
      align-items: center;
      margin-left: -1.125rem;
    }

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

    .header-nav-item { position: relative; }

    .header-nav-link {
      display: flex;
      align-items: center;
      padding: 0.5rem 1.125rem;
      font-size: 0.9375rem;
      font-weight: 500;
      color: var(--color-text);
      letter-spacing: 0.01em;
      transition: color 0.2s ease;
      white-space: nowrap;
    }

    .header-nav-link:hover,
    .header-nav-item:hover > .header-nav-link {
      color: var(--color-primary-dark);
    }

    .header-nav-link::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 1.125rem;
      right: 1.125rem;
      height: 2px;
      background: var(--color-primary);
      transform: scaleX(0);
      transition: transform 0.25s ease;
    }

    .header-nav-item:hover > .header-nav-link::after { transform: scaleX(1); }

    .nav-chevron {
      width: 10px;
      height: 10px;
      margin-left: 6px;
      transition: transform 0.2s ease;
      opacity: 0.5;
    }

    .header-nav-item:hover .nav-chevron {
      transform: rotate(180deg);
      opacity: 1;
    }

    .navbar-actions {
      display: none;
      align-items: center;
      gap: 0.5rem;
      flex-shrink: 0;
    }

    .search-toggle {
      width: 34px;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 6px;
      color: var(--color-text-secondary);
      transition: background 0.2s, color 0.2s;
    }

    .search-toggle:hover {
      background: var(--color-surface);
      color: var(--color-text);
    }

    .search-toggle svg { width: 16px; height: 16px; }

    /* Mega Menu */
    .mega-menu {
      position: absolute;
      top: 100%;
      left: 50%;
      transform: translateX(-30%) translateY(10px);
      min-width: 560px;
      background: var(--color-white);
      border: 1px solid var(--color-border);
      border-radius: 4px;
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
      padding: 0;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    }

    .header-nav-item:hover > .mega-menu {
      opacity: 1;
      visibility: visible;
      transform: translateX(-30%) translateY(0);
    }

    .mega-menu-header {
      padding: 1rem 1.25rem 0.625rem;
      border-bottom: 1px solid var(--color-border-light);
    }

    .mega-menu-header h3 {
      font-family: var(--font-serif);
      font-size: 1rem;
      font-weight: 600;
      color: var(--color-black);
      letter-spacing: -0.01em;
    }

    .mega-menu-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 0;
      padding: 0.5rem 0;
    }

    .mega-menu-item {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.625rem 1.25rem;
      transition: background 0.15s ease;
    }

    .mega-menu-item:hover { background: var(--color-surface); }
    .mega-menu-item:hover .mega-menu-title { color: var(--color-primary-dark); }

    .mega-menu-icon {
      flex-shrink: 0;
      width: 20px;
      height: 20px;
      color: var(--color-text-tertiary);
      transition: color 0.15s ease;
    }

    .mega-menu-item:hover .mega-menu-icon { color: var(--color-primary-dark); }

    .mega-menu-text { flex: 1; min-width: 0; }

    .mega-menu-title {
      font-size: 0.8125rem;
      font-weight: 500;
      color: var(--color-text);
      transition: color 0.15s ease;
      line-height: 1.3;
    }

    .mega-menu-desc {
      font-size: 0.6875rem;
      color: var(--color-text-tertiary);
      line-height: 1.3;
      margin-top: 1px;
    }

    .mega-menu-footer {
      padding: 0.625rem 1.25rem;
      border-top: 1px solid var(--color-border-light);
      background: var(--color-surface);
      border-radius: 0 0 4px 4px;
    }

    .mega-menu-footer a {
      font-size: 0.75rem;
      font-weight: 500;
      color: var(--color-primary-dark);
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      transition: gap 0.2s ease;
    }

    .mega-menu-footer a:hover { gap: 0.5rem; }

    /* Mobile hamburger */
    .mobile-toggle {
      display: none;
      width: 34px;
      height: 34px;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 5px;
      border-radius: 6px;
    }

    .mobile-toggle span {
      display: block;
      width: 20px;
      height: 1.5px;
      background: var(--color-text);
      border-radius: 1px;
      transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .mobile-toggle.active span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
    .mobile-toggle.active span:nth-child(2) { opacity: 0; }
    .mobile-toggle.active span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

    /* Mobile nav */
    .mobile-nav {
      position: fixed;
      top: var(--header-height);
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 999;
      background: var(--color-white);
      overflow-y: auto;
      transform: translateX(100%);
      transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), top 0.35s ease;
      font-family: var(--font-sans);
    }

    .mobile-nav.active { transform: translateX(0); }

    .mobile-nav-inner { padding: 1rem 1.5rem 2rem; }

    .mobile-nav-item { border-bottom: 1px solid var(--color-border-light); }

    .mobile-nav-link {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 1rem 0;
      font-size: 0.9375rem;
      font-weight: 500;
      color: var(--color-text);
      width: 100%;
    }

    .mobile-nav-link .nav-chevron { transition: transform 0.2s; }
    .mobile-nav-link.expanded .nav-chevron { transform: rotate(180deg); }

    .mobile-submenu {
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.3s ease;
    }

    .mobile-submenu.open { max-height: 600px; }

    .mobile-submenu-item {
      display: block;
      padding: 0.625rem 0 0.625rem 1rem;
      font-size: 0.8125rem;
      color: var(--color-text-secondary);
      transition: color 0.2s;
    }

    .mobile-submenu-item:hover { color: var(--color-primary-dark); }

    .mobile-cta-wrap { padding: 1.5rem 0; }

    .mobile-cta {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      width: 100%;
      padding: 0.875rem;
      font-size: 0.9375rem;
      font-weight: 600;
      color: var(--color-white);
      background: var(--color-primary-dark);
      border-radius: 10px;
    }

    .mobile-lang-section {
      padding-top: 1rem;
      border-top: 1px solid var(--color-border-light);
    }

    .mobile-lang-title {
      font-size: 0.6875rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--color-text-tertiary);
      margin-bottom: 0.5rem;
    }

    .mobile-lang-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.375rem;
    }

    .mobile-lang-option {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.375rem;
      padding: 0.5rem;
      font-size: 0.75rem;
      font-weight: 500;
      color: var(--color-text-secondary);
      border: 1px solid var(--color-border);
      border-radius: 6px;
      transition: border-color 0.2s, color 0.2s;
    }

    .mobile-lang-option:hover,
    .mobile-lang-option.active {
      border-color: var(--color-primary);
      color: var(--color-primary-dark);
    }

    .mobile-lang-option img {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      object-fit: cover;
      flex-shrink: 0;
    }

    @media (max-width: 1024px) {
      :root { --header-height: var(--navbar-height); }
      .header-topbar { display: none; }
      .header-nav { display: none; }
      .search-toggle { display: none; }
      .navbar-actions { display: flex; }
      .mobile-toggle { display: flex; }
      .navbar-logo { display: flex; }
      .navbar-inner { justify-content: space-between; }
    }

    @media (min-width: 1025px) {
      .mobile-nav { display: none !important; }
    }

    @media (max-width: 480px) {
      .header-cta span { display: none; }
      .header-cta { padding: 0.375rem; }
    }

    /* ===== WordPress admin bar offset =====
       When logged in, WP adds .admin-bar to <body> and pins a 32px (desktop) /
       46px (<=782px) bar at top:0. Our fixed header/drawer also pin to top, so
       push them down by the bar height. WP's own html{margin-top} already shifts
       the in-flow spacer + page content, so only the fixed elements need this. */
    .admin-bar .site-header { top: 32px; }
    .admin-bar .mobile-nav { top: calc(32px + var(--header-height)); }

    @media screen and (max-width: 782px) {
      .admin-bar .site-header { top: 46px; }
      .admin-bar .mobile-nav { top: calc(46px + var(--header-height)); }
    }

    /* ===== Homepage transparent overlay =====
       On the homepage the header starts transparent and overlays the hero
       (.main-top-area, tan bg), then turns solid white once the page is
       scrolled — restoring the old front-page behaviour the redesign dropped.
       Desktop only (>=1025px): on mobile the topbar is hidden and the navbar
       must stay solid white to remain legible over the busy hero, so the
       overlay treatment is intentionally not applied there.
       JS (site-header.js) toggles .is-scrolled on #siteHeader. Inner pages
       never get .site-header--home, so they stay solid white as before. */
    @media (min-width: 1025px) {
      .site-header--home {
        background: transparent;
        box-shadow: none;
        transition: background-color 0.3s ease, box-shadow 0.3s ease;
      }

      /* Drop the white fills + hairline borders so the hero shows through. */
      .site-header--home .header-topbar,
      .site-header--home .header-navbar {
        background: transparent;
        border-bottom-color: transparent;
        transition: background-color 0.3s ease, border-color 0.3s ease;
      }

      /* Collapse the offset spacer so the header overlays the hero instead of
         pushing it down. */
      .site-header-spacer--home { height: 0; }

      /* Scrolled — restore the solid white header. */
      .site-header--home.is-scrolled {
        background: var(--color-white);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
      }

      .site-header--home.is-scrolled .header-topbar {
        border-bottom-color: var(--color-border-light);
      }

      .site-header--home.is-scrolled .header-navbar {
        background: var(--color-white);
        border-bottom-color: var(--color-border-light);
      }
    }
