:root {
  --surface: #ffffff;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f6f3f2;
  --surface-container: #f0eded;
  --surface-container-high: #eae7e7;
  --on-surface: #1b1c1c;
  --on-surface-variant: #594139;
  --outline: #8d7168;
  --outline-variant: #e1bfb5;
  --dot: #dedede;
  --primary: #ab3500;
  --primary-container: #ff6b35;
  --on-primary-container: #5f1900;
  --secondary: #785a00;
  --secondary-container: #ffd167;
  --on-secondary-container: #765900;
  --tertiary: #2b6485;
  --tertiary-container: #6ba0c4;
  --on-tertiary-container: #00364e;
  --error: #ba1a1a;
  --ink: var(--on-surface);
  --muted: var(--on-surface-variant);
  --white: var(--surface-container-lowest);
  --warm: var(--surface-container-low);
  --line: var(--outline-variant);
  --orange: var(--primary-container);
  --red: var(--error);
  --blue: var(--tertiary);
  --border: 1px solid var(--on-surface);
  --dot-offset: 0px;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --display: "Hanken Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 20px;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--surface);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
}

body::before {
  content: "";
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  left: 0;
  height: 8px;
  background: linear-gradient(
    90deg,
    var(--primary-container) 0 50%,
    var(--secondary-container) 50% 75%,
    var(--tertiary-container) 75% 100%
  );
}

a {
  color: var(--tertiary);
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--primary);
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 50;
  top: 1rem;
  left: 1rem;
  padding: 0.55rem 0.8rem;
  color: var(--white);
  background: var(--primary);
  border: var(--border);
  transform: translateY(-190%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  min-height: 100vh;
}

.site-shell::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0 0 0 18rem;
  pointer-events: none;
  background-image: radial-gradient(
    circle,
    var(--dot) 1.1px,
    transparent 1.2px
  );
  background-position: 0 var(--dot-offset);
  background-size: 40px 40px;
}

.sidebar {
  position: sticky;
  z-index: 1;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 2.2rem 1.5rem;
  background: var(--warm);
  border-right: var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  color: var(--on-primary-container);
  background: var(--primary-container);
  border: var(--border);
  font: 700 1.25rem/1 var(--display);
}

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

.brand strong {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: 0.04rem;
  color: var(--muted);
  font: 700 0.72rem/1.4 var(--mono);
  text-transform: uppercase;
}

.nav-label {
  margin: 2.4rem 0 0.7rem;
  color: var(--muted);
  font: 700 0.72rem/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar nav > a {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.45rem;
  margin: 0 -0.45rem;
  padding: 0.48rem 0.45rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  font-size: 0.98rem;
  line-height: 1.4;
  text-decoration: none;
}

.sidebar nav > a span {
  color: var(--muted);
  font: 600 0.72rem/1.9 var(--mono);
}

.sidebar nav > a:hover,
.sidebar nav > a:focus {
  color: var(--white);
  background: var(--tertiary);
}

.sidebar nav > a:hover span,
.sidebar nav > a:focus span {
  color: var(--white);
}

.sidebar nav > a.capstone-link {
  margin-top: 0.65rem;
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  border: var(--border);
}

.sidebar nav > a.capstone-link span {
  color: var(--on-secondary-container);
}

.sidebar nav > a.capstone-link:hover,
.sidebar nav > a.capstone-link:focus {
  color: var(--white);
  background: var(--primary);
}

.sidebar nav > a.capstone-link:hover span,
.sidebar nav > a.capstone-link:focus span {
  color: var(--white);
}

.sidebar nav > a[aria-current="page"] {
  color: var(--on-primary-container);
  background: var(--primary-container);
  border: 2px solid var(--on-surface);
  box-shadow: 4px 4px 0 var(--on-surface);
}

.sidebar nav > a[aria-current="page"] span {
  color: var(--on-primary-container);
}

.secondary-nav {
  margin-top: 1.2rem;
}

.secondary-nav summary {
  cursor: pointer;
  color: var(--muted);
  font: 700 0.78rem/1.5 var(--mono);
  text-transform: uppercase;
}

.secondary-nav div {
  margin-top: 0.45rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--line);
}

.secondary-nav a {
  display: block;
  padding: 0.3rem 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  text-decoration: none;
}

