/* --- SLIDESHOW LAYOUT & POSTER (Extracted from _slideshow-media.css) --- */

@layer regular {
  .slideshow-poster {
      float: right;
      width: var(--ss-desktop-main-w, 500px);
      aspect-ratio: 2 / 3;
      border-radius: 8px;
      overflow: visible;
      cursor: default;
      box-shadow: none;
      border: 1px solid #000;
      flex-shrink: 0;
      z-index: 1;
      transition: box-shadow 0.3s ease, transform 0.3s ease;
      transform: translateY(0);
      position: relative;
      background: transparent;
  }
}

/* Fullscreen toggle button over poster (upper-left) */
.ss-fs-toggle-button {
    display: none;
}

/* Mobile responsive adjustments for poster */
@media (max-width: 768px) {
    .slideshow-poster {
        width: 150px;
        height: 225px;
        float: none;
        margin: 20px auto 15px auto;
        transform: translateX(-80px);
        overflow: visible;
        position: relative;
        border-radius: 5px;
    }
    .slideshow-poster img { border-radius: 5px; }

    .slideshow-poster.expanded {
        width: 100vw;
        height: auto;
        max-height: 80vh;
        margin: 0 auto 15px auto;
        transform: translateX(0);
    }
}

.slideshow-poster::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: var(--ss-curr-poster);
    background-size: cover;
    background-position: center;
    border-radius: inherit;
    filter: blur(5px) saturate(1.25) brightness(1.1);
    opacity: 0.35;
    transform: scale(1.015);
}

.slideshow-poster:hover::before {
    animation: sideGlowPulse 10s ease-in-out infinite;
}

/* Fullscreen Mode Styles: Positioned centered in the right 2/5 (40%) of the screen */
@layer fullscreen {
  .slideshow-overlay.fs-mode .slideshow-poster {
      position: fixed !important;
      top: 50% !important;
      left: 80% !important; /* Center of the right 40% (2/5) of screen */
      right: auto !important;
      bottom: auto !important;
      transform: translate(-50%, -50%) !important;
      height: 85vh !important;
      aspect-ratio: 2 / 3 !important;
      width: auto !important;
      min-width: 0 !important;
      max-width: 38vw !important;
      margin: 0 !important;
      z-index: 0 !important;
      border-radius: 12px !important;
      border: 1px solid #000 !important;
      float: none !important;
      box-shadow: 0 20px 60px rgba(0,0,0,0.9) !important;
      background: transparent !important;
      pointer-events: none !important;
      /* Disable transitions while animating or in FS mode to prevent drifting */
      transition: opacity 0.5s ease, box-shadow 0.3s ease !important;
  }

  /* Specifically disable transform transitions when entering/exiting to prevent "double" movement */
  .slideshow-overlay.fs-mode .slideshow-poster.fs-enter,
  .slideshow-overlay.fs-mode .slideshow-poster.fs-enter-fast,
  .slideshow-overlay.fs-mode .slideshow-poster.fs-exit,
  .slideshow-overlay.fs-mode .slideshow-poster.fs-exit-right {
      transition: none !important;
  }

  .slideshow-overlay.fs-mode .slideshow-poster img {
      border-radius: 12px;
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: center;
      display: block;
      pointer-events: auto;
  }
}

