/* ==========================================================================
   Olsaar v-next — clips: real footage on the page.
   HANDOVER §7. A diagram explains; a clip proves.

   .clip              a <figure data-clip> holding one muted loop + its caption
   .clip--ui          product UI footage in a dark rounded window, seated in a thin
                      mat in the field's own tone with a soft layered shadow; no fake
                      browser chrome. Set --ar for the footage's shape.
   .clip--phone       a real-proportioned iPhone (abyss bezel, titanium rim,
                      dynamic island, side buttons) holding a 9:19.5 video.
                      Set --phone-w to cap its width.
   .phone-wall        a grid of small phones; js/clips.js plays only a few at once.
   .clip-cap          the caption row: a .t-label that says it's real footage,
                      and the round pause button for loops longer than 5 s.

   Behaviour lives in js/clips.js (lazy sources, play in view only, pause on
   hidden tab, reduced motion = poster only).
   ========================================================================== */

:root {
  /* The product's own canvas (posting v2: dark cool graphite). Footage sits on it,
     so the window edge never flashes a different colour while a clip loads. */
  --ui-canvas: #0f1116;
  /* The phone's hardware: abyss bezel, a lighter titanium rim. */
  --phone-bezel: #07080a;
  --phone-rim: #2c2f37;
  --phone-key: #1d2027;
}

.clip {
  position: relative;
  margin: 0;
  min-width: 0;
}

.clip video,
.clip .clip-poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ui-canvas);
}

/* ---------- Caption row ---------- */

.clip-cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-top: clamp(0.875rem, 1.4vw, 1.125rem);
}
.clip-cap .t-label {
  display: block;
  max-width: 62ch;
  line-height: 1.45;
  text-wrap: pretty;
}
/* "This is real": a small solid dot in the field's live colour leads the caption.
   Diagrams say "Illustrative"; footage carries this dot. */
.clip-cap .t-label::before {
  content: "";
  display: inline-block;
  width: 0.4375rem;
  height: 0.4375rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.06em;
}

/* Pause / play: the fleet's round [data-pause] button, for any figure. */
.fig-pause {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 50%;
  color: var(--fg);
  box-shadow: inset 0 0 0 1.5px var(--line-2);
  transition: box-shadow var(--dur-1) ease, transform var(--dur-1) ease;
}
.fig-pause:hover { box-shadow: inset 0 0 0 1.5px var(--fg); }
.fig-pause:active { transform: scale(0.94); }
.fig-pause:focus-visible { border-radius: 50%; }
.fig-pause .i { width: 0.875rem; height: 0.875rem; fill: currentColor; stroke-width: 0; }
.fig-pause .i-play { display: none; margin-left: 2px; }
.fig-pause[aria-pressed="true"] .i-play { display: block; }
.fig-pause[aria-pressed="true"] .i-pause { display: none; }
.fig-pause[hidden] { display: none; }
/* On flood, a navy ring reads better than a white one next to navy captions. */
[data-theme="flood"] .fig-pause { color: var(--fg-2); box-shadow: inset 0 0 0 1.5px rgba(11, 13, 16, 0.35); }
[data-theme="flood"] .fig-pause:hover { box-shadow: inset 0 0 0 1.5px var(--fg-2); }
html:not(.js) .fig-pause { display: none; }

/* ---------- UI window ---------- */

/* The seat. Every recording sits the same way on every field: a thin mat a step lighter
   than the field, a hairline round the mat, and a soft layered shadow (a close contact
   shadow plus a wide, faint ambient one) instead of one heavy drop. All of it is
   box-shadow, so the frame never changes layout; the mat's corners follow the window's.
   Per field (set on the field, so the nearest one wins): --seat-bg (mat), --seat-line
   (hairline), --seat-c1 / --seat-c2 (contact / ambient shadow). */
:root,
[data-theme="paper"],
[data-theme="paper-2"] {
  --seat-bg: #fafafa;
  --seat-line: rgba(10, 10, 11, 0.1);
  --seat-c1: rgba(11, 13, 16, 0.07);
  --seat-c2: rgba(11, 13, 16, 0.13);
}
[data-theme="flood"] {
  --seat-bg: #ff527f;
  --seat-line: rgba(11, 13, 16, 0.1);
  --seat-c1: rgba(11, 13, 16, 0.12);
  --seat-c2: rgba(11, 13, 16, 0.22);
}
[data-theme="deep"],
[data-theme="abyss"] {
  --seat-bg: #22252d;
  --seat-line: rgba(229, 231, 235, 0.14);
  --seat-c1: rgba(4, 5, 7, 0.22);
  --seat-c2: rgba(4, 5, 7, 0.34);
}
.clip--ui { --seat: 0.5rem; }
.clip--ui .clip-media {
  position: relative;
  aspect-ratio: var(--ar, 16 / 10);
  border-radius: var(--r-3);
  background: var(--ui-canvas);
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 0 0 var(--seat) var(--seat-bg),
    0 0 0 calc(var(--seat) + 1px) var(--seat-line),
    0 0.25rem 0.75rem calc(var(--seat) - 0.125rem) var(--seat-c1),
    0 1.75rem 3.5rem calc(var(--seat) - 1.25rem) var(--seat-c2);
}
/* The window's own edge, drawn over the footage so it holds on every field: a faint light
   rim with a brighter top edge, the way a lit screen catches the light. */
