/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 29.6px;
  color: rgb(255, 255, 255);
  background: #111724; /* Solid dark blue background */
}

/* Container */
.container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header and Navbar */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #111724; /* Solid background */
  z-index: 1000;
  transition: top 0.3s ease;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 15px; /* MODIFIED: Added horizontal padding */
}

.navbar-left {
  display: flex;
  align-items: center;
  cursor: pointer; /* Indicate it's clickable */
  transition: transform 0.3s ease; /* Smooth scale animation */
  flex-shrink: 1; /* NEW: Allow this element to shrink if needed */
  min-width: 0; /* NEW: A flexbox fix to allow shrinking */
}

.navbar-left:hover {
  transform: scale(1.05); /* Subtle scale increase on hover */
}

.logo-img {
  width: 50px;
  height: 50px;
  margin-right: 15px;
  flex-shrink: 0; /* NEW: Prevent logo from shrinking */
}

.church-name {
  font-size: 28px;
  font-weight: 700;
  color: #D4AF37;
}

.church-subname {
  font-size: 16px;
  font-weight: 500;
  color: #eeede8;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 20px;
}

.nav-link {
  color: rgb(255, 255, 255);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
  margin-right: 15px;
  position: relative; /* For animated underline */
}

.nav-link:hover {
  color: #D4AF37;
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: #D4AF37;
  transition: width 0.3s ease;
}

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

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #D4AF37; /* Gold-yellow default */
  font-size: 29px;
  cursor: pointer;
  position: absolute;
  top: 30px; /* MODIFIED: Adjusted for vertical centering */
  right: 15px; /* MODIFIED: Aligns with new navbar padding */
  z-index: 1100;
}

/* Hero Section */
.hero {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hero-images {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  animation: heroFade 15s infinite;
}

.hero-image:nth-child(1) { animation-delay: 0s; }
.hero-image:nth-child(2) { animation-delay: 5s; }
.hero-image:nth-child(3) { animation-delay: 10s; }

@keyframes heroFade {
  0% { opacity: 0; }
  20% { opacity: 1; }
  33.33% { opacity: 1; }
  53.33% { opacity: 0; }
  100% { opacity: 0; }
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* This new gradient fades to the body's background color at the bottom */
  background: linear-gradient(to bottom, rgba(16, 22, 36, 0.6) 70%, #111724 100%);
  z-index: 0;
}

.hero-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.hero-text {
  font-size: 17px;
  margin-bottom: 30px;
  position: relative;
  z-index: 1;
}

.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.btn {
  padding: 10px 20px;
  background: #D4AF37;
  color: #111724;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 700;
  transition: background 0.3s ease;
  border: none;
  cursor: pointer;
}

/* Sections */
.section {
  padding: 80px 0;
}

.section-title {
  font-size: 30px;
  font-weight: 700;
  color: #D4AF37;
  text-align: center;
  margin-bottom: 40px;
  margin-top: 50px;
}

/* Ministries & Events & Blogs Preview on Homepage */
.ministries-container, .events-container, .blog-container {
  position: relative;
}

.ministries-cards, .events-cards, .blog-cards {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  gap: 20px;
  padding: 10px 0;
}

.ministries-cards::-webkit-scrollbar, .events-cards::-webkit-scrollbar, .blog-cards::-webkit-scrollbar {
  display: none;
}

.ministry-card {
  flex: 0 0 23%;
  height: 200px;
  position: relative;
  text-decoration: none;
  border-radius: 10px;
  overflow: hidden;
}

.ministry-image {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.ministry-card .card-title {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: #1E2A44;
  padding: 5px 10px;
  border-radius: 5px;
}

.blog-card {
  flex: 0 0 23%;
}

.preview-card {
  background: transparent;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(212, 175, 55, 0.3);
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  text-align: center;
  display: block;
  text-decoration: none;
}

.preview-card:hover {
  background: #D4AF37;
  color: #111724;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(16, 22, 36, 0.3);
}

.preview-card h3 {
  color: #D4AF37;
  font-size: 18px;
  margin-bottom: 10px;
}

.preview-card .author {
  color: #fff;
  font-size: 14px;
  font-style: italic;
  margin-bottom: 10px;
}

.preview-card p {
   color: #fff;
}

.preview-card:hover h3,
.preview-card:hover .author,
.preview-card:hover p {
  color: #111724;
}

/* Arrows for Swiping */
.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #D4AF37;
  color: #1E2A44;
  border: none;
  padding: 10px;
  cursor: pointer;
  border-radius: 50%;
  display: none; /* Hide by default */
}
.left-arrow { left: -40px; }
.right-arrow { right: -40px; }

/* --- Full Page Styles (Events & Blogs) --- */
.event-list, .blog-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}
.event-card-full {
  background: #1E2A44;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  width: 80%;
}
.flyer-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.event-info {
  padding: 20px;
}
.event-info h3 {
  color: #D4AF37;
}

/* Modal for Flyer */
.flyer-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
}
.flyer-modal-overlay.visible {
  display: flex;
}
.flyer-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 90vw;
  max-height: 90vh;
  color: white;
}
.flyer-modal-text h2 {
  color: #D4AF37;
}
.flyer-modal-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.flyer-modal-back-button {
  position: absolute;
  top: 20px;
  left: 20px;
}

