/* =====================================================================
   HEADER — Premium Glassmorphism Design
   Emeralds International School
   ===================================================================== */

/* ─── Keyframes ─────────────────────────────────────────────────────── */

@keyframes headerGoldShimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes navLinkFadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes dropdownReveal {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mobileSlideIn {
  from { clip-path: circle(0% at top right); }
  to   { clip-path: circle(150% at top right); }
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 168, 67, 0.45); }
  50%      { box-shadow: 0 0 0 10px rgba(212, 168, 67, 0); }
}

@keyframes hamburgerPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ─── Main Header ───────────────────────────────────────────────────── */

.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--navy-900, #0A192F);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25),
              0 1px 3px rgba(0, 0, 0, 0.12);
  transition: background 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              backdrop-filter 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gold accent line at the bottom — always visible on solid state */
.main-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--gold-500, #D4A843) 20%,
    var(--gold-300, #F0CC6B) 50%,
    var(--gold-500, #D4A843) 80%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: headerGoldShimmer 6s ease-in-out infinite;
  opacity: 1;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Homepage — Transparent at Top ─────────────────────────────────── */

body.home-page .main-header {
  background: linear-gradient(
    180deg,
    rgba(6, 15, 30, 0.55) 0%,
    rgba(6, 15, 30, 0.15) 100%
  );
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

body.home-page .main-header::after {
  opacity: 0;
}

/* ─── Scrolled / Sticky State ───────────────────────────────────────── */

.main-header.sticky,
body.home-page .main-header.sticky {
  background: rgba(10, 25, 47, 0.97);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(212, 168, 67, 0.12);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3),
              0 1px 3px rgba(0, 0, 0, 0.15);
}

.main-header.sticky::after,
body.home-page .main-header.sticky::after {
  opacity: 1;
}

/* ─── Container ─────────────────────────────────────────────────────── */

.main-header .container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 3rem);
}

/* ─── Header Content (Flexbox Row) ──────────────────────────────────── */

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  gap: 2rem;
  min-height: 72px;
}

/* ─── Logo ──────────────────────────────────────────────────────────── */

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  flex-shrink: 0;
  position: relative;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover {
  transform: scale(1.03);
}

.brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
  transition: filter 0.35s ease;
}

.main-header.sticky .brand-logo {
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.15));
}

.logo span {
  white-space: nowrap;
  font-family: var(--font-display, 'Playfair Display', serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--white, #FFFFFF) !important;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: text-shadow 0.35s ease, letter-spacing 0.35s ease;
}

.main-header.sticky .logo span {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  letter-spacing: 1px;
}

/* ─── Main Nav ──────────────────────────────────────────────────────── */

.main-nav {
  display: flex;
  align-items: center;
}

/* ─── Nav List ──────────────────────────────────────────────────────── */

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list > li {
  position: relative;
  white-space: nowrap;
}

/* ─── Nav Links ─────────────────────────────────────────────────────── */

.nav-list > li > a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.88) !important;
  font-family: var(--font-body, 'Poppins', sans-serif);
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: 0.3px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  border-radius: var(--r-sm, 8px);
  transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              text-shadow 0.3s ease;
}

.main-header.sticky .nav-list > li > a {
  text-shadow: none;
}

