/* =============================================================================
   GALLERY PAGE STYLES (Updated)
   Purpose:
   - Clean, responsive gallery layout with accessible pagination controls
   - Brand-locked colors (Grenier): #2e0c5e (Deep Royal Purple), #facc15 (Amber)
   - Smooth, reduced-motion-friendly transitions
   - Consistent “page show/hide” behavior (single source of truth)
   - Lightbox modal styling matched to brand
   ========================================================================== */

/* ============================================================================
   THEME TOKENS (Brand Lock v50.0)
   ========================================================================== */
:root {
  --brand-purple: #2e0c5e; /* Deep Royal Purple */
  --brand-amber: #facc15; /* Vibrant Amber Yellow-Gold */
  --ink-900: #1a1a1a; /* Very dark neutral */
  --ink-700: #2c3e50; /* Deep slate for headings */
  --ink-600: #333333; /* Dark neutral text */
  --ink-500: #6c757d; /* Muted body text */
  --bg-100: #f8f9fa; /* Light neutral background */
  --bg-200: #f0f0f0; /* Light skeleton shimmer */
  --bg-300: #e0e0e0; /* Neutral fallback/skeleton */
  --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.15);
  --radius-md: 12px;
  --radius-lg: 15px;
  --space-xl: 80px;
  --space-lg: 60px;
  --space-md: 50px;
  --space-sm: 40px;
  --trans-fast: 0.2s ease-out;
  --trans-med: 0.3s ease;
  --trans-slow: 0.5s ease-in-out;
}

/* Prefer reduced motion: tone down transitions/animations for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================================
   SECTION: GALLERY SECTION WRAPPER
   ========================================================================== */

.gallery__section,
#gallery-section {
  /* Keep both selectors to support existing markup */
  padding: var(--space-xl) 0;
  background-color: var(--bg-100); /* #f8f9fa */
  min-height: 100vh;
}

.gallery__section.overhid {
  overflow: hidden;
}

/* On smaller screens, tighten vertical rhythm */
@media (max-width: 991px) {
  .gallery__section,
  #gallery-section {
    padding: var(--space-lg) 0;
  }
}
@media (max-width: 767px) {
  .gallery__section,
  #gallery-section {
    padding: var(--space-md) 0;
  }
}
@media (max-width: 575px) {
  .gallery__section,
  #gallery-section {
    padding: var(--space-sm) 0;
  }
}

/* Optional top offset for pages where header overlaps; keep !important as before */
#gallery-section {
  padding-top: 200px !important; /* preserves your original spacing to clear logo/nav */
  padding-bottom: 100px !important;
}

/* ============================================================================
   SECTION: TITLE BLOCK
   ========================================================================== */

.gallery__title-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-md);
  padding-bottom: 0; /* unify spacing here; headline uses underline accent */
  text-align: center;
}

.gallery__title {
  font-size: 3rem;
  font-weight: 700;
  color: var(--ink-900); /* #1a1a1a */
  letter-spacing: 2px;
  position: relative;
  display: inline-block;
  padding-bottom: 15px;
  text-transform: uppercase;
}

/* Brand underline: purple → amber gradient */
.gallery__title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--brand-purple) 0%,
    var(--brand-amber) 100%
  );
  border-radius: 2px;
}

/* Title responsiveness */
@media (max-width: 1199px) {
  .gallery__title {
    font-size: 2.5rem;
  }
}
@media (max-width: 991px) {
  .gallery__title {
    font-size: 2.2rem;
  }
}
@media (max-width: 767px) {
  .gallery__title {
    font-size: 2rem;
    letter-spacing: 1px;
  }
}
@media (max-width: 575px) {
  .gallery__title {
    font-size: 1.8rem;
  }
}

/* ============================================================================
   SECTION: PAGE VISIBILITY (Single source of truth)
   - Avoid duplicates by defining once and reusing everywhere.
   ========================================================================== */

.gallery-page {
  display: none;
  opacity: 0;
  transition: opacity var(--trans-slow);
  /* When using flex layout for grid children (cards) */
  flex-wrap: wrap;
}

.gallery-page.active {
  display: flex;
  opacity: 1;
}

/* ============================================================================
   SECTION: GALLERY CARDS (Service Items)
   ========================================================================== */

.service__items {
  background: #ffffff; /* White card */
  border-radius: var(--radius-md); /* 12px */
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--trans-med), box-shadow var(--trans-med);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.service__items:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-md);
}

/* Thumbnail area (16:9 by default; fixed height fallback kept for legacy) */
.service__thumb {
  position: relative;
  width: 100%;
  height: 250px; /* Legacy height */
  overflow: hidden;
  background-color: #000000; /* Black fallback when image not ready */
  aspect-ratio: 16 / 9; /* Modern ratio control; height acts as fallback */
  cursor: pointer;
}

