:root {
  --scale: 1;
  --font-size: calc(1.15rem * var(--scale));
  --bg: #f6f4ef;
  --fg: #1b1b1b;
  --muted: #5c5c5c;
  --accent: #0f62fe;
  --footer-bg: color-mix(in srgb, var(--bg) 88%, var(--fg) 12%);
  --code-bg: color-mix(in srgb, var(--bg) 86%, var(--fg) 14%);
  --sidebar-bg: color-mix(in srgb, var(--bg) 92%, var(--fg) 8%);
  --sidebar-width: 16.5rem;
  --max-width: 56rem;
}

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

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  background: var(--bg);
  color: var(--fg);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: var(--font-size);
  line-height: 1.45;
}

body.has-sidebar {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.slide-sidebar {
  display: none;
  grid-column: 1;
  grid-row: 1 / -1;
  background: var(--sidebar-bg);
  border-right: 1px solid color-mix(in srgb, var(--fg) 12%, transparent);
  padding: 1.25rem 0.9rem 1.5rem;
  overflow: auto;
  font-size: 0.95rem;
}

.has-sidebar .slide-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-heading {
  margin: 0 0.55rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.slide-sidebar nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}

.slide-sidebar a {
  display: block;
  color: inherit;
  text-decoration: none;
  padding: 0.45rem 0.65rem;
  border-radius: 0.55rem;
  line-height: 1.3;
}

.slide-sidebar a:hover {
  background: color-mix(in srgb, var(--fg) 8%, transparent);
}

.slide-sidebar a.is-current {
  background: var(--accent);
  color: #fff;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  height: 2.4rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--fg) 18%, transparent);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--fg);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.has-sidebar .slide,
.has-sidebar .slide-footer {
  grid-column: 2;
}

.slide {
  width: min(var(--max-width), calc(100% - 3rem));
  margin: 0 auto;
  padding: 8vh 0 2rem;
  min-width: 0;
}

.slide > :first-child {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.4em;
  margin-bottom: 0.4em;
}

h2 {
  font-size: 1.7em;
}

p,
ul,
ol,
pre,
blockquote {
  max-width: 65ch;
}

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

code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 0.3em;
}

pre {
  background: var(--code-bg);
  padding: 1rem 1.2rem;
  overflow: auto;
  border-radius: 0.6rem;
  max-width: 100%;
}

pre code {
  background: transparent;
  padding: 0;
}

pre.shiki {
  background: var(--shiki-light-bg, var(--shiki-dark-bg, var(--code-bg)));
}

pre.shiki code {
  font-size: 0.82em;
  display: block;
  line-height: 1.55;
}

pre.shiki .line {
  display: inline-block;
  min-height: 1.2em;
}

.slide-footer {
  display: grid;
  grid-template-columns: 3.2rem 1fr 3.2rem;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--footer-bg);
  border-top: 1px solid color-mix(in srgb, var(--fg) 12%, transparent);
}

.sidebar-backdrop {
  display: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  color: var(--fg);
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--fg) 18%, transparent);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.nav-link svg {
  width: 1.35rem;
  height: 1.35rem;
}

.nav-link:hover:not(.is-disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.nav-link.is-disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.slide-meta {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.72em;
  color: var(--muted);
}

.home-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.home-link:hover {
  color: var(--accent);
}

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

@media (max-width: 900px) {
  body.has-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }

  .has-sidebar .slide,
  .has-sidebar .slide-footer {
    grid-column: 1;
  }

  .has-sidebar .slide-sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-width), 86vw);
    z-index: 4;
    box-shadow: 8px 0 24px rgb(0 0 0 / 18%);
  }

  body.sidebar-open .slide-sidebar {
    display: flex;
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 3;
    border: 0;
    background: rgb(0 0 0 / 35%);
    cursor: pointer;
  }

  .has-sidebar .sidebar-toggle {
    display: inline-flex;
  }

  .has-sidebar .slide-footer {
    grid-template-columns: auto 3.2rem 1fr 3.2rem;
  }
}

@media (max-width: 720px) {
  body {
    font-size: calc(var(--font-size) * 0.88);
  }

  .slide {
    width: min(100%, calc(100% - 1.5rem));
    padding-top: 4vh;
  }
}
