/* -----------------------------------------
   Core Design Philosophy & Aesthetics
----------------------------------------- */
:root {
  --primary-navy: #0F1E36;
  --accent-gold: #C5A880;
  --bg-offwhite: #F8F9FA;
  --text-charcoal: #2D3748;
  --font-heading: 'Cormorant Garamond', serif;
  --font-body: 'Inter', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
  font-family: var(--font-body);
  color: var(--text-charcoal);
  background-color: var(--bg-offwhite);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary-navy);
}

/* -----------------------------------------
   Global Elements
----------------------------------------- */


/* Typography & Links */
a {
  color: var(--primary-navy);
  text-decoration: none;
  transition: var(--transition-smooth);
}

a:hover {
  color: var(--accent-gold);
}

/* Navigation Bar */
.navbar {
  background-color: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: var(--transition-smooth);
  padding: 15px 0;
}

.navbar-brand {
  font-size: 1.8rem;
  color: var(--primary-navy) !important;
}

.navbar-brand span {
  color: var(--accent-gold);
}

.nav-link {
  font-weight: 500;
  color: var(--text-charcoal) !important;
  margin: 0 10px;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 50%;
  background-color: var(--accent-gold);
  transition: var(--transition-smooth);
  transform: translateX(-50%);
}

.nav-link:hover::after, .nav-link.active::after {
  width: 100%;
}

.navbar-toggler {
  border: none;
}
.navbar-toggler:focus {
  box-shadow: 0 0 0 2px var(--accent-gold);
}

/* Buttons */
.btn-primary, .bg-primary {
  background-color: var(--primary-navy) !important;
  border-color: var(--primary-navy) !important;
}

.btn-primary:hover {
  background-color: var(--accent-gold) !important;
  border-color: var(--accent-gold) !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.btn-secondary {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #fff;
  border-radius: 8px;
  padding: 12px 28px;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background-color: var(--primary-navy);
  border-color: var(--primary-navy);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.btn-outline-primary {
  color: var(--primary-navy);
  border-color: var(--primary-navy);
  transition: var(--transition-smooth);
}
.btn-outline-primary:hover {
  background-color: var(--primary-navy);
  border-color: var(--primary-navy);
  color: #fff;
}
.btn-outline-secondary {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  transition: var(--transition-smooth);
}
.btn-outline-secondary:hover {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #fff;
}

.text-primary {
  color: var(--primary-navy) !important;
}
.text-secondary {
  color: var(--accent-gold) !important;
}
.bg-secondary {
  background-color: var(--accent-gold) !important;
}

/* -----------------------------------------
   Hero Section
----------------------------------------- */
.hero-carousel {
  height: 85vh;
  min-height: 550px;
}

.hero-carousel .carousel-inner, 
.hero-carousel .carousel-item {
  height: 100%;
}

.hero-carousel .carousel-item img {
  object-fit: cover;
  height: 100%;
  width: 100%;
}

.carousel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(15, 30, 54, 0.4), rgba(15, 30, 54, 0.75));
}

.carousel-caption {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  text-align: center;
}

.carousel-caption h1 {
  color: #fff;
  font-size: 4rem;
  font-weight: 700;
  text-shadow: 0px 4px 15px rgba(0,0,0,0.4);
  margin-bottom: 20px;
}

.carousel-caption p {
  font-size: 1.25rem;
  font-family: var(--font-body);
  color: #F8F9FA;
  margin-bottom: 35px;
  font-weight: 400;
}

/* -----------------------------------------
   Quick Stats Bar (Floating)
----------------------------------------- */
.stats-bar {
  margin-top: -60px;
  position: relative;
  z-index: 10;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 15px 35px rgba(15, 30, 54, 0.08);
  border: 1px solid rgba(0,0,0,0.03);
  padding: 30px 20px;
}

.stat-item {
  text-align: center;
  position: relative;
}

.stat-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 15%;
  height: 70%;
  width: 1px;
  background-color: rgba(197, 168, 128, 0.3);
}

@media (max-width: 767px) {
  .stats-bar {
    margin-top: -20px; /* Reduced negative margin to avoid overlap on mobile */
    margin-bottom: 20px;
  }
  .stat-item:not(:last-child)::after {
    display: none;
  }
  .stat-item {
    padding: 15px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
  }
  .stat-item:last-child {
    border-bottom: none;
  }
}

.stat-item i {
  font-size: 2.2rem;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--primary-navy);
  margin-bottom: 5px;
  line-height: 1;
}

.stat-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-charcoal);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* -----------------------------------------
   Head of School (Portrait Wrapper)
----------------------------------------- */
.portrait-wrapper {
  position: relative;
  display: inline-block;
  margin-right: 20px;
  margin-top: 20px;
}