/* Blog Detail View */
.blog-detail {
  width: 80%;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(212, 175, 55, 0.3);
}
.blog-content h2, .blog-content .author {
  text-align: center;
}
.blog-content p {
  text-align: left;
}
.blog-content h2 {
  font-size: 24px;
  font-weight: 700;
  color: #D4AF37;
  margin-bottom: 15px;
}
.blog-content .author {
  font-size: 14px;
  font-style: italic;
  margin-bottom: 15px;
}
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #D4AF37;
  color: #111724;
  border: none;
  border-radius: 5px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 40px;
}
.blog-navigation {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.blog-nav-btn:disabled {
  background-color: #555;
  color: #888;
  cursor: not-allowed;
}

/* Footer */
.footer {
  padding: 40px 0;
  text-align: center;
}
.footer-content {
  display: flex;
  justify-content: space-between;
  margin-bottom: 30px;
}
.footer-section {
  flex: 1;
  padding: 0 20px;
}
.footer-title {
  color: #D4AF37;
}
.footer-text {
  color: #FFFFFF;
}
.social-link, .footer-link {
  color: #D4AF37;
  text-decoration: none;
}
.social-link:hover, .footer-link:hover {
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .nav-links {
    position: fixed;
    top: 0;
    right: -250px;
    height: 100%;
    width: 250px;
    background: #1E2A44;
    flex-direction: column;
    padding: 80px 20px;
    transition: right 0.3s ease;
  }
  .nav-links.active {
    right: 0;
  }
  .hero { height: 80vh; }
  .ministry-card, .blog-card {
    flex: 0 0 80%;
  }
  .arrow { display: block; } /* Show arrows on mobile */
  .footer-content { flex-direction: column; gap: 30px; }
  .blog-detail, .event-card-full { width: 100%; }
  .blog-detail {
    border-radius: 0;
    min-height: 100vh;
  }

  /* A balanced size for the main church name */
  .church-name {
    font-size: 24px;
  }

  /* A proportional size for the sub-name */
  .church-subname {
    font-size: 14px;
  }

  /* Reset the welcome text to its correct size */
  .hero-title {
    font-size: 34px;
  }
}

@media (max-width: 480px) {
  .ministry-card, .blog-card {
    flex: 0 0 100%;
  }
}

/* Homepage Latest Event Section */
.latest-event-desktop-card {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  cursor: pointer;
}
.latest-event-desktop-card .flyer-bg {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 0.4s ease;
}
.latest-event-desktop-card:hover .flyer-bg {
  transform: scale(1.05);
}
.latest-event-desktop-card .gradient-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, rgba(16, 22, 36, 0.9) 20%, rgba(16, 22, 36, 0.1) 80%);
}
.latest-event-desktop-card .text-content {
  position: absolute;
  top: 50%;
  left: 5%;
  transform: translateY(-50%);
  color: #fff;
  max-width: 50%;
}
.latest-event-desktop-card .text-content h2 {
  font-size: 36px;
  color: #D4AF37;
  margin-bottom: 10px;
}
.latest-event-desktop-card .text-content p {
  font-size: 20px;
}
.latest-event-mobile-card {
  display: none;
}
.explore-more-link {
  display: block;
  margin-top: 15px;
  font-style: italic;
  color: #D4AF37;
  text-decoration: none;
  text-align: right;
}
.explore-more-link:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .latest-event-desktop-card { display: none; }
  .latest-event-mobile-card { display: block; }
  .explore-more-link { text-align: center; }
}

