:root {
  color-scheme: light;
  /* --light-level (0 to 100) is set by the slider in the header: 0 is pure white, 100 the softest off-white. */
  /* Colours follow the logo: teal (#008878) leads, purple (#a044db) is the second accent. */
  --bg: color-mix(in srgb, #ffffff, #e8eeef calc(var(--light-level) * 1%));
  --header-bg: color-mix(in srgb, var(--bg) 96%, transparent);
  --chip-bg: color-mix(in srgb, #eff4f4, #e0e8e9 calc(var(--light-level) * 1%));
  --surface: color-mix(in srgb, #ffffff, #f4f8f8 calc(var(--light-level) * 1%));
  --surface-2: color-mix(in srgb, #edf3f3, #e1e9ea calc(var(--light-level) * 1%));
  --ink: #13201f;
  --muted: #5a6a6b;
  --line: color-mix(in srgb, #d3dfe0, #c3d1d3 calc(var(--light-level) * 1%));
  /* A shade deeper than the logo teal, so links stay readable on the softest background. */
  --accent: #007a6c;
  --accent-2: #006b5f;
  --accent-soft: #e0f4f1;
  --accent-ink: #00403a;
  --accent-alt: #8a2fc4;
  --github-ink: #181717;
  --on-accent: #ffffff;
  /* The road the buggy from the logo drives on. */
  --road: #1d2c2f;
  --road-line: rgba(255, 255, 255, 0.6);
  /* The site's arrow: a plain arrow with the logo's speed lines behind it. */
  --arrow-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 20' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 5 8.5 7M1.5 12 7.5 14M13 10h17M23.5 3.5 30 10l-6.5 6.5'/%3E%3C/svg%3E");
  --code-bg: #0f1b1d;
  --code-ink: #eef6f6;
  --code-key: #8bd3ff;
  --code-string: #ffd38a;
  --code-value: #7ee6d3;
  --code-comment: #7f9496;
  --code-keyword: #d3a6f7;
  --code-type: #7dd3fc;
  --code-func: #f0abfc;
  --radius: 8px;
  --dark-level: 40;
  --light-level: 40;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

/* Dark theme: follows the system until the reader picks one with the toggle in the header. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    /* --dark-level (0 to 100) is set by the slider in the header: 0 is the darkest, 100 the lightest. */
    --bg: color-mix(in srgb, #0b1315, #283d41 calc(var(--dark-level) * 1%));
    --header-bg: color-mix(in srgb, var(--bg) 92%, transparent);
    --chip-bg: color-mix(in srgb, #19272a, #3d5559 calc(var(--dark-level) * 1%));
    --surface: color-mix(in srgb, #111b1e, #30474b calc(var(--dark-level) * 1%));
    --surface-2: color-mix(in srgb, #172427, #384f53 calc(var(--dark-level) * 1%));
    --ink: #e8f1f1;
    --muted: #a3b4b6;
    --line: color-mix(in srgb, #233236, #4a6266 calc(var(--dark-level) * 1%));
    --accent: #2bbfa9;
    --accent-2: #64dcc9;
    --accent-soft: rgba(43, 191, 169, 0.15);
    --accent-ink: #b5f0e6;
    --accent-alt: #c084f0;
    --on-accent: #0b1315;
    --road: #060b0d;
    --github-ink: #ffffff;
    --code-bg: color-mix(in srgb, #070d0f, #1a2a2d calc(var(--dark-level) * 1%));
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  /* --dark-level (0 to 100) is set by the slider in the header: 0 is the darkest, 100 the lightest. */
  --bg: color-mix(in srgb, #0b1315, #283d41 calc(var(--dark-level) * 1%));
  --header-bg: color-mix(in srgb, var(--bg) 92%, transparent);
  --chip-bg: color-mix(in srgb, #19272a, #3d5559 calc(var(--dark-level) * 1%));
  --surface: color-mix(in srgb, #111b1e, #30474b calc(var(--dark-level) * 1%));
  --surface-2: color-mix(in srgb, #172427, #384f53 calc(var(--dark-level) * 1%));
  --ink: #e8f1f1;
  --muted: #a3b4b6;
  --line: color-mix(in srgb, #233236, #4a6266 calc(var(--dark-level) * 1%));
  --accent: #2bbfa9;
  --accent-2: #64dcc9;
  --accent-soft: rgba(43, 191, 169, 0.15);
  --accent-ink: #b5f0e6;
  --accent-alt: #c084f0;
  --on-accent: #0b1315;
  --road: #060b0d;
  --github-ink: #ffffff;
  --code-bg: color-mix(in srgb, #070d0f, #1a2a2d calc(var(--dark-level) * 1%));
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent-2);
}

.theme-toggle .icon-sun,
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  /* Keeps the footer at the bottom of the window on short pages. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

:is(a, button, summary, input):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

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

/* Links that leave the site open in a new tab and carry a small arrow. */
a[target="_blank"]:not(.social-link)::after {
  content: "";
  content: "" / " (opens in a new tab)";
  display: inline-block;
  flex: none;
  width: 0.7em;
  height: 0.7em;
  margin-left: 0.28em;
  vertical-align: 0.04em;
  background-color: currentColor;
  opacity: 0.7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.top-links a[target="_blank"]:not(.social-link)::after {
  margin-left: -2px;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 13px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  width: auto;
  height: 56px;
  flex: none;
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 18px;
  font-size: 14px;
}

/* Brightness slider and theme toggle, set apart from the page links. */
.theme-controls {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

/* GitHub and Slack as icon buttons at the far right of the header and in the footer. */
.social-link {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  color: var(--muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.top-links .social-link {
  display: inline-grid;
}

.top-links .theme-controls + .social-link {
  margin-left: -4px;
}

.top-links .social-link + .social-link {
  margin-left: -14px;
}

.social-link:hover,
.top-links .social-link:hover,
.social-link:focus-visible {
  background: var(--chip-bg);
  color: var(--ink);
}

/* On hover, each icon shows its own brand colours. */
.social-github:is(:hover, :focus-visible),
.top-links .social-github:is(:hover, :focus-visible) {
  color: var(--github-ink);
}

.social-slack path {
  transition: fill 0.15s ease;
}

.social-slack:is(:hover, :focus-visible) .slack-red {
  fill: #e01e5a;
}

.social-slack:is(:hover, :focus-visible) .slack-blue {
  fill: #36c5f0;
}

.social-slack:is(:hover, :focus-visible) .slack-green {
  fill: #2eb67d;
}

.social-slack:is(:hover, :focus-visible) .slack-yellow {
  fill: #ecb22e;
}

.top-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
}

.top-links a:hover,
.top-links a:focus-visible {
  color: var(--accent-2);
}

.nav-icon {
  flex: none;
}

.top-links :is(a, button)[data-tip]::before {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: max-content;
  max-width: 240px;
  padding: 7px 10px;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  box-shadow: 0 6px 20px rgba(11, 19, 21, 0.22);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.top-links :is(a, button)[data-tip]:hover::before,
.top-links :is(a, button)[data-tip]:focus-visible::before {
  opacity: 1;
  transform: none;
}

@media (hover: none) {
  .top-links :is(a, button)[data-tip]::before {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .top-links :is(a, button)[data-tip]::before {
    transition: none;
  }
}

.guide-layout {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 34px;
  padding: 30px 22px 68px;
}

.sidebar {
  position: sticky;
  /* Below the sticky header, which is about 83px tall with the logo. */
  top: 100px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.sidebar-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chapter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 2px;
}

.chapter-list a {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: baseline;
  gap: 8px;
  padding: 8px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.chapter-list a:hover,
.chapter-list a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--ink);
}

.chapter-list .num {
  color: var(--accent);
  font-weight: 780;
  font-size: 12px;
}

.content {
  max-width: 880px;
}

.chapter-label {
  margin: 0 0 8px;
  color: var(--accent-alt);
  font-size: 13px;
  font-weight: 780;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.page-title {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.08;
  letter-spacing: 0;
}

.intro {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 19px;
  max-width: 760px;
}

.section {
  margin: 34px 0;
}

.section h2 {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.section h3 {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: 0;
}

p {
  margin: 0 0 14px;
}

.short {
  color: var(--muted);
}

.example {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.example-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.example-title a {
  font-weight: 650;
}

pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 13px;
  line-height: 1.45;
}

pre .tok-key,
pre .tok-func {
  color: var(--code-key);
}

pre .tok-string {
  color: var(--code-string);
}

pre .tok-value {
  color: var(--code-value);
}

pre .tok-comment {
  color: var(--code-comment);
  font-style: italic;
}

pre .tok-keyword {
  color: var(--code-keyword);
}

pre .tok-type {
  color: var(--code-type);
}

pre .tok-command {
  color: var(--code-func);
}

code {
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, ui-monospace, monospace;
}

:not(pre) > code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--chip-bg);
  color: var(--ink);
  /* Highlighted words in a sentence keep the sentence's font; only code blocks use the monospace face. */
  font-family: inherit;
  font-size: inherit;
}

.note {
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  padding: 14px 16px;
}

.note p:last-child {
  margin-bottom: 0;
}

/* FAQ: each question is closed until the reader opens it. */
.faq-list {
  display: grid;
  gap: 12px;
  margin: 28px 0 34px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

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

.faq-item summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item[open] summary::after {
  transform: rotate(-135deg);
}

.faq-item summary:hover h2 {
  color: var(--accent-2);
}

.faq-item summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

.faq-item summary h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.faq-body {
  box-sizing: border-box;
  padding: 0 20px 20px;
}

.faq-body > :last-child {
  margin-bottom: 0;
}

.step-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.step-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px;
}

.step-list .step-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 780;
  font-size: 13px;
}

.step-list strong {
  display: block;
  margin-bottom: 3px;
}

.step-list span {
  color: var(--muted);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.mini-card strong {
  display: block;
  margin-bottom: 6px;
}

.mini-card span {
  color: var(--muted);
}

.mini-card p:last-child {
  margin-bottom: 0;
}

.horizontal-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-2);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.link-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.link-list a {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  text-decoration: none;
  font-weight: 680;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 42px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.page-nav a {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 16px;
  text-decoration: none;
  font-weight: 730;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.page-nav a small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page-nav .page-nav-next {
  margin-left: auto;
  align-items: flex-end;
  text-align: right;
}

.page-nav a:hover,
.link-list a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.link-list a {
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

/* Site footer, the same on every page. */
.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 48px 22px 28px;
  font-size: 14px;
}

.footer-inner {
  /* Lines up with the header, whose 1240px includes 22px of padding on each side. */
  max-width: 1196px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: 40px;
}

.footer-logo {
  display: inline-block;
}

.footer-logo img {
  display: block;
  width: auto;
  height: 48px;
}

.footer-brand p {
  max-width: 340px;
  margin: 14px 0 0;
  line-height: 1.6;
}

.footer-social {
  display: flex;
  gap: 6px;
  margin: 16px 0 0 -8px;
}

.footer-col h2 {
  margin: 4px 0 14px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-col ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-col a {
  color: var(--muted);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  max-width: 1196px;
  margin: 36px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: 13px;
}

@media (max-width: 920px) {
  .footer-inner {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px 24px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .theme-controls {
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 560px) {
  .footer-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-nav a {
    min-width: 0;
  }

  .page-nav .page-nav-next {
    margin-left: 0;
  }
}

@media (max-width: 920px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-links {
    justify-content: flex-start;
  }

  .guide-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .sidebar {
    position: static;
  }

  .chapter-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .horizontal-list {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 560px) {
  .header-inner,
  .guide-layout,
  .footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .chapter-list {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 34px;
  }

  .intro {
    font-size: 17px;
  }

  .page-nav {
    flex-direction: column;
  }
}

/* Core concepts: where a profile sits among the tools around it */
.chain {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0;
}

.chain span {
  flex: 1;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 15px;
  font-weight: 650;
  text-align: center;
}

.table-wrap + .short,
.example + .table-wrap,
.example + .short,
.short + .example,
.short + .table-wrap {
  margin-top: 20px;
}

.example + .example,
.example + .short + .example {
  margin-top: 20px;
}

@media (max-width: 700px) {
  .chain {
    flex-direction: column;
  }

  .chain span {
    flex: none;
    width: 100%;
  }

  .chain i {
    transform: rotate(90deg);
  }
}

.chain span.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.chain i {
  color: var(--accent-alt);
  font-style: normal;
  font-weight: 800;
}

/* Code to profile: one tab for each language */
.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.tab-list [role="tab"] {
  margin-bottom: -1px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tab-list [role="tab"]:hover {
  color: var(--accent-2);
}

.tab-list [role="tab"][aria-selected="true"] {
  border-color: var(--line);
  border-bottom-color: var(--bg);
  background: var(--bg);
  color: var(--ink);
}

.tabs:not(.with-tabs) .tab-list {
  display: none;
}

.tab-panel h3 {
  margin: 22px 0 8px;
  font-size: 17px;
}

.tab-panel h3:first-child {
  margin-top: 0;
}

.tab-panel .example {
  margin: 10px 0 14px;
}

/* Install commands, one under another */
.cmds div {
  margin: 0 0 8px;
}

.cmds div:last-child {
  margin-bottom: 0;
}

.cmds code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.cmds .cmd-note {
  color: var(--muted);
  font-size: 14px;
}

td.cmds {
  width: 46%;
}

/* Brightness slider: sets the dark level in the dark theme and the light level in the light theme. */
.theme-level {
  display: inline-block;
  width: 72px;
  accent-color: var(--accent);
  cursor: pointer;
}

.figure {
  margin: 18px 0 22px;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ------------------------------------------------------------------
   Arrows, the home page stage explorer, and the buggy from the logo.
   ------------------------------------------------------------------ */

/* The site's arrow: the arrow takes the text colour, the speed lines take the logo's purple. */
.arrow {
  display: inline-block;
  flex: none;
  width: 1.7em;
  height: 1em;
  vertical-align: -0.12em;
  background: linear-gradient(90deg, var(--accent-alt) 0 32%, currentColor 32%);
  -webkit-mask: var(--arrow-mask) center / contain no-repeat;
  mask: var(--arrow-mask) center / contain no-repeat;
  transition: translate 0.25s ease;
}

.arrow-back {
  scale: -1 1;
}

.arrow-up {
  rotate: -90deg;
}

/* On a filled button the speed lines are a lighter shade of the button text. */
:is(.button-primary, .stage-btn-primary) .arrow {
  background: linear-gradient(90deg, color-mix(in srgb, currentColor 55%, transparent) 0 32%, currentColor 32%);
}

/* The logo revs a little when pointed at. */
.brand:hover .brand-logo {
  animation: buggy-rev 0.5s ease-in-out;
  transform-origin: 18% 85%;
}

@keyframes buggy-rev {
  0%, 100% { transform: none; }
  25% { transform: rotate(-3deg) translateX(-1px); }
  55% { transform: rotate(1.5deg) translateX(2px); }
  80% { transform: rotate(-0.6deg); }
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 720;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.button:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover {
  border-color: var(--accent-2);
  background: var(--accent-2);
  color: var(--on-accent);
}

.button:hover .arrow {
  translate: 4px 0;
}

/* Home page hero */
.home-main {
  flex: 1 0 auto;
}

.hero-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 22px 0;
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(ellipse 60% 90% at 0% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(ellipse 50% 80% at 100% 10%, color-mix(in srgb, var(--accent-alt) 14%, transparent), transparent 70%),
    var(--surface);
  --buggy-width: clamp(64px, 10vw, 124px);
  --road-height: 46px;
}

.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 40px;
  padding: 44px 44px 6px;
}

.hero .page-title {
  font-size: clamp(32px, 3.5vw, 46px);
}

.hero-lede {
  margin: 0;
  color: var(--muted);
  font-size: 19px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

/* The card that explains the current stage. */
.stage-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 14px 40px rgba(11, 19, 21, 0.1);
  padding: 20px 22px 14px;
}

/* Every panel sits in the same place, so the card keeps one height as the stages change. */
.stage-panels {
  display: grid;
}

.stage-panel {
  grid-area: 1 / 1;
  min-width: 0;
}

.stage-panel[hidden] {
  display: block;
  visibility: hidden;
}

.stage-panel:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
  border-radius: 6px;
}

.stage-kicker {
  margin: 0 0 4px;
  color: var(--accent-alt);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stage-title {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.2;
}

.stage-text {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
}

/* A small editor window for code and the profile. */
.stage-window {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
}

.stage-window-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--code-comment);
  font-size: 12px;
  font-weight: 650;
}

.stage-window-bar::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 30px;
  border-radius: 50%;
  background: #e26d5c;
  box-shadow: 13px 0 0 #e9b949, 26px 0 0 #5cbf87;
}

.stage-window pre {
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
}

.stage-window pre + .stage-window-bar {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Rows that fill in one after another, as the platform works through the profile. */
.stage-rows {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 14px;
}

.stage-row strong {
  display: block;
  font-size: 14px;
}

.stage-row small {
  color: var(--muted);
  font-size: 12.5px;
}

.stage-row code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, ui-monospace, monospace;
  font-size: 13px;
}

.stage-status {
  display: grid;
  justify-items: end;
}

.stage-status > span {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.status-wait {
  color: var(--muted);
  visibility: hidden;
}

.status-wait::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.status-done {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.status-done::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 10px no-repeat,
    var(--accent);
}

/* The app, up and running. */
.stage-running {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 720;
}

.stage-running span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.stage-running span::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22b573;
  box-shadow: 0 0 0 0 rgba(34, 181, 115, 0.5);
  animation: pulse 1.6s ease-out infinite;
}

.stage-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.stage-more:hover .arrow {
  translate: 4px 0;
}

@media (prefers-reduced-motion: no-preference) {
  .stage-panel.is-active .stage-row {
    animation: row-in 0.35s calc(var(--i, 0) * 0.45s + 0.1s) ease-out both;
  }

  .stage-panel.is-active .status-wait {
    animation: show-then-hide 0.6s calc(var(--i, 0) * 0.45s + 0.25s) both;
  }

  .stage-panel.is-active .status-done {
    animation: pop-in 0.3s calc(var(--i, 0) * 0.45s + 0.85s) cubic-bezier(0.3, 0, 0.2, 1.5) both;
  }
}

@keyframes row-in {
  from { opacity: 0; translate: 0 8px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes show-then-hide {
  0%, 99% { visibility: visible; }
  100% { visibility: hidden; }
}

@keyframes pop-in {
  from { opacity: 0; scale: 0.6; }
  to { opacity: 1; scale: 1; }
}

@keyframes spin {
  to { rotate: 360deg; }
}

@keyframes pulse {
  to { box-shadow: 0 0 0 8px rgba(34, 181, 115, 0); }
}

/* Back, play and next, under the stage. */
.stage-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.stage-nav .stage-btn-primary {
  margin-left: auto;
}

.stage-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.stage-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.stage-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.stage-btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.stage-btn-primary:hover:not(:disabled) {
  border-color: var(--accent-2);
  background: var(--accent-2);
}

.stage-btn:hover:not(:disabled) .arrow {
  translate: 3px 0;
}

.stage-btn:hover:not(:disabled) .arrow-back {
  translate: -3px 0;
}

.play-icon {
  width: 0;
  height: 0;
  border-block: 6px solid transparent;
  border-left: 10px solid currentColor;
}

.stage-play[aria-pressed="true"] .play-icon {
  width: 10px;
  height: 12px;
  border: 0;
  border-inline: 3.5px solid currentColor;
}

/* The road, with a stop for each stage. */
.hero-road {
  position: relative;
  height: calc(var(--road-height) + 112px);
}

/* Asphalt with a dashed centre line, and a curb in the logo's teal and purple. */
.hero-road::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: var(--road-height);
  border-top: 5px solid transparent;
  background:
    repeating-linear-gradient(90deg, var(--road-line) 0 28px, transparent 28px 56px) 0 55% / 100% 2px no-repeat,
    linear-gradient(var(--road), var(--road)) padding-box,
    repeating-linear-gradient(90deg, #008878 0 22px, #a044db 22px 44px) border-box;
}

.stage-stops {
  position: absolute;
  z-index: 2;
  left: calc(var(--buggy-width) + 56px);
  right: 64px;
  bottom: var(--road-height);
  display: flex;
  justify-content: space-between;
}

.stage-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

/* A sign on a post at the side of the road. */
.stop-sign {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(11, 19, 21, 0.08);
  font-size: 13.5px;
  font-weight: 720;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, translate 0.3s cubic-bezier(0.3, 0, 0.2, 1.6);
}

.stage-stop::after {
  content: "";
  width: 3px;
  height: 34px;
  background: var(--line);
}

.stop-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 780;
}

.stage-stop:hover .stop-sign {
  border-color: var(--accent);
  color: var(--ink);
}

.stage-stop.is-visited .stop-num {
  background: var(--accent-soft);
  color: var(--accent);
}

.stage-stop[aria-selected="true"] {
  color: var(--on-accent);
}

.stage-stop[aria-selected="true"] .stop-sign {
  border-color: var(--accent);
  background: var(--accent);
  translate: 0 -4px;
}

.stage-stop[aria-selected="true"] .stop-num {
  background: var(--on-accent);
  color: var(--accent);
}

.stage-stop[aria-selected="true"]::after {
  background: var(--accent);
}

.stage-stop:focus-visible {
  outline: none;
}

.stage-stop:focus-visible .stop-sign {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* The buggy drives between the stops; it sits just before the sign of the current stage. */
.road-buggy {
  position: absolute;
  z-index: 1;
  left: 0;
  bottom: 10px;
  width: var(--buggy-width);
  pointer-events: none;
  transform-origin: 60% 92%;
  /* Off the road until the script brings it in. */
  translate: -200px 0;
}

.road-buggy img {
  display: block;
  width: 100%;
  height: auto;
  transition: scale 0.25s ease;
}

.road-buggy.is-reversed img {
  scale: -1 1;
}

.road-buggy.is-moving img {
  animation: buggy-bounce 0.16s infinite alternate ease-in-out;
}

@keyframes buggy-bounce {
  from { translate: 0 0; }
  to { translate: 0 -3px; }
}

/* Dust kicked up behind the wheels while the buggy drives. */
.dust {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(214, 226, 227, 0.55);
  pointer-events: none;
  animation: dust 0.7s ease-out forwards;
}

@keyframes dust {
  from { opacity: 0.75; transform: translate(0, 0) scale(0.4); }
  to { opacity: 0; transform: translate(calc(var(--dir, 1) * -34px), -16px) scale(1.9); }
}

.home-intro {
  margin-top: 0;
}

.home-intro + .section {
  margin-top: 28px;
}

/* Home page: the steps are joined like checkpoints on a road. */
.step-list.road li {
  position: relative;
}

.step-list.road li:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 25px;
  top: 43px;
  bottom: -27px;
  border-left: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent);
}

.step-list.road li:last-child .step-num {
  background: repeating-conic-gradient(var(--accent) 0 25%, var(--accent-soft) 0 50%) 0 0 / 10px 10px;
  color: var(--on-accent);
  text-shadow: 0 0 3px var(--accent);
}

.section[id] {
  scroll-margin-top: 104px;
}

/* Reading progress: the buggy drives along the bottom of the header as the page scrolls. */
.drive-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  pointer-events: none;
  /* The buggy's position is measured against the width of the bar. */
  container-type: inline-size;
}

.drive-progress-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #008878, #a044db);
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
}

.drive-progress-car {
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 26px;
  height: auto;
  opacity: 0;
  transform: translateX(calc(var(--progress, 0) * (100cqw - 26px)));
  transition: opacity 0.3s ease;
}

.drive-progress.is-on .drive-progress-car {
  opacity: 1;
}

.drive-progress-car.is-reversing {
  scale: -1 1;
}

.drive-progress.is-moving .drive-progress-car {
  animation: buggy-bounce 0.12s infinite alternate ease-in-out;
}

/* The current chapter in the sidebar. */
.chapter-list a[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Previous and next cards carry an arrow pointing the way. */
.page-nav a {
  position: relative;
}

.page-nav a::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 30px;
  height: 18px;
  margin-top: -9px;
  background: linear-gradient(90deg, var(--accent-alt) 0 32%, var(--accent) 32%);
  -webkit-mask: var(--arrow-mask) center / contain no-repeat;
  mask: var(--arrow-mask) center / contain no-repeat;
  transition: translate 0.25s ease;
}

.page-nav .page-nav-next {
  padding-right: 62px;
}

.page-nav .page-nav-next::before {
  right: 20px;
}

.page-nav .page-nav-prev {
  padding-left: 62px;
}

.page-nav .page-nav-prev::before {
  left: 20px;
  scale: -1 1;
}

.page-nav .page-nav-next:hover::before {
  translate: 5px 0;
}

.page-nav .page-nav-prev:hover::before {
  translate: -5px 0;
}

/* Footer: the buggy drives along the top edge once the reader reaches it. */
.footer {
  position: relative;
  overflow-x: clip;
}

.footer-buggy {
  position: absolute;
  left: 0;
  bottom: 100%;
  width: 54px;
  height: auto;
  margin-bottom: 1px;
  translate: -80px 0;
  pointer-events: none;
}

.footer-buggy.is-driving {
  animation: footer-drive 5s cubic-bezier(0.45, 0.05, 0.55, 0.95) forwards;
}

@keyframes footer-drive {
  from { translate: -80px 0; }
  to { translate: calc(100vw + 20px) 0; }
}

/* Back to top */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font-size: 20px;
  box-shadow: 0 8px 24px rgba(11, 19, 21, 0.18);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, border-color 0.15s ease;
}

.back-to-top.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.back-to-top:hover {
  border-color: var(--accent);
}

.back-to-top:hover .arrow {
  translate: 0 -3px;
}

@media (max-width: 920px) {
  .hero-top {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 34px 28px 6px;
  }
}

@media (max-width: 640px) {
  .hero-wrap {
    padding: 18px 14px 0;
  }

  .hero-top {
    padding: 26px 16px 4px;
  }

  .stage-card {
    padding: 16px 14px 12px;
  }

  .stage-window pre {
    font-size: 11.5px;
  }

  .stage-nav .stage-play span:last-child {
    display: none;
  }

  .stage-stops {
    left: calc(var(--buggy-width) + 36px);
    right: 30px;
  }

  .stop-sign {
    padding: 4px;
  }

  .stop-label {
    display: none;
  }

  .back-to-top {
    right: 14px;
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand:hover .brand-logo,
  .drive-progress.is-moving .drive-progress-car,
  .road-buggy.is-moving img,
  .stage-running span::before {
    animation: none;
  }

  .arrow,
  .page-nav a::before,
  .stop-sign {
    transition: none;
  }
}
