/* El árbol de accesibilidad frágil: deck styles.
   Without JavaScript the page is a document; html.js switches to slides. */

:root {
  /* Light and dark palettes in one place. color-scheme picks the side:
     "light dark" follows the system; the theme setting forces one. */
  color-scheme: light dark;
  --bg: light-dark(#fbfaf7, #121212);
  --surface: light-dark(#f1efe8, #1f1f1f);
  --text: light-dark(#1b1b1b, #ececec);
  --muted: light-dark(#4a4a4a, #b8b8b8);
  --accent: light-dark(#0a58ca, #8ab4f8);
  --bad: light-dark(#b3261e, #f2b8b5);
  --good: light-dark(#146c2e, #7dd99a);
  --border: light-dark(#c9c6bd, #4a4a4a);
  /* PerfReviews green. --brand as is for decorative lines; --brand-strong
     wherever a line, bar or text must reach 3:1 or 4.5:1 (#00843f on the
     light background is 4.6:1; #00aa58 on the dark one is 6.1:1). */
  --brand: #00aa58;
  --brand-strong: light-dark(#00843f, #00aa58);
  --on-brand: #121212;
  --focus: var(--brand-strong);
  --bar: var(--accent);
  --bar-bad: var(--bad);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --controls-height: 3.5rem;
  --notes-height: 34dvh;
}

:root[data-theme='light'] {
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.25rem;
  line-height: 1.5;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 6vw, 4.5rem);
}

h2 {
  font-size: clamp(1.75rem, 4vw, 3rem);
}

p,
li {
  text-wrap: pretty;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Document layout (default, and without JavaScript) ------------------- */

#deck {
  max-width: 60rem;
  margin-inline: auto;
  padding: 1.5rem;
}

.slide {
  padding-block: 2rem;
  border-block-end: 1px solid var(--border);
}

.subtitle {
  font-size: 1.4em;
  color: var(--muted);
  margin-block-start: 0;
}

.statement {
  font-size: 1.6em;
  font-weight: 600;
  line-height: 1.25;
}

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

.bad {
  color: var(--bad);
}

.good {
  color: var(--good);
}

.source {
  font-size: 0.8em;
  color: var(--muted);
}

blockquote {
  margin: 1rem 0;
  padding-inline-start: 1rem;
  border-inline-start: 4px solid var(--brand);
  font-size: 1.15em;
}

/* Code wraps instead of scrolling, so it never needs a scroll container. */
pre {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.7em;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

code {
  font-family: var(--mono);
}

kbd {
  font-family: var(--mono);
  padding: 0.05em 0.4em;
  border: 1px solid var(--border);
  border-radius: 0.3em;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}

caption {
  text-align: start;
  font-weight: 600;
  padding-block-end: 0.5rem;
}

th,
td {
  padding: 0.35rem 0.6rem;
  border-block-end: 1px solid var(--border);
  text-align: start;
}

td.num,
th.num {
  text-align: end;
}

figure {
  margin: 1rem 0;
}

figcaption {
  font-size: 0.85em;
  color: var(--muted);
}

img {
  max-width: 100%;
  height: auto;
}

/* Thin DevTools track captures, each with a text label above it. */
.trace-strips img {
  display: block;
  border: 1px solid var(--border);
}

.trace-strips figcaption {
  margin-block-start: 0.5rem;
}

.trace-label {
  margin: 0.5rem 0 0.15rem;
  font-size: 0.8em;
  font-weight: 600;
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem;
}

/* QR codes stay dark on white in every theme, so phones can scan them. */
.qr-columns {
  align-items: center;
}

.qr {
  margin: 0;
  text-align: center;

  & img {
    width: min(40dvh, 100%);
    height: auto;
    padding: 0.75rem;
    background: #fff;
    border-radius: 0.5rem;
  }

  & figcaption {
    font-size: 0.75em;
    overflow-wrap: anywhere;
  }

  & .qr-note {
    margin-block: 0.4em 0;
    font-size: 1.25em;
    overflow-wrap: normal;
  }
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.steps li::before {
  content: counter(step) '. ';
  color: var(--muted);
}

.steps .highlight {
  border-color: var(--brand-strong);
  outline: 2px solid var(--brand-strong);
}

/* Bar charts built from real tables: the numbers stay readable as text. */
.bars td.bar-cell {
  width: 55%;
}

.bars .bar {
  display: block;
  height: 1.1em;
  inline-size: calc(var(--value) * 100%);
  min-inline-size: 2px;
  background: var(--bar);
  border-radius: 0 0.25rem 0.25rem 0;
}

.bars .bar.is-bad {
  background: var(--bar-bad);
}

/* Notes: visible in the document; in slides, only when turned on. */
.notes {
  margin-block-start: 2rem;
  padding: 1rem 1.25rem;
  border-inline-start: 4px solid var(--muted);
  background: var(--surface);
  font-size: 0.95rem;
}

.notes h3 {
  margin-block-start: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* --- Controls and help ----------------------------------------------------- */

#deck-controls {
  position: fixed;
  inset-block-end: 0;
  inset-inline: 0;
  z-index: 10;
  /* Not --controls-height: deck.js sets that one from this bar's height. */
  min-height: 3.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border-block-start: 1px solid var(--border);
  font-size: 1rem;
}

/* Key hints, shown while Alt (Option) is held (deck.js). */
.key-hint {
  display: none;
}

html[data-hints] button:has(> .key-hint) {
  position: relative;
}

html[data-hints] .key-hint {
  display: block;
  position: absolute;
  inset-block-end: calc(100% + 0.35rem);
  inset-inline-start: 50%;
  translate: -50% 0;
  min-width: 1.8em;
  padding: 0.1em 0.45em;
  border: 1px solid var(--on-brand);
  border-radius: 0.3em;
  background: var(--brand);
  color: var(--on-brand);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

/* The demo buttons are at the top of the demo: their hints go below. */
html[data-hints] .demo-controls .key-hint {
  inset-block: calc(100% + 0.35rem) auto;
}

html.js[data-hints][data-controls='hidden'] #deck-controls:not(:focus-within, :hover) {
  opacity: 1;
}

/* Hidden with H: still in the page, shown again on focus or hover. */
html.js[data-controls='hidden'] #deck-controls:not(:focus-within, :hover) {
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  #deck-controls {
    transition: opacity 150ms ease-out;
  }
}

#deck-controls button,
#help button {
  font: inherit;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

#deck-controls button[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

#deck-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#slide-counter {
  margin-inline-start: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#help {
  max-width: min(72rem, 94vw);
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--bg);
  color: var(--text);
}

#help::backdrop {
  background: rgb(0 0 0 / 0.5);
}

#help h2 {
  margin-block: 0 1rem;
  font-size: 1.75rem;
}

/* Shortcuts on the left, settings on the right; one column when narrow. */
.help-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr));
  gap: 0 2.5rem;
  align-items: start;
}

/* The shortcuts table has more to say: it gets the wider column. */
@media (min-width: 60rem) {
  .help-columns {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

#help table {
  font-size: 0.95em;
}

#help th,
#help td {
  padding-block: 0.25rem;
}

#help fieldset + fieldset {
  margin-block-start: 0.75rem;
}

