/*
 * Beat house-cast: The Casting Desk, a contact sheet of the house cast with one
 * character expanded (web/landing/sections/house-cast.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]: the frame's variant
 * (house-cast-desk) is styled here alone.
 *
 * Layout: the copy over the desk. In a wide desk the expanded character stands on the
 * left (its stage in a fixed box, so switching from a square plush to a tall portrait
 * never moves the sheet) and the sheet runs on the right, three cards to a row, each a
 * headshot with the name and tagline beside it. Below 760 px of desk the expanded stage
 * is on top and the sheet below it in two columns, each card a headshot over its name.
 *
 * Type, as the brand sets it: names in the serif, taglines in the sans, the cast count and
 * the frame size in the mono.
 */

/* ── The copy, as a header ─────────────────────────────────────────────── */

@media (min-width: 1024px) {
  .use-case[data-beat="house-cast"] .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;
    margin: 0 0 clamp(24px, 4vh, 36px);
  }
  .use-case[data-beat="house-cast"] .use-case-eyebrow { grid-area: eyebrow; }
  .use-case[data-beat="house-cast"] .use-case-title { grid-area: title; margin: 0; }
  .use-case[data-beat="house-cast"] .use-case-body { grid-area: body; padding-bottom: 6px; }
}

@media (max-width: 1023px) {
  .use-case[data-beat="house-cast"] .use-case-copy { margin: 0 0 24px; }
}

/* ── The desk: the expanded character and the sheet ────────────────────── */

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

@container demo-frame (min-width: 760px) {
  [data-beat="house-cast"] .demo-frame-body {
    grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.5fr);
    grid-template-areas: "stage main";
    align-items: start;
    gap: 22px;
    padding: 18px;
  }
}

/* ── The expanded character ────────────────────────────────────────────── */

[data-beat="house-cast"] .house-cast-pick {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  scroll-margin-top: calc(var(--top-h) + 12px);
}

@container demo-frame (min-width: 760px) {
  [data-beat="house-cast"] .house-cast-pick {
    position: sticky;
    top: calc(var(--top-h) + 16px);
  }
}

/* The box the stage stands in. The stage inside keeps the character's own shape
   (CharacterSurface sets its aspect ratio; the module mirrors it as --house-cast-ar, width
   over height) and is as large as the box allows: the box's width, or its height times
   the ratio. On a phone the box is the character's shape, no taller than most of the
   screen (the sheet is below it, out of sight when a card is chosen); in a desk it is one
   size for every character, so a switch never moves the column beside the sheet. */
[data-beat="house-cast"] .house-cast-stage {
  container-type: size;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  aspect-ratio: var(--house-cast-ar, 4 / 5);
  max-height: min(520px, 62svh);
}

@container demo-frame (min-width: 760px) {
  [data-beat="house-cast"] .house-cast-stage {
    aspect-ratio: 4 / 5;
    max-height: min(560px, 70vh);
  }
}

[data-beat="house-cast"] .house-cast-stage > .char-stage {
  flex: none;
  width: min(100cqw, 100cqh * var(--house-cast-ar, 0.8));
  height: auto;
}

[data-beat="house-cast"] .house-cast-stage > .char-stage[data-size] { min-width: 0; }

[data-beat="house-cast"] .house-cast-pick-copy { display: grid; gap: 4px; }

[data-beat="house-cast"] .house-cast-pick-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(24px, 2.6vw, 30px);
  line-height: 1.15;
}

[data-beat="house-cast"] .house-cast-pick-tagline {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  text-wrap: pretty;
}

[data-beat="house-cast"] .house-cast-pick-frame {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--muted);
}

[data-beat="house-cast"] .house-cast-pick-frame:empty,
[data-beat="house-cast"] .house-cast-pick-name:empty,
[data-beat="house-cast"] .house-cast-pick-tagline:empty { display: none; }

[data-beat="house-cast"] .house-cast-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

[data-beat="house-cast"] .house-cast-tools[hidden] { display: none; }

[data-beat="house-cast"] .house-cast-hear,
[data-beat="house-cast"] .house-cast-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color .12s, filter .12s;
}

/* The one control the beat is about: the accent, once in the frame. */
[data-beat="house-cast"] .house-cast-hear {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

[data-beat="house-cast"] .house-cast-hear:hover { filter: brightness(1.08); }
[data-beat="house-cast"] .house-cast-hear:disabled { opacity: .6; cursor: default; filter: none; }
[data-beat="house-cast"] .house-cast-open:hover { border-color: var(--muted); }

[data-beat="house-cast"] .house-cast-icon { width: 11px; height: 11px; flex: none; }
[data-beat="house-cast"] .house-cast-icon[hidden] { display: none; }

/* The provider that spoke the intro, with the note on what an intro is under it. */
[data-beat="house-cast"] [data-row="provider"] .demo-frame-note { margin-top: 4px; }

/* The line's time beside its controls: the frame has no foot of its own here. */
[data-beat="house-cast"] .house-cast-status { flex-basis: 100%; min-height: 1.4em; }

/* ── The sheet ─────────────────────────────────────────────────────────── */

[data-beat="house-cast"] .house-cast-sheet { min-width: 0; }

[data-beat="house-cast"] .house-cast-count {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

[data-beat="house-cast"] .house-cast-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

[data-beat="house-cast"] .house-cast-card { min-width: 0; }
[data-beat="house-cast"] .house-cast-card[hidden] { display: none; }

/* A card: a headshot over the name and the tagline (a phone), or beside them (a desk). */
[data-beat="house-cast"] .house-cast-face {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "thumb" "name" "tagline";
  align-content: start;
  gap: 2px;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 6px 6px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s, background-color .12s;
}

[data-beat="house-cast"] .house-cast-face:hover { background: var(--panel-2); }

[data-beat="house-cast"] .house-cast-face[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--panel-2);
}

[data-beat="house-cast"] .house-cast-thumb {
  grid-area: thumb;
  display: block;
  aspect-ratio: 1 / 1;
  margin: 0 0 6px;
  border-radius: 8px;
  overflow: hidden;
  background: #0e0b14; /* the stage ground, until the thumbnail is in */
}

[data-beat="house-cast"] .house-cast-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
}

[data-beat="house-cast"] .house-cast-thumb img:not([src]) { visibility: hidden; }

[data-beat="house-cast"] .house-cast-card-name {
  grid-area: name;
  min-width: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.2;
}

[data-beat="house-cast"] .house-cast-card-tagline {
  grid-area: tagline;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}

@container demo-frame (min-width: 560px) {
  [data-beat="house-cast"] .house-cast-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* A desk: three to a row, the headshot beside the words. */
@container demo-frame (min-width: 760px) {
  [data-beat="house-cast"] .house-cast-face {
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-areas: "thumb name" "thumb tagline";
    grid-template-rows: auto 1fr;
    column-gap: 11px;
    row-gap: 3px;
    padding: 7px;
  }

  [data-beat="house-cast"] .house-cast-thumb {
    aspect-ratio: 4 / 5;
    margin: 0;
    border-radius: 7px;
  }

  [data-beat="house-cast"] .house-cast-card-name { font-size: 16.5px; padding-top: 2px; }
  [data-beat="house-cast"] .house-cast-card-tagline { -webkit-line-clamp: 3; font-size: 12.5px; }
}
