/* ── Site Nav ─────────────────────────────────────────────── */
/* Deep hull blue rather than the page's off-white: the hero behind it is a
   photograph, and a light bar dissolved into the sky. Solid from the first
   pixel (no scroll-linked transparency) so the links never sit on an
   unpredictable ground. */
.site-nav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 100;
  background: var(--deep);
  border-bottom: 1px solid color-mix(in oklch, var(--white) 12%, transparent);
  box-shadow: 0 1px 16px color-mix(in oklch, var(--deep-dark) 30%, transparent);
  /* Edge-to-edge: keep the links below the status bar while the background
     extends under it. 0 in a normal browser. */
  padding-top: env(safe-area-inset-top, 0px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin-inline: auto;
  padding: var(--space-4) var(--space-6);
}

/* On the dark bar the mark goes warm-white and the bolt lightens, so the
   accent stays legible instead of muddying into the navy. */
.nav-brand {
  font-size: 1.25rem;
  color: var(--white);
  --bm-bolt: var(--solar);
  --bm-sub: color-mix(in oklch, var(--solar) 82%, var(--white));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-links a {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in oklch, var(--white) 78%, transparent);
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--white);
}

.nav-quote-btn {
  background: var(--accent) !important;
  color: var(--deep-dark) !important;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  transition: background 0.15s !important;
}

.nav-quote-btn:hover {
  background: var(--accent-dark) !important;
  color: var(--white) !important;
}

/* The phone number is the highest-intent action on a tradesman's site — on a
   phone it is one tap to a call — so it keeps a seat in the bar beside the
   quote pill and never collapses into the drawer. */
.nav-call {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Mobile nav drawer ───────────────────────────────────────────────────
   Hamburger + slide-in drawer holding the links the bar collapses on phones.
   Markup: siteDrawer in home/page.templ; behaviour: nav-drawer.js. The
   drawer is a SIBLING of the fixed bar, not a child: as a child, its backdrop
   would paint over the bar's own background and dim it — as a sibling the
   open state can lift the whole bar (with the morphed ×) above the backdrop. */
.nav-burger {
  display: none; /* → inline-flex in the mobile media query */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--radius-sm);
  color: var(--white);
  -webkit-tap-highlight-color: transparent;
}

.nav-burger:active {
  background: color-mix(in oklch, var(--white) 14%, transparent);
}

.nav-burger:focus-visible {
  outline: 2px solid var(--solar);
  outline-offset: 2px;
}

.nav-burger-bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s var(--ease-out), opacity 0.2s var(--ease-out);
}

/* Hamburger → × morph (the middle bar fades, the outer two cross). */
html.nav-drawer-open .nav-burger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

html.nav-drawer-open .nav-burger-bar:nth-child(2) {
  opacity: 0;
}

html.nav-drawer-open .nav-burger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-drawer-root {
  display: none; /* → block in the mobile media query */
}

.nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: oklch(20% 0.05 250 / 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s var(--ease-out), visibility 0s linear 0.28s;
}

.nav-drawer-root.is-open .nav-drawer-backdrop {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.28s var(--ease-out);
}

.nav-drawer {
  position: fixed;
  /* Sits below the fixed bar, which the open state lifts above the backdrop so
     the morphed × stays visible and tappable. 76px = the mobile bar
     (16px padding + 44px burger row + 16px padding) + status-bar inset. */
  top: calc(76px + env(safe-area-inset-top, 0px));
  right: 0;
  bottom: 0;
  z-index: 120;
  width: min(320px, 85vw);
  display: flex;
  flex-direction: column;
  background: var(--off-white);
  color: var(--ocean-deep);
  box-shadow: -12px 0 40px color-mix(in oklch, var(--deep-dark) 30%, transparent);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.28s var(--ease-out), visibility 0s linear 0.28s;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-drawer-root.is-open .nav-drawer {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.28s var(--ease-out);
}

.nav-drawer-items {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: var(--space-2) 0;
}

/* Items keep the bar links' identity (condensed uppercase display face) so the
   drawer reads as the same nav, just unfolded. */
.nav-drawer-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 48px;
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ocean-mid);
  transition: background 0.12s, color 0.12s;
}

.nav-drawer-item iconify-icon {
  color: var(--solar-dark);
}

.nav-drawer-item:hover {
  background: var(--sand-200);
  color: var(--ocean-deep);
}

.nav-drawer-item:focus-visible {
  outline: 2px solid var(--deep);
  outline-offset: -2px;
}

/* The call link anchors the drawer bottom, separated by a hairline — the one
   action worth a permanent seat once the links are unfolded. */
.nav-drawer-foot {
  border-top: 1px solid var(--border);
  padding: var(--space-2) 0;
}

/* Body scroll locks while the drawer is open; the bar rises above the backdrop
   so the × stays reachable (nav-drawer.js toggles the class). */
html.nav-drawer-open body {
  overflow: hidden;
}

html.nav-drawer-open .site-nav {
  z-index: 130;
}

@media (prefers-reduced-motion: reduce) {
  /* Drawer + burger morph go instant; the open/close state change is the only
     feedback reduced-motion users need. */
  .nav-drawer,
  .nav-drawer-backdrop,
  .nav-burger-bar {
    transition-duration: 0.01ms;
    transition-delay: 0s;
  }
}

@media (max-width: 860px) {
  /* Section anchors collapse into the drawer; the call link and the quote pill
     keep their seats — they are the site's two conversion actions. The burger
     is a <button>, so the anchor selector leaves it alone. */
  .nav-links a:not(.nav-quote-btn):not(.nav-call) {
    display: none;
  }

  .nav-burger {
    display: inline-flex;
  }

  .nav-drawer-root {
    display: block;
  }

  .nav-inner {
    padding-inline: var(--space-4);
  }
  .nav-links {
    gap: var(--space-4);
  }
  .nav-links a {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

@media (max-width: 560px) {
  /* Brand + call + pill + burger still brush the edges of a 390px row after the
     ≤860 tightening. Drop the call link's text to its icon and shrink the
     rhythm one more notch rather than letting the pill get pushed off-screen. */
  .nav-inner {
    padding-inline: var(--space-3);
  }
  .nav-links {
    gap: var(--space-3);
  }
  .nav-links a {
    font-size: 0.82rem;
  }
  .nav-call span {
    display: none;
  }
  .nav-quote-btn {
    padding: var(--space-2) var(--space-3);
  }
  .nav-brand {
    font-size: 1.05rem;
  }
}

@media (max-width: 400px) {
  /* Last resort on the narrowest phones: the wordmark's subtitle line goes,
     leaving the mark and "SIARGAO POWER & SOLAR" on one line. */
  .nav-brand .brand-word span {
    display: none;
  }
}
