/* ==========================================================================
   Applicazioni Informatiche del Machine Learning
   Shared slide theme — layered on top of reveal.js `white`
   ========================================================================== */

/* The vendored theme ships only 400 and 600 of Source Sans Pro, so every
   `font-weight: 700` below silently rendered at semibold — headings and <strong>
   came out identical and weight carried no hierarchy at all. Source Sans 3 is
   the metric-compatible successor with a real 200–900 axis. */
@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/SourceSans3-VF.woff2') format('woff2-variations');
  font-weight: 200 900; font-style: normal; font-display: block;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/SourceSans3-Italic-VF.woff2') format('woff2-variations');
  font-weight: 200 900; font-style: italic; font-display: block;
}
@font-face {
  font-family: 'Source Code Pro';
  src: url('../fonts/SourceCodePro-VF.woff2') format('woff2-variations');
  font-weight: 200 900; font-style: normal; font-display: block;
}

:root {
  --aiml-primary:  #0b3d62;   /* deep blue  — structure, headings          */
  --aiml-accent:   #c0392b;   /* brick red  — failures, warnings, "broken" */
  --aiml-success:  #14663a;   /* green      — fixes, "repaired"            */
  --aiml-math:     #6c3483;   /* purple     — mathematical thread          */
  --aiml-muted:    #6b7280;   /* grey       — chrome only: footer, number  */
  --aiml-muted-strong: #4b5563; /* secondary text a student must read      */
  --aiml-rule:     #b0bcc7;   /* hairlines that survive a projector        */
  --aiml-rule-faint: #d5dbe1; /* table cell rules only                     */
  --aiml-rule-strong: #8a97a3; /* 3.06:1 — anything that BOUNDS a box.     */
                              /* --aiml-rule is 1.93:1, which is right for */
                              /* a gridline and wrong for a border.        */
  --aiml-bg-soft:  #f4f7f9;   /* panel background                          */

  /* Six steps. Never write an inline font-size; if none fits, add a step
     here deliberately rather than inventing 1.12em on one slide. */
  --t-xs: 0.62em; --t-sm: 0.78em; --t-md: 1em; --t-lg: 1.18em;
  --t-h2: 1.62em; --t-h1: 2.10em; --t-num: 2.60em;

  /* Optical adjustments — sizes deliberately OFF the scale above, each
     because a particular typeface or context needs it. They are declared
     here, at the values already in use, for one reason: a size written as a
     bare number inside a rule is a size nobody can find. There were thirteen
     of those, against seven declared steps, so "what sizes does this deck
     use?" had no answer you could read anywhere.

     Adding to this block is not free. If a new element needs a size, take a
     step off the scale first; come here only when you can write the reason
     on the line, as these do. */
  --t-badge:         0.52em;  /* uppercase and letterspaced: reads larger  */
  --t-clock:         0.60em;  /* divider timing, beside a 0.62em kicker    */
  --t-meta:          0.68em;  /* title-slide metadata                      */
  --t-panel-title:   0.74em;
  --t-table:         0.80em;
  --t-takeaway:      0.86em;  /* figure captions, under a full-width plate */
  --t-code:          0.88em;  /* Source Code Pro runs small at a given em  */
  --t-nested:        0.90em;  /* second-level list items                   */
  --t-panel:         0.94em;
  --t-subtitle:      1.05em;
  --t-katex:         1.14em;  /* KaTeX runs small; optical match to prose  */
  --t-katex-display: 1.55em;

  /* Vertical rhythm in canvas pixels, so a .small paragraph is not spaced
     22% tighter than a body one purely because its own type is smaller. */
  --sp-1: 8px; --sp-2: 14px; --sp-3: 22px; --sp-4: 34px;

  --r-main-font: 'Source Sans 3', 'Source Sans Pro', Helvetica, sans-serif;
  --r-heading-font: var(--r-main-font);
  --r-code-font: 'Source Code Pro', 'SFMono-Regular', Consolas, monospace;
}

/* --- Layout anchor (pairs with center:false) ----------------------------- */
/* reveal centres both axes, so the h2 baseline swung 16px→241px across a deck.
   Flush left with a fixed top; only these four slide types stay centred. */
.reveal .slides > section { text-align: left; padding-top: 4px; }
.reveal .slides > section:not(.divider):not(.title-slide) { padding-bottom: 46px; }
.reveal .slides > section.title-slide,
.reveal .slides > section.divider,
.reveal .slides > section.figslide,
.reveal .slides > section.commit-slide {
  flex-direction: column; justify-content: center;
  height: 100%; text-align: center;
}
/* height:100% plus the padding above would otherwise make these 770px tall in
   a 720px canvas. */
.reveal .slides > section { box-sizing: border-box; }
/* reveal sets `display: block` INLINE on the present slide, which beats a
   stylesheet rule — so `display: flex` above never applied and these slides
   sat jammed at the top with the space below them empty. Scoping to .present
   is what makes !important safe: every other slide keeps reveal's inline
   `display: none` and stays hidden. */
