/* Lecture slides. Read mode; present and print rules are added below. */

/* IDS theme font (atipo Mg12): web licence needed before this is deployed. The theme falls back to the brand fonts. */
@font-face { font-family: "Mg12"; src: url("/fonts/Mg12-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Mg12"; src: url("/fonts/Mg12-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Mg12"; src: url("/fonts/Mg12-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Mg12"; src: url("/fonts/Mg12-RegularItalic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Mg12"; src: url("/fonts/Mg12-MediumItalic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "Mg12"; src: url("/fonts/Mg12-BoldItalic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

.lecture-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-sm); margin-bottom: var(--space-md); }
.lecture-title { font-family: var(--font-brand); font-weight: 800; margin: 0; }
.lecture-meta { margin: 0; color: var(--fg-muted); }
.lecture-present { font: inherit; font-weight: 600; border: var(--border-structural); background: var(--color-white); padding: var(--space-xs) var(--space-sm); cursor: pointer; }
.lecture-present:hover, .lecture-present:focus-visible { background: var(--color-pink-light); }

.lecture-deck { display: grid; gap: var(--space-lg); max-width: min(100%, 1100px); }

/* Slide grid: 16:9, units in cqw. 12 columns, 5cqw outer margins, 2cqw gutters.
   Tracks: margin | col 1..12 | margin  (grid lines 1..15). Row 1 content, row 2 footer. */
.slide { --m: 5cqw; --gap: 2cqw; --mt: 5cqw;
  --font-display: var(--font-brand); --font-text: var(--font-body);
  --fs-body: 2.6cqw; --fs-h1: 7.5cqw; --fs-h2: 5cqw; --fs-h3: 3.4cqw;
  --slide-bg: #fff; --slide-fg: #000; --slide-border: var(--border-structural); --accent: var(--fg-pink); --accent-text: var(--accent); --fw-display: 800;
  --header-bg: transparent; --header-fg: currentColor;
  aspect-ratio: 16 / 9; container-type: inline-size; position: relative; overflow: hidden;
  background: var(--slide-bg); border: var(--slide-border); color: var(--slide-fg);
  display: grid; grid-template-columns: 5% repeat(12, 1fr) 5%; column-gap: 2%; /* percentages: the slide's own cqw would resolve against its parent */
  grid-template-rows: minmax(0, 1fr) auto; font-family: var(--font-text); }

.slide__text { grid-column: 2 / 14; grid-row: 1; min-width: 0; padding: var(--mt) 0 var(--gap);
  display: flex; flex-direction: column; justify-content: flex-start; gap: 1.6cqw;
  font-size: var(--fs-body); line-height: 1.35; }
.slide__text:has(> :only-child) { justify-content: center; }
.slide__text h1, .slide__text h2 { font-family: var(--font-display); font-weight: var(--fw-display); line-height: 1; margin: 0; }
.slide__text h3 { font-family: var(--font-text); font-weight: 600; line-height: 1.1; margin: 0; }
.slide__text h1 { font-size: var(--fs-h1); }
.slide__text h2 { font-size: var(--fs-h2); }
.slide__text h3 { font-size: var(--fs-h3); }
.slide__text p, .slide__text ul, .slide__text ol, .slide__text pre, .slide__text blockquote { margin: 0; max-width: 60cqw; }
.slide__text ul, .slide__text ol { padding-left: 1.2em; }
.slide__text li + li { margin-top: .35em; }
.slide__text a { color: inherit; text-decoration: underline; }
.slide__text pre { font-size: 1.8cqw; padding: 1.5cqw; background: rgba(0,0,0,.06); overflow: hidden; }
.slide__text code { font-size: .9em; }
.slide__media img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Image attributes: fit (whole image), crop (focal point), mask (shape) */
.slide__media img.img-fit { object-fit: contain; }
.slide__media img.img-crop-top { object-position: center top; }
.slide__media img.img-crop-bottom { object-position: center bottom; }
.slide__media img.img-crop-left { object-position: left center; }
.slide__media img.img-crop-right { object-position: right center; }
.slide__media img.img-crop-center { object-position: center center; }
/* A masked image floats inside its area (margin) instead of bleeding to the edge. */
.slide__media img.img-masked { width: calc(100% - 8cqw); height: calc(100% - 8cqw); margin: 4cqw; align-self: center; justify-self: center; }
.slide__media img.img-mask-circle { clip-path: circle(closest-side at 50% 50%); }
.slide__media img.img-mask-rounded { clip-path: inset(0 round 4cqw); }
.slide__media img.img-mask-hexagon { clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.slide__media img.img-mask-triangle { clip-path: polygon(50% 4%, 100% 96%, 0 96%); }

/* Templates */
.slide--title .slide__text, .slide--subtitle .slide__text, .slide--quote .slide__text { justify-content: center; }
.slide--title .slide__text h1 { font-size: 11cqw; }
.slide--subtitle .slide__text h1 { font-size: 8.5cqw; }
.slide--subtitle .slide__text p { font-family: var(--font-text); font-size: var(--fs-h3); max-width: 50cqw; }
.slide--quote blockquote p { font-family: var(--font-display); font-weight: var(--fw-display); font-size: 5.2cqw; line-height: 1.08; }
.slide--quote blockquote .slide__attribution { font-family: var(--font-text); font-weight: 400; font-size: var(--fs-body); line-height: 1.35; margin-top: 2cqw; }
.slide--quote blockquote { max-width: 70cqw; }
/* Quotation marks come from the template (the brand font draws its curly quotes reversed), so authors leave them out. */
.slide--quote blockquote p:first-child::before { content: "\201C"; font-family: var(--font-text); font-weight: 400; }
.slide--quote blockquote p:has(+ .slide__attribution)::after,
.slide--quote blockquote p:last-child:not(.slide__attribution)::after { content: "\201D"; font-family: var(--font-text); font-weight: 400; }

.slide--split .slide__text { grid-column: 2 / 7; }
.slide--split .slide__media { grid-column: 8 / 15; grid-row: 1 / -1; display: grid; grid-auto-rows: 1fr; min-height: 0; }
.slide--split .slide__media { position: relative; }
.slide--split .slide__media:not(:has(.img-fit, .img-masked))::after { content: ""; position: absolute; inset: auto 0 0 0; height: 12cqw; pointer-events: none;
  background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.slide--split.slide--flip .slide__text { grid-column: 9 / 14; }
.slide--split.slide--flip .slide__media { grid-column: 1 / 8; }

.slide--image { background: #000; color: #fff; } /* letterbox colour for {fit}; a colour marker overrides it */
.slide--image .slide__media { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(30%, 1fr)); }
.slide--image:not(:has(.img-fit, .img-masked, .has-caption))::after { content: ""; position: absolute; inset: auto 0 0 0; height: 14cqw; z-index: 1; pointer-events: none;
  background: linear-gradient(transparent, rgba(0,0,0,.6)); }

.slide--index .slide__toc { list-style: none; padding: 0; margin: 0; max-width: none; columns: 2; column-gap: 4cqw; font-size: 3cqw; line-height: 1.2; }
.slide--index .slide__toc li { break-inside: avoid; margin: 0 0 1.2cqw; }
.slide--index .slide__toc a { display: flex; justify-content: space-between; gap: 2cqw; text-decoration: none; color: inherit; border-bottom: 2px solid currentColor; padding-bottom: .4cqw; }
.slide--index .toc__num { font-family: var(--font-display); font-weight: var(--fw-display); }
.slide--sources .slide__table { width: 100%; max-width: none; border-collapse: collapse; font-size: 1.8cqw; line-height: 1.25; }
.slide--sources .slide__table th { text-align: left; font-family: var(--font-text); font-weight: var(--fw-display); border-bottom: 2px solid currentColor; padding: 0 1cqw .6cqw 0; }
.slide--sources .slide__table td { padding: .5cqw 1cqw .5cqw 0; vertical-align: top; border-bottom: 1px solid rgba(0,0,0,.25); }
.slide--sources .tbl__num { width: 4cqw; font-family: var(--font-display); font-weight: var(--fw-display); }

/* Header strip (deck front matter `series`) and per-slide label */
.slide--has-header .slide__text, .slide--has-header .slide__media { margin-top: 3.4cqw; }
.slide__header { position: absolute; top: 0; left: 0; right: 0; height: 3.4cqw; z-index: 3; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 calc(var(--m) + var(--gap)); font-size: 1.15cqw; letter-spacing: .04em; background: var(--header-bg); color: var(--header-fg); border-bottom: 1px solid rgba(0,0,0,.2); }
.slide__header span:nth-child(2) { text-align: center; }
.slide__header span:nth-child(3) { text-align: right; }
.slide__eyebrow { position: absolute; top: 1.8cqw; left: calc(var(--m) + var(--gap)); z-index: 2; font-size: 1.5cqw; opacity: .7; }
.slide--has-header .slide__eyebrow { top: 5.4cqw; }

/* Section divider: big number in the accent colour */
.slide--section .slide__text { justify-content: center; }
.slide--section .slide__text h1 { font-size: 11cqw; display: flex; align-items: baseline; gap: 3cqw; }
.section__num { color: var(--accent); flex: none; }
.section__title { min-width: 0; }

/* Columns: heading left, body right */
.slide--columns .slide__text { display: grid; grid-template-columns: 4fr 7fr; column-gap: 4cqw; align-content: start; }
.slide--columns .slide__col > * + * { margin-top: 1.6cqw; }

/* Cards in a row, optional icon on top */
.slide--cards .slide__text { justify-content: flex-start; }
.slide__lead { margin-bottom: 1cqw; }
.slide__cards { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2cqw; align-items: stretch; }
.slide__card { border-top: .5cqw solid var(--accent); padding-top: 1.6cqw; display: flex; flex-direction: column; gap: 1.2cqw; min-width: 0; }
.slide__card img { display: block; height: 8cqw; width: auto; max-width: 100%; align-self: flex-start; }
.slide__card h3 { font-size: var(--fs-h3); }
.slide__card p { font-size: 2.2cqw; max-width: none; }

/* Tables */
.slide__text table { width: 100%; border-collapse: collapse; font-size: 2.2cqw; line-height: 1.25; }
.slide__text th { text-align: left; font-weight: 700; border-bottom: .3cqw solid currentColor; padding: .8cqw 1.2cqw .8cqw 0; }
.slide__text td { padding: .8cqw 1.2cqw .8cqw 0; border-bottom: 1px solid rgba(0,0,0,.2); vertical-align: top; }

/* Inline accent: ==word== (underlined on coloured backgrounds, where the accent would not read) */
mark.accent { background: none; color: var(--accent-text); }
.slide--bg-pink mark.accent, .slide--bg-pink-light mark.accent, .slide--bg-blue mark.accent, .slide--bg-yellow mark.accent, .slide--bg-black mark.accent,
.slide--bg-orange mark.accent, .slide--bg-ink mark.accent, .slide--bg-grey mark.accent { color: inherit; text-decoration: underline; text-decoration-thickness: .12em; text-underline-offset: .12em; }

/* Split ratio 2/3: the image takes two thirds */
.slide--split.slide--ratio-2-3 .slide__text { grid-column: 2 / 6; }
.slide--split.slide--ratio-2-3 .slide__media { grid-column: 6 / 15; }
.slide--split.slide--flip.slide--ratio-2-3 .slide__text { grid-column: 10 / 14; }
.slide--split.slide--flip.slide--ratio-2-3 .slide__media { grid-column: 1 / 10; }

/* The 2/3 split has a narrow text column: smaller headings keep words whole */
.slide--split.slide--ratio-2-3 .slide__text h1, .slide--split.slide--ratio-2-3 .slide__text h2 { font-size: 3.6cqw; }
.slide--split.slide--ratio-2-3 .slide__text h3 { font-size: 2.8cqw; }

/* Vertical alignment of the text column */
.slide.slide--valign-top .slide__text { justify-content: flex-start; }
.slide.slide--valign-center .slide__text { justify-content: center; }
.slide.slide--valign-bottom .slide__text { justify-content: flex-end; }

/* Columns slides are grids: align their content instead */
.slide--columns.slide--valign-top .slide__text { align-content: start; }
.slide--columns.slide--valign-center .slide__text { align-content: center; }
.slide--columns.slide--valign-bottom .slide__text { align-content: end; }

/* Image grids: cols=N and captions */
.slide--image.slide--cols-2 .slide__media { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; gap: .4cqw; }
.slide--image.slide--cols-3 .slide__media { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: .4cqw; }
.slide--image.slide--cols-4 .slide__media { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; gap: .4cqw; }
.slide--image:has(.has-caption) .slide__media { grid-row: 1; }
.has-caption { margin: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; min-width: 0; }
.has-caption img { min-height: 0; }
.has-caption figcaption { padding: .8cqw 1.2cqw; font-size: 1.5cqw; line-height: 1.25; background: rgba(0,0,0,.7); color: #fff; }

/* Backgrounds */
.slide--bg-pink { background: var(--color-pink-dark); color: #000; --accent: currentColor; --accent-text: currentColor; }
.slide--bg-pink-light { background: var(--color-pink-mid); color: #000; --accent: currentColor; --accent-text: currentColor; }
.slide--bg-blue { background: var(--color-blue); color: #fff; --accent: currentColor; --accent-text: currentColor; }
.slide--bg-yellow { background: var(--color-yellow); color: #000; --accent: currentColor; --accent-text: currentColor; }
.slide--bg-black { background: #000; color: #fff; --accent: currentColor; --accent-text: currentColor; }
.slide--bg-white { background: #fff; color: #000; }

/* Footer: source left, n/N right */
.slide__footer { grid-column: 2 / 14; grid-row: 2; position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: baseline; gap: 2cqw;
  padding: 0 0 2cqw; font-size: 1.5cqw; line-height: 1.2; }
.slide__source { font-size: 1.2cqw; min-width: 0; max-width: 80%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.slide__source a { color: inherit; }
.slide--flip .slide__source { max-width: 42cqw; }
.slide__date { margin-left: auto; margin-right: 2cqw; font-size: 1.5cqw; flex: none; opacity: .8; }
.slide__num { font-family: var(--font-display); font-weight: var(--fw-display); font-size: 1.8cqw; flex: none; }
.slide--image:not(:has(.img-fit, .img-masked)):not(:has(.has-caption)) .slide__footer,
.slide--split:not(.slide--flip):not(:has(.img-fit, .img-masked)) .slide__num,
.slide--split.slide--flip:not(:has(.img-fit, .img-masked)) .slide__source {
  color: #fff; text-shadow: 0 0 .6cqw rgba(0,0,0,.65); opacity: 1; }

/* IDS theme (deck front matter `theme: ids`): cream slides, ink header bar, orange accent, Mg12 type. */
.theme-ids .slide { --slide-bg: #f0ede5; --slide-fg: #181818; --slide-border: 0; --accent: #f07018; --accent-text: #a84808; --fw-display: 500;
  --header-bg: #181818; --header-fg: #f0ede5;
  --font-display: "Mg12", var(--font-brand), sans-serif; --font-text: "Mg12", var(--font-body), sans-serif; }
.theme-ids .slide__header { border-bottom: 0; }
.theme-ids .slide--image { background: #181818; color: #f0ede5; }
.theme-ids .slide--bg-orange { background: #f07018; color: #181818; --accent: currentColor; --accent-text: currentColor; }
.theme-ids .slide--bg-ink { background: #181818; color: #f0ede5; --accent: currentColor; --accent-text: currentColor; }
.theme-ids .slide--bg-grey { background: #c5c3be; color: #181818; --accent: currentColor; --accent-text: currentColor; }
.theme-ids .slide--bg-cream { background: #f0ede5; color: #181818; }
.theme-ids .slide--bg-white { background: #fff; color: #181818; }

/* Present mode */
body.is-presenting { overflow: hidden; background: #000; }
body.is-presenting > *:not(main):not(.lecture-exit), body.is-presenting main > *:not(.pg-page), body.is-presenting .pg-page > *:not(.lecture-deck) { display: none !important; }
body.is-presenting .pg-page { padding: 0; margin: 0; max-width: none; }
.lecture-exit { display: none; }
body.is-presenting .lecture-exit { display: block; position: fixed; top: 8px; right: 8px; z-index: 10; width: 44px; height: 44px;
  font-size: 28px; line-height: 1; color: #fff; background: rgba(0,0,0,.45); border: 0; border-radius: 50%; cursor: pointer; opacity: .35; }
body.is-presenting .lecture-exit:hover, body.is-presenting .lecture-exit:focus-visible { opacity: 1; }
@media print { .lecture-exit { display: none !important; } }
body.is-presenting .lecture-deck { position: fixed; inset: 0; display: block; max-width: none; background: #000; }
body.is-presenting .slide { position: absolute; top: 50%; left: 50%; width: min(100vw, 100vh * 16 / 9); border: 0;
  transform: translate(calc(-50% + 4%), -50%); opacity: 0; pointer-events: none;
  transition: opacity 250ms ease, transform 250ms ease; }
body.is-presenting .slide.is-before { transform: translate(calc(-50% - 4%), -50%); }
body.is-presenting .slide.is-current { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { body.is-presenting .slide { transition: none; } }

/* Text colour override (text=<colour>): the theme's own colour names */
.slide.slide--text-pink { color: var(--color-pink-dark); --accent: currentColor; --accent-text: currentColor; }
.slide.slide--text-pink-light { color: var(--color-pink-mid); --accent: currentColor; --accent-text: currentColor; }
.slide.slide--text-blue { color: var(--color-blue); --accent: currentColor; --accent-text: currentColor; }
.slide.slide--text-yellow { color: var(--color-yellow); --accent: currentColor; --accent-text: currentColor; }
.slide.slide--text-black { color: #000; --accent: currentColor; --accent-text: currentColor; }
.slide.slide--text-white { color: #fff; --accent: currentColor; --accent-text: currentColor; }
.theme-ids .slide.slide--text-orange { color: #f07018; --accent: currentColor; --accent-text: currentColor; }
.theme-ids .slide.slide--text-ink { color: #181818; --accent: currentColor; --accent-text: currentColor; }
.theme-ids .slide.slide--text-grey { color: #c5c3be; --accent: currentColor; --accent-text: currentColor; }
.theme-ids .slide.slide--text-cream { color: #f0ede5; --accent: currentColor; --accent-text: currentColor; }
.theme-ids .slide.slide--text-white { color: #fff; --accent: currentColor; --accent-text: currentColor; }

/* Print: one slide per page, 16:9 */
@page { size: 13.333in 7.5in; margin: 0; }
@media print {
  html, body { margin: 0; background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body > *:not(main), main > *:not(.pg-page), .pg-page > *:not(.lecture-deck) { display: none !important; }
  .pg-page { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .lecture-deck { display: block; max-width: none; }
  .slide, body.is-presenting .slide { position: relative; top: auto; left: auto; width: 100vw; height: 100vh; aspect-ratio: auto;
    border: 0; opacity: 1 !important; transform: none !important; transition: none; break-after: page; page-break-after: always; }
}
.lecture-download { font-weight: 600; color: var(--fg-pink); }

.lecture-back { display: inline-block; margin-bottom: var(--space-sm); color: var(--fg-pink); font-weight: 600; }
.lecture-heading { font-family: var(--font-brand); font-weight: 800; margin: 0 0 var(--space-md); }