.portrait-wrapper::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid var(--accent-gold);
  top: -15px;
  left: 15px;
  z-index: -1;
  border-radius: 4px;
}

.portrait-wrapper img {
  border-radius: 4px;
  width: 100%;
  height: auto;
}

.signature {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  font-style: italic;
  color: var(--primary-navy);
}

/* -----------------------------------------
   Cards & UI Elements
----------------------------------------- */
.card-hover {
  border: none;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.04);
  transition: var(--transition-smooth);
}

.card-hover:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(15, 30, 54, 0.1);
}

.card-img-top {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  height: 250px;
  object-fit: cover;
}

/* Focus Overrides */
.accordion-button:focus, .nav-link:focus, .form-control:focus, .form-select:focus, .btn:focus {
  box-shadow: 0 0 0 3px rgba(197, 168, 128, 0.4) !important;
  border-color: var(--accent-gold) !important;
}

.accordion-button:not(.collapsed) {
  color: var(--primary-navy);
  background-color: rgba(197, 168, 128, 0.1);
}

.accordion-button::after {
  filter: contrast(0.5);
}

/* -----------------------------------------
   About Section & Timeline
----------------------------------------- */
.blockquote-custom {
  position: relative;
  font-size: 1.7rem;
  font-style: italic;
  font-family: var(--font-heading);
  padding: 30px 50px;
  border-left: 5px solid var(--accent-gold);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  margin: 40px 0;
  color: var(--primary-navy);
}

/* Alternating Timeline */
.timeline-modern {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
}

.timeline-modern::after {
  content: '';
  position: absolute;
  width: 2px;
  background-color: var(--accent-gold);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -1px;
}

.timeline-item {
  padding: 20px 40px;
  position: relative;
  background-color: inherit;
  width: 50%;
}

.timeline-item::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  right: -10px;
  background-color: white;
  border: 4px solid var(--accent-gold);
  top: 30px;
  border-radius: 50%;
  z-index: 1;
}

.timeline-left {
  left: 0;
}

.timeline-right {
  left: 50%;
}

.timeline-right::after {
  left: -10px;
}

.timeline-content {
  padding: 30px;
  background-color: white;
  position: relative;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

@media screen and (max-width: 768px) {
  .timeline-modern::after {
    left: 31px;
  }
  .timeline-item {
    width: 100%;
    padding-left: 70px;
    padding-right: 25px;
  }
  .timeline-item::after {
    left: 21px;
  }
  .timeline-right {
    left: 0%;
  }
}

/* -----------------------------------------
   Scroll Animations
----------------------------------------- */
.fade-in-section {
  opacity: 0;
  transform: translateY(30px);
  visibility: hidden;
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  will-change: opacity, visibility;
}

.fade-in-section.is-visible {
  opacity: 1;
  transform: none;
  visibility: visible;
}

/* -----------------------------------------
   Footer
----------------------------------------- */
footer {
  background-color: var(--primary-navy);
  color: rgba(255, 255, 255, 0.7);
  padding: 70px 0 30px;
  margin-top: 80px;
}

/* Ensure footer text and links don't wrap awkwardly on small screens */
@media (max-width: 576px) {
  footer .navbar-brand {
    font-size: 1.5rem;
  }
  footer p, footer li {
    font-size: 0.9rem;
  }
}

footer h5 {
  color: #fff;
  margin-bottom: 25px;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 1rem;
}

footer a {
  color: rgba(255, 255, 255, 0.7);
}

footer a:hover {
  color: var(--accent-gold);
}

.social-icons a {
  display: inline-block;
  margin-right: 15px;
  font-size: 1.2rem;
  background: rgba(255,255,255,0.1);
  width: 45px;
  height: 45px;
  line-height: 45px;
  text-align: center;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.social-icons a:hover {
  background: var(--accent-gold);
  color: #fff;
  transform: translateY(-3px);
}

/* Academics Masonry */
.masonry-gallery {
  column-count: 3;
  column-gap: 20px;
}
.masonry-item {
  break-inside: avoid;
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.masonry-item img {
  width: 100%;
  height: auto;
  transition: transform 0.4s ease;
  display: block;
}
.masonry-item:hover img {
  transform: scale(1.05);
}
@media (max-width: 768px) {
  .masonry-gallery { column-count: 2; }
}
@media (max-width: 576px) {
  .masonry-gallery { column-count: 1; }
}

/* Tables */
.table-custom thead {
  background-color: var(--primary-navy);
  color: white;
}
.table-custom tbody tr:hover {
  background-color: rgba(197, 168, 128, 0.05);
}

/* Form Validation Customization */
.was-validated .form-control:valid, .form-control.is-valid {
  border-color: var(--accent-gold);
  background-image: none; /* Remove default green tick */
}
.was-validated .form-control:invalid, .form-control.is-invalid {
  border-color: #e63946;
}