#help h3 {
  margin-block: 1.5rem 0.5rem;
  font-size: 1.15rem;
}

#help fieldset {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
}

#help fieldset label {
  display: block;
  padding-block: 0.15rem;
}

.languages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0;
  list-style: none;
}

.languages [aria-current='true'] {
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}

/* --- Slide mode -------------------------------------------------------------- */

html.js[data-mode='slides'] #deck {
  max-width: none;
  padding: 0;
}

/* Each slide fills the space above the controls and scrolls on its own if
   its content does not fit (for example when zoomed to 200%). */
html.js[data-mode='slides'] .slide {
  display: flex;
  flex-direction: column;
  /* Content starts at the top, so every title sits at the same height. */
  justify-content: flex-start;
  height: calc(100dvh - var(--controls-height));
  overflow-y: auto;
  padding: clamp(1.5rem, 5vmin, 4rem) clamp(1.5rem, 8vw, 8rem);
  padding-block-start: clamp(2rem, 9vmin, 6rem);
  border: 0;
  /* --fit (deck.js) shrinks a slide that would not fit, never below 1rem,
     so zooming in still enlarges the text and the slide scrolls instead. */
  font-size: max(1rem, calc(clamp(1.1rem, 1.2rem + 1vmin, 2rem) * var(--fit, 1)));
  container-type: size;
}

