/* ==========================================================================
   Header, Footer, Nav
   ========================================================================== */

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-4) 0;
  background: transparent;
  transition: background var(--dur-base) var(--ease-in-out),
              box-shadow var(--dur-base) var(--ease-in-out),
              padding var(--dur-base) var(--ease-in-out);
}

.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  padding: var(--space-3) 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  transition: opacity var(--dur-fast);
}

.brand-mark:hover {
  opacity: 0.75;
  color: inherit;
}

.brand-mark img {
  height: 88px;
  width: auto;
  display: block;
}

.site-header.is-scrolled .brand-mark img {
  height: 64px;
}

@media (max-width: 700px) {
  .brand-mark img {
    height: 60px;
  }
  .site-header.is-scrolled .brand-mark img {
    height: 50px;
  }
}

/* Splash header — white text overlay */
.site-header.on-splash:not(.is-scrolled) {
  color: white;
}
.site-header.on-splash:not(.is-scrolled) .brand-mark {
  color: white;
}
.site-header.on-splash:not(.is-scrolled) .nav-list a {
  color: white;
}

/* Nav */
.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-list a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  padding: var(--space-2) 0;
  position: relative;
  transition: color var(--dur-fast);
}

.nav-list a:hover {
  color: var(--brand-primary);
}

.nav-list a[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--brand-primary);
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: inherit;
  cursor: pointer;
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  min-width: 240px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast), transform var(--dur-fast);
  list-style: none;
  margin: 0;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-menu li {
  margin: 0;
}

.nav-dropdown-menu a {
  display: block;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--text-primary) !important;
  font-size: var(--text-sm);
}

.nav-dropdown-menu a:hover {
  background: var(--background-warm);
  color: var(--brand-primary) !important;
}

/* Mobile nav */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
  color: inherit;
}

.mobile-nav-toggle svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.mobile-nav {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 200;
  padding: var(--space-16) var(--space-6);
  transform: translateX(100%);
  transition: transform var(--dur-base) var(--ease-out-quart);
  overflow-y: auto;
}

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

.mobile-nav-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
}

.mobile-nav-close svg {
  width: 24px;
  height: 24px;
}

.mobile-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav li {
  margin-bottom: var(--space-4);
}

.mobile-nav a {
  display: block;
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-primary);
  padding: var(--space-3) 0;
  text-decoration: none;
}

.mobile-nav .mobile-sublist {
  margin-top: var(--space-3);
  padding-left: var(--space-4);
  border-left: 2px solid var(--border-subtle);
}

.mobile-nav .mobile-sublist a {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .nav-list {
    display: none;
  }
  .mobile-nav-toggle {
    display: block;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--brand-deep);
  color: rgba(255, 255, 255, 0.85);
  padding: var(--space-20) 0 var(--space-8);
  margin-top: var(--space-24);
}

.site-footer a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: color var(--dur-fast);
}

.site-footer a:hover {
  color: white;
}

.footer-grid {
  display: grid;
  gap: var(--space-12);
  grid-template-columns: 1.4fr 1fr 1fr;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
}

.footer-col h4 {
  color: white;
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-4);
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: var(--space-2);
}

.footer-brand {
  margin-bottom: var(--space-6);
}

.footer-brand img {
  height: 90px;
  width: auto;
  filter: brightness(0) invert(1);
  margin-bottom: var(--space-4);
}

.footer-brand .tagline {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: var(--space-2);
  max-width: 30ch;
}

.footer-brand .location {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.05em;
}

.footer-bottom {
  margin-top: var(--space-16);
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.55);
}

/* Wavy page — dark hero header treatment */
.site-header.on-dark:not(.is-scrolled) {
  color: white;
}
.site-header.on-dark:not(.is-scrolled) .brand-mark,
.site-header.on-dark:not(.is-scrolled) .nav-list a,
.site-header.on-dark:not(.is-scrolled) .nav-dropdown-trigger,
.site-header.on-dark:not(.is-scrolled) .mobile-nav-toggle {
  color: white;
}
/* White wordmark on dark hero until the header gets its light background */
.site-header.on-dark:not(.is-scrolled) .brand-mark img {
  filter: brightness(0) invert(1);
}
/* When on-dark header scrolls to opaque state, restore normal dark logo */
.site-header.on-dark.is-scrolled .brand-mark img {
  content: url('../images/changing-tides-logo-black.png');
}