.clip--ui .clip-media::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(229, 231, 235, 0.1), inset 0 1px 0 rgba(229, 231, 235, 0.08);
  pointer-events: none;
}
.clip--ui > .clip-cap { margin-top: calc(var(--seat) + clamp(0.875rem, 1.4vw, 1.125rem)); }
@media (max-width: 760px) {
  .clip--ui { --seat: 0.3125rem; }
  .clip--ui .clip-media { border-radius: var(--r-2); }
}

/* ---------- iPhone ----------
   Built in container units (cqi = 1% of the phone's width), so the frame keeps its
   proportions at any size. Measured from an iPhone 15 Pro: bezel ≈ 3.4% of the
   width, screen corner ≈ 14% of the screen width, island 32% × 9.4%. */

.clip--phone { --phone-w: 20rem; width: 100%; max-width: var(--phone-w); }
.clip--phone .clip-cap { align-items: flex-start; padding-inline: 0.25rem; }

.phone {
  container-type: inline-size;
  width: 100%;
}
.phone-frame {
  position: relative;
  margin-inline: 0.9cqi;                    /* room for the side keys */
  padding: 3.4cqi;
  border-radius: 16.4cqi;
  background: var(--phone-bezel);
  box-shadow:
    inset 0 0 0 0.55cqi var(--phone-rim),
    inset 0 0 0 1.1cqi var(--phone-bezel),
    var(--shadow);
}
/* Right: the side button. Left: action button, then volume up and down. */
.phone-frame::before,
.phone-frame::after {
  content: "";
  position: absolute;
  width: 0.9cqi;
  background: var(--phone-key);
  pointer-events: none;
}
.phone-frame::before {
  right: -0.75cqi;
  top: 30%;
  height: 15%;
  border-radius: 0 0.6cqi 0.6cqi 0;
}
.phone-frame::after {
  left: -0.75cqi;
  top: 17.5%;
  height: 27%;
  border-radius: 0.6cqi 0 0 0.6cqi;
  background:
    linear-gradient(var(--phone-key) 0 18%, transparent 18% 30%,
                    var(--phone-key) 30% 62%, transparent 62% 70%,
                    var(--phone-key) 70% 100%);
}
.phone-screen {
  position: relative;
  aspect-ratio: 9 / 19.5;
  border-radius: 13cqi;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}
.phone-island {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 2.6cqi;
  width: 29.8cqi;
  height: 8.8cqi;
  border-radius: 999px;
  background: #000;
  transform: translateX(-50%);
  pointer-events: none;
}

/* ---------- Phone wall ----------
   A grid of small phones. data-play="3" on the wall caps how many play at once
   (HANDOVER §7.1.7); js/clips.js rotates which ones. */

.phone-wall {
  --wall-min: 7.25rem;
  display: grid;
  grid-template-columns: repeat(var(--wall-cols, 6), minmax(0, 1fr));
  gap: clamp(0.875rem, 1.8vw, 1.75rem);
  align-items: start;
}
.phone-wall .clip--phone { max-width: none; }
.phone-wall .phone-frame { box-shadow: inset 0 0 0 0.55cqi var(--phone-rim), inset 0 0 0 1.1cqi var(--phone-bezel), 0 1rem 2rem -1.25rem rgba(5, 6, 8, 0.45); }
.phone-wall-foot { margin-top: clamp(1.25rem, 2.4vw, 2rem); }
@media (max-width: 1100px) { .phone-wall { --wall-cols: 4; } .phone-wall > :nth-child(n + 9) { display: none; } }
@media (max-width: 560px) { .phone-wall { --wall-cols: 3; } .phone-wall > :nth-child(n + 7) { display: none; } }

/* ---------- Still: a real screenshot in the UI window (int1) ----------
   .clip--still holds a <picture> instead of a <video>. [data-pan] (js/clips.js) eases it
   from a close look at the transform-origin out to the whole window as it scrolls in,
   scrubbed to the scroll; at rest it shows the whole screenshot, unchanged. */
.clip-media picture { display: block; width: 100%; height: 100%; }
.clip--ui[data-pan] .clip-poster { transform-origin: 72% 36%; }
