/*
 * Beat small-mouths: Pocketworld, a miniature game HUD with Pip at two sizes over one
 * voice and two analyses of it (web/landing/sections/small-mouths.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 (small-mouths-pocketworld) is styled here and nowhere else.
 *
 * Layout: the copy as a header across the top, the Pocketworld window full width below. In
 * it: the controls (extendedShapes with its two sets and the cue count, the two views), the
 * two views side by side (the inspection stage and the game screen, whose dialogue box
 * holds Pip at his real HUD size), then the cue lists on one axis. Inspect / In the
 * interface move the width between the two views; on a phone they are tabs and one view
 * shows at a time. The HUD portrait never changes size: 56 px is the point.
 *
 * Type: mono for the shape identifiers, the parameter, the counts and the pixel sizes; the
 * system sans for the size labels and the line; the serif only in the copy's title.
 */

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

.use-case[data-beat="small-mouths"] .use-case-copy {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  grid-template-areas:
    "eyebrow eyebrow"
    "title body";
  align-items: end;
  gap: 0 clamp(28px, 5vw, 72px);
  margin: 0 0 clamp(24px, 4vh, 36px);
}

.use-case[data-beat="small-mouths"] .use-case-eyebrow { grid-area: eyebrow; }
.use-case[data-beat="small-mouths"] .use-case-title { grid-area: title; margin: 0; }
.use-case[data-beat="small-mouths"] .use-case-body { grid-area: body; padding-bottom: 6px; }

@media (max-width: 860px) {
  .use-case[data-beat="small-mouths"] .use-case-copy {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "eyebrow" "title" "body";
  }

  .use-case[data-beat="small-mouths"] .use-case-title { margin: 0 0 16px; }
}

/* ── The window: the views, then the cue lists ─────────────────────────── */

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

[data-beat="small-mouths"] .demo-frame-slot[data-slot="main"] {
  display: grid;
  gap: 16px;
}

/* ── The controls ─────────────────────────────────────────────────────── */

[data-beat="small-mouths"] .small-mouths-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  min-width: 0;
}