html.js[data-mode='slides'] .slide[hidden],
html.js .slide[hidden] {
  display: none;
}

html.js[data-notes='hidden'] .notes {
  display: none;
}

/* With notes on, the slide leaves room for the notes panel below it. */
html.js[data-mode='slides'][data-notes='visible'] .slide {
  justify-content: flex-start;
  height: calc(100dvh - var(--controls-height) - var(--notes-height));
}

/* Notes of the current slide: a fixed panel just above the controls, with
   its own scroll. Only one slide is visible, so only one panel shows. */
html.js[data-mode='slides'] .notes {
  position: fixed;
  inset-inline: 0;
  inset-block-end: var(--controls-height);
  height: var(--notes-height);
  margin: 0;
  overflow-y: auto;
  padding: 1rem clamp(1.5rem, 8vw, 8rem);
  border-inline-start: 0;
  border-block-start: 4px solid var(--muted);
  font-size: clamp(0.95rem, 0.9rem + 0.4vmin, 1.25rem);
}

html.js[data-mode='slides'] .slide img {
  max-height: calc(50cqh * var(--fit, 1));
  width: auto;
}

/* The title's top margin would scale with --fit and move it. */
html.js[data-mode='slides'] .slide > h2 {
  margin-block-start: 0;
}

/* The cover is the exception: a title slide, centred. */
html.js[data-mode='slides'] #portada {
  justify-content: safe center;
}

html.js[data-mode='slides'] .slide h1,
html.js[data-mode='slides'] .slide h2 {
  font-size: max(1.5rem, calc(var(--heading-size) * var(--fit, 1)));
}

html.js[data-mode='slides'] .slide h1 {
  --heading-size: clamp(2.25rem, 6vw, 4.5rem);
}

html.js[data-mode='slides'] .slide h2 {
  --heading-size: clamp(1.75rem, 4vw, 3rem);
}

html.js[data-mode='document'] #deck {
  padding-block-end: 5rem;
}

/* --- Speaker ------------------------------------------------------------------ */

.speaker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: 1.5rem 3rem;
  align-items: center;
}

.speaker-photo {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 70dvh;
  border-radius: 0.75rem;
}

.speaker-info h2 {
  margin-block: 0 0.25rem;
}

.speaker-info .subtitle {
  margin-block: 0 1.25rem;
}

.logos,
.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-block: 0 1.25rem;
  padding: 0;
  list-style: none;
}

.logos img {
  display: block;
  width: auto;
  height: 4rem;
}

/* The logos are white cards in both themes; the focus ring goes around them. */
.logos a {
  display: block;
  border-radius: 0.6rem;
}

/* As a slide: the photo bleeds to the edges at the full height of the slide
   and everything is sized from that height (cqh), so the slide never needs
   to scroll, with or without the notes and the controls. */
html.js[data-mode='slides'] #sobre-mi {
  container-type: size;
  padding: 0;
}

html.js[data-mode='slides'] #sobre-mi .speaker {
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  height: 100%;
}

html.js[data-mode='slides'] #sobre-mi .speaker > picture,
html.js[data-mode='slides'] #sobre-mi .speaker-photo {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
}

