/* SELFREF//PENTAD: the shared lab layout (../assets/theme.css) carries the page. Only what belongs to this page is
   here: the stage pointer, the amber handle, the two-segment lens, text cases for mathematics, readout colour roles
   and the compact HUD of small frames. Colours come from the tokens (var(--cyan) …), never from literal values. */
/* a size container (local-viz-cards): every child of the stage is absolutely placed and its height comes from the lab
   grid row and min-height, so size containment changes no layout; it lets the HUD read the stage's width and height */
#stage { container-type: size; }
/* only a live stage takes the pointer; a still (cover, cited still) lets touch scroll the page */
.stage:not(.still) #cv { cursor: grab; touch-action: none; }
.stage:not(.still) #cv:active { cursor: grabbing; }
.stage.still #cv { cursor: default; touch-action: auto; }

.logo span { color: var(--cyan); font-weight: 700; }
.tagline em, .sheet li b { color: var(--cyan); }
.hud-tl .big { color: var(--sigma); }
.field output, dl.ro .a dd { color: var(--ink); }
.hud-tl .big, .hud-tl .sub, .strip .head h2, .strip .head span, .tau, .hud-bl { text-transform: none; }
.hud-tl .sub { line-height: 1.4; }
/* the display and body faces have no ∉: set it in the data face */
.hud-tl .sym, .stage .tag .sym { font-family: var(--font-data); }

/* the lens: two buttons, the pressed one in amber (the current choice) */
.lens-toggle { display: flex; border: 1px solid var(--line-hot); margin: 0 0 8px; }
.lens-toggle button { flex: 1 1 0; min-width: 0; padding: 8px 7px; border: 0; background: transparent; color: var(--dim); font: inherit; font-size: 12px; line-height: 1.3;
  text-align: center; cursor: pointer; text-transform: none; }
.lens-toggle button + button { border-left: 1px solid var(--line-hot); }
.lens-toggle button[aria-pressed="true"] { background: var(--amber); color: var(--on-accent); font-weight: 600; }
.lens-toggle button:hover { color: var(--ink); }
.lens-toggle button[aria-pressed="true"]:hover { color: var(--on-accent); }
.lens-toggle button:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.lens-note { margin-top: 0; }

/* the right column: the theory button on top, then parameters, readouts and evidence */
.side > #infoBtn { flex: none; align-self: stretch; text-align: center; padding: 7px 9px; }
#ctlPanel .field[hidden] { display: none; }
#ctlPanel .field { margin-bottom: 6px; }
.twist-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.twist-field .flabel { font-size: 12.5px; color: var(--ink); }
.twist-field .chip { text-transform: none; }
#ctlScene { text-transform: none; }

/* readouts by colour role: cyan = line and inner product, magenta = area and what escapes, violet = axis and scaffold */
dl.ro dd output { font: inherit; color: inherit; }
dl.ro .v dd { color: var(--violet); }
dl.ro dt, dl.ro dd { text-transform: none; }
.nummark { color: var(--dim); }

/* the amber handle: a button on the object, so dragging it never turns the camera */
.handle { position: absolute; left: 0; top: 0; z-index: 3; width: 28px; height: 28px; padding: 0; margin: 0; border: 2px solid var(--amber); border-radius: 50%;
  background: color-mix(in srgb, var(--amber) 12%, transparent); transform: translate(-50%, -50%); cursor: grab; touch-action: none;
  user-select: none; -webkit-user-select: none; box-shadow: 0 0 10px color-mix(in srgb, var(--amber) 55%, transparent); }
.handle:active, .handle.dragging { cursor: grabbing; background: color-mix(in srgb, var(--amber) 28%, transparent); }
.handle[hidden] { display: none; }
.stage.still .handle { pointer-events: none; }
:root[data-thumb-mode] .handle, :root[data-shot] .handle { display: none; }

/* stage labels keep their case and their colour role */
.stage .tag.raw { text-transform: none; }
.stage .tag.c-cy { color: var(--cyan); }
.stage .tag.c-mg { color: var(--magenta); }
.stage .tag.c-vi { color: var(--violet); }
.stage .tag.c-am { color: var(--amber); }
.stage .tag.c-ik { color: var(--ink); }
.stage .tag.c-dm { color: var(--dim); }

/* legend swatches of this page */
.sw.ring { width: 10px; height: 10px; border-radius: 50%; background: transparent; border: 2px solid var(--amber); }

/* time-rail text: a hint line and a formula line */
.keys #hint, .keys #formula { display: block; }
.keys #formula { font-family: var(--font-data); color: var(--ink); font-size: 10.5px; margin-top: 2px; text-transform: none; }

/* small stages (narrow frames of the book, phones): tighter HUD */
@container (max-width: 620px) {
  .hud-tl { left: 12px; max-width: calc(100% - 24px); }
  .hud-tl .big { font-size: 12px; }
  .hud-tl .sub { font-size: 10.5px; line-height: 1.35; }
  .hud-bl { left: 12px; right: 12px; bottom: 9px; gap: 2px 10px; font-size: 10px; }
  .stage .tag.raw { font-size: 10.5px; }
  .handle { width: 24px; height: 24px; }
}
/* short stages (a low frame in the book, a phone held sideways): the same compact HUD, read from the height */
@container (max-height: 320px) {
  .hud-tl { top: 10px; }
  .hud-tl .big { font-size: 12px; }
  .hud-tl .sub { font-size: 10.5px; line-height: 1.35; }
  .hud-bl { bottom: 8px; gap: 2px 10px; font-size: 10px; }
  .stage .tag.raw { font-size: 10.5px; }
}

/* the one-column page (narrow windows, short screens): a taller stage, and the page scrolls as usual */
@media (max-width: 1080px) {
  :root:not([data-embed]):not([data-thumb-mode]):not([data-shot]) .lab .center { grid-template-rows: minmax(min-content, max(460px, 66vh)) auto auto; }
}
@media (max-width: 520px) {
  :root:not([data-embed]):not([data-thumb-mode]):not([data-shot]) .lab .center { grid-template-rows: minmax(min-content, max(480px, 66vh)) auto auto; }
}
