:root {
  --header-h: 88px;
}

.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--header-h);
  padding: 0 clamp(1rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition:
    background var(--slow) var(--ease-out),
    border-color var(--slow) var(--ease-out),
    backdrop-filter var(--slow) var(--ease-out);
}

.header.scrolled {
  background: rgba(243, 240, 233, 0.92);
  backdrop-filter: blur(24px) saturate(1.2);
  border-bottom-color: rgba(13, 31, 18, 0.06);
}

.header.scrolled .logo-text { color: var(--forest-700); }
.header.scrolled .nav-desktop a { color: var(--stone); }
.header.scrolled .nav-desktop a:hover { color: var(--gold-600); background: none; }
.header.scrolled .phone-link { color: var(--forest-700); }
.header.scrolled .phone-link:hover { background: rgba(13,31,18,0.06); }

.header-inner {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

/* ==== Logo ==== */
.logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--white);
  display: flex;
  align-items: baseline;
  gap: 6px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.logo-text .accent-word {
  color: var(--gold-500);
  font-weight: 400;
  font-style: italic;
}

/* ==== Desktop nav ==== */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 2.5vw, 2.5rem);
  margin-left: auto;
}
.nav-desktop a {
  color: rgba(255,255,255,0.75);
  padding: 0;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  position: relative;
  white-space: nowrap;
  transition: color 0.4s;
}
.nav-desktop a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1px;
  background: var(--gold-500);
  transition: width 0.5s var(--ease-out);
}
.nav-desktop a:hover { color: var(--gold-500); background: none; }
.nav-desktop a:hover::after { width: 100%; }

/* ==== Right cluster ==== */
.header-cta {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1.5vw, 1.8rem);
  flex-shrink: 0;
}
.header-cta .btn-sm {
  padding: 0.7rem 1.8rem;
  border-radius: 0;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}

.phone-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background var(--fast);
}
.phone-link:hover { background: rgba(255,255,255,0.08); }
.hamburger {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--white);
  -webkit-tap-highlight-color: transparent;
  transition: color var(--slow) var(--ease-out);
}
.header.scrolled .hamburger { color: var(--forest-700); }

.hamburger:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
  border-radius: 8px;
}

.hamburger span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transform: translate(-50%, -50%);
  transition:
    transform 0.35s var(--ease-out),
    opacity 0.2s ease;
}
.hamburger span:nth-child(1) { transform: translate(-50%, calc(-50% - 7px)); }
.hamburger span:nth-child(2) { transform: translate(-50%, -50%); }
.hamburger span:nth-child(3) { transform: translate(-50%, calc(-50% + 7px)); }
.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translate(-50%, -50%) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: translate(-50%, -50%) scaleX(0.4);
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translate(-50%, -50%) rotate(-45deg);
}
.mobile-nav {
  display: none;
  position: fixed;
  top: calc(var(--header-h) + 8px);
  right: 12px;
  width: min(320px, calc(100vw - 24px));
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 999;

  background: var(--forest-900);
  border: 1px solid var(--line-on-forest-soft);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  padding: 10px;
}
.mobile-nav.active {
  display: block;
  animation: mobileNavIn 0.2s var(--ease-out);
}
@keyframes mobileNavIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ==== Mobile nav links ==== */
.mobile-nav a {
  position: relative;
  display: block;
  color: rgba(255,255,255,0.88);
  padding: 13px 14px;
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-display);
  font-weight: 600;
  transition: background var(--fast), color var(--fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav a:not(.btn):not(.phone-link)::after {
  content: '';
  position: absolute;
  left: 14px;
  bottom: 7px;
  height: 1px;
  width: 0;
  background: var(--gold-400);
  transition: width 0.35s var(--ease-out);
  pointer-events: none;
}
.mobile-nav a:not(.btn):not(.phone-link):is(:active, :focus-visible)::after {
  width: calc(100% - 28px);
}
@media (hover: hover) and (pointer: fine) {
  .mobile-nav a:not(.btn):not(.phone-link):hover::after {
    width: calc(100% - 28px);
  }
  .mobile-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: var(--gold-400);
  }
}
.mobile-nav a:is(:active, :focus-visible) {
  background: rgba(255,255,255,0.06);
  color: var(--gold-400);
}
.mobile-nav .btn {
  margin-top: 10px;
  width: 100%;
  text-align: center;
}
.mobile-nav .phone-link {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
}
html { scroll-padding-top: calc(var(--header-h) + 12px); }
@media (max-width: 1200px) {
  :root { --header-h: 80px; }
  .nav-desktop a { font-size: 0.75rem; }
}
@media (max-width: 1024px) {
  :root { --header-h: 72px; }
  .header-cta .phone-link { display: none; }
}
@media (max-width: 900px) {
  :root { --header-h: 64px; }

  .nav-desktop,
  .header-cta .btn-sm { display: none; }

  .header-cta { margin-left: auto; }

  .hamburger { display: flex; align-items: center; justify-content: center; }
}
@media (max-width: 480px) {
  :root { --header-h: 60px; }

  .logo { font-size: 1.35rem; }

  .mobile-nav {
    right: 10px;
    width: min(300px, calc(100vw - 20px));
    padding: 8px;
  }
  .mobile-nav a { padding: 12px 12px; font-size: 0.95rem; }
  .mobile-nav a:not(.btn):not(.phone-link)::after { left: 12px; }
  .mobile-nav a:not(.btn):not(.phone-link):is(:active, :focus-visible)::after {
    width: calc(100% - 24px);
  }
  @media (hover: hover) and (pointer: fine) {
    .mobile-nav a:not(.btn):not(.phone-link):hover::after {
      width: calc(100% - 24px);
    }
  }

  .hamburger { width: 40px; height: 40px; }
  .hamburger span { width: 22px; }
}
