/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Figtree', sans-serif;
}

/* This class locks the screen */
.no-scroll {
  overflow: hidden;
  height: 100vh;
}

/* Apply it by default to the html/body */
html, body {
  width: 100%;
  /* Remove the 'none' from before so we can toggle it */
  -ms-overflow-style: auto; 
  scrollbar-width: auto;
}

/* Hide scrollbar for IE, Edge and Firefox */
html {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1.5rem 5%;
  z-index: 1000;
  /* This ensures the entire header area attempts to blend */
  mix-blend-mode: difference; 
}

.logo-link {
  color: white; /* Essential for 'difference' to look like an X-ray */
  text-decoration: none;
  font-weight: 600;
  font-size: 1.4rem;
  transition: opacity 0.3s ease;
  display: inline-block;
  letter-spacing: 0.5px;
  -webkit-font-smoothing: antialiased;
}

/* Optional: a subtle hover effect that doesn't break the blend */
.logo-link:hover {
  opacity: 0.7;
}

.main-header div {
  color: white;      /* text color on your background */
  font-weight: 600;
  font-size: 1.5rem;
  font-family: 'Figtree', sans-serif;
  mix-blend-mode: difference; /* keeps the text dynamic with background */
  pointer-events: auto; /* allows text selection if needed */
}

/* Hero section */
.hero {
  position: relative;
  height: 100vh;
  overflow: visible; /* ensures background stays inside */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 20vh;
  pointer-events: auto;
  z-index: 1;
}

.hero-bg-container {
  position: absolute;
  top: 0;
  left: 50%;           /* center horizontally */
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  transform: translateX(-50%); /* center horizontally */
}

.hero-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 110%;
  max-width: 100%; /* slightly bigger to allow movement */
  object-fit: cover;
  height: auto;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease-out; /* smooth movement */
  pointer-events: none;
  z-index: -1; /* behind text */
  overflow: hidden;
}

/* 1. The Animation for automatic drifting */
@keyframes desktopDrift {
  0% { transform: translate(-50%, -50%) scale(1.05); }
  50% { transform: translate(-48%, -52%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1.05); }
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('images/grain.png');
  opacity: 0.15;
  pointer-events: none;
}

/* Make hero taller so it can contain both first-page and second-page content */
.extended-hero {
  height: 200vh; /* double viewport height (first page + gallery heading) */
  position: relative;
  overflow: hidden;
}

/* First-page overlay stays near top */
.first-page-overlay {
  position: absolute;
  top: 20%;
  left: 10%;
  z-index: 2;
}

/* Second-page heading at bottom of first viewport (start of second page) */
.second-page-heading {
  position: absolute;
  top: calc(95vh + 50px); /* below first viewport */
  right: 10%;               /* left offset */
  left: auto;             /* make sure width doesn't force centering */
  width: auto;             /* auto width so it doesn't stretch full width */
  z-index: 2;
}

.second-page-heading h2 {
  font-size: 3rem;
  font-weight: 600;
  display: inline-block;
  
  /* The Animated Gradient & Blend Mode */
  background: linear-gradient(270deg, #ffffff, #d4e9f5, #83a1a7, #ffffff);
  background-size: 600% 600%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 15s ease infinite;
  mix-blend-mode: difference;
}

/* The cursor only appears when the 'typing-active' class is added */
.second-page-heading h2.typing-active::after {
  content: "|";
  color: white;
  margin-left: 5px;
  animation: blink 1s infinite;
}

.overlay {
  position: relative; /* keep overlay above image */
  margin-left: 10%;
  color: white;
  max-width: 500px;
  z-index: 1;
  pointer-events: auto; /* allow clicks and buttons */
}

.overlay h1, .overlay p {
  color: white; /* fallback */
  mix-blend-mode: difference; /* or lighten/darken/exclusion */
}

#typing, #subtext #btn{
  font-size: 4rem;
  line-height: 1.2;
  margin-bottom: 1rem;

  /* Animated gradient */
  background: linear-gradient(270deg, #ffffff, #d4e9f5, #83a1a7, #ffffff);
  background-size: 600% 600%;

  /* Make gradient visible in text */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;

  /* Blend with background image */
  mix-blend-mode: difference; /* or try: overlay, screen, difference */

  /* Animate the gradient */
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Subtext smaller font */
#subtext {
  font-size: 1.5rem;
  opacity: 0.9;
}

/* Cursor for typing */
#typing::after, #subtext::after {
  content: "|";
  animation: blink 1s infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Button styling */
.btn {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 24px;
  font-weight: 600;
  font-size: 1.2rem;
  color: white; /* always white text */
  mix-blend-mode: difference; /* or lighten/darken/exclusion */
  border: 2px solid white;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0); /* fully transparent */
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

/* Hover: soft background fade and slight lift */
.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.08); /* subtle light overlay */
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transform: scale(1.2); /* slightly larger than button */
  pointer-events: none; /* lets clicks go through */
  border-radius: 4px; /* match button corners */
}

