﻿.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(5, 18, 15, 0.34);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.navbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 72px;
  padding: 4px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin-right: auto;
  line-height: 0;
}

.brand-logo {
  display: block;
  height: 92px;
  width: auto;
  object-fit: contain;
}
.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0;
  margin-left: auto;
  margin-right: 12px;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 8px;
  color: rgba(255,255,255,0.82);
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1;
  transition: color 180ms ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -5px;
  height: 1px;
  background: rgba(255,255,255,0.9);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 180ms ease;
}

.nav-link.active {
  color: rgba(255,255,255,1);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.nav-link.active::after,
.nav-link:focus-visible::after {
  transform: scaleX(1);
}

/* Hover underline only where hover exists. Touch browsers keep a tapped
   link in :hover until the next tap, which left a second underline on
   phones once the active section moved on. */
@media (hover: hover) {
  .nav-link:hover::after {
    transform: scaleX(1);
  }
}

.nav-link:hover,
.nav-link:focus-visible {
  color: rgba(255,255,255,1);
}

.nav-cta {
  margin-left: 2px;
  color: rgba(255,255,255,0.96);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0 8px;
  min-height: 30px;
}

.nav-cta::after {
  left: 8px;
  right: 8px;
}

/* ------------------------------------------------------------------
   Narrow screens (≤780px): compact header with a hamburger menu.
   Everything below is scoped to the media query, except the one rule
   that hides the toggle on wider screens. Desktop rules above apply
   unchanged at widths over 780px.
   ------------------------------------------------------------------ */

.nav-toggle {
  display: none;
}

@media (max-width: 780px) {
  .site-header {
    background: rgba(4, 32, 15, 0.96);
    border-bottom: 1px solid rgba(255, 251, 208, 0.16);
    /* A backdrop-filter on the header itself would make it the containing
       block for the fixed-position menu panel, so the blur moves to a
       pseudo-element that sits under the bar's content. */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .site-header::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    content: "";
    pointer-events: none;
  }

  .site-header.is-menu-open {
    background: var(--forest);
  }

  html.menu-open,
  html.menu-open body {
    overflow: hidden;
  }

  .navbar.container {
    width: calc(100% - 32px);
  }

  .navbar {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 12px;
    min-height: 60px;
    padding: 6px 0;
  }

  .brand {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
  }

  .brand-logo {
    height: 48px;
  }

  /* --- Hamburger: three cream strokes that fold into a cross. --- */
  .nav-toggle {
    position: relative;
    z-index: 2;
    display: grid;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    margin-right: -11px; /* the strokes, not the hit area, align with the gutter */
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--cream);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 180ms ease, transform 180ms ease;
  }

  .nav-toggle:active {
    transform: scale(0.94);
  }

  .nav-toggle:focus-visible {
    outline: 2px solid var(--river-blue);
    outline-offset: 2px;
    box-shadow: none;
  }

  .nav-toggle-bar,
  .nav-toggle-bar::before,
  .nav-toggle-bar::after {
    display: block;
    width: 22px;
    height: 1.5px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 300ms cubic-bezier(0.2, 0.7, 0.2, 1), background-color 160ms ease;
  }

  .nav-toggle-bar {
    position: relative;
  }

  .nav-toggle-bar::before,
  .nav-toggle-bar::after {
    position: absolute;
    left: 0;
    content: "";
  }

  .nav-toggle-bar::before {
    top: -7px;
  }

  .nav-toggle-bar::after {
    top: 7px;
  }

  .site-header.is-menu-open .nav-toggle-bar {
    background-color: transparent;
  }

  .site-header.is-menu-open .nav-toggle-bar::before {
    transform: translateY(7px) rotate(45deg);
  }

  .site-header.is-menu-open .nav-toggle-bar::after {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* --- Menu panel: fills the viewport beneath the header bar. --- */
  .nav-links {
    position: fixed;
    top: var(--anchor-offset, 60px);
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    margin: 0;
    padding: 28px 16px 32px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background:
      radial-gradient(ellipse at 90% 8%, rgba(168, 98, 42, 0.16), transparent 32%),
      var(--forest);
    counter-reset: nav-item;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition:
      opacity 240ms ease,
      transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1),
      visibility 0s linear 320ms;
  }

  .site-header.is-menu-open .nav-links {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition:
      opacity 240ms ease,
      transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1),
      visibility 0s;
  }

  /* Closing line at the foot of the panel, echoing the hero signature. */
  .nav-links::after {
    margin-top: auto;
    padding-top: 32px;
    color: rgba(255, 251, 208, 0.56);
    font: 600 0.66rem/1.4 var(--font-body);
    letter-spacing: 0.24em;
    text-transform: uppercase;
    content: "Made by hand · Built to last";
  }

  .site-header .nav-links .nav-link,
  .site-header .nav-links .nav-cta {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: baseline;
    justify-content: flex-start;
    gap: 16px;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 17px 0 15px;
    border: 0;
    border-bottom: 1px solid rgba(255, 251, 208, 0.14);
    border-radius: 0;
    background: transparent;
    color: var(--cream);
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 8.4vw, 2.5rem);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1;
    text-transform: uppercase;
    counter-increment: nav-item;
    opacity: 0;
    transform: translateY(10px);
    transition:
      color 180ms ease,
      opacity 360ms ease,
      transform 420ms cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .site-header .nav-links .nav-link::before {
    flex: 0 0 auto;
    min-width: 28px;
    color: var(--walnut);
    font-family: var(--font-body);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    content: counter(nav-item, decimal-leading-zero);
  }

  /* The active-section underline becomes a short river-blue bar under the label. */
  .site-header .nav-links .nav-link::after,
  .site-header .nav-links .nav-cta::after {
    top: auto;
    right: auto;
    bottom: 9px;
    left: 44px;
    width: 30px;
    height: 2px;
    transform-origin: left center;
  }

  .site-header .nav-links .nav-link.active {
    color: var(--walnut);
  }

  .site-header .nav-links .nav-link:focus-visible {
    outline: 2px solid var(--river-blue);
    outline-offset: -2px;
    box-shadow: none;
  }

  .site-header.is-menu-open .nav-links .nav-link {
    opacity: 1;
    transform: none;
  }

  .site-header.is-menu-open .nav-links .nav-link:nth-child(1) { transition-delay: 60ms; }
  .site-header.is-menu-open .nav-links .nav-link:nth-child(2) { transition-delay: 110ms; }
  .site-header.is-menu-open .nav-links .nav-link:nth-child(3) { transition-delay: 160ms; }
  .site-header.is-menu-open .nav-links .nav-link:nth-child(4) { transition-delay: 210ms; }
  .site-header.is-menu-open .nav-links .nav-link:nth-child(5) { transition-delay: 260ms; }
}

@media (max-width: 780px) and (hover: hover) {
  .nav-toggle:hover {
    color: var(--walnut);
  }

  .site-header .nav-links .nav-link:hover {
    color: var(--walnut);
  }

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

@media (max-width: 360px) {
  .navbar.container {
    width: calc(100% - 28px);
  }

  .navbar {
    min-height: 56px;
  }

  .brand-logo {
    height: 44px;
  }

  .nav-links {
    padding: 22px 14px 28px;
  }
}

@media (max-width: 780px) and (prefers-reduced-motion: reduce) {
  .nav-toggle,
  .nav-toggle-bar,
  .nav-toggle-bar::before,
  .nav-toggle-bar::after,
  .nav-links,
  .site-header.is-menu-open .nav-links,
  .site-header .nav-links .nav-link,
  .site-header .nav-links .nav-cta,
  .site-header.is-menu-open .nav-links .nav-link {
    transition: none;
    transition-delay: 0s;
  }
}