/* Underline animation — grows from center */
.nav-list > li > a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--gold-400, #E6B94A),
    var(--gold-300, #F0CC6B),
    var(--gold-400, #E6B94A)
  );
  border-radius: 2px;
  transform: translateX(-50%);
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hover & Active states */
.nav-list > li > a:hover,
.nav-list > li > a.active {
  color: var(--gold-400, #E6B94A) !important;
  background: rgba(212, 168, 67, 0.06);
}

.nav-list > li > a:hover::after,
.nav-list > li > a.active::after {
  width: 60%;
}

/* Dropdown chevron icon */
.nav-list > li > a i {
  font-size: 0.65rem;
  opacity: 0.7;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease;
}

.has-dropdown:hover > a i {
  transform: rotate(180deg);
  opacity: 1;
}

/* ─── Dropdown Menu ─────────────────────────────────────────────────── */

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px) scale(0.97);
  min-width: 240px;
  background: rgba(10, 25, 47, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(212, 168, 67, 0.15);
  border-radius: var(--r-md, 14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35),
              0 8px 24px rgba(0, 0, 0, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.06);
  list-style: none;
  padding: 0.5rem;
  padding-top: 12px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              visibility 0.35s;
}

/* Arrow pointer on dropdown */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: rgba(10, 25, 47, 0.92);
  border-top: 1px solid rgba(212, 168, 67, 0.15);
  border-left: 1px solid rgba(212, 168, 67, 0.15);
  border-radius: 2px 0 0 0;
}

/* Invisible bridge to prevent hover gap */
.has-dropdown::before {
  content: '';
  position: absolute;
  top: 100%;
  left: -10px;
  width: calc(100% + 20px);
  height: 25px;
  background: transparent;
}

