/* =============================================================================
   NAV.CSS — Site header, navigation, mobile menu
   Pet Transfer Bodrum
   Matches the actual markup rendered by includes/header.php — keep these
   in sync if the header markup ever changes (class names must match).
   ============================================================================= */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-h);
  transition:
    background var(--duration-base) var(--ease-in-out),
    box-shadow var(--duration-base),
    backdrop-filter var(--duration-base);
}

/* Transparent on dark hero sections (top of page, not yet scrolled) */
.site-header:not(.scrolled) {
  background: transparent;
}

/* Scrolled: opaque light glass with subtle shadow — this is what makes
   text readable once the user scrolls past the dark hero. */
.site-header.scrolled {
  background: rgba(250, 250, 248, 0.97);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 1px 0 var(--color-border), var(--shadow-sm);
}

/* Pages whose hero is NOT a tall dark section (most inner pages use
   .page-hero which is dark, so this is mostly a safety net) still need
   readable nav text even before the user scrolls — handled by always
   giving inner-page bodies a non-transparent header via this class,
   set server-side per page type if needed. Default behaviour above
   already covers .page-hero since it shares --color-primary. */

/* ── Inner wrapper ──────────────────────────────────────── */
.header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-px);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* ── Logo ───────────────────────────────────────────────── */
.header-logo { flex-shrink: 0; display: flex; align-items: center; }
.header-logo a { text-decoration: none; display: flex; align-items: center; gap: 10px; }
.header-logo img { max-height: 40px; width: auto; display: block; }

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  color: var(--color-primary);
  transition: color var(--duration-fast);
}
.site-header:not(.scrolled) .logo-text { color: #fff; }

/* ── Main nav (desktop) ─────────────────────────────────── */
.header-nav { display: flex; align-items: center; }

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

.nav-link {
  display: block;
  padding: 8px 14px;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm, 8px);
  transition: color var(--duration-fast), background var(--duration-fast);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.nav-link:hover { color: var(--color-primary); background: var(--color-bg-alt); }
.nav-link--active { color: var(--color-primary); background: var(--color-bg-alt); }

/* White nav text on transparent dark header (top of page) */
.site-header:not(.scrolled) .nav-link { color: rgba(255,255,255,0.85); }
.site-header:not(.scrolled) .nav-link:hover,
.site-header:not(.scrolled) .nav-link--active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* ── Header actions (phone + WhatsApp + hamburger) ──────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Phone — icon sits directly beside the number, single line */
.header-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm, 8px);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.header-phone svg { flex-shrink: 0; }
.header-phone:hover { background: var(--color-bg-alt); }

.site-header:not(.scrolled) .header-phone { color: #fff; }
.site-header:not(.scrolled) .header-phone:hover { background: rgba(255,255,255,0.1); }

/* WhatsApp CTA button */
.header-wa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ── Hamburger (mobile toggle) ──────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm, 8px);
  transition: background var(--duration-fast);
  flex-shrink: 0;
}
.hamburger:hover { background: rgba(27,58,75,0.06); }

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: all var(--duration-base) var(--ease-out);
  transform-origin: center;
}
.site-header:not(.scrolled) .hamburger-line { background: #fff; }

.hamburger.open .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open .hamburger-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile slide-out drawer ──────────────────────────────
   z-index must beat every other fixed UI element on the page —
   back-to-top (9999), cookie-banner (9998), sticky-cta (9990),
   #toast-container / #paw-cursor (99999) — otherwise those become
   visible above the open drawer as soon as their own scroll
   thresholds are crossed (the bug: drawer looks "covered" once
   you scroll past those triggers). Keep this above all of them. */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 100000;
}
.mobile-menu[hidden] { display: none; }

.mobile-menu__overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 36, 51, 0.55);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out);
}
.mobile-menu.is-open .mobile-menu__overlay { opacity: 1; }

.mobile-menu__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: var(--color-surface, #fff);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--duration-base) var(--ease-out);
  overflow-y: auto;
}
.mobile-menu.is-open .mobile-menu__panel { transform: translateX(0); }

.mobile-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
}
.mobile-menu__header img { max-height: 32px; width: auto; }

.mobile-menu__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--color-bg-alt);
  border-radius: 50%;
  color: var(--color-text);
  cursor: pointer;
}

.mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mobile-nav-link {
  display: block;
  padding: 14px 12px;
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius-md, 10px);
}
.mobile-nav-link:hover,
.mobile-nav-link--active {
  background: var(--color-bg-alt);
  color: var(--color-primary);
}

.mobile-menu__footer {
  margin-top: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--color-border);
}

/* ── Breakpoint: collapse to hamburger ──────────────────── */
@media (max-width: 900px) {
  .header-nav { display: none; }
  .hamburger { display: flex; }
}

@media (max-width: 640px) {
  /* Phone number is already reachable inside the drawer — keep the
     top bar to logo + WhatsApp + hamburger only, to avoid crowding. */
  .header-phone { display: none; }
  .header-wa span { display: none; }
  .header-wa { padding: 10px; }
}
