@charset "UTF-8";

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("assets/fonts/manrope/Manrope-Variable.ttf") format("truetype");
}

:root {
  --bg: #252e3b;
  --surface: #252e3b;
  --sidebar: #252e3b;
  --text: #e4ebf5;
  --muted: #aebbd0;
  --line: #3b485b;
  --accent: #ffa386;
  --primary: #bc4324;
  --primary-hover: #a9371b;
  --blue: #8dbfff;
  --blue-soft: #2d4059;
  --warning: #edbd83;
  --warning-soft: #252e3b;
  --accent-soft: #443832;
  --green: #8cdbb0;
  --code-bg: #222a36;
  --code-head: #252e3b;
  --code-text: #d4d4d4;
  --code-muted: #a4b2c7;
  --header-height: 76px;
  --sidebar-width: 280px;
  --content-width: 1120px;
  --page-gutter: 40px;
  --page-space: 32px;
  color-scheme: dark;
  font-family:
    "Manrope",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
  scrollbar-gutter: stable;
}
body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
summary {
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: var(--accent);
}
h1,
h2,
h3,
p {
  margin: 0;
}
svg {
  display: block;
}
code,
pre,
kbd {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
p code {
  padding: 1px 4px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 0.9em;
  line-height: 1;
  border-radius: 3px;
  overflow-wrap: anywhere;
}
:where(
  button,
  a,
  input,
  textarea,
  summary,
  pre,
  [role="tabpanel"]
):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
main:focus {
  outline: none;
}
.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;
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 20px;
  padding: 10px 18px;
  z-index: 200;
  background: var(--text);
  color: var(--bg);
}
.skip-link:focus {
  top: 12px;
}
.muted {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.small {
  font-size: 12px;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
}
.icon-button:hover {
  color: var(--blue);
  background: var(--blue-soft);
}
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 550;
}
.text-button:hover {
  color: var(--accent);
}
.button {
  background: transparent;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}