.reveal .slides > section.present.title-slide,
.reveal .slides > section.present.divider,
.reveal .slides > section.present.figslide,
.reveal .slides > section.present.commit-slide { display: flex !important; }
/* A figure slide is a content slide, not a title card. It shares the flex rule
   above with the title slide and the divider, where centring is right — but it
   inherited their text-align, so 228 headings sat at 167 different x positions
   while the 3px rule beneath them still ran full-bleed, leaving each title
   floating detached inside its own rule. The figure itself stays centred by the
   margin:auto on the next line. */
.reveal .slides > section.figslide { justify-content: flex-start; text-align: left; }
.reveal .slides > section.figslide > figure { margin: auto; }

/* --- Base typography ---------------------------------------------------- */

.reveal {
  /* 30px, and it was tried at 32. A typography pass re-laid-out all 2,003
     slides at 30/32/34/36: the median fills 62% of the usable canvas at 30px
     and 67% at 32px, for a measured cost of two overflowing slides. Tried it.
     The real cost was higher, because the same review also asked for six
     over-wide equations to be split, and splitting converts a width problem
     into a height one — after which 32px left two maths-thread slides over the
     canvas that could only be brought back by cutting a proof, or by a
     per-slide font override, which section 11.1 forbids and which the decks
     currently have zero of. Cutting maths to gain 2px of body text is the wrong
     trade. The legibility win came from the diagrams instead (11.7a): 37 of 40
     went from 16px to 19px by being presented at the canvas width, which cost
     nothing and is worth more than two points of body size. */
  /* The one absolute size in the deck: every em above is relative to this,
     so the scale has exactly one root. Not a scale step. */
  font-size: 30px;
  color: #16212b;
}

.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4 {
  text-transform: none;      /* the `white` theme uppercases; undo it */
  letter-spacing: -0.01em;
  color: var(--aiml-primary);
  font-weight: 700;
  line-height: 1.15;
}

.reveal h1 { font-size: var(--t-h1); line-height: 1.10; }
.reveal h2 { font-size: var(--t-h2); line-height: 1.12; margin-bottom: var(--sp-3); }
.reveal h3 { font-size: var(--t-lg); font-weight: 600; color: var(--aiml-primary); }
/* an eyebrow, not a shrunken heading — it used to be smaller than its own body */
.reveal h4 { font-size: var(--t-sm); font-weight: 600; color: var(--aiml-muted-strong);
             letter-spacing: 0.06em; text-transform: uppercase; }

.reveal p        { line-height: 1.35; }
.reveal em       { color: var(--aiml-primary); font-style: italic; }
.reveal strong   { color: var(--aiml-primary); font-weight: 600; }
.reveal a        { color: var(--aiml-primary); text-decoration: underline;
                   text-underline-offset: 3px; }
.reveal a:hover  { color: var(--aiml-accent); }

