/* ============================================================
   nav.css — Site Navigation
   Pinion & Adams Fabricators
   ============================================================ */

/* ----------------------------------------
   Nav Wrapper
   ---------------------------------------- */

#site-nav {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  /* Wide enough to show all links at page load; consistent across every page */
  max-width: 1100px;
  z-index: var(--z-nav);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  transition:
    border-color 0.45s ease,
    box-shadow 0.45s ease,
    border-radius 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    max-width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Backdrop blur on pseudo-element — avoids Chrome bug where
   backdrop-filter on the same element breaks overflow:hidden */
#site-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(20, 28, 46, 0.18);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  transition: background 0.45s ease, backdrop-filter 0.45s ease;
  z-index: 0;
}

#site-nav.scrolled {
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.45);
  border-radius: 16px;
  max-width: 1280px;
}

/* ----------------------------------------
   Logo
   ---------------------------------------- */

#site-nav.scrolled::before {
  background: rgba(20, 28, 46, 0.82);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}

/* ----------------------------------------
   Nav Inner Layout
   ---------------------------------------- */

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 0.5rem 1.25rem;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* ----------------------------------------
   Logo
   ---------------------------------------- */

.nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.nav-logo img {
  height: 52px;
  width: auto;
  display: block;
  transition: opacity var(--transition-fast);
}

.nav-logo:hover img {
  opacity: 0.85;
}

/* ----------------------------------------
   Nav Links (Desktop)
   ---------------------------------------- */

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  list-style: none;
  flex: 0 0 auto;
  margin-left: auto;
  overflow: hidden;
}

/* ----------------------------------------
   All links visible at all times on desktop.
   data-compact attribute kept in HTML for mobile overlay but
   does not affect desktop visibility.
   ---------------------------------------- */

/* All desktop nav links always visible */
.nav-links li {
  display: block;
  opacity: 1;
}

.nav-links a {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  position: relative;
  padding: 0.35rem 0.48rem;
  border-radius: 100px;
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-links a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}


.nav-links a.is-active {
  color: #ffffff;
  background: var(--color-accent);
  box-shadow: 0 0 12px rgba(38, 157, 204, 0.45);
}

#site-nav.scrolled .nav-links a.is-active {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(38, 157, 204, 0.45);
}

/* ----------------------------------------
   Contact Link (standalone flex item in nav-inner)
   ---------------------------------------- */

.nav-contact-link {
  display: inline-flex;
  align-items: center;
  margin-top: -2px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 0.35rem 0.48rem;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-contact-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-contact-link.is-active {
  color: #ffffff;
  background-color: var(--color-accent);
  box-shadow: 0 0 12px rgba(38, 157, 204, 0.45);
}

/* ----------------------------------------
   CTA Wrap / Button
   ---------------------------------------- */

.nav-cta-wrap {
  display: none;
}

/* ----------------------------------------
   Theme Toggle
   ---------------------------------------- */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* Show sun in dark mode, moon in light mode */
[data-theme="dark"]  .theme-icon--moon { display: none; }
[data-theme="light"] .theme-icon--sun  { display: none; }
[data-theme="dark"]  .theme-icon--sun  { display: block; }
[data-theme="light"] .theme-icon--moon { display: block; }

/* Mobile overlay toggle */
.theme-toggle--mobile {
  width: auto;
  height: auto;
  border-radius: 100px;
  padding: 0.6rem 1.4rem;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 1.5rem;
}

.theme-toggle--mobile svg {
  width: 18px;
  height: 18px;
}

/* ----------------------------------------
   Hamburger Button (Mobile)
   ---------------------------------------- */

.nav-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: 0;
  position: relative;
  z-index: calc(var(--z-overlay) + 10);
  flex-shrink: 0;
  margin-left: auto;
}

.hamburger-bar {
  display: block;
  width: 24px;
  height: 2px;
  background: #ffffff;
  border-radius: 1px;
  transition: transform 0.35s ease, opacity 0.35s ease;
  transform-origin: center;
}

/* Island is always dark on scroll — bars stay white */
#site-nav.scrolled .hamburger-bar {
  background: #ffffff;
}

/* Morph to X when open */
.nav-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

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

/* ----------------------------------------
   Mobile Overlay
   ---------------------------------------- */

.nav-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 46, 0.98);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: var(--z-overlay);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
  overflow-y: auto;
  padding: 5rem 2rem;
}

.nav-mobile-overlay.is-open {
  transform: translateX(0);
}

.nav-mobile-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.5rem;
  line-height: 1;
  transition: color var(--transition-fast);
}

