/* Tiraz Labs — reel tile + full-screen player v4 (owner: foundation A). Pairs with js/ui/reel.js (T.reel). Tokens only, logical properties.
   .reel            the tile (figure). Aspect from --reel-ar (set by JS from data-aspect; default 9 / 16). Size it from the parent grid.
   .reel-hit        the whole tile is one button (opens the player). Poster <img> under a muted <video>; the video fades in when it plays.
   .reel-cap        optional caption under the tile.
   .reel-lightbox   the dialog: scrim, centred 9:16 stage, 48px close button. html.reel-is-open locks the page scroll. */

.reel { --reel-ar: 9 / 16; position: relative; margin: 0; min-width: 0; }
.reel-hit { position: relative; display: block; width: 100%; aspect-ratio: var(--reel-ar); padding: 0; border: 0; margin: 0; overflow: hidden; cursor: pointer;
  border-radius: var(--r-media); background: var(--surface-2); color: var(--paper); isolation: isolate; -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 0 0 1px var(--line); transition: translate var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); }
.reel-poster, .reel-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.reel-poster { z-index: 0; }
.reel-video { z-index: 1; opacity: 0; transition: opacity var(--dur-3) var(--ease-out); pointer-events: none; }
.reel.is-playing .reel-video { opacity: 1; }
/* a soft floor so the badges read on any frame */
.reel-hit::after { content: ""; position: absolute; inset: auto 0 0 0; height: 38%; z-index: 2; pointer-events: none;
  background: linear-gradient(to top, rgba(var(--ink-rgb), .55), transparent); }
.reel-play, .reel-sound { position: absolute; z-index: 3; display: grid; place-items: center; border-radius: 50%; pointer-events: none;
  background: rgba(var(--ink-rgb), .62); color: var(--paper); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(var(--paper-rgb), .18); transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out); }
.reel-play { inset-block-end: 14px; inset-inline-start: 14px; width: 48px; height: 48px; }
.reel-play svg { translate: 1px 0; }
html[dir="rtl"] .reel-play svg { translate: 1px 0; } /* the play triangle never mirrors */
.reel-sound { inset-block-end: 20px; inset-inline-end: 14px; width: 36px; height: 36px; opacity: .9; }
.reel.is-playing .reel-play { opacity: 0; transform: scale(.85); }
.reel.is-error .reel-play { opacity: .5; }
@media (hover: hover) {
  .reel-hit:hover { translate: 0 -4px; box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-2); }
  .reel-hit:hover .reel-play { opacity: 1; transform: scale(1.06); background: var(--accent-fill); color: var(--accent-ink); }
}
.reel-hit:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.reel-hit:focus-visible .reel-play { opacity: 1; transform: none; background: var(--accent-fill); color: var(--accent-ink); }
.reel-cap { margin-block-start: 12px; font-size: var(--t-small); line-height: 1.5; color: var(--text-soft); }
@media (prefers-reduced-motion: reduce) { .reel-video { display: none; } .reel-hit { transition: none; } }

/* ======================================================================
   The player (one per page, created on first open)
   ====================================================================== */
html.reel-is-open { overflow: hidden; }
.reel-lightbox { --reel-ar: 9 / 16; --reel-k: .5625; position: fixed; inset: 0; z-index: var(--z-lightbox); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); opacity: 0; transition: opacity var(--dur-3) var(--ease-out); }
.reel-lightbox[hidden] { display: none; }
.reel-lightbox.is-open { opacity: 1; }
.reel-lb-scrim { position: absolute; inset: 0; background: rgba(var(--ink-rgb), .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.reel-lb-stage { position: relative; z-index: 1; aspect-ratio: var(--reel-ar); width: min(calc(100vw - 32px), calc((100dvh - 32px) * var(--reel-k, .5625)));
  border-radius: var(--r-media); overflow: hidden; background: var(--ink-0); box-shadow: var(--shadow-3), 0 0 0 1px var(--gold-line);
  transform: scale(.97); transition: transform var(--dur-3) var(--ease-expo); }
.reel-lightbox.is-open .reel-lb-stage { transform: none; }
.reel-lb-video { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--ink-0); }
.reel-lb-close { position: absolute; z-index: 2; inset-block-start: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; width: 52px; height: 52px;
  display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; background: rgba(var(--paper-rgb), .12); color: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(var(--paper-rgb), .22); transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out); }
.reel-lb-close:hover { background: var(--accent-fill); color: var(--accent-ink); }
.reel-lb-close:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
@media (max-width: 599px) { .reel-lb-stage { border-radius: var(--r-card); } }
@media (prefers-reduced-motion: reduce) { .reel-lightbox, .reel-lb-stage { transition: none; transform: none; } }
