/* --- SLIDESHOW LAYOUT (Extracted from _slideshow-base.css) --- */

/* Full-screen slideshow overlay */
.slideshow-overlay.fs-mode {
    overflow: hidden !important; /* No scrollbars in FS mode */
}

.slideshow-overlay {
  position: fixed; 
  inset: 0; 
  z-index: 30000;
  background: var(--primary-color);
  display: flex; 
  flex-direction: column;
  justify-content: flex-start; 
  align-items: center;
  overflow: hidden;
  padding: 4vh 4vw; 
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  contain: layout style paint;
}

/* NEW: Transparency toggle (outer background) */
:root[data-ss-transparency="true"] .slideshow-overlay {
  background-color: rgba(var(--primary-color-rgb), 0.2);
}

/* When off: opaque */
:root[data-ss-transparency="false"] .slideshow-overlay {
  background-color: var(--primary-color);
}

/* Header for close button and theme toggle */
.slideshow-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2vh 2vw;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    pointer-events: none; 
    z-index: 30001;
}

/* Hide the close icon in the slideshow's upper-right corner */
.slideshow-close-button {
    display: none !important;
}

.slideshow-close-button {
    font-size: 2rem;
    right: calc(2vw + 36px + 5px); 
}

/* Main Content Area */
.slideshow-description-container {
    width: 90%;
    max-width: 1560px;
    background-color: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    padding: calc(25px * 0.7); 
    margin-top: 10px; 
    padding-bottom: calc(115px * 0.7); 
    color: #fff !important; 
    flex-shrink: 0;
    position: relative;
    contain: layout style;
}

/* NEW: Transparency toggle (inner background window) */
:root[data-ss-transparency="true"] .slideshow-description-container {
    background-color: rgba(20, 20, 20, 0.2);
}

/* When off: opaque */
:root[data-ss-transparency="false"] .slideshow-description-container {
    background-color: rgba(20, 20, 20, 1);
}

