/* ============================================================
   Villa Nova — Reels Wall Component v4
   Thumbnail grid + modal lightbox. No iframes on load.
   ============================================================ */

/* ── Grid ─────────────────────────────────────────────────── */
.rwl-wrap { width: 100%; }

.rwl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 900px) { .rwl-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .rwl-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

/* ── Card ─────────────────────────────────────────────────── */
.rwl-card {
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: var(--white, #fff);
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  border: 1.5px solid rgba(0,0,0,.06);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), box-shadow .3s ease;
  position: relative;
  outline: none;
}
.rwl-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
}
.rwl-card:focus-visible { outline: 2px solid var(--gold, #B8860B); outline-offset: 2px; }

/* ── Thumbnail (no iframe!) ─────────────────────────────── */
.rwl-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 9/16;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Platform gradients */
.rwl-tt {
  background: linear-gradient(145deg, #010101 0%, #1a0a2e 40%, #2d0a1e 100%);
}
.rwl-ig {
  background: linear-gradient(145deg, #f09433 0%, #dc2743 40%, #bc1888 75%, #833ab4 100%);
}

/* Decorative blobs */
.rwl-blob {
  position: absolute;
  border-radius: 50%;
  opacity: .15;
  pointer-events: none;
}
.rwl-tt .rwl-blob { background: #fff; }
.rwl-ig .rwl-blob { background: rgba(255,255,255,.4); }

.rwl-b1 { width: 130%; height: 130%; top: -65%; left: -15%; }
.rwl-b2 { width: 80%; height: 80%; bottom: -40%; right: -30%; opacity: .08; }

/* Watermark icon */
.rwl-wm {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(48px, 10vw, 72px);
  color: rgba(255,255,255,.06);
  pointer-events: none;
  transition: opacity .3s;
}
.rwl-card:hover .rwl-wm { opacity: 0; }

/* Play button */
.rwl-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.rwl-play svg {
  width: clamp(40px, 8vw, 54px);
  height: clamp(40px, 8vw, 54px);
  color: #fff;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.5));
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  padding: 10px;
  backdrop-filter: blur(6px);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), background .2s;
}
.rwl-card:hover .rwl-play svg {
  transform: scale(1.15);
  background: rgba(255,255,255,.25);
}

/* Platform badge */
.rwl-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  z-index: 20;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.rwl-badge-tt { background: rgba(1,1,1,.75); }
.rwl-badge-ig { background: rgba(188,24,136,.75); }

/* Category chip */
.rwl-cat {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 99px;
  z-index: 20;
}

/* Hover overlay gradient */
.rwl-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.5) 0%, transparent 50%);
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.rwl-card:hover .rwl-thumb::after { opacity: 1; }

/* ── Info strip ──────────────────────────────────────────── */
.rwl-info {
  padding: 10px 12px 12px;
  background: var(--white, #fff);
}
.rwl-ttl {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink, #1a1410);
  line-height: 1.4;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rwl-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold, #B8860B);
  letter-spacing: .3px;
  transition: gap .2s;
}
.rwl-card:hover .rwl-cta { gap: 8px; }

/* ═══════════════════════════════════════════════════════════
   MODAL LIGHTBOX
═══════════════════════════════════════════════════════════ */
#rwlModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9900;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#rwlModal.open { display: flex; }

/* Backdrop */
#rwlBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,8,6,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: rwlFadeIn .25s ease;
}

/* Container */
#rwlContainer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: rwlSlideUp .3s cubic-bezier(.34,1.4,.64,1);
  max-height: 96vh;
}

/* Iframe box */
#rwlIframeBox {
  width: min(360px, 90vw);
  height: min(640px, 82vh);
  border-radius: 20px;
  overflow: hidden;
  background: #0a0a0a;
  box-shadow: 0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
  position: relative;
}
#rwlIframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Loading spinner */
#rwlSpinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  z-index: 2;
  transition: opacity .3s;
}
#rwlSpinner.hidden { opacity: 0; pointer-events: none; }
.rwl-spin {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: var(--gold, #B8860B);
  border-radius: 50%;
  animation: rwlRotate .7s linear infinite;
}

/* Close button */
#rwlClose {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--white, #fff);
  border: none;
  color: var(--ink, #1a1410);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  transition: all .2s;
  z-index: 10;
}
#rwlClose:hover { background: var(--rouge, #C0392B); color: #fff; transform: rotate(90deg); }

/* Nav arrows */
.rwl-nav {
  display: flex;
  gap: 10px;
}
.rwl-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.15);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  backdrop-filter: blur(8px);
}
.rwl-nav-btn:hover { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.4); }
.rwl-nav-btn:disabled { opacity: .3; cursor: default; pointer-events: none; }

/* Counter + link */
#rwlMeta {
  display: flex;
  align-items: center;
  gap: 14px;
}
#rwlCounter {
  font-size: 12px;
  color: rgba(255,255,255,.5);
  font-weight: 600;
  min-width: 50px;
  text-align: center;
}
#rwlExtLink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 99px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s;
  backdrop-filter: blur(8px);
}
#rwlExtLink:hover { background: rgba(255,255,255,.2); }

/* Animations */
@keyframes rwlFadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes rwlSlideUp { from { opacity: 0; transform: translateY(30px) scale(.95) } to { opacity: 1; transform: translateY(0) scale(1) } }
@keyframes rwlRotate { to { transform: rotate(360deg) } }

@media (max-width: 480px) {
  #rwlIframeBox { width: 92vw; height: 75vh; border-radius: 14px; }
  #rwlClose { top: -12px; right: -12px; width: 32px; height: 32px; font-size: 14px; }
}

/* ── Real thumbnail image ──────────────────────────────────── */
.rwl-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.rwl-card:hover .rwl-thumb-img {
  transform: scale(1.05);
}

/* Dark scrim over photo for contrast */
.rwl-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,.65) 0%,
    rgba(0,0,0,.15) 45%,
    rgba(0,0,0,.1) 100%
  );
  pointer-events: none;
}
/* Make play button pop on real thumbnails */
.rwl-thumb:has(.rwl-thumb-img) .rwl-play svg {
  background: rgba(255,255,255,.92);
  color: #111;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.rwl-card:hover .rwl-thumb:has(.rwl-thumb-img) .rwl-play svg {
  background: #fff;
  transform: scale(1.18);
}
