/* ============================================
   SCROLL-SNAP CAROUSEL - Clean & Resilient
   ============================================ */

/* Reset for carousel */
.ym-carousel * { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --wine: #6E0E1E;
  --ivory: #FAF6F1;
  --warm-gray: #5C5C5C;
  --soft-gold: #C9B27B;
  --transition: 320ms cubic-bezier(.22,.61,.36,1);
}

/* Container - Override conflicting styles */
.ym-carousel,
.ym-carousel.photo-carousel {
  position: relative;
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
  z-index: 1;
  isolation: isolate;
  height: auto !important;
  overflow: visible !important;
}

/* Scroll container */
.ym-track {
  display: flex !important;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  gap: 1rem;
  padding: 0.5rem 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  height: auto !important;
  position: relative !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
}

.ym-track::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Slides - size to content */
.ym-slide {
  flex: 0 0 auto;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  position: relative !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  opacity: 1 !important;
  transform: none !important;
  top: auto !important;
  left: auto !important;
}

/* Frame wrapper - syncs to image aspect ratio */
.ym-frame {
  position: relative;
  width: auto;
  height: clamp(520px, 65vh, 720px);
  aspect-ratio: var(--img-ratio, 3/2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transition: box-shadow var(--transition);
  flex-shrink: 0;
}

/* Main image - no cropping */
.ym-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Orientation-specific tweaks - Desktop */
@media (min-width: 1024px) {
  /* Frame sizing handled by aspect-ratio */
  .ym-slide.is-portrait .ym-frame {
    /* Narrower for portraits */
  }

  .ym-slide.is-landscape .ym-frame {
    /* Wider for landscapes */
  }
}

/* Active slide styling - subtle wine hairline */
.ym-slide.active .ym-frame {
  box-shadow:
    inset 0 0 0 0.5px var(--wine),
    0 8px 32px rgba(0,0,0,0.12);
}

/* Captions - centered under frame */
.ym-caption {
  text-align: center;
  padding: 1rem 1rem 0;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ym-caption-title {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: var(--wine);
  margin-bottom: 0.25rem;
  white-space: nowrap;
}

.ym-caption-meta {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: var(--warm-gray);
  font-style: italic;
  white-space: nowrap;
}

/* Navigation */
.ym-nav {
  display: flex !important;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
  position: relative;
  z-index: 100;
  clear: both;
}

.ym-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--wine);
  color: white;
  border: 2px solid var(--wine);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: all 0.4s ease;
  font-size: 20px;
  padding: 0;
  z-index: 100;
}

.ym-btn:hover {
  background: white;
  color: var(--wine);
  border: 2px solid var(--wine);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 20px rgba(110, 14, 30, 0.15);
}

.ym-btn:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}

/* Arrow characters */
.ym-prev::after {
  content: '‹';
  font-size: 28px;
  line-height: 1;
}

.ym-next::after {
  content: '›';
  font-size: 28px;
  line-height: 1;
}

/* Timeline */
.ym-timeline {
  position: relative;
  width: 100%;
  max-width: 300px;
  height: 2px;
  background: rgba(110,14,30,0.2);
  margin: 1.5rem auto 2rem;
  border-radius: 1px;
  z-index: 50;
}

.ym-progress {
  height: 100%;
  background: var(--wine);
  transition: width var(--transition);
  border-radius: 1px;
}

.ym-segments {
  position: absolute;
  top: -8px;
  width: 100%;
  height: 18px;
  display: flex;
}

.ym-segment {
  flex: 1;
  cursor: pointer;
  background: transparent;
  border: none;
}

/* Mobile adjustments */
@media (max-width: 1023px) {
  .ym-frame {
    width: 100%;
    height: auto;
    /* Height computed from aspect-ratio */
  }

  .ym-slide {
    flex: 0 0 100%;
  }
}

@media (max-width: 640px) {
  .ym-track { gap: 0.75rem; }

  .ym-frame {
    border-radius: 8px;
  }

  .ym-nav {
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .ym-btn {
    width: 44px;
    height: 44px;
  }

  .ym-prev::after,
  .ym-next::after {
    font-size: 24px;
  }
}

/* Very small screens */
@media (max-width: 374px) {
  .ym-caption-title { font-size: 1.05rem; }
  .ym-caption-meta { font-size: 0.85rem; }

  .ym-btn {
    width: 40px;
    height: 40px;
  }

  .ym-prev::after,
  .ym-next::after {
    font-size: 22px;
  }
}

/* Large screens */
@media (min-width: 1441px) {
  .ym-carousel { margin: 3rem auto; }
  .ym-frame {
    height: clamp(560px, 68vh, 800px);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .ym-track { scroll-behavior: auto; }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}