/* ==========================================================================
   CSS Variables & Tokens
   ========================================================================== */
:root {
  /* Color Palette */
  --primary: #1B3A5C;
  --primary-light: #2A5F8F;
  --secondary: #C9A84C;
  --secondary-light: #DFC06A;
  --accent: #E8F0FE;
  
  --bg: #FFFFFF;
  --bg-alt: #F5F6FA;
  
  --text: #2D2D2D;
  --text-light: #6B7280;
  --white: #FFFFFF;
  --black: #000000;
  
  /* Typography */
  --font-heading: 'Merriweather', serif;
  --font-body: 'Inter', sans-serif;
  
  /* Layout & Spacing */
  --container-width: 1200px;
  --spacing-xs: 0.5rem;   /* 8px */
  --spacing-sm: 1rem;     /* 16px */
  --spacing-md: 2rem;     /* 32px */
  --spacing-lg: 4rem;     /* 64px */
  --spacing-xl: 6rem;     /* 96px */
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
  --header-glass: rgba(255, 255, 255, 0.95);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, svg, video {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover, a:focus {
  color: var(--primary-light);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: var(--spacing-sm);
  font-weight: 700;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: var(--spacing-md);
}

p:last-child {
  margin-bottom: 0;
}

.text-center { text-align: center; }
.text-light { color: var(--text-light); }
.text-white { color: var(--white); }

.section-title {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  position: relative;
  padding-bottom: var(--spacing-sm);
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background-color: var(--secondary);
}

.site-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

/* ==========================================================================
   Layout Utilities
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

.section {
  padding: var(--spacing-xl) 0;
}

.bg-light { background-color: var(--bg-alt); }
.bg-accent { background-color: var(--accent); }
.bg-primary { background-color: var(--primary); color: var(--white); }
.bg-primary h1, .bg-primary h2, .bg-primary h3, .bg-primary h4, .bg-primary p { color: var(--white); }
.bg-primary .section-title::after { background-color: var(--secondary); }

.grid {
  display: grid;
  gap: var(--spacing-md);
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.btn-primary {
  background-color: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background-color: var(--primary-light);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--bg);
}

.btn-secondary:hover {
  background-color: var(--secondary-light);
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary);
  color: var(--white);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background-color: var(--header-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: padding var(--transition-normal), box-shadow var(--transition-normal);
  padding: 1rem 0;
}

.site-header.scrolled {
  padding: 0.5rem 0;
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1001; /* Above mobile menu */
}

.logo-svg {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.main-nav ul {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.main-nav a {
  color: var(--text);
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
  white-space: nowrap; /* Prevent wrapping */
  font-size: 0.95rem;
}

.main-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--secondary);
  transition: width var(--transition-normal);
}

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

.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.menu-toggle span {
  display: block;
  width: 25px;
  height: 2px;
  background-color: var(--primary);
  margin-bottom: 5px;
  transition: all var(--transition-normal);
}

.menu-toggle span:last-child {
  margin-bottom: 0;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

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

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   Hero Sections
   ========================================================================== */
.hero {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: center;
  padding-top: 80px; /* Offset for sticky header */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--white);
  text-align: center;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(27, 58, 92, 0.8) 0%, rgba(27, 58, 92, 0.6) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  color: var(--white);
  margin-bottom: var(--spacing-md);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-lg);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Page Hero (Shorter) */
.page-hero {
  min-height: 40vh;
  padding-top: 80px;
}

.page-hero h1 {
  margin-bottom: 0;
}

/* ==========================================================================
   Cards Structure
   ========================================================================== */
.card {
  background-color: var(--bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card-img-wrap {
  position: relative;
  padding-top: 60%; /* Aspect ratio */
  overflow: hidden;
}

.card-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.card:hover .card-img {
  transform: scale(1.05);
}

.card-content {
  padding: var(--spacing-md);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  margin-bottom: var(--spacing-xs);
  color: var(--primary);
}

/* Alternating Layout for Ministries */
.alternating-row {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  align-items: center;
}

@media (min-width: 768px) {
  .alternating-row {
    flex-direction: row;
    gap: var(--spacing-lg);
  }
  
  .alternating-row:nth-child(even) {
    flex-direction: row-reverse;
  }
  
  .alternating-image, .alternating-content {
    flex: 1;
  }
}

.alternating-image img {
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}

.alternating-content h3 {
  color: var(--primary);
  position: relative;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.alternating-content h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 2px;
  background-color: var(--secondary);
}

/* ==========================================================================
   Photo Gallery
   ========================================================================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-sm);
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(27, 58, 92, 0.7);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.gallery-item:hover img {
  transform: scale(1.1);
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

/* Lightbox Modal */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  padding: 2rem;
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90vh;
}

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: var(--white);
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: var(--font-body);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  background-color: var(--bg);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.1);
}

textarea.form-control {
  min-height: 150px;
  resize: vertical;
}