.nav-mobile-close:hover {
  color: #ffffff;
}

.nav-mobile-close svg {
  width: 28px;
  height: 28px;
  display: block;
}

/* ----------------------------------------
   Mobile Nav Links
   ---------------------------------------- */

.nav-mobile-links {
  list-style: none;
  text-align: center;
  margin-bottom: 2.5rem;
}

.nav-mobile-links li {
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.nav-mobile-links a {
  display: block;
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 5.2vh, 2.5rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 0.5rem 1rem;
  transform: translateY(30px);
  opacity: 0;
  /* delay applies only to the entrance (transform/opacity), never to hover colour */
  transition: color 0.12s ease, transform 0.4s ease var(--d, 0s), opacity 0.4s ease var(--d, 0s);
}

.nav-mobile-overlay.is-open .nav-mobile-links a { transform: translateY(0); opacity: 1; }
.nav-mobile-overlay.is-open .nav-mobile-links li:nth-child(1) a { --d: 0.09s; }
.nav-mobile-overlay.is-open .nav-mobile-links li:nth-child(2) a { --d: 0.13s; }
.nav-mobile-overlay.is-open .nav-mobile-links li:nth-child(3) a { --d: 0.17s; }
.nav-mobile-overlay.is-open .nav-mobile-links li:nth-child(4) a { --d: 0.21s; }
.nav-mobile-overlay.is-open .nav-mobile-links li:nth-child(5) a { --d: 0.25s; }
.nav-mobile-overlay.is-open .nav-mobile-links li:nth-child(6) a { --d: 0.29s; }
.nav-mobile-overlay.is-open .nav-mobile-links li:nth-child(7) a { --d: 0.33s; }
.nav-mobile-overlay.is-open .nav-mobile-links li:nth-child(8) a { --d: 0.37s; }
.nav-mobile-overlay.is-open .nav-mobile-links li:nth-child(9) a { --d: 0.41s; }
.nav-mobile-overlay.is-open .nav-mobile-links li:nth-child(10) a { --d: 0.45s; }

.nav-mobile-links a:hover,
.nav-mobile-links a.is-active {
  color: var(--color-accent);
}

/* Mobile CTA */
.nav-mobile-overlay .btn {
  opacity: 0;
  transform: translateY(20px);
  transition: background 0.2s ease, opacity 0.4s ease 0.45s, transform 0.4s ease 0.45s;
}

.nav-mobile-overlay.is-open .btn {
  opacity: 1;
  transform: translateY(0);
}

/* ----------------------------------------
   Desktop show/hide
   ---------------------------------------- */

@media (min-width: 1101px) {
  .nav-hamburger { display: none; }
  .nav-mobile-overlay { display: none; }
}

@media (max-width: 1100px) {
  .nav-links { display: none; }
  .nav-cta-wrap { display: none; }
  .nav-contact-link { display: none; }
  .nav-hamburger { display: flex; }
}

/* ============================================================
   LIGHT NAV — keeps the dark-blue "FABRICATORS" wordmark legible
   ============================================================ */

#site-nav {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 6px 28px rgba(10, 20, 45, 0.22);
}

#site-nav::before {
  background: linear-gradient(135deg, rgba(226, 235, 247, 0.90), rgba(188, 206, 230, 0.90));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}

#site-nav.scrolled {
  border-color: rgba(26, 39, 68, 0.10);
  box-shadow: 0 8px 40px rgba(10, 20, 45, 0.30);
}

#site-nav.scrolled::before {
  background: linear-gradient(135deg, rgba(226, 235, 247, 0.97), rgba(188, 206, 230, 0.97));
}

.nav-links a,
.nav-contact-link {
  color: #1a2744;
  font-weight: 600;
}

.nav-links a:hover,
.nav-contact-link:hover {
  color: #205785;
  background: rgba(32, 87, 133, 0.10);
}

.nav-links a.is-active,
.nav-contact-link.is-active,
#site-nav.scrolled .nav-links a.is-active {
  color: #ffffff;
  background: var(--color-accent);
}

.theme-toggle {
  background: rgba(26, 39, 68, 0.06);
  border-color: rgba(26, 39, 68, 0.18);
  color: #1a2744;
}
.theme-toggle:hover { background: rgba(26, 39, 68, 0.12); color: #205785; }

.hamburger-bar,
#site-nav.scrolled .hamburger-bar { background: #1a2744; }
.nav-hamburger[aria-expanded="true"] .hamburger-bar { background: #ffffff; }
