/* support: look — v9 art-direction system (piece.look / chapter.look / beat.look, piece.thread).
   Loaded ONLY when a piece names a look or a thread. Every colour is a tenant token (--brand-color-*, dark-*); a brand
   with no dark ladder derives "studio" from its ink / ground tokens with color-mix in oklch. No hex, no glow, no blur
   filter, no colour gradient as a fill: the vignette and the far pool are SOLID token colours shaped by a radial ALPHA
   mask (D-017 scrim rule); the grain is a static feTurbulence alpha mask over the ink token at low opacity.
   Depth = 3 layers per look: base ground (the scene background) · far pool (drifts, painted on the timeline) ·
   vignette + grain (static, nearest).
   © Dudoxx UG / Acceleate Consulting - Walid Boudabbous <walid@acceleate.com> */

/* ---- look tokens ---------------------------------------------------------------------------------------- */
.scene.look-porcelain, .scene.look-editorial {
  --lk-ground: var(--brand-color-bg);
  --lk-pool: var(--brand-color-paper, var(--brand-color-bg));
  --lk-edge: var(--brand-color-bg-recessed, var(--brand-color-muted, var(--brand-color-bg)));
  --lk-vig-o: 0.85; --lk-grain-o: 0.045; --lk-pool-o: 1;
  --lk-display: 4.4cqw; --lk-display-mid: 3.8cqw; --lk-display-stack: 4cqw;
}
.scene.look-studio {
  /* the brand DARK ladder; without one: ink-derived (fg is the darkest brand ink) */
  --lk-ground: var(--brand-color-dark-bg, color-mix(in oklch, var(--brand-color-fg) 90%, var(--brand-color-bg)));
  --lk-pool: color-mix(in oklch, var(--brand-color-dark-card, color-mix(in oklch, var(--brand-color-fg) 80%, var(--brand-color-bg))) 90%, var(--brand-color-dark-fg, var(--brand-color-bg)));
  --lk-edge: var(--brand-color-dark-bg-recessed, var(--brand-color-dark-sidebar, var(--brand-color-fg)));
  --lk-vig-o: 0.9; --lk-grain-o: 0.06; --lk-pool-o: 0.9;
  --lk-display: 4.4cqw; --lk-display-mid: 3.8cqw; --lk-display-stack: 4cqw;
  --ink: var(--brand-color-dark-fg, var(--brand-color-bg));
  --muted: var(--brand-color-dark-fg-secondary, var(--brand-color-dark-muted-foreground, color-mix(in oklch, var(--brand-color-bg) 72%, var(--brand-color-fg))));
  --card: var(--brand-color-dark-card, color-mix(in oklch, var(--brand-color-fg) 80%, var(--brand-color-bg)));
  --recess: var(--brand-color-dark-bg-recessed, var(--brand-color-dark-sidebar, var(--brand-color-fg)));
  --rule: var(--brand-color-dark-hairline, var(--brand-color-dark-border, color-mix(in oklch, var(--brand-color-bg) 16%, var(--brand-color-fg))));
  /* the ONE action accent on dark is the brand's dark primary (dudoxx vivid cobalt, acceleate light navy, d4h mint) */
  --accent: var(--brand-color-dark-primary, var(--brand-color-primary));
  --signal: var(--brand-color-dark-signal, var(--brand-color-signal, var(--brand-color-highlight, var(--brand-color-dark-accent, var(--accent)))));
  --lift: 0 0 0 1px var(--rule), 0 0.3cqw 0 0 color-mix(in oklch, var(--lk-edge) 70%, transparent);
  /* skin-depth paints the active note / step / agenda row with --tint-cobalt, a LIGHT tint: on the dark ground the
     light-ink label vanished (lab review r8). The studio tint is the accent mixed into the dark card. */
  --tint-cobalt: color-mix(in oklch, var(--accent) 24%, var(--card));
  background: var(--lk-ground); color: var(--ink);
}
.scene.look-editorial {
  --fs-headline: 4.6cqw; --fs-hero: 5.8cqw; --fs-title: 2.6cqw; --fs-lead: 2.3cqw; --fs-figure: 8.2cqw;
  --lk-display: 5.2cqw; --lk-display-mid: 4.3cqw; --lk-display-stack: 4.6cqw; --lk-grain-o: 0.035;
}
.scene.look-porcelain, .scene.look-editorial {
  /* light ink reset, so a light beat inside a studio chapter reads light */
  --ink: var(--brand-color-fg); --muted: var(--brand-color-fg-secondary, var(--brand-color-muted-foreground, var(--brand-color-fg)));
  --card: var(--brand-color-paper, var(--brand-color-bg)); --recess: var(--brand-color-bg-recessed, var(--brand-color-muted));
  --rule: var(--brand-color-hairline, var(--brand-color-muted)); --accent: var(--brand-color-primary);
  --signal: var(--brand-color-signal, var(--brand-color-highlight, var(--brand-color-primary)));
  background: var(--lk-ground); color: var(--ink);
}
.scene.has-look { isolation: isolate; } /* the ground sits at z -1 INSIDE the scene, under every in-flow block */

