:root {
  --brand: var(--color-purple);
  --accent: var(--color-red);
  --global-bg: #fff;
  --global-bg-invert: #000;
  --bg: #f6f0f0;
  --fg: #122;
  --fg-h1: var(--fg);
  --fg-h2: var(--fg);
  --fg-h3: var(--fg);
  --fg-lead: var(--color-purple);
  --chapter-bg: linear-gradient(
    135deg,
    color-mix(in srgb, var(--brand) 12%, #fff),
    #fff
  );
  --misc-bg: linear-gradient(to top, rgb(0 0 0 / 0.4), transparent);
  --misc-fg: #111;
  --pagenum-bg: rgb(0 0 0 / 0.45);
  --pill-bg: rgb(255 255 255 / 0.4);
  --pill-line: rgb(255 255 255 / 0.2);
  --line: #ccc;
  --line-light: #ddd;
  --fs-5xl: 64px;
  --fs-4xl: 56px;
  --fs-3xl: 48px;
  --fs-2xl: 40px;
  --fs-xl: 28px;
  --fs-lg: 20px;
  --fs-md: 16px;
  --fs-sm: 14px;
  --fs-xs: 12px;
  --fs-2xs: 10px;
  --fs-3xs: 8px;
  --pad: 32px;
  --gap: 16px;
  --radius: 16px;
  --shadow: 0 10px 30px rgb(0 0 0 / 0.12);
}

:root[data-theme=dark] {
  --global-bg: #0b1220;
  --global-bg-invert: #f4eddf;
  --bg: #0f1628;
  --fg: #e5e7eb;
  --chapter-bg:
    radial-gradient(
      1200px 600px at 20% 20%,
      rgb(255 255 255 / 0.06),
      transparent
    ),
    linear-gradient(135deg, #0f1628, #0b1220);
  --misc-bg: linear-gradient(to top, rgb(255 255 255 / 0.2), transparent);
  --misc-fg: #fff;
  --pagenum-bg: rgb(0 0 0 / 0.45);
  --pill-bg: rgb(255 255 255 / 0.2);
  --pill-line: rgb(255 255 255 / 0.2);
  --line: #143677;
  --line-light: #1f2937;
}
:root[data-theme=dark] table thead th {
  background: var(--global-bg);
}
:root[data-theme=dark] pre {
  background: var(--global-bg);
}

html {
  scroll-behavior: smooth;
}

body {
  -webkit-text-size-adjust: 100%;
  overflow-wrap: anywhere;
  color: var(--fg);
  background: var(--global-bg);
  font-family: var(--font-sans);
  line-height: 1.45;
}

table {
  overflow-wrap: break-word;
}

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

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

code {
  display: inline-block;
  margin-block: 4px;
}

.unstyled {
  margin: 0;
  padding: 0;
  border: 0;
  background: 0;
  color: inherit;
  font: inherit;
}

.wrapper {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

.deck {
  position: relative;
  width: calc(var(--slide-w, 1600) * 1px);
  height: calc(var(--slide-h, 900) * 1px);
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: var(--shadow);
  outline: none;
}

.misc {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  color: var(--misc-fg);
}

.slides {
  position: absolute;
  inset: 0 0 50px;
  z-index: 0;
}

.slide {
  position: absolute;
  inset: 0;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--gap);
  opacity: 0;
  transform: translateX(4%);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  visibility: hidden;
  z-index: 0;
}

.slide[aria-hidden=false] {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  visibility: visible;
  z-index: 1;
}

.slide :is(h1, h2, h3) {
  margin-bottom: 16px;
  font-weight: bold;
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.slide h1 {
  color: var(--fg-h1);
  font-size: var(--fs-2xl);
}

.slide h2 {
  color: var(--fg-h2);
  font-size: var(--fs-xl);
}

.slide h3 {
  color: var(--fg-h3);
  font-size: var(--fs-lg);
}

.slide :is(ul, ol) {
  margin-left: 36px;
  list-style: revert;
}

.slide p,
.slide li {
  font-size: var(--fs-md);
}

.slide a {
  color: inherit;
}

.slide a:hover {
  text-decoration: none;
}

.x-red {
  color: #f00 !important;
}

.x-green {
  color: #090 !important;
}

.x-cyan {
  color: #008B8B !important;
}

.x-gold {
  color: #996515 !important;
}

.slide strong {
  color: var(--accent);
}

.slide :is(h1, h2, h3):not(:first-child) {
  margin-top: 16px;
}

.slide .kicker + :is(h1, h2, h3) {
  margin-top: 0;
}

.slide :is(h1, h2, h3):has(+ .lead) {
  margin-bottom: 0;
}

.slide > * :is(p, ul, ol, table, pre, blockquote):not(:first-child) {
  margin-top: 8px;
}

.slide > * :is(li):not(:first-child) {
  margin-top: 4px;
}

.slide .lead {
  font-size: var(--fs-lg);
  color: var(--fg-lead);
}

.slide .kicker {
  font: 600 var(--fs-sm)/1 var(--font-sans);
  letter-spacing: 0.12em;
  color: var(--accent);
}

.slide.chapter {
  background: var(--chapter-bg);
  display: grid;
  align-content: center;
  justify-items: start;
}

.slide.chapter :is(h1, h2, h3) {
  color: var(--brand);
  font-size: var(--fs-4xl);
}

.mod-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mod-block > * {
  flex: 1 1 0;
  border: 1px solid var(--line-light);
}

.mod-block .block {
  padding: 8px;
}

.mod-block .block.x-fit {
  flex: 0 0 auto;
  padding: 0;
}

table[data-full-column] :is(th, td) {
  width: 0;
  white-space: nowrap;
}

table[data-full-column="1"] :is(th, td):nth-child(1) {
  width: auto;
  white-space: normal;
}

table[data-full-column="2"] :is(th, td):nth-child(2) {
  width: auto;
  white-space: normal;
}

table[data-full-column="3"] :is(th, td):nth-child(3) {
  width: auto;
  white-space: normal;
}

table[data-full-column="4"] :is(th, td):nth-child(4) {
  width: auto;
  white-space: normal;
}

table[data-full-column="5"] :is(th, td):nth-child(5) {
  width: auto;
  white-space: normal;
}

table[data-full-column="6"] :is(th, td):nth-child(6) {
  width: auto;
  white-space: normal;
}

table[data-full-column="7"] :is(th, td):nth-child(7) {
  width: auto;
  white-space: normal;
}

table[data-full-column="8"] :is(th, td):nth-child(8) {
  width: auto;
  white-space: normal;
}

table[data-full-column="9"] :is(th, td):nth-child(9) {
  width: auto;
  white-space: normal;
}

.misc-controls {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--misc-bg);
  z-index: 5;
  pointer-events: none;
}

.misc-controls .pill {
  pointer-events: auto;
  background: var(--pill-bg);
  border: 1px solid var(--pill-line);
  backdrop-filter: blur(6px);
  padding: 6px 10px;
  border-radius: 9999px;
  font: 600 var(--fs-3xs)/1 var(--font-sans);
}

.misc-controls .pill a {
  color: inherit;
  font-family: bold;
}

.misc-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  background: var(--accent);
  width: 0%;
  transition: width 0.25s linear;
  z-index: 5;
}

.misc-pagenum {
  position: absolute;
  right: 12px;
  bottom: 8px;
  z-index: 6;
  font: 600 var(--fs-xs)/1 var(--font-sans);
  color: #fff;
  background: var(--pagenum-bg);
  padding: 4px 8px;
  border-radius: 8px;
}

.slide .toc-list {
  columns: 2;
  gap: 2.2rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.slide .toc-list li {
  break-inside: avoid;
  margin: 0.3rem 0;
  font-size: var(--fs-md);
}

.slide .toc-list a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--fg) 40%, transparent);
}

.slide .toc-list a:hover {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

@media print {
  @page {
    size: A4 landscape;
    margin: 6mm;
  }
  body {
    background: #fff;
  }
  .wrapper {
    position: static;
    display: block;
  }
  .deck {
    width: auto;
    height: auto;
    box-shadow: none;
    border: none;
  }
  .slide {
    position: static;
    break-after: always;
    opacity: 1 !important;
    transform: none !important;
  }
  .misc-controls,
  .misc-progress {
    display: none !important;
  }
  .misc-pagenum {
    position: static;
    color: #111;
    background: transparent;
    text-align: right;
    padding: 0;
    margin-top: 2rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .slide {
    transition: none;
  }
}