/* Responsive thumb heights when legacy height is preferred */
@media (max-width: 1199px) {
  .service__thumb {
    height: 220px;
  }
}
@media (max-width: 991px) {
  .service__thumb {
    height: 200px;
  }
}
@media (max-width: 767px) {
  .service__thumb {
    height: 220px;
  }
}
@media (max-width: 575px) {
  .service__thumb {
    height: 200px;
  }
}

/* Image fill */
.service__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s ease, opacity 0.3s ease;
}

.service__items:hover .service__thumb img {
  transform: scale(1.1);
  opacity: 0.9;
}

/* Card content */
.service__content {
  padding: 25px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

@media (max-width: 991px) {
  .service__content {
    padding: 20px 15px;
  }
}

.service__content h4 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink-700); /* #2c3e50 */
  margin-bottom: 12px;
  line-height: 1.4;
}

@media (max-width: 767px) {
  .service__content h4 {
    font-size: 1.2rem;
  }
}

.service__content h4 a {
  color: inherit;
  text-decoration: none;
  transition: color var(--trans-med);
  outline: none;
}

.service__content h4 a:hover,
.service__content h4 a:focus-visible {
  color: var(--brand-amber); /* #facc15 */
}

.service__content p {
  font-size: 0.95rem;
  color: var(--ink-500); /* #6c757d */
  line-height: 1.6;
  margin: 0;
  flex: 1;
}

@media (max-width: 767px) {
  .service__content p {
    font-size: 0.9rem;
  }
}

/* Optional hover overlay with icon (kept from your later block) */
.service__thumb-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4); /* Semi-transparent black */
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity var(--trans-med);
}
.service__thumb:hover .service__thumb-overlay {
  opacity: 1;
}

.service__thumb-overlay i {
  font-size: 48px;
  color: #ffffff; /* White */
}

/* ============================================================================
   SECTION: PAGINATION CONTROLS (Buttons + Legacy Links)
   ========================================================================== */

.gallery-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: var(--space-md);
  padding: 20px 0;
}

.gallery-pagination button {
  padding: 10px 20px;
  background-color: #ffffff; /* White */
  border: 2px solid var(--bg-300); /* #e0e0e0 */
  border-radius: 8px; /* slightly larger radius for touch */
  color: var(--ink-600); /* #333333 */
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--trans-med), background-color var(--trans-med),
    border-color var(--trans-med), color var(--trans-med),
    box-shadow var(--trans-med);
  outline: none;
}

.gallery-pagination button:hover,
.gallery-pagination button:focus-visible {
  background-color: var(--brand-amber); /* #facc15 */
  border-color: var(--brand-amber);
  color: #1a1a1a; /* dark text on amber for contrast */
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(250, 204, 21, 0.35); /* amber glow */
}

.gallery-pagination button.active {
  background-color: var(--brand-purple); /* #2e0c5e */
  border-color: var(--brand-purple);
  color: #ffffff;
}

/* Tighten layout on very small screens */
@media (max-width: 575px) {
  .gallery-pagination {
    flex-wrap: wrap;
    gap: 8px;
  }
  .gallery-pagination button {
    padding: 8px 15px;
    font-size: 0.9rem;
  }
}

/* Legacy numeric pagination link (kept for compatibility) */
.default__pagination li a.active {
  background-color: var(--brand-purple); /* #2e0c5e */
  color: #ffffff;
  border-color: var(--brand-purple);
  font-weight: 700;
}

/* ============================================================================
   SECTION: LOADING & ERROR STATES (Skeleton shimmer; safe, loop-free)
   ========================================================================== */

/* Loading shimmer on the thumbnail container while image decodes */
.service__thumb.loading {
  background: linear-gradient(
    90deg,
    var(--bg-300) 25%,
    var(--bg-200) 50%,
    var(--bg-300) 75%
  );
  background-size: 200% 100%;
  animation: gallery-loading 1.5s infinite;
}

@keyframes gallery-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Hide broken/empty images; JS sets neutral bg on parent to avoid loops */
.service__thumb img[src=""],
.service__thumb img:not([src]) {
  display: none;
}

/* (Note: ::after on <img> has no effect. If you want an alt-text overlay,
   render a sibling element in HTML or via JS when an error occurs.) */

/* ============================================================================
   SECTION: LIGHTBOX MODAL (Brand-styled)
   ========================================================================== */

#image-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65); /* dark scrim */
  z-index: 10000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