html.js[data-mode='slides'] #sobre-mi .speaker-photo {
  object-fit: cover;
  object-position: 50% 40%;
  border-radius: 0;
}

html.js[data-mode='slides'] #sobre-mi .speaker-info {
  padding: 4cqh clamp(1.5rem, 5vw, 5rem);
}

html.js[data-mode='slides'] #sobre-mi .speaker-info h2 {
  font-size: clamp(1.75rem, 13cqh, 6rem);
  line-height: 1;
}

html.js[data-mode='slides'] #sobre-mi .subtitle {
  margin-block-end: 6cqh;
  font-size: clamp(1rem, 6cqh, 2.5rem);
}

html.js[data-mode='slides'] #sobre-mi .logos {
  flex-wrap: nowrap;
  gap: 1.5cqw;
  margin-block-end: 5cqh;
}

/* Four 2:1 logos in one row: limited by the height of the slide and by the
   width of the text column (3/5 of the slide minus its padding). */
html.js[data-mode='slides'] #sobre-mi .logos img {
  height: clamp(1.75rem, min(11cqh, (60cqw - 2 * clamp(1.5rem, 5vw, 5rem) - 4.5cqw) / 8), 6rem);
}

html.js[data-mode='slides'] #sobre-mi .profile-links {
  gap: 1cqh 2rem;
  margin: 0;
  font-size: clamp(0.9rem, 4.5cqh, 1.75rem);
}

/* Narrow screens or 200% zoom: photo on top as a band, text below. */
@media (max-width: 48rem) {
  html.js[data-mode='slides'] #sobre-mi {
    container-type: normal;
  }

  html.js[data-mode='slides'] #sobre-mi .speaker {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
  }

  html.js[data-mode='slides'] #sobre-mi .speaker > picture,
  html.js[data-mode='slides'] #sobre-mi .speaker-photo {
    height: 35dvh;
  }

  html.js[data-mode='slides'] #sobre-mi .speaker-info h2,
  html.js[data-mode='slides'] #sobre-mi .subtitle,
  html.js[data-mode='slides'] #sobre-mi .profile-links {
    font-size: revert-layer;
  }

  html.js[data-mode='slides'] #sobre-mi .logos img {
    height: 3rem;
  }
}

/* --- Alt text on screen ------------------------------------------------------ */

/* The alt of an image, shown with A as the code that holds it. Dark in both
   themes, like the black and white photo it sits on. */
.alt-reveal {
  margin: 0.5rem 0 0;
  padding: 0.75em 1em;
  border-radius: 0.5rem;
  background: #121212;
  color: #ececec;
  font-family: var(--mono);
  font-size: 0.9em;
  line-height: 1.4;
}

.alt-reveal::before {
  content: 'alt="';
  color: var(--brand);
}

.alt-reveal::after {
  content: '"';
  color: var(--brand);
}

/* Over the bottom of the photo: the copy shares the photo's grid cell. Both
   are placed explicitly, or the photo would move to the next free cell. */
.speaker > picture,
.speaker > .alt-reveal {
  grid-area: 1 / 1;
}

.speaker > .alt-reveal {
  align-self: end;
  z-index: 1;
  margin: 1rem;
  background: rgb(18 18 18 / 0.92);
}

html.js[data-mode='slides'] #sobre-mi .speaker > .alt-reveal {
  font-size: clamp(1rem, 3.6cqh, 1.75rem);
}

/* --- Live demos ------------------------------------------------------------- */

