:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #0b1220;
  --muted: #5b6473;
  --accent: #6b5cff;
  --accent-2: #22d3ee;
  --border: #e6e9f2;
  --shadow: 0 6px 24px rgba(20, 24, 40, 0.06), 0 2px 6px rgba(20, 24, 40, 0.04);
  --ring: 0 0 0 3px rgba(107, 92, 255, 0.35);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #0f1530;
  --text: #eaf1ff;
  --muted: #a9b2c6;
  --accent: #8b82ff;
  --accent-2: #22d3ee;
  --border: #1d2442;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 3px rgba(34, 211, 238, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.container {
  max-width: 78ch;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--surface) 60%, var(--accent-2) 4%) 0%,
    var(--surface) 65%
  );
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand a {
  font-weight: 750;
  color: var(--text);
}

.site-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--shadow), var(--ring);
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle__icon {
  font-size: 1rem;
  line-height: 1;
}

.theme-toggle__label {
  font-size: 0.9rem;
}

.theme-toggle[data-theme-state="dark"] .theme-toggle__icon--sun {
  display: none;
}

.theme-toggle[data-theme-state="light"] .theme-toggle__icon--moon {
  display: none;
}

nav ul {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

nav a {
  display: inline-block;
  padding: 0.55rem 0.8rem;
  border-radius: 0.75rem;
  font-weight: 600;
}

nav a[aria-current="page"] {
  background: var(--bg);
  border: 1px solid var(--border);
}

@media (max-width: 720px) {
  .site-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .site-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .site-actions nav {
    width: 100%;
  }

  .site-actions nav ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .site-actions nav a {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.5rem 0.6rem;
  }

  .theme-toggle {
    align-self: flex-end;
  }
}

.hero {
  padding: 1.25rem 0 0.7rem;
}

.hero h1 {
  line-height: 1.2;
  margin: 0.35rem 0 0;
  font-size: clamp(1.75rem, 3vw + 0.4rem, 2.5rem);
}

.lede {
  color: var(--muted);
  font-size: 1.06rem;
}

section.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  padding: 1.1rem 1rem;
  margin: 1.1rem 0;
  box-shadow: var(--shadow);
}

#tldr.card {
  margin: 0.7rem 0 1rem;
  padding: 0.85rem 0.9rem;
  box-shadow: none;
  background: color-mix(in oklab, var(--surface) 88%, var(--bg));
  border-color: color-mix(in oklab, var(--border) 70%, transparent);
}

#tldr h2 {
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
}

#tldr .small {
  font-size: 0.93rem;
}

.small {
  font-size: 0.95rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.65rem 0.95rem;
  border-radius: 0.9rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(107, 92, 255, 0.18);
}

:root[data-theme="dark"] .btn {
  background: var(--accent);
  color: var(--surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

:root[data-theme="dark"] .btn:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

section.faq.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 1.1rem 1rem;
  margin: 1.1rem 0;
  box-shadow: var(--shadow);
}

section.faq h2 {
  margin-top: 0;
}

.faq details {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  margin: 0.75rem 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg), transparent);
}

.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1rem;
  font-weight: 700;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq details[open] summary {
  border-bottom: 1px solid var(--border);
}

.faq .answer {
  padding: 1rem;
}

.faq .answer p {
  margin: 0.6rem 0;
}

.faq .answer ul {
  padding-left: 1.2rem;
}

@media (prefers-reduced-motion:no-preference) {
  .faq details {
    transition: background 0.2s ease;
  }

  .faq details[open] {
    background: var(--surface);
  }
}

section.cite.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 1.1rem 1rem;
  margin: 1.1rem 0;
  box-shadow: var(--shadow);
}

section.cite h2 {
  margin-top: 0;
}

.cite .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.cite details {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  margin: 0.75rem 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg), transparent);
}

.cite summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1rem;
  font-weight: 700;
}

.cite summary::-webkit-details-marker {
  display: none;
}

.cite details[open] summary {
  border-bottom: 1px solid var(--border);
}

.cite .body {
  padding: 1rem;
}

.cite .body p {
  margin: 0.6rem 0;
}

.cite .body ul {
  padding-left: 1.2rem;
}

nav.breadcrumbs {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.2rem 0 0.35rem;
}

