/* Shared slide viewer: image slides with prev/next, full screen, per-slide sources.
   Pages are generated by tools/slide-viewers/build.py. Night colours live in viewer-night.css,
   which blogs/theme.js switches on and off (it is linked with id="night-theme"). */
:root {
  color-scheme: light;
  --bg: #ffffff; --bg-code: #f3f3f2; --bg-subtle: #f7f7f5;
  --fg: #282828; --fg1: #3c3836; --fg2: #504945; --fg3: #6b6866;
  --fg4: #676767; --fg5: #737373;
  --border-soft: #67676733; --hair: #6767671f; --sep: rgba(103, 103, 103, 0.38);
  --accent: #2563eb; --link-hover: #1d4ed8;
  --slide-bg: #ffffff; --bar: #2563eb; --bar-track: #6767671a;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Iowan Old Style', 'Iowan Old Style BT', Georgia, serif;
  --site-header-height: 54px;
}
html.embed { --bg: transparent; } /* the blog page shows through the iframe */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: var(--font-serif); font-size: 17px; line-height: 1.6;
  background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-header {
  position: sticky; top: 0; z-index: 100; height: var(--site-header-height);
  display: flex; justify-content: space-between; align-items: center; padding: 0 24px;
  background: #fffffff0; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #67676726; font-family: var(--font-sans);
}
.navbar-logo a { color: var(--fg); text-decoration: none; font-size: 14px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.top-nav a { color: var(--fg2); text-decoration: none; font-size: 13.5px; margin-left: 22px; transition: color 0.2s ease-in-out; }
.top-nav a:hover, .top-nav a.active { color: var(--fg); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  font: 12px/1.4 var(--font-sans); color: var(--fg2); background: transparent;
  border: 1px solid var(--border-soft); border-radius: 20px; padding: 5px 10px; margin-left: 18px;
  cursor: pointer; white-space: nowrap; vertical-align: middle;
}
.theme-toggle:hover { color: var(--fg); background: var(--bg-code); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (pointer: coarse) { .theme-toggle { min-height: 44px; min-width: 64px; } }
@media (max-width: 680px) {
  .site-header { height: auto; min-height: 54px; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .top-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; width: 100%; }
  .top-nav a { margin-left: 0; font-size: 12px; }
  .theme-toggle { margin-left: auto; }
}

#main { margin: 0 auto; max-width: 1128px; padding: 0 24px 3rem; }

/* Heading: the same title and meta row as the blog posts. */
.page-head { max-width: 760px; margin: 0 auto; padding-top: 4rem; text-align: center; }
.page-head h1 {
  font-family: var(--font-serif); font-weight: 500; font-size: clamp(28px, 3vw, 35px);
  line-height: 1.25; margin: 0 auto; text-wrap: balance; color: var(--fg);
}
.post-meta-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px;
  margin-top: 1.15rem; font-family: var(--font-sans); font-size: 11px; color: var(--fg4);
}
.post-meta-row .sep { margin: 0 -1px; color: var(--sep); }
.post-meta-row .author a { color: var(--fg4); text-decoration: none; }
.post-meta-row .author a:hover { text-decoration: underline; text-underline-offset: 2px; }
.deck-links {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 0;
  margin: 1.1rem 0 0; font: 13.5px/1.5 var(--font-sans); color: var(--fg5);
}
.deck-links .sep { margin: 0 9px; color: #67676760; }
.deck-links a, .hint a, footer a {
  color: var(--fg3); text-decoration: underline; text-decoration-color: #67676755;
  text-underline-offset: 2.5px; text-decoration-thickness: 1px; transition: color 0.15s, text-decoration-color 0.15s;
}
.deck-links a:hover, .hint a:hover, footer a:hover { color: var(--link-hover); text-decoration-color: #1d4ed870; }

.viewer { margin-top: 2rem; }
.stage { position: relative; }
.slides { list-style: none; margin: 0; padding: 0; position: relative; touch-action: pan-y pinch-zoom; }
.slide { display: none; }
.slide.is-current { display: block; }
html:not(.js) .slide { display: block; margin-bottom: 1rem; }
.slide img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 9;
  background: var(--slide-bg); border: 1px solid var(--hair); border-radius: 6px;
  cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
}
.progress { height: 2px; margin-top: 10px; background: var(--bar-track); border-radius: 2px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--bar); transition: width 0.2s ease-out; }

.controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-family: var(--font-sans); }
.controls .spacer { flex: 1; }
.ctrl {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 38px; height: 34px; padding: 0 10px;
  font: 12.5px/1 var(--font-sans); color: var(--fg2); background: transparent;
  border: 1px solid var(--border-soft); border-radius: 20px; cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.ctrl:hover:not(:disabled) { color: var(--fg); background: var(--bg-code); }
.ctrl:disabled { opacity: 0.4; cursor: default; }
.ctrl:focus-visible, .slide img:focus-visible, .sources a:focus-visible, .deck-links a:focus-visible,
.top-nav a:focus-visible, .navbar-logo a:focus-visible, footer a:focus-visible, .post-meta-row a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.ctrl svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.counter { font-size: 12.5px; color: var(--fg4); font-variant-numeric: tabular-nums; min-width: 4.6em; text-align: center; letter-spacing: 0.02em; }
.ctrl .fs-label { font-size: 12px; }
@media (pointer: coarse) { .ctrl { min-width: 44px; height: 44px; } }

.sources { margin-top: 12px; font: 12.5px/1.55 var(--font-sans); color: var(--fg5); }
.sources .src-label { font-size: 10.5px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; color: var(--fg5); margin-right: 8px; }
.sources ul { display: inline; list-style: none; margin: 0; padding: 0; }
.sources li { display: inline; }
.sources li + li::before { content: "\00b7"; margin: 0 7px; color: #67676770; }
.sources a {
  color: var(--fg4); text-decoration: underline; text-decoration-color: #67676740;
  text-underline-offset: 2px; text-decoration-thickness: 1px; overflow-wrap: anywhere;
}
.sources a:hover { color: var(--link-hover); text-decoration-color: #1d4ed870; }
.sources .none { font-style: italic; }
.hint { margin-top: 1.4rem; font: 12.5px/1.5 var(--font-sans); color: var(--fg5); }
.hint code { font-size: 11.5px; }
.hint kbd { font-family: inherit; font-size: 11.5px; border: 1px solid var(--border-soft); border-radius: 3px; padding: 0 5px; color: var(--fg3); }

footer {
  max-width: 660px; margin: 3.5rem auto 0; padding-top: 1.4rem;
  border-top: 1px solid #67676726; font-family: var(--font-sans); font-size: 13px; color: var(--fg4); text-align: center;
}

/* Full screen (native, or a fixed overlay where the API is missing). */
.stage.is-fs {
  position: fixed; inset: 0; z-index: 1000; width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  padding: 12px 16px calc(10px + env(safe-area-inset-bottom)); background: #000;
  --fg2: #d6d6d6; --fg4: #b0b0b0; --border-soft: #ffffff30; --bg-code: #ffffff14; --bar-track: #ffffff1f; --bar: #8fb4ff;
}
.stage.is-fs .slides { flex: 1 1 auto; min-height: 0; }
.stage.is-fs .slide.is-current { height: 100%; }
.stage.is-fs .slide img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; border: 0; border-radius: 0; background: transparent; }
.stage.is-fs .ctrl:hover:not(:disabled) { color: #fff; }

/* Embed mode (?embed=1): the iframe inside a blog post. */
html.embed .site-header, html.embed .page-head, html.embed .hint, html.embed footer { display: none; }
html.embed body { font-size: 16px; }
html.embed #main { max-width: none; padding: 0 1px 2px; }
html.embed .viewer { margin-top: 0; }
html.embed .sources { max-height: 6.4em; overflow-y: auto; }

@media (max-width: 600px) {
  #main { padding: 0 16px 2.5rem; }
  .page-head { padding-top: 2.6rem; }
  .page-head h1 { font-size: 28px; }
  .deck-links { gap: 4px 16px; }
  .deck-links .sep { display: none; }
  .controls { gap: 8px; }
  .ctrl .fs-label { display: none; }
}
@media (prefers-reduced-motion: reduce) { .progress span { transition: none; } }
@media print {
  .site-header, .controls, .progress, .hint, .theme-toggle { display: none !important; }
  .slide { display: block !important; break-inside: avoid; margin-bottom: 1rem; }
}