.demo-open,
.demo-close,
.demo-fullscreen {
  font: inherit;
  font-size: 0.8em;
  padding: 0.35rem 0.9rem;
  border: 2px solid var(--brand-strong);
  border-radius: 0.4rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.demo iframe {
  display: block;
  width: 100%;
  height: min(62dvh, 40rem);
  margin-block: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: #fff;
}

.demo-fullscreen[aria-pressed='true'] {
  background: var(--brand);
  color: var(--on-brand);
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
}

/* Fullscreen: trace.cafe takes the whole screen, the buttons stay below. */
.demo:fullscreen {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  background: var(--bg);
}

.demo:fullscreen iframe {
  flex: 1;
  height: auto;
  margin: 0 0 0.5rem;
}

/* A reminder for the speaker, and a note for everyone: this part is shown
   live outside the slides. */
.demo-badge {
  display: inline-block;
  align-self: flex-start;
  margin-block: 0 0.75rem;
  padding: 0.2em 0.75em;
  border: 2px solid var(--brand-strong);
  border-radius: 999px;
  font-size: 0.8em;
  font-weight: 700;
}

.tip {
  margin-block: 1em 0;
  padding: 0.5em 0.9em;
  border-inline-start: 0.25em solid var(--brand);
  background: var(--surface);
  font-size: 0.85em;
}

/* Marker-style highlight for the key numbers. */
mark {
  padding: 0 0.15em;
  border-radius: 0.2em;
  background: light-dark(rgb(0 170 88 / 0.28), rgb(0 170 88 / 0.38));
  color: inherit;
  font-weight: 700;
}

/* Thanks in three languages, with a line between them. */
.thanks span + span {
  margin-inline-start: 0.35em;
  padding-inline-start: 0.45em;
  border-inline-start: 0.08em solid var(--brand);
}

/* The out-of-date tree explainer: four panels per step. In the text view
   every step shows at once, two by two, each panel as a line. */
html.js[data-view='text'] .frames {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(24em, 100%), 1fr));
  gap: 1em 2em;
}

html.js[data-view='text'] .frames h3 {
  font-size: 1em;
}

html.js[data-view='text'] .frame-panels {
  display: block;
}

html.js[data-view='text'] .panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5em;
  align-items: baseline;
  padding: 0;
  border: 0;
  background: none;
}

html.js[data-view='text'] .panel-title {
  margin: 0;
}

html.js[data-view='text'] .panel pre {
  white-space: normal;
}

html.js[data-view='text'] .panel-title::after {
  content: ':' / '';
}

html.js[data-view='text'] .screen-button {
  padding: 0;
  background: none;
  color: inherit;
}

html.js[data-view='text'] .frame-summary {
  margin-block-start: 0.4em;
  font-size: 0.85em;
}

/* The out-of-date tree explainer: four panels per step. */
.frames {
  padding: 0;
  list-style: none;
}

.frames h3 {
  margin-block: 0 0.6em;
}

.frame-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(9em, 100%), 1fr));
  gap: 0.75em;
}

.panel {
  padding: 0.6em 0.8em;
  border: 2px solid var(--border);
  border-radius: 0.5em;
  background: var(--surface);
  font-size: 0.85em;
}

.panel p {
  margin: 0;
}

.panel pre {
  overflow-wrap: break-word;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.85em;
}

