/* ============================================================
   Video lightbox (js/components/lightbox.js)
   The moments items become buttons with a play glyph; the full
   clip opens in a modal <dialog> over a dark blurred backdrop.
   Pure white type on near-black, pink only as light.
   ============================================================ */

/* ---------- the clickable items ---------- */
.moments__item[data-full] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
body.has-cursor .moments__item[data-full] { cursor: none; }
.moments__item[data-full]:focus-visible { outline: 2px solid var(--magenta-hi); outline-offset: 6px; border-radius: var(--radius-sm); }

/* play glyph: pink ring, white triangle, centred over the media (::after is the gradient) */
.moments__item[data-full] .moments__media::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  border: 2px solid var(--pink, #ff8fbb);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M8 5.5v13l11-6.5z'/%3E%3C/svg%3E") 56% 50% / 26px 26px no-repeat,
    rgba(5, 3, 4, 0.42);
  box-shadow: 0 0 0 0 rgba(255, 143, 187, 0.35), 0 10px 30px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: scale(0.82);
  transition: opacity 0.35s var(--ease-out), transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
  pointer-events: none;
}
.moments__item[data-full]:hover .moments__media::before,
.moments__item[data-full]:focus-visible .moments__media::before {
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 0 0 6px rgba(255, 143, 187, 0.16), 0 10px 30px rgba(0, 0, 0, 0.45);
}
.moments__item[data-full]:active .moments__media::before { transform: scale(0.94); }
/* touch: no hover, so the glyph stays visible (quietly) to say "tap me" */
@media (hover: none) {
  .moments__item[data-full] .moments__media::before { opacity: 0.9; transform: scale(1); }
}

/* ---------- the dialog ---------- */
.lightbox { display: none; }
.lightbox[open] {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: clamp(1rem, 3vh, 2rem) 0;
  border: 0;
  overflow: hidden;
  color: #fff;
  background: rgba(5, 3, 4, 0.92);
  -webkit-backdrop-filter: blur(16px) saturate(0.9);
  backdrop-filter: blur(16px) saturate(0.9);
  direction: rtl;
  font-family: var(--font-body);
  cursor: default;
}
.lightbox::backdrop { background: transparent; }
body.has-cursor .lightbox { cursor: default; }
body.has-cursor .lightbox button { cursor: pointer; }
.lightbox:focus { outline: none; }

.lightbox__panel {
  display: grid;
  gap: clamp(0.6rem, 1.6vh, 1.1rem);
  justify-items: stretch;
  width: min(92vw, 1280px, calc((100vh - 9rem) * 16 / 9));
  width: min(92vw, 1280px, calc((100dvh - 9rem) * 16 / 9));
  max-width: 100%;
  will-change: transform, opacity;
}

.lightbox__title {
  margin: 0;
  padding: 0 0.15em;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #fff;
  text-align: start;
  text-shadow: 0 1px 2px rgba(5, 3, 4, 0.9), 0 3px 14px rgba(5, 3, 4, 0.6);
}
.lightbox__title[hidden] { display: none; }

.lightbox__player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 143, 187, 0.35);
  background: #050304;
  overflow: hidden;
  box-shadow:
    0 50px 120px -40px rgba(0, 0, 0, 0.95),
    0 0 90px rgba(214, 74, 124, 0.12);
}
.lightbox__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050304;
  outline: none;
}
.lightbox__video:focus-visible { outline: 2px solid var(--magenta-hi); outline-offset: -3px; }

/* round close, top-start corner (right in RTL) */
.lightbox__close {
  position: absolute;
  z-index: 3;
  top: clamp(0.9rem, 2.5vh, 1.5rem);
  inset-inline-start: clamp(0.9rem, 2.5vw, 1.5rem);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 143, 187, 0.45);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background 0.3s var(--ease-out), border-color 0.3s var(--ease-out), transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}
.lightbox__close:hover,
.lightbox__close:focus-visible {
  background: rgba(255, 143, 187, 0.18);
  border-color: var(--pink, #ff8fbb);
  box-shadow: 0 0 0 6px rgba(255, 143, 187, 0.14);
  transform: scale(1.06);
}
.lightbox__close:focus-visible { outline: 2px solid var(--magenta-hi); outline-offset: 3px; }
.lightbox__close:active { transform: scale(0.96); }

/* "turn on sound" pill, shown only when the browser refused unmuted autoplay */
.lightbox__unmute {
  position: absolute;
  z-index: 2;
  top: 0.9rem;
  inset-inline-start: 0.9rem;
  padding: 0.5em 1.1em;
  border-radius: 999px;
  border: 1px solid var(--pink, #ff8fbb);
  background: rgba(5, 3, 4, 0.6);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 0 0 rgba(255, 143, 187, 0.3), 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: background 0.3s var(--ease-out), box-shadow 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}
.lightbox__unmute::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-inline-end: 0.5em;
  vertical-align: -0.1em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4z' fill='%23ffffff'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M19 5a9 9 0 0 1 0 14'/%3E%3C/svg%3E") center / contain no-repeat;
}
.lightbox__unmute:hover,
.lightbox__unmute:focus-visible {
  background: rgba(255, 143, 187, 0.22);
  box-shadow: 0 0 0 6px rgba(255, 143, 187, 0.14), 0 8px 24px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
}
.lightbox__unmute[hidden] { display: none; }

/* ---------- open / close motion without GSAP ---------- */
@keyframes lb-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes lb-scale-in { from { opacity: 0; transform: translateY(12px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes lb-scale-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(0.96); } }
.lightbox--css[open] { animation: lb-fade-in 0.5s var(--ease-soft) both; }
.lightbox--css[open] .lightbox__panel { animation: lb-scale-in 0.5s var(--ease-out) both; }
.lightbox--css[open].is-closing { animation: lb-fade-out 0.32s var(--ease-in-out) both; }
.lightbox--css[open].is-closing .lightbox__panel { animation: lb-scale-out 0.32s var(--ease-in-out) both; }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  .lightbox[open] { padding: 0.75rem 0; }
  .lightbox__panel {
    width: min(96vw, calc((100vh - 7rem) * 16 / 9));
    width: min(96vw, calc((100dvh - 7rem) * 16 / 9));
    gap: 0.6rem;
  }
  .lightbox__title { font-size: 1.5rem; padding-inline: 0.2rem; }
  .lightbox__player { border-radius: var(--radius-sm); }
  .lightbox__close { width: 44px; height: 44px; top: 0.75rem; inset-inline-start: 0.75rem; }
  .lightbox__unmute { top: 0.7rem; inset-inline-start: 0.7rem; font-size: 0.85rem; }
  .moments__item[data-full] .moments__media::before { width: 56px; height: 56px; margin: -28px 0 0 -28px; background-size: 22px 22px; }
}

/* ---------- reduced motion: fades only, no scale ---------- */
@media (prefers-reduced-motion: reduce) {
  .moments__item[data-full] .moments__media::before { transition: opacity 0.2s linear; transform: none; }
  .moments__item[data-full]:hover .moments__media::before,
  .moments__item[data-full]:focus-visible .moments__media::before,
  .moments__item[data-full]:active .moments__media::before { transform: none; }
  .lightbox--css[open] { animation-duration: 0.2s; }
  .lightbox--css[open] .lightbox__panel { animation: none; }
  .lightbox--css[open].is-closing { animation-duration: 0.15s; }
  .lightbox--css[open].is-closing .lightbox__panel { animation: none; }
  .lightbox__close, .lightbox__close:hover, .lightbox__close:active,
  .lightbox__unmute, .lightbox__unmute:hover { transform: none; transition: none; }
}
