/* Presentations — deck list, slide editor, present mode and print.

   A slide is one box with `container-type: size`, and everything inside it is
   placed in percentages and sized in container units. The same markup is a rail
   thumbnail, an editor stage, a projector slide and a printed page. */

.pres-page { display: flex; flex-direction: column; gap: var(--panel-gap); }
/* No gap: the bar is joined to the slide, and what follows sets its own space. */
.pres-editor { display: flex; flex-direction: column; }
.pres-page [hidden], .pres-editor [hidden] { display: none; }

.pres-blank { margin: 0; color: var(--muted); font-size: var(--text-reading); }

/* ------------------------------------------------------------- deck list */

.pres-deck-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pres-deck {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border: 1px solid var(--line); border-radius: 3px; background: var(--paper-raised);
  box-shadow: 0 9px 28px rgba(34, 31, 25, .045);
}
.pres-deck-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px;
  border: 0; background: none; cursor: pointer; text-align: left; font: inherit; color: inherit;
}
/* The deck's own first slide, small — a thumbnail is the slide rather than a
   drawing of it, same as the rail and the locator. */
.pres-deck-thumb { flex: none; width: 108px; }
.pres-deck-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pres-deck-open:hover .pres-deck-title { color: var(--blue); }
.pres-deck-title { font: 400 17px/1.2 var(--serif); }
.pres-deck-meta { color: var(--muted); font-size: var(--text-label); letter-spacing: var(--tracking-label); text-transform: uppercase; }

/* A phone gets a flat, read-only list — no tree, no delete, one tap straight
   into presenting. */
.pres-page-mobile .pres-deck { box-shadow: none; }
.pres-page-mobile .pres-deck-thumb { width: 86px; }

/* --------------------------------------------------------- folder browser */

/* The tree itself is the resources tab's own — .resource-tree and its kin,
   already on the page since every page's stylesheet loads up front. Only the
   rename/delete affordances (which the resources tree keeps in its file list
   instead) are added here. */
/* resources' own tree line is a 2-column grid (toggle, row) with no room for
   a third item — floated on top of it instead of fighting that grid. */
.resource-tree-line { position: relative; }
.pres-tree-row-actions {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px; opacity: 0;
}
.resource-tree-line:hover .pres-tree-row-actions { opacity: 1; }
.resources-browser .pres-deck-list,
.resources-browser .pres-blank { padding: 14px 17px; }
.resources-browser .pres-deck-list { gap: 10px; }

/* ---------------------------------------------------------------- editor */

/* The controls belong to the slide, so they sit on it: one bar, joined by a
   hairline to the top edge of the page being edited. */
.deck-bar {
  display: flex; align-items: center; gap: 8px; padding: 4px 8px;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 3px 3px 0 0;
  background: var(--paper-raised);
}
/* Title and state share the row: two rows of chrome over a slide is one too
   many. */
.deck-identity { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.deck-title {
  flex: 1; min-width: 80px; height: 26px; padding: 0 4px; border: 1px solid transparent; border-radius: 2px;
  background: none; color: var(--ink); font: 400 16px/26px var(--serif);
}
.deck-title:hover { border-color: var(--line); }
.deck-title:focus { border-color: var(--blue); outline: none; background: var(--paper); }
.deck-meta { display: flex; align-items: center; gap: 10px; margin: 0; }
.deck-visibility {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0; border: 0; background: none;
  color: var(--muted); cursor: pointer; font: inherit; font-size: var(--text-meta);
  letter-spacing: var(--tracking-label); text-transform: uppercase;
}
.deck-visibility svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.deck-visibility:hover { color: var(--ink); }
.deck-visibility[aria-pressed="true"] { color: var(--blue); }
.deck-shared, .deck-status { display: inline-flex; align-items: center; height: 26px; color: var(--muted); font-size: var(--text-meta); letter-spacing: var(--tracking-label); text-transform: uppercase; }

.deck-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 24px;
  padding: 0; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--ink); cursor: pointer;
}
.deck-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.deck-icon:hover:not(:disabled) { background: rgba(23, 23, 19, .06); }
.deck-icon:disabled { opacity: .3; cursor: default; }
.deck-button {
  min-height: 24px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--paper); color: var(--ink); cursor: pointer; font: inherit; font-size: var(--text-control);
}
.deck-button:hover { border-color: var(--ink); }
.deck-button.is-primary { border-color: var(--ink); background: var(--ink); color: white; }
.deck-button.is-primary:hover { background: var(--blue); border-color: var(--blue); }
.deck-button[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); }
.deck-select { height: 24px; padding: 0 4px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); font: inherit; font-size: var(--text-control); }
.deck-group { position: relative; display: inline-flex; align-items: center; gap: 2px; }