.panel-title {
  margin-block-end: 0.4em;
  color: var(--muted);
  font-size: 0.8em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel.is-changed {
  border-color: var(--brand-strong);
}

.panel.is-stale {
  border-color: var(--bad);
  border-style: dashed;
}

.panel-state {
  display: inline-block;
  margin-block-start: 0.4em;
  font-size: 0.8em;
  font-weight: 700;
}

.screen-button {
  display: inline-block;
  padding: 0.3em 0.8em;
  border-radius: 0.4em;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
}

.screen-button.is-disabled {
  background: var(--border);
  color: var(--text);
}

.frame-summary {
  margin-block: 0.75em 0;
}

/* As a slide, an open demo covers the whole slide: trace.cafe gets the
   room, and the slide content stays in the page for screen readers. */
html.js[data-mode='slides'] .slide {
  position: relative;
}

html.js[data-mode='slides'] .demo.is-open {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  background: var(--bg);
}

html.js[data-mode='slides'] .demo.is-open iframe {
  flex: 1;
  height: auto;
  margin-block: 0 0.5rem;
}

.demo .demo-open + .demo-open {
  margin-inline-start: 0.5rem;
}

/* With the demo open, the screenshot leaves the screen but keeps its text
   alternative for screen readers, which do not get the demo itself. */
.demo.is-open figure {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Visual view: the same content, drawn ----------------------------------- */

/* Builds: items not shown yet keep their place (deck.js). */
[data-build-hidden] {
  visibility: hidden;
}

/* One step at a time: every step in the same cell, as tall as the tallest. */
html.js[data-view='visual'] [data-build='replace'] {
  display: grid;
}

html.js[data-view='visual'] [data-build='replace'] > li {
  grid-area: 1 / 1;
}

@media (prefers-reduced-motion: no-preference) {
  [data-build] > li {
    transition: opacity 200ms ease-out;
  }

  [data-build] > [data-build-hidden] {
    opacity: 0;
  }
}

/* Pictures that only repeat what the text next to them says (the table
   stays as their text version) are left out of the text view. */
html.js[data-view='text'] .visual-only {
  display: none;
}

html.js[data-view='visual'] [data-visual='hidden'] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html.js[data-view='visual'][data-mode='slides'] .slide > h2,
html.js[data-view='visual'][data-mode='slides'] .speaker-info > h2 {
  --heading-size: clamp(2rem, 1rem + 3.5vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

html.js[data-view='visual'] .slide > h2::before {
  content: '';
  display: block;
  width: 3.5rem;
  height: 0.3rem;
  margin-block-end: 0.75rem;
  border-radius: 0.15rem;
  background: var(--brand);
}

/* A key sentence, set apart from the title: lighter, quoted, with a rule. */
html.js[data-view='visual'] .statement {
  max-width: 32ch;
  padding-inline-start: 0.75em;
  border-inline-start: 0.2em solid var(--brand);
  font-size: 1.5em;
  font-weight: 400;
  line-height: 1.35;
}

/* Charts (deck.js builds them from the tables): one panel per measure, a
   bar per item with its label and value written next to it. */
.chart-view {
  display: none;
}

html.js[data-view='visual'] .chart-view {
  display: block;
}

html.js[data-view='visual'] .chart-table {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.chart-caption {
  margin-block: 0 0.75rem;
  font-weight: 600;
}

.chart-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15em, 100%), 1fr));
  gap: 1em 2em;
}

.chart-panel {
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  column-gap: 0.6em;
  align-content: start;
}

.chart-panel-title {
  grid-column: 1 / -1;
  margin-block: 0 0.4em;
  padding-block-end: 0.25em;
  border-block-end: 2px solid var(--brand);
  font-size: 0.85em;
  font-weight: 700;
}

/* Every item shares the panel's columns: labels, bars and values line up. */
.chart-item {
  --bar-color: light-dark(#cfcbc1, #4d4d4d);
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
  margin-block: 0.3em;
  font-size: 0.8em;
  font-variant-numeric: tabular-nums;
}

.chart-item.is-good {
  --bar-color: var(--brand-strong);
}

.chart-item.is-bad {
  --bar-color: var(--bad);
}

.chart-item.is-good .chart-value,
.chart-item.is-bad .chart-value {
  font-weight: 700;
}

.chart-item.is-bad .chart-value {
  color: var(--bad);
}

.chart-track {
  display: block;
  height: 1.1em;
}

.chart-bar {
  display: block;
  height: 100%;
  inline-size: calc(var(--share) * 100%);
  min-inline-size: 3px;
  border-radius: 0 0.3em 0.3em 0;
  background: var(--bar-color);
}

.chart-value {
  text-align: end;
}

/* Few items with a large range: vertical columns. */
.chart-columns .chart-panels {
  grid-template-columns: 1fr;
}

.chart-columns .chart-panel {
  display: flex;
  grid-template-columns: none;
  gap: 1.5em;
  align-items: flex-end;
  justify-content: center;
}

.chart-columns .chart-panel-title {
  display: none;
}

.chart-columns .chart-item {
  display: flex;
  grid-column: auto;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.3em;
  width: 7em;
  font-size: 0.9em;
}

.chart-columns .chart-track {
  display: flex;
  align-items: flex-end;
  width: 4.5em;
  height: calc(8em * var(--fit, 1));
}

.chart-columns .chart-bar {
  inline-size: 100%;
  block-size: calc(var(--share) * 100%);
  min-block-size: 3px;
  border-radius: 0.3em 0.3em 0 0;
}

.chart-columns .chart-value {
  order: -1;
  text-align: center;
}

/* "n of 3": filled and empty dots. */
.chart-dots .chart-track {
  display: flex;
  gap: 0.35em;
  height: auto;
}

.chart-dot {
  width: 1.1em;
  height: 1.1em;
  border: 2px solid var(--bar-color);
  border-radius: 50%;
}

.chart-dot.is-on {
  background: var(--bar-color);
}

.chart-item:not(.is-good, .is-bad) .chart-dot {
  --bar-color: var(--muted);
}

@media (forced-colors: active) {
  .chart-bar,
  .chart-dot.is-on {
    background: CanvasText;
  }

  .chart-dot {
    border-color: CanvasText;
  }
}

/* The rendering steps as a pipeline of arrows. */
html.js[data-view='visual'] .steps {
  gap: 0.3rem;
}

html.js[data-view='visual'] .steps li {
  padding: 0.75rem 1.5rem 0.75rem 1.75rem;
  border: 0;
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 0.9rem) 0, 100% 50%, calc(100% - 0.9rem) 100%, 0 100%, 0.9rem 50%);
}

