/* ==========================================================================
   ST. PETER CHRISTIAN SCHOOL — NAVIGATION STYLES
   Clean, modern, mobile-first with elegant desktop polish
   ========================================================================== */

/* ── CSS Custom Properties (fallbacks if theme vars missing) ─────────── */
:root {
  --sp-burgundy:      var(--color-burgundy, #7B1F3A);
  --sp-burgundy-dark: #5E1730;
  --sp-gold:          var(--color-gold, #C9A227);
  --sp-gold-light:    #E0BC3F;
  --sp-cream:         var(--color-cream, #FDF8F0);
  --sp-cream-dark:    #F0E6D3;
  --sp-white:         #FFFFFF;
  --sp-text-dark:     var(--color-text-dark, #1A1A1A);
  --sp-text-medium:   var(--color-text-medium, #4A4A4A);
  --sp-text-light:    var(--color-text-light, #888888);

  --shadow-soft:      0 2px 12px rgba(0,0,0,0.06);
  --shadow-medium:    0 8px 30px rgba(0,0,0,0.08);
  --shadow-strong:    0 12px 40px rgba(0,0,0,0.12);
  --radius-card:      12px;
  --radius-pill:      9999px;
  --radius-btn:       10px;

  --font-display:     var(--font-display, 'Georgia', serif);
  --font-body:        var(--font-body, 'Inter', -apple-system, sans-serif);

  --nav-height:       6rem;
  --mobile-bar-h:     44px;
}

/* ── Sticky Site Header Wrapper ───────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* ── Navbar (no longer sticky itself — wrapper handles it) ────────── */
.navbar {
  background: var(--sp-white);
  box-shadow: var(--shadow-soft);
  padding: 0 5%;
  transition: box-shadow 0.3s ease;
}

.navbar.scrolled {
  box-shadow: var(--shadow-medium);
}

/* ── Top Bar Navigation ───────────────────────────────────────────── */
.top-bar-nav {
  background: var(--sp-burgundy);
  color: #fff;
  font-size: 0.8125rem;
  padding: 0.5rem 5%;
}

.top-bar-nav-inner {
  max-width: 75rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.5rem;
}

.top-bar-links li {
  margin-bottom: 0 !important;
}

.top-bar-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.top-bar-links a:hover {
  color: #fff;
}

.top-bar-phone {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.top-bar-phone svg {
  flex-shrink: 0;
}

/* ── Mobile Top Bar ───────────────────────────────────────────────── */
.mobile-top-bar {
  display: none;
  background: var(--sp-burgundy);
  padding: 0 5%;
  height: var(--mobile-bar-h);
}

.mobile-top-bar-inner {
  max-width: 75rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  height: 100%;
}

.mobile-top-bar-phone {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: rgba(255,255,255,0.95);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}

.mobile-top-bar-phone:hover {
  opacity: 0.85;
}

.mobile-top-bar-phone svg {
  flex-shrink: 0;
}

/* Mobile CTA — pill style, eye-catching */
.mobile-top-bar-cta {
  display: inline-flex;
  align-items: center;
  background: var(--sp-gold);
  color: var(--sp-text-dark);
  padding: 0.375rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(201,162,39,0.35);
}

.mobile-top-bar-cta:hover {
  background: var(--sp-gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(201,162,39,0.45);
}

/* ── Navbar ──────────────────────────────────────────────────────────── */
.navbar {
  background: var(--sp-white);
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0 5%;
  transition: box-shadow 0.3s ease;
}

.navbar.scrolled {
  box-shadow: var(--shadow-medium);
}

.nav-container {
  max-width: 75rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--nav-height);
  gap: 1.5rem;
}

/* ── Logo ────────────────────────────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
  z-index: 2;
}

.logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--sp-burgundy);
  color: var(--sp-white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.logo:hover .logo-icon {
  transform: scale(1.05);
}

.logo-text {
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--sp-text-dark);
  line-height: 1.2;
}

.logo-text span {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--sp-text-light);
  letter-spacing: 0.02em;
}

/* Custom logo image */
.custom-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.custom-logo {
  max-height: 75px;
  width: auto;
  display: block;
}

/* ── Desktop Nav Links ─────────────────────────────────────────────── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  justify-content: center;
}

.nav-links > li {
  position: relative;
  margin-bottom: 0;
  display: flex; align-items: center; align-self: center;
}

.nav-links > li > a {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--sp-text-dark);
  text-decoration: none;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.nav-links > li > a:hover,
.nav-links > li > a:focus {
  background-color: var(--sp-cream);
  color: var(--sp-burgundy);
  outline: none;
}

/* Active/current page */
.nav-links > li.current-menu-item > a,
.nav-links > li.current-menu-parent > a {
  color: var(--sp-burgundy);
  font-weight: 600;
}

/* Dropdown arrow */
.nav-links > li.menu-item-has-children > a::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  margin-left: 0.25rem;
  opacity: 0.5;
  transition: transform 0.25s ease, opacity 0.2s;
}

.nav-links > li.menu-item-has-children:hover > a::after,
.nav-links > li.menu-item-has-children > a[aria-expanded="true"]::after {
  transform: rotate(180deg);
  opacity: 0.8;
}

/* ── Dropdown Menus ────────────────────────────────────────────────── */
.nav-links .sub-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%) translateY(-0.5rem);
  min-width: 14rem;
  background: var(--sp-white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-medium);
  padding: 0.5rem;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  z-index: 100;
}

/* Dropdown caret arrow */
.nav-links .sub-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: var(--sp-white);
  box-shadow: -2px -2px 4px rgba(0,0,0,0.04);
}

.nav-links > li:hover > .sub-menu,
.nav-links > li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-links .sub-menu li {
  margin-bottom: 0;
}

.nav-links .sub-menu a {
  display: block;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sp-text-dark);
  text-decoration: none;
  border-radius: 0.5rem;
  transition: background-color 0.15s ease, color 0.15s ease, padding-left 0.2s;
}

.nav-links .sub-menu a:hover,
.nav-links .sub-menu a:focus {
  background-color: var(--sp-cream);
  color: var(--sp-burgundy);
  padding-left: 1.125rem;
  outline: none;
}

/* ── Desktop CTA Group (catchy buttons) ────────────────────────────── */
.nav-cta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Phone button — subtle but clickable */
.nav-cta-phone {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sp-text-medium);
  text-decoration: none;
  border-radius: var(--radius-btn);
  border: 1.5px solid var(--sp-cream-dark);
  background: var(--sp-white);
  transition: all 0.25s ease;
  white-space: nowrap;
}

.nav-cta-phone svg {
  color: var(--sp-burgundy);
  transition: transform 0.25s ease;
}

.nav-cta-phone:hover {
  border-color: var(--sp-burgundy);
  color: var(--sp-burgundy);
  background: var(--sp-cream);
}

.nav-cta-phone:hover svg {
  transform: rotate(12deg);
}

/* Tour button — PRIMARY, eye-catching CTA */
.nav-cta-tour {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--sp-text-dark);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: var(--radius-btn);
  background: var(--sp-gold);
  border: 2px solid var(--sp-gold);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(201,162,39,0.3);
}