#modal-window {
  width: 100%;
  height: 100%;
  max-width: 1100px;
  max-height: 90vh;
  background-color: #ffffff; /* White */
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  border: 3px solid var(--brand-purple); /* Brand frame */
}

#modal-top-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  flex-direction: row-reverse;
  gap: 8px;
}

#modal-top-controls button {
  background: rgba(40, 40, 40, 0.7); /* semi-dark */
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  font-size: 16px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--trans-fast), background-color var(--trans-fast),
    box-shadow var(--trans-fast);
  display: flex;
  justify-content: center;
  align-items: center;
  outline: none;
}

#modal-top-controls button:hover,
#modal-top-controls button:focus-visible {
  transform: scale(1.1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

/* Button-specific brand accent hovers */
#modal-close-btn:hover,
#modal-close-btn:focus-visible {
  background-color: var(--brand-purple); /* Purple close */
}
#fullscreen-btn:hover,
#fullscreen-btn:focus-visible {
  background-color: var(--brand-amber); /* Amber fullscreen */
  color: #1a1a1a;
}
#minimize-btn:hover,
#minimize-btn:focus-visible {
  background-color: var(--brand-amber); /* Amber minimize */
  color: #1a1a1a;
}

#modal-image-container {
  width: 100%;
  height: 100%;
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background-color: #222222; /* deep neutral to frame media */
}

#modal-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform var(--trans-fast);
  cursor: grab;
}

#modal-image.is-dragging {
  cursor: grabbing;
}

/* Zoom slider dock */
#modal-zoom-controls {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(20, 20, 20, 0.65);
  padding: 8px 15px;
  border-radius: 20px;
  border: 2px solid var(--brand-amber); /* subtle brand ring */
}

#zoom-slider {
  cursor: pointer;
  width: 180px;
}

/* Disable body scroll when modal open */
body.modal-open {
  overflow: hidden;
}

/* ============================================================================
   SECTION: BANNER OVERRIDES (Scoped to Gallery Page)
   Purpose: Fix text overlap issues specific to the gallery banner.
   ========================================================================== */

/* 
   Fix for banner text overlap during fade transition:
   Hide animated elements by default. They will be revealed by the animation class.
   Using !important to override any potential conflicts from other stylesheets.
*/
.banner__section .banner__content [data-animation]:not(.animated) {
  opacity: 0 !important;
}

/* Ensure slides have a solid background to prevent transparency overlap during fade */
.banner__section .swiper-slide {
  background-color: #fff; /* or #000 depending on design, safe default */
  z-index: 1; /* Default z-index */
}

.banner__section .swiper-slide.swiper-slide-active {
  z-index: 10; /* Ensure active slide is on top */
}

/* 
   Responsive Aspect Ratio Fix:
   Forces the banner container to maintain a 16:9 ratio (standard video/image format).
   This allows the height to auto-adjust based on width, preventing cropping on wide screens
   and excessive height on mobile.
*/
.banner__section {
  aspect-ratio: 21 / 9 !important; /* Reduced height by ~25% (Ultrawide) */
  height: auto !important; /* Override fixed 100vh */
  min-height: unset !important; /* Allow it to shrink if needed */
}

/* Ensure the slider and images fill this new responsive container */
.banner__slider,
.banner__image {
  height: 100% !important;
  background-size: 100% 100% !important; /* Force fit: No crop, no bars (Stretches if ratio differs) */
  background-position: center center !important;
  background-repeat: no-repeat !important;
}
/* ================================================================= */
/* ================================================================= */
/* ================================================================= */
/*       BANNER SLIDER CONTENT BOTTOM POSITIONING OVERRIDE            */
/* ================================================================= */
/* ================================================================= */
/* ================================================================= */
/*  PURPOSE: Force all banner slide content to the bottom position    */
/*  This section overrides ALL other banner content styles            */
/* ================================================================= */
/* ================================================================= */
/* ================================================================= */

/* ================================================================= */
/* SWIPER SLIDES - FORCE RELATIVE POSITIONING                         */
/* ================================================================= */
.banner__section .swiper-slide {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
}