.button:hover {
  border-color: var(--muted);
}
.ui-icon {
  display: block;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.action-button {
  position: relative;
  gap: 8px;
}
.external-mark {
  width: 14px;
  height: 14px;
}
.primary {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}
.primary:hover {
  border-color: transparent;
  background: var(--primary-hover);
  color: #fff;
}

/* One continuous header above a flat, divided workspace. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--header-height);
  padding-inline: 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-size: 23px;
  line-height: 32px;
  letter-spacing: -0.7px;
}
.brand {
  flex: 0 0 auto;
  font-weight: 700;
}
.brand-dot {
  color: var(--accent);
}
.topic-switcher {
  position: relative;
  min-width: 0;
}
.header-topic {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: inherit;
  text-align: left;
}
.header-topic:hover,
.header-topic[aria-expanded="true"] {
  color: var(--accent);
}
.header-topic-label {
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.topic-chevron {
  width: 14px;
  height: 14px;
  transition: transform 160ms ease;
}
.header-topic[aria-expanded="true"] .topic-chevron {
  transform: rotate(180deg);
}
.topics-menu {
  position: absolute;
  top: calc(100% + 16px);
  left: 0;
  width: min(340px, calc(100vw - 112px));
  max-height: min(420px, calc(100dvh - var(--header-height) - 24px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  letter-spacing: normal;
}
.topics-menu .nav-item {
  min-height: 44px;
  align-items: center;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 22px;
  overflow-wrap: anywhere;
}
.sidebar {
  position: fixed;
  inset: var(--header-height) auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: var(--page-space) 20px 16px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}
#lesson-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  padding: 4px 4px 16px;
}
.nav-group {
  margin-bottom: 24px;
}
.nav-group h2 {
  padding: 0 8px 8px 36px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  color: var(--muted);
}
.nav-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px;
  margin: 0;
  border-radius: 4px;
  font-size: 12px;
  line-height: 24px;
}
#lesson-nav .nav-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
}
.nav-item > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.nav-item:hover {
  background: var(--blue-soft);
  color: var(--text);
}
.nav-number {
  font:
    10px/1 "SFMono-Regular",
    Consolas,
    monospace;
  color: var(--muted);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-item.active .nav-number {
  color: var(--accent);
}
.workspace {
  margin-left: var(--sidebar-width);
  min-width: 0;
}
.is-home .workspace {
  margin-left: 0;
}
.is-home #main {
  max-width: none;
  padding: 0;
}
.topics-page {
  --wheel-height: min(440px, 80svh);
  --wheel-row: 80px;
  --wheel-gap: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  column-gap: var(--wheel-gap);
  min-height: 100svh;
  padding-inline: 32px;
}
.home-brand,
.home-topics a {
  font-size: clamp(24px, 3.2vw, 40px);
  line-height: 1.3;
  letter-spacing: -1px;
}
.home-brand {
  justify-self: end;
}
.home-topics {
  width: min(540px, 100%);
  height: var(--wheel-height);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  mask-image: linear-gradient(
    to bottom,
    transparent,
    black 22%,
    black 78%,
    transparent
  );
}
.home-topics::-webkit-scrollbar {
  display: none;
}
.home-topics ul {
  margin: 0;
  padding: calc((var(--wheel-height) - var(--wheel-row)) / 2) 0;
  list-style: none;
}
.home-topics li {
  display: flex;
  align-items: center;
  min-height: var(--wheel-row);
  scroll-snap-align: center;
}
.home-topics a {
  display: block;
  width: 100%;
  padding: 12px 0;
  color: var(--muted);
  font-weight: 500;
  overflow-wrap: anywhere;
  opacity: var(--wheel-opacity, 1);
  transform: scale(var(--wheel-scale, 1));
  transform-origin: left center;
  transition: color 160ms ease;
}
.home-topics .is-centered {
  color: var(--text);
}
.home-topics a:hover,
.home-topics a:focus-visible {
  color: var(--accent);
}
.home-topics a:focus-visible {
  outline-offset: -2px;
}
.home-empty {
  max-width: 240px;
}
/* Keep page content and the footer aligned at every viewport width. */
#main,
.page-footer {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}
.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-block: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

/* Topic overview and official resources. */
.home-page {
  display: grid;
  gap: var(--page-space);
  padding-top: var(--page-space);
}
.hero {
  padding-bottom: var(--page-space);
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  margin-bottom: 16px;
  font-size: 40px;
  line-height: 48px;
  letter-spacing: -1.3px;
  font-weight: 650;
}
.hero h1 > span {
  color: var(--accent);
}
.hero-description {
  max-width: 640px;
  font-size: 16px;
  line-height: 28px;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* Each section places its explanation directly above its code blocks. */
.lesson-page {
  position: relative;
  isolation: isolate;
  padding-top: var(--page-space);
}
.lesson-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 24px;
  margin-bottom: 24px;
}
.lesson-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 48px;
}
.lesson-actions .button {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
}
.ask-button {
  color: var(--accent);
}
.ask-button:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.doc-button {
  color: var(--muted);
}
.doc-button:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.lesson-header h1 {
  min-width: 0;
  font-size: 40px;
  font-weight: 650;
  line-height: 48px;
  letter-spacing: -1px;
}
.code-window {
  --panel-accent: var(--blue);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--code-text);
}
.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  background: var(--code-head);
  border-bottom: 1px solid var(--line);
  color: var(--code-muted);
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 650;
  line-height: 20px;
}
.code-header > span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.code-window pre {
  margin: 0;
  padding: 16px 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  font-size: 12px;
  line-height: 24px;
  tab-size: 4;
}
.code-window pre > code {
  display: block;
  min-width: max-content;
}
.code-line {
  display: flex;
  align-items: baseline;
  min-height: 24px;
  padding-right: 16px;
  border-left: 2px solid transparent;
}
.line-number {
  user-select: none;
  flex: 0 0 40px;
  padding-right: 12px;
  color: var(--code-muted);
  font-size: 10px;
  line-height: 1;
  text-align: right;
}
.line-text {
  display: block;
  white-space: pre;
}
.shiki {
  color: var(--shiki-dark, var(--code-text));
  background: var(--code-bg);
}
.shiki .line-text > span {
  color: var(--shiki-dark);
  font-style: var(--shiki-dark-font-style, normal);
  font-weight: var(--shiki-dark-font-weight, 400);
  text-decoration: var(--shiki-dark-text-decoration, none);
}
.lesson-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-top: 32px;
  padding: 24px 0 16px;
  border-top: 1px solid var(--line);
}
.previous-lesson {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 13px;
}
.code-line.highlighted {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

/* Question dialog. */
dialog {
  width: min(650px, calc(100vw - 32px));
  max-height: 82dvh;
  margin: 8dvh auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
dialog[open] {
  display: flex;
  flex-direction: column;
}
dialog::backdrop {
  background: #17222766;
}
.dialog-head {
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 22px 13px;
}
.dialog-head h2 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.4px;
}
.empty-state {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty-state > span {
  font-size: 30px;
}
.empty-state h3 {
  margin: 5px 0;
  color: var(--text);
  font-size: 17px;
}
.ask-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: 85dvh;
}
.ask-dialog .dialog-head {
  border-bottom: 1px solid var(--line);
}
#ask-form {
  padding: 18px 22px 20px;
  overflow: auto;
}
.ask-topic {
  margin-bottom: 17px;
  color: var(--muted);
  font-size: 12px;
}
.ask-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}
#ask-question,
#ask-preview-text {
  display: block;
  width: 100%;
  min-height: 115px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.7;
}
#ask-question::placeholder {
  color: var(--muted);
  font-size: 13px;
}
.ask-context-note {
  margin: 13px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}