.deck-menu-wrap { position: relative; }
.deck-menu {
  position: absolute; top: calc(100% + 5px); left: 0; z-index: 8; min-width: 170px; max-height: 280px;
  overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--paper-raised); box-shadow: var(--shadow);
}
.deck-menu.is-right { right: 0; left: auto; min-width: 230px; }
.deck-menu[hidden] { display: none; }
.deck-menu button {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%;
  padding: 6px 9px; border: 0; border-radius: 2px; background: none; color: var(--ink); cursor: pointer;
  text-align: left; font: 400 12px/1.3 var(--sans);
}
.deck-menu button:hover { background: var(--blue-soft); color: var(--blue); }
.deck-menu button span { color: var(--muted); font-size: 10px; }
.deck-menu button:hover span { color: var(--blue); }
.deck-chevron { width: 12px; height: 12px; margin-left: 4px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.deck-button.has-chevron { display: inline-flex; align-items: center; padding-right: 8px; }
.deck-visibility.is-shared { color: var(--blue); }
.deck-visibility .deck-chevron { width: 10px; height: 10px; margin-left: 2px; }

/* Zoom, and the locator that comes with it. */
.deck-zoom-level {
  min-width: 44px; height: 24px; padding: 0 4px; border: 1px solid transparent; border-radius: 3px;
  background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: var(--text-meta);
  font-variant-numeric: tabular-nums;
}
.deck-zoom-level:hover { border-color: var(--line); color: var(--ink); }
.deck-menu 
.deck-menu 

/* ------------------------------------------------------------ the surface */

.pres-stage-shell { position: relative; }
.pres-stage { position: relative; width: 100%; }
/* Zoomed, the slide grows inside a window that does not: the box keeps the
   height it had at rest, and what no longer fits is scrolled to. */
/* overflow-anchor: none — the browser's own scroll anchoring reads a redrawn
   slide as content shifting and puts the view back where it was. */
.pres-stage.is-zoomed { overflow: auto; overflow-anchor: none; overscroll-behavior: contain; border: 1px solid var(--line); border-top: 0; }
/* Space held, or the middle button down: the slide is being moved, not edited. */
.pres-stage.is-hand, .pres-stage.is-hand * { cursor: grab; }
.pres-stage.is-dragging-view, .pres-stage.is-dragging-view * { cursor: grabbing; }
.pres-bench.is-zoomed { width: auto; margin-inline: 0; }

/* Where you are, while the whole slide no longer fits. Click or drag it to
   move the window instead. */
.pres-map {
  position: absolute; right: 10px; bottom: 10px; z-index: 4; width: 168px; aspect-ratio: 16 / 9;
  overflow: hidden; border: 1px solid var(--line); border-radius: 2px; background: white;
  box-shadow: 0 6px 18px rgba(34, 31, 25, .12); cursor: pointer;
}
.pres-map[hidden] { display: none; }
.pres-map-page { position: absolute; inset: 0; pointer-events: none; }
.pres-map-page .pres-slide {
  position: absolute; top: 0; left: 0; width: 1280px; height: 720px; transform-origin: top left;
  border: 0; border-radius: 0; box-shadow: none; aspect-ratio: auto;
}
.pres-map-window { position: absolute; border: 1.5px solid var(--blue); background: rgba(24, 79, 209, .1); pointer-events: none; }
/* The slide, with a margin either side to park work that is not on it yet. The
   margins take the width the page's own margins leave, so the slide keeps the
   size it had. --slide-width is measured where it is known, in the editor. */
.pres-bench {
  width: 100vw; margin-inline: calc(50% - 50vw);
  display: grid; grid-template-columns: 1fr var(--slide-width, 100%) 1fr;
}
.pres-bench > .pres-slide { grid-column: 2; }
.pres-bench .pres-slide { border-left: 1px dashed var(--muted); border-right: 1px dashed var(--muted); }
.pres-frame.is-parked { opacity: .75; }

/* Notes belong to the slide above them, not to the deck below. */
.pres-notes-strip { width: 100%; margin-top: 10px; }
.pres-notes-details { border: 1px solid var(--line); border-radius: 3px; background: var(--paper-raised); }
.pres-notes-summary {
  display: flex; align-items: baseline; gap: 10px; padding: 7px 12px; cursor: pointer;
  list-style: none; user-select: none;
}
.pres-notes-summary::-webkit-details-marker { display: none; }
.pres-notes-summary:hover { background: rgba(23, 23, 19, .04); }
.pres-notes-preview { flex: 1; overflow: hidden; color: var(--muted); font-size: var(--text-body); text-overflow: ellipsis; white-space: nowrap; }
.pres-notes { width: 100%; min-height: 110px; padding: 10px 12px; border: 0; border-top: 1px solid var(--line); background: var(--paper); font: inherit; font-size: var(--text-body); resize: vertical; }
.pres-notes:focus { outline: none; box-shadow: inset 2px 0 0 var(--blue); }
.pres-notes-read { padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper-raised); }
.pres-side-title { margin: 0; color: var(--muted); font: 400 var(--text-label)/1 var(--sans); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.pres-side-notes { margin: 6px 0 0; color: var(--muted); font-size: var(--text-body); white-space: pre-wrap; }

/* --------------------------------------------------------------- the deck */

/* Every slide, small, wrapping onto as many rows as it takes. */
.pres-film { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.pres-thumb { position: relative; cursor: pointer; }
.pres-thumb-page {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border: 1px solid var(--line); border-radius: 2px; background: white;
}
/* The slide itself at its own size, shrunk to the tile — a thumbnail is the
   slide rather than a drawing of it. */
.pres-thumb-page .pres-slide {
  position: absolute; top: 0; left: 0; width: 1280px; height: 720px;
  transform-origin: top left; transform: scale(var(--thumb-scale, .103));
  border: 0; border-radius: 0; box-shadow: none; aspect-ratio: auto; pointer-events: none;
}
.pres-thumb.is-active .pres-thumb-page { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.pres-thumb:focus-visible .pres-thumb-page { outline: 2px solid var(--blue); outline-offset: 2px; }
.pres-thumb.is-dragging { opacity: .4; }
.pres-thumb.is-drop-before .pres-thumb-page { box-shadow: inset 3px 0 0 var(--blue); }
.pres-thumb.is-drop-after .pres-thumb-page { box-shadow: inset -3px 0 0 var(--blue); }
.pres-thumb-number {
  position: absolute; left: 4px; bottom: 4px; min-width: 16px; padding: 1px 4px; border-radius: 2px;
  background: rgba(255, 255, 255, .82); color: var(--ink); font: 500 10px/1.4 var(--sans);
  font-variant-numeric: tabular-nums; text-align: center;
}
.pres-thumb-remove {
  position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; padding: 0 0 1px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .86); color: var(--ink);
  cursor: pointer; font-size: 14px; line-height: 1; opacity: 0;
}
.pres-thumb:hover .pres-thumb-remove, .pres-thumb:focus-within .pres-thumb-remove { opacity: 1; }
.pres-thumb-add {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9;
  border: 1px dashed var(--line); border-radius: 2px; background: none; color: var(--muted);
  cursor: pointer; font: 300 22px/1 var(--sans);
}
.pres-thumb-add:hover { border-color: var(--ink); color: var(--ink); }

/* ----------------------------------------------------------------- slide */

.pres-slide {
  container-type: size;
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border: 1px solid var(--line); border-radius: 3px; background: white;
  box-shadow: 0 9px 28px rgba(34, 31, 25, .045);
  font-size: 1.7cqi;
}
/* In the editor the slide lets its blocks' controls show outside it; presenting
   and printing keep the crop. */
.pres-slide.is-editable { overflow: visible; }
/* Dragging a block should move it, not sweep a text selection across it. */
.pres-slide.is-editable .pres-frame { user-select: none; }
.pres-slide.is-editable .pres-frame textarea,
.pres-slide.is-editable .pres-frame input { user-select: text; }
/* A picture dragged in from the desktop is welcome here. */
.pres-slide.is-file-over { outline: 2px dashed var(--blue); outline-offset: -2px; background: var(--blue-soft); }

/* Blocks sit where they were put; later ones draw over earlier ones. */
/* A frame's own font-size, alignment and vertical placement come from the
   document; only what does not vary lives here. */
.pres-frame { position: absolute; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pres-slide.is-editable .pres-frame { border: 1px solid transparent; border-radius: 2px; cursor: move; }
.pres-slide.is-editable .pres-frame:hover { border-color: var(--line); }
.pres-slide.is-editable .pres-frame.is-selected { border-color: var(--blue); }
.pres-resize { display: none; }
.pres-slide.is-editable .pres-frame.is-selected .pres-resize {
  display: block; position: absolute; right: -5px; bottom: -5px; width: 11px; height: 11px;
  border: 1px solid var(--blue); border-radius: 2px; background: var(--paper); cursor: nwse-resize;
}
.pres-slot-empty { margin: 0; color: var(--muted); }
.pres-marquee { position: absolute; z-index: 2; border: 1px solid var(--blue); background: rgba(24, 79, 209, .08); pointer-events: none; }
/* The grid is drawn only while it is on, and only in the editor. */
/* Square cells: 2.5% across the width, the same distance down a 16:9 height. */
.pres-slide.has-grid {
  background-image:
    repeating-linear-gradient(to right, rgba(23, 23, 19, .08) 0 1px, transparent 1px var(--grid)),
    repeating-linear-gradient(to bottom, rgba(23, 23, 19, .08) 0 1px, transparent 1px var(--grid-down));
}

/* Undo, and the states behind it. */

.pres-history-time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.pres-history-empty { margin: 0; padding: 8px; color: var(--muted); font-size: var(--text-body); }

/* A caption being written sits where it will read. */
.pres-caption-live {
  width: 100%; margin-top: .4em; padding: .15em .3em; border: 1px solid var(--blue); border-radius: 2px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: .75em;
}
.pres-slide.is-editable figcaption { cursor: text; }

/* Controls float over the stage, in page pixels rather than slide units, so
   they stay legible however small the block is. `[hidden]` is spelled out
   because the rule below sets display. */
.pres-tools[hidden] { display: none; }
.pres-tools {
  position: absolute; z-index: 3; user-select: none;
  display: flex; align-items: center; gap: 4px; padding: 3px 5px;
  border: 1px solid var(--line); border-radius: 3px; background: var(--paper-raised);
  box-shadow: 0 6px 18px rgba(34, 31, 25, .1); white-space: nowrap; cursor: default;
}
.pres-tools-kind { padding: 0 4px; color: var(--muted); font: 400 9px/1 var(--sans); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.pres-tool {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 24px;
  padding: 0; border: 0; border-radius: 2px; background: transparent; color: var(--ink); cursor: pointer;
}
.pres-tool.is-wide { width: auto; padding: 0 8px; font: 400 11px/1 var(--sans); }
.pres-tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pres-tool:hover { background: var(--blue-soft); color: var(--blue); }
.pres-tool.is-on { color: var(--blue); }
.pres-tool[data-pres-tool="remove"]:hover { background: rgba(181, 59, 47, .12); color: var(--red); }
.pres-tool.is-tight { width: 22px; height: 22px; }
.pres-tool.is-tight svg { width: 13px; height: 13px; stroke-width: 1.4; }
.pres-tools-group { display: inline-flex; gap: 1px; padding: 0 2px; }
.pres-tools-size select {
  height: 22px; padding: 0 2px; border: 1px solid var(--line); border-radius: 2px; background: var(--paper);
  font: 400 11px/1 var(--sans); color: var(--ink);
}
.pres-tools-caption { width: 130px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 2px; background: var(--paper); font: 400 11px/1.4 var(--sans); }

/* Which slide a copy lands on. */
/* A locked block says so, and shows no resize grip. */
.pres-slide.is-editable .pres-frame.is-locked { cursor: default; }
.pres-slide.is-editable .pres-frame.is-locked.is-selected { border-style: dashed; }
.pres-slide.is-editable .pres-frame.is-locked .pres-resize { display: none; }

/* Rendered markdown sizes itself off the slide, overriding the fixed scale in
   core/markdown.css that serves notes and notebook entries. */
.pres-slide .md { font-size: 1em; line-height: 1.45; }
.pres-slide .md > :first-child { margin-top: 0; }
.pres-slide .md h1 { margin: 0 0 .4em; font-size: 1.75em; }
.pres-slide .md h2 { margin: 0 0 .4em; font-size: 1.35em; }
.pres-slide .md h3 { margin: 0 0 .4em; font-size: 1.1em; }
.pres-slide .md p, .pres-slide .md ul, .pres-slide .md ol { margin: 0 0 .6em; }
.pres-slide .md li + li { margin-top: .25em; }
.pres-slide .md code, .pres-slide .md pre { font-size: .85em; }
.pres-text { overflow: hidden; overflow-wrap: anywhere; }
.pres-title-block { margin: 0; overflow: hidden; overflow-wrap: anywhere; font: 400 1.9em/1.15 var(--serif); }
.pres-title-input-block {
  width: 100%; padding: .2em .3em; border: 1px solid var(--blue); border-radius: 3px;
  background: var(--paper); font: 400 2.1em/1.15 var(--serif); color: var(--ink);
}
.pres-text-input {
  width: 100%; height: 100%; padding: .5em; border: 1px solid var(--blue); border-radius: 3px;
  background: var(--paper); font: inherit; font-family: var(--sans); font-size: .9em; resize: none;
}
.pres-figure { display: flex; flex-direction: column; gap: .5em; margin: 0; min-height: 0; height: 100%; }
.pres-figure img { min-height: 0; max-height: 100%; object-fit: contain; }
.pres-figure figcaption { color: var(--muted); font-size: .7em; text-align: center; }

/* ------------------------------------------------------------- composer */

/* A full screen of Python: the code needs the room, the figure needs to be
   watched while it changes, and the file list stays out of the way until it is
   wanted. */
.pres-composer {
  position: fixed; inset: 0; z-index: 1100; display: grid; grid-template-rows: auto minmax(0, 1fr);
  background: var(--paper);
}
.pres-composer-bar {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid var(--line); background: var(--paper-raised);
}
.pres-composer-title { flex: 1; margin: 0; font: 400 19px/1.1 var(--serif); }
.pres-composer-bar .button { min-height: 32px; padding: 0 14px; font-size: var(--text-control); }
.pres-composer-bar kbd { margin-left: 6px; opacity: .55; font: inherit; font-size: 10px; }
.pres-code-state { color: var(--muted); font-size: var(--text-meta); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.pres-code-state[data-state="busy"] { color: var(--blue); }
.pres-code-state[data-state="ok"] { color: var(--green); }
.pres-code-state[data-state="bad"] { color: var(--red); }

.pres-composer-body {
  min-height: 0; display: grid;
  --tree-width: 246px; --right-width: 520px; --console-height: 220px;
  grid-template-columns: var(--tree-width) 5px minmax(320px, 1fr) 5px var(--right-width);
}
/* Every panel edge is a rule you can drag; they all behave the same way. */
.pres-splitter { cursor: col-resize; background: var(--line); touch-action: none; }
.pres-splitter.is-horizontal { cursor: row-resize; height: 5px; }
.pres-splitter:hover, .pres-splitter:focus-visible { background: var(--blue); outline: none; }
.pres-code-column { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.pres-code-wrap { position: relative; min-height: 0; overflow: hidden; }

/* The editor's own status line: mode on the left, the two switches a vim user
   wants within reach, and the keys that matter kept in view. */
.pres-code-bar {
  display: flex; align-items: center; gap: 12px; padding: 5px 12px;
  border-top: 1px solid var(--line); background: var(--paper-raised);
  font-size: var(--text-meta); letter-spacing: var(--tracking-label);
}
.pres-mode {
  padding: 2px 8px; border-radius: 2px; background: var(--ink); color: var(--paper);
  font-weight: 500; text-transform: uppercase;
}
.pres-mode[data-mode="insert"] { background: var(--green); }
.pres-mode[data-mode="visual"] { background: #8b5aa6; }
.pres-mode[data-mode="replace"] { background: var(--red); }
.pres-bar-toggle, .pres-bar-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; border: 0;
  background: none; color: var(--muted); cursor: pointer;
  font: inherit; font-size: var(--text-meta); letter-spacing: var(--tracking-label); text-transform: uppercase;
}
.pres-bar-toggle:hover, .pres-bar-link:hover { color: var(--ink); }
.pres-bar-dot { width: 7px; height: 7px; border: 1px solid var(--muted); border-radius: 50%; }
.pres-bar-toggle[aria-pressed="true"] { color: var(--blue); }
.pres-bar-toggle[aria-pressed="true"] .pres-bar-dot { border-color: var(--blue); background: var(--blue); }
.pres-bar-link { text-decoration: underline; text-underline-offset: 3px; }
.pres-bar-hint { flex: 1; color: var(--muted); text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; text-transform: none; }
.pres-bar-hint.is-loud { color: var(--blue); }
/* CodeMirror draws the editor; these rules give it the app's paper, its type
   scale and the height of the pane it sits in. */
.pres-code-wrap .CodeMirror {
  width: 100%; height: 100%; background: white; color: var(--ink);
  font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pres-code-wrap .CodeMirror-gutters { border-right: 1px solid var(--line); background: white; }
.pres-code-wrap .CodeMirror-linenumber { color: var(--muted); font-size: 11px; }
.pres-code-wrap .CodeMirror-cursor { border-left: 1.5px solid var(--ink); }
.pres-code-wrap .CodeMirror-selected { background: var(--blue-soft); }
.pres-code-wrap .cm-comment { color: var(--muted); font-style: italic; }
.pres-code-wrap .cm-string, .pres-code-wrap .cm-string-2 { color: var(--green); }
.pres-code-wrap .cm-keyword { color: var(--blue); }
.pres-code-wrap .cm-builtin { color: #8b5aa6; }
.pres-code-wrap .cm-number { color: var(--red); }
.pres-code-wrap .cm-def, .pres-code-wrap .cm-variable-2 { color: var(--ink); }
/* Vim's `:` line and its fat block cursor. */
.pres-code-wrap .CodeMirror-dialog { padding: 4px 8px; border-bottom: 1px solid var(--line); background: var(--paper-raised); font-size: 12px; }
.pres-code-wrap .CodeMirror-dialog input { border: 0; background: transparent; color: var(--ink); font: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pres-code-wrap .cm-fat-cursor .CodeMirror-cursor { background: rgba(24, 79, 209, .45); border: 0; }
.pres-ghost-text { border-radius: 2px; background: var(--blue-soft); color: var(--blue); white-space: pre; }

.pres-composer-right { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) 5px var(--console-height); border-left: 1px solid var(--line); }
.pres-preview { position: relative; min-height: 0; display: grid; background: white; }
/* What the run is doing, laid over the figure rather than beside it: the panel
   keeps one child in flow, so nothing moves when the status appears. `[hidden]`
   is spelled out because .pres-code-preview sets display and would win. */
.pres-phase {
  position: absolute; inset: 0; z-index: 1; display: grid; place-content: center;
  padding: 0 32px; background: white; text-align: center;
}
.pres-preview [hidden] { display: none; }
.pres-phase-text { margin: 0; font: 400 20px/1.25 var(--serif); color: var(--ink); }
.pres-phase[data-state="busy"] .pres-phase-text { color: var(--blue); }
.pres-phase[data-state="bad"] .pres-phase-text { color: var(--red); }
.pres-phase-sub { margin: 6px 0 0; color: var(--muted); font-size: var(--text-body); line-height: 1.5; }
.pres-phase-sub:empty { display: none; }
.pres-figure-meta {
  position: absolute; left: 12px; bottom: 10px; color: var(--muted);
  font-size: var(--text-meta); letter-spacing: var(--tracking-label); text-transform: uppercase;
}
.pres-copy-figure {
  position: absolute; top: 10px; right: 12px; padding: 3px 10px; border: 1px solid var(--line);
  border-radius: 999px; background: rgba(255, 255, 255, .9); color: var(--muted); cursor: pointer;
  font: inherit; font-size: 11px; opacity: 0; transition: opacity .12s;
}
.pres-preview:hover .pres-copy-figure, .pres-copy-figure:focus-visible { opacity: 1; }
.pres-copy-figure:hover { border-color: var(--ink); color: var(--ink); }
.pres-code-preview { display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto; background: white; }
.pres-code-preview img { max-width: 100%; max-height: 100%; }
/* min-height: 0 is what makes this scroll: a grid item defaults to min-height
   auto and grows past its track rather than overflowing inside it. */
.pres-code-console { min-height: 0; overflow-y: auto; overscroll-behavior: contain; background: white; }
.pres-code-out, .pres-code-trace {
  margin: 0; padding: 12px 18px; white-space: pre-wrap; word-break: break-word;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pres-code-trace { background: rgba(181, 59, 47, .07); color: var(--red); }
.pres-console-hint { margin: 0; padding: 12px 18px; color: var(--muted); font-size: var(--text-body); }

/* The collections tree. Same shape as the organization tab's drawer — indent
   token, hover wash, tabular counts — kept here rather than borrowed, so that
   stylesheet stays free to change. */
.pres-tree { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); border-right: 1px solid var(--line); background: var(--paper-raised); }
.pres-tree-title { margin: 0; padding: 14px 16px 8px; color: var(--muted); font: 400 var(--text-label)/1 var(--sans); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.pres-tree-body { overflow-y: auto; padding: 0 8px 14px; }
.pres-tree-section + .pres-tree-section { margin-top: 14px; }
.pres-tree-section-title {
  margin: 0; padding: 6px 6px 4px; color: var(--muted);
  font: 400 var(--text-meta)/1 var(--sans); letter-spacing: var(--tracking-label); text-transform: uppercase;
}
.pres-tree-loading { margin: 0; padding: 4px 6px 4px var(--indent, 6px); color: var(--muted); font-size: 10px; }
.pres-tree-drag {
  position: fixed; top: -1000px; left: -1000px; padding: 4px 8px; border-radius: 3px;
  background: var(--ink); color: white; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pres-tree-row { display: flex; align-items: center; gap: 4px; padding-left: var(--indent); border-radius: 2px; }
.pres-tree-row:hover { background: rgba(23, 23, 19, .05); }
.pres-tree-row.is-armed { background: var(--blue-soft); }
/* A file with no parsed data is shown, so it can be found, and marked, so it is
   not mistaken for something plottable. */
.pres-tree-row.is-dim .pres-tree-label { color: var(--muted); font-style: italic; }
.pres-tree-row.is-armed .pres-tree-label { color: var(--blue); }
.pres-tree-caret:disabled { opacity: .3; cursor: default; }
.pres-tree-caret {
  width: 16px; height: 20px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 9px;
}
.pres-tree-label {
  flex: 1; min-width: 0; padding: 5px 4px; border: 0; overflow: hidden; background: transparent;
  color: inherit; cursor: pointer; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: 11px;
}
.pres-tree-label:hover { color: var(--blue); }
.pres-tree-count { padding-right: 6px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }

.pres-confirm { width: min(430px, 92vw); padding: 22px; }
.pres-confirm-title { margin: 0; font: 400 19px/1.2 var(--serif); }
.pres-confirm-text { margin: 8px 0 18px; color: var(--muted); font-size: var(--text-body); line-height: 1.55; }
.pres-confirm-foot { display: flex; justify-content: flex-end; gap: 8px; }
/* announcements.css declares an unscoped .button.is-danger that paints the
   label red; the colour is restated here so it reads on the red fill. */
.pres-confirm .button.is-danger { border-color: var(--red); background: var(--red); color: white; }
.pres-confirm .button.is-danger:hover { background: #9d3227; border-color: #9d3227; color: white; }

/* ------------------------------------------------------------- templates */

/* A shelf, not a gallery: names and purposes read down the page, and a step
   opens where it sits. */
/* A fixed box: the shelf scrolls inside it, so opening a template does not
   resize the panel under the pointer. */
.pres-templates { width: min(680px, 94vw); height: min(660px, 86vh); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.pres-templates-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line); background: var(--paper-raised);
}
.pres-templates-title { margin: 0; font: 400 21px/1.1 var(--serif); }
.pres-templates-sub { margin: 4px 0 0; color: var(--muted); font-size: var(--text-body); }
.pres-templates-body { flex: 1; min-height: 0; overflow-y: auto; }

.pres-template { border-bottom: 1px solid var(--line); }
.pres-template-head { display: flex; flex-direction: column; gap: 2px; padding: 12px 20px; cursor: pointer; list-style: none; user-select: none; }
.pres-template-head::-webkit-details-marker { display: none; }
.pres-template-head:hover { background: rgba(23, 23, 19, .04); }
.pres-template[open] .pres-template-head { background: rgba(23, 23, 19, .04); }
.pres-template-name { font: 400 15px/1.2 var(--serif); }
.pres-template-purpose { color: var(--muted); font-size: var(--text-body); }
.pres-template-body { padding: 4px 20px 16px; }

.pres-step + .pres-step { margin-top: 14px; }
.pres-step-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.pres-step-label { margin: 0; color: var(--muted); font: 400 var(--text-label)/1 var(--sans); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.pres-step-actions { display: flex; gap: 6px; }
.pres-step-action {
  padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  color: var(--muted); cursor: pointer; font: inherit; font-size: 11px;
}
.pres-step-action:hover { border-color: var(--ink); color: var(--ink); }
.pres-step-action.is-primary { border-color: var(--blue); color: var(--blue); }
.pres-step-action.is-primary:hover { background: var(--blue-soft); }
.pres-step-code {
  margin: 0; padding: 10px 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 3px;
  background: white; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pres-template-foot { display: flex; justify-content: flex-end; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------- keys and settings */

/* Two columns, because the question people arrive with is "which of my config
   works here" — so the answer sits beside the box rather than under it. */
.pres-keys { width: min(940px, 95vw); max-height: 88vh; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.pres-keys-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line); background: var(--paper-raised);
}
.pres-keys-title { margin: 0; font: 400 21px/1.1 var(--serif); }
.pres-keys-sub { margin: 4px 0 0; color: var(--muted); font-size: var(--text-body); }

.pres-keys-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 268px; }
.pres-keys-editor { display: flex; flex-direction: column; min-height: 0; gap: 8px; padding: 16px 20px 18px; }
.pres-keys-label { margin: 0; color: var(--muted); font: 400 var(--text-label)/1 var(--sans); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.pres-keys-input {
  flex: 1; min-height: 260px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--paper); color: var(--ink);
  font: 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; resize: none; white-space: pre; tab-size: 2;
}
.pres-keys-input:focus { border-color: var(--blue); outline: none; box-shadow: inset 2px 0 0 var(--blue); }
.pres-keys-problems {
  padding: 10px 12px; border-left: 2px solid var(--red); border-radius: 0 3px 3px 0;
  background: rgba(181, 59, 47, .07); color: var(--red);
  font: 11.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pres-keys-problems p { margin: 0 0 3px; }
.pres-keys-problems p:last-child { margin-bottom: 0; }

/* The ledger: every directive that lands, and one line naming what cannot. */
.pres-keys-ref { min-height: 0; overflow-y: auto; padding: 16px 20px 18px; border-left: 1px solid var(--line); background: var(--paper-raised); }
.pres-keys-group + .pres-keys-group { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pres-keys-note { margin: 5px 0 0; color: var(--muted); font-size: var(--text-body); line-height: 1.5; }
.pres-keys-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 0; }
.pres-keys-chips code {
  padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  color: var(--ink); font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pres-keys-group.is-out .pres-keys-label { color: var(--red); }

.pres-keys-foot {
  display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  border-top: 1px solid var(--line); background: var(--paper-raised);
}
.pres-keys-restore {
  padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer;
  font: inherit; font-size: var(--text-body); text-decoration: underline; text-underline-offset: 3px;
}
.pres-keys-restore:hover { color: var(--ink); }
.pres-keys-status { flex: 1; color: var(--muted); font-size: var(--text-body); }

/* --------------------------------------------------------------- present */

/* One slide, as large as the screen allows, on its own ground. Zoomed, the
   slide is positioned and sized in plain pixels rather than by a transform —
   the same numbers the pointer-anchored zoom and the locator both read. */
.pres-present { position: fixed; inset: 0; z-index: 1100; background: #111; }
body.is-presenting { overflow: hidden; }
.pres-present:focus { outline: none; }
.pres-viewport { position: absolute; inset: 0; overflow: hidden; }
.pres-screen { position: absolute; }
.pres-present .pres-slide { width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none; aspect-ratio: 16 / 9; }
/* The middle button down: the slide is being moved, not clicked past. */
.pres-present.is-dragging-view, .pres-present.is-dragging-view * { cursor: grabbing; }
.pres-present-bar {
  position: absolute; right: 16px; bottom: 14px; z-index: 2; display: flex; align-items: center; gap: 10px;
  opacity: .25; transition: opacity .15s;
}
.pres-present-bar:hover, .pres-present:focus-within .pres-present-bar { opacity: 1; }
.pres-present-count { color: white; font-size: var(--text-body); font-variant-numeric: tabular-nums; }
.pres-present-button {
  min-height: var(--tap); padding: 0 12px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px;
  background: rgba(0, 0, 0, .35); color: white; cursor: pointer; font: inherit; font-size: var(--text-control);
}
.pres-present-button:hover { background: rgba(255, 255, 255, .15); }
.pres-present-zoom { display: inline-flex; align-items: center; gap: 4px; }
.pres-present-zoom-level { min-width: 48px; font-variant-numeric: tabular-nums; }

/* The locator: where you are, once the slide no longer fits the window.
   Click or drag it to move the window instead. */
.pres-present-locator {
  position: absolute; right: 16px; bottom: 58px; z-index: 2; width: 168px; aspect-ratio: 16 / 9;
  overflow: hidden; border: 1px solid rgba(255, 255, 255, .35); border-radius: 2px; background: #1a1a1a;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4); cursor: pointer; opacity: .25; transition: opacity .15s;
}
.pres-present-locator:hover, .pres-present:focus-within .pres-present-locator { opacity: 1; }
.pres-present-locator[hidden] { display: none; }
.pres-present-locator-page { position: absolute; inset: 0; pointer-events: none; }
.pres-present-locator-page .pres-slide {
  position: absolute; top: 0; left: 0; width: 1280px; height: 720px; transform-origin: top left;
  border: 0; border-radius: 0; box-shadow: none; aspect-ratio: auto;
}
.pres-present-locator-window {
  position: absolute; border: 1.5px solid #4ea1ff; background: rgba(78, 161, 255, .18); pointer-events: none;
}

/* ------------------------------------------------------------------- pdf */

/* Where slides are laid out to be photographed: off to the side, at the exact
   size of a page, and free of the crop the on-screen slide keeps. */
.pres-pdf-stage { position: fixed; left: -20000px; top: 0; width: 1280px; height: 720px; }
.pres-pdf-stage .pres-slide {
  width: 1280px; height: 720px; border: 0; border-radius: 0; box-shadow: none;
  aspect-ratio: auto; background: white;
}
/* A line that runs a shade long shows rather than disappears: fonts substitute
   between screens and the metrics move with them. */
.pres-pdf-stage .pres-text, .pres-pdf-stage .pres-title-block { overflow: visible; }

/* ------------------------------------------------------------ narrow view */

/* --------------------------------------------------------------- snippets */

/* A shelf, like templates, but the shelf is filled by whoever opens it: a
   save row above the list, and only that person's own rows can be edited or
   removed. A preview pane sits beside the list, because the two things that
   tell a snippet apart — what it draws, what it says — are both worth
   seeing before picking one. */
.pres-snippets { width: min(1040px, 96vw); height: min(720px, 88vh); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.pres-snippets-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line); background: var(--paper-raised);
}
.pres-snippets-title { margin: 0; font: 400 21px/1.1 var(--serif); }
.pres-snippets-sub { margin: 4px 0 0; color: var(--muted); font-size: var(--text-body); }

.pres-snippets-save { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.pres-snippets-name {
  flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 3px;
  background: white; font: inherit; font-size: var(--text-body);
}
.pres-snippets-name:focus { border-color: var(--blue); outline: none; }

.pres-snippets-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pres-snippets-list-pane { min-height: 0; overflow-y: auto; border-right: 1px solid var(--line); }
.pres-snippets-preview { min-height: 0; overflow-y: auto; padding: 18px 20px; background: var(--paper-raised); }
.pres-snippets-hint { margin: 0; padding: 20px; color: var(--muted); font-size: var(--text-body); }
.pres-snippets-preview .pres-snippets-hint { padding: 0; }
.pres-snippets-preview-title { margin: 0 0 12px; font: 400 17px/1.2 var(--serif); }
.pres-snippets-preview-figure {
  display: block; max-width: 100%; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 3px;
  background: white;
}
.pres-snippets-preview-code { max-height: none; }

.pres-snippets-list { list-style: none; margin: 0; padding: 0; }
.pres-snippet {
  display: flex; flex-direction: column; gap: 8px; padding: 11px 20px; border-bottom: 1px solid var(--line);
}
.pres-snippet.is-selected { background: var(--blue-soft); }
.pres-snippet-main {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; border: 0; background: none; padding: 0;
  cursor: pointer; text-align: left; font: inherit;
}
.pres-snippet-name { font: 400 15px/1.2 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.pres-snippet-meta { color: var(--muted); font-size: var(--text-body); }
.pres-snippet-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pres-step-action.is-danger { border-color: var(--red); color: var(--red); }
.pres-step-action.is-danger:hover { background: rgba(157, 50, 39, .08); }

@media (max-width: 760px) {
  .pres-snippets-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .pres-snippets-list-pane { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 900px) {
  .pres-composer-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr); }
  .pres-tree { grid-template-rows: auto; max-height: 26vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .pres-composer-right { border-left: 0; border-top: 1px solid var(--line); }
  .pres-splitter { display: none; }
  .pres-code-wrap { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 700px) {
  .pres-keys-body { grid-template-columns: minmax(0, 1fr); }
  .pres-keys-ref { border-left: 0; border-top: 1px solid var(--line); }
  .pres-title-input { font-size: 18px; }
  .pres-rail-remove { opacity: 1; }
}