.reveal ul,
.reveal ol { display: block; margin-left: 1.1em; }
.reveal li { margin-bottom: var(--sp-1); line-height: 1.3; }
.reveal p  { margin: 0 0 var(--sp-2); }
.reveal ul ul,
.reveal ol ol { font-size: var(--t-nested); margin-top: 0.35em; color: #33414d; }

.reveal section > * { max-width: 100%; }

/* --- Slide titles get a hairline rule ----------------------------------- */

.reveal section > h2:first-child {
  border-bottom: 3px solid var(--aiml-primary);
  padding-bottom: 0.22em;
  margin-bottom: var(--sp-3);
}

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

.reveal .title-slide h1 {
  color: var(--aiml-primary);
  border: none;
  margin-bottom: 0.15em;
}
.reveal .title-slide .subtitle {
  font-size: var(--t-subtitle);
  color: var(--aiml-muted);
  margin-bottom: 1.3em;
}
.reveal .title-slide .meta {
  font-size: var(--t-meta);
  color: var(--aiml-muted);
  line-height: 1.7;
  border-top: 1px solid var(--aiml-rule);
  padding-top: 0.9em;
  display: inline-block;
}

/* --- Section dividers --------------------------------------------------- */

.reveal .divider {
  background: var(--aiml-primary);
}
.reveal .divider h1,
.reveal .divider h2,
.reveal .divider h3,
.reveal .divider p {
  color: #ffffff;
  border: none;
}
.reveal .divider .kicker {
  font-size: var(--t-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #9fc4dd;
  margin-bottom: 0.6em;
}
.reveal .divider .clock {
  font-size: var(--t-clock);
  color: #9fc4dd;
  margin-top: 1.2em;
}

/* --- Lecture-type badges ------------------------------------------------ */

.badge {
  display: inline-block;
  font-size: var(--t-badge);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.28em 0.85em;
  border-radius: 3px;
  vertical-align: middle;
}
.badge-build { background: var(--aiml-primary); color: #fff; }
.badge-fix   { background: var(--aiml-success); color: #fff; }
.badge-math  { background: var(--aiml-math);    color: #fff; }
.badge-ch    { background: var(--aiml-bg-soft); color: var(--aiml-muted-strong);
               border: 1px solid var(--aiml-rule); }
.badge-fail  { background: var(--aiml-accent);  color: #fff; }

/* --- Callout panels ----------------------------------------------------- */

.panel {
  border-left: 5px solid var(--aiml-primary);
  background: var(--aiml-bg-soft);
  padding: 0.75em 1.05em;
  margin: var(--sp-3) 0;
  text-align: left;
  font-size: var(--t-panel);   /* never below the body it interrupts */
  border-radius: 0 4px 4px 0;
}
/* grey-on-tint failed AA in all four variants (4.32–4.49:1) at 19px uppercase
   and letter-spaced — the three conditions that make text hardest to read. The
   label is doing semantic work anyway, so give it the panel's own colour. */
.panel .panel-title {
  display: block;
  font-size: var(--t-panel-title);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--aiml-muted-strong);
  margin-bottom: 0.35em;
}
.panel-fail .panel-title { color: var(--aiml-accent); }
.panel-fix  .panel-title { color: var(--aiml-success); }
.panel-math .panel-title { color: var(--aiml-math); }
.panel-fail    { border-left-color: var(--aiml-accent);
                 background: #fdf1ef; }
.panel-fix     { border-left-color: var(--aiml-success);
                 background: #eff8f2; }
.panel-math    { border-left-color: var(--aiml-math);
                 background: #f6f0f9; }
.panel-book    { border-left-color: var(--aiml-muted);
                 background: #f7f8f9; font-style: italic; }

/* --- The "commit your number" slide ------------------------------------- */

.commit {
  border: 3px dashed var(--aiml-accent);
  background: #fffdf7;
  padding: 1.1em 1.4em;
  border-radius: 6px;
  margin: 0.8em auto;
  max-width: 88%;
}
.commit .commit-label {
  font-size: var(--t-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--aiml-accent);
  font-weight: 700;
  display: block;
  margin-bottom: 0.5em;
}
.commit .blank {
  display: inline-block;
  border-bottom: 2px solid var(--aiml-primary);
  min-width: 4.5em;
  margin: 0 0.25em;
}

/* --- Colab links -------------------------------------------------------- */

.colab-btn {
  display: inline-block;
  background: #f9ab00;
  color: #16212b !important;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.5em 1.1em;
  border-radius: 4px;
  text-decoration: none !important;
  margin: 0.25em;
  border: 2px solid #d99400;
}
.colab-btn:hover { background: #ffc32b; color: #000 !important; }

/* --- Animation links -----------------------------------------------------
   A slide whose idea has an interactive version on the lecture's animation
   page (animations/lecture-NN.html) carries this pill in its top-right
   corner. Positioned, not flowed, so adding one can never push a slide past
   the canvas; quiet, so it does not compete with the slide's own content.
   Absent from the printed deck: a link on paper is a dead end. */
.reveal .slides section > a.anim-link {
  position: absolute;
  top: 0; right: 0;
  font-size: var(--t-badge);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--aiml-math) !important;
  background: #f6f0f9;
  border: 1px solid var(--aiml-math);
  border-radius: 999px;
  padding: 0.3em 0.95em 0.3em 0.8em;
  text-decoration: none !important;
  line-height: 1.3;
  z-index: 5;
}
.reveal .slides section > a.anim-link::before { content: "\25B6\00A0\00A0"; }
.reveal .slides section > a.anim-link:hover { background: var(--aiml-math); color: #fff !important; }
@media print { .reveal .slides section > a.anim-link { display: none; } }
html.reveal-print .reveal .slides section > a.anim-link { display: none; }

.nb-index {
  font-size: var(--t-badge);
  text-align: left;
  column-count: 2;
  column-gap: 2.2em;
  line-height: 1.55;
}
.nb-index a { text-decoration: none; }
.nb-index .done { color: var(--aiml-primary); font-weight: 600; }
.nb-index .todo { color: var(--aiml-muted); }

/* --- Tables ------------------------------------------------------------- */

/* NOTE: reveal.js renders line-numbered code blocks as <table class="hljs-ln">,
   and that table's parent is the <code> element — so a `:not(pre) >` guard does
   NOT exclude it. Exclude it by its own class instead, or the content-table
   styling below stripes the source code. */

.reveal table:not(.hljs-ln) {
  font-size: var(--t-table);
  border-collapse: collapse;
  margin: 0.5em auto;
}
.reveal table:not(.hljs-ln) th {
  background: var(--aiml-primary);
  color: #fff;
  font-weight: 600;
  border: none;
  padding: 0.42em 0.75em;
  text-align: left;
}
.reveal table:not(.hljs-ln) td {
  border-bottom: 1px solid var(--aiml-rule-faint);
  padding: 0.38em 0.75em;
}
/* #fafbfc is 1.02:1 against white — not perceptible at any distance */
.reveal table:not(.hljs-ln) tr:nth-child(even) td { background: #eef2f6; }
/* a right-aligned money column needs its header over the digits */
.reveal table:not(.hljs-ln) th.num { text-align: right; }

/* The code table: no inherited chrome, and one uniform gutter.
   Keep these selectors free of :nth-child — an even-row rule outranks a plain
   `td` rule and would apply the gutter padding to alternate lines only, which
   makes every other line of source code sit a few pixels out of alignment. */
.reveal table.hljs-ln,
.reveal table.hljs-ln tr,
.reveal table.hljs-ln td {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  margin: 0;
}
.reveal table.hljs-ln td.hljs-ln-numbers { padding-right: 1.1em; }
.reveal table.hljs-ln td.hljs-ln-code    { padding-left: 0.2em; }
.reveal table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.reveal table .hit  { color: var(--aiml-success); font-weight: 700; }
.reveal table .miss { color: var(--aiml-accent);  font-weight: 700; }

/* Monokai's comment grey is 3.03:1 on its own background and its keyword pink
   3.93:1 — both under AA, on 313 slides. Comments here are not decoration: they
   carry the measured output, the pointer to the planted defect, the wall clock.
   The least legible text on the slide was the text the slide is about. */
.reveal pre code .hljs-comment,
.reveal pre code .hljs-quote { color: #9d987f; }        /* 4.62:1 */
.reveal pre code .hljs-keyword,
.reveal pre code .hljs-selector-tag { color: #ff79b8; } /* 4.52:1 */

/* --- Code --------------------------------------------------------------- */

/* was 0.46em = 13.8px = 1.9% of canvas height, about half the legibility floor
   for a hall — in a course whose central claim is "read the code before you run
   it". 0.62em = 18.6px; measured, the longest line in either deck is 921px
   against ~1103px usable. width:fit-content stops a 22-character snippet being
   painted as a 1237px slab. */
.reveal pre {
  width: fit-content;
  max-width: 96%;
  /* Left-aligned, not centred. `width: fit-content` plus `auto` margins
     re-centres every block on its own longest line, so 313 code slides had
     76 different left edges spanning 377px and not one of them lined up
     with the heading above it. Section 11.3 kills that on the vertical
     axis; this is the same defect lying down. */
  margin: var(--sp-3) 0;
  font-size: var(--t-xs);
  line-height: 1.42;
  box-shadow: none;
  border: 1px solid var(--aiml-rule);
  border-radius: 4px;
}
.reveal pre code {
  padding: 0.9em 1.1em;
  max-height: 520px;
  border-radius: 4px;
}
.reveal code:not(pre code) {
  background: var(--aiml-bg-soft);
  border: 1px solid var(--aiml-rule-faint);
  white-space: nowrap;   /* or the chip breaks and leaves two half-boxes */
  border-radius: 3px;
  padding: 0.06em 0.32em;
  font-size: var(--t-code);
  /* was #9c2f2f — a third red in a deck where red means "broken", so ten
     identifiers in a row read as a warning stripe. The chip carries it. */
  color: var(--aiml-primary);
}

/* --- Mathematics -------------------------------------------------------- */

/* KaTeX_Main has a smaller x-height than Source Sans 3, so 1.05em read ~7%
   *smaller* than the prose around it. 1.14em is the optical match. */
.reveal .katex { font-size: var(--t-katex); }
.reveal .katex-display > .katex { font-size: var(--t-katex-display); }
.reveal .katex-display { margin: var(--sp-2) 0; padding: 0; }
/* was white-on-white with a 1.4:1 hairline — a rectangle of nothing on a
   projector. A top rule in the thread's own purple instead. */
.eqn-box {
  background: var(--aiml-bg-soft);
  border: none;
  border-top: 3px solid var(--aiml-math);
  border-radius: 0 0 5px 5px;
  padding: 0.7em 1.4em;
  margin: var(--sp-2) auto;
  display: inline-block;
}

/* An equation standing directly above a figure, where the figure is the point
   and the equation is its caption. Same box, less air: a full-height eqn-box
   plus a diagram overruns the canvas on any slide that carries both. */
.eqn-box.compact { padding: 0.45em 1.4em; margin: var(--sp-1) auto; }
/* From Lecture 12 on (decided 2026-11-23) a display equation stands in the
   middle of the slide, or of its column. inline-block on a left-aligned slide
   ignores auto margins and sat every box against the left edge; a table
   shrink-wraps the same way and does honour them. Decks opt in with
   <div class="reveal eqn-centre">. */
.reveal.eqn-centre .eqn-box { display: table; margin-left: auto; margin-right: auto; }
.eqn-label {
  font-size: var(--t-xs);
  color: var(--aiml-math);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-top: 0.35em;
}
.derive-step {
  font-size: var(--t-sm);
  color: var(--aiml-muted-strong);
  margin-top: 0.45em;
}

/* --- Two-column layout -------------------------------------------------- */

.cols {
  display: flex;
  gap: 1.6em;
  align-items: flex-start;
  text-align: left;
}
.cols > div { flex: 1; min-width: 0; }
.cols-40-60 > div:first-child { flex: 0 0 38%; }
.cols-60-40 > div:last-child  { flex: 0 0 38%; }

/* Six styled things were declared and never used — figcaption, .cite, .left,
   .center, and a `.reveal figure img` rule with a border and a 460px cap that
   could never apply because all 229 images sit inside figure.fig, which sets
   border:none. A vocabulary with unused words in it is a vocabulary nobody can
   trust; if one of these is wanted later, it can come back with a user.       */

/* --- Figures ------------------------------------------------------------ */

.reveal figure { margin: var(--sp-2) auto; }



/* Figure slides. `.fig` is the default; the modifiers trade height for width
   depending on the aspect ratio of the plot or diagram. */
.reveal figure.fig { margin: 0.15em auto; }
.reveal figure.fig img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 500px;
  width: auto;
  height: auto;
  border: none;
}
/* Wide, short diagrams — let them use the full slide width. */
/* `width: 100%` alongside `max-height` sets the two axes independently, so the
   browser squashes the image into a fixed 1280x420 box regardless of its own
   proportions — every .fig-wide figure was rendering at exactly 420/1280, which
   stretched them horizontally by 10-48%. l2-grid is a heatmap whose square
   cells were drawn half again as wide as tall, and the letterforms in those
   figures were wider than the same Source Sans 3 on the slide beside them.
   max-width lets the aspect ratio survive.
   Consequence for authors: to fill the full width, author at aspect <= 0.328. */
.reveal figure.fig-wide img  { width: auto; height: auto;
                               max-width: 100%; max-height: 520px; }
/* Tall plots (square scatters, the histogram grid). */
.reveal figure.fig-tall img  { max-height: 528px; }
/* A figure sharing a slide with body text. */
.reveal figure.fig-inset img { max-height: 330px; }
/* A figure inside a .cols column. */
.reveal .cols figure.fig img { max-height: 340px; }

/* A figure slide usually needs its heading to take less room. */
.reveal section.figslide > h2:first-child {
  font-size: var(--t-h2);
  margin-bottom: 0.35em;
  padding-bottom: 0.2em;
}
/* defined at top level: it is used on non-figure slides too, and there it was
   silently unstyled. */
.takeaway {
  font-size: var(--t-sm);
  color: var(--aiml-muted-strong);
  margin-top: var(--sp-2);
}
.reveal section.figslide .takeaway { font-size: var(--t-takeaway); }

/* Lecture 1 opens with fifty-one applications, one illustration each, told as
   one day: the time of day sits in front of the heading. The plate is held
   shorter than a .fig so a two-line caption still clears the footer. */
.reveal figure.fig-app img { max-height: 440px; border-radius: 14px; }
.reveal .app-time { color: var(--aiml-accent); font-weight: 600;
                    font-variant-numeric: tabular-nums; margin-right: 0.3em; }
.reveal section.app-slide .takeaway { max-width: 1060px; margin-left: auto;
                                      margin-right: auto; text-align: center; }


/* --- Persistent footer -------------------------------------------------- */

/* The theme sets the typeface on .reveal, and the footer deliberately sits
   OUTSIDE .reveal so it can survive slide changes — so it inherited from body,
   which no rule had ever touched, and rendered in the browser's default serif on
   every slide of all 24 decks. Times, under a Source Sans 3 heading, for the one
   piece of text that is on screen the whole lecture. Nothing caught it: it is
   not an overflow, not a contrast failure, not a missing asset. Someone has to
   look. Set it on body so anything else placed outside .reveal inherits
   correctly too. */
body {
  font-family: 'Source Sans 3', 'Source Sans Pro', Helvetica, sans-serif;
}

.deck-footer {
  position: fixed;
  bottom: 14px;
  left: 22px;
  /* Chrome, not content: the footer sits outside .reveal and must not scale
     with the slide's type. Absolute by intent, like the 30px root. */
  font-size: 15px;
  color: var(--aiml-muted);
  z-index: 30;
  pointer-events: none;
  letter-spacing: 0.02em;
}
.deck-footer .sep { opacity: 0.45; margin: 0 0.55em; }

/* reveal styles .slide-number itself, in its own stack. */
.reveal .slide-number,
.reveal .slide-number a {
  font-family: 'Source Sans 3', 'Source Sans Pro', Helvetica, sans-serif;
}

/* Hidden on divider and title slides — toggled from JS on slidechanged,
   because .deck-footer sits outside .reveal and cannot be matched by a
   sibling selector against the current slide. */
.deck-footer.is-hidden { display: none; }

/* --- Print / PDF handout ------------------------------------------------ */

@media print {
  .deck-footer { display: none; }
  .reveal pre code { max-height: none; }
}

/* --- Small utilities ---------------------------------------------------- */

.muted     { color: var(--aiml-muted-strong); }

/* `<aside class="note">` -- three of them, against 109 `<aside class="notes">`.
   The plural is reveal's own: presenter cues, hidden from the slide and shown
   in the speaker view. The singular matched no rule in any stylesheet, so its
   text rendered as full-size body prose, indistinguishable from the argument
   above it.

   The obvious repair is to call the typo a typo and add the 's'. That is the
   wrong repair: read the three and they are not presenter cues. They are
   teaching -- "getting these the same way round is a common and silent error"
   -- and the plural would have hidden them from the room. So the class gets
   the style it never had, one step quieter than body text, and the content
   stays where a student can read it. */
.reveal aside.note {
  display: block;
  font-size: var(--t-sm);
  color: var(--aiml-muted-strong);
  border-left: 2px solid var(--aiml-rule-faint);
  padding-left: 0.7em;
  margin: var(--sp-2) 0 0;
}
.fail      { color: var(--aiml-accent);  font-weight: 700; }
.fix       { color: var(--aiml-success); font-weight: 700; }
.big-num   { font-size: var(--t-num); font-weight: 700; color: var(--aiml-primary);
             font-variant-numeric: tabular-nums; line-height: 1.1; }
.big-num.bad  { color: var(--aiml-accent); }
.big-num.good { color: var(--aiml-success); }
.left      { text-align: left; }
.center    { text-align: center; }
.small     { font-size: var(--t-sm); }
.smaller   { font-size: var(--t-xs); }
.lead      { font-size: var(--t-lg); line-height: 1.32; }
.tight li  { margin-bottom: 0.22em; }

/* Currency in prose. The span is not decoration: a bare "$" pairs with the next
   "$" in the same text node and KaTeX renders the pair as maths, eating the
   spaces and the dollar signs. Wrapping each amount breaks the text node so no
   pairing is possible — and keeps the amount from wrapping mid-number. */
.usd { white-space: nowrap; }

/* --- Stepped code highlighting ------------------------------------------ */

/* reveal dims non-highlighted lines to opacity .4, which against monokai's
   #272822 lands at roughly 2:1 — the lines you are deliberately drawing
   attention *away* from become unreadable rather than secondary. On the nine
   slides that step through code, those lines still carry the context that makes
   the highlighted one mean anything. */
.reveal .hljs.has-highlights tr:not(.highlight-line) { opacity: 0.62; }
.reveal .hljs.has-highlights .highlight-line { background: rgba(255,255,255,0.07); }

/* ------------------------------------------------------------------------- */
/* Redundant cues for the failure/repair pair.                                */
/*                                                                            */
/* --aiml-accent and --aiml-success are 90.5 apart in normal vision and 12.6  */
/* apart under protanopia. .fail/.fix, .hit/.miss and .big-num carry their    */
/* meaning in colour ALONE — same weight, same size, same shape — across      */
/* 500-odd instances. A mark costs nothing and works in any vision.           */
.reveal .fail::before { content: "\2717\00a0"; }
/* On a list item that cross IS the marker, so the native bullet has to go --
   otherwise the row reads "• ✗ text". (0,2,1) beats `.reveal ul` at (0,1,1). */
.reveal li.fail { list-style: none; }
.reveal .fix::before  { content: "\2713\00a0"; }
.reveal table td.miss::after { content: "\00a0\2717"; }
.reveal table td.hit::after  { content: "\00a0\2713"; }
/* the panels already name themselves in their title, so they are exempt */
.reveal .panel .fail::before,
.reveal .panel .fix::before { content: none; }
/* KaTeX's \rlap and \llap (and so \not, \ne) emit a <span class="fix">
   of their own; without this, every such symbol wore a green tick
   (seen on the silhouette slide of Lecture 6, 2026-10-21). */
.reveal .katex .fix::before,
.reveal .katex .fail::before { content: none; }

/* 9. The commit slide is the course's central ritual and was set four         */
/* different ways — three inline line-heights plus one that was centred.       */
.reveal .commit p {
  text-align: left;
  line-height: 1.85;
  font-size: var(--t-sm);
}

/* 21. The "Next" divider's closing line was hardcoded #cfe2f0 inline, once in */
/* every deck: a third light blue beside the divider's white and #9fc4dd.      */
.reveal .divider .small { color: #9fc4dd; }

/* The Colab button's own breathing room. It was an inline margin on 18 slides,
   which is 18 chances to type a different number. */
.reveal .colab-line { margin: 1.2em 0; }

/* A .lead used as a title-slide standfirst sits tighter than a .lead in prose. */
.reveal .title-slide .lead { line-height: 1.4; margin-top: 0.8em; }

/* Two-line comparison notes inside a panel. */
.reveal .panel p.tight { margin: 0.3em 0; }

/* ==========================================================================
   Theme refresh — the redesign of 2026-09
   --------------------------------------------------------------------------
   The course dropped its Build / Break-to-Fix pairing, so the badges that
   named it (.badge-build, .badge-fix, .badge-fail) and the .commit block are
   deprecated. They stay defined only until the last deck is converted; do not
   use them in a new deck. What replaces them is below.
   ========================================================================== */

/* --- Badges ------------------------------------------------------------- */
/* A deck's title slide carries the lecture number and the chapter, nothing
   else. The number is the identity; the chapter is context, so it stays in
   the outlined .badge-ch it already had. */
.badge-lec   { background: var(--aiml-primary); color: #fff; }

/* Lectures 19–22 sit outside the primary text. Marked once on the title
   slide, so a student always knows which surface they are on. */
.badge-notes { background: var(--aiml-math); color: #fff; }

/* --- Marking scope (AUTHORING.md §6) ------------------------------------ */
/* Every section declares one. A student must never have to guess whether
   something is examinable, and "I assumed it wasn't" must never be available
   as an excuse. Set flush right, so it reads as an annotation on the heading
   rather than as content. */
.scope {
  float: right;
  font-size: var(--t-badge);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2em 0.7em;
  border-radius: 3px;
  margin-top: 0.5em;
}
.scope-exam    { background: var(--aiml-bg-soft); color: var(--aiml-primary);
                 border: 1px solid var(--aiml-rule-strong); }
.scope-eng     { background: transparent; color: var(--aiml-muted-strong);
                 border: 1px dashed var(--aiml-rule-strong); }
.scope-context { background: transparent; color: var(--aiml-math);
                 border: 1px dashed var(--aiml-math); }

/* --- Derivations -------------------------------------------------------- */
/* Now the centrepiece of every lecture rather than a device on half of them:
   eighteen of them, 40% of the written paper. A derivation is a numbered
   sequence in which each step earns its own line, with the reason for the step
   set beside it rather than under it — the reason is what is examinable, and a
   reason set as a footnote reads as optional. */
/* `.reveal .derivation`, not `.derivation`. reveal's white theme carries
   `.reveal ol { list-style-type: decimal }` and this file carries
   `.reveal ol { margin-left: 1.1em }` -- both (0,1,1), both of which beat a
   bare `.derivation` at (0,1,0). The class therefore lost BOTH declarations
   below: every derivation in the course rendered the theme's decimal marker
   AND the counter badge -- "1. 1", "2. 2" -- and sat 1.1em further right than
   the prose above it. Eighteen derivations, the centrepiece of the lectures
   and 40% of the written paper, on seven decks. Specificity, not the
   cascade. */
.reveal .derivation {
  list-style: none;
  counter-reset: dstep;
  padding-left: 0;
  margin: var(--sp-3) 0;
}
/* The number sits in a gutter and the step flows beside it. This was a
   two-column grid until the first shipped derivation hit the trap: a grid
   makes EVERY child a grid item, so a step written as the obvious
   `<li>math <span class="why">reason</span></li>` put .why in a third column,
   wrapping it into the 2.1em number gutter and taking the slide to 1519px in a
   720px canvas. Nothing warned; the deck simply scaled down to illegible.

   Float-in-gutter instead. It has no notion of "how many children", so a step
   may hold any markup — bare text, a .why, several paragraphs, a display
   equation — and still line up. Authors should not have to know a layout rule
   to write a list item. */
.derivation > li {
  counter-increment: dstep;
  position: relative;
  padding: 0.42em 0 0.42em 2.6em;
  border-bottom: 1px solid var(--aiml-rule-faint);
}
.derivation > li:last-child { border-bottom: none; }
.derivation > li::before {
  content: counter(dstep);
  position: absolute;
  left: 0;
  width: 2.1em;
  text-align: right;
  font-family: var(--r-code-font);
  font-size: var(--t-sm);
  font-weight: 700;
  color: var(--aiml-math);
}
/* The justification for the step, not a second thought about it. */
.derivation .why {
  display: block;
  font-size: var(--t-sm);
  color: var(--aiml-muted-strong);
  margin-top: 0.15em;
}
/* The last line of a derivation is the result. It gets the weight, because in
   six months it is the only line anyone remembers. */
.derivation > li.result { border-bottom: none; padding-top: 0.6em; }
.derivation > li.result::before { color: var(--aiml-primary); }

/* --- Failure conditions (AUTHORING.md §3.3) ----------------------------- */
/* Where the old course planted a defect and sprang it, the new one states the
   condition under which the method fails. Same red as the old .panel-fail,
   because it means the same thing — but it is now a property of the method,
   so it is titled as one. */
.panel-when { border-left-color: var(--aiml-accent); background: #fdf1ef; }
.panel-when .panel-title { color: var(--aiml-accent); }

/* --- The notebook slide (AUTHORING.md §3.4) ----------------------------- */
/* Last slide of every deck, and the only one a student will come back to
   after the lecture. It is centred like a divider, because it is a
   destination rather than a point in an argument. */
.reveal .slides > section.notebook-slide { text-align: left; }
.notebook-slide .colab-line { text-align: center; }

/* --- Part V: retrieval ---------------------------------------------------
   A relevance pattern down a ranked list, the tokeniser's output, and the
   three stages of a search system. All three are read as a row, so they are
   flex rows with the cell sizes fixed in canvas pixels rather than ems: a
   ten-cell strip must not reflow when the font falls back. */
.reveal .rank-strip   { margin: 14px auto; width: max-content; }
.reveal .rank-row,
.reveal .rank-nums    { display: flex; gap: 6px; justify-content: center; }
.reveal .rank-row > span {
  /* 44px square, so the glyph is sized to the cell rather than to the type
     scale: this is a diagram element whose size is set by the strip. */
  width: 44px; height: 44px; line-height: 44px; text-align: center;
  border-radius: 5px; font-size: var(--t-lg);
}
.reveal .hit-cell     { background: var(--aiml-primary); color: #fff; }
.reveal .miss-cell    { background: var(--aiml-bg-soft);
                        color: var(--aiml-muted-strong); }
.reveal .rank-nums > span {
  width: 44px; text-align: center; font-size: var(--t-xs);
  color: var(--aiml-muted-strong); margin-top: 4px;
}
.reveal .tok-row      { display: flex; flex-wrap: wrap; gap: 8px;
                        justify-content: center; }
.reveal .tok {
  padding: 4px 12px; border-radius: 4px; background: var(--aiml-bg-soft);
  border: 1px solid var(--aiml-rule); font-family: var(--r-code-font);
  font-size: var(--t-sm);
}
.reveal .pipeline     { display: flex; gap: 12px; margin: 18px 0; }
.reveal .stage {
  flex: 1; padding: 14px; border-radius: 6px; background: var(--aiml-bg-soft);
  border-left: 4px solid var(--aiml-primary);
}
.reveal .stage .small { display: block; color: var(--aiml-muted-strong);
                        margin-top: 6px; }
.reveal .stage-n {
  display: inline-block; width: 26px; height: 26px; line-height: 26px;
  text-align: center; border-radius: 50%; background: var(--aiml-primary);
  color: #fff; font-size: var(--t-xs); margin-right: 8px;
}
.reveal blockquote {
  display: block; width: auto; margin: 12px 0; padding: 10px 16px;
  background: var(--aiml-bg-soft); border-left: 4px solid var(--aiml-rule);
  box-shadow: none; font-style: normal; text-align: left;
}

/* ------------------------------------------------------------------ *
 * Exam-style exercises, and the solutions that appear one lecture later.
 *
 * These are NOT presented. They sit at the end of every deck for a student
 * reading it afterwards, which is why they are quieter than the lecture
 * itself: no colour that competes with the failure red or the derivation
 * purple, and a number in the margin so a solution can name its question.
 * ------------------------------------------------------------------ */
/* A <ul>, not an <ol>: reveal.js styles ordered lists with its own
   decimal marker, which would print beside the counter badge and give
   every question two numbers ("1. [1] A colleague reports…"). */
.reveal .ex-list { counter-reset: ex; list-style: none; margin: 0; padding: 0; }
.reveal .ex-list > li {
  counter-increment: ex;
  position: relative;
  padding-left: 2.2em;
  margin-bottom: 0.75em;
  font-size: var(--t-sm);
  line-height: 1.45;
}
.reveal .ex-list > li::before {
  content: counter(ex);
  position: absolute;
  left: 0; top: 0.05em;
  min-width: 1.5em;
  text-align: center;
  font-weight: 700;
  color: var(--aiml-primary);
  border: 1px solid var(--aiml-rule-strong);
  border-radius: 3px;
  padding: 0 0.25em;
}
/* A solution list continues the numbering of the exercise list it answers,
   so `start` on the <ol> is not enough -- the counter is set per slide. */
.reveal .ex-list.sol > li::before {
  color: #fff;
  background: var(--aiml-success);
  border-color: var(--aiml-success);
}
.ex-marks {
  color: var(--aiml-muted);
  font-weight: 600;
  white-space: nowrap;
}
.ex-note { color: var(--aiml-muted-strong); font-size: var(--t-sm); }

/* --- One run's numbers ----------------------------------------------------- */
/* Every slide quoting a measured number ends with this line, written by
   tools/annotate_