.ask-preview {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ask-preview summary {
  padding: 12px 0;
  font-size: 12px;
}
.ask-preview summary span {
  float: right;
  color: var(--muted);
  font-size: 11px;
}
#ask-preview-text {
  min-height: 180px;
  max-height: 35dvh;
  margin-bottom: 12px;
  font-family: monospace;
  font-size: 12px;
}
.ask-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 17px;
}
.ask-actions .text-button {
  font-size: 12px;
}
.ask-actions .button {
  font-size: 13px;
}
.ask-fallback-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.ask-status {
  color: var(--green);
  font-size: 13px;
  line-height: 1.8;
}
.ask-status:not(:empty) {
  margin-top: 13px;
}
.noscript {
  position: fixed;
  inset: 25% 10% auto;
  z-index: 200;
  padding: 30px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--text);
}

/* Fade content without moving text or controls off their grid lines. */
@keyframes page-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.home-page,
.lesson-page {
  animation: page-enter 280ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
dialog[open] {
  animation: page-enter 200ms ease-out both;
}
body,
.sidebar,
.code-window,
.code-header,
.shiki,
.nav-item,
.nav-number,
.icon-button,
.text-button {
  transition:
    background-color 220ms ease,
    color 180ms ease,
    border-color 220ms ease;
}
.shiki .line-text > span {
  transition: color 220ms ease;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
  .home-topics a {
    transform: none;
  }
}

@media print {
  *,
  *::before,
  *::after {
    box-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }
  .lesson-page::before {
    display: none;
  }
  .site-header,
  .sidebar,
  .hero-actions,
  .lesson-navigation,
  .page-footer,
  dialog,
  .lesson-actions {
    display: none !important;
  }
  .workspace {
    margin: 0;
  }
  #main {
    max-width: none;
    padding: 0;
  }
  .home-page,
  .lesson-page {
    padding: 0;
  }
  body {
    min-width: 0;
    background: white;
    color: black;
  }
  .code-window {
    break-inside: avoid;
    background: #f7f7f7;
    color: black;
  }
  .code-window pre {
    overflow: visible;
  }
  .code-window pre > code {
    min-width: 0;
  }
  .line-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    min-width: 0;
  }
  .shiki .line-text > span {
    color: inherit;
  }
  .shiki {
    background: #fff;
    color: #000;
  }
  .code-header {
    background: #eee;
    color: black;
  }
  .line-number {
    color: #555;
  }
}

/* Topic resources and general Markdown content. */
.muted,
.loading-state {
  color: var(--muted);
  font-size: 13px;
}
.loading-state {
  padding-top: 40px;
}
.topic-resources {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 24px;
}
.topic-resources h2 {
  margin-bottom: 8px;
  font-size: 16px;
}
.topic-resources a,
.markdown a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.markdown a[target="_blank"]::after {
  content: "↗";
  display: inline-block;
  margin-left: 4px;
  font-size: 0.85em;
  text-decoration: none;
}
.markdown {
  font-size: 14px;
  line-height: 24px;
  overflow-wrap: break-word;
}
.markdown h1 {
  margin: 32px 0 16px;
  font-size: 28px;
  line-height: 40px;
}
.markdown h2 {
  margin: 32px 0 16px;
  font-size: 21px;
  line-height: 32px;
}
.markdown > h2:first-child {
  margin-top: 0;
}
.markdown h3 {
  margin: 24px 0 16px;
  font-size: 16px;
}
.markdown p {
  margin: 0 0 16px;
}
.markdown ul,
.markdown ol {
  padding-left: 24px;
  margin: 16px 0;
}
.markdown li {
  margin: 8px 0;
}
.markdown blockquote {
  margin: 20px 0;
  padding: 10px 22px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}
.markdown .code-window {
  margin: 24px 0;
}
.markdown pre,
.markdown code {
  overflow-wrap: normal;
}
.markdown > pre {
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code-bg);
}
.markdown img {
  max-width: 100%;
  height: auto;
}
.markdown table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 20px 0;
}
.markdown th,
.markdown td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.markdown hr {
  margin: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
@media (max-width: 1320px) {
  .lesson-header {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}
@media (max-width: 760px) {
  :root {
    --header-height: 64px;
    --page-gutter: 24px;
    --page-space: 24px;
  }
  .site-header {
    padding-inline: var(--page-gutter);
    font-size: 21px;
  }
  .topics-page {
    --wheel-row: 72px;
    --wheel-gap: 12px;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    padding-inline: 20px;
  }
  .home-brand,
  .home-topics a {
    letter-spacing: -0.5px;
  }
  .sidebar {
    position: relative;
    inset: auto;
    width: auto;
    padding: 16px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  #lesson-nav {
    max-height: 230px;
    flex: auto;
  }
  .workspace {
    margin-left: 0;
  }
  .hero h1,
  .lesson-header h1 {
    font-size: 32px;
    line-height: 40px;
  }
  .lesson-navigation {
    align-items: flex-start;
    flex-direction: column;
  }
  .page-footer {
    flex-direction: column;
  }
}
@media (max-width: 600px) {
  .lesson-actions {
    gap: 8px;
  }
  .lesson-actions .button {
    gap: 6px;
    min-height: 44px;
    min-width: 0;
    padding: 10px 8px;
    font-size: 12px;
    white-space: normal;
  }
}
