@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;700&display=swap');

body {
  margin: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  background-color: #f4f4f4;
}

/* Homepage overflow control during animation */
body.homepage {
  overflow: hidden;
  animation: allow-scroll 5s forwards;
}

.content-container {
  padding-bottom: 100px;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 10px;
}

footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 100;
}

/* --- HERO FADE-IN FOR ALL NON-HOMEPAGE PAGES --- */

/* Selects these elements ONLY on pages where the body tag does NOT have the class "homepage". */
body:not(.homepage) .hero-section .main-title,
body:not(.homepage) .hero-section .hero-text-container,
body:not(.homepage) .hero-section nav {
  /*
    THIS IS THE CRITICAL FIX:
    We are forcing the opacity to 0 to override any Tachyons utility classes
    (like .white-90) that might be using "!important" themselves.
  */
  opacity: 0 !important;

  /* Apply the animation */
  animation: simple-fade-in 1.2s forwards ease-out;
}

/* Give the text and nav a slightly staggered start */
body:not(.homepage) .hero-section .hero-text-container,
body:not(.homepage) .hero-section nav {
  animation-delay: 0.2s;
}

/* Keyframe for the fade-in animation (no change here) */
@keyframes simple-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- INTRO ANIMATION CLASSES (Homepage Only) --- */

/* The Hero Section (Splash Screen) - Homepage Only - IDENTICAL to other pages */
body.homepage .hero-section {
  animation: shrink-hero 3s forwards;
  position: relative;
  height: 100vh;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

/* Hero content container - IDENTICAL to other pages */
body.homepage .hero-content {
  animation: preserve-hero-content 5s forwards;
  position: relative;
  z-index: 2;
  background-color: transparent;
}

/* Darkening Overlay - Homepage Only - positioned within hero-content */
body.homepage .hero-content::after {
  animation: darken-overlay 5s forwards;
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  opacity: 0;
  z-index: 1;
}

/* Ensure overlay covers full hero section */
body.homepage .hero-section {
  overflow: hidden;
}

/* Main Title - Homepage Only - match other hero sections */
body.homepage .main-title {
  animation: fade-in-title 5s forwards;
  font-size: 6vw; /* Match responsive size like other pages */
  font-weight: 300;
  letter-spacing: 2px;
  z-index: 3;
  opacity: 0;
  text-align: center;
  margin: 0;
  color: white;
  position: relative;
  margin-top: 55px;
}

/* Navigation Menu - Homepage Only - IDENTICAL to other pages */
body.homepage .hero-content nav {
  animation: fade-in-nav 5s forwards;
  opacity: 0;
  position: relative;
  z-index: 3;
}

body.homepage .hero-content nav .flex-l {
  justify-content: space-between;
  align-items: center;
}

body.homepage .hero-content nav a,
body.homepage .hero-content nav ul li a {
  color: white !important;
  text-decoration: none;
  pointer-events: auto;
}

/* Hero text container - IDENTICAL to other pages */
body.homepage .hero-text-container {
  animation: fade-in-hero-text 5s forwards;
  opacity: 0;
  position: relative;
  z-index: 3;
}

/* Main Page Content - Homepage Only */
body.homepage .main-content {
  animation: fade-in-content 5s forwards;
  opacity: 0;
  padding: 3rem;
  max-width: 1600px;
  margin: 0 auto;
}

/* === KEYFRAME ANIMATIONS === */
/* All animations run for 8 seconds and maintain their final state (forwards) */

/* 1. Shrinks the hero section (Unchanged) */
@keyframes shrink-hero {
  0%, 40% {
    height: 100vh; /* Stay full height for the first 70% of the time */
  }
  100% {
    height: 40vh;  /* Shrink to match other pages (40vh) */
  }
}

/* 2. Fades in the dark overlay (ADJUSTED) */
@keyframes darken-overlay {
  /* Stay transparent until the shrinking starts */
  0%, 70% {
    opacity: 0;
  }
  /* Fade in quickly after shrinking begins */
  90%, 100% {
    opacity: 0.8;
  }
}

/* 3. Fades in the main title (ADJUSTED) */
@keyframes fade-in-title {
  /* Stay hidden until the screen is dark */
  0%, 75% {
    opacity: 0;
    transform: translateY(20px);
  }
  /* Fade in during the final moments */
  95%, 100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 4. Fades in the navigation (Unchanged) */
@keyframes fade-in-nav {
  0%, 80% { /* Stay hidden for most of the animation */
    opacity: 0;
  }
  100% { /* Fade in at the very end */
    opacity: 1;
  }
}

/* 5. Fades in the main content below the hero (Unchanged) */
@keyframes fade-in-content {
  0%, 80% { /* Stay hidden while the hero animation runs */
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* 6. Allows the body to be scrollable after the animation (Unchanged) */
@keyframes allow-scroll {
  to {
    overflow: auto;
  }
}

/* 7. Preserves hero content structure (Unchanged) */
@keyframes preserve-hero-content {
  0%, 100% {
    /* Keep the exact same structure as other pages */
  }
}

/* 8. Fades in hero text (Unchanged) */
@keyframes fade-in-hero-text {
  0%, 85% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* --- END INTRO ANIMATIONS --- */

/* 3. For Gallery Images (Loads on Scroll with JS) */
.fade-in-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.fade-in-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- END ANIMATIONS --- */

.f2.f1-l.fw2.white-90.mb0.lh-title {
  font-weight: 300 !important;
}

.gallery-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.gallery-image-wrapper {
  flex: 1 1 calc(50% - 1.5rem);
  max-width: calc(50% - 1.5rem);
  box-sizing: border-box;
  text-align: center;
}

.gallery-image-wrapper img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border: 1px solid #ddd;
  padding: 0.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .gallery-image-wrapper {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

/* Border for Service and About images */
.services-image-large {
  border: 1px solid #ddd;
  padding: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- GALLERY MODAL STYLES --- */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  overflow: auto;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.modal.show {
  opacity: 1;
}

.modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.3s ease-in-out;
}

.modal.show .modal-content {
  transform: translate(-50%, -50%) scale(1);
}

.close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #ffffff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  transition: color 0.2s ease;
}

.close:hover,
.close:focus {
  color: #cccccc;
  text-decoration: none;
  cursor: pointer;
}

/* --- END GALLERY MODAL STYLES --- */