/* Fullscreen Mode: Hide inner window chrome and other UI elements */
.slideshow-overlay.fs-mode .slideshow-description-container {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Fullscreen Mode: Poster‑driven background that reflects current image */
.slideshow-overlay.fs-mode {
    /* Keep fullscreen layout/positioning from the base .slideshow-overlay,
       but move the poster-based background into a blurred ::before layer
       so we can animate its opacity separately. */
    position: fixed;
    inset: 0;
    overflow: hidden;
    /* Remove direct background image here; it will be provided by ::before */
    background: radial-gradient(circle at center, rgba(0,0,0,0.25), rgba(0,0,0,0.9));
}

/* Heavily blurred fullscreen poster background layers with crossfade:
   - ::before holds the current blurred background (var(--ss-bg-poster))
   - ::after holds the incoming staged blurred background (var(--ss-next-poster))
   We keep the existing background visible until the next has loaded and faded in. */
.slideshow-overlay.fs-mode::before,
.slideshow-overlay.fs-mode::after {
    content: "";
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    filter: blur(30px) saturate(1.1) brightness(1.02);
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.9s ease;
}

/* current visible blurred poster */
.slideshow-overlay.fs-mode::before {
    background:
      radial-gradient(circle at center, rgba(0,0,0,0.25), rgba(0,0,0,0.9)),
      var(--ss-bg-poster, none);
    opacity: 1;
}

/* staged next blurred poster starts invisible */
.slideshow-overlay.fs-mode::after {
    background: var(--ss-next-poster, none);
    opacity: 0;
}

/* when a next poster is staged, add class to trigger crossfade */
.slideshow-overlay.fs-mode.ss-bg-switching::after {
    /* fade the staged background in */
    opacity: 1;
}

/* Once the staged background is visible, the JS will commit it into --ss-bg-poster
   and remove the ss-bg-switching class, leaving ::after empty again. */

/* FS Background Composition Modes
   - tiles: many small repeated poster tiles (visually balanced)
   - dual: two large poster layers offset for balance
   - dual-zoom: two large layers where 2nd is zoomed in 50%
   - single-zoom: a single poster zoomed in for dramatic crop
   Mode is selected by JS adding one of:
     ss-bg-mode-tiles, ss-bg-mode-dual, ss-bg-mode-dual-zoom, ss-bg-mode-single-zoom
   The renderer sets --ss-bg-poster and --ss-bg-poster-2 (if needed) as url('...')
   --ss-bg-seed-x / --ss-bg-seed-y provide small offsets.
*/
@media (prefers-reduced-motion: no-preference) {
  /* Default: current blurred poster */
  .slideshow-overlay.fs-mode::before {
    background:
      radial-gradient(circle at center, rgba(0,0,0,0.25), rgba(0,0,0,0.9)),
      var(--ss-bg-poster, none);
    opacity: 1;
  }

  /* Tiles mode: repeated, smaller versions of the poster grid with subtle blur */
  .slideshow-overlay.fs-mode.ss-bg-mode-tiles::before {
    background:
      radial-gradient(circle at center, rgba(0,0,0,0.25), rgba(0,0,0,0.85)),
      var(--ss-bg-poster, none);
    background-size: 24% 24%, cover;
    background-repeat: repeat, no-repeat;
    background-position: center;
    filter: blur(36px) saturate(1.15) brightness(1.05);
    opacity: 0.95;
  }

  /* Dual mode: two complementary blurred layers. ::before holds the primary,
     ::after holds the second layer which is offset by seed variables */
  .slideshow-overlay.fs-mode.ss-bg-mode-dual::before {
    background:
      radial-gradient(circle at center, rgba(0,0,0,0.18), rgba(0,0,0,0.9)),
      var(--ss-bg-poster, none);
    background-size: cover;
    filter: blur(30px) saturate(1.05) brightness(1.02);
    opacity: 1;
    transform-origin: center;
  }
  .slideshow-overlay.fs-mode.ss-bg-mode-dual::after {
    background: var(--ss-bg-poster-2, none);
    background-size: cover;
    background-position: calc(50% + var(--ss-bg-seed-x, 0px)) calc(50% + var(--ss-bg-seed-y, 0px));
    filter: blur(28px) saturate(1.1) brightness(1.05);
    opacity: 0.82;
    transform: scale(1.03);
    transition: opacity 900ms ease, transform 900ms ease;
  }

  /* Dual zoom mode: secondary layer is noticeably zoomed-in for a powerful crop */
  .slideshow-overlay.fs-mode.ss-bg-mode-dual-zoom::before {
    background:
      radial-gradient(circle at center, rgba(0,0,0,0.18), rgba(0,0,0,0.9)),
      var(--ss-bg-poster, none);
    filter: blur(28px) saturate(1.05) brightness(1);
    opacity: 1;
  }
  .slideshow-overlay.fs-mode.ss-bg-mode-dual-zoom::after {
    background: var(--ss-bg-poster-2, none);
    background-size: 160% 160%;
    background-position: calc(50% + var(--ss-bg-seed-x, 0px)) calc(50% + var(--ss-bg-seed-y, 0px));
    filter: blur(20px) saturate(1.08) brightness(1.06);
    opacity: 0.9;
    transform: translateY(0);
    transition: opacity 900ms ease, transform 900ms ease;
  }

  /* Single zoom: use just the primary poster, zoomed to emphasize detail */
  .slideshow-overlay.fs-mode.ss-bg-mode-single-zoom::before {
    background:
      radial-gradient(circle at center, rgba(0,0,0,0.15), rgba(0,0,0,0.9)),
      var(--ss-bg-poster, none);
    background-size: 140% 140%;
    background-position: calc(50% + var(--ss-bg-seed-x, 0px)) calc(50% + var(--ss-bg-seed-y, 0px));
    filter: blur(26px) saturate(1.12) brightness(1.08);
    opacity: 1;
  }
}

/* Backwards-compat: keep the explicit delayed fade-in keyframe for any legacy flows */
@keyframes fsBgFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Ensure inner content sits above the blurred background layer */
.slideshow-overlay.fs-mode .slideshow-description-container,
.slideshow-overlay.fs-mode .slideshow-controls-container,
.slideshow-overlay.fs-mode .slideshow-cast-area {
    position: relative;
    z-index: 1;
}

/* Keep chrome off on top of the fullscreen image */
.slideshow-overlay.fs-mode .slideshow-header,
.slideshow-overlay.single-item-slideshow .slideshow-info-bar {
    display: none !important;
}

@media (min-width: 769px) {
  :root[data-bg-desktop-hidden="false"] .slideshow-overlay {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

@media (max-width: 768px) {
    .slideshow-description-container {
        width: 100%;
        margin-top: 70px; 
        padding: 15px;
        padding-bottom: 0; 
    }
    .slideshow-overlay.single-item-slideshow .slideshow-description-container {
        margin-top: 10px; /* Move 60px higher on mobile */
    }
}