/*
 * Slides — slide engine geometry.
 *
 * This file only defines structure and behaviour: canvas scaling, scenes,
 * the camera of continuous scenes, step visibility and the chrome layer.
 * Colors, fonts and layouts belong to a theme (see themes/). The one thing the
 * framework provides is a self-hosted font baseline (framework/fonts/), so
 * that no text and no glyph ever depends on the fonts of the system or the
 * browser:
 *   "Slides Sans"     DejaVu Sans: the default for every text token
 *   "Slides Mono"     DejaVu Sans Mono: code, pre, kbd, samp
 *   "Slides Symbols"  DejaVu Sans, only Greek and U+2000-2BFF (arrows, maths,
 *                     shapes, ✓ ✗ ⚠ …): the glyph fallback behind theme fonts
 * A theme sets the tokens below and ends each stack with
 * var(--k-font-fallback), e.g. --k-font-body: "Its Font", var(--k-font-fallback).
 * `just check` reports any text drawn with a system font.
 *
 * Licensed fonts are not part of the framework or a theme: local/fonts.css
 * (the user's own, never published) declares them with @font-face and is
 * imported here, before every theme. A theme names such a font first in its
 * stack and an open substitute next (framework/fonts/open.css); without
 * local/fonts.css the browser takes the substitute. The server answers an
 * absent local/fonts.css with an empty stylesheet.
 */

@import url("../local/fonts.css");
/* local/style.css: the installation's settings for themes, e.g. a theme
   token the theme leaves unset (an institute logo). Loaded before the theme,
   so it can only set what the theme does not; empty when absent. */
@import url("../local/style.css");

