/* agenda v6 "toc" — the designed index (tiles, one active tile, travelling frame marker, camera push). Loaded only with
   the agenda preset. The legacy list (layout: "list") keeps its rules in piece.css (.agenda-*); nothing here touches it.
   © Dudoxx UG / Acceleate Consulting - Walid Boudabbous <walid@acceleate.com>
   Tokens only (no hex, no gradient, no blur, no glow). State comes from two vars per tile that agenda.js paints from t:
   --on (0..1: the active weight) and --seen (0..1); the list carries --recede (0..1, the walk has started).
   No will-change anywhere: a cached layer raster at an old scale breaks seek purity (icon-kit lesson). */
.scene.is-toc { gap: 1cqw; padding-bottom: 9cqw; }
.scene.is-toc > .toc { flex: 1 1 auto; min-height: 0; display: flex; position: relative; }
.scene.is-toc.stack .title { font-size: 2.7cqw; }
.scene.is-toc .title { padding-block-start: 0.1em; margin-block-start: -0.1em; } /* the display face's glyph box (~1.2em) rose 0.1em above the
   1.02 line box: AUDIT clip on the title (lab open-b4, 2026-11-05). The padding holds the glyphs, the margin keeps the row in place. */
.scene.is-toc.stack > .col-text { display: flex; align-items: baseline; gap: 1.4cqw; } /* kicker + title on ONE line: the height goes to the tiles */
.scene.is-toc.stack .kicker { margin: 0; }
.scene.is-toc.stack .accent-rail { display: none; } /* the tiles' bars draw instead: the head stays one row tall */
.scene.is-toc.stack > .col-text > :is(.col-ico, .art) { display: none; } /* a stacked index spends its height on the tiles */
.scene.is-toc.is-side { align-items: stretch; }
.scene.is-toc.is-side > .col-text { flex: 0 0 28cqw; max-width: 28cqw; }
.scene.is-toc > .toc-sum { position: absolute; right: var(--safe-x); top: var(--safe-top); margin: 0; padding-top: 2cqw;
  font-family: var(--face-mono); font-size: var(--fs-label); color: var(--muted); font-variant-numeric: tabular-nums; }
.scene.is-toc .col-text > .toc-sum { margin: 1cqw 0 0; font-family: var(--face-mono); font-size: var(--fs-eyebrow); color: var(--muted); font-variant-numeric: tabular-nums; }

.toc-view { position: relative; flex: 1 1 auto; min-height: 0; }
.toc-view.is-scroll { overflow: hidden; }
.toc-track { position: relative; box-sizing: border-box; height: 100%; margin: 0; padding: 0.6cqw; list-style: none;
  display: grid; grid-template-columns: repeat(var(--tcols, 5), minmax(0, 1fr)); grid-template-rows: repeat(var(--trows, 3), minmax(var(--tmin, 7cqw), 1fr));
  gap: 0.8cqw; -webkit-user-select: none; user-select: none; }
.toc-tile { --on: 0; --seen: 0; position: relative; min-width: 0; min-height: 0; z-index: 1; }
.toc-card { position: relative; box-sizing: border-box; height: 100%; display: flex; flex-direction: column; overflow: hidden;
  padding: 0.75cqw 1.1cqw 0.8cqw; border-radius: 1.1cqw; background: color-mix(in oklch, var(--accent) calc(var(--on) * 9%), var(--card));
  box-shadow: 0 0 0 1px var(--rule), 0 calc(0.3cqw + var(--on) * 0.35cqw) 0 0 color-mix(in oklch, var(--ink) calc(10% + var(--on) * 6%), transparent);
  transform: scale(calc(1 + var(--on) * 0.035)); transform-origin: 50% 50%;
  opacity: calc(1 - var(--recede, 0) * (1 - var(--on)) * (0.36 - var(--seen) * 0.1)); }
.toc-rule { position: absolute; left: 1.2cqw; right: 1.2cqw; top: 0; height: 0.28cqw; border-radius: 0 0 99em 99em; transform-origin: 0 50%;
  background: color-mix(in oklch, var(--accent) calc(35% + var(--on) * 65%), var(--rule)); }
.toc-top { position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 0.7cqw; min-height: 2.6cqw; }
.toc-top > * { flex: 0 0 auto; }
.toc-card .toc-ico { --ik-size: 2.6cqw; }
.toc-ico--svg { display: inline-grid; place-items: center; width: 2.6cqw; height: 2.6cqw; border-radius: 0.7cqw; color: var(--accent);
  background: color-mix(in oklch, var(--accent) 12%, var(--card)); }