.nav-cta-tour::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--sp-gold-light);
  transform: translateX(-101%);
  transition: transform 0.35s ease;
}

.nav-cta-tour span,
.nav-cta-tour svg {
  position: relative;
  z-index: 1;
}

.nav-cta-tour svg {
  transition: transform 0.3s ease;
}

.nav-cta-tour:hover {
  border-color: var(--sp-gold-light);
  box-shadow: 0 6px 24px rgba(201,162,39,0.45);
  transform: translateY(-2px);
}

.nav-cta-tour:hover::before {
  transform: translateX(0);
}

.nav-cta-tour:hover svg {
  transform: translateX(3px);
}

.nav-cta-tour:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(201,162,39,0.3);
}

.mobile-top-bar-phone {
  display: none;
}

.mobile-top-bar-cta {
  display: none;
}

/* ── Mobile Menu Toggle ─────────────────────────────────────────────── */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 2.75rem;
  height: 2.75rem;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  border-radius: 0.5rem;
  transition: background-color 0.2s;
}

.menu-toggle:hover {
  background-color: var(--sp-cream);
}

.menu-toggle span {
  display: block;
  width: 1.5rem;
  height: 2.5px;
  background-color: var(--sp-text-dark);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.2s;
}

.menu-toggle.active span {
  background-color: var(--sp-burgundy);
}

