/* Gallery Carousel and Room Grid Styling */

.gallery-section {
  position: relative;
  overflow: hidden;
}

/* Carousel Scroller Container */
.gallery-carousel-wrapper {
  position: relative;
  margin: var(--spacing-lg) 0;
}

.scroller {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none; /* Hide default scrollbar Firefox */
  -ms-overflow-style: none;  /* Hide scrollbar IE/Edge */
  padding: var(--spacing-lg) 0;
  gap: var(--spacing-lg);
  padding-left: calc(50vw - 260px); /* Center snap-aligned items visually */
  padding-right: calc(50vw - 260px);
}

.scroller::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

/* Scroller Slide Entry */
.entry {
  flex: 0 0 520px;
  width: 520px;
  scroll-snap-align: center;
  list-style: none;
  
  /* Establish this element as a scroll-state query container for snap highlights */
  container-type: scroll-state;
}

@media (max-width: 768px) {
  .scroller {
    padding-left: calc(50vw - 165px);
    padding-right: calc(50vw - 165px);
    gap: var(--spacing-md);
  }
  .entry {
    flex: 0 0 330px;
    width: 330px;
  }
}

@media (max-width: 480px) {
  .scroller {
    padding-left: calc(50vw - 145px);
    padding-right: calc(50vw - 145px);
  }
  .entry {
    flex: 0 0 290px;
    width: 290px;
  }
}

/* Inner card that holds the content and visual formatting */
.gallery-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
  
  /* Shared transitions for normal hover and snapped states */
  transition: 
    scale 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
    opacity 0.4s ease,
    box-shadow 0.4s ease,
    border-color 0.4s ease;
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
}

.gallery-card-content {
  padding: var(--spacing-md);
}

.gallery-card h3 {
  font-size: 1.35rem;
  margin-bottom: var(--spacing-xs);
}

.gallery-card p {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Carousel Action Buttons */
.carousel-btn-container {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.carousel-btn {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  width: 50px;
  height: 50px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.carousel-btn:hover {
  background-color: var(--color-primary);
  color: var(--color-bg);
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.carousel-btn svg {
  width: 24px;
  height: 24px;
}

/* 
=========================================
SCROLL-DRIVEN ANIMATIONS (NATIVE SUPPORT)
=========================================
*/
@supports ((animation-timeline: view()) and (animation-range: entry)) {
  @keyframes carousel-slide {
    0% {
      scale: 0.85;
      opacity: 0.4;
    }
    50% {
      scale: 1;
      opacity: 1;
    }
    100% {
      scale: 0.85;
      opacity: 0.4;
    }
  }

  /* Apply the animation to each slide's card container, using an anonymous view timeline on the inline axis */
  .scroller > .entry > .gallery-card {
    animation: carousel-slide auto linear both;
    animation-timeline: view(inline);
    animation-range: cover 0% cover 100%;
  }
}

/*
===================================================
CONTAINER SCROLL-STATE SNAPPED HIGHLIGHTS
===================================================
Only show highlights for users who do not request reduced motion.
*/
@media (prefers-reduced-motion: no-preference) {
  /* Style card elements when their parent .entry container is snapped */
  @supports (container-type: scroll-state) {
    @container scroll-state(snapped: x) {
      .gallery-card {
        scale: 1.03;
        box-shadow: var(--shadow-lg);
        border-color: var(--color-accent);
      }
      
      .gallery-card h3 {
        color: var(--color-accent);
      }
    }
  }
  
  /* CSS Fallback for browsers executing JS IntersectionObserver fallback */
  .entry.is-snapped > .gallery-card {
    scale: 1.03;
    box-shadow: var(--shadow-lg);
    border-color: var(--color-accent);
  }
  
  .entry.is-snapped > .gallery-card h3 {
    color: var(--color-accent);
  }
}

/* Motion Sensitivity Override */
@media (prefers-reduced-motion: reduce) {
  .gallery-card {
    transition: none !important;
    scale: 1 !important;
    opacity: 1 !important;
  }
  
  .scroller > .entry > .gallery-card {
    animation: none !important;
  }
  
  .entry.is-snapped > .gallery-card,
  @container scroll-state(snapped: x) {
    .gallery-card {
      scale: 1 !important;
      box-shadow: var(--shadow-sm) !important;
      border-color: var(--color-border) !important;
    }
  }
}

/* Secondary Section: Grid View of Alpine Attractions */
.attractions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
}

.attraction-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.attraction-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.attraction-img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
}

.attraction-content {
  padding: var(--spacing-md);
}

.attraction-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  background-color: rgba(var(--color-primary-rgb), 0.1);
  color: var(--color-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-xs);
}

/* Gallery Filter Tabs */
.gallery-filter-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.filter-btn {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover,
.filter-btn.active {
  background-color: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
}

/* Grid Layout */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--spacing-md);
}

.grid-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  aspect-ratio: 3/2;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), opacity 0.3s ease;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grid-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