/* ---- ground: far pool (drifts) · vignette · grain ------------------------------------------------------- */
.lk-ground { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.lk-ground > i { position: absolute; display: block; }
.lk-far { inset: -10%; background: var(--lk-pool); opacity: var(--lk-pool-o);
  -webkit-mask-image: radial-gradient(ellipse 48% 56% at 68% 42%, black 0%, transparent 72%);
  mask-image: radial-gradient(ellipse 48% 56% at 68% 42%, black 0%, transparent 72%); }
.lk-vig { inset: 0; background: var(--lk-edge); opacity: var(--lk-vig-o);
  -webkit-mask-image: radial-gradient(ellipse 78% 74% at 50% 46%, transparent 58%, black 100%);
  mask-image: radial-gradient(ellipse 78% 74% at 50% 46%, transparent 58%, black 100%); }
.lk-grain { inset: 0; background: var(--ink, var(--brand-color-fg)); opacity: var(--lk-grain-o);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.6 0 0 0 -0.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url%28%23n%29'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.6 0 0 0 -0.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url%28%23n%29'/%3E%3C/svg%3E");
  -webkit-mask-size: 180px 180px; mask-size: 180px 180px; }
/* a chapter photo (scene-bg) already carries the depth: the far pool would only grey it */
.scene.has-bg > .lk-ground > .lk-far { display: none; }

/* ---- type: the look's display treatment ----------------------------------------------------------------- */
.scene.look-editorial .title, .look-editorial .title { letter-spacing: -0.03em; line-height: 1.04; }
.scene.look-editorial .accent-rail, .look-editorial .accent-rail { width: 9cqw; height: 0.45cqw; }
.scene.look-editorial .kicker, .look-editorial .kicker { font-size: var(--fs-label); }
.look-editorial .stack .title, .scene.look-editorial.stack .title { font-size: 4cqw; }
/* a BARE text column (kicker + title, no body, no points) is the scene's display focal instead of a thin head;
   sizes cut 15 % after AUDIT found 4 titles clipped in 23-30cqw rails (lab review r8); lines balance, never clip */
.has-look .col-text .title { text-wrap: balance; overflow-wrap: break-word; padding-bottom: 0.12em; } /* descenders below a 1.02 line height (AUDIT clip, r8) */
:is(.has-look.stack, .has-look .stack) > .col-text:not(:has(.body, .col-points)) .title { font-size: var(--lk-display-stack); line-height: 1.02; }
:is(.has-look:not(.stack):not(.has-beats), .has-look .scene-beat:not(.stack)):not(.preset-ui-tour):not(.preset-code):not(.preset-click-path):not(.preset-title-open):not(.preset-headline) > .col-text:not(:has(.body, .col-points)) .title { font-size: var(--lk-display); line-height: 1.02; }
:is(.has-look:not(.stack), .has-look .scene-beat:not(.stack)):is(.preset-device, .preset-table, .preset-field-review, .preset-progress, .preset-chart, .preset-doc-stage, .preset-hub, .preset-diagram) > .col-text:not(:has(.body, .col-points)) .title { font-size: var(--lk-display-mid); }

/* ---- studio: on-dark surfaces from the look tokens -------------------------------------------------------- */
.scene.look-studio .kicker, .look-studio .kicker { color: var(--brand-color-dark-link, var(--muted)); }
.scene.look-studio .kpi-label { color: var(--muted); }

/* a studio piece never dips to the light stage ground between two dark scenes (cut-rise leaves ~0.1 s of bare stage) */
.stage.on-dark:has(.scene.look-studio) { background: var(--brand-color-dark-bg, color-mix(in oklch, var(--brand-color-fg) 90%, var(--brand-color-bg))); }

/* 2026-11-05: a brand with no signal token (d4h) uses its highlight token: d4h.yaml names yellow the "pin-prick emphasis"
   (hover/active only, never a fill) and a rule + dot is exactly that, never a surface. */
/* ---- the thread: one brand-signal rule + dot that crosses every chapter seam (painted from t in look.js) --- */
.look-thread { position: absolute; left: 0; top: 0; z-index: 3; display: flex; align-items: center; height: 0.62cqw; pointer-events: none;
  color: var(--brand-color-signal, var(--brand-color-highlight, var(--brand-color-primary))); will-change: transform; }
.stage.on-dark .look-thread { color: var(--brand-color-dark-signal, var(--brand-color-signal, var(--brand-color-highlight, var(--brand-color-dark-accent, var(--brand-color-primary))))); }
.look-thread .lt-rule { display: block; width: 1.8cqw; height: 0.22cqw; border-radius: 99em; background: currentColor; transform-origin: 100% 50%; } /* the streak trails behind the dot */
.look-thread .lt-dot { display: block; width: 0.62cqw; aspect-ratio: 1; margin-left: 0.3cqw; border-radius: 50%; background: currentColor; }
.look-thread--dot .lt-rule, .look-thread--rule .lt-dot { display: none; }

/* ---- phone portrait ----------------------------------------------------------------------------------------- */
@media (max-width: 600px) and (orientation: portrait) {
  .lk-far { inset: -6% -20%; -webkit-mask-image: radial-gradient(ellipse 70% 40% at 50% 30%, black 0%, transparent 72%); mask-image: radial-gradient(ellipse 70% 40% at 50% 30%, black 0%, transparent 72%); }
  .lk-vig { -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 45%, transparent 60%, black 100%); mask-image: radial-gradient(ellipse 90% 80% at 50% 45%, transparent 60%, black 100%); }
  .lk-grain { -webkit-mask-size: 120px 120px; mask-size: 120px 120px; }
  .stage :is(.has-look.stack, .has-look .stack) > .col-text:not(:has(.body, .col-points)) .title,
  .stage .has-look .col-text:not(:has(.body, .col-points)) .title { font-size: calc(var(--fs-headline) * 1.25); }
  .stage .look-editorial .stack .title { font-size: var(--fs-headline); }
  /* A23: the editorial look re-sets the type tokens in cqw and dropped the phone px floors (piece.css phone block):
     a file-drop count rendered at 8.7 px. Same floors here. */
  .stage .scene.look-editorial { --fs-headline: max(4.6cqw, 21px); --fs-hero: max(5.8cqw, 25px); --fs-title: max(2.6cqw, 15px); --fs-lead: max(2.3cqw, 14px); --fs-figure: max(8.2cqw, 30px); }
  .look-thread { height: 1.4cqw; }
  .look-thread .lt-rule { width: 4cqw; height: 0.5cqw; }
  .look-thread .lt-dot { width: 1.4cqw; margin-left: 0.6cqw; }
  .stage.has-thread { --lt-slot: calc(4cqw + 0.6cqw + 1.4cqw + 1.6cqw); }
}
@media (prefers-reduced-motion: reduce) { .look-thread { will-change: auto; } }
.stage.has-thread .eyebrow-rule { visibility: hidden; width: 0; margin: 0; } /* the thread takes the eyebrow rule's place (2026-11-05: two rules stacked) */
/* the thread's reserved slot (2026-11-05 r2): every kicker is padded by the thread's width + gap, and look.js rests the
   thread in that padding, left of the kicker's first line, so it never crosses a word. --lt-slot = rule + gap + dot + gap. */
.stage.has-thread { --lt-slot: calc(1.8cqw + 0.3cqw + 0.62cqw + 1.6cqw); }
.stage.has-thread .kicker { padding-left: var(--lt-slot); }
/* the title rule is seated INSIDE its title by look.js: below the last line, on the title's own depth transform */
.title > .accent-rail { margin-top: 0.35em; }
