/* FTCDesign — clean docs layout */

:root {
  --bg: #1a1918;
  --bg-alt: #232220;
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --ink: #f0ece6;
  --ink-soft: #bbb6ad;
  --ink-muted: #807a72;
  --line: #322f2c;
  --line-strong: #46423e;

  --orange: #589CE9;
  --orange-dark: #52a0f2;
  --orange-soft: #0a1b2d;
  
  --track: #100f0e;

  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", Menlo, Consolas, monospace;

  --radius: 4px;
  --header-h: 100px;
  --header-h-row1: 60px;
  --sidebar-w: 260px;
  --toc-w: 260px;
  --content-max: 1100px;
}

[data-theme="light"] {
  --bg: #fafaf7;
  --bg-alt: #f1efea;
  --bg-overlay: rgba(26, 25, 24, 0.4);
  --ink: #1a1918;
  --ink-soft: #4f4d47;
  --ink-muted: #8a857c;
  --line: #e4e1d9;
  --line-strong: #c7c2b8;

  --orange: #589CE9;
  --orange-dark: #52a0f2;
  --orange-soft: #0a1b2d;

  --track: #ebe7df;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  scrollbar-color: var(--line-strong) var(--track);
  scrollbar-width: thin;
  background: var(--bg);
  color-scheme: dark;
}
html[data-theme="light"] { color-scheme: light; }

@view-transition { navigation: auto; }

/* Persistent shell: header, sidebar, and footer carry a name so the browser
   pairs them across pages and we can opt them out of the transition. */
.site-header { view-transition-name: site-header; }
.sidebar { view-transition-name: site-sidebar; }
.site-footer { view-transition-name: site-footer; }

::view-transition-group(site-header),
::view-transition-group(site-sidebar),
::view-transition-group(site-footer) {
  animation-duration: 0s;
}
::view-transition-old(site-header),
::view-transition-new(site-header),
::view-transition-old(site-sidebar),
::view-transition-new(site-sidebar),
::view-transition-old(site-footer),
::view-transition-new(site-footer) {
  animation: none;
  mix-blend-mode: normal;
}

/* Only the unnamed root content (main column) crossfades. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 240ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
::view-transition-old(root) { animation-name: vtFadeOut; }
::view-transition-new(root) { animation-name: vtFadeIn; }
@keyframes vtFadeOut { to { opacity: 0; } }
@keyframes vtFadeIn { from { opacity: 0; } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--track); }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 2px solid var(--track);
}
::-webkit-scrollbar-thumb:hover { background: var(--orange); }
::-webkit-scrollbar-corner { background: var(--track); }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}
.main { animation: mainFadeIn 220ms cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes mainFadeIn { from { opacity: 0; } to { opacity: 1; } }
@supports (view-transition-name: root) {
  .main { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  .main { animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.001ms; }
}

a {
  color: var(--orange-dark);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--sans);
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.015em;
  font-weight: 600;
}
h1 { font-size: 2.6rem; line-height: 1.1; font-weight: 600; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; line-height: 1.25; font-weight: 600; }
h3 { font-size: 1.15rem; line-height: 1.35; font-weight: 600; }
h4 { font-size: 0.92rem; }

p { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; margin: 0 0 1em; }
li { margin-bottom: 0.3em; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-alt);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  color: var(--orange-dark);
}

hr { border: none; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---- Header ---- */

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

.site-header__inner {
  width: 100%;
  min-width: 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header-h-row1);
}

.site-nav {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  display: flex;
  gap: 2px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
}
.site-nav a:hover { color: var(--ink); text-decoration: none; background: color-mix(in srgb, var(--orange) 8%, transparent); }
.site-nav a[aria-current="page"] {
  color: var(--orange);
  border-bottom-color: var(--orange);
  font-weight: 600;
}
.site-nav a.site-nav__featured {
  color: var(--ink);
  font-weight: 600;
}
.site-nav a.site-nav__featured[aria-current="page"] { color: var(--orange); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
  line-height: 1;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand:hover .brand__mark img,
.brand:hover .brand__mark svg { filter: brightness(0.92); }
.brand__mark {
  width: 32px; height: 32px;
  display: inline-grid;
  place-items: center;
}
.brand__mark img,
.brand__mark svg {
  width: 32px;
  height: 32px;
  display: block;
  transition: filter 120ms ease;
}
.brand__sep {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: var(--line-strong);
  margin: 0 2px;
}
.brand__sub {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  padding-top: 2px;
}
@media (max-width: 540px) { .brand__sep, .brand__sub { display: none; } }

.hamburger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  width: 32px; height: 32px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
  color: var(--ink-soft);
  transition: border-color 120ms ease, color 120ms ease;
}
.hamburger:hover { border-color: var(--ink-muted); color: var(--ink); }
.hamburger span {
  background: currentColor;
}
.hamburger span {
  display: block;
  width: 14px; height: 1.5px;
  background: var(--ink);
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-muted);
  font: 0.86rem var(--sans);
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 24px;
}
.search-trigger:hover { border-color: var(--ink-muted); color: var(--ink); }
.search-trigger__label { flex: 1; text-align: left; }
.search-trigger kbd {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--bg);
  color: var(--ink-muted);
}

