/* ============================================================
   Samana — Header
   Sticky (position: sticky), white text, two states:
   - Default: solid petrol.
   - body.has-hero (page opens with a hero/banner photo — see
     samana_has_hero()): transparent over the photo, with a soft
     dark gradient for legibility, until the page scrolls —
     assets/js/header-scroll.js then adds .is-scrolled and it
     fades to solid petrol.
   The header's height and logo size never change on scroll (no
   layout shift).
   Desktop nav from 1200px; below that, mobile-menu.css takes over.
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  color: var(--color-header-text);
  background-color: var(--color-header-bg);
  box-shadow: var(--shadow-header);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Over a hero: the header stays in the normal flow (sticky), and the
   content below is pulled up underneath it by its own height. */
.has-hero .site-main {
  margin-top: calc(-1 * var(--header-height));
}

.has-hero .site-header:not(.is-scrolled) {
  background-color: transparent;
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
  box-shadow: none;
}

/* WP admin bar (logged-in only) would otherwise cover the sticky
   header — offset by the bar's own height. Below 600px the admin
   bar itself isn't fixed, so no offset there. */
@media (min-width: 601px) {
  .admin-bar .site-header {
    top: var(--wp-admin--admin-bar--height, 32px);
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  min-height: var(--header-height);
}

/* ============================================================
   LOGO
   Sized by width, height follows the image's own aspect ratio.
   ============================================================ */
.header-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-logo-img {
  width: clamp(125px, 18vw, 175px);
  height: auto;
}

.header-logo-text {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: var(--fw-heading);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-header-text);
}

/* ============================================================
   NAV
   Centered in the remaining space between the logo and the
   phone/CTA group. .header-cta-btn (mobile-panel copy of the CTA)
   is hidden on desktop — see ACTIONS below.
   ============================================================ */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  flex: 1;
  justify-content: center;
}

.main-menu {
  display: flex;
  align-items: center;
  gap: 28px;
}

.main-menu .top-level-item > a {
  font-family: var(--font-body);
  color: var(--color-nav-link);
  font-weight: var(--fw-regular);
  font-size: var(--fs-nav);
  line-height: 24px;
  letter-spacing: 0.01em;
  text-decoration: none;
  padding-bottom: 6px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-bottom-color var(--transition);
}

.main-menu .top-level-item > a:hover,
.main-menu .top-level-item > a:focus-visible,
.main-menu .top-level-item.current-menu-item > a,
.main-menu .top-level-item.current-menu-ancestor > a,
.main-menu .top-level-item.current-menu-parent > a {
  color: var(--color-nav-link-hover);
  border-bottom-color: var(--color-nav-link-hover);
}

/* ============================================================
   DROPDOWN (items with children) — DESKTOP ONLY
   Opens on hover / keyboard focus (focus-within) of the top-level
   item. The parent link still navigates normally. Mobile uses an
   accordion instead — see mobile-menu.css.
   ============================================================ */
@media (min-width: 1200px) {

  .main-menu .top-level-item {
    position: relative;
  }

  .main-menu .has-children > a::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform var(--transition);
  }

  .main-menu .has-children:hover > a::after,
  .main-menu .has-children:focus-within > a::after {
    transform: rotate(-135deg) translateY(2px);
  }

  /* .sub-menu-wrap carries the gap (padding-top) between the parent link
     and the dropdown panel — padding stays part of its own hoverable box
     (unlike margin), so crossing it never drops the hover state. */
  .sub-menu-wrap {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;
    padding-top: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity var(--transition), transform var(--transition), visibility 0.2s;
  }

  .top-level-item:hover > .sub-menu-wrap,
  .top-level-item:focus-within > .sub-menu-wrap {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  /* Third level flies out to the right of its parent item. */
  .sub-menu .menu-item {
    position: relative;
  }

  .sub-sub-menu-wrap {
    position: absolute;
    top: 0;
    left: 100%;
    padding-left: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility 0.2s;
  }

  .sub-menu .menu-item:hover > .sub-sub-menu-wrap,
  .sub-menu .menu-item:focus-within > .sub-sub-menu-wrap {
    opacity: 1;
    visibility: visible;
  }

  .sub-menu,
  .sub-sub-menu {
    min-width: 260px;
    overflow: hidden; /* clips first/last item's hover bg to the rounded corners */
    background-color: var(--color-dropdown-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-dropdown);
  }

  .sub-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--color-text);
    font-size: var(--fs-nav);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--transition), color var(--transition);
  }

  .sub-menu a:hover,
  .sub-menu a:focus-visible,
  .sub-menu .current-menu-item > a {
    background-color: var(--color-dropdown-hover);
    color: var(--color-primary);
  }

  .sub-menu a:focus-visible {
    outline-offset: -2px;
  }

  /* Mobile uses the .sub-menu-toggle button instead (mobile-menu.css) */
  .sub-menu-toggle {
    display: none;
  }
}

/* ============================================================
   ACTIONS — phone + CTA, right-aligned, last group in the header.
   Hidden below 1200px (mobile-menu.css); the mobile panel has its
   own .header-cta-btn copy, hidden here on desktop.
   ============================================================ */
.header-actions {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-shrink: 0;
}

@media (min-width: 1200px) {
  .header-cta-btn {
    display: none;
  }
}

/* ============================================================
   PHONE — plain text, no box
   ============================================================ */
.header-phone {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.header-phone-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps);
  color: var(--color-white-a85);
}

.header-phone-number {
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  font-size: var(--fs-nav);
  line-height: 24px;
  letter-spacing: 0.04em;
  color: var(--color-header-text);
  text-decoration: none;
}

/* ============================================================
   MOBILE HAMBURGER + full-screen panel top row
   Hidden on desktop — mobile-menu.css shows them below 1200px.
   ============================================================ */
.mobile-menu-toggle,
.mobile-menu-panel-header {
  display: none;
}