.btn:hover::after {
  opacity: 1; /* fade in soft light */
  transform: scale(1); /* gently shrink into place */
}

.btn:hover {
  transform: translateY(-2px); /* gentle lift effect */
}

/* Fade-in helper */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}

.fade-in.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 600px) {
  .overlay {
    margin-left: 5%;
    padding: 2rem 1.5rem;
  }

  #typing {
    font-size: 2rem;
  }

  #subtext {
    font-size: 1rem;
  }
}

/* 1. The Container: Handles centering and the Vertical Bounce */
.scroll-arrow {
  position: fixed;
  bottom: 20px;
  left: 50%;
  /* We remove the static transform: translateX here because the animation will handle it */
  cursor: pointer;
  z-index: 100000;
  pointer-events: auto;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  
  /* Applying the bounce to the container so it moves straight down */
  animation: bounce 1.5s infinite; 
}

/* 2. The Animation: Stays centered (X) and moves only Up/Down (Y) */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(10px);
  }
  60% {
    transform: translateX(-50%) translateY(5px);
  }
}

/* 3. The V Shape: Just handles the look and rotation */
.scroll-arrow span {
  display: block;
  width: 20px;
  height: 20px;
  border-left: 4px solid white;
  border-bottom: 4px solid white;
  transform: rotate(-45deg); /* This rotation no longer affects the bounce direction */
}

/* Hidden state */
.scroll-arrow.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gallery-filters {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 20px; /* Adjusts the white space height */
  background: white;
}

.filter-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  font-weight: 400;
  color: #888;
  cursor: pointer;
  padding: 5px 15px;
  transition: all 0.3s ease;
  position: relative;
}

.filter-btn:hover {
  color: #333;
}

/* The underline effect for the active gallery */
.filter-btn.active {
  color: #000;
  font-weight: 600;
}

.filter-btn.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 15px;
  right: 15px;
  height: 2px;
  background: #000;
}

#gallery {
  margin-top: 0vh; /* pulls gallery up to touch hero’s bottom */
  position: relative;
  z-index: 3;
  background: white; /* ensures gallery content is readable */
  padding-top:60px;
}

#gallery-grid {
  display: block;        /* MUST be block for column-count to work */
  column-count: 4;       
  column-gap: 12px;
  padding: 10px;
  width: 100%;
  opacity: 0;
  transition: opacity 0.8s ease;
}

#gallery-grid.loaded {
  opacity: 1;
}

/* Ensure the cards don't split or warp */
/* Update this section */
.image-card {
  display: inline-block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 12px;
  background: #f9f9f9; /* This acts as a placeholder while the image loads */
  border-radius: 6px;
  overflow: hidden;
  min-height: 200px; /* Gives the columns some height before images appear */
}

.image-card img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 1, 0.3, 1);
}

/* Change translateY(10px) to -20px to make them load "DOWN" */
.image-card img:not(.loaded) {
  opacity: 0;
  transform: translateY(-20px); 
}

.image-card img:hover {
  transform: scale(1.02);
  opacity: 0.95;
  cursor: pointer;
}

/* When image is loaded */
.image-card img.loaded {
  opacity: 1;
  transform: translateY(0);
}

.image-card img.loaded:hover {
  transform: scale(1.02);
  opacity: 0.95;
  cursor: pointer;
}

.loader-container {
  width: 100%;
  max-width: 400px;
  margin: 50px auto;
  text-align: center;
  transition: opacity 0.5s ease;
}

.loader-container p {
  font-family: inherit;
  margin-bottom: 10px;
  color: #666;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: #eee;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  width: 0%; /* Starts at 0 */
  height: 100%;
  background: linear-gradient(90deg, #83a1a7, #d4e9f5);
  transition: width 0.3s ease;
}

.loader-container.hidden {
  opacity: 0;
  pointer-events: none;
  display: none; /* Add this to ensure it doesn't block clicks on the photos */
  transition: opacity 0.5s ease;
}

/* Lightbox overlay */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
  z-index: 2000;
  flex-direction: column;
}

