/*
 * PO — Video Reels Block  (popup modal version)
 * Standalone CSS. Works with any theme.
 */

/* ── Section wrapper ── */
.po-reels-section {
  padding: 72px 0 80px;
  background: var(--primary, #0f1923);
  overflow: hidden;
}

/* ── Inner container ── */
.po-reels-container {
  max-width: var(--max-w, 1280px);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ── */
.po-reels-header     { text-align: center; margin-bottom: 40px; }
.po-reels-heading {
  font-family: var(--font-head, 'Barlow Condensed', sans-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--white, #ffffff);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 8px;
  line-height: 1.1;
}
.po-reels-sub {
  color: rgba(255,255,255,.5);
  font-size: 16px;
  margin: 0;
  font-family: var(--font-body, sans-serif);
}

/* ── Horizontal scroll track ── */
.po-reels-track--scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 8px 4px 24px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  scrollbar-width: none;
}
.po-reels-track--scroll::-webkit-scrollbar { display: none; }
.po-reels-track--scroll.is-dragging        { cursor: grabbing; user-select: none; }

/* ── Wrapping grid track ── */
.po-reels-track--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 240px));
  gap: 14px;
  justify-content: center;
}

/* ── Card ── */
.po-reel-card {
  flex: 0 0 220px;
  width: 220px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  outline: none;
}
.po-reel-card:focus-visible .po-reel-thumb {
  outline: 3px solid var(--accent, #e05c2a);
  outline-offset: 3px;
}
.po-reels-track--grid .po-reel-card { flex: none; width: 100%; }

/* ── Thumbnail 9:16 ── */
.po-reel-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  transition: transform .22s ease, box-shadow .22s ease;
}
.po-reel-card:hover .po-reel-thumb {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0,0,0,.60);
}

.po-reel-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: filter .22s ease;
}
.po-reel-card:hover .po-reel-img { filter: brightness(.8); }

/* bottom vignette */
.po-reel-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.55) 0%, transparent 55%);
  z-index: 2;
  pointer-events: none;
}

/* ── Play icon overlay ── */
.po-reel-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  z-index: 3;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  border: 2px solid rgba(255,255,255,.75);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s, border-color .18s, transform .18s;
  pointer-events: none;
}
.po-reel-play-icon svg { width: 26px; height: 26px; }
.po-reel-card:hover .po-reel-play-icon {
  background: var(--accent, #e05c2a);
  border-color: var(--accent, #e05c2a);
  transform: translate(-50%, -50%) scale(1.12);
}

/* ── Badge ── */
.po-reel-label {
  position: absolute;
  top: 11px;
  left: 11px;
  z-index: 4;
  background: var(--accent, #e05c2a);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 50px;
  pointer-events: none;
  font-family: var(--font-body, sans-serif);
  line-height: 1;
}

/* ── Caption ── */
.po-reel-title {
  color: rgba(255,255,255,.8);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  text-align: center;
  font-family: var(--font-body, sans-serif);
  padding: 0 4px;
}

/* ── Demo placeholder ── */
.po-reel-card--demo .po-reel-demo-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #1a2d3f 0%, #0f1923 60%, rgba(224,92,42,.15) 100%);
}
.po-reels-hint {
  text-align: center;
  color: rgba(255,255,255,.3);
  font-size: 13px;
  margin: 20px 0 0;
  font-style: italic;
  font-family: var(--font-body, sans-serif);
}

/* ════════════════════════════════════════════════
   MODAL
════════════════════════════════════════════════ */

/* Prevent body scroll while modal open */
body.po-reel-modal-open { overflow: hidden; }

.po-reel-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.po-reel-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.po-reel-modal.is-closing {
  opacity: 0;
  pointer-events: none;
}
/* hidden attribute hides before JS adds .is-visible */
.po-reel-modal[hidden] { display: none !important; }

/* backdrop */
.po-reel-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 16, .92);
  cursor: pointer;
}

/* inner wrap — vertically constrained so video fits viewport */
.po-reel-modal__wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  /* max height: viewport minus some padding */
  max-height: calc(100dvh - 48px);
}

/* video inside modal — 9:16, capped to viewport height */
.po-reel-modal__video {
  display: block;
  width: auto;
  height: calc(100dvh - 120px);
  max-height: 780px;
  max-width: calc((100dvh - 120px) * (9/16));
  aspect-ratio: 9 / 16;
  border-radius: 20px;
  object-fit: cover;
  background: #000;
  box-shadow: 0 24px 80px rgba(0,0,0,.8);
}

/* caption below video */
.po-reel-modal__title {
  color: rgba(255,255,255,.75);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body, sans-serif);
  margin: 0;
  text-align: center;
  min-height: 1em;
}

/* close button — top-right corner of viewport */
.po-reel-modal__close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background .15s, transform .15s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.po-reel-modal__close svg   { width: 20px; height: 20px; }
.po-reel-modal__close:hover { background: var(--accent, #e05c2a); transform: scale(1.1); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .po-reel-card              { flex: 0 0 175px; width: 175px; }
  .po-reels-track--grid      { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
  .po-reel-play-icon         { width: 46px; height: 46px; }
  .po-reel-play-icon svg     { width: 22px; height: 22px; }
  .po-reels-heading          { font-size: 2rem; }
  .po-reel-modal__video      { height: calc(100dvh - 80px); border-radius: 14px; }
  .po-reel-modal__close      { top: 10px; right: 10px; }
}
@media (max-width: 480px) {
  .po-reel-card { flex: 0 0 155px; width: 155px; }
  .po-reel-modal__video {
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    max-width: 100vw;
  }
}
