/*
 * Beat product-walkthrough: Launchroom, a release presentation
 * (web/landing/sections/product-walkthrough.html). Linked in the page head by
 * lib/landing.ts while the beat is enabled; the shells' sheets it builds on are linked
 * by the page itself, once each and before every section sheet. Every class here starts
 * with the beat id and every rule is scoped by [data-beat].
 *
 * Layout: the serif copy over the Launchroom window, which takes the page's width; inside
 * it the release headline, then the finished walkthrough and the raw clip side by side
 * (16 : 9 columns, so the 16:9 screen and the square clip stand the same height), tabs
 * instead once the gallery is narrower than 640 px, and the export settings in mono. The
 * screen's states are stacked images; the ring and the cursor are the edit's, moved to
 * the narration's words by the module.
 */

.use-case[data-beat="product-walkthrough"] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}

/* The copy over the window, the title and the line side by side while there is room:
   the walkthrough and the raw clip share the window's width. The hero's rule (the copy
   beside the window) was measured against it at 1280: the two panes drop from 686 and
   386 px to 435 and 245, so the video beats keep the full row, all four alike. */
@media (min-width: 1024px) {
  .use-case[data-beat="product-walkthrough"] .use-case-copy {
    display: grid;
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    grid-template-areas: "eyebrow eyebrow" "title body";
    column-gap: clamp(28px, 4vw, 56px);
    align-items: end;
  }
  .use-case[data-beat="product-walkthrough"] .use-case-eyebrow { grid-area: eyebrow; }
  .use-case[data-beat="product-walkthrough"] .use-case-title { grid-area: title; margin: 0; }
  .use-case[data-beat="product-walkthrough"] .use-case-body { grid-area: body; padding-bottom: 6px; }
}

/* ── Inside the window ─────────────────────────────────────────────────── */

[data-beat="product-walkthrough"] .demo-frame-body {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "main";
}

[data-beat="product-walkthrough"] .demo-frame-slot[data-slot="main"] {
  display: grid;
  gap: 14px;
}

[data-beat="product-walkthrough"] .product-walkthrough-release {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.2;
  text-wrap: balance;
}

@container media-gallery (min-width: 640px) {
  [data-beat="product-walkthrough"] .media-gallery[data-layout="comparison"] .media-gallery-stage { grid-template-columns: minmax(0, 16fr) minmax(0, 9fr); }
}

[data-beat="product-walkthrough"] .product-walkthrough-label { min-height: 20px; }
[data-beat="product-walkthrough"] .product-walkthrough-label-name { color: var(--text); font-weight: 600; }
[data-beat="product-walkthrough"] .product-walkthrough-note { font-family: var(--serif); font-style: italic; font-size: 14px; }

/* With the tabs showing, the tab already names the pane. */
@container media-gallery (max-width: 639px) {
  [data-beat="product-walkthrough"] .product-walkthrough-label-name { display: none; }
}

/* ── The finished walkthrough: the product's screen, the edit, the presenter ── */

[data-beat="product-walkthrough"] .product-walkthrough-screen {
  aspect-ratio: 16 / 9;
  background: #17121f;
}

[data-beat="product-walkthrough"] .product-walkthrough-shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .2s ease;
}

/* The plain screen is always underneath: it is the poster, script or none. */
[data-beat="product-walkthrough"] .product-walkthrough-shot[data-shot="base"],
[data-beat="product-walkthrough"] .product-walkthrough-shot[data-on] { opacity: 1; }

[data-beat="product-walkthrough"] .product-walkthrough-ring {
  position: absolute;
  left: var(--x, 0);
  top: var(--y, 0);
  width: var(--w, 0);
  height: var(--h, 0);
  border: 2px solid var(--accent);
  border-radius: 9px;
  opacity: 0;
  pointer-events: none;
  transition: left .35s cubic-bezier(.2, .8, .2, 1), top .35s cubic-bezier(.2, .8, .2, 1), width .35s cubic-bezier(.2, .8, .2, 1), height .35s cubic-bezier(.2, .8, .2, 1), opacity .2s;
}

[data-beat="product-walkthrough"] .product-walkthrough-cursor {
  position: absolute;
  left: var(--x, 30%);
  top: var(--y, 30%);
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #1d1329;
  border-radius: 50%;
  background: rgba(236, 233, 242, .92);
  opacity: 0;
  pointer-events: none;
  transition: left .5s cubic-bezier(.2, .8, .2, 1), top .5s cubic-bezier(.2, .8, .2, 1), opacity .2s;
}

[data-beat="product-walkthrough"] .product-walkthrough-ring[data-on],
[data-beat="product-walkthrough"] .product-walkthrough-cursor[data-on] { opacity: 1; }

/* The presenter: the narrator's circle in the corner. Its box is the clip's own square, so
   the gallery's mask is the circle the clip's script names. */
[data-beat="product-walkthrough"] .product-walkthrough-presenter {
  position: absolute;
  right: 2.5%;
  bottom: 4%;
  width: 25%;
}

[data-beat="product-walkthrough"] .product-walkthrough-item[data-masked] .product-walkthrough-presenter::after {
  content: "";
  position: absolute;
  inset: .52%;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(236, 233, 242, .8);
  pointer-events: none;
}

/* The finished view's captions sit after the screen in the figure: over the screen's lower
   middle while it is wide, under it on a phone, where the screen is too small to cover. */
[data-beat="product-walkthrough"] .product-walkthrough-item[data-masked] { position: relative; }

[data-beat="product-walkthrough"] .product-walkthrough-captions {
  left: 30%;
  right: auto;
  bottom: 12px;
  transform: none;
  max-width: 40%;
  text-align: left;
  font-size: 13px;
}

/* ── The raw clip: square, key colour and all ──────────────────────────── */

[data-beat="product-walkthrough"] .product-walkthrough-raw { background: var(--ink); }

[data-beat="product-walkthrough"] .product-walkthrough-raw .media-gallery-captions {
  font-size: 12.5px;
  bottom: 8px;
}

/* ── The export settings: the request's own fields ───────────────────── */

[data-beat="product-walkthrough"] .product-walkthrough-export {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

[data-beat="product-walkthrough"] .product-walkthrough-export[hidden] { display: none; }
[data-beat="product-walkthrough"] .product-walkthrough-export-key { color: var(--muted); }

[data-beat="product-walkthrough"] .product-walkthrough-icon { width: 13px; height: 13px; flex: none; }
[data-beat="product-walkthrough"] .product-walkthrough-icon[hidden] { display: none; }

/* A phone-width screen: the presenter a little larger, the captions under the screen (their
   line kept, so the controls do not jump when one appears). */
@container media-gallery (max-width: 480px) {
  [data-beat="product-walkthrough"] .product-walkthrough-presenter { width: 32%; }
  [data-beat="product-walkthrough"] .product-walkthrough-captions {
    position: static;
    width: auto;
    max-width: none;
    min-height: 2.9em;
    padding: 0;
    background: transparent;
    font-size: 13px;
  }
  [data-beat="product-walkthrough"] .product-walkthrough-captions[hidden] { display: block; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  [data-beat="product-walkthrough"] :is(.product-walkthrough-shot, .product-walkthrough-ring, .product-walkthrough-cursor) { transition: none; }
}