/* FS Mode Poster Animations - Updated for center-aligned translationX/Y */
@keyframes fsPosterZoomOut {
    from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    to { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}

@keyframes fsPosterWobbleIn {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    40% { transform: translate(-50%, -50%) scale(1.08) rotate(1deg); opacity: 1; }
    70% { transform: translate(-50%, -50%) scale(0.98) rotate(-1deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
}

/* NEW: FS Mode slide-out to the right for the current poster */
@keyframes fsPosterSlideOutRight {
    from { transform: translate(-50%, -50%); opacity: 1; }
    to   { transform: translate(150vw, -50%); opacity: 0; }
}

/* NEW: FS Mode fast slide / zoom-in from the right for the next poster */
@keyframes fsPosterSlideInRightFast {
    0%   { transform: translate(100vw, -50%) scale(0.9); opacity: 0; }
    60%  { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.slideshow-overlay.fs-mode .slideshow-poster.fs-exit {
    animation: fsPosterZoomOut 0.5s ease-in forwards;
}

.slideshow-overlay.fs-mode .slideshow-poster.fs-enter {
    animation: fsPosterWobbleIn 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* NEW: class hooks for the new right-side animations */
.slideshow-overlay.fs-mode .slideshow-poster.fs-exit-right {
    animation: fsPosterSlideOutRight 0.45s ease-in forwards;
}

.slideshow-overlay.fs-mode .slideshow-poster.fs-enter-fast {
    animation: fsPosterSlideInRightFast 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Hide mobile actions in FS mode */
.slideshow-overlay.fs-mode .ss-mobile-actions {
    display: none !important;
}

/* Ensure controls stay above the fullscreen poster and fixed to right */
.slideshow-overlay.fs-mode .slideshow-controls-container {
    z-index: 30010 !important;
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 2vw !important;
    width: 56px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    left: auto !important;
}

/* Ensure cast area stays above the fullscreen poster */
.slideshow-overlay.fs-mode .slideshow-cast-area {
    z-index: 30006 !important;
}

.ss-fs-title-container {
    display: none;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.slideshow-overlay.fs-mode .ss-fs-title-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    flex-shrink: 1;
    min-width: 0;
}

.ss-fs-title {
    display: none;
}

.slideshow-overlay.fs-mode .ss-fs-title {
    display: block;
    position: static;
    font-size: 20pt;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Cinzel Decorative', 'Abril Fatface', cursive;
    margin: 0;
    padding: 0 0 0 15px;
    flex-shrink: 1;
    min-width: 0;
}

.ss-fs-description {
    display: none;
}

.slideshow-overlay.fs-mode .ss-fs-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 16.5pt;
    color: #e0e0e0;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
    margin: 0;
    padding: 0 0 0 15px;
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    line-height: 1.35;
}

:root[data-show-slideshow-description="false"] .ss-fs-description {
    display: none !important;
}

.ss-fs-icons {
    display: none;
}

.slideshow-overlay.fs-mode .ss-fs-icons {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    margin-bottom: 10px;
    padding: 0 0 0 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.slideshow-overlay.fs-mode .ss-fs-icons .ss-fs-runtime {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14pt;
    color: #ffffff;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}

.slideshow-overlay.fs-mode .ss-fs-icons .ss-fs-runtime svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    display: inline-block;
    vertical-align: middle;
}

.slideshow-overlay.fs-mode .ss-fs-icons .mpa-rating-badge {
    font-size: 11pt;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1.5px solid #ffffff;
    font-weight: 700;
    color: #ffffff;
    text-shadow: none;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.slideshow-overlay.fs-mode .ss-fs-icons .ss-vote {
    font-size: 14pt;
    font-weight: 700;
    color: var(--primary-color, #e50914);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}

.slideshow-overlay.fs-mode .ss-fs-icons .ss-release-inline {
    font-size: 14pt;
    color: #ffffff;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}

:root[data-show-slideshow-icons="false"] .ss-fs-icons {
    display: none !important;
}

.slideshow-poster.paused-long {
    animation: pulseImage 3s ease-in-out infinite;
    transition: none;
}

.slideshow-poster img {
    width: 100%;
    height: 100%; 
    display: block;
    object-fit: cover;
    transition: opacity 0.5s ease; 
    border-radius: 8px;
}

/* Mobile Actions */
.ss-mobile-actions {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    left: 100%;          
    bottom: 0;           
    top: auto;
    transform: none;
    padding-left: 10px;  
    gap: 10px;           
    align-items: center;
    z-index: 10;
}

.ss-mobile-btn {
    width: 100px;
    height: 37px;
    cursor: pointer;
    display: block;
    transition: transform 0.2s ease;
}
.ss-mobile-btn:hover {
    transform: scale(1.05);
}
.ss-mobile-btn.preview-mobile { order: 2; }
.ss-mobile-btn.listen-mobile { order: 1; }

@layer regular {
  @media (min-width: 769px) {
      .slideshow-poster {
          margin-top: 120px;
          width: 500px;
          height: 750px;
          aspect-ratio: auto;
      }
      .slideshow-overlay.single-item-slideshow .slideshow-poster {
          margin-top: 60px; /* Adjusted to remain 20px lower */
      }
  }

  @media (max-width: 768px) {
    .slideshow-poster {
        width: 150px;
        height: 225px;
        float: none;
        margin: 20px auto 15px auto;
        transform: translateX(-80px);
        overflow: visible;
        position: relative;
        border-radius: 5px;
    }
    .slideshow-poster img { border-radius: 5px; }

    .slideshow-poster.expanded {
        width: 100vw;
        height: auto;
        max-height: 80vh;
        margin: 0 auto 15px auto;
        transform: translateX(0);
    }
  }
}