.theme-toggle, .header-link {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink-soft);
  text-decoration: none;
  flex: 0 0 auto;
}
.theme-toggle:hover, .header-link:hover {
  border-color: var(--ink-muted);
  color: var(--ink);
}
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ---- Layout ---- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.layout--no-toc {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 86vw;
  z-index: 61;
  overflow-y: auto;
  padding: 24px 16px 32px 24px;
  border-right: 1px solid var(--line);
  font-size: 0.92rem;
  background: var(--bg);
  transform: translateX(-100%);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.open { transform: translateX(0); }

/* Inner pages dock the sidebar into a fixed left column at desktop widths */
@media (min-width: 841px) {
  .layout--with-sidebar {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .layout--with-sidebar .sidebar {
    position: relative;
    inset: auto;
    width: auto;
    max-width: none;
    z-index: auto;
    height: 100%;
    transform: none;
    transition: none;
  }
  .layout--with-sidebar .sidebar__close { display: none; }
  .layout--with-sidebar .sidebar-backdrop { left: var(--sidebar-w); }
}

.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar nav > a {
  padding: 5px 10px;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 3px;
  border-left: 2px solid transparent;
  margin-left: -2px;
}
.sidebar nav > a:hover { color: var(--ink); text-decoration: none; }
.sidebar nav > a[aria-current="page"] {
  color: var(--orange);
  border-left-color: var(--orange);
  background: var(--orange-soft);
  font-weight: 600;
}

.sidebar h4 {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.012em;
  text-transform: none;
  color: var(--ink);
  margin: 22px 0 8px;
  padding: 4px 10px;
  transition: color 120ms ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  border-radius: 3px;
}
.sidebar h4:hover { color: var(--orange); background: color-mix(in srgb, var(--orange) 8%, transparent); }
.sidebar h4::after {
  content: "";
  width: 7px; height: 7px;
  border-right: 1.6px solid var(--ink-muted);
  border-bottom: 1.6px solid var(--ink-muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 160ms ease, border-color 120ms ease;
  flex-shrink: 0;
}
.sidebar h4:hover::after { border-color: var(--orange); }
.sidebar h4.is-collapsed::after {
  transform: rotate(-45deg) translate(-1px, 1px);
}
.sidebar h4:first-of-type { margin-top: 8px; }
.sidebar h4.active-section { color: var(--orange); }
.sidebar h4.active-section::after { border-color: var(--orange); }
.sidebar h4:first-of-type { margin-top: 4px; }

.sidebar .sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 0;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  margin: 4px 0 4px 12px;
}
.sidebar .sub a {
  padding: 4px 10px;
  font-size: 0.86rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 3px;
}
.sidebar .sub a:hover { color: var(--ink); text-decoration: none; }
.sidebar .sub a[aria-current="page"] {
  color: var(--orange);
  font-weight: 600;
  background: var(--orange-soft);
}
.sidebar [hidden] { display: none !important; }

.sidebar__close {
  display: inline-grid;
  place-items: center;
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
}

.main {
  padding: 40px 56px 80px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

.main__inner { max-width: var(--content-max); margin: 0 auto; }

.toc {
  position: fixed;
  top: var(--header-h);
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 86vw;
  z-index: 60;
  overflow-y: auto;
  padding: 40px 24px 32px 24px;
  font-size: 0.85rem;
  background: var(--bg);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
.toc.open { transform: translateX(0); }
.toc__close {
  position: absolute;
  top: 12px; right: 12px;
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
}
.toc__close:hover { border-color: var(--ink-muted); }
.toc h4 {
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange);
  margin: 0 0 8px;
  font-weight: 600;
}
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 4px 10px;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -2px;
}
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc:not(.home-rail) a:not(.toc--h3) {
  color: var(--ink);
  font-weight: 600;
  margin-top: 14px;
}
.toc:not(.home-rail) ul > li:first-child > a:not(.toc--h3) { margin-top: 0; }
.toc .toc--h3 {
  padding-left: 26px;
  font-size: 0.82rem;
  border-left-color: var(--line);
}
.toc a.active {
  color: var(--orange);
  border-left-color: var(--orange);
  font-weight: 600;
}

/* Dock the TOC into a fixed right column on wide screens */
@media (min-width: 1100px) {
  .layout--with-toc {
    grid-template-columns: minmax(0, 1fr) var(--toc-w);
  }
  .layout--with-sidebar.layout--with-toc {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  }
  .layout--with-toc .toc {
    position: relative;
    inset: auto;
    width: auto;
    max-width: none;
    z-index: auto;
    height: 100%;
    transform: none;
    transition: none;
    padding-top: 28px;
  }
  .layout--with-toc .toc__close { display: none; }
}

/* ---- Homepage right-rail (reuses .toc layout, custom content) ---- */
.home-rail h4 { margin-top: 0; }
.home-rail h4 + p,
.home-rail h4 + ul { margin-top: 8px; }
.home-rail p {
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0 0 22px;
}
.home-rail p a {
  color: var(--orange-dark);
  text-decoration: none;
  border-bottom: 1px dotted var(--line-strong);
}
.home-rail p a:hover {
  border-bottom-color: var(--orange);
  color: var(--orange);
}
.home-rail h4:not(:first-child) { margin-top: 24px; }
.home-rail .contributors {
  list-style: none;
  padding: 0;
  margin: 0;
}
.home-rail .contributors li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.home-rail .contributors li:last-child { border-bottom: none; }
.home-rail .contributor__name {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
}
.home-rail .contributor__team {
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  font-weight: 500;
}
.home-rail .rail-links {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.home-rail .rail-links li { padding: 0; margin: 0; }
.home-rail .rail-links a,
.home-rail .rail-links button.rail-theme {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: auto;
  padding: 8px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-decoration: none;
  font: 0.86rem var(--sans);
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease, color 120ms ease;
}
.home-rail .rail-links a:hover,
.home-rail .rail-links button.rail-theme:hover {
  border-color: var(--orange);
  color: var(--ink);
}
.home-rail .rail-links svg { flex: 0 0 16px; }
.home-rail .rail-links button.rail-theme { place-items: stretch; }
.home-rail .rail-links .rail-theme .icon-moon { display: none; }
.home-rail .rail-links .rail-theme .icon-sun { display: block; }
[data-theme="light"] .home-rail .rail-links .rail-theme .icon-sun { display: none; }
[data-theme="light"] .home-rail .rail-links .rail-theme .icon-moon { display: block; }

@media (max-width: 1100px) {
  .main { padding: 32px 40px 64px; }
}

/* On wide monitors, give the layout a little more room and nudge the
   typography up so things stay proportional rather than shrinking into
   a column in the middle of the screen. */
@media (min-width: 1600px) {
  :root {
    --sidebar-w: 280px;
    --toc-w: 280px;
    --content-max: 1180px;
  }
  .main { padding: 48px 64px 96px; }
}
@media (min-width: 2000px) {
  :root {
    --sidebar-w: 300px;
    --toc-w: 300px;
    --content-max: 1280px;
  }
  body { font-size: 17px; }
}
@media (min-width: 2400px) {
  :root {
    --content-max: 1360px;
  }
  body { font-size: 18px; }
}

@media (max-width: 840px) {
  .main { padding: 24px 20px 56px; }
  .search-trigger { max-width: none; margin-left: 8px; }
  .search-trigger__label, .search-trigger kbd { display: none; }
  .site-header__inner { gap: 10px; padding: 0 14px; }
}

@media (max-width: 640px) {
  /* Free up header space on phones — these are also reachable via the
     sidebar/home-rail. */
  .site-header__inner .header-link { display: none; }
}

@media (max-width: 540px) {
  .brand span:last-child { display: none; }
  .search-trigger { padding: 6px 8px; }
}

/* ---- Backdrop for mobile sidebar ---- */
.sidebar-backdrop {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: var(--bg-overlay);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
body.no-scroll { overflow: hidden; }

/* ---- Breadcrumbs ---- */
.crumbs {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-bottom: 18px;
}
.crumbs a { color: var(--ink-muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs span { margin: 0 6px; }

/* ---- Prose ---- */
.prose h1 {
  margin-bottom: 16px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.prose .lede {
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 36px;
  max-width: 60ch;
}
.prose h2 {
  margin-top: 44px;
  scroll-margin-top: 80px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 1.4rem;
}
.prose h3 {
  margin-top: 28px;
  scroll-margin-top: 80px;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.05rem;
}
.prose p { color: var(--ink-soft); font-size: 1rem; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol {
  list-style: none;
  padding-left: 0;
}
.prose ul li, .prose ol li {
  color: var(--ink-soft);
  position: relative;
  padding-left: 22px;
  margin-bottom: 0.5em;
}
.prose ul li strong, .prose ol li strong { color: var(--ink); }
.prose ul li::before {
  content: "";
  position: absolute;
  left: 4px; top: 0.7em;
  width: 8px; height: 1.5px;
  background: var(--orange);
}
.prose ol { counter-reset: prose-counter; }
.prose ol li {
  counter-increment: prose-counter;
  padding-left: 32px;
}
.prose ol li::before {
  content: counter(prose-counter);
  position: absolute;
  left: 0; top: 0.05em;
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  background: var(--orange-soft);
  color: var(--orange);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}
.prose p a, .prose li a {
  color: var(--orange-dark);
  border-bottom: 1px dotted var(--line-strong);
  text-decoration: none;
}
.prose p a:hover, .prose li a:hover {
  border-bottom-color: var(--orange);
  text-decoration: none;
}

.prose blockquote {
  margin: 18px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--orange);
  color: var(--ink);
  background: var(--bg-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---- Pager ---- */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.pager a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  background: var(--bg-alt);
}
.pager a:hover { border-color: var(--orange); text-decoration: none; }
.pager a:hover .pager__title { color: var(--orange); }
.pager__label {
  display: block;
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange);
  margin-bottom: 4px;
  font-weight: 600;
}
.pager__title { font-weight: 600; color: var(--ink); font-size: 0.98rem; }
.pager .pager--next { text-align: right; }
.pager .pager--prev:only-child { grid-column: 1 / 2; }
.pager .pager--next:only-child { grid-column: 2 / 3; }
@media (max-width: 540px) {
  .pager { grid-template-columns: 1fr; }
}

/* ---- Callout ---- */
.callout {
  margin: 22px 0;
  padding: 14px 18px;
  border: 1px solid var(--orange);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--orange-soft);
}
.callout__label {
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--orange);
  margin-bottom: 6px;
}
.callout p { color: var(--ink); }
.callout p:last-child { margin-bottom: 0; }

/* ---- Section timeline (homepage) ---- */
.section-grid {
  list-style: none;
  padding: 0 0 0 22px;
  margin: 24px 0 0;
  position: relative;
  counter-reset: section-num;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.section-grid::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.section-grid li {
  margin: 0;
  padding: 0;
  position: relative;
  counter-increment: section-num;
}
.section-grid li::before { display: none; }
.section-grid a, .paths a {
  border-bottom-style: none !important;
}
.section-grid a {
  display: block;
  position: relative;
  padding: 0 16px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
  min-height: 104px;
}
.section-grid a::before {
  content: "";
  display: block;
  height: 6px;
  background: var(--orange);
  margin: 0 -16px 16px;
  transition: background-color 160ms ease;
}
.section-grid a:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--orange) 12%, var(--bg-alt));
  transform: translateX(2px);
  text-decoration: none;
}
.section-grid a:hover::before { background: var(--orange-dark); }
.section-grid a:hover .section__title { color: var(--orange); }
.section-grid .section__num { display: none; }
.section-grid .section__title {
  display: block;
  font-weight: 600;
  color: var(--ink);
  font-size: 1rem;
  margin: 0 0 3px;
  padding-right: 100px;
  letter-spacing: -0.01em;
}
.section-grid .section__sub {
  display: block;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}
.section-grid .section__meta {
  position: absolute;
  top: 20px;
  right: 14px;
  margin-top: 0;
  padding: 1px 7px;
  background: var(--orange-soft);
  color: var(--orange);
  font-family: var(--sans);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  font-weight: 600;
}

/* ---- Quick paths (3-column homepage helper) ---- */
.paths {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0 8px;
  padding: 0;
  list-style: none;
}
.paths li { margin: 0; padding: 0; }
.paths li::before { display: none; }
.paths a {
  display: block;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
}
.paths a:hover { border-color: var(--orange); text-decoration: none; }
.paths .path__tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 6px;
  font-weight: 600;
}
.paths .path__title { display: block; font-weight: 600; color: var(--ink); font-size: 0.95rem; }
.paths .path__sub { display: block; color: var(--ink-soft); font-size: 0.85rem; margin-top: 3px; line-height: 1.4; }
@media (max-width: 720px) { .paths { grid-template-columns: 1fr; } }

/* ---- Homepage hero ---- */
.prose.home > .hero + * { margin-top: 0; }
.prose.home .hero ~ section { margin-top: 56px; }
.prose.home h2 { border-bottom: none; padding-bottom: 0; }

.hero {
  position: relative;
  margin: -8px -8px 8px;
  padding: 44px 32px 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    radial-gradient(900px 320px at 8% -20%, color-mix(in srgb, var(--orange) 22%, transparent), transparent 60%),
    radial-gradient(700px 280px at 110% 0%, color-mix(in srgb, var(--orange-dark) 14%, transparent), transparent 65%),
    var(--bg-alt);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--line) 70%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--line) 70%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 90% 100%, rgba(0,0,0,0.55), transparent 60%);
  -webkit-mask-image: radial-gradient(circle at 90% 100%, rgba(0,0,0,0.55), transparent 60%);
  opacity: 0.6;
}
.hero > * { position: relative; z-index: 1; }
.hero__eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  background: var(--orange-soft);
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 14px;
  font-weight: 600;
}
.hero__title {
  font-size: 2.4rem;
  line-height: 1.08;
  letter-spacing: -0.028em;
  margin: 0 0 14px;
  max-width: 22ch;
  color: var(--ink);
  border-bottom: none;
  padding-bottom: 0;
}
.hero__lede {
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 0 22px;
}
.hero__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 22px;
}
.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.94rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.hero__cta--primary {
  background: var(--orange);
  color: #1a1a1a;
  border-color: var(--orange);
}
.hero__cta--primary:hover {
  background: var(--orange-dark);
  border-color: var(--orange-dark);
  color: #1a1a1a;
  text-decoration: none;
  transform: translateX(2px);
}
[data-theme="light"] .hero__cta--primary { color: #fff; }
[data-theme="light"] .hero__cta--primary:hover { color: #fff; }
.hero__cta--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.hero__cta--secondary:hover {
  border-color: var(--orange);
  color: var(--orange);
  text-decoration: none;
}
.hero__chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hero__chips li {
  margin: 0;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--bg) 65%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.hero__chips li::before { display: none; }
.hero__footnote {
  margin: 18px 0 0;
  font-size: 0.86rem;
  color: var(--ink-muted);
  font-family: var(--sans);
}
@media (max-width: 640px) {
  .hero { padding: 32px 22px 28px; }
  .hero__title { font-size: 1.85rem; }
  .hero__lede { font-size: 1rem; }
}

/* ---- Tutorials/Course promo box ---- */
.tutorials-box {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 18px;
  margin: 24px 0 0;
  padding: 18px 22px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
  font-family: var(--sans);
}
.tutorials-box:hover {
  text-decoration: none;
  border-color: var(--orange);
  border-left-color: var(--orange-dark);
  background: color-mix(in srgb, var(--orange) 8%, var(--bg-alt));
  transform: translateX(2px);
}
.tutorials-box__icon {
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--orange-soft);
  color: var(--orange);
}
.tutorials-box:hover .tutorials-box__icon {
  background: var(--orange);
  color: #1a1a1a;
}
[data-theme="light"] .tutorials-box:hover .tutorials-box__icon { color: #fff; }
.tutorials-box__body { display: block; }
.tutorials-box__eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 4px;
}
.tutorials-box__title {
  display: block;
  font-weight: 600;
  font-size: 1.04rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 3px;
}
.tutorials-box__sub {
  display: block;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.tutorials-box__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--orange);
  color: #1a1a1a;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: background-color 140ms ease;
}
[data-theme="light"] .tutorials-box__cta { color: #fff; }
.tutorials-box:hover .tutorials-box__cta { background: var(--orange-dark); }
@media (max-width: 720px) {
  .tutorials-box {
    grid-template-columns: 44px 1fr;
    grid-template-areas:
      "icon body"
      "cta cta";
    gap: 14px 16px;
  }
  .tutorials-box__icon { grid-area: icon; }
  .tutorials-box__body { grid-area: body; }
  .tutorials-box__cta { grid-area: cta; justify-self: start; }
}

/* ---- Start-here paths variant ---- */
.start-here__head h2,
.explore__head h2,
.reassure h2 {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 1.35rem;
}
.start-here__head p,
.explore__head p {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 0 0 18px;
  max-width: 60ch;
}
.paths--start { grid-template-columns: repeat(3, 1fr); }
.paths--start a {
  background: var(--bg-alt);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  transition: border-color 160ms ease, transform 160ms ease;
}
.paths--start a:hover { transform: translateY(-2px); border-color: var(--orange); }
.paths--start .path__sub { flex: 1; margin-bottom: 10px; }
.paths--start .path__hint {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--orange);
  font-weight: 600;
  margin-top: auto;
}
.paths--start a:hover .path__hint { color: var(--orange-dark); }
@media (max-width: 720px) { .paths--start { grid-template-columns: 1fr; } }

