:root {
  --blue-950: #071f49;
  --blue-900: #0b3474;
  --blue-800: #0d4ea6;
  --blue-700: #1466d8;
  --blue-100: #eaf4ff;
  --blue-50: #f6fbff;
  --ink: #101828;
  --muted: #667085;
  --line: #d8e1ef;
  --soft-line: #edf2f7;
  --surface: #fff;
  --success: #00875f;
  --error: #c0362c;
  --warning: #9a6700;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(216, 225, 239, 0.92);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--blue-700);
  font-size: 16px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.1;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.top-nav {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.top-nav a {
  min-height: 38px;
  border-radius: 8px;
  padding: 9px 13px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
  transition:
    color 160ms ease,
    background 160ms ease;
}

.top-nav a:hover,
.top-nav a.is-active {
  color: var(--blue-800);
  background: var(--blue-100);
}

main {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0 78px;
}

.page {
  animation: page-in 220ms ease both;
}

.is-hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero,
.page-heading,
.course-header,
.lesson-hero {
  max-width: 820px;
}

.home-page {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 0.72fr);
  gap: clamp(30px, 4.8vw, 62px);
  align-items: start;
}

.hero {
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding: clamp(34px, 7vw, 84px) 0 30px;
}

.home-visual {
  position: relative;
  z-index: 0;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  width: 100%;
  min-height: 420px;
  height: clamp(460px, 48vw, 660px);
  margin-top: clamp(8px, 2.5vw, 28px);
  overflow: visible;
}

.home-visual::before {
  position: absolute;
  inset: 4% -18% 4% -10%;
  z-index: -1;
  background:
    radial-gradient(circle at 56% 45%, rgba(92, 231, 255, 0.2), transparent 31%),
    radial-gradient(circle at 78% 55%, rgba(125, 92, 255, 0.11), transparent 36%),
    radial-gradient(circle at 38% 74%, rgba(20, 102, 216, 0.15), transparent 40%),
    linear-gradient(rgba(13, 78, 166, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 78, 166, 0.04) 1px, transparent 1px);
  background-size:
    auto,
    auto,
    auto,
    42px 42px,
    42px 42px;
  mask-image: radial-gradient(ellipse at 58% 48%, #000 0 58%, transparent 80%);
  content: "";
}

.home-visual::after {
  position: absolute;
  inset: 2% -10% 8% -4%;
  z-index: -1;
  background-image:
    radial-gradient(circle, rgba(12, 74, 172, 0.18) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(92, 231, 255, 0.2) 0 1px, transparent 1.5px);
  background-position:
    7px 11px,
    29px 37px;
  background-size:
    58px 58px,
    86px 86px;
  mask-image: radial-gradient(ellipse at 58% 48%, #000 0 42%, transparent 72%);
  opacity: 0.72;
  content: "";
}

#homeThreeCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hero h1,
.page-heading h1,
.course-header h1,
.lesson-hero h1 {
  margin: 0;
  color: var(--blue-950);
  font-size: clamp(42px, 6vw, 74px);
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.lead,
.page-heading p,
.course-header p,
.lesson-hero p,
.article-summary {
  max-width: 720px;
  margin: 24px 0 0;
  color: #344054;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.9;
  overflow-wrap: anywhere;
}

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

.primary-action,
.secondary-action,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 800;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.primary-action,
.primary-button {
  color: #fff;
  background: var(--blue-700);
}

.secondary-action {
  color: var(--blue-800);
  background: #fff;
  border-color: var(--line);
}

.primary-action:hover,
.primary-button:hover,
.secondary-action:hover {
  transform: translateY(-1px);
}

.secondary-action:hover {
  border-color: #a9bed8;
}

.home-aside {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
  grid-template-columns: minmax(260px, 0.42fr) minmax(0, 1fr);
  display: grid;
  gap: 18px;
  padding-top: 0;
}

.quiet-panel,
.mini-log {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #fff;
}

.panel-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.quiet-panel strong {
  display: block;
  color: var(--blue-950);
  font-size: 24px;
}

.quiet-panel p,
.mini-log p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.mini-log {
  display: grid;
  gap: 12px;
}

.mini-log-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--soft-line);
}

.mini-log-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.mini-log-row time {
  color: var(--blue-800);
  font-size: 12px;
  font-weight: 900;
}

.mini-log-row span {
  color: #344054;
  font-size: 14px;
  line-height: 1.5;
}

.home-section {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  min-width: 0;
  padding-top: 42px;
  border-top: 1px solid var(--line);
}

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

.section-heading,
.page-heading {
  display: grid;
  grid-template-columns: minmax(240px, 0.42fr) minmax(0, 0.7fr);
  column-gap: 40px;
  align-items: end;
  margin-bottom: 26px;
}

.section-heading .eyebrow,
.page-heading .eyebrow {
  grid-column: 1 / -1;
}

.section-heading h2,
.page-heading h1 {
  margin: 0;
  color: var(--blue-950);
  font-size: clamp(34px, 4.6vw, 58px);
  line-height: 1.02;
}

.section-heading p,
.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.page-heading {
  padding: 34px 0 30px;
  border-bottom: 1px solid var(--line);
}

.article-list,
.update-list,
.course-list,
.lesson-index-list {
  border-top: 1px solid var(--line);
}

.article-row,
.update-row,
.course-row,
.lesson-index-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) 96px;
  gap: 22px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
  color: inherit;
  background: transparent;
  text-align: left;
  transition:
    color 160ms ease,
    transform 160ms ease;
}