/* Hamburger → X animation */
.menu-toggle.active span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* ── MOBILE STYLES (max-width: 1024px) ────────────────────────────── */
@media (max-width: 1024px) {
  
  .mobile-top-bar {
    display: block;
  }

  .mobile-top-bar-phone,
  .mobile-top-bar-cta {
    position: fixed;
    right: 16px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  /* Phone button - bottom */
  .mobile-top-bar-phone {
    bottom: 88px; /* 16px gap above CTA */
    background-color: var(--color-burgundy); /* Green - adjust to your brand */
    color: #ffffff;
  }

  /* CTA button - bottom-most */
  .mobile-top-bar-cta {
    bottom: 16px;
    background-color: var(--color-gold); /* Blue - adjust to your brand */
    color: #ffffff;
    font-size: 0; /* Hide text, show icon only */
  }

  /* Hover/active states */
  .mobile-top-bar-phone:active,
  .mobile-top-bar-cta:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  /* Icon sizing */
  .mobile-top-bar-phone svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
  }

  /* Hide the phone number text, keep icon */
  .mobile-top-bar-phone span {
    display: none;
  }

  /* Add a calendar icon to CTA via pseudo-element (optional) */
  .mobile-top-bar-cta::before {
    content: "📅";
    font-size: 24px;
  }

  .nav-container {
    height: calc(var(--nav-height) - 0.5rem);
  }

  /* Hide desktop CTA on mobile */
  .nav-cta {
    display: none !important;
  }

  .menu-toggle {
    display: flex;
  }

  /* Mobile nav overlay */
  .nav-links {
    position: fixed;
    /* top: calc(var(--nav-height) - 0.5rem + var(--mobile-bar-h)); */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--sp-white);
    flex-direction: column;
    align-items: stretch;
    padding: 5rem 5rem 0 2rem;
    gap: 0;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: var(--shadow-strong);
    z-index: 999;
    justify-content: flex-start;
  }

  .nav-links > li:hover > .sub-menu,
  .nav-links > li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .nav-links.active {
    transform: translateX(0);
  }

  /* Mobile nav items */
  .nav-links > li {
    width: 100%;
    border-bottom: 1px solid var(--sp-cream-dark);
    display: block;
  }

  .nav-links > li > a {
    padding: 1.125rem 3.25rem 1.125rem 0;
    font-size: 1.0625rem;
    font-weight: 600;
    width: 100%;
    justify-content: space-between;
    border-radius: 0;
  }

  .nav-links > li > a:hover {
    background: none;
    color: var(--sp-burgundy);
  }

  /* Remove desktop hover underline */
  .nav-links > li > a::after {
    display: none !important;
  }

  /* Submenu toggle button (chevron) */
  .submenu-toggle {
    position: absolute;
    right: -0.5rem;
    top: 0;
    width: 3.25rem;
    height: 3.25rem;
    display: flex;
    align-items: start;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 2;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
  }

  .submenu-toggle:hover {
    background-color: var(--sp-cream);
  }

  .submenu-toggle .chevron {
    width: 20px;
    height: 20px;
    color: var(--sp-text-light);
    transition: transform 0.3s ease, color 0.2s;
  }

  .nav-item.open .submenu-toggle .chevron {
    transform: rotate(180deg);
    color: var(--sp-burgundy);
  }

  /* Mobile dropdown */
  .nav-links .sub-menu {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    border-radius: 0;
    min-width: auto;
    display: none;
    background: var(--sp-cream);
    width: 100%;          
    margin: 0;            
    padding: 0.5rem 0;    
    transition: none;
  }

  .nav-links .sub-menu::before {
    display: none;
  }

  .nav-item.open > .sub-menu {
    display: block;
    animation: slideDown 0.25s ease;
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .nav-links .sub-menu a {
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    border-radius: 0.5rem;
  }

  /* Mobile CTA inside menu (if nav-cta is moved inside nav-links via JS) */
  .nav-links .nav-cta-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--sp-cream-dark);
  }

  .nav-links .nav-cta-mobile a {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

/* ── Accessibility: reduced motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Focus visible for keyboard navigation ──────────────────────────── */
.nav-links a:focus-visible,
.nav-cta-phone:focus-visible,
.nav-cta-tour:focus-visible,
.menu-toggle:focus-visible,
.submenu-toggle:focus-visible {
  outline: 2px solid var(--sp-burgundy);
  outline-offset: 2px;
}

/* ── Top Bar Navigation ─────────────────────────────────────────── */
.top-bar-nav {
  background: var(--sp-burgundy);
  color: #fff;
  font-size: 0.8125rem;
  padding: 0.5rem 1.5rem;
}

.top-bar-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.5rem;
}

.top-bar-links li {
  margin-bottom: 0 !important;
}

.top-bar-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.top-bar-links a:hover {
    color: #fff;
}

.top-bar-phone {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.top-bar-phone svg {
    flex-shrink: 0;
}

.top-bar-nav-cta {
  display: none;
}

/* Mobile: hide top bar nav, keep mobile top bar */
@media (max-width: 768px) {
  .top-bar-phone {
    display: none;
  }

  .top-bar-nav-cta {
    display: inline-flex;
    align-items: center;
    background: var(--sp-gold);
    color: var(--sp-text-dark);
    padding: 0.375rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 800;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(201,162,39,0.35);
  }
}

/* ── Secondary Navigation Bar ─────────────────────────────────────── */
.secondary-nav {
  background: var(--sp-cream);
  border-bottom: 1px solid var(--sp-cream-dark);
  padding: 0 5%;
  position: sticky;
  top: var(--header-height, auto); /* Will be set by JS */
  z-index: 999;
  display: flex;
}

.secondary-nav-inner {
  max-width: 75rem;
  margin: 0 auto;
}

.secondary-nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.secondary-nav-links::-webkit-scrollbar {
  display: none;
}

.secondary-nav-links li {
  margin-bottom: 0;
  flex-shrink: 0;
}

.secondary-nav-links a {
  display: block;
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sp-text-medium);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.secondary-nav-links a:hover {
  color: var(--sp-burgundy);
  background: rgba(123, 31, 58, 0.04);
}

.secondary-nav-links li.current-menu-item a {
  color: var(--sp-burgundy);
  font-weight: 600;
  border-bottom-color: var(--sp-burgundy);
  background: rgba(123, 31, 58, 0.06);
}

/* ── Mobile Secondary Nav ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .secondary-nav {
    top: var(--header-height-mobile, auto);
    padding: 0;
  }

  .secondary-nav-links a {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
  }
}

@media (max-width: 768px) {
  .secondary-nav {
    display: none; /* Hide on very small screens, use mobile menu instead */
  }
}