/*
 * Header & Navigation Styles
 *
 * Styles for the site header, logo, and navigation menu
 * Includes desktop horizontal nav and mobile hamburger menu
 */

/* ============================================
   HEADER
   ============================================ */

.site-header {
  background-color: var(--color-white);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: var(--z-sticky);
}

/* ============================================
   PEEK NAV — compact fixed bar (desktop only)
   Created by JS, hidden by default, slides in
   on scroll-up or mouse hover near top
   ============================================ */

.peek-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  background-color: var(--color-white);
  box-shadow: var(--shadow-md);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  display: none;
  justify-content: center;
  align-items: center;
  gap: var(--space-md);
  padding: 12px 0;
}

@media (min-width: 768px) {
  .peek-nav {
    display: flex;
  }
}

.peek-nav.visible {
  transform: translateY(0);
}

.peek-nav a {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-charcoal);
  text-decoration: none;
  transition: color var(--transition-fast);
  white-space: nowrap;
}

.peek-nav a:hover,
.peek-nav a.active {
  color: var(--color-sage);
  text-decoration: none;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;   /* ← top/bottom header padding — increase to add more breathing room */
  padding-bottom: 4px;
}

@media (min-width: 768px) {
  .header-container {
    padding-top: 4px;
    padding-bottom: 4px;
  }
}

/* ============================================
   LOGO
   ============================================ */

.site-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.site-logo:hover {
  opacity: 0.8;
  text-decoration: none;
}

/*
 * LOGO SIZE — adjust these two values to resize the header logo:
 *
 *   Mobile  → change the height inside .logo-img below
 *   Desktop → change the height inside the @media (min-width: 768px) block
 */
.logo-img {
  height: 54px;  /* ← mobile size: change this number */
  max-width: calc(100vw - 80px); /* prevent logo from covering the hamburger */
  width: auto;
  display: block;
}

@media (min-width: 768px) {
  .logo-img {
    height: 220px;  /* ← desktop size: change this number */
  }
}

/* ============================================
   NAVIGATION - DESKTOP
   ============================================ */

.nav-menu {
  display: none; /* Hidden on mobile by default */
}

@media (min-width: 768px) {
  .nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
  }

  /* Desktop: 3-column grid for the 6 nav links */
  .nav-menu ul {
    display: grid;
    grid-template-columns: repeat(3, auto);
    column-gap: var(--space-md);
    row-gap: 15px;
    justify-content: end;
  }
}

/* Base nav list — no grid here so mobile can override cleanly */
.nav-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu a {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-charcoal);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition-fast);
  position: relative;
}

.nav-menu a:hover {
  color: var(--color-sage);
  text-decoration: none;
}

/*
 * Active/current page indicator
 */
.nav-menu a.active {
  color: var(--color-sage);
}

.nav-menu a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-sage);
}

/*
 * CTA button in navigation
 */
.nav-cta {
  margin-left: var(--space-sm);
}

/* ============================================
   MOBILE MENU TOGGLE
   ============================================ */

.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 28px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: var(--z-fixed);
}

@media (min-width: 768px) {
  .menu-toggle {
    display: none; /* Hide on desktop */
  }
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--color-sage);
  outline-offset: 4px;
}

/*
 * Hamburger icon bars
 */
.hamburger {
  width: 28px;
  height: 3px;
  background-color: var(--color-charcoal);
  border-radius: 2px;
  transition: all var(--transition-base);
  position: relative;
  transform-origin: center;
}

/*
 * Animate to X when menu is open
 */
.menu-toggle[aria-expanded="true"] .hamburger:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .hamburger:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .hamburger:nth-child(3) {
  transform: translateY(-11px) rotate(-45deg);
}

/* ============================================
   NAVIGATION - MOBILE MENU
   ============================================ */

@media (max-width: 767px) {
  .nav-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-cream);
    z-index: var(--z-modal);
    padding: var(--space-xl) var(--space-md);
    overflow-y: auto;
  }

  .nav-menu.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .nav-menu ul {
    display: flex; /* override the grid that applies on desktop */
    flex-direction: column;
    gap: var(--space-lg);
    text-align: center;
    width: 100%;
  }

  .nav-menu a {
    font-size: var(--text-xl);
    display: block;
    padding: var(--space-sm);
  }

  .nav-menu a.active::after {
    display: none; /* Remove underline on mobile */
  }

  .nav-cta {
    margin-left: 0;
    margin-top: var(--space-md);
    width: 100%;
  }

  .nav-cta .btn {
    width: 100%;
  }
}

/*
 * Larger tap target for hamburger on mobile (44×44px minimum)
 * Also recalculates the X animation translateY values to match the new spacing
 */
@media (max-width: 767px) {
  .menu-toggle {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    gap: 6px;
  }

  /* Recalculated for center+gap layout: bars are 9px apart center-to-center */
  .menu-toggle[aria-expanded="true"] .hamburger:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }

  .menu-toggle[aria-expanded="true"] .hamburger:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }
}

/*
 * Prevent scrolling when mobile menu is open
 */
body.menu-open {
  overflow: hidden;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/*
 * Skip link (keyboard navigation)
 */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-sm);
  background-color: var(--color-sage);
  color: var(--color-white);
  padding: var(--space-xs) var(--space-sm);
  text-decoration: none;
  border-radius: var(--radius-sm);
  z-index: var(--z-tooltip);
  font-weight: var(--font-weight-semibold);
}

.skip-link:focus {
  top: var(--space-sm);
}
