/* ============================================================
   SHAHI MAHAL — GUEST STORIES VIDEO REELS
   Instagram-Reels style vertical video carousel
   Responsive layout:
   - Desktop (>= 1024px): 3 videos per row
   - Tablet (768px - 1023px): 2 videos per row
   - Mobile (< 768px): 1 video per row
   ============================================================ */

/* ---------- Section ---------- */
.reels-section {
  background: #080808;
  padding: 6rem 0 5rem;
  position: relative;
  overflow: hidden;
}

.reels-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold, #c9a84c), transparent);
}

/* ---------- Carousel Wrapper ---------- */
.reels-carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 -0.5rem;
}

/* ---------- Nav Arrows ---------- */
.reels-nav {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid rgba(201,168,76,0.4);
  background: rgba(10,10,10,0.85);
  color: var(--gold, #c9a84c);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  z-index: 10;
  backdrop-filter: blur(8px);
  position: relative;
}

.reels-nav:hover {
  background: var(--gold, #c9a84c);
  color: #000;
  border-color: var(--gold, #c9a84c);
  transform: scale(1.08);
}

.reels-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Track ---------- */
.reels-track-outer {
  overflow: hidden;
  flex: 1;
  border-radius: 18px;
}

.reels-track {
  display: flex;
  gap: 1.25rem;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  padding: 0.5rem 0.25rem 1rem;
}

/* ---------- Reel Card ---------- */
/* Desktop (>= 1024px): 3 videos per row */
.reel-card {
  flex: 0 0 calc(33.333% - 0.833rem); /* 3 equal width cards per row */
  min-width: 0;
  max-width: none;
  position: relative;
  cursor: pointer;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.reel-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 50px rgba(201,168,76,0.22), 0 0 0 1.5px rgba(201,168,76,0.4);
}

.reel-inner {
  position: relative;
  width: 100%;
  padding-top: 177.78%; /* 9:16 vertical ratio */
  border-radius: 18px;
  overflow: hidden;
  background: #111;
}

/* ---------- Video Element ---------- */
.reel-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 18px;
}

/* ---------- Overlay ---------- */
.reel-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.08) 0%,
    transparent 35%,
    transparent 55%,
    rgba(0,0,0,0.85) 100%
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
  border-radius: 18px;
}

.reel-card:hover .reel-overlay {
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.1) 0%,
    transparent 30%,
    transparent 50%,
    rgba(0,0,0,0.9) 100%
  );
}

/* Play button */
.reel-play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(201,168,76,0.9);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(201,168,76,0.4);
  transition: all 0.25s ease;
  pointer-events: none;
}

.reel-play-btn svg {
  margin-left: 3px; /* visual center for play triangle */
}

.reel-card:hover .reel-play-btn {
  transform: scale(1.12);
  background: var(--gold, #c9a84c);
  box-shadow: 0 6px 25px rgba(201,168,76,0.6);
}

/* Playing indicator badge */
.reel-playing-indicator {
  position: absolute;
  top: 12px; left: 12px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(201,168,76,0.4);
  border-radius: 20px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.reel-card.is-playing .reel-playing-indicator {
  opacity: 1;
}

.reel-bar {
  width: 3px;
  height: 10px;
  background: var(--gold, #c9a84c);
  border-radius: 2px;
  animation: reelBarPulse 0.8s ease-in-out infinite alternate;
}

.reel-bar:nth-child(2) { animation-delay: 0.2s; height: 14px; }
.reel-bar:nth-child(3) { animation-delay: 0.4s; height: 8px; }

@keyframes reelBarPulse {
  from { transform: scaleY(0.4); }
  to   { transform: scaleY(1); }
}

/* Card Caption & Title at Bottom */
.reel-meta, .reel-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3rem 1.2rem 1.25rem;
  background: linear-gradient(to top, rgba(0,0,0,0.96) 0%, rgba(0,0,0,0.7) 60%, transparent 100%);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  z-index: 4;
  pointer-events: none;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
}

.reel-tag, .reel-badge {
  display: inline-block;
  font-family: var(--font-heading, 'Cinzel', serif);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold, #c9a84c);
  text-shadow: 0 2px 4px rgba(0,0,0,0.9);
}

.reel-title {
  font-family: var(--font-heading, 'Cinzel', serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.25;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

.reel-caption, .reel-subtitle {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.85);
  margin: 0;
  line-height: 1.35;
}

/* ---------- Dot Indicators ---------- */
.reels-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.reels-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(201,168,76,0.3);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.3s ease;
}

.reels-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--gold, #c9a84c);
  box-shadow: 0 0 10px rgba(201,168,76,0.5);
}

/* ---------- Fullscreen Lightbox Modal ---------- */
.reels-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.3s ease, opacity 0.3s ease;
}

.reels-modal.is-open {
  visibility: visible;
  opacity: 1;
}

.reels-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(12px);
}

.reels-modal-content {
  position: relative;
  z-index: 2;
  width: min(380px, 90vw);
  max-height: 88vh;
  border-radius: 20px;
  overflow: hidden;
  border: 1.5px solid rgba(201,168,76,0.4);
  box-shadow: 0 25px 60px rgba(0,0,0,0.9), 0 0 40px rgba(201,168,76,0.25);
  animation: modalScaleIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes modalScaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.reels-modal-video {
  display: block;
  width: 100%;
  aspect-ratio: 9/16;
  object-fit: cover;
  background: #000;
}

.reels-modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.reels-modal-close:hover {
  background: rgba(229,62,62,0.85);
  transform: scale(1.1);
}

/* Upload placeholder overlay */
.reel-card.no-video .reel-overlay {
  background: linear-gradient(160deg, rgba(20,14,6,0.95) 0%, rgba(30,22,5,0.9) 100%);
}

.reel-card.no-video .reel-play-btn {
  background: rgba(201,168,76,0.15);
  border: 1.5px dashed rgba(201,168,76,0.4);
  color: rgba(201,168,76,0.6);
}

/* ---------- Responsive Breakpoints ---------- */

/* Tablet (768px – 1023px): 2 videos per row */
@media (max-width: 1023px) {
  .reel-card {
    flex: 0 0 calc(50% - 0.625rem); /* Exactly 2 cards per row */
  }
}

/* Mobile (< 768px): 1 video per row */
@media (max-width: 767px) {
  .reels-section { padding: 4rem 0 3.5rem; }
  .reel-card {
    flex: 0 0 100%; /* Exactly 1 full-width card per row */
  }
  .reels-nav {
    width: 40px;
    height: 40px;
  }
  .reels-nav svg { width: 18px; height: 18px; }
  .reels-carousel-wrapper { gap: 0.5rem; }
  .reels-modal-content { width: min(340px, 92vw); }
}
