/* 🌸 Gallery Page Styling - Gallery-specific only */
/* DO NOT include body, header, or global styles - those are in style.css */

/* Title animation for gallery page */
.content-section h2 {
  animation: floatTitle 3s ease-in-out infinite alternate;
}

@keyframes floatTitle {
  from { transform: translateY(0); }
  to { transform: translateY(-5px); }
}

/* 🌸 Romantic Note Box */
.gallery-note {
  max-width: 800px;
  margin: 0 auto 40px auto; /* Centers it and adds space below */
  padding: 20px 25px;
  
  /* A soft, transparent background using the theme's accent color */
  background: rgba(255, 179, 217, 0.1); 
  border: 1px solid rgba(255, 179, 217, 0.3);
  border-radius: 15px;
  
  /* Align the heart icon and the text */
  display: flex;
  align-items: center;
  gap: 15px;
}

.gallery-note p {
  margin: 0;
  font-style: italic;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.gallery-note svg {
  fill: var(--text-header);
  width: 24px;
  height: 24px;
  flex-shrink: 0; /* Prevents icon from shrinking */
}

/* --- Light Mode for the Note --- */
body.light-mode .gallery-note {
  /* Uses the light-mode accent color for the background and border */
  background: rgba(164, 107, 140, 0.08); 
  border-color: rgba(164, 107, 140, 0.25);
}

/* 🌸 Gallery grid layout */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 15px;
  padding: 0 20px 60px;
  width: 100%;
  max-width: 1100px;
  box-sizing: border-box;
  margin: 0 auto;
}

/* 🌸 Gallery Image Card */
.gallery-card {
  width: 100%;
  height: 230px;
  overflow: hidden;
  border-radius: 15px;
  box-shadow: 0 6px 15px rgba(255, 150, 180, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
  cursor: pointer;
  border: 3px solid transparent;
  position: relative;
}

.gallery-card:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(255, 120, 180, 0.3);
  border: 3px solid #ff7aa2;
  cursor: url('../images/cursor/hover.png') 16 16, pointer;
}
/* Update your existing rule */
.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.3s ease, opacity 0.5s ease-in-out; /* <-- MODIFY THIS LINE */
  
  opacity: 0; /* <-- ADD THIS: Start fully transparent */
}

/* Add this new rule */
.gallery-card img.loaded {
  opacity: 1; /* Fade to fully visible */
}

.gallery-card:hover img {
  filter: brightness(1.1);
}

/* Light mode adjustments for gallery cards */
body.light-mode .gallery-card {
  box-shadow: 0 6px 15px rgba(255, 150, 200, 0.2);
}

body.light-mode .gallery-card:hover {
  box-shadow: 0 10px 25px rgba(255, 120, 180, 0.4);
  border-color: #ff7aa2;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    padding: 0 15px 40px;
  }
  
  .gallery-card {
    height: 180px;
  }
}

@media (max-width: 500px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  
  .gallery-card {
    height: 150px;
  }
}

/* 🌸 Lightbox Popup Styling */

/* 1. The full-screen overlay */
.lightbox {
  position: fixed; /* Stays in place even when scrolling */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85); /* Dark, semi-transparent background */
  
  /* Use flexbox to perfectly center the image */
  display: flex;
  justify-content: center;
  align-items: center;

  /* Hide it by default */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000; /* Ensures it's on top of everything */
}

/* 2. Make it visible when active */
.lightbox.active {
  opacity: 1;
  visibility: visible;
}

/* 3. The image inside the lightbox (This is the key part!) */
.lightbox img {
  /* This is the magic! */
  max-width: 90vw;   /* Max width is 90% of the viewport width */
  max-height: 90vh;  /* Max height is 90% of the viewport height */
  
  /* Add some nice visual touches */
  box-shadow: 0 0 35px rgba(255, 122, 162, 0.5);
  border-radius: 10px;
  border: 3px solid white;

  /* A subtle zoom-in animation when it appears */
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

/* 4. The "zoom-in" effect when the lightbox becomes active */
.lightbox.active img {
  transform: scale(1);
}


/* 🌸 Lightbox Navigation Buttons */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  font-size: 2rem;
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 1001;
}

.lightbox-nav:hover {
  background: rgba(0, 0, 0, 0.7);
}

.lightbox-nav.prev {
  left: 10px;
  border-radius: 5px 0 0 5px;
}

.lightbox-nav.next {
  right: 10px;
  border-radius: 0 5px 5px 0;
}

/* In gallery.css */

/* 🌸 Lightbox Action Buttons */
.lightbox-action-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s ease;
  z-index: 1001;
}

.lightbox-action-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.lightbox-action-btn svg {
  width: 20px;
  height: 20px;
  stroke: white; /* Use stroke for line-based icons */
  stroke-width: 2;
  fill: none;
}

.lightbox-action-btn::after {
  content: attr(aria-label);
  position: absolute;
  top: 120%; 
  left: 50%;
  transform: translateX(-50%);
  
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.8rem;
  white-space: nowrap;
  
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.lightbox-action-btn:hover::after {
  opacity: 1;
  visibility: visible;
  top: 110%; 
}

/* NEW: Specific positioning for the "Open in New Tab" button's tooltip */
.lightbox-action-btn.open-btn::after {
  left: auto; /* Reset left positioning */
  right: 0;   /* Position from the right edge of its parent (.open-btn) */
  transform: translateX(0); /* Remove the left:50% and translateX(-50%) */
}

/* Optional: If you want the download button's tooltip to also align to its right */
.lightbox-action-btn.download-btn::after {
  left: auto;
  right: 0;
  transform: translateX(0);
}

.lightbox-action-btn.download-btn {
  right: 65px; /* (15px margin + 40px button width + 10px gap) */
}



/* In gallery.css, add this after your lightbox styles */

/* 🌸 Lightbox Loader */
.lightbox-loader {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ff7aa2; /* Your romantic pink color */
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: spin 1s linear infinite;
  display: none; /* Hidden by default */
  z-index: 1002;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Add a transition to the lightbox image for fading */
.lightbox img {
  /* ... (keep all your existing styles like max-width, max-height, etc.) */
  transition: opacity 0.3s ease-in-out;
}

/* Optional styling for the sort button in gallery.css */
.gallery-controls {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.nice-button {
  background: rgba(255, 102, 170, 0.6);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: url('../images/cursor/hover.png') 16 16, pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.nice-button:hover {
  background: #ff66aa;
  transform: translateY(-2px);
}

body.light-mode .nice-button {
  background: #ff99cc;
  color: #5c0033;
}