/* Image */
.lightbox-img {
  max-width: 90%;
  max-height: 80%;
  border-radius: 4px;
  position: relative;
  z-index: 10;
}

/* Close button top-right */
.lightbox .close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
  z-index: 20;
}

/* Download button top-left as icon */
#download-lightbox {
  position: absolute;
  top: 20px;
  left: 30px;
  font-size: 28px; /* bigger for visibility */
  color: white;
  text-decoration: none;
  z-index: 20;
  background: none; /* remove blue box */
  padding: 0;
  line-height: 1;
}

#download-lightbox:hover {
  color: #d4e9f5; /* subtle hover color */
}

/* Arrows on sides of image */
#prev, #next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 50px;
  background: rgba(0,0,0,0.3);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
}

#prev { left: 20px; }
#next { right: 20px; }

#prev:hover, #next:hover {
  background: rgba(0,0,0,0.6);
}

#lightbox-img {
    max-width: 90%;
    max-height: 80vh;
    transition: transform 0.1s ease-out; 
    cursor: grab; /* Shows the open hand */
    user-select: none;
    transform-origin: center center; 
    position: relative;
    top: 0;
    left: 0;
    pointer-events: auto;
}

/* While the mouse is pressed down, show the closed hand */
#lightbox-img:active {
    cursor: grabbing;
}

#lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    display: none; /* JS toggles this to flex */
    align-items: center;
    justify-content: center;
    overflow: hidden; 
    touch-action: none; 
}

/* Lightbox Spinner */
.spinner {
  display: none; /* Hidden by default */
  position: absolute;
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s ease-in-out infinite;
  z-index: 5; /* Sit behind the buttons but in front of background */
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Ensure the image stays hidden while loading to prevent "flickering" */
.lightbox-img.loading {
  opacity: 0;
}



/* --- MOBILE ONLY OVERRIDES (Screens smaller than 768px) --- */
@media (max-width: 768px) {

    /* 1. Shrink the Hero Text so it fits on one line */
    #typing {
        font-size: 2.2rem !important; 
    }
    
    #subtext {
        font-size: 1.1rem !important;
    }

    /* 2. Stack the Gallery into 2 columns instead of 4 */
    #gallery-grid {
        column-count: 2 !important;
        column-gap: 8px;
    }

    /* 3. Make Lightbox Buttons easier to tap with fingers */
    #prev, #next {
        width: 45px;
        height: 45px;
        font-size: 22px;
        background: rgba(0,0,0,0.4); /* Darker for better visibility */
    }

    .lightbox .close {
        top: 15px;
        right: 15px;
        font-size: 35px;
    }
    
    /* 4. Adjust the "Photo Gallery" heading position */
    .second-page-heading {
        top: calc(90vh + 20px);
        right: 5%;
    }
    
    .second-page-heading h2 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {

    /* Force the Hero container to be exactly the height of the phone screen */
    .hero {
        height: 100vh;
        width: 100%;
        display: flex;
        align-items: center;
        overflow: hidden;
    }

    /* Enlarge the background image to fill the vertical space */
    .hero-bg {
        height: 100vh !important; /* Matches phone height */
        width: auto !important;   /* Allows width to scale naturally */
        min-width: 150vw;         /* Ensures it's wide enough to 'drift' */
        object-fit: cover;        /* Crops the sides so it doesn't stretch */
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    /* Move the text overlay to the center so it doesn't get cut off */
    .overlay {
        margin-left: 0;
        width: 100%;
        padding: 0 20px;
        text-align: center;
    }
}

@media (max-width: 768px) {
    /* ... your other mobile code ... */

    /* Shrink the logo text */
    .logo-link {
        font-size: 1.1rem !important; /* Smaller than the desktop 1.4rem */
        letter-spacing: 0.3px;
    }

    /* Adjust header padding so it doesn't take up too much vertical space */
    .main-header {
        padding: 1rem 5%;
    }
}

@media (max-width: 768px) {
    /* ... (keep your other mobile code here) ... */

    /* 1. Reduce the gap at the bottom of the first page */
    .hero {
        margin-bottom: 5vh !important; /* Changed from 20vh to 5vh */
    }

    /* 2. Pull the Gallery up closer */
    #gallery {
        margin-top: 0 !important;
        padding-top: 20px !important; /* Small padding for the filters */
    }

    /* 3. Adjust the "Photo Gallery" title position */
    .second-page-heading {
        top: calc(100vh - 40px) !important; /* Move it right to the edge of the image */
        right: 5% !important;
    }
}