[data-beat="small-mouths"] .small-mouths-sets,
[data-beat="small-mouths"] .small-mouths-prominence {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

[data-beat="small-mouths"] .small-mouths-sets[hidden],
[data-beat="small-mouths"] .small-mouths-prominence[hidden] { display: none; }

[data-beat="small-mouths"] .small-mouths-prominence { margin-left: auto; }

[data-beat="small-mouths"] .small-mouths-param {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-right: 2px;
}

[data-beat="small-mouths"] :is(.small-mouths-set, .small-mouths-view-choice) {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  transition: border-color .12s;
}

[data-beat="small-mouths"] :is(.small-mouths-set, .small-mouths-view-choice):hover { border-color: var(--muted); }
[data-beat="small-mouths"] :is(.small-mouths-set, .small-mouths-view-choice)[aria-pressed="true"] { border-color: var(--accent); background: var(--ink); }

[data-beat="small-mouths"] .small-mouths-value {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

[data-beat="small-mouths"] .small-mouths-count {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

[data-beat="small-mouths"] .small-mouths-count-n {
  color: var(--text);
  font-size: 15px;
}

[data-beat="small-mouths"] .small-mouths-count-n[hidden] { display: none; }

/* ── The two views ────────────────────────────────────────────────────── */

[data-beat="small-mouths"] .small-mouths-views {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px clamp(20px, 4cqw, 44px);
  min-width: 0;
}

[data-beat="small-mouths"] .small-mouths-pane {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: width .2s ease;
}

/* Inspect prominent: the stage large, the game screen beside it at a modest width. */
[data-beat="small-mouths"] .small-mouths-pane[data-pane="inspect"] { width: clamp(240px, 38cqw, 400px); }
[data-beat="small-mouths"] .small-mouths-pane[data-pane="interface"] { width: clamp(260px, 34cqw, 360px); }

/* In the interface prominent: the game screen wide, the inspection stage at its minimum. */
[data-beat="small-mouths"] [data-prominent="interface"] .small-mouths-pane[data-pane="inspect"] { width: 240px; }
[data-beat="small-mouths"] [data-prominent="interface"] .small-mouths-pane[data-pane="interface"] { width: clamp(300px, 56cqw, 640px); }

[data-beat="small-mouths"] .small-mouths-size {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  font-size: 12.5px;
  color: var(--muted);
}

[data-beat="small-mouths"] .small-mouths-px {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── The game screen ──────────────────────────────────────────────────── */

[data-beat="small-mouths"] .small-mouths-hud {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  aspect-ratio: 16 / 11;
  min-height: 210px;
  overflow: hidden;
  border-radius: 12px;
  background: #1b1526;
  box-shadow: 0 0 0 1px var(--line);
}

[data-beat="small-mouths"] .small-mouths-hud-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
}

[data-beat="small-mouths"] .small-mouths-hud-hearts { display: inline-flex; gap: 3px; }

[data-beat="small-mouths"] .small-mouths-hud-hearts i {
  width: 11px;
  height: 10px;
  background: var(--text);
  clip-path: polygon(50% 100%, 0 45%, 0 15%, 25% 0, 50% 18%, 75% 0, 100% 15%, 100% 45%);
}

[data-beat="small-mouths"] .small-mouths-hud-hearts i.small-mouths-hud-empty { background: var(--line); }

[data-beat="small-mouths"] .small-mouths-hud-level { margin-left: auto; color: var(--muted); }

[data-beat="small-mouths"] .small-mouths-hud-coins { display: inline-flex; align-items: center; gap: 4px; }

[data-beat="small-mouths"] .small-mouths-hud-coins i {
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--text);
  transform: rotate(45deg);
}

/* The world: a horizon and three platforms, flat. */
[data-beat="small-mouths"] .small-mouths-hud-world {
  position: relative;
  min-height: 0;
  border-bottom: 2px solid #2c2340;
}

[data-beat="small-mouths"] .small-mouths-hud-block {
  position: absolute;
  bottom: 0;
  background: #2c2340;
  border-radius: 3px 3px 0 0;
}

[data-beat="small-mouths"] .small-mouths-hud-block[data-block="a"] { left: 8%; width: 18%; height: 34%; }
[data-beat="small-mouths"] .small-mouths-hud-block[data-block="b"] { left: 40%; width: 12%; height: 58%; }
[data-beat="small-mouths"] .small-mouths-hud-block[data-block="c"] { right: 10%; width: 22%; height: 22%; }

/* The dialogue box: Pip at his HUD size, his name, the line. */
[data-beat="small-mouths"] .small-mouths-hud-dialog {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
}

[data-beat="small-mouths"] .small-mouths-hud-face {
  flex: none;
  border-radius: 6px;
}

[data-beat="small-mouths"] .small-mouths-hud-words {
  min-width: 0;
  display: grid;
  gap: 2px;
}

[data-beat="small-mouths"] .small-mouths-hud-name {
  margin: 0;
  min-height: 1.2em;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

[data-beat="small-mouths"] .small-mouths-flow .reader-flow-text {
  font-size: 12.5px;
  line-height: 1.45;
}

/* ── The cue lists: the selected analysis's lane lit, the other set back ─ */

[data-beat="small-mouths"] [data-set="nine"] .timeline-desk-lane[data-lane="six"],
[data-beat="small-mouths"] [data-set="six"] .timeline-desk-lane[data-lane="nine"] { opacity: .45; }

/* ── The foot ─────────────────────────────────────────────────────────── */

[data-beat="small-mouths"] .small-mouths-supplied {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--muted);
}

/* ── The drawer: the shapes ───────────────────────────────────────────── */

/* One column held to the drawer's width: an auto track grows to the chip grid's widest
   row (its auto-fill reads the strip's max-width, 516 px of chips) and pushed the page to
   724 px at a 360 px viewport with the drawer open. */
[data-beat="small-mouths"] .small-mouths-shapes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 0 14px 16px;
}

[data-beat="small-mouths"] .small-mouths-shapes-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

[data-beat="small-mouths"] .small-mouths-shapes-label [hidden] { display: none; }

/* A specimen stage beside the chips: the frame a chip shows, in sight while the drawer is
   read (the two stages above are scrolled away by then). */
[data-beat="small-mouths"] .small-mouths-specimen-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 16px;
}

[data-beat="small-mouths"] .small-mouths-specimen { flex: none; border-radius: 10px; }
[data-beat="small-mouths"] .small-mouths-specimen[hidden] { display: none; }
/* The strip's own grid (ShapeStrip.css) has the same auto track: held here too. */
[data-beat="small-mouths"] .small-mouths-strip { flex: 1 1 260px; grid-template-columns: minmax(0, 1fr); }

/* ── A phone: one view at a time, the two choices as tabs ─────────────── */

@container demo-frame (max-width: 599px) {
  [data-beat="small-mouths"] .small-mouths-sets {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  [data-beat="small-mouths"] .small-mouths-sets[hidden] { display: none; }
  [data-beat="small-mouths"] .small-mouths-param { grid-column: 1 / -1; }
  [data-beat="small-mouths"] .small-mouths-set {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 8px;
    border-radius: 14px;
  }

  [data-beat="small-mouths"] .small-mouths-prominence {
    margin-left: 0;
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  [data-beat="small-mouths"] .small-mouths-prominence[hidden] { display: none; }

  [data-beat="small-mouths"] .small-mouths-view-choice { justify-content: center; }

  [data-beat="small-mouths"] .small-mouths-pane[data-pane],
  [data-beat="small-mouths"] [data-prominent="interface"] .small-mouths-pane[data-pane] { width: 100%; }

  [data-beat="small-mouths"] [data-prominent="inspect"] .small-mouths-pane[data-pane="interface"],
  [data-beat="small-mouths"] [data-prominent="interface"] .small-mouths-pane[data-pane="inspect"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  [data-beat="small-mouths"] .small-mouths-pane { transition: none; }
}