/* ================================================================= */
/* BANNER CONTENT CONTAINER - FORCE ABSOLUTE BOTTOM LEFT              */
/* ================================================================= */
.banner__section .swiper-slide .container {
  position: absolute !important;
  bottom: 60px !important;
  left: 250px !important;
  right: auto !important;
  top: auto !important;
  z-index: 10 !important;
  width: auto !important;
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* ================================================================= */
/* ROW - REMOVE BOOTSTRAP CENTERING                                   */
/* ================================================================= */
.banner__section .swiper-slide .container .row {
  margin: 0 !important;
  justify-content: flex-start !important;
}

/* ================================================================= */
/* COLUMN - FORCE LEFT ALIGNMENT                                      */
/* ================================================================= */
.banner__section .swiper-slide .container .row > div {
  padding: 0 !important;
  margin: 0 !important;
  flex: none !important;
  width: auto !important;
  max-width: 800px !important;
}

/* ================================================================= */
/* BANNER CONTENT - FORCE LEFT ALIGNMENT                              */
/* ================================================================= */
.banner__section .swiper-slide .banner__content {
  position: relative !important;
  margin: 0 !important;
  text-align: left !important;
  align-items: flex-start !important;
}

/* ================================================================= */
/* GLASS-TINTED BACKGROUND FOR BANNER TEXT (Ensures Readability)     */
/* ================================================================= */
/* Glass effect is HIDDEN by default - only shows when text animates in */
.banner__section .swiper-slide .banner__content h1,
.banner__section .swiper-slide .banner__content p {
  background-color: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 18px 25px !important;
  border-radius: 10px !important;
  border: none !important;
  margin-bottom: 15px !important;
  color: #ffffff !important;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6) !important;
  transition: background-color 0.5s ease !important;
}

/* GLASS EFFECT APPEARS WITH TEXT ANIMATION */
.banner__section .swiper-slide .banner__content h1.animated,
.banner__section .swiper-slide .banner__content p.animated {
  background-color: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
}

.banner__section .swiper-slide .banner__content p {
  color: #f5f5f5 !important;
  font-size: 1.1rem !important;
  line-height: 1.6 !important;
}

/* ================================================================= */
/* ================================================================= */
/* ================================================================= */
/*       END OF BANNER SLIDER CONTENT BOTTOM POSITIONING OVERRIDE     */
/* ================================================================= */
/* ================================================================= */
/* ================================================================= */

/* ================================================================= */
/* ================================================================= */
/* ================================================================= */
/*    GALLERY SERVICE CONTENT BOTTOM ALIGNMENT - MASTER OVERRIDE     */
/* ================================================================= */
/* ================================================================= */
/* ================================================================= */
/*  PURPOSE: Force all service card content in the gallery section   */
/*           to align to the BOTTOM of each card, regardless of      */
/*           other CSS rules or screen sizes.                         */
/* ================================================================= */
/* ================================================================= */
/* ================================================================= */

/* ================================================================= */
/* GALLERY SERVICE ITEMS - FORCE RELATIVE POSITIONING & FIXED HEIGHT */
/* ================================================================= */
.gallery__section .service__items,
#gallery-section .service__items,
.gallery-page .service__items {
  position: relative !important;
  min-height: 420px !important;
  display: flex !important;
  flex-direction: column !important;
}

/* ================================================================= */
/* GALLERY SERVICE CONTENT - FORCE ABSOLUTE BOTTOM POSITIONING       */
/* ================================================================= */
.gallery__section .service__items .service__content,
#gallery-section .service__items .service__content,
.gallery-page .service__items .service__content {
  position: absolute !important;
  bottom: 20px !important;
  left: 0 !important;
  right: 0 !important;
  top: auto !important;
  padding: 0 20px !important;
  margin: 0 !important;
  width: auto !important;
  box-sizing: border-box !important;
}

/* ================================================================= */
/* RESPONSIVE ADJUSTMENTS FOR GALLERY SERVICE CONTENT                 */
/* ================================================================= */
@media (max-width: 991px) {
  .gallery__section .service__items,
  #gallery-section .service__items,
  .gallery-page .service__items {
    min-height: 400px !important;
  }

  .gallery__section .service__items .service__content,
  #gallery-section .service__items .service__content,
  .gallery-page .service__items .service__content {
    bottom: 15px !important;
    padding: 0 15px !important;
  }
}

@media (max-width: 767px) {
  .gallery__section .service__items,
  #gallery-section .service__items,
  .gallery-page .service__items {
    min-height: 380px !important;
  }

  .gallery__section .service__items .service__content,
  #gallery-section .service__items .service__content,
  .gallery-page .service__items .service__content {
    bottom: 15px !important;
  }
}

@media (max-width: 575px) {
  .gallery__section .service__items,
  #gallery-section .service__items,
  .gallery-page .service__items {
    min-height: 360px !important;
  }

  .gallery__section .service__items .service__content,
  #gallery-section .service__items .service__content,
  .gallery-page .service__items .service__content {
    bottom: 12px !important;
    padding: 0 12px !important;
  }
}

/* ================================================================= */
/* ================================================================= */
/* ================================================================= */
/*    END OF GALLERY SERVICE CONTENT BOTTOM ALIGNMENT OVERRIDE       */
/* ================================================================= */
/* ================================================================= */
/* ================================================================= */