.has-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.dropdown-menu li {
  border-radius: var(--r-sm, 8px);
  overflow: hidden;
}

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.7rem 1.1rem;
  color: rgba(255, 255, 255, 0.82) !important;
  font-family: var(--font-body, 'Poppins', sans-serif);
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
  text-shadow: none !important;
  border-radius: var(--r-sm, 8px);
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gold left-bar indicator on hover */
.dropdown-menu a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  background: linear-gradient(
    180deg,
    var(--gold-400, #E6B94A),
    var(--gold-500, #D4A843)
  );
  border-radius: 0 3px 3px 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dropdown-menu a:hover {
  background: rgba(212, 168, 67, 0.08);
  color: var(--gold-300, #F0CC6B) !important;
  padding-left: 1.4rem;
}

.dropdown-menu a:hover::before {
  transform: translateY(-50%) scaleY(1);
}

.dropdown-menu a.active {
  color: var(--gold-400, #E6B94A) !important;
  background: rgba(212, 168, 67, 0.1);
}

.dropdown-menu a.active::before {
  transform: translateY(-50%) scaleY(1);
}

/* ─── CTA Button ────────────────────────────────────────────────────── */

.cta-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  background: linear-gradient(
    135deg,
    var(--gold-500, #D4A843) 0%,
    var(--gold-400, #E6B94A) 50%,
    var(--gold-300, #F0CC6B) 100%
  ) !important;
  background-size: 200% 200%;
  color: var(--navy-950, #060F1E) !important;
  font-family: var(--font-body, 'Poppins', sans-serif);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: none !important;
  border: none;
  border-radius: var(--r-full, 9999px);
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 4px 15px rgba(212, 168, 67, 0.3),
              0 1px 3px rgba(0, 0, 0, 0.1),
              inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Shine sweep effect */
.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 100%
  );
  transform: skewX(-25deg);
  transition: left 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.cta-button:hover {
  background-position: right center !important;
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 30px rgba(212, 168, 67, 0.45),
              0 4px 12px rgba(0, 0, 0, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.cta-button:hover::before {
  left: 125%;
}

.cta-button:active {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 4px 15px rgba(212, 168, 67, 0.3),
              0 2px 6px rgba(0, 0, 0, 0.1);
}

/* ─── Mobile Menu Toggle (Hamburger) ────────────────────────────────── */

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-sm, 8px);
  cursor: pointer;
  padding: 10px;
  width: 44px;
  height: 44px;
  z-index: 1001;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.mobile-menu-toggle:hover {
  background: rgba(212, 168, 67, 0.1);
  border-color: rgba(212, 168, 67, 0.25);
}

.mobile-menu-toggle:active {
  animation: hamburgerPop 0.3s ease;
}

.mobile-menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white, #FFFFFF);
  border-radius: var(--r-full, 9999px);
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  transform-origin: center;
}

/* X animation when active */
.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
  background: var(--gold-400, #E6B94A);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
  background: var(--gold-400, #E6B94A);
}

/* =====================================================================
   RESPONSIVE — Tablet (≤ 1024px)
   ===================================================================== */

@media (max-width: 1024px) {

  .header-content {
    min-height: 68px;
    padding: 0;
    gap: 1rem;
  }

  .brand-logo {
    height: 40px;
  }

  .logo span {
    font-size: 12px;
    letter-spacing: 1px;
  }

  /* Hide desktop CTA, show hamburger */
  .cta-button {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  /* ─── Full-Screen Mobile Overlay ────────────────────────────────── */

  .main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(
      165deg,
      var(--navy-950, #060F1E) 0%,
      var(--navy-900, #0A192F) 40%,
      rgba(15, 36, 64, 0.98) 100%
    );
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    clip-path: circle(0% at calc(100% - 2.5rem) 2.1rem);
    transition: clip-path 0.65s cubic-bezier(0.68, -0.15, 0.27, 1.15),
                opacity 0.4s ease,
                visibility 0.4s ease;
  }

  .main-nav.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    clip-path: circle(150% at calc(100% - 2.5rem) 2.1rem);
  }

  /* Decorative gold accent circle on mobile menu */
  .main-nav::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 350px;
    height: 350px;
    background: radial-gradient(
      circle,
      rgba(212, 168, 67, 0.06) 0%,
      transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
  }

  /* Second decorative element */
  .main-nav::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 250px;
    height: 250px;
    background: radial-gradient(
      circle,
      rgba(212, 168, 67, 0.04) 0%,
      transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
  }

  /* ─── Mobile Nav List ───────────────────────────────────────────── */

  .nav-list {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 5rem 2rem 3rem;
    width: 100%;
    max-width: 380px;
  }

  .nav-list > li {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.35s ease, transform 0.35s ease;
  }

  /* Stagger animation for menu items */
  .main-nav.active .nav-list > li {
    opacity: 1;
    transform: translateY(0);
  }

  .main-nav.active .nav-list > li:nth-child(1) { transition-delay: 0.12s; }
  .main-nav.active .nav-list > li:nth-child(2) { transition-delay: 0.18s; }
  .main-nav.active .nav-list > li:nth-child(3) { transition-delay: 0.24s; }
  .main-nav.active .nav-list > li:nth-child(4) { transition-delay: 0.30s; }
  .main-nav.active .nav-list > li:nth-child(5) { transition-delay: 0.36s; }
  .main-nav.active .nav-list > li:nth-child(6) { transition-delay: 0.42s; }
  .main-nav.active .nav-list > li:nth-child(7) { transition-delay: 0.48s; }
  .main-nav.active .nav-list > li:nth-child(8) { transition-delay: 0.54s; }
  .main-nav.active .nav-list > li:nth-child(9) { transition-delay: 0.60s; }
  .main-nav.active .nav-list > li:nth-child(10) { transition-delay: 0.66s; }

  .nav-list > li:last-child {
    border-bottom: none;
  }

  .nav-list > li > a {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.8px;
    padding: 18px 10px;
    justify-content: center;
    width: 100%;
    text-shadow: none;
    border-radius: var(--r-sm, 8px);
  }

  .nav-list > li > a:hover,
  .nav-list > li > a.active {
    color: var(--gold-400, #E6B94A) !important;
    background: rgba(212, 168, 67, 0.06);
  }

  .nav-list > li > a::after {
    bottom: 10px;
  }

  /* Dropdown chevron on mobile — for toggle */
  .nav-list > li.has-dropdown > a::after {
    display: none;
  }

  .nav-list > li > a i {
    font-size: 0.7rem;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .has-dropdown.active > a i {
    transform: rotate(180deg);
  }

  /* ─── Mobile Dropdown ───────────────────────────────────────────── */

  .dropdown-menu {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    min-width: unset;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: var(--r-sm, 8px);
    box-shadow: none;
    padding: 0;
    margin: 0 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.35s ease;
  }

  .dropdown-menu::before {
    display: none;
  }

  .has-dropdown::before {
    display: none;
  }

  .has-dropdown.active .dropdown-menu {
    max-height: 600px;
    padding: 0.5rem 0;
  }

  .dropdown-menu a {
    color: rgba(255, 255, 255, 0.72) !important;
    font-size: 14px;
    padding: 0.65rem 1.2rem;
    justify-content: center;
    border-radius: var(--r-sm, 8px);
  }

  .dropdown-menu a:hover,
  .dropdown-menu a.active {
    color: var(--gold-400, #E6B94A) !important;
    background: rgba(212, 168, 67, 0.08);
    padding-left: 1.2rem;
  }

  .dropdown-menu a::before {
    display: none;
  }

  /* ─── Mobile CTA at bottom of nav ───────────────────────────────── */
  /* If you want a CTA visible in mobile, add it to the nav list in PHP.
     Otherwise, we add spacing at the bottom. */
}

/* =====================================================================
   RESPONSIVE — Mobile (≤ 768px)
   ===================================================================== */

@media (max-width: 768px) {

  .main-header .container {
    padding: 0 clamp(0.75rem, 4vw, 1.5rem);
  }

  .header-content {
    min-height: 62px;
    gap: 0.75rem;
  }

  .brand-logo {
    height: 36px;
  }

  .logo span {
    font-size: 11px;
    letter-spacing: 0.8px;
  }

  .nav-list {
    padding: 4.5rem 1.5rem 2.5rem;
    max-width: 320px;
  }

  .nav-list > li > a {
    font-size: 16px;
    padding: 16px 8px;
  }

  .dropdown-menu a {
    font-size: 13.5px;
    padding: 0.55rem 1rem;
  }
}

/* =====================================================================
   RESPONSIVE — Small Mobile (≤ 480px)
   ===================================================================== */

@media (max-width: 480px) {

  .main-header .container {
    padding: 0 0.75rem;
  }

  .header-content {
    min-height: 56px;
    gap: 0.5rem;
  }

  .brand-logo {
    height: 32px;
  }

  .logo {
    gap: 10px;
  }

  .logo span {
    font-size: 10px;
    letter-spacing: 0.5px;
  }

  .mobile-menu-toggle {
    width: 40px;
    height: 40px;
    padding: 8px;
  }

  .mobile-menu-toggle span {
    width: 20px;
  }

  .nav-list {
    padding: 4rem 1.25rem 2rem;
    max-width: 280px;
  }

  .nav-list > li > a {
    font-size: 15px;
    padding: 14px 6px;
    letter-spacing: 0.5px;
  }

  .dropdown-menu a {
    font-size: 13px;
    padding: 0.5rem 0.85rem;
  }
}

/* =====================================================================
   UTILITY — Reduced Motion
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {
  .main-header,
  .main-header::after,
  .nav-list > li > a,
  .nav-list > li > a::after,
  .nav-list > li > a i,
  .dropdown-menu,
  .dropdown-menu a,
  .dropdown-menu a::before,
  .cta-button,
  .cta-button::before,
  .mobile-menu-toggle span,
  .main-nav,
  .nav-list > li,
  .logo {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
  }

  .main-nav {
    clip-path: none !important;
  }

  .main-nav:not(.active) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .main-nav.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

/* =====================================================================
   UTILITY — Print
   ===================================================================== */

@media print {
  .main-header {
    position: static;
    background: #fff !important;
    box-shadow: none !important;
    border-bottom: 2px solid #0A192F;
  }

  .main-header::after,
  .mobile-menu-toggle,
  .cta-button {
    display: none !important;
  }

  .nav-list > li > a {
    color: #0A192F !important;
    text-shadow: none !important;
  }
}