.contact-info {
  background-color: var(--bg-alt);
  padding: var(--spacing-lg);
  border-radius: 8px;
  height: 100%;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.contact-icon {
  width: 24px;
  height: 24px;
  color: var(--secondary);
  flex-shrink: 0;
  margin-top: 3px;
}

/* ==========================================================================
   Events Table
   ========================================================================== */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--spacing-lg);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  border-radius: 8px;
  overflow: hidden;
}

.schedule-table th,
.schedule-table td {
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--bg-alt);
}

.schedule-table th {
  background-color: var(--primary);
  color: var(--white);
  font-weight: 600;
}

.schedule-table tr:last-child td {
  border-bottom: none;
}

.schedule-table tr:hover td {
  background-color: var(--bg-alt);
}

/* ==========================================================================
   Map Embed
   ========================================================================== */
.map-container {
  width: 100%;
  height: 400px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.map-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ==========================================================================
   Statistics Counters
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  text-align: center;
}

.stat-item {
  padding: var(--spacing-md);
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.5rem;
  display: block;
}

.stat-label {
  font-size: 1.1rem;
  color: var(--text-light);
  font-weight: 500;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background-color: var(--primary);
  color: var(--white);
  padding-top: var(--spacing-xl);
}

.footer-top {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3rem;
  margin-bottom: var(--spacing-lg);
  align-items: start;
}

.footer-col h4 {
  color: var(--secondary);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin-bottom: 2rem;
  position: relative;
  padding-bottom: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.footer-col h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30px;
  height: 2px;
  background-color: var(--secondary);
}

/* Column 1: wider description text still wraps correctly */
.footer-mission {
  padding-right: 0 !important; /* Remove any inline override */
  min-width: 0;
}

.footer-mission .site-title {
  font-size: 1.05rem;
}

.footer-logo-area {
  margin-bottom: 1.5rem;
}

.footer-nav ul,
.footer-schedule ul,
.footer-contact ul {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-nav a {
  color: #a0aec0;
  position: relative;
  transition: all var(--transition-fast);
  display: inline-block;
}

.footer-nav a:hover {
  color: var(--secondary);
  transform: translateX(5px);
}

.footer-contact li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: #a0aec0;
}

.footer-contact a {
  color: #a0aec0;
  transition: color var(--transition-fast);
}

.footer-contact a:hover {
  color: var(--secondary);
}

.footer-contact svg {
  width: 20px;
  height: 20px;
  fill: var(--secondary);
  flex-shrink: 0;
  margin-top: 2px;
}

/* Newsletter Band */
.newsletter-band {
  background-color: var(--primary-light);
  padding: var(--spacing-lg) 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.newsletter-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.newsletter-content h3 {
  color: var(--white);
  margin-bottom: 0.5rem;
}

.newsletter-form {
  display: flex;
  width: 100%;
  max-width: 600px;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-sm);
  border-radius: 4px;
}

.newsletter-form input {
  flex-grow: 1;
  padding: 1rem 1.25rem;
  border: none;
  border-radius: 4px 0 0 4px;
  font-size: 1rem;
}

.newsletter-form button {
  border-radius: 0 4px 4px 0;
  padding: 1rem 2rem;
  font-weight: bold;
  letter-spacing: 1px;
}

/* Footer Bottom */
.footer-bottom {
  padding: 2rem 0;
  text-align: center;
  font-size: 0.9rem;
  color: #a0aec0;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer-bottom a {
  color: var(--secondary);
}

.footer-bottom a:hover {
  text-decoration: underline;
}

/* Back to Top */
#backToTop {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 45px;
  height: 45px;
  background-color: var(--secondary);
  color: var(--bg);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

#backToTop.visible {
  opacity: 1;
  visibility: visible;
}

#backToTop:hover {
  background-color: var(--primary);
  color: var(--white);
  transform: translateY(-3px);
}

/* ==========================================================================
   Animations & Interaction
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  /* Navigation Mobile */
  .menu-toggle {
    display: block;
  }
  
  .main-nav {
    position: fixed;
    top: 75px; /* Height of header approx */
    left: 0;
    width: 100%;
    background-color: var(--bg);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    transform: translateY(-150%);
    opacity: 0;
    transition: all var(--transition-normal);
    z-index: 1000;
  }
  
  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
  }
  
  .main-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 1rem 0;
  }
  
  .main-nav a {
    display: block;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--bg-alt);
  }
  
  .main-nav a::after {
    display: none;
  }
  
  /* Layout adjustments */
  .section { padding: var(--spacing-lg) 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  
  .hero { min-height: 60vh; }
  .page-hero { min-height: 30vh; }
  
  .schedule-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
  
  .site-title { font-size: 1.1rem; }
  .logo-svg { width: 36px; height: 36px; }
  
  .newsletter-form {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .newsletter-form input,
  .newsletter-form button {
    width: 100%;
    border-radius: 4px;
  }
}
