| 1 | /* slides.css — the look of a slide. |
| 2 | |
| 3 | internal/slides/render builds the tree; this file decides where the |
| 4 | regions sit and how big the words are. Nothing here knows what a deck |
| 5 | says, and nothing in the renderer writes a rule, so a template's |
| 6 | layout changes here and only here. |
| 7 | |
| 8 | It is a separate stylesheet from tokens.css and theme.css on purpose. |
| 9 | Those two dress the app — the chrome around a deck, in the reader's |
| 10 | own light or dark. A slide is not chrome: it is a document with a |
| 11 | fixed look that has to be the same on the presenter's laptop and on |
| 12 | the projector, so its palette comes from the deck's theme |
| 13 | (internal/slides/render/themes.go, which says why it does not follow |
| 14 | the OS scheme) and arrives as custom properties inline on the |
| 15 | section. Everything below reads those; it never names a colour except |
| 16 | as a fallback for a section that arrived without them. |
| 17 | |
| 18 | ── How a slide scales ─────────────────────────────────────────────── |
| 19 | |
| 20 | The section is a container (`container-type: inline-size`) and every |
| 21 | size inside it is in `cqw`, so a slide is one design that works at any |
| 22 | width: 1920 on a projector, 900 in the editor, 380 on a phone. There |
| 23 | is no second stylesheet and no breakpoint doing the scaling. |
| 24 | |
| 25 | The type scale lives as custom properties ON the section and is used |
| 26 | BY its descendants. That order is load-bearing: `cqw` in a property |
| 27 | resolves against the element's own query container, and an element is |
| 28 | never its own container, so a `cqw` written directly on the section |
| 29 | would measure the page around it instead. Held in a custom property |
| 30 | it is substituted into the descendant's declaration and measured |
| 31 | there, against the section. The section's own padding is a percentage |
| 32 | for the same reason. |
| 33 | |
| 34 | And that is why the template grid is not on the section but on the |
| 35 | `[slides-frame]` inside it. `gap: var(--slides-gap)` is a `cqw` |
| 36 | length USED on the element it is written on, which is the one place |
| 37 | the rule above bites: written on the section it measured whatever |
| 38 | container was outside — the space between a heading and a body was |
| 39 | 49.92px on a 1920 screen, 20.27px in a 780px window, and a different |
| 40 | number again in the editor's stage. On the frame it is a descendant |
| 41 | declaration like every other one, so it is 2.6% of the section's |
| 42 | content box wherever the slide is drawn (43.68px at 1920), and |
| 43 | internal/slides/layout can state one number for it. |
| 44 | |
| 45 | ── The phone ──────────────────────────────────────────────────────── |
| 46 | |
| 47 | Three mechanisms, and they do different jobs: |
| 48 | |
| 49 | - `@container slide (max-width: 600px)` collapses the template grids |
| 50 | to one column, honours the `data-phone-*` layer, and puts a rem |
| 51 | floor under the type scale so a 320px reflow is still readable. |
| 52 | It fires for a narrow container anywhere — a phone, a two-up |
| 53 | editor, a preview pane. |
| 54 | - `[data-vp="phone"]`, which the renderer writes when it was asked |
| 55 | for a phone, drops the 16:9 frame on a flow slide so it grows as |
| 56 | tall as its content. A container query cannot do this: a query |
| 57 | styles a container's descendants, never the container itself. |
| 58 | - `@media (max-width: 600px)` does the same for a slide that was |
| 59 | rendered for a desktop and opened on a phone anyway — the |
| 60 | scriptless viewer has no way to know which it is serving, and §8's |
| 61 | 320px reflow is not optional. |
| 62 | |
| 63 | Modern CSS is the floor (rastrillo SKILL.md): container queries, |
| 64 | `oklch()`, `color-mix()` and `light-dark()` are all free here. |
| 65 | |
| 66 | ── The fonts ──────────────────────────────────────────────────────── |
| 67 | |
| 68 | This file declares no font face, and that is the point (Paul, |
| 69 | 2026-10-26: "No flashing, ever!"). The stacks below and on every |
| 70 | section name the three Liberation families this app serves itself |
| 71 | first. They are not decoration: the Go layout engine |
| 72 | (internal/slides/layout) measures a slide with those exact font |
| 73 | programs to produce the SVG thumbnail and the PDF, and |
| 74 | internal/slides/fonts holds the same files for the engine's side of |
| 75 | that promise. |
| 76 | |
| 77 | They used to be @font-face rules here with font-display: swap, which |
| 78 | is a flash by definition: text drawn in a fallback, then redrawn in |
| 79 | the web face. Now the faces exist only once the font gate |
| 80 | (internal/slides/fontgate.go, fixtures/fonts-gate.mjs) has loaded all |
| 81 | four styles of a family and added them to document.fonts together, |
| 82 | before it shows any slide. So: |
| 83 | |
| 84 | - with no script, nothing declares the web faces and every stack |
| 85 | falls through to the system faces after them, from the first paint |
| 86 | to the last; |
| 87 | - with the gate, the slides are hidden (below) until every family |
| 88 | the deck uses is on, or has missed its deadline and been committed |
| 89 | to those same system faces for the visit; |
| 90 | - a family nobody has asked for yet is not in the page, so nothing |
| 91 | can be drawn in it while it loads. */ |
| 92 | |
| 93 | /* The hold. fixtures/fonts-hold.js sets it before the first paint and |
| 94 | the gate takes it off once, so it is never in the server's markup: a |
| 95 | page without scripts is never held. Every slide, not only its text, |
| 96 | so nothing shows a slide with its words missing; visibility, so the |
| 97 | page's layout underneath is already the final one. Screen only: a |
| 98 | page printed while held prints, in its system faces. */ |
| 99 | @media screen { |
| 100 | html[data-slides-fonts="pending"] [slides-slide], |
| 101 | html[data-slides-fonts="pending"] [slides-scene-layer] { |
| 102 | visibility: hidden; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | [slides-slide] { |
| 107 | /* The palette. These values are what a section renders as when it |
| 108 | arrived without inline custom properties — a fragment pasted into |
| 109 | a page, a test harness. A real section overrides every one of them |
| 110 | from the deck's theme. */ |
| 111 | --slides-bg: #faf7f0; |
| 112 | --slides-fg: #1c1a17; |
| 113 | --slides-accent: #8a5410; |
| 114 | --slides-accent-2: #46617a; |
| 115 | --slides-font-heading: Liberation Serif, Georgia, serif; |
| 116 | --slides-font-body: Liberation Sans, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; |
| 117 | /* Code is one face on every theme, so it is a variable here and |
| 118 | not a theme property. */ |
| 119 | --slides-font-code: Liberation Mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; |
| 120 | |
| 121 | /* The type scale, in cqw so it is a fraction of the slide's own |
| 122 | width. Calibrated on a 1920-wide frame: 6.6cqw is ~127px, about a |
| 123 | 95pt title, and the body steps land near 32, 40 and 49pt — slide |
| 124 | sizes, not document sizes. */ |
| 125 | --slides-t-1: 6.6cqw; |
| 126 | --slides-t-2: 5cqw; |
| 127 | --slides-t-3: 4cqw; |
| 128 | --slides-body-l: 3.4cqw; |
| 129 | --slides-body-m: 2.8cqw; |
| 130 | --slides-body-s: 2.2cqw; |
| 131 | --slides-code: 2.3cqw; |
| 132 | |
| 133 | --slides-gap: 2.6cqw; |
| 134 | --slides-rule: 0.5cqw; |
| 135 | /* Percentage, not cqw: see the header. 6.25% of a 16:9 frame is |
| 136 | 120px at 1920, the margin a slide template usually keeps. */ |
| 137 | --slides-pad: 6.25%; |
| 138 | |
| 139 | box-sizing: border-box; |
| 140 | container-type: inline-size; |
| 141 | container-name: slide; |
| 142 | aspect-ratio: 16 / 9; |
| 143 | inline-size: 100%; |
| 144 | margin: 0; |
| 145 | padding: var(--slides-pad); /* spacing-allow: the slide's margin, 6.25% of its own frame (the deck's geometry, not the page's) */ |
| 146 | background-color: var(--slides-bg); |
| 147 | color: var(--slides-fg); |
| 148 | font-family: var(--slides-font-body); |
| 149 | line-height: 1.3; |
| 150 | text-wrap: pretty; |
| 151 | /* A slide that overflows scrolls rather than clipping. Losing the |
| 152 | end of a sentence to `overflow: hidden` is a WCAG 1.4.10 failure |
| 153 | nobody would ever see reported; a scrollbar is visible, and it is |
| 154 | the estilo allowance §8 already makes for the canvas stage. */ |
| 155 | overflow: auto; |
| 156 | |
| 157 | /* One cell, which the frame fills. The template grid is on the |
| 158 | frame (see the header); all the section does is give it the |
| 159 | content box to be laid out in. */ |
| 160 | display: grid; |
| 161 | grid-template-columns: minmax(0, 1fr); |
| 162 | grid-template-rows: minmax(0, 1fr); |
| 163 | } |
| 164 | |
| 165 | [slides-slide] * { |
| 166 | box-sizing: border-box; |
| 167 | } |
| 168 | |
| 169 | /* The frame: the template grid, one cell of the section, inside its |
| 170 | padding. Every `cqw` written here is a descendant's and resolves |
| 171 | against the section, which is the whole reason it exists. A canvas |
| 172 | slide has no frame — its blocks are placed by hand on the section |
| 173 | itself, and there is no gap to get wrong. */ |
| 174 | [slides-frame] { |
| 175 | display: grid; |
| 176 | gap: var(--slides-gap); /* spacing-allow: the template's regions, 2.6cqw of the slide (the deck's geometry) */ |
| 177 | grid-template-columns: minmax(0, 1fr); |
| 178 | align-content: start; |
| 179 | min-inline-size: 0; |
| 180 | min-block-size: 0; |
| 181 | } |
| 182 | |
| 183 | /* A slide's own backdrop (§2.2): a colour arrives as --slides-bg and |
| 184 | needs no rule; an image arrives as a URL to paint. */ |
| 185 | [slides-slide][data-background="image"] { |
| 186 | background-image: var(--slides-bg-image); |
| 187 | background-size: cover; |
| 188 | background-position: center; |
| 189 | } |
| 190 | |
| 191 | /* ── Regions ───────────────────────────────────────────────────────── |
| 192 | A region is a grid area and a column of blocks. A region a template |
| 193 | has no area for falls through to auto placement rather than |
| 194 | disappearing, which is what makes an aside on a title slide still |
| 195 | readable. */ |
| 196 | |
| 197 | [slides-region] { |
| 198 | display: flex; |
| 199 | flex-direction: column; |
| 200 | gap: var(--slides-gap); /* spacing-allow: a region's blocks, 2.6cqw of the slide (the deck's geometry) */ |
| 201 | min-inline-size: 0; |
| 202 | min-block-size: 0; |
| 203 | } |
| 204 | |
| 205 | [slides-region][data-region="heading"] { |
| 206 | grid-area: heading; |
| 207 | } |
| 208 | [slides-region][data-region="body"] { |
| 209 | grid-area: body; |
| 210 | } |
| 211 | [slides-region][data-region="aside"] { |
| 212 | grid-area: aside; |
| 213 | } |
| 214 | [slides-region][data-region="media"] { |
| 215 | grid-area: media; |
| 216 | } |
| 217 | |
| 218 | /* ── Templates ─────────────────────────────────────────────────────── |
| 219 | Each is a grid, and each names its areas so the region rules above |
| 220 | land in the right cell. */ |
| 221 | |
| 222 | /* title — the opening slide: everything centred, in the middle. */ |
| 223 | [slides-slide][data-template="title"] > [slides-frame] { |
| 224 | grid-template-areas: "heading" "body"; |
| 225 | grid-template-rows: auto auto; |
| 226 | align-content: center; |
| 227 | justify-items: center; |
| 228 | text-align: center; |
| 229 | } |
| 230 | [slides-slide][data-template="title"] [slides-region] { |
| 231 | align-items: center; |
| 232 | max-inline-size: 80%; |
| 233 | } |
| 234 | |
| 235 | /* title-body — the workhorse: a heading, then everything else. */ |
| 236 | [slides-slide][data-template="title-body"] > [slides-frame] { |
| 237 | grid-template-areas: "heading" "body"; |
| 238 | grid-template-rows: auto 1fr; |
| 239 | } |
| 240 | |
| 241 | /* two-column — the heading spans, body and aside sit side by side. */ |
| 242 | [slides-slide][data-template="two-column"] > [slides-frame] { |
| 243 | grid-template-areas: |
| 244 | "heading heading" |
| 245 | "body aside"; |
| 246 | grid-template-columns: 1fr 1fr; |
| 247 | grid-template-rows: auto 1fr; |
| 248 | column-gap: calc(var(--slides-gap) * 1.6); /* spacing-allow: two columns' gutter, in the slide's cqw */ |
| 249 | } |
| 250 | |
| 251 | /* section — a chapter break: one heading, centred, over an accent bar |
| 252 | that is the only decoration in the whole stylesheet. */ |
| 253 | [slides-slide][data-template="section"] > [slides-frame] { |
| 254 | grid-template-areas: "heading"; |
| 255 | align-content: center; |
| 256 | } |
| 257 | [slides-slide][data-template="section"] [data-region="heading"] { |
| 258 | align-items: center; |
| 259 | } |
| 260 | [slides-slide][data-template="section"] [data-region="heading"]::after { |
| 261 | content: ""; |
| 262 | inline-size: 18cqw; |
| 263 | block-size: var(--slides-rule); |
| 264 | background-color: var(--slides-accent); |
| 265 | border-radius: var(--slides-rule); |
| 266 | } |
| 267 | |
| 268 | /* image-full — the media fills the frame and the heading sits over its |
| 269 | bottom-left corner, on a scrim so the words survive a light picture. |
| 270 | The heading is still first in the document: the picture is not what |
| 271 | the slide is about. */ |
| 272 | [slides-slide][data-template="image-full"] { |
| 273 | /* No padding, so one cqw on this template is 19.2px and not 16.8 |
| 274 | — internal/slides/layout carries both scales for it. */ |
| 275 | padding: 0; |
| 276 | } |
| 277 | [slides-slide][data-template="image-full"] > [slides-frame] { |
| 278 | grid-template-areas: "media"; |
| 279 | grid-template-rows: 1fr; |
| 280 | gap: 0; |
| 281 | } |
| 282 | [slides-slide][data-template="image-full"] [data-region="heading"] { |
| 283 | grid-area: media; |
| 284 | z-index: 1; |
| 285 | align-self: end; |
| 286 | justify-self: start; |
| 287 | max-inline-size: 80%; |
| 288 | margin: var(--slides-pad); /* spacing-allow: the slide's margin, a percentage of its frame */ |
| 289 | padding: calc(var(--slides-gap) / 2) var(--slides-gap); /* spacing-allow: the scrim round a heading on a picture, in the slide's cqw */ |
| 290 | border-radius: 1cqw; |
| 291 | /* The scrim is the slide's own background, mixed towards |
| 292 | transparent: it belongs to whichever theme is on. */ |
| 293 | background-color: color-mix(in oklab, var(--slides-bg) 82%, transparent); |
| 294 | backdrop-filter: blur(0.6cqw); |
| 295 | } |
| 296 | [slides-slide][data-template="image-full"] [data-region="media"], |
| 297 | [slides-slide][data-template="image-full"] [data-block="image"] { |
| 298 | block-size: 100%; |
| 299 | min-block-size: 0; |
| 300 | } |
| 301 | |
| 302 | /* quote — one pull quote, centred, and nothing competing with it. */ |
| 303 | [slides-slide][data-template="quote"] > [slides-frame] { |
| 304 | grid-template-areas: "body"; |
| 305 | align-content: center; |
| 306 | justify-items: center; |
| 307 | } |
| 308 | [slides-slide][data-template="quote"] [slides-region] { |
| 309 | align-items: center; |
| 310 | max-inline-size: 84%; |
| 311 | text-align: center; |
| 312 | } |
| 313 | |
| 314 | /* blank — a single body region, stacked from the top. It is also what |
| 315 | a canvas slide reflowed onto a phone becomes (§2.3). */ |
| 316 | [slides-slide][data-template="blank"] > [slides-frame] { |
| 317 | grid-template-areas: "body"; |
| 318 | } |
| 319 | |
| 320 | /* ── Blocks ────────────────────────────────────────────────────────── |
| 321 | Semantic elements, sized off the scale, with the browser's own |
| 322 | margins removed: spacing on a slide is the region's gap, so two |
| 323 | blocks are never a gap plus a margin. */ |
| 324 | |
| 325 | [slides-block] { |
| 326 | margin: 0; |
| 327 | min-inline-size: 0; |
| 328 | } |
| 329 | |
| 330 | [slides-block][data-block="heading"] { |
| 331 | font-family: var(--slides-font-heading); |
| 332 | font-weight: 600; |
| 333 | line-height: 1.1; |
| 334 | text-wrap: balance; |
| 335 | letter-spacing: -0.01em; |
| 336 | } |
| 337 | [slides-block][data-level="1"] { |
| 338 | font-size: var(--slides-t-1); |
| 339 | } |
| 340 | [slides-block][data-level="2"] { |
| 341 | font-size: var(--slides-t-2); |
| 342 | } |
| 343 | [slides-block][data-level="3"] { |
| 344 | font-size: var(--slides-t-3); |
| 345 | color: var(--slides-accent); |
| 346 | } |
| 347 | [slides-slide][data-template="section"] [data-block="heading"] { |
| 348 | text-align: center; |
| 349 | } |
| 350 | |
| 351 | [slides-block][data-block="text"], |
| 352 | [slides-block][data-block="list"] { |
| 353 | font-size: var(--slides-body-m); |
| 354 | } |
| 355 | [slides-block][data-size="s"] { |
| 356 | font-size: var(--slides-body-s); |
| 357 | } |
| 358 | [slides-block][data-size="l"] { |
| 359 | font-size: var(--slides-body-l); |
| 360 | } |
| 361 | [slides-block][data-align="center"] { |
| 362 | text-align: center; |
| 363 | } |
| 364 | [slides-block][data-align="end"] { |
| 365 | text-align: end; |
| 366 | } |
| 367 | [slides-block][data-align="justify"] { |
| 368 | text-align: justify; |
| 369 | } |
| 370 | |
| 371 | [slides-block] p { |
| 372 | margin: 0; |
| 373 | } |
| 374 | [slides-block] p + p { |
| 375 | margin-block-start: 0.6em; /* spacing-allow: a slide's paragraph spacing, in its own type's em */ |
| 376 | } |
| 377 | |
| 378 | [slides-block][data-block="list"] { |
| 379 | display: flex; |
| 380 | flex-direction: column; |
| 381 | gap: 0.4em; /* spacing-allow: a slide list's items, in its own type's em */ |
| 382 | padding-inline-start: 1.4em; /* spacing-allow: a slide list's indent, in its own type's em */ |
| 383 | } |
| 384 | [slides-block][data-block="list"][data-indent="1"] { |
| 385 | padding-inline-start: 3em; /* spacing-allow: a slide list's indent, in its own type's em */ |
| 386 | } |
| 387 | [slides-block][data-block="list"][data-indent="2"] { |
| 388 | padding-inline-start: 4.6em; /* spacing-allow: a slide list's indent, in its own type's em */ |
| 389 | } |
| 390 | [slides-block][data-block="list"][data-indent="3"] { |
| 391 | padding-inline-start: 6.2em; /* spacing-allow: a slide list's indent, in its own type's em */ |
| 392 | } |
| 393 | [slides-block][data-block="list"] li::marker { |
| 394 | color: var(--slides-accent); |
| 395 | } |
| 396 | |
| 397 | [slides-block][data-block="quote"] { |
| 398 | font-size: var(--slides-body-l); |
| 399 | display: flex; |
| 400 | flex-direction: column; |
| 401 | gap: 0.6em; /* spacing-allow: a slide quote and its caption, in its own type's em */ |
| 402 | } |
| 403 | [slides-block][data-block="quote"] blockquote { |
| 404 | margin: 0; |
| 405 | font-style: italic; |
| 406 | text-wrap: balance; |
| 407 | } |
| 408 | [slides-block][data-block="quote"] figcaption { |
| 409 | font-size: 0.62em; |
| 410 | font-style: normal; |
| 411 | color: var(--slides-accent); |
| 412 | } |
| 413 | [slides-block][data-block="quote"] figcaption::before { |
| 414 | content: "— "; |
| 415 | } |
| 416 | [slides-block][data-block="quote"] cite { |
| 417 | font-style: normal; |
| 418 | } |
| 419 | |
| 420 | [slides-block][data-block="image"] { |
| 421 | display: flex; |
| 422 | min-block-size: 0; |
| 423 | } |
| 424 | [slides-block][data-block="image"] img { |
| 425 | inline-size: 100%; |
| 426 | block-size: 100%; |
| 427 | max-inline-size: 100%; |
| 428 | border-radius: var(--slides-radius, 0); |
| 429 | object-fit: cover; |
| 430 | } |
| 431 | [slides-block][data-block="image"][data-fit="contain"] img { |
| 432 | object-fit: contain; |
| 433 | } |
| 434 | /* An image with no alt yet is not an error the reader should meet, but |
| 435 | the editor stage wants to see it. The outline shows only where the |
| 436 | host page asks for it. */ |
| 437 | [slides-editing] [slides-block] img[data-missing-alt] { |
| 438 | outline: var(--slides-rule) dashed var(--slides-accent); |
| 439 | outline-offset: calc(var(--slides-rule) * -1); |
| 440 | } |
| 441 | /* A clip block (scenes and clips spec §2): its poster, the picture of |
| 442 | its video's first frame, drawn whole; where scripts run the video |
| 443 | (fixtures/clip.mjs) takes the same cell over it, unseen until it plays |
| 444 | (data-clip-live), so the poster shows until then and whenever the |
| 445 | video can't be had. internal/slides/layout's planClip draws the same |
| 446 | box. */ |
| 447 | [slides-block][data-block="clip"] { |
| 448 | display: grid; |
| 449 | grid-template: minmax(0, 1fr) / minmax(0, 1fr); |
| 450 | min-block-size: 0; |
| 451 | } |
| 452 | [slides-block][data-block="clip"] > img, |
| 453 | [slides-block][data-block="clip"] > video { |
| 454 | grid-area: 1 / 1; |
| 455 | inline-size: 100%; |
| 456 | block-size: 100%; |
| 457 | min-block-size: 0; |
| 458 | object-fit: contain; |
| 459 | } |
| 460 | [slides-block][data-block="clip"] > video { |
| 461 | opacity: 0; |
| 462 | pointer-events: none; |
| 463 | } |
| 464 | [slides-block][data-block="clip"][data-clip-live] > video { |
| 465 | opacity: 1; |
| 466 | } |
| 467 | [slides-block][data-block="clip"] > [data-clip-press] { |
| 468 | display: none; |
| 469 | } |
| 470 | /* A scene block (scenes and clips spec §3): its stills, one per state |
| 471 | it passes through, stacked in one cell, and the newest that has |
| 472 | arrived drawn over the rest, which are hidden from everyone. In a |
| 473 | region it asks for a 16:9 box at the region's width and gives way |
| 474 | like a picture when the region is shorter; the scene itself is then |
| 475 | the largest 16:9 box that fits, centred (the block is a size |
| 476 | container for that, so its type is set on the block, against the |
| 477 | slide). On a canvas the scene is its box. A frame may run inside the |
| 478 | block (fixtures/scene-places.mjs), so the block holds it. |
| 479 | internal/slides/layout/scenes.go draws the same numbers. */ |
| 480 | [slides-block][data-block="scene"] { |
| 481 | position: relative; |
| 482 | display: grid; |
| 483 | grid-template: minmax(0, 1fr) / minmax(0, 1fr); |
| 484 | inline-size: 100%; |
| 485 | aspect-ratio: 16 / 9; |
| 486 | min-block-size: 0; |
| 487 | container-type: size; |
| 488 | font-size: var(--slides-body-s); |
| 489 | } |
| 490 | [slides-block][data-block="scene"] > [data-scene-state] { |
| 491 | grid-area: 1 / 1; |
| 492 | inline-size: 100%; |
| 493 | block-size: 100%; |
| 494 | min-block-size: 0; |
| 495 | box-sizing: border-box; |
| 496 | object-fit: contain; |
| 497 | } |
| 498 | /* A scene's frame run inside its block (fixtures/scene-places.mjs: a |
| 499 | box drawn over it) takes its stills' cell and size, over them. */ |
| 500 | [slides-block][data-block="scene"] > [slides-scene-frame] { |
| 501 | grid-area: 1 / 1; |
| 502 | inline-size: 100%; |
| 503 | block-size: 100%; |
| 504 | min-block-size: 0; |
| 505 | border: 0; |
| 506 | } |
| 507 | [slides-slide]:not([data-layout="canvas"]) [slides-block][data-block="scene"] > [data-scene-state], |
| 508 | [slides-slide]:not([data-layout="canvas"]) [slides-block][data-block="scene"] > [slides-scene-frame] { |
| 509 | place-self: center; |
| 510 | inline-size: min(100cqw, 100cqh * 16 / 9); |
| 511 | block-size: min(100cqh, 100cqw * 9 / 16); |
| 512 | } |
| 513 | [slides-block][data-block="scene"] > [data-scene-state]:has(~ [data-scene-state]:not([data-waiting])) { |
| 514 | visibility: hidden; |
| 515 | } |
| 516 | /* While the scene's own frame runs over it (fixtures/scene-layer.mjs), |
| 517 | the still under it is not drawn, so a scene with a clear background |
| 518 | shows nothing through it; it is still what assistive technology |
| 519 | reads, the frame being inert. */ |
| 520 | [slides-block][data-block="scene"][data-scene-live] > [data-scene-state] { |
| 521 | opacity: 0; |
| 522 | } |
| 523 | /* A state with no still: the scene's name and the state's description |
| 524 | on a panel a shade off the slide, as a code block's is. */ |
| 525 | [slides-block] [data-scene-placeholder] { |
| 526 | display: flex; |
| 527 | flex-direction: column; |
| 528 | align-items: center; |
| 529 | justify-content: center; |
| 530 | gap: 0.5em; /* spacing-allow: a scene's placeholder, in its own type's em */ |
| 531 | padding: 1em; /* spacing-allow: a scene's placeholder, in its own type's em */ |
| 532 | border-radius: 0.6em; |
| 533 | line-height: 1.3; |
| 534 | text-align: center; |
| 535 | color: var(--slides-fg); |
| 536 | background-color: color-mix(in oklab, var(--slides-fg) 8%, var(--slides-bg)); |
| 537 | } |
| 538 | /* The frames scenes run in, over the slide and outside it |
| 539 | (fixtures/scene-layer.mjs): gone with the slide when the room is |
| 540 | blacked out. */ |
| 541 | [data-blackout="true"] > [slides-scene-layer] { |
| 542 | visibility: hidden; |
| 543 | } |
| 544 | |
| 545 | /* A block nothing reaches — named as a child by a columns block that |
| 546 | is itself inside one of its children, a shape the ops refuse but a |
| 547 | merge of two people's edits can still make (codex 7). The renderer |
| 548 | puts it after everything else instead of dropping it; the content is |
| 549 | what the reader sees, and the editor stage sees the outline too. The |
| 550 | wrapper is a region with no grid area, so it lands in a fresh row |
| 551 | under the template's own. */ |
| 552 | [slides-region][data-region="unreached"] { |
| 553 | grid-column: 1 / -1; |
| 554 | } |
| 555 | [slides-editing] [slides-block][data-unreached] { |
| 556 | outline: var(--slides-rule) dashed var(--slides-accent-2); |
| 557 | outline-offset: calc(var(--slides-rule) * -1); |
| 558 | } |
| 559 | |
| 560 | [slides-block][data-block="columns"] { |
| 561 | display: grid; |
| 562 | gap: var(--slides-gap); /* spacing-allow: a slide's columns, 2.6cqw of the slide */ |
| 563 | grid-template-columns: repeat(2, minmax(0, 1fr)); |
| 564 | } |
| 565 | [slides-block][data-block="columns"][data-count="3"] { |
| 566 | grid-template-columns: repeat(3, minmax(0, 1fr)); |
| 567 | } |
| 568 | |
| 569 | [slides-block][data-block="code"] { |
| 570 | font-size: var(--slides-code); |
| 571 | font-family: var(--slides-font-code); |
| 572 | line-height: 1.45; |
| 573 | padding: 1em; /* spacing-allow: a slide's code block, in its own type's em */ |
| 574 | border-radius: 0.6em; |
| 575 | overflow-x: auto; |
| 576 | tab-size: 2; |
| 577 | /* A panel a shade off the slide, in whichever direction the theme |
| 578 | runs — no second colour needed, and no assumption about light or |
| 579 | dark. */ |
| 580 | background-color: color-mix(in oklab, var(--slides-fg) 8%, var(--slides-bg)); |
| 581 | } |
| 582 | [slides-block][data-block="code"] code { |
| 583 | font: inherit; |
| 584 | } |
| 585 | [slides-block] :not(pre) > code { |
| 586 | font-family: var(--slides-font-code); |
| 587 | font-size: 0.88em; |
| 588 | padding: 0.1em 0.3em; /* spacing-allow: inline code on a slide, in its own type's em */ |
| 589 | border-radius: 0.25em; |
| 590 | background-color: color-mix(in oklab, var(--slides-fg) 10%, var(--slides-bg)); |
| 591 | } |
| 592 | |
| 593 | [slides-block] mark { |
| 594 | background-color: color-mix(in oklab, var(--slides-accent) 26%, var(--slides-bg)); |
| 595 | color: inherit; |
| 596 | padding: 0 0.15em; /* spacing-allow: a highlight on a slide, in its own type's em */ |
| 597 | border-radius: 0.2em; |
| 598 | } |
| 599 | [slides-block] a { |
| 600 | color: var(--slides-accent); |
| 601 | /* Never colour alone (§8): a link is underlined as well. */ |
| 602 | text-decoration: underline; |
| 603 | text-underline-offset: 0.15em; |
| 604 | text-decoration-thickness: 0.07em; |
| 605 | } |
| 606 | |
| 607 | [slides-block][data-block="table"] { |
| 608 | inline-size: 100%; |
| 609 | font-size: var(--slides-body-s); |
| 610 | border-collapse: collapse; |
| 611 | } |
| 612 | [slides-block][data-block="table"] th, |
| 613 | [slides-block][data-block="table"] td { |
| 614 | text-align: start; |
| 615 | vertical-align: top; |
| 616 | padding: 0.45em 0.7em; /* spacing-allow: a slide table's cells, in its own type's em */ |
| 617 | border-block-end: 1px solid color-mix(in oklab, var(--slides-fg) 22%, var(--slides-bg)); |
| 618 | } |
| 619 | [slides-block][data-block="table"] th { |
| 620 | font-weight: 600; |
| 621 | border-block-end-color: var(--slides-accent); |
| 622 | } |
| 623 | |
| 624 | [slides-block][data-block="divider"] { |
| 625 | border: 0; |
| 626 | inline-size: 100%; |
| 627 | block-size: var(--slides-rule); |
| 628 | background-color: color-mix(in oklab, var(--slides-fg) 30%, var(--slides-bg)); |
| 629 | border-radius: var(--slides-rule); |
| 630 | } |
| 631 | |
| 632 | [slides-block][data-block="spacer"] { |
| 633 | block-size: var(--slides-gap); |
| 634 | flex: none; |
| 635 | } |
| 636 | [slides-block][data-block="spacer"][data-size="s"] { |
| 637 | block-size: calc(var(--slides-gap) / 2); |
| 638 | } |
| 639 | [slides-block][data-block="spacer"][data-size="l"] { |
| 640 | block-size: calc(var(--slides-gap) * 2); |
| 641 | } |
| 642 | |
| 643 | /* A follow-along code (render.go's qrBlock): the code for the box's |
| 644 | follow link in the slide's text colour on its background, the short |
| 645 | address under it in the body face, breaking anywhere because an |
| 646 | address has no spaces. In a region the code is the column's width up |
| 647 | to 30cqw; in a canvas box (below) it takes what the box leaves above |
| 648 | the address, kept square and centred by the SVG itself. |
| 649 | internal/slides/layout's planQR draws the same geometry (qrGapEm, |
| 650 | qrFlowCqw). */ |
| 651 | [slides-block][data-block="qr"] { |
| 652 | display: flex; |
| 653 | flex-direction: column; |
| 654 | align-items: center; |
| 655 | gap: 0.4em; /* spacing-allow: a code and its address, in the slide's own type's em */ |
| 656 | font-family: var(--slides-font-body); |
| 657 | font-size: var(--slides-body-s); |
| 658 | } |
| 659 | [slides-block][data-block="qr"] svg { |
| 660 | display: block; |
| 661 | inline-size: min(100%, 30cqw); |
| 662 | block-size: auto; |
| 663 | aspect-ratio: 1; |
| 664 | } |
| 665 | [slides-block][data-block="qr"] svg rect { |
| 666 | fill: var(--slides-bg); |
| 667 | } |
| 668 | [slides-block][data-block="qr"] svg path { |
| 669 | fill: currentColor; |
| 670 | } |
| 671 | [slides-block][data-block="qr"] figcaption { |
| 672 | max-inline-size: 100%; |
| 673 | text-align: center; |
| 674 | overflow-wrap: anywhere; |
| 675 | } |
| 676 | |
| 677 | [slides-block][data-block="shape"] { |
| 678 | inline-size: 100%; |
| 679 | block-size: auto; |
| 680 | min-block-size: 8cqw; |
| 681 | overflow: visible; |
| 682 | } |
| 683 | |
| 684 | /* ── Canvas ────────────────────────────────────────────────────────── |
| 685 | Blocks placed by hand (§2.3). The boxes are percentages of the frame, |
| 686 | so a canvas slide needs no breakpoint at all: it scales as a whole, |
| 687 | text included, because the type scale is in cqw. */ |
| 688 | |
| 689 | [slides-slide][data-layout="canvas"] { |
| 690 | display: block; |
| 691 | position: relative; |
| 692 | padding: 0; |
| 693 | overflow: hidden; |
| 694 | } |
| 695 | [slides-slide][data-layout="canvas"] > [slides-block] { |
| 696 | position: absolute; |
| 697 | display: flex; |
| 698 | flex-direction: column; |
| 699 | /* Top-aligned and never clipped: a box is where text STARTS, not a |
| 700 | viewport onto it. Centring plus overflow: hidden cut the first and |
| 701 | last lines of any block taller than its box (seen on the sample |
| 702 | deck's canvas heading, 2026-09-07) — the same WCAG 1.4.10 failure |
| 703 | the slide-level rule above refuses. Text that outgrows its box |
| 704 | runs past it; the person shrinks the type or grows the box. */ |
| 705 | justify-content: flex-start; |
| 706 | overflow: visible; |
| 707 | } |
| 708 | [slides-slide][data-layout="canvas"] > [data-block="shape"] { |
| 709 | display: block; |
| 710 | block-size: 100%; |
| 711 | min-block-size: 0; |
| 712 | overflow: hidden; |
| 713 | } |
| 714 | [slides-slide][data-layout="canvas"] > [data-block="image"] { |
| 715 | display: block; |
| 716 | overflow: hidden; |
| 717 | } |
| 718 | [slides-slide][data-layout="canvas"] > [data-block="clip"] { |
| 719 | overflow: hidden; |
| 720 | } |
| 721 | [slides-slide][data-layout="canvas"] > [data-block="scene"] { |
| 722 | display: grid; |
| 723 | aspect-ratio: auto; |
| 724 | overflow: hidden; |
| 725 | } |
| 726 | [slides-slide][data-layout="canvas"] > [data-block="qr"] svg { |
| 727 | flex: 1 1 0; |
| 728 | min-block-size: 0; |
| 729 | inline-size: 100%; |
| 730 | aspect-ratio: auto; |
| 731 | } |
| 732 | |
| 733 | /* ── The phone layer ───────────────────────────────────────────────── |
| 734 | Everything below is scoped to a narrow container, and it is last in |
| 735 | the file so a phone rule beats the desktop rule it ties with. */ |
| 736 | |
| 737 | @container slide (max-width: 600px) { |
| 738 | /* A rem floor under the scale: at 380px a slide's 2.8cqw body would |
| 739 | be 10px, and §8 takes 320px reflow with no exemptions. The floors |
| 740 | are set on the descendants rather than on the section, because a |
| 741 | container query styles a container's contents and never the |
| 742 | container itself. */ |
| 743 | [slides-frame], |
| 744 | [slides-region], |
| 745 | [slides-slide] > [slides-block] { |
| 746 | --slides-t-1: max(1.6rem, 9cqw); |
| 747 | --slides-t-2: max(1.35rem, 7cqw); |
| 748 | --slides-t-3: max(1.15rem, 5.6cqw); |
| 749 | --slides-body-l: max(1.1rem, 4.6cqw); |
| 750 | --slides-body-m: max(1rem, 4cqw); |
| 751 | --slides-body-s: max(0.9rem, 3.4cqw); |
| 752 | --slides-code: max(0.85rem, 3.2cqw); |
| 753 | --slides-gap: max(0.8rem, 4cqw); |
| 754 | } |
| 755 | |
| 756 | /* Every template collapses to one column, in document order. Both |
| 757 | halves matter: `grid-area: auto` alone is not enough, because a |
| 758 | template that still carries an explicit multi-column track (only |
| 759 | `two-column` does, at 1fr 1fr) auto-places its items into that |
| 760 | track instead of stacking them — the region rule below undoes the |
| 761 | named placement, this one undoes the columns underneath it. |
| 762 | |
| 763 | The region rule has to be `[slides-region][data-region]`, not |
| 764 | `[slides-region]`: the named placements above are (0,2,0), and a |
| 765 | (0,1,0) rule here lost to them however late it came, so every |
| 766 | region kept an area the collapsed grid no longer has and all of |
| 767 | them landed in one implicit cell — the heading drawn over the |
| 768 | body on every flow slide (polish audit B4). Equal specificity and |
| 769 | later in the file is what wins; the browser drive |
| 770 | TestBrowserPhoneStacksFlowRegions holds it. */ |
| 771 | [slides-slide][data-layout="flow"] > [slides-frame] { |
| 772 | grid-template-columns: 1fr; |
| 773 | grid-template-areas: none; |
| 774 | } |
| 775 | [slides-region][data-region] { |
| 776 | grid-area: auto; |
| 777 | } |
| 778 | |
| 779 | /* image-full stops overlaying: the heading goes under the picture, |
| 780 | where a phone-sized scrim would have been unreadable anyway. */ |
| 781 | [slides-slide][data-template="image-full"] [data-region="heading"] { |
| 782 | grid-area: auto; |
| 783 | max-inline-size: none; |
| 784 | margin: 0; |
| 785 | background: none; |
| 786 | backdrop-filter: none; |
| 787 | } |
| 788 | [slides-slide][data-template="image-full"] [data-block="image"] img { |
| 789 | block-size: auto; |
| 790 | object-fit: contain; |
| 791 | } |
| 792 | |
| 793 | [slides-slide][data-template="title"] [slides-region], |
| 794 | [slides-slide][data-template="quote"] [slides-region] { |
| 795 | max-inline-size: none; |
| 796 | } |
| 797 | |
| 798 | /* A columns block is columns no longer. */ |
| 799 | [slides-block][data-block="columns"] { |
| 800 | grid-template-columns: minmax(0, 1fr); |
| 801 | } |
| 802 | |
| 803 | /* §2.5, the phone layer. `hidden` and `size` are attributes the |
| 804 | selector can read; `order` and `box` are values, because CSS |
| 805 | cannot pull a number out of a data attribute — the renderer sends |
| 806 | those as custom properties on the same element. */ |
| 807 | [slides-block][data-phone-hidden] { |
| 808 | display: none; |
| 809 | } |
| 810 | [slides-block] { |
| 811 | order: var(--slides-phone-order, 0); |
| 812 | } |
| 813 | [slides-block][data-phone-size="s"] { |
| 814 | font-size: var(--slides-body-s); |
| 815 | } |
| 816 | [slides-block][data-phone-size="m"] { |
| 817 | font-size: var(--slides-body-m); |
| 818 | } |
| 819 | [slides-block][data-phone-size="l"] { |
| 820 | font-size: var(--slides-body-l); |
| 821 | } |
| 822 | [slides-slide][data-layout="canvas"] > [slides-block][data-phone-box] { |
| 823 | left: var(--slides-phone-left); |
| 824 | top: var(--slides-phone-top); |
| 825 | width: var(--slides-phone-width); |
| 826 | height: var(--slides-phone-height); |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | /* A flow slide rendered for a phone (§2.3's reflow, and every template |
| 831 | at a phone width) is as tall as what is on it. The 16:9 frame is a |
| 832 | projector's shape, not a page's, and keeping it here would mean |
| 833 | either a scrollbar per slide or words falling off the bottom. |
| 834 | |
| 835 | Two selectors for one rule, because there are two ways to arrive: |
| 836 | the renderer was told it was a phone, or a desktop render was opened |
| 837 | on one — which is every scriptless viewer, since a server rendering |
| 838 | HTML has no honest way to know the screen. */ |
| 839 | [slides-slide][data-vp="phone"]:not([data-layout="canvas"]) { |
| 840 | aspect-ratio: auto; |
| 841 | overflow: visible; |
| 842 | } |
| 843 | |
| 844 | @media (max-width: 600px) { |
| 845 | [slides-slide]:not([data-layout="canvas"]) { |
| 846 | aspect-ratio: auto; |
| 847 | overflow: visible; |
| 848 | } |
| 849 | } |
| 850 | |
| 851 | /* A slide drawn at a press (render.Options.Reveal). What has not yet |
| 852 | arrived is still laid out, so nothing moves when it does, but it is |
| 853 | neither seen, read out, nor reachable with Tab: visibility does all |
| 854 | three. */ |
| 855 | [data-waiting] { |
| 856 | visibility: hidden; |
| 857 | } |
| 858 | |
| 859 | /* The arriving effect. A script sets data-arriving on what a press has |
| 860 | just shown (the server never does) and takes it off when the effect |
| 861 | is done; the deck's setting is on the section as data-arrive. With |
| 862 | no setting, or with reduced motion asked for, a thing just appears. */ |
| 863 | @keyframes slides-arrive-fade { |
| 864 | from { opacity: 0; } |
| 865 | } |
| 866 | |
| 867 | @keyframes slides-arrive-rise { |
| 868 | from { opacity: 0; transform: translateY(0.6em); } |
| 869 | } |
| 870 | |
| 871 | @media (prefers-reduced-motion: no-preference) { |
| 872 | [data-arrive="fade"] [data-arriving] { |
| 873 | animation: slides-arrive-fade 300ms ease-out; |
| 874 | } |
| 875 | |
| 876 | [data-arrive="rise"] [data-arriving] { |
| 877 | animation: slides-arrive-rise 300ms ease-out; |
| 878 | } |
| 879 | } |
| 880 | |