/* Story Display Modes - Stack and Modal Styles */

/* ============== Stack Styles ============== */
.story-stack {
  position: relative;
  cursor: pointer;
  display: inline-block;
  /* Reserve space for stacked layers peeking below */
  padding-bottom: 14px;
  overflow: visible;
}

.story-stack:focus {
  outline: 2px solid #000;
  outline-offset: 4px;
}

.story-stack__main {
  position: relative;
  z-index: 3;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Colored strips below main image using pseudo-elements on parent */
.story-stack::before,
.story-stack::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 6px;
  pointer-events: none;
}

/* Burgundy strip (closer to image) */
.story-stack::before {
  bottom: 6px;
  background: #681916;
  transform: scale(0.97);
  z-index: 2;
}

/* Purple strip (further from image) */
.story-stack::after {
  bottom: 0;
  background: #2D0060;
  transform: scale(0.94);
  z-index: 1;
}

.story-stack__main img,
.story-stack__thumb {
  width: 100%;
  height: auto;
  display: block;
}

.story-stack__badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #000;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  pointer-events: none;
}

/* ============== Modal Styles ============== */
.story-modal {
  border: none;
  padding: 0;
  max-width: 100vw;
  max-height: 100vh;
  width: 100%;
  height: 100%;
  background: transparent;
  overflow: hidden;
}

.story-modal::backdrop {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.story-modal__viewport {
  overflow: hidden;
  height: 100%;
  width: 100%;
}

.story-modal__container {
  display: flex;
  gap: 1rem;
  height: 100%;
  align-items: center;
  user-select: none;
  -webkit-touch-callout: none;
}

.story-modal__slide {
  flex: 0 0 auto;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  box-sizing: border-box;
  cursor: pointer;
}

.story-modal__thumb {
  max-height: 80vh;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.story-modal__slide mux-player {
  position: absolute;
  inset: 0;
  margin: auto;
  max-height: 80vh;
  max-width: 100%;
  width: 100%;
  height: 100%;
  --controls: none;
  opacity: 0;
  pointer-events: none;
}

/* Hide thumb when video is active (mux-player replaces it) */
.story-modal__slide--active .story-modal__thumb {
  opacity: 0;
}
/* Image slides: keep thumb visible (it IS the content) */
.story-modal__slide--active[data-media-type="image"] .story-modal__thumb {
  opacity: 1;
}

.story-modal__slide--active mux-player {
  opacity: 1;
  pointer-events: auto;
}

/* Duration badge on video slides */
.story-modal__duration {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 5;
  pointer-events: none;
}
/* Hide duration badge when video is playing */
.story-modal__slide--active .story-modal__duration {
  display: none;
}

.story-modal__close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-modal__close:hover {
  background: #fff;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .story-modal__container {
    scroll-behavior: auto;
  }
}

/* Gallery grid styles for stack view */
.gallery-story--stack {
  display: block;
  overflow: visible;
}

.gallery-story--stack .story-stack {
  width: 100%;
  display: block;
}

/* Story Block wrapper (for Wagtail embeds) */
.story-block {
  margin: 1.5rem 0;
}

.story-block__caption {
  font-size: 0.875rem;
  color: #666;
  text-align: center;
  margin-top: 0.5rem;
}

/* ============== Annotation Toggle Button ============== */
.story-carousel__toggle-annotations {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  color: #22c55e; /* green when annotations visible */
  transition: color 0.15s;
}

.story-carousel__toggle-annotations:hover {
  text-decoration: underline;
}

.annotations-hidden .story-carousel__toggle-annotations {
  color: #ef4444; /* red when annotations hidden */
}

/* ============== Modal Annotation Toggle ============== */
.story-modal__toggle-annotations {
  position: fixed;
  top: 1rem;
  right: 4rem;  /* Left of close button */
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #22c55e; /* green when annotations visible */
  transition: color 0.15s;
}

.story-modal__toggle-annotations:hover {
  background: #fff;
}

.story-modal.annotations-hidden .story-modal__toggle-annotations {
  color: #ef4444; /* red when annotations hidden */
}

/* Hide annotation overlays when modal has annotations-hidden class */
.story-modal.annotations-hidden .video-annotation-overlay {
  display: none;
}

/* ============== Caption Toggle Button (Carousel) ============== */
.story-carousel__toggle-captions {
  background: transparent;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  color: #22c55e; /* green when captions visible */
  transition: color 0.15s;
}

.story-carousel__toggle-captions:hover {
  text-decoration: underline;
}

.captions-hidden .story-carousel__toggle-captions {
  color: #ef4444; /* red when captions hidden */
}

/* ============== Modal Caption Toggle ============== */
/* Note: Uses pill shape (border-radius: 8px) instead of circle (50%)
   because "CC" text needs more horizontal space than the single "※" character
   used by the annotation toggle. This is an intentional design difference. */
.story-modal__toggle-captions {
  position: fixed;
  top: 1rem;
  right: 7rem;  /* Left of annotation toggle */
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 8px;  /* Pill shape for "CC" text */
  padding: 0 0.5rem;
  height: 44px;
  min-height: 44px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #22c55e; /* green when captions visible */
  transition: color 0.15s;
}

.story-modal__toggle-captions:hover {
  background: #fff;
}

.story-modal.captions-hidden .story-modal__toggle-captions {
  color: #ef4444; /* red when captions hidden */
}
