/* Project plate, exhibit part: the vitrine around the one skinnable region, and its caption.
   The frame owns .exhibit__stage's box (SPEC §6); the skin file owns everything inside it. */
@layer exhibit {
  .exhibit {
    position: relative;

    /* vitrine corners, in frame red */
    &::before {
      content: ''; position: absolute; inset: -9px; pointer-events: none;
      border: 1px solid var(--accent);
      --k: 18px;
      mask:
        linear-gradient(#000 0 0) top left / var(--k) var(--k) no-repeat,
        linear-gradient(#000 0 0) top right / var(--k) var(--k) no-repeat,
        linear-gradient(#000 0 0) bottom left / var(--k) var(--k) no-repeat,
        linear-gradient(#000 0 0) bottom right / var(--k) var(--k) no-repeat;
    }
  }

  .exhibit__stage {
    container-type: inline-size;
    isolation: isolate;
    overflow: clip;
    contain: paint;
    min-block-size: 14rem;
    padding: clamp(12px, 2.2cqi, 28px);
    background: var(--skin-bg, var(--black));
    color: var(--skin-ink, var(--ink));

    & .hp { inline-size: 100%; }
  }

  .exhibit__caption {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem 1.5rem;
    margin-block-start: 0.9rem;
    font: 400 var(--fs-label) / 1.5 var(--mono); letter-spacing: 0.06em; color: var(--ink-3);

    & span { max-inline-size: 62ch; text-wrap: pretty; }
    & > span { flex: 1 1 24ch; } /* the caption gives way first, so the readout never wraps alone */
    /* The wire readout: observation of real htmx requests into the stage, never content. Visible,
       and silent to screen readers (aria-live="off" in the markup): it changes every poll. */
    & output {
      display: inline-flex; flex-wrap: wrap; flex: 0 1 auto; justify-content: flex-end; gap: 0 0.6ch;
      color: var(--accent-text); font-variant-numeric: tabular-nums;
    }
  }
  /* While live demos are paused (scripts/live.js), the readout says so instead of going quiet. The
     suffix is always laid out, so pausing never changes the readout's width: hidden, it waits in front
     of the figure; shown, it moves behind it. The caption never re-wraps and the page never moves. */
  .exhibit__caption output::after { content: '\00b7  paused' / ''; order: -1; visibility: hidden; color: var(--ink-2); }
  :root[data-paused] .exhibit__caption output::after { order: 0; visibility: visible; }
  /* Narrow figures put the readout on its own line, flush left: there the hidden suffix trails it instead */
  .exhibit { container: exhibit / inline-size; }
  @container exhibit (inline-size < 30rem) {
    .exhibit__caption output { justify-content: flex-start; }
    .exhibit__caption output::after { order: 0; }
  }
}
