/*
 * Beat character-workshop: Atelier, the character editor's three asset panes on a house
 * character with the regenerate control under them (web/landing/sections/
 * character-workshop.html). Linked in the page head by lib/landing.ts while the beat is
 * enabled; the shells' sheets it builds on (DemoFrame, CharacterSurface, ShapeStrip) 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
 * (character-workshop-atelier) is styled here and nowhere else.
 *
 * Layout: the copy as a header, then the Atelier window: the character on the left with
 * the region outline over the stage and its file and numbers under it; the panes on the
 * right, chosen from a row in the editor's own nav style (mono, uppercase), then the
 * active pane, then the editor's control row (Regenerate and Undo, disabled, Selected, the
 * note). On a phone: the character, then the panes, the choices wrapping.
 *
 * The outline is a sibling of the stage box laid over it (the stage owns its box's
 * children). Its box is in percent of the frame, and the stage box has the frame's own
 * aspect ratio with the art contained, so the percent of the box is the percent of the
 * art. Nothing here draws on, moves or transforms the stage's layers.
 *
 * Type: mono for the pane names, the shape letters, the expression and asset ids, the
 * file names and the numbers; the system sans for the controls' words and the note.
 */

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

.use-case[data-beat="character-workshop"] .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="character-workshop"] .use-case-eyebrow { grid-area: eyebrow; }
.use-case[data-beat="character-workshop"] .use-case-title { grid-area: title; margin: 0; }
.use-case[data-beat="character-workshop"] .use-case-body { grid-area: body; padding-bottom: 6px; }

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

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

/* ── The window: the character left, the panes right ──────────────────── */

@container demo-frame (min-width: 640px) {
  [data-beat="character-workshop"] .demo-frame-body {
    grid-template-columns: minmax(240px, 5fr) minmax(0, 6fr);
    grid-template-areas: "stage main";
    align-items: start;
    gap: 18px 28px;
    padding: 20px;
  }
}

/* ── The stage, the region over it, the file and numbers under it ─────── */

[data-beat="character-workshop"] .character-workshop-view {
  margin: 0 auto;
  max-width: 460px;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

[data-beat="character-workshop"] .character-workshop-canvas {
  position: relative;
  min-width: 0;
}

[data-beat="character-workshop"] .character-workshop-region {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px dashed var(--accent);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(14, 11, 20, .55), inset 0 0 0 1px rgba(14, 11, 20, .35);
  pointer-events: none;
}

[data-beat="character-workshop"] .character-workshop-region[hidden] { display: none; }

[data-beat="character-workshop"] .character-workshop-caption {
  margin: 0;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}

[data-beat="character-workshop"] .character-workshop-caption code { font-family: inherit; }
[data-beat="character-workshop"] .character-workshop-file { color: var(--text); }
[data-beat="character-workshop"] .character-workshop-numbers { font-variant-numeric: tabular-nums; }

/* ── The pane choices, in the editor's nav style ───────────────────────── */

[data-beat="character-workshop"] .character-workshop-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 14px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

[data-beat="character-workshop"] .character-workshop-pane-choice {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}

[data-beat="character-workshop"] .character-workshop-pane-choice:hover { color: var(--text); }

[data-beat="character-workshop"] .character-workshop-pane-choice[aria-pressed="true"] {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}

[data-beat="character-workshop"] .character-workshop-pane-choice:disabled { cursor: default; }
[data-beat="character-workshop"] .character-workshop-pane-choice:disabled:hover { color: var(--muted); }
[data-beat="character-workshop"] .character-workshop-pane-choice[aria-pressed="true"]:disabled:hover { color: var(--text); }

[data-beat="character-workshop"] :is(.character-workshop-pane-choice, .character-workshop-blink, .character-workshop-expression, .character-workshop-edit, .character-workshop-file-link):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── The panes ─────────────────────────────────────────────────────────── */

/* One column held to the slot's width: an auto track would grow to the chip grid's
   widest row (its auto-fill reads the strip's max-width) and push the page sideways. */
[data-beat="character-workshop"] .character-workshop-pane {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

/* The strip's own grid (ShapeStrip.css) has the same auto track: held here too. */
[data-beat="character-workshop"] .character-workshop-strip { grid-template-columns: minmax(0, 1fr); }

[data-beat="character-workshop"] .character-workshop-pane[hidden] { display: none; }

[data-beat="character-workshop"] .character-workshop-files {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
}

[data-beat="character-workshop"] .character-workshop-file-link {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

[data-beat="character-workshop"] .character-workshop-file-link:hover { color: var(--text); text-decoration-color: var(--muted); }

/* Blink: one control, the size of a pane's worth of chips. */
[data-beat="character-workshop"] .character-workshop-blink {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .1s;
}

[data-beat="character-workshop"] .character-workshop-blink:hover { border-color: var(--accent); }
[data-beat="character-workshop"] .character-workshop-blink:active { background: var(--ink); }
[data-beat="character-workshop"] .character-workshop-blink:disabled { cursor: default; opacity: .6; }
[data-beat="character-workshop"] .character-workshop-blink:disabled:hover { border-color: var(--line); }

/* A closed lid, drawn: a shallow arc with three lashes. */
[data-beat="character-workshop"] .character-workshop-lid {
  position: relative;
  width: 18px;
  height: 9px;
  flex: none;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 10px 10px;
}

/* Expressions: chips with the API's ids. */
[data-beat="character-workshop"] .character-workshop-expressions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 6px;
  max-width: 560px;
}

[data-beat="character-workshop"] .character-workshop-expression {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color .1s, background-color .1s;
}

[data-beat="character-workshop"] .character-workshop-expression:hover { border-color: var(--muted); }

[data-beat="character-workshop"] .character-workshop-expression[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--ink);
}

[data-beat="character-workshop"] .character-workshop-expression:disabled { cursor: default; }
[data-beat="character-workshop"] .character-workshop-expression:disabled:hover { border-color: var(--line); }
[data-beat="character-workshop"] .character-workshop-expression[aria-pressed="true"]:disabled:hover { border-color: var(--accent); }

/* ── The editor's control row: disabled here, and said so ──────────────── */

[data-beat="character-workshop"] .character-workshop-regen {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

[data-beat="character-workshop"] .character-workshop-regen-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

[data-beat="character-workshop"] :is(.character-workshop-regenerate, .character-workshop-undo) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

[data-beat="character-workshop"] .character-workshop-undo { background: none; font-weight: 500; }
[data-beat="character-workshop"] :is(.character-workshop-regenerate, .character-workshop-undo):disabled { opacity: .55; cursor: not-allowed; }
[data-beat="character-workshop"] .character-workshop-glyph { font-size: 14px; line-height: 1; }

[data-beat="character-workshop"] .character-workshop-selected {
  margin: 0 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}

[data-beat="character-workshop"] .character-workshop-selected-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

[data-beat="character-workshop"] .character-workshop-selected-id {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
}

[data-beat="character-workshop"] .character-workshop-note {
  margin: 0;
  max-width: 62ch;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* ── A phone: the choices and the control row wrap, Selected on its own line ── */

@container demo-frame (max-width: 459px) {
  [data-beat="character-workshop"] .character-workshop-pane-choice {
    flex: 1 1 auto;
    padding: 8px 8px;
    letter-spacing: .06em;
  }

  [data-beat="character-workshop"] .character-workshop-selected { margin-left: 0; flex: 1 1 100%; }
}