.secondary-nav a:hover {
  color: var(--red);
}

.secondary-nav a[aria-current="page"] {
  margin-left: -0.9rem;
  padding-left: 0.7rem;
  color: var(--white);
  background: var(--tertiary);
  border-left: 4px solid var(--primary-container);
}

.section-nav {
  margin: 0.8rem 0 1.2rem;
  padding: 0.65rem 0 0.15rem 0.8rem;
  border-left: 3px solid var(--tertiary-container);
  list-style: none;
}

.section-nav::before {
  content: "On this page";
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font: 700 0.65rem/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-nav li {
  margin: 0;
}

.section-nav a {
  display: block;
  margin: 0.12rem 0;
  padding: 0.24rem 0.35rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
}

.section-nav .section-nav-level-3 a {
  padding-left: 1rem;
  font-size: 0.7rem;
}

.section-nav a:hover {
  color: var(--white);
  background: var(--tertiary);
}

.section-nav a[aria-current="location"] {
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  border: 1px solid var(--on-surface);
  box-shadow: 3px 3px 0 var(--on-surface);
}

.page-column {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.mobile-header {
  display: none;
}

.content {
  width: min(100% - 5rem, 60rem);
  min-height: calc(100vh - 7rem);
  margin: 0 auto;
  padding: 4rem 0 6rem;
}

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

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

h1 {
  max-width: 18ch;
  margin: 0 0 1.6rem;
  font-size: clamp(3.2rem, 6vw, 5.2rem);
  letter-spacing: -0.045em;
  text-wrap: balance;
}

h2 {
  margin: 4.2rem 0 1.1rem;
  padding-top: 0.7rem;
  border-top: 4px solid var(--primary-container);
  font-size: clamp(1.8rem, 3vw, 2.3rem);
}

h3 {
  margin: 2.8rem 0 0.7rem;
  font-size: 1.4rem;
}

h4 {
  margin: 2.2rem 0 0.6rem;
  font-size: 1.15rem;
}

p,
ul,
ol {
  max-width: 52rem;
}

li + li {
  margin-top: 0.42rem;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 1.2rem;
  padding: 0.3rem 0.55rem;
  color: var(--on-primary-container);
  background: var(--primary-container);
  border-radius: 0.25rem;
  font: 700 0.76rem/1.25 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  max-width: 52rem;
  margin: 0 0 1.7rem;
  padding-left: 1.15rem;
  border-left: 6px solid var(--tertiary);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 500;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 2rem 0 3.2rem;
}

.button {
  display: inline-flex;
  min-height: 3rem;
  padding: 0.65rem 0.95rem;
  align-items: center;
  color: var(--on-primary-container);
  background: var(--primary-container);
  border: var(--border);
  border-radius: 999px;
  font: 750 0.84rem/1.2 var(--mono);
  text-decoration: none;
  text-transform: uppercase;
}

.button:hover {
  color: var(--white);
  background: var(--primary);
}

.button.secondary {
  color: var(--ink);
  background: var(--white);
}

.button.secondary:hover {
  color: var(--white);
  background: var(--tertiary);
}

.learning-path {
  max-width: 52rem;
  margin: 2rem 0;
  padding: 0;
  border-top: var(--border);
  list-style: none;
}

.learning-path li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0.8rem;
  margin: 0;
  padding: 1.1rem 0.6rem;
  border-bottom: 1px solid var(--line);
}

.learning-path li > span {
  color: var(--primary);
  font: 750 0.82rem/1.7 var(--mono);
}

.learning-path a {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
}

.learning-path p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.learning-path .capstone {
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  border-bottom: var(--border);
  border-radius: 0.5rem;
}

.learning-path .capstone > span,
.learning-path .capstone p,
.learning-path .capstone a {
  color: var(--on-secondary-container);
}

.next-page {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1rem;
  max-width: 52rem;
  margin-top: 5rem;
  padding: 1rem 1.15rem;
  color: var(--white);
  background: var(--primary);
  border: var(--border);
  border-radius: 0.5rem;
}

.next-page span {
  font: 700 0.76rem/1.7 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.next-page a {
  color: var(--white);
  text-align: right;
}

.next-page a:hover {
  color: var(--white);
  text-decoration-thickness: 3px;
}

blockquote,
.callout {
  max-width: 52rem;
  margin: 2rem 0;
  padding: 1rem 1.15rem;
  color: var(--ink);
  background: var(--warm);
  border-left: 6px solid var(--tertiary);
  border-radius: 0 0.5rem 0.5rem 0;
}

blockquote > :first-child,
.callout > :first-child {
  margin-top: 0;
}

blockquote > :last-child,
.callout > :last-child {
  margin-bottom: 0;
}

.callout.warning {
  border-left-color: var(--error);
}

.callout strong {
  text-transform: uppercase;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 2rem 0;
  padding: 1px;
  background: var(--ink);
  list-style: none;
}

.pipeline li {
  display: grid;
  min-height: 5.6rem;
  margin: 0;
  padding: 0.65rem;
  place-items: center;
  background: var(--white);
  font: 700 0.75rem/1.45 var(--mono);
  text-align: center;
  text-transform: uppercase;
}

.pipeline li:last-child {
  color: var(--on-secondary-container);
  background: var(--secondary-container);
}

.step {
  position: relative;
  margin: 4.2rem 0 1.5rem;
  padding-top: 0.7rem;
  border-top: 4px solid var(--primary-container);
}

.step::before {
  content: attr(data-step);
  position: absolute;
  top: -1.7rem;
  right: 0;
  color: var(--primary);
  font: 800 0.8rem/1 var(--mono);
}

.step h2,
.step h3 {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.source-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  max-width: 52rem;
  margin: 1.8rem 0;
  padding: 1px;
  background: var(--line);
}

.source-map a {
  padding: 0.72rem 0.8rem;
  color: var(--ink);
  background: var(--warm);
  font-size: 0.95rem;
  text-decoration: none;
}

.source-map a:hover {
  color: var(--white);
  background: var(--tertiary);
}

code,
kbd {
  font-family: var(--mono);
  font-size: 0.92em;
}

:not(pre) > code {
  padding: 0.12em 0.34em;
  color: var(--on-surface-variant);
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: 0.25rem;
}

div.highlighter-rouge {
  max-width: 100%;
  margin: 1.7rem 8px 2.3rem 0;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  margin: 1.7rem 0;
  padding: 1.2rem 1.3rem;
  color: var(--on-surface);
  background: var(--surface-container-lowest);
  border: 3px solid var(--on-surface);
  border-radius: 0;
  box-shadow: 8px 8px 0 var(--on-surface);
  font-size: 0.9rem;
  line-height: 1.7;
  tab-size: 2;
  -moz-tab-size: 2;
}

div.highlighter-rouge pre {
  margin: 0;
}

pre code {
  color: inherit;
  background: transparent;
}

/*
 * Light syntax theme derived from ColorBrewer Set1/Paired. Darkened variants
 * preserve the palette while keeping every token readable on paper white.
 * Rouge performs the language parsing at build time; no runtime JavaScript.
 */
.highlight,
.highlight .w {
  color: var(--on-surface);
  background: var(--surface-container-lowest);
}

.highlight .c,
.highlight .ch,
.highlight .cd,
.highlight .c1,
.highlight .cm,
.highlight .cpf,
.highlight .cp,
.highlight .cs {
  color: #6d625e;
  font-style: italic;
}

.highlight .k,
.highlight .kc,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt,
.highlight .kv,
.highlight .ow {
  color: #6a3d9a;
  font-weight: 700;
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sa,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sx,
.highlight .sr,
.highlight .ss,
.highlight .dl {
  color: #287a3a;
}

.highlight .m,
.highlight .mb,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo,
.highlight .mx,
.highlight .il {
  color: #1f5f99;
  font-weight: 600;
}

.highlight .nf,
.highlight .fm {
  color: #b7181a;
  font-weight: 700;
}

.highlight .nc,
.highlight .nd,
.highlight .ne {
  color: #6a3d9a;
  font-weight: 700;
}

.highlight .nn,
.highlight .no,
.highlight .nl {
  color: #1f5f99;
  font-weight: 600;
}

.highlight .nb,
.highlight .bp,
.highlight .nv,
.highlight .vm,
.highlight .vc,
.highlight .vg,
.highlight .vi {
  color: #8c4a19;
}

.highlight .o {
  color: #006d6f;
  font-weight: 600;
}

.highlight .p {
  color: var(--on-surface-variant);
}

.highlight .na {
  color: #8c4a19;
}

.highlight .nt {
  color: #287a3a;
  font-weight: 600;
}

.highlight .ni {
  color: #b7181a;
}

.highlight .n,
.highlight .nx,
.highlight .py {
  color: var(--on-surface);
}

.highlight .gh,
.highlight .gu {
  color: #6a3d9a;
  font-weight: 700;
}

.highlight .gd,
.highlight .gr {
  color: #b7181a;
}

.highlight .gi {
  color: #287a3a;
}

.highlight .ge {
  font-style: italic;
}

.highlight .gs {
  font-weight: 700;
}

.highlight .gp,
.highlight .gt {
  color: #8c4a19;
  font-weight: 600;
}

.highlight .go {
  color: #6d625e;
}

.highlight .err {
  color: var(--white);
  background: var(--error);
}

table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.8rem 0;
  border-collapse: collapse;
  background: var(--white);
  font-size: 0.98rem;
  border-radius: 0.5rem;
}

th,
td {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--on-tertiary-container);
  background: var(--tertiary-container);
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
}

hr {
  margin: 3.5rem 0;
  border: 0;
  border-top: var(--border);
}

.api-signature {
  margin-top: 1.8rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.42rem;
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  border-radius: 0.25rem;
  font: 700 0.72rem/1.2 var(--mono);
  text-transform: uppercase;
}

footer {
  display: flex;
  width: min(100% - 5rem, 60rem);
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font: 600 0.8rem/1.55 var(--mono);
}

@media (max-width: 1020px) {
  .site-shell {
    display: block;
  }

  .site-shell::before {
    left: 0;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
    position: sticky;
    z-index: 20;
    top: 8px;
    min-height: 4rem;
    padding: 0.6rem 1rem;
    align-items: center;
    justify-content: space-between;
    background: var(--warm);
    border-bottom: var(--border);
  }

  .brand.compact .brand-mark {
    width: 2.2rem;
    height: 2.2rem;
  }

  .mobile-nav {
    position: relative;
  }

  .mobile-nav summary {
    padding: 0.45rem 0.6rem;
    cursor: pointer;
    color: var(--on-primary-container);
    background: var(--primary-container);
    border: var(--border);
    font: 700 0.78rem/1.2 var(--mono);
    text-transform: uppercase;
  }

  .mobile-nav div {
    position: absolute;
    top: 2.8rem;
    right: 0;
    width: 17rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding: 0.6rem;
    background: var(--white);
    border: var(--border);
  }

  .mobile-nav a {
    display: block;
    padding: 0.48rem 0.5rem;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    font-size: 0.96rem;
    text-decoration: none;
  }

  .mobile-nav a:hover {
    color: var(--white);
    background: var(--tertiary);
  }

  .mobile-nav a[aria-current="page"] {
    color: var(--on-primary-container);
    background: var(--primary-container);
    border: 2px solid var(--on-surface);
  }

  .mobile-nav .section-nav {
    margin: 0.45rem 0 0.8rem;
    padding-top: 0.4rem;
  }

  .mobile-nav .section-nav a {
    padding: 0.3rem 0.4rem;
    font-size: 0.78rem;
  }

  .mobile-nav .section-nav .section-nav-level-3 a {
    padding-left: 1rem;
    font-size: 0.72rem;
  }

  .content {
    padding-top: 4rem;
  }

  .content,
  footer {
    width: min(100% - 4rem, 60rem);
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  html {
    font-size: 18px;
  }

  .content,
  footer {
    width: min(100% - 2rem, 60rem);
  }

  .content {
    padding-bottom: 4rem;
  }

  h1 {
    font-size: clamp(2.8rem, 13vw, 4.2rem);
  }

  h2 {
    margin-top: 3.5rem;
  }

  .pipeline,
  .source-map {
    grid-template-columns: 1fr;
  }

  .pipeline li {
    min-height: auto;
    padding: 0.8rem;
  }

  .next-page {
    grid-template-columns: 1fr;
  }

  .next-page a {
    text-align: left;
  }

  pre {
    padding: 1rem;
    font-size: 0.94rem;
  }

  footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media print {
  body::before,
  .sidebar,
  .mobile-header,
  footer {
    display: none;
  }

  .content {
    width: 100%;
    padding: 0;
  }
}