.flyer-modal-text {
    margin-bottom: 15px;
    flex-shrink: 0;
}
.flyer-modal-text h2 {
  font-size: 24px;
  color: #D4AF37;
}
.flyer-modal-text p {
  font-size: 16px;
}
.flyer-modal-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  flex-shrink: 1;
  min-height: 0;
}
.flyer-modal-back-button {
    position: absolute;
    top: 20px;
    left: 20px;
}

.blog-list {
  width: 80%;
  max-width: 900px;
  margin: 0 auto;
}
.blog-list .preview-card {
  width: 100%;
}
.blog-detail {
  padding: 40px;
}

/* Other Page Specifics */
.about-content, .new-here-items {
  display: flex;
  gap: 30px;
}
.about-item { align-items: center; }
.about-image { width: 50%; height: 300px; background-size: cover; background-position: center; border-radius: 10px; }
.about-text { width: 50%; }
.about-subtitle, .section-subtitle { font-size: 24px; font-weight: 700; color: #D4AF37; margin-bottom: 15px; }
.new-here-hero, .ministry-hero, .donate-hero { position: relative; height: 60vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.new-here-bg, .ministry-bg, .donate-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; z-index: -1; }
.new-here-bg::before, .ministry-bg::before, .donate-bg::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(16, 22, 36, 0.6); z-index: 0; }
.ministry-large-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; }
.ministry-large-card { position: relative; height: 300px; text-decoration: none; border-radius: 10px; overflow: hidden; transition: background 0.3s ease; }
.ministry-large-card:hover { background: rgba(212, 175, 55, 0.1); }
.ministry-large-image { width: 100%; height: 100%; background-size: cover; background-position: center; }
.ministry-large-card .card-title { position: absolute; bottom: 20px; left: 20px; font-size: 24px; font-weight: 700; color: white; background: #1E2A44; padding: 10px 20px; border-radius: 5px; }
.btn:hover { background: #b8972d; }
.section-text { font-size: 16px; line-height: 29.6px; text-align: center; margin-bottom: 20px; }

@media (min-width: 769px) {
  .event-list { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }
}
@media (max-width: 768px) {
  .new-here-items, .about-item { flex-direction: column; text-align: center;}
  .about-item .about-image, .about-item .about-text { width: 100%; }
  .ministry-large-cards { grid-template-columns: 1fr; }
}

/* --- NEW: Final Mobile Font Size Adjustments --- */
@media (max-width: 768px) {
  /* Increase the size of the main site title in the header */
  .church-name {
    font-size: 29px;
  }

  /* Increase the size of the site sub-title in the header */
  .church-subname {
    font-size: 15px;
  }

  /* Decrease the size of the 'Welcome' text in the hero section */
  .hero-title {
    font-size: 24px;
  }
}

/* --- FIX: Final Mobile Menu Button Alignment --- */
@media (max-width: 768px) {
  .menu-toggle {
    /* Fine-tuning the vertical position. This should be the correct value. */
    top: 25px;
    left: calc(100% - 60px); /* Adjusted to align with the right edge of the navbar */
  }
}

/* --- FIX: Prevent Horizontal Page Overflow --- */
/* This rule forces every main section to hide anything
   that tries to break out of the screen's boundaries,
   fixing the unwanted margin on mobile devices. */
   .section {
    overflow-x: hidden;
  }

/* =============================================
   FIX: About Page Layout & Responsiveness (v2)
   ============================================= */

/* Center the main "About" title properly */
.about .section-title {
  margin-bottom: 60px;
}

/* Main container for the "Community" and "Beliefs" sections */
.about-content {
  display: flex;
  flex-direction: column;
  gap: 60px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Styles for each section (image + text) on desktop */
.about-item {
  display: flex;
  align-items: center;
  gap: 40px;
}

/* Alternating layout for a dynamic design */
.about-item:nth-child(even) {
  flex-direction: row-reverse;
}

/* Image and text containers share space on desktop */
.about-image,
.about-text {
  flex: 1;
}

.about-image {
  height: 400px;
  background-size: cover;
  background-position: center;
  border-radius: 10px;
}

.about .about-subtitle,
.about .section-text {
  text-align: left;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
  /* Stack items vertically on mobile */
  .about-item,
  .about-item:nth-child(even) {
    flex-direction: column;
  }

  /*
    KEY FIX: Reset flex property.
    This prevents the desktop 'flex: 1' from collapsing the image on mobile.
  */
  .about-image,
  .about-text {
    flex: none; /* This is the line that fixes the bug */
    width: 100%;
  }

  /* Explicitly define image height for mobile */
  .about-image {
    height: 250px;
  }

  /* Center text on mobile for better readability */
  .about .about-subtitle,
  .about .section-text {
    text-align: center;
  }
}

/* =========================================================
   FIX: "I'm New Here" Page - Centered Headings & Gradient
   ========================================================= */

/* 1. This creates the seamless flow from the image to the content below.
      It changes the hero overlay to a smooth gradient that fades into the
      dark blue background of the page. */
      .new-here-bg::before {
        background: linear-gradient(to bottom, rgba(16, 22, 36, 0.7) 0%, #111724 100%);
      }
      
      /* 2. This reduces the large gap between the hero image and the content,
            which removes the "thin line" effect. */
      .new-here-content.section {
        padding-top: 40px;
      }
      
      /* 3. This is the key fix for your alignment request. It center-aligns
            everything within each of the three columns ("Arriving Early", etc.),
            so the headings are perfectly centered above their text. */
      .new-here-item {
        text-align: center;
      }

      /* This rule targets the "Bank Account Details" heading and
   center-aligns it. */
.donate-content .section-subtitle {
  text-align: center;
}

/* =======================================
   FIX: Mobile Header Text Overlap
   ======================================= */

/* This rule applies only to mobile screens */
@media (max-width: 768px) {

  /*
    1. Make the navbar a "relative" container. This ensures
       the menu button is positioned correctly within the header.
       We also add padding on the right to create space for the button.
  */
  .navbar {
    position: relative;
    padding-right: 60px; /* Creates space on the right for the menu button */
  }

  /*
    2. Properly align the menu button within the new space we created.
       This places it perfectly in the top-right corner.
  */
  .menu-toggle {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    /* Reset any conflicting 'left' property from previous fixes */
    left: auto;
  }

/* =========================================================
   DEFINITIVE FIX FOR HAMBURGER 'X' ANIMATION
   ========================================================= */

/* --- 1. Basic Styling --- */
.menu-toggle {
  width: 42px; height: 42px; display: flex; flex-direction: column;
  justify-content: center; align-items: center; cursor: pointer;
  padding: 3px; background: transparent; border: none; overflow: hidden;
}
.bar {
  display: block; width: 100%; height: 4px; background: #D4AF37;
  border-radius: 3px; transition: all 0.35s ease-in-out;
  animation-play-state: running;
}
.bar + .bar { margin-top: 6px; }

/* --- 2. Gravity Animation --- */
@keyframes bounce-and-fall {
  0%, 100% { transform: translateY(0); animation-timing-function: ease-out; }
  25% { transform: translateY(-6px); animation-timing-function: ease-in; }
  75% { transform: translateY(5px); animation-timing-function: ease-out; }
}
.bar1 { animation: bounce-and-fall 4s infinite 0.1s; }
.bar2 { animation: bounce-and-fall 4s infinite 0.2s; }
.bar3 { animation: bounce-and-fall 4s infinite 0.3s; }

/* --- 3. "X" Animation on Click (WITH !IMPORTANT) --- */
/* The '!important' flag forces these styles to apply, overriding any cache or conflicts. */
.menu-toggle.active .bar {
  animation-play-state: paused !important;
}
.menu-toggle.active .bar1 {
  transform: translateY(10px) rotate(45deg) !important;
}
.menu-toggle.active .bar2 {
  opacity: 0 !important;
}
.menu-toggle.active .bar3 {
  transform: translateY(-10px) rotate(-45deg) !important;
}

/* --- 4. Mobile Position --- */
@media (max-width: 768px) {
  .menu-toggle { top: 45%; }
}
}