.toc-ico--svg svg { width: 55%; height: 55%; }
.toc-n { display: inline-block; overflow: hidden; font-family: var(--face-head); font-weight: 700; font-size: 2.7cqw; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: color-mix(in oklch, var(--accent) calc(var(--on) * 100%), var(--ink)); }
.toc-roll { display: inline-block; }
.toc-top > .toc-aside { flex: 0 1 auto; margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25cqw; min-width: 0; }
.toc-act, .toc-badge { font-size: var(--fs-eyebrow); line-height: 1.2; white-space: nowrap; }
.toc-act { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-family: var(--face-mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.toc-badge { display: inline-block; padding: 0.15em 0.6em; border-radius: 99em; background: var(--recess); color: var(--ink); font-weight: 600; }
.toc-meta { display: flex; gap: 0.5cqw; white-space: nowrap; font-family: var(--face-mono); font-size: var(--fs-eyebrow); line-height: 1.2;
  font-variant-numeric: tabular-nums; color: var(--muted); }
.toc-d::before { content: "· "; }
.toc-t { color: color-mix(in oklch, var(--accent) calc(var(--on) * 100%), var(--muted)); }
/* seen: a small accent check chip on the icon tile's corner (or the number's, without an icon) */
.toc-check { position: absolute; left: 1.9cqw; top: -0.35cqw; width: 1.3cqw; height: 1.3cqw; border-radius: 50%; background: var(--accent);
  opacity: calc(var(--seen) * (1 - var(--on))); }
.toc-check::after { content: ""; position: absolute; left: 0.43cqw; top: 0.2cqw; width: 0.32cqw; height: 0.62cqw; border: solid var(--card);
  border-width: 0 0.17cqw 0.17cqw 0; transform: rotate(45deg); }
.scene.is-toc.stack .toc:not(.is-dense) .toc-d { display: none; } /* 5-column tiles: start time only */
.toc-tile.is-here .toc-check, .toc-tile.is-next .toc-check { display: none; }
.toc-l { flex: 0 0 auto; display: block; margin-top: auto; padding-top: 0.2cqw; font-family: var(--face-head); font-size: 1.9cqw; font-weight: 600; line-height: 1.15;
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc-line { flex: 0 0 auto; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; min-height: 2.4em; margin-top: 0.1cqw;
  font-size: var(--fs-eyebrow); line-height: 1.2; color: color-mix(in oklch, var(--ink) calc(var(--on) * 100%), var(--muted)); }
.toc-tile.no-line .toc-line { display: none; }
.toc-prog { position: absolute; left: 1.2cqw; right: 1.2cqw; top: 0; height: 0.28cqw; border-radius: 0 0 99em 99em; overflow: hidden; /* rides the tile's top bar */
  background: var(--rule); opacity: var(--on); }
.toc-fill { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.toc-marker { position: absolute; left: 0; top: 0; box-sizing: content-box; margin: -0.55cqw 0 0 -0.55cqw; padding: 0.3cqw;
  border: 0.25cqw solid var(--accent); border-radius: 1.4cqw; pointer-events: none; opacity: 0; z-index: 4; }
.toc-tile.is-next::after { content: attr(data-next); position: absolute; top: 1.1cqw; right: 1.3cqw; z-index: 5; padding: 0.15em 0.6em;
  border-radius: 99em; font-size: var(--fs-eyebrow); font-weight: 600; line-height: 1.2; color: var(--accent); background: var(--card);
  box-shadow: 0 0 0 0.16cqw var(--accent); }
.toc-tile.is-next .toc-aside { visibility: hidden; }

/* side (act opener, <= 8 rows): 1-2 wide columns beside the copy */
.toc.is-side { --tmin: 7cqw; }
.toc.is-side .toc-line { -webkit-line-clamp: 1; min-height: 1.25em; }

/* dense (> 15 chapters, wide stage): one-line tiles [icon · NN · title · m:ss], 4-5 columns, no one-liner */
@media not all and (max-width: 600px) and (orientation: portrait) {
  .toc.is-dense { --tmin: 4.2cqw; }
  .toc.is-dense .toc-track { gap: 0.7cqw 0.9cqw; }
  .toc.is-dense .toc-card { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-content: center; align-items: center;
    column-gap: 0.8cqw; padding: 0.5cqw 1cqw; border-radius: 0.8cqw; }
  .toc.is-dense .toc-top { display: contents; }
  .toc.is-dense .toc-card .toc-ico { --ik-size: 2.4cqw; grid-column: 1; grid-row: 1; }
  .toc.is-dense .toc-ico--svg { width: 2.4cqw; height: 2.4cqw; }
  .toc.is-dense .toc-n { grid-column: 2; grid-row: 1; font-size: 2.1cqw; }
  .toc.is-dense .toc-l { grid-column: 3; grid-row: 1; margin: 0; padding: 0; font-size: 1.55cqw; }
  .toc.is-dense .toc-aside { grid-column: 4; grid-row: 1; }
  .toc.is-dense :is(.toc-line, .toc-act, .toc-d, .toc-rule) { display: none; }
  .toc.is-dense .toc-check { left: 1.8cqw; top: 0.2cqw; }
  .toc.is-dense .toc-tile.is-next::after { top: 50%; transform: translateY(-50%); }
}

/* phone (390 x 844 and friends): one vertical list of tall rows; the camera scrolls it to the active row (agenda.js).
   Rows keep their height (the one-liner is always laid out), so the scroll target never moves under the camera. */
@media (max-width: 600px) and (orientation: portrait) {
  .stage .scene.is-toc { padding-bottom: var(--safe-bottom); }
  .stage .scene.is-toc > .col-text { order: 0; } .stage .scene.is-toc > .toc { order: 2; flex: 1 1 auto; width: 100%; }
  .stage .scene.is-toc.is-side > .col-text { flex: 0 0 auto; max-width: none; } /* the side head stacks: its 28cqw basis was a 106 px column on a phone, cutting the title (comm-fr act-4, 2026-11-05) */
  .stage .scene.is-toc > .toc-sum { order: 1; position: static; padding: 0; font-size: var(--fs-eyebrow); }
  .stage .scene.is-toc .title { font-size: var(--fs-headline); }
  .stage .toc-view { overflow: hidden; }
  .stage .toc-track { height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: auto; gap: 2.6cqw; padding: 2.6cqw; }
  .stage .toc-tile { grid-column: auto !important; }
  .stage .toc-card { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 3cqw; row-gap: 0.8cqw;
    align-items: center; padding: 3.4cqw 3.6cqw; border-radius: 3cqw; transform: scale(calc(1 + var(--on) * 0.04)); }
  .stage .toc-top { display: contents; }
  .stage .toc-card .toc-ico { --ik-size: max(9cqw, 34px); grid-column: 1; grid-row: 1 / span 2; }
  .stage .toc-ico--svg { width: max(9cqw, 34px); height: max(9cqw, 34px); border-radius: 2.2cqw; }
  .stage .toc-n { grid-column: 2; grid-row: 1 / span 2; font-size: max(7cqw, 26px); }
  .stage .toc-l { grid-column: 3; grid-row: 1; margin: 0; padding: 0; font-size: max(4.4cqw, 17px); }
  .stage .toc-line { grid-column: 3 / span 2; grid-row: 2; margin: 0; min-height: 0; -webkit-line-clamp: 1; font-size: max(3.3cqw, 13px); }
  .stage .toc-aside { grid-column: 4; grid-row: 1; }
  .stage :is(.toc-act, .toc-d, .toc-rule) { display: none; }
  .stage .toc-meta, .stage .toc-badge { font-size: max(2.8cqw, 11px); }
  .stage .toc-check { left: max(7cqw, 27px); top: 1.6cqw; width: max(3.4cqw, 13px); height: max(3.4cqw, 13px); }
  .stage .toc-check::after { left: 30%; top: 14%; width: 22%; height: 44%; border-width: 0 max(0.45cqw, 2px) max(0.45cqw, 2px) 0; }
  .stage .toc-prog { left: 3.6cqw; right: 3.6cqw; top: 0; height: 0.7cqw; }
  .stage .toc-marker { margin: -1.4cqw 0 0 -1.4cqw; padding: 0.8cqw; border-width: 0.6cqw; border-radius: 3.6cqw; }
  .stage .toc-tile.is-next::after { top: 3.4cqw; right: 3.6cqw; font-size: max(2.8cqw, 11px); }
}