/* ---- Section grid with icons ---- */
.section-grid--icons {
  padding-left: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.section-grid--icons::before { display: none; }
.section-grid--icons li::before { display: none; }
.section-grid--icons a {
  padding: 18px 18px 18px 64px;
  min-height: 92px;
  display: block;
}
.section-grid--icons a::before { display: none; }
.section-grid--icons .section__icon {
  position: absolute;
  left: 18px;
  top: 18px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--orange-soft);
  color: var(--orange);
  transition: background-color 160ms ease, color 160ms ease;
}
.section-grid--icons a:hover .section__icon {
  background: var(--orange);
  color: #1a1a1a;
}
[data-theme="light"] .section-grid--icons a:hover .section__icon { color: #fff; }
.section-grid--icons .section__title {
  padding-right: 110px;
  font-size: 1.02rem;
}
.section-grid--icons .section__sub { margin-top: 2px; }
.section-grid--icons .section__meta { top: 22px; right: 18px; }
.section-grid--icons .stage-num {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
@media (max-width: 760px) {
  .section-grid--icons { grid-template-columns: 1fr; }
}

/* ---- Reassurance grid ---- */
.reassure__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.reassure__card {
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.reassure__card h3 {
  font-size: 0.96rem;
  margin: 0 0 6px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.reassure__card p {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}
@media (max-width: 760px) {
  .reassure__grid { grid-template-columns: 1fr; }
}

/* ---- Tutorial cards ---- */
.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 16px 0 12px;
  padding-left: 0;
  list-style: none;
}
.tut-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transition: border-color 160ms ease, transform 160ms ease;
  min-height: 340px;
}
.tut-card:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
  text-decoration: none;
}
.prose .tut-card { border-bottom-style: solid; }
.tut-card__media {
  aspect-ratio: 4 / 3;
  position: relative;
  background:
    repeating-linear-gradient(
      45deg,
      color-mix(in srgb, var(--orange) 5%, var(--bg)) 0 12px,
      var(--bg-alt) 12px 24px
    );
  border-bottom: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-muted);
}
.tut-card__media svg { width: 38px; height: 38px; opacity: 0.55; }
.tut-card__body {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.tut-card__body .diff { align-self: flex-start; margin: 0; }
.tut-card__title {
  margin: 2px 0 0;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
  line-height: 1.3;
}
.tut-card:hover .tut-card__title { color: var(--orange); }
.tut-card__sub {
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}
@media (max-width: 540px) {
  .tutorial-grid { grid-template-columns: 1fr; }
}

/* ---- Tutorial difficulty pills ---- */
.diff {
  display: inline-block;
  padding: 1px 9px;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  margin: 0 4px 0 4px;
  vertical-align: 0.08em;
  white-space: nowrap;
}
.diff--easy { background: rgba(95, 164, 95, 0.18); color: #7fc97f; }
.diff--medium { background: var(--orange-soft); color: var(--orange); }
.diff--hard { background: rgba(211, 93, 93, 0.18); color: #e07b7b; }
[data-theme="light"] .diff--easy { background: rgba(76, 132, 76, 0.16); color: #3f7a3f; }
[data-theme="light"] .diff--hard { background: rgba(180, 50, 50, 0.14); color: #a83030; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 0;
}
.site-footer__inner {
  width: 100%;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer a { color: var(--ink-muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink-soft); text-decoration: underline; }

/* ---- Search modal ---- */
.search-modal {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 0;
}
.search-modal.open { display: flex; }
.search-modal__panel {
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  overflow: hidden;
}
.search-modal__input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.search-modal__input-wrap svg { flex: 0 0 16px; color: var(--ink-muted); }
.search-modal__input {
  flex: 1;
  background: none;
  border: none;
  font: 0.95rem var(--sans);
  color: var(--ink);
  outline: none;
}
.search-modal__close {
  font: 0.74rem var(--mono);
  background: var(--bg-alt);
  border: 1px solid var(--line-strong);
  color: var(--ink-muted);
  border-radius: 3px;
  padding: 1px 6px;
  cursor: pointer;
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 50vh;
  overflow-y: auto;
}
.search-results li a {
  display: block;
  padding: 8px 12px;
  border-radius: 3px;
  color: var(--ink);
  text-decoration: none;
}
.search-results li a:hover,
.search-results li.active a {
  background: var(--orange-soft);
  color: var(--orange-dark);
}
.search-results .result__title { font-weight: 500; font-size: 0.93rem; }
.search-results .result__sub { font-size: 0.8rem; color: var(--ink-muted); margin-top: 1px; }
.search-results li.active .result__sub { color: var(--orange-dark); }
.search-results__empty {
  padding: 16px;
  color: var(--ink-muted);
  text-align: center;
  font-size: 0.88rem;
}
.search-modal__hints {
  display: flex;
  gap: 14px;
  padding: 6px 14px;
  border-top: 1px solid var(--line);
  font-size: 0.74rem;
  color: var(--ink-muted);
  background: var(--bg-alt);
}
.search-modal__hints kbd {
  font-family: var(--mono);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 0 4px;
  margin-right: 4px;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

/* ---- Tutorial detail pages ---- */
.tut-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: 0 0 18px;
  font-size: 0.82rem;
  color: var(--ink-muted);
}
.tut-meta .diff { margin: 0; }
.tut-meta__dot { color: var(--line-strong); }

.tut-hero {
  position: relative;
  aspect-ratio: 16 / 7;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0 0 28px;
  background:
    repeating-linear-gradient(
      45deg,
      color-mix(in srgb, var(--orange) 6%, var(--bg)) 0 14px,
      var(--bg-alt) 14px 28px
    );
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  overflow: hidden;
}
.tut-hero__label {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.tut-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 22px;
  margin: 28px 0;
  align-items: start;
}
.tut-step__figure {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    repeating-linear-gradient(
      135deg,
      color-mix(in srgb, var(--orange) 5%, var(--bg)) 0 12px,
      var(--bg-alt) 12px 24px
    );
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  overflow: hidden;
}
.tut-step__figure-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.tut-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--orange);
  color: #1a1918;
  font-weight: 700;
  font-size: 0.82rem;
  margin-right: 8px;
  vertical-align: 0.12em;
}
.tut-step__body h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  letter-spacing: -0.012em;
}
.tut-step__body p { margin: 0 0 10px; }
@media (max-width: 760px) {
  .tut-step { grid-template-columns: 1fr; }
  .tut-step__figure { aspect-ratio: 16 / 9; }
}

/* Inline clickable tip — example text that pops up next to a phrase. */
.tip {
  position: relative;
  display: inline;
  border-bottom: 1px dashed var(--orange);
  color: var(--ink);
  cursor: help;
  padding: 0 1px;
  font: inherit;
  background: none;
  outline: none;
}
.tip::after {
  content: "i";
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--orange);
  background: var(--orange-soft);
  border-radius: 999px;
  margin: 0 2px 0 4px;
  vertical-align: 0.1em;
  line-height: 1;
}
.tip:hover, .tip:focus-visible, .tip.is-open {
  background: var(--orange-soft);
}
.tip__pop {
  position: absolute;
  z-index: 20;
  left: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  max-width: 320px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--orange);
  border-radius: 5px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--ink-soft);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 0s linear 140ms;
  pointer-events: none;
  white-space: normal;
}
.tip__pop::before {
  content: "Tip";
  display: block;
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 4px;
}
.tip:hover .tip__pop,
.tip:focus-within .tip__pop,
.tip.is-open .tip__pop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity 140ms ease, transform 140ms ease, visibility 0s linear 0s;
}
@media (max-width: 540px) {
  .tip__pop { min-width: 200px; max-width: 80vw; }
}