html.js[data-view='visual'] .steps .highlight {
  outline: 0;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
}

html.js[data-view='visual'] .steps .highlight::before {
  color: inherit;
}

/* Timelines: a line with a dot per year. */
/* The line belongs to each item, so it only reaches the items shown. */
html.js[data-view='visual'] .timeline {
  margin-inline-start: 0.75rem;
  padding: 0;
  list-style: none;
}

html.js[data-view='visual'] .timeline li {
  position: relative;
  padding: 0.35rem 0 0.6rem 1.75rem;
  border-inline-start: 0.3rem solid var(--brand);
}

html.js[data-view='visual'] .timeline li::before {
  content: '';
  position: absolute;
  inset-inline-start: -0.9rem;
  inset-block-start: 0.55rem;
  width: 1.5rem;
  height: 1.5rem;
  border: 0.3rem solid var(--brand);
  border-radius: 50%;
  background: var(--bg);
}

html.js[data-view='visual'] .timeline-sep {
  display: none;
}

html.js[data-view='visual'] .timeline strong {
  display: block;
  font-size: 1.35em;
  color: var(--brand-strong);
}

/* Lists of ideas as cards. */
html.js[data-view='visual'] .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: 1rem;
  padding: 0;
  list-style: none;
}

html.js[data-view='visual'] .cards li {
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-block-start: 0.4rem solid var(--brand);
  border-radius: 0.5rem;
  background: var(--surface);
}

@media (prefers-reduced-motion: no-preference) {
  html.js[data-mode='slides'] .slide:not([hidden]) {
    animation: slide-in 180ms ease-out;
  }

  @keyframes slide-in {
    from {
      opacity: 0.4;
    }
  }
}

@media (forced-colors: active) {
  .bars .bar,
  .bars .bar.is-bad {
    background: CanvasText;
  }

  #deck-controls button[aria-pressed='true'] {
    outline: 3px solid Highlight;
  }

  /* Bars and diagram shapes lose their colors; the numbers stay. */
  html.js[data-view='visual'] table.chart td[data-value] {
    background-image: linear-gradient(CanvasText, CanvasText);
  }
}

@media print {
  #deck-controls,
  #help {
    display: none;
  }

  .slide,
  .slide[hidden] {
    display: block !important;
    break-after: page;
  }

  .notes {
    display: block !important;
  }
}