nav.breadcrumbs ol {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

nav.breadcrumbs li + li::before {
  content: "›";
  color: currentColor;
}

nav.breadcrumbs a {
  color: inherit;
}

.pod-summary {
  margin: 0.4rem 0 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.pod-summary summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-weight: 600;
}

.pod-summary .answer {
  padding: 0 1rem 1rem;
}

.pod-summary[open] {
  background: var(--surface);
}

.slides-toc {
  position: sticky;
  top: 4.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 0.5rem 0.75rem;
  z-index: 2;
}

.slides-toc ul {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.slides-toc a {
  display: inline-block;
  min-width: 2ch;
  text-align: center;
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  text-decoration: none;
}

.slides-toc a:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.slides-controls {
  position: sticky;
  top: 4.25rem;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  box-shadow: var(--shadow);
  margin-top: 0.5rem;
}

.slides-controls .controls-left {
  justify-self: start;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.slides-controls .controls-center {
  justify-self: center;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.slides-controls .controls-right {
  justify-self: end;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.slides-controls button {
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 0.4rem 0.7rem;
  border-radius: 0.6rem;
  cursor: pointer;
}

.slides-controls button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn-ctrl {
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  padding: 0.45rem 0.7rem;
  border-radius: 0.6rem;
  cursor: pointer;
}

.btn-ctrl:hover {
  filter: brightness(1.03);
}

:root[data-theme="dark"] .btn-ctrl {
  background: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 70%, transparent);
  color: var(--surface);
}

:root[data-theme="dark"] .btn-ctrl:hover {
  filter: brightness(1.07);
}

.btn-ghost {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 0.6rem;
  cursor: pointer;
}

.btn-ghost:hover {
  filter: brightness(1.02);
}

.slides-viewport {
  position: relative;
}

.slide {
  display: none;
  margin: 0;
}

.slide.is-active {
  display: block;
}

.slide-figure {
  display: block;
}

.slide-figure img {
  aspect-ratio: 16 / 9;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  display: block;
  background: var(--bg);
}

.slide-figure figcaption {
  display: none;
  margin-top: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 0.7rem 0.8rem;
}

#slides[data-notes="on"] .slide-figure figcaption {
  display: block;
}

.slide-figure h3 {
  margin: 0.1rem 0 0.4rem;
  font-size: 1.05rem;
}

.slide-figure .summary {
  margin: 0.25rem 0;
  color: var(--muted);
}

.slide-figure .focus {
  margin: 0.25rem 0;
  padding-left: 1rem;
}

.slide-figure .focus li {
  margin: 0.15rem 0;
}

@media (min-width: 920px) {
  .slide-figure {
    grid-template-columns: 2fr 1.1fr;
    align-items: start;
  }
}

.slides-index {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface);
  scroll-snap-type: x mandatory;
  margin-top: 0.75rem;
}

.slides-index .thumb {
  flex: 0 0 auto;
  scroll-snap-align: center;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.2rem;
  text-decoration: none;
}

.slides-index img {
  display: block;
  height: 76px;
  width: auto;
  border-radius: 0.3rem;
}

#slides-index {
  flex-wrap: nowrap;
  overflow-y: hidden;
  padding: 0.25rem 0;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

#slides-index .thumb {
  flex: 0 0 auto;
  display: inline-block;
}

#slides-index img {
  height: auto;
  max-height: 96px;
}

#slides-index .thumb.is-active img {
  outline: 3px solid;
}

#slides figcaption[hidden] {
  display: none !important;
}

.slides-sections {
  margin: 0.6rem 0 0.2rem;
}

.slides-sections ul {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.slides-sections a {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  text-decoration: none;
}

.jump-panel {
  margin: 0.6rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  box-shadow: var(--shadow);
  padding: 0.6rem 0.6rem;
}

.jump-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.jump-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.jump-list button {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  cursor: pointer;
}

.jump-list button:hover {
  filter: brightness(1.03);
}

.slides-collapsible {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.25rem 0.5rem;
}

.slides-collapsible > summary {
  font-size: 1.05rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  list-style: none;
  cursor: pointer;
  padding: 0.8rem 1rem;
  border-radius: 0.9rem;
}

.slides-collapsible > summary::-webkit-details-marker {
  display: none;
}

.slides-collapsible > summary .summary-title {
  font-weight: 800;
}

.slides-collapsible > summary .summary-sub {
  color: var(--muted);
  font-size: 0.95rem;
}

.slides-collapsible[open] {
  padding: 0.5rem;
}

.slides-collapsible[open] > summary {
  background: color-mix(in oklab, var(--bg) 70%, var(--accent) 6%);
  border: 1px solid var(--border);
}

.slides-collapsible[open] > summary .summary-title {
  font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (max-width: 720px) {
  .slides-index {
    display: none;
  }
}

#slides[data-thumbs="on"] .slides-index {
  display: flex;
}

#slides[data-thumbs="on"] #slides-index {
  display: flex;
}

#slides[data-thumbs="off"] .slides-index {
  display: none;
}

#slides[data-thumbs="off"] #slides-index {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

#slide-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1000;
}

#slide-overlay[hidden] {
  display: none;
}

#slide-overlay .overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 30, 0.7);
  backdrop-filter: blur(2px);
}

#slide-overlay .overlay-figure {
  position: relative;
  max-width: min(96vw, 1200px);
  margin: 0;
  padding: 0;
}

#slide-overlay img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.6rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

#slide-overlay #overlay-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 0.5rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
}

#slide-overlay #overlay-caption {
  margin-top: 0.4rem;
  color: #fff;
}