@font-face { font-family: "Slides Sans"; src: url("fonts/slides-sans-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: block; }
@font-face { font-family: "Slides Sans"; src: url("fonts/slides-sans-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: block; }
@font-face { font-family: "Slides Sans"; src: url("fonts/slides-sans-oblique.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: block; }
@font-face { font-family: "Slides Sans"; src: url("fonts/slides-sans-bold-oblique.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: block; }
@font-face { font-family: "Slides Mono"; src: url("fonts/slides-mono-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: block; }
@font-face { font-family: "Slides Mono"; src: url("fonts/slides-mono-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: block; }
@font-face { font-family: "Slides Mono"; src: url("fonts/slides-mono-oblique.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: block; }
@font-face { font-family: "Slides Mono"; src: url("fonts/slides-mono-bold-oblique.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: block; }
@font-face { font-family: "Slides Symbols"; src: url("fonts/slides-symbols-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: block; unicode-range: U+0370-03FF, U+2000-2BFF; }
@font-face { font-family: "Slides Symbols"; src: url("fonts/slides-symbols-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: block; unicode-range: U+0370-03FF, U+2000-2BFF; }

/* Font tokens with their framework defaults; a theme's :root (loaded after
   this file) overrides them. */
:root {
  --k-font-fallback: "Slides Symbols", "Slides Sans";
  --k-font-body: var(--k-font-fallback);
  --k-font-head: var(--k-font-body);
  --k-font-tab: var(--k-font-body);
  --k-font-quote: var(--k-font-body);
  --k-font-mono: "Slides Mono", var(--k-font-fallback);
}

/* No element falls back to the browser's default fonts. Zero specificity, so
   any theme rule wins. */
:where(html) { font-family: var(--k-font-body); }
:where(code, pre, kbd, samp, tt) { font-family: var(--k-font-mono); }
:where(button, input, select, textarea) { font-family: inherit; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  /* The letterbox colour behind everything: the slide transition clips the
     viewport (and with it the viewport's own background) to the canvas, so
     the bars around it show the page background. */
  background: var(--k-letterbox, #111);
}

/* Hide the raw document until the engine has built and measured it. */
:is(main.slides, main.kreis):not(.k-ready) { visibility: hidden; }

/* ---------- Viewport and canvas ------------------------------------------ */

.k-viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--k-letterbox, #111);
}

.k-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--k-w) * 1px);
  height: calc(var(--k-h) * 1px);
  transform-origin: 0 0;
  overflow: hidden;
  background: var(--k-bg, #fff);
}

/* ---------- Scenes --------------------------------------------------------- */

.k-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
  box-sizing: border-box;
}
.k-scene.k-active { visibility: visible; }

.k-scene[data-transition="fade"] {
  opacity: 0;
  transition: opacity var(--k-t-cut, 0.35s) ease, visibility 0s linear var(--k-t-cut, 0.35s);
}
.k-scene[data-transition="fade"].k-active {
  opacity: 1;
  transition-delay: 0s, 0s;
}

/* Popup (data-popup): the element is lifted out of the flow over a blurring,
   dimming backdrop. While it moves, a frame (.k-popup-frame) shows the box and
   the element itself is transparent, so only its content slides. */
.k-popup-lifted, .k-popup-frame { position: absolute !important; margin: 0 !important; box-sizing: border-box; }
/* The rectangles are measured on screen, so the offsets of placed (.at) and
   hand-tuned (--dx, --dy, --s) elements are already in them. */
.k-popup-lifted, .k-popup-frame { translate: none !important; scale: none !important; }
/* !important: above components that set their own z-index (clippings) */
.k-popup-lifted { z-index: 51 !important; }
.k-popup-frame { z-index: 50 !important; pointer-events: none; }
.k-popup-moving { background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
[data-popup]:not(.k-popup-open) .popup-only { display: none; }
/* The placeholder takes the element's outer size (border box), so the layout
   around it does not move when the element is lifted. */
.k-popup-ph { visibility: hidden; box-sizing: border-box; scale: none !important; }
.k-popup-backdrop {
  position: absolute; inset: 0; z-index: 49; pointer-events: none;
  background: var(--k-popup-dim, rgba(0, 0, 0, 0.35));
  -webkit-backdrop-filter: blur(var(--k-popup-blur, 3px));
  backdrop-filter: blur(var(--k-popup-blur, 3px));
  opacity: 0; transition: opacity var(--k-t-popup, 0.45s) ease;
}
.k-popup-backdrop.k-show { opacity: 1; }
.k-popup-backdrop.k-instant-pop { transition: none; }
/* While a popup is open (.k-popup-active on its scene): on a continuous scene
   the track with the backdrop lies above the sticky title, the footer zone
   and the footnotes, so they are dimmed and blurred like the rest; the footer
   and view ID of the chrome are blurred and faded in step with the backdrop. */
.k-scene.k-continuous.k-popup-active .k-track { z-index: 4; }
/* The backdrop's backdrop-filter does not reach into the scaled canvas in
   Firefox: blur the sticky title and the footnotes themselves as well. */
.k-scene.k-continuous > :is(.sticky, .k-refs) { transition: filter var(--k-t-popup, 0.45s) ease; }
.k-scene.k-continuous.k-popup-active > :is(.sticky, .k-refs) { filter: blur(var(--k-popup-blur, 3px)); }
.k-chrome > * { transition: filter var(--k-t-popup, 0.45s) ease, opacity var(--k-t-popup, 0.45s) ease; }
.k-canvas:has(.k-scene.k-active.k-popup-active) > .k-chrome > * { filter: blur(var(--k-popup-blur, 3px)); opacity: 0.45; }

/* Bleed (data-bleed): the element is lifted like a popup and grows over the
   whole slide, title and footer included; nothing is dimmed. Its geometry is
   set by the engine (important inline styles); a web page is scaled from its
   top-left corner. */
.k-bleed { transform-origin: 0 0; max-width: none !important; max-height: none !important; }
.k-canvas:has(.k-scene.k-active.k-bleed-active) > .k-chrome > * { opacity: 0; }
.k-scene.k-continuous.k-bleed-active .k-track { z-index: 4; }

/* Static copy of the previous slide while it slides out (data-section-transition="slide"). */
.k-ghost { pointer-events: none; }
/* Media in static copies (slide transition, overview) become empty boxes. */
.k-media-ph { display: inline-block; vertical-align: top; }
.k-ghost .k-scene { visibility: visible; }

/* The track holds the scene content. In continuous scenes it is taller than
   the canvas and the camera moves it upwards. */
.k-track {
  position: relative;
  box-sizing: border-box;
  min-height: 100%;
}
.k-scene.k-continuous .k-track {
  will-change: transform;  /* only these tracks move */
  min-height: calc(var(--k-h) * 1px);
  padding-top: calc(var(--k-sticky-h, 0) * 1px);
  transition: transform var(--k-t-camera, 0.7s) cubic-bezier(0.45, 0, 0.25, 1);
}

/* A sticky header of a continuous scene stays put while the track moves. */
.k-scene.k-continuous > .sticky {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
}

.stop { height: 0; margin: 0; padding: 0; }

/* ---------- Steps ---------------------------------------------------------- */

[data-step] {
  transition:
    opacity var(--k-t-step, 0.4s) ease,
    transform var(--k-t-step, 0.4s) ease,
    visibility 0s;
}
.k-future, .k-gone {
  opacity: 0;
  visibility: hidden;
  transition-delay: 0s, 0s, var(--k-t-step, 0.4s);
}

/* Speaker notes are never shown on the canvas. */
.notes { display: none !important; }

/* Measuring and instant modes switch all motion off. */
.k-measure [data-step],
.k-instant *, .k-instant *::before, .k-instant *::after {
  transition: none !important;
  animation-duration: 0s !important;
}
.k-measure [data-step] { transform: none !important; }

/* ---------- References and agenda (outline.js) ---------------------------- */

/* <k-ref> keeps only its circled number in the text; the reference itself
   moves to the footnote list .k-refs at the bottom of the scene. */
k-ref { display: inline; }
.k-refs {
  position: absolute;
  z-index: 3;
  margin: 0;
  padding: 0;
  list-style: none;
}
.k-ref-note {
  transition: opacity var(--k-t-step, 0.4s) ease, visibility 0s;
}
/* Paged sheets: footnotes of other pages fold away, so the list (and the footer
   glass) holds only the current page's references. */
.k-refs-paged .k-ref-note {
  overflow: hidden;
  max-height: 4em;
  transition: opacity var(--k-t-step, 0.4s) ease, max-height var(--k-t-step, 0.4s) ease,
    margin var(--k-t-step, 0.4s) ease, visibility 0s;
}
.k-refs-paged .k-ref-note:is(.k-future, .k-gone) { max-height: 0; margin-top: 0; }
/* Content of a continuous scene can scroll clear of the footnotes. */
.k-scene.k-continuous.k-has-refs .k-track {
  padding-bottom: calc(var(--k-pad-bottom, 120px) + var(--k-refs-h, 0px));
}
k-agenda { display: block; }

/* ---------- Web pages ------------------------------------------------------ */

/* style="--zoom: 1.5": the page is laid out at 1/zoom of the box, then scaled
   up, so a desktop page stays readable on the canvas. */
iframe[style*="--zoom"], .k-iframe-ph[style*="--zoom"] {
  width: calc(100% / var(--zoom)) !important;
  height: calc(100% / var(--zoom)) !important;
  scale: var(--zoom);
  transform-origin: 0 0;
}
.k-iframe-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8e9ea;
  color: #656970;
  font-size: 40px;
}
/* <k-youtube>: a 16:9 box with the video's poster until the player loads. */
k-youtube {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000 var(--k-yt-poster, none) center / cover no-repeat;
}
k-youtube > :is(iframe, .k-iframe-ph) {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
k-youtube > .k-iframe-ph { background: none; color: transparent; }
/* Edit mode moves the frame instead of interacting with the page. */
.k-viewport.k-edit iframe { pointer-events: none; }

/* <k-act>: scripted clicks and keys in a web page. The element itself shows
   nothing; the page it acts on takes no mouse input, so clicks advance the
   talk. The pointer is drawn over the page while an act runs: an arrow whose
   tip is the element's top-left corner, placed and scaled by media.js. */
k-act { display: none !important; }
iframe.k-scripted { pointer-events: none; }
.k-pointer {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  width: 46px;
  height: 62px;
  transform-origin: 0 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  /* A light rim around the dark arrow (and the click ring), then a shadow:
     the pointer stays visible on light and on dark pages alike. */
  filter:
    drop-shadow(2px 0 0 var(--k-pointer-rim, #fff)) drop-shadow(-2px 0 0 var(--k-pointer-rim, #fff))
    drop-shadow(0 2px 0 var(--k-pointer-rim, #fff)) drop-shadow(0 -2px 0 var(--k-pointer-rim, #fff))
    drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
}
.k-pointer.k-show { opacity: 1; }
.k-pointer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--k-pointer, var(--k-fg, #222));
  clip-path: polygon(0 0, 0 78%, 22% 60%, 40% 100%, 56% 93%, 39% 55%, 68% 55%);
}
.k-pointer::after {
  content: "";
  position: absolute;
  left: -45px;
  top: -45px;
  width: 90px;
  height: 90px;
  box-sizing: border-box;
  border: 6px solid var(--k-accent, currentColor);
  border-radius: 50%;
  opacity: 0;
}
.k-pointer.k-click::after { animation: k-click 0.5s ease-out; }
@keyframes k-click {
  from { scale: 0.2; opacity: 0.9; }
  to { scale: 1; opacity: 0; }
}

/* ---------- Placement helper ---------------------------------------------- */

/* <div class="at" style="--x: 960; --y: 540">: centred on canvas coordinates. */
.at {
  position: absolute;
  left: calc(var(--x) * 1px);
  top: calc(var(--y) * 1px);
  translate: calc(var(--ax, -50) * 1%) calc(var(--ay, -50) * 1%);
}

/* ---------- Hand-tuned offsets (written by edit mode) ---------------------- */

/* style="--dx: 12; --dy: -30"  shift,  "--w: 640"  width,  "--s: 1.2"  scale.
   The individual translate/scale properties leave `transform` free for the
   step animations. Elements with class .at are moved through --x/--y instead. */
[style*="--dx:"], [style*="--dy:"] {
  translate: calc(var(--dx, 0) * 1px) calc(var(--dy, 0) * 1px);
}
/* On .at elements the offset adds to the centring instead of replacing it. */
.at:is([style*="--dx:"], [style*="--dy:"]) {
  translate: calc(var(--ax, -50) * 1% + var(--dx, 0) * 1px) calc(var(--ay, -50) * 1% + var(--dy, 0) * 1px);
}
[style*="--w:"] { width: calc(var(--w) * 1px); max-width: none; box-sizing: border-box; }
[style*="--s:"] { scale: var(--s); transform-origin: 0 0; }

/* ---------- Arrows --------------------------------------------------------- */

k-arrow, k-mark {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}
k-arrow > svg, k-mark > svg {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
}

/* <k-pdf>: a window (its own height) through which the pages roll up. */
k-pdf { display: block; position: relative; overflow: hidden; height: 640px; }
.k-pdf-sheet { display: flex; flex-direction: column; gap: 24px; will-change: transform; }
.k-pdf-page { display: block; width: 100%; height: auto; }

k-svg { display: block; }
k-svg > svg { display: block; width: 100%; height: auto; }

/* ---------- Chrome: footer, view ID, overlays ------------------------------ */

.k-chrome {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.k-black {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
  display: none;
}
.k-viewport.k-blacked .k-black { display: block; }

.k-goto {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 101;
  font: 1.5rem/1.2 var(--k-font-body);
  padding: 0.4rem 0.7rem;
  width: 8ch;
  border: 2px solid #888;
  border-radius: 0.4rem;
}

/* ======================================================================== */
/* Editorial UI: menu, overview, draft labels, edit mode (ui.js, editor.js)  */
/* Drawn in window pixels outside the scaled canvas. Uses the theme tokens   */
/* with neutral fallbacks so it works with any theme.                        */
/* ======================================================================== */

.k-ui-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  font-family: var(--k-font-body);
  color: #fff;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(20, 22, 26, 0.55);
}
.k-ui-overlay kbd {
  font: 600 0.8rem/1 var(--k-font-tab);
  padding: 0.3em 0.5em;
  border-radius: 0.35em;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  white-space: pre;
}

/* ---------- Menu button ---------------------------------------------------- */

.k-ui-fab {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 150;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--k-accent, #333);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.k-ui-fab.k-show { opacity: 0.9; pointer-events: auto; }
.k-ui-fab span { width: 18px; height: 2px; border-radius: 1px; background: #fff; }

/* ---------- Menu ----------------------------------------------------------- */

.k-menu { display: flex; align-items: center; justify-content: center; background: rgba(20, 22, 26, 0.35); }
.k-menu-panel {
  min-width: 340px;
  max-width: 90vw;
  padding: 18px 10px 12px;
  border-radius: 16px;
  background: rgba(30, 33, 38, 0.92);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.k-menu-title {
  font-weight: 700;
  font-size: 1rem;
  padding: 0 14px 10px;
  opacity: 0.75;
}
.k-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 1.05rem;
  text-align: left;
  cursor: pointer;
}
.k-menu-item:hover, .k-menu-item.k-sel { background: rgba(255, 255, 255, 0.1); }
.k-menu-label { flex: 1; }
.k-menu-state {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.5;
}
.k-menu-state.on { opacity: 1; color: #fff; background: var(--k-accent, #555); padding: 0.15em 0.5em; border-radius: 1em; }
.k-menu-help {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  align-items: center;
  margin: 10px 14px 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ---------- Overview ------------------------------------------------------- */

.k-ov { overflow-y: auto; padding: 30px 32px 24px; box-sizing: border-box; background: rgba(20, 22, 26, 0.78); }
.k-ov-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));  /* ui.js sets the count */
  gap: 14px 18px;
}
.k-ov-chapter {
  grid-column: 1 / -1;
  margin: 8px 0 -4px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.8;
}
.k-ov-tile {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.k-ov-frame {
  position: relative;
  aspect-ratio: var(--k-w) / var(--k-h);
  overflow: hidden;
  border-radius: 6px;
  background: var(--k-bg, #fff);
  outline: 3px solid transparent;
  outline-offset: 3px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  transition: outline-color 0.15s ease;
}
.k-ov-tile:hover .k-ov-frame { outline-color: rgba(255, 255, 255, 0.5); }
.k-ov-tile.k-sel .k-ov-frame { outline-color: #fff; }
.k-ov-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--k-w) * 1px);
  height: calc(var(--k-h) * 1px);
  transform: scale(var(--f, 0.15));
  transform-origin: 0 0;
  pointer-events: none;
  /* The frame's rounded corners, here too: Chrome does not clip frosted
     (backdrop-filter) parts of a thumbnail to the frame's radius until a repaint. */
  clip-path: inset(0 round calc(6px / var(--f, 0.15)));
}
.k-ov-canvas .k-scene { visibility: visible; }
.k-ov-cap { display: flex; gap: 8px; margin-top: 5px; font-size: 0.8rem; align-items: baseline; white-space: nowrap; min-width: 0; }
.k-ov-num { font-family: var(--k-font-tab); font-weight: 700; }
.k-ov-title { opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-ov-section {
  margin-left: auto;
  flex: none;
  font-size: 0.75rem;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--k-accent, #555);
  color: #fff;
}
.k-ov-chapter { display: flex; align-items: center; gap: 12px; }
.k-ov-part-time { font-family: var(--k-font-tab); font-weight: 400; letter-spacing: 0; opacity: 0.8; margin-left: 4px; }
.k-ov-part-time::before { content: "· "; }
.k-ov-time {
  position: absolute;
  right: 6px;
  top: 6px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(20, 22, 26, 0.72);
  color: #fff;
  font: 700 0.75rem/1.4 var(--k-font-tab);
}
.k-ov-time.manual { box-shadow: inset 0 0 0 1.5px #fff; }
/* A continuous sheet with several screens: cards behind it, and their number. */
.k-ov-tile.k-stack .k-ov-frame {
  box-shadow: 5px -5px 0 -1px #c9ccd1, 0 6px 24px rgba(0, 0, 0, 0.3);
}
.k-ov-tile.k-stack-deep .k-ov-frame {
  box-shadow: 5px -5px 0 -1px #c9ccd1, 10px -10px 0 -2px #969ba3, 0 6px 24px rgba(0, 0, 0, 0.3);
}
.k-ov-pages {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 1px 7px 1px 22px;
  border-radius: 99px;
  background: rgba(20, 22, 26, 0.72);
  color: #fff;
  font: 700 0.75rem/1.4 var(--k-font-tab);
}
/* The stack icon: two offset squares. */
.k-ov-pages::before, .k-ov-pages::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1.5px solid #fff;
  border-radius: 1.5px;
}
.k-ov-pages::before { left: 7px; top: 6px; }
.k-ov-pages::after { left: 10px; top: 3px; border-left-color: transparent; border-bottom-color: transparent; }
.k-ov-stats {
  margin: 0;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}
.k-ov-total { font-weight: 700; margin-right: 8px; font-family: var(--k-font-tab); }
.k-ov-session { padding: 2px 10px; border-radius: 99px; font-weight: 700; font-size: 0.8rem; }
.k-ov-session.ok { background: #2e7d4f; }
.k-ov-session.tight { background: #b8860b; }
.k-ov-session.over { background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.5); text-decoration: line-through; }
.k-ov-dot {
  display: inline-block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--k-accent, #555);
  color: #fff;
  text-align: center;
  line-height: 26px;
  font-family: var(--k-font-tab);
  letter-spacing: 0;
}

/* The overview's title, above the view switch. */
/* The header of the overview: title row, then the view switch and the time
   estimate, a hairline below; it stays at the left while the linear view
   scrolls sideways. */
.k-ov-head {
  position: sticky;
  left: 0;
  box-sizing: border-box;
  max-width: calc(100vw - 64px);
  margin: 0 0 22px;
  padding: 0 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.k-ov-head-top { display: flex; align-items: baseline; gap: 18px; margin: 0 0 16px; min-width: 0; }
.k-ov-heading { flex: none; font-size: 1.9rem; font-weight: 700; letter-spacing: 0.01em; line-height: 1.1; }
.k-ov-talk { font-size: 1.05rem; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The view switch (Grid | Linear), left in the stats row. */
.k-ov-switch { display: flex; margin-right: auto; border-radius: 99px; background: rgba(255, 255, 255, 0.12); padding: 3px; }
.k-ov-switch button {
  padding: 3px 14px;
  border: 0;
  border-radius: 99px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.7;
  cursor: pointer;
}
.k-ov-switch button.k-on { background: rgba(255, 255, 255, 0.9); color: #222; opacity: 1; }

/* Linear view: one row of section columns that scrolls sideways (ui.js sets
   --col-w and --f); a continuous scene is one long tile of height --th. */
.k-ov.k-ov-linear-view { overflow: auto; }
.k-ov-linear { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 34px; width: max-content; }
/* The time axis along the top: a dotted line with a tick and the elapsed time
   at the start of every column (ui.js places the marks), the total at the end,
   and every quarter of an hour highlighted below the line. Geometry: labels
   0-18 px, the line's centre at 27 px, quarter labels from 36 px. */
.k-ov-linear { position: relative; padding-top: 66px; }
.k-ov-axis { position: absolute; left: 0; right: 0; top: 0; height: 58px; }
.k-ov-axis::before { content: ""; position: absolute; left: 0; right: 0; top: 25px; border-top: 4px dotted rgba(255, 255, 255, 0.5); }
.k-ov-axis-mark {
  position: absolute;
  top: 0;
  padding-left: 7px;
  font: 700 0.8rem/18px var(--k-font-tab);
  white-space: nowrap;
  opacity: 0.85;
}
/* The tick, centred on the line: 16 px high around y = 27. */
.k-ov-axis-mark::before { content: ""; position: absolute; left: -1px; top: 19px; width: 2px; height: 16px; background: #fff; }
.k-ov-axis-mark.k-end { transform: translateX(-100%); padding: 0 7px 0 0; }
.k-ov-axis-mark.k-end::before { left: auto; right: -1px; }
/* A quarter of an hour: a taller tick and a pill below the line. */
.k-ov-axis-mark.k-quarter { top: 36px; padding: 0; transform: translateX(-50%); opacity: 1; }
.k-ov-axis-mark.k-quarter::before { left: 50%; top: -21px; width: 4px; height: 24px; margin-left: -2px; border-radius: 2px; background: #f2b134; }
.k-ov-axis-mark.k-quarter { padding: 1px 10px; border-radius: 99px; background: #f2b134; color: #1d1f23; line-height: 18px; margin-top: 4px; }
.k-ov-part { display: flex; flex-direction: column; }
.k-ov-part > .k-ov-chapter { margin: 0 0 8px; min-height: 26px; white-space: nowrap; }
/* The part header (name and part time) stays at the left edge while its part is in view. */
.k-ov-part > .k-ov-chapter { position: sticky; left: 0; align-self: flex-start; }
.k-ov-cols { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 16px; }
.k-ov-col { display: flex; flex-direction: column; gap: 12px; width: var(--col-w, 200px); flex: none; }
.k-ov-col-head { display: flex; align-items: center; height: 1.5rem; min-width: 0; }
.k-ov-col-head .k-ov-section {
  display: inline-flex; align-items: center; height: 1.35rem; padding: 0 10px; line-height: 1;
  margin-left: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* The bar along the bottom: part segments and the thumb of the visible window. */
.k-ov-nav {
  position: sticky;
  left: 0;
  display: flex;
  height: 22px;
  margin-top: 14px;
  width: calc(100vw - 64px);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  touch-action: none;
}
.k-ov-nav[hidden] { display: none; }
.k-ov-nav-seg { flex: none; height: 100%; border-radius: 11px; background: var(--k-accent, #888); opacity: 0.55; }
.k-ov-nav-seg:not([data-part]) { background: rgba(255, 255, 255, 0.35); }
.k-ov-nav-thumb {
  position: absolute;
  top: -3px;
  bottom: -3px;
  border: 3px solid #fff;
  border-radius: 14px;
  box-sizing: border-box;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.k-ov.k-ov-linear-view { cursor: grab; }
.k-ov.k-ov-linear-view:active { cursor: grabbing; }
.k-ov-tile.k-long .k-ov-frame { aspect-ratio: var(--k-w) / var(--th); }
.k-ov-tile.k-long .k-ov-canvas { height: calc(var(--th) * 1px); }

/* ---------- Mode badge and toasts ----------------------------------------- */

.k-mode-badge {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 150;
  padding: 5px 12px;
  border-radius: 20px;
  font: 700 0.75rem/1.2 var(--k-font-body);
  letter-spacing: 0.12em;
  color: #fff;
  background: #c2410c;
  pointer-events: none;
}
.k-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 300;
  translate: -50% 20px;
  max-width: 80vw;
  padding: 10px 18px;
  border-radius: 10px;
  font: 500 0.95rem/1.3 var(--k-font-body);
  color: #fff;
  background: rgba(30, 33, 38, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, translate 0.2s ease;
}
.k-toast.k-show { opacity: 1; translate: -50% 0; }
.k-toast.k-error { background: #b91c1c; }

/* ---------- Draft labels (canvas pixels, inside the scaled canvas) -------- */

.k-draft-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: visible;
  z-index: 50;
  pointer-events: none;
}
.k-draft-label {
  position: absolute;
  translate: -6px calc(-100% - 4px);
  padding: 3px 9px;
  border: 0;
  border-radius: 12px;
  font: 700 20px/1.1 var(--k-font-tab);
  color: #fff;
  background: #c2410c;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
/* Arrow labels sit above and to the right of the midpoint, clear of the bend handle. */
.k-draft-label.k-at-point { translate: 18px calc(-100% - 16px); }
.k-draft-label.k-dim { opacity: 0.4; }
.k-draft-label.k-hover, .k-draft-label:hover { background: #7c2d12; }
.k-draft-label.k-sel { background: #111; }
.k-draft-outline {
  position: absolute;
  outline: 2px dashed #c2410c;
  outline-offset: 4px;
  border-radius: 4px;
  pointer-events: none;
}
/* ---------- Edit mode ------------------------------------------------------ */

/* The current slide complete: later steps shown, removed elements faded.
   Scoped to the active scene: `visibility: visible` on a child would
   otherwise show through the hidden inactive scenes. */
.k-viewport.k-edit .k-active .k-future { visibility: visible !important; opacity: 1 !important; transform: none !important; }
.k-viewport.k-edit .k-active .k-gone { visibility: visible !important; opacity: 0.35 !important; }
.k-viewport.k-edit .k-active k-arrow.k-future .k-arrow-line { stroke-dashoffset: 0; }
.k-viewport.k-edit .k-active k-arrow.k-future .k-arrow-head { opacity: 1; }
/* Continuous slides: no camera, the whole sheet scrolls with the mouse wheel. */
.k-viewport.k-edit .k-scene.k-continuous { overflow-y: auto; overscroll-behavior: contain; }
.k-viewport.k-edit .k-scene.k-continuous .k-track { transform: none !important; transition: none !important; padding-top: 24px; }
.k-viewport.k-edit .k-scene.k-continuous > .sticky { position: sticky; }
/* The sticky title is in the flow here; pull the track up under it, so the
   track starts at the slide top as when presenting and .at elements (placed
   relative to the track) keep their positions. */
.k-viewport.k-edit .k-scene.k-continuous:has(> .sticky) .k-track {
  margin-top: calc(var(--k-sticky-h, 0) * -1px);
  padding-top: calc(var(--k-sticky-h, 0) * 1px + 24px);
}
.k-viewport.k-edit .k-scene.k-continuous::after { display: none; }

.k-viewport.k-edit .k-track * { cursor: move; }
.k-viewport.k-edit { user-select: none; }
.k-edit-box {
  position: absolute;
  outline: 2px solid #111;
  outline-offset: 4px;
  pointer-events: none;
}
.k-edit-box.k-arrow-edit { outline: 0; left: 0; top: 0; width: 0; height: 0; }
/* Text editing: the element's HTML source in a box over the element. */
.k-viewport.k-edit .k-text-edit {
  position: absolute;
  z-index: 10;
  box-sizing: border-box;
  margin: 0;
  padding: 4px 8px;
  resize: none;
  overflow: hidden;
  color: #111;
  background: #fff;
  border: 0;
  outline: 3px solid #c2410c;
  outline-offset: 4px;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  cursor: text;
  user-select: text;
  pointer-events: auto;
}
.k-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  translate: -50% -50%;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #111;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  box-sizing: border-box;
}
.k-handle.k-h-w { left: calc(100% + 4px); top: 50%; cursor: ew-resize; border-radius: 6px; height: 40px; width: 16px; }
.k-handle.k-h-s { left: calc(100% + 4px); top: calc(100% + 4px); cursor: nwse-resize; }
.k-handle.k-h-bend { background: #c2410c; cursor: grab; }
.k-handle.k-h-from, .k-handle.k-h-to {
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.6);
  border: 4px solid #c2410c;
  cursor: move;
}
/* Shown while an arrow end is dragged: its box and the five snap anchors. */
.k-snap-box {
  position: absolute;
  outline: 2px dashed #c2410c;
  pointer-events: none;
}
.k-snap-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  translate: -50% -50%;
  border-radius: 50%;
  border: 2px solid #c2410c;
  background: #fff;
  box-sizing: border-box;
}
.k-snap-dot.on { width: 22px; height: 22px; background: #c2410c; }

/* Formulas typeset with LaTeX (math.js, tools/texmath.py). */
mjx-container > svg.k-tex { overflow: visible; }

/* ---------- Reduced motion ----------------------------------------------------- */

/* Systems set to reduce motion: no animated steps, camera moves or popups
   (the slide transition is switched off in slides.js). */
@media (prefers-reduced-motion: reduce) {
  .k-canvas, .k-scene { --k-t-step: 0s; --k-t-camera: 0s; --k-t-popup: 0s; --k-t-cut: 0s; }
  .k-pointer { --k-t-act: 0s; }
  /* Themes draw arrows in with transitions of their own. */
  k-arrow *, k-mark * { transition: none !important; }
}