.article-row:hover,
.course-row:hover,
.lesson-index-row:hover {
  color: var(--blue-800);
  transform: translateX(2px);
}

.article-date,
.update-date,
.course-number,
.lesson-number {
  color: var(--blue-800);
  font-size: 13px;
  font-weight: 900;
}

.article-main strong,
.course-main strong,
.lesson-main strong {
  display: block;
  color: var(--ink);
  font-size: 19px;
}

.article-main span,
.course-main span,
.lesson-main span,
.update-main {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.7;
}

.article-tag,
.course-meta,
.lesson-meta {
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.update-row {
  grid-template-columns: 132px minmax(0, 1fr);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 20px 0 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.crumbs a {
  color: var(--blue-800);
}

.crumbs span::before,
.crumbs a + a::before {
  content: "/";
  margin-right: 8px;
  color: #98a2b3;
}

.blog-article,
.lesson-article {
  max-width: 920px;
  margin: 0 auto;
}

.blog-article h1 {
  margin: 0;
  color: var(--blue-950);
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.05;
}

.article-body {
  margin-top: 36px;
  border-top: 1px solid var(--line);
}

.article-body h2,
.lesson-section h2,
.quiz-section h2,
.practice-section h2 {
  margin: 34px 0 14px;
  color: var(--blue-950);
  font-size: 28px;
}

.article-body p,
.lesson-section p,
.quiz-section p,
.practice-section p {
  color: #344054;
  line-height: 1.95;
}

.course-header {
  padding: 34px 0 30px;
}

.course-header h1 {
  font-size: clamp(38px, 5vw, 64px);
}

.lesson-index-row {
  grid-template-columns: 92px minmax(0, 1fr) 110px;
}

.lesson-folder {
  border-bottom: 1px solid var(--line);
  padding: 0;
}

.lesson-folder:first-child {
  margin-top: 10px;
}

.lesson-folder-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 22px;
  align-items: center;
  width: 100%;
  border: 0;
  padding: 24px 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.lesson-folder-toggle:hover .lesson-folder-main strong {
  color: var(--blue-800);
}

.lesson-folder-main strong {
  display: block;
  margin: 0;
  color: var(--blue-950);
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.1;
  transition: color 160ms ease;
}

.lesson-folder-description {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.7;
}

.lesson-folder-icon {
  display: grid;
  width: 34px;
  height: 34px;
  justify-self: end;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue-800);
  background: #fff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.lesson-folder-toggle[aria-expanded="true"] .lesson-folder-icon {
  color: #fff;
  background: var(--blue-700);
}

.lesson-folder-toggle[aria-expanded="true"] .lesson-folder-icon::before {
  content: "-";
}

.lesson-folder-toggle[aria-expanded="true"] .lesson-folder-icon {
  font-size: 0;
}

.lesson-folder-toggle[aria-expanded="true"] .lesson-folder-icon::before {
  font-size: 20px;
}

.lesson-folder-description {
  margin: 0 0 12px 154px;
}

.lesson-folder-list .lesson-index-row:last-child {
  border-bottom: 0;
}

.lesson-hero {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.lesson-hero h1 {
  font-size: clamp(40px, 5vw, 66px);
}

.lesson-body {
  display: grid;
  gap: 38px;
  margin-top: 34px;
}

.lesson-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
  padding-bottom: 38px;
  border-bottom: 1px solid var(--line);
}

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

.lesson-section p {
  margin: 0 0 16px;
}

.code-example {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.code-label {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.code-block,
.answer-code,
.output-block {
  overflow-x: auto;
  margin: 0;
  border-radius: 8px;
  padding: 18px;
  color: #eaf4ff;
  background: #071d45;
  font-size: 14px;
  line-height: 1.75;
}

.output-block {
  color: var(--blue-950);
  background: var(--blue-50);
  border: 1px solid #cde7ff;
}

.code-block code,
.answer-code code,
.output-block code,
#practiceEditor {
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.concept-figure {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--blue-50);
}

.generated-figure {
  width: min(100%, 980px);
  margin: 4px 0 0;
}

.generated-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.generated-figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.figure-title {
  margin: 0 0 16px;
  color: var(--blue-950);
  font-weight: 900;
}

.flow-figure {
  display: grid;
  gap: 12px;
}

.flow-item {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

.flow-box {
  border: 1px solid #b7d8f6;
  border-radius: 8px;
  padding: 12px;
  color: var(--blue-950);
  background: #fff;
  text-align: center;
  font-weight: 800;
}

.flow-arrow {
  color: var(--blue-700);
  font-weight: 900;
}

.index-ruler {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.index-cell {
  display: grid;
  gap: 6px;
  text-align: center;
}

.index-cell strong {
  display: grid;
  min-height: 40px;
  place-items: center;
  border: 1px solid #b7d8f6;
  border-radius: 8px;
  background: #fff;
  color: var(--blue-950);
}

.index-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.method-stack {
  display: grid;
  gap: 10px;
}

.method-stack span {
  border-left: 4px solid var(--blue-700);
  padding: 10px 12px;
  color: #344054;
  background: #fff;
  line-height: 1.5;
}

.quiz-section,
.practice-section {
  margin-top: 38px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.quiz-list {
  display: grid;
  gap: 28px;
  margin-top: 22px;
}

.quiz-item {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.quiz-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.quiz-type {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--blue-800);
  background: var(--blue-100);
  font-size: 12px;
  font-weight: 900;
}

.quiz-item p {
  margin-top: 12px;
}

.choice-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.choice-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: #344054;
  background: #fff;
  text-align: left;
  line-height: 1.55;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.choice-button:hover {
  transform: translateY(-1px);
  border-color: #a9bed8;
}

.choice-button.is-correct {
  border-color: rgba(0, 135, 95, 0.38);
  color: var(--success);
  background: #e5f6ef;
}

.choice-button.is-wrong {
  border-color: rgba(192, 54, 44, 0.36);
  color: var(--error);
  background: #fff0ee;
}

.feedback {
  min-height: 28px;
  margin: 16px 0 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.75;
}

.feedback.is-success {
  color: var(--success);
}

.feedback.is-error {
  color: var(--error);
}

.feedback.is-warning {
  color: var(--warning);
}

.editor-label {
  display: block;
  margin: 20px 0 10px;
  color: var(--blue-950);
  font-weight: 900;
}

#practiceEditor {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid #c9d8ea;
  border-radius: 8px;
  padding: 18px;
  color: #eaf4ff;
  background: #071d45;
  font-size: 14px;
  line-height: 1.7;
  outline: none;
}

#practiceEditor:focus {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 4px rgba(20, 102, 216, 0.12);
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.answer-code {
  margin-top: 18px;
}

.lesson-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.lesson-pager-link {
  display: grid;
  gap: 8px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  transition:
    border-color 160ms ease,
    transform 160ms ease;
}

.lesson-pager-link:hover {
  border-color: #a9bed8;
  transform: translateY(-1px);
}

.lesson-pager-link.next {
  text-align: right;
}

.lesson-pager-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.lesson-pager-link strong {
  color: var(--blue-950);
  font-size: 20px;
  line-height: 1.25;
}

.lesson-pager-link.is-disabled {
  pointer-events: none;
  background: #f8fafc;
  opacity: 0.62;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 940px) {
  .site-header,
  .home-page,
  .section-heading,
  .page-heading,
  .lesson-section {
    grid-template-columns: 1fr;
  }

  .top-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .hero,
  .home-visual,
  .home-aside {
    grid-column: 1;
    grid-row: auto;
  }

  .home-visual {
    min-height: 300px;
    height: min(84vw, 460px);
    margin-top: -44px;
  }

  .home-aside {
    grid-template-columns: 1fr;
    padding-top: 0;
  }

  .section-heading p,
  .page-heading p {
    margin-top: 10px;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  main {
    width: min(100% - 28px, 1160px);
    padding-top: 22px;
  }

  .hero,
  .hero-actions,
  .lead {
    max-width: calc(100vw - 28px);
  }

  .hero h1,
  .page-heading h1,
  .course-header h1,
  .lesson-hero h1 {
    max-width: 8.7em;
    font-size: 34px;
    line-height: 1.05;
    line-break: anywhere;
    word-break: break-all;
  }

  .lead,
  .page-heading p,
  .course-header p,
  .lesson-hero p,
  .article-summary {
    max-width: 22em;
    line-break: anywhere;
  }

  .home-visual {
    overflow: hidden;
  }

  .article-row,
  .course-row,
  .lesson-index-row,
  .update-row,
  .lesson-folder-toggle {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .lesson-folder-icon {
    justify-self: start;
  }

  .lesson-folder-description {
    margin-left: 0;
  }

  .article-tag,
  .course-meta,
  .lesson-meta {
    justify-self: start;
  }

  .flow-item {
    grid-template-columns: 1fr;
  }

  .flow-arrow {
    text-align: center;
    transform: rotate(90deg);
  }

  .index-ruler {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-actions,
  .editor-actions,
  .lesson-pager {
    width: 100%;
  }

  .hero-actions a,
  .editor-actions button {
    flex: 1 1 100%;
    min-width: 0;
  }

  .lesson-pager {
    grid-template-columns: 1fr;
  }

  .lesson-pager-link.next {
    text-align: left;
  }
}
