/* Black, white, and gold. Dark is the default, including with no
   JavaScript and with no saved preference. Light applies only when
   data-theme="light" and is black on white. Gold is a heading color in
   dark. In light it is only the active-nav underline and the code prompt.
   Link text is black in light and off-white in dark, and content links
   stay underlined. */
:root {
  color-scheme: dark;
  --bg: #0B0B0C;
  --bg-elev: #141415;
  --ink: #F2F0EA;
  --muted: #ABA9A2;
  --line: #2A2A2C;
  --accent: #E3BF6A;
  --accent-contrast: #0B0B0C;
  --link: #F2F0EA;
  --link-hover: #FFFFFF;
  --clay: #E3BF6A;
  --nav-mark: #E3BF6A;
  --prompt: #E3BF6A;
  --pill: #1E1C17;
  --pill-ink: #E8D7AE;
  --code-bg: #050505;
  --code-fg: #EAE8E2;
  --inline-code-bg: #1C1C1E;
  --inline-code-fg: #EDE6D3;
  --callout: #1A160D;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  --grid-line: rgba(255, 255, 255, 0.045);
  --grid-size: 48px;
  --header-sticky: 5.25rem;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF;
  --bg-elev: #FFFFFF;
  --ink: #111111;
  --muted: #5F5F5F;
  --line: #E4E4E4;
  --accent: #111111;
  --accent-contrast: #FFFFFF;
  --link: #111111;
  --link-hover: #000000;
  --clay: #0B0B0C;
  --nav-mark: #B8913A;
  --prompt: #B8913A;
  --pill: #F1F1F1;
  --pill-ink: #111111;
  --code-bg: #0B0B0C;
  --code-fg: #F2F0EA;
  --inline-code-bg: #F1F1F1;
  --inline-code-fg: #111111;
  --callout: #F1F1F1;
  --shadow: 0 1px 0 rgba(17, 17, 17, 0.04);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.6;
}

:root[data-theme="light"] body {
  background-image: none;
}

::selection {
  background: #E3BF6A;
  color: #111111;
}

:root[data-theme="light"] ::selection {
  background: #111111;
  color: #FFFFFF;
}

img {
  max-width: 100%;
}

a {
  color: var(--link);
  text-underline-offset: 0.16em;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button,
input {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4 {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--clay);
}

.wrap {
  width: min(1120px, calc(100% - 2.4rem));
  margin-inline: auto;
}

.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: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.6rem;
}

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

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.15rem;
  padding: 0.75rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}

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

.brand-logo {
  display: none;
  height: 48px;
}

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

.brand-logo-dark {
  display: block;
}

:root[data-theme="light"] .brand-logo-dark {
  display: none;
}

:root[data-theme="light"] .brand-logo-light {
  display: block;
}

.site-nav {
  display: flex;
  gap: 0.9rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--nav-mark);
}

.search-form {
  position: relative;
  flex: 1 1 16rem;
  min-width: 12rem;
}

.search-form input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.48rem 0.8rem;
}

:root[data-theme="light"] .search-form input {
  background: #FAFAFA;
}

.search-results {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 30;
  width: min(34rem, calc(100vw - 1.5rem));
  max-height: 24rem;
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(18, 22, 20, 0.16);
}

.search-hit {
  display: block;
  padding: 0.7rem 0.9rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
}

.search-hit:last-child {
  border-bottom: 0;
}

.search-hit:hover,
.search-hit.is-active {
  background: var(--pill);
  color: inherit;
}

.search-kind {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clay);
  font-weight: 600;
}

:root[data-theme="light"] .search-kind {
  color: var(--muted);
}

.search-hit strong {
  display: block;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
}

.search-snippet {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-empty {
  margin: 0;
  padding: 0.8rem 0.9rem;
  color: var(--muted);
}

mark {
  background: #E3BF6A;
  color: #111111;
  border-radius: 2px;
  padding: 0 0.12em;
}

:root[data-theme="light"] mark {
  background: #111111;
  color: #FFFFFF;
}

.theme-toggle {
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
}

.theme-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
}

.icon-moon { display: none; }

:root[data-theme="light"] .icon-moon { display: block; }
:root[data-theme="light"] .icon-sun { display: none; }

main {
  padding-bottom: 4rem;
}

.hero {
  padding: 2.3rem 0 0.4rem;
  max-width: 40rem;
}

.kicker {
  margin: 0 0 0.35rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clay);
}

:root[data-theme="light"] .kicker {
  color: var(--muted);
}

h1 {
  margin: 0 0 0.55rem;
  font-size: clamp(2rem, 4vw, 2.7rem);
}

.lede {
  margin: 0;
  font-size: 1.12rem;
  color: var(--muted);
}

.meta {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.5rem 0 1.15rem;
}

.tag-btn {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.tag-btn:hover {
  border-color: var(--clay);
}

.tag-btn.is-active {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--accent-contrast);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 0.85rem;
}

a.card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 100%;
  padding: 0.95rem 1rem 0.9rem;
  text-decoration: none;
  color: inherit;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

a.card:hover {
  border-color: var(--clay);
  color: inherit;
  transform: translateY(-1px);
}

a.card h3 {
  margin: 0;
  font-size: 1.28rem;
}

a.card p {
  margin: 0;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card.is-hidden {
  display: none;
}

.card-tags,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
}

.card-tags li,
.tag-list a {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--pill-ink);
  background: var(--pill);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  text-decoration: none;
}

.tag-list a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.tag-list {
  margin-top: 0.85rem;
}

.tag-list a:hover {
  color: var(--link);
}

.empty-state {
  margin: 1rem 0 0;
  color: var(--muted);
}

.notes-block {
  margin-top: 2.6rem;
}

.notes-block h2 {
  margin: 0 0 0.8rem;
  font-size: 1.45rem;
}

.doc-header {
  grid-area: header;
  padding: 1.55rem 0 0.2rem;
  max-width: 44rem;
}

article.doc > .doc-header {
  padding-top: 0.7rem;
}

.crumbs {
  grid-area: crumbs;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.1rem;
  min-width: 0;
  max-width: 100%;
  margin: 0 0 0.75rem;
}

.crumbs > nav {
  min-width: 0;
  max-width: 100%;
}

article.doc > .crumbs {
  margin: 1.35rem 0 0;
}

.crumb-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.35;
}

.crumb-slot {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.crumb {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.35rem 0.2rem;
  border-radius: 4px;
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

a.crumb {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a.crumb:hover,
a.crumb:focus-visible {
  background: var(--pill);
  color: var(--link-hover);
}

a.crumb-root {
  /* Extra padding is the hit target. The negative margin keeps the
     slash sitting in the path instead of opening a gap. */
  min-width: 2.75rem;
  justify-content: center;
  padding-inline: 0.7rem;
  margin-inline: -0.45rem;
  text-decoration: none;
}

a.crumb-root:hover,
a.crumb-root:focus-visible {
  background: var(--pill);
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink);
  text-underline-offset: 0.18em;
}

.crumb-here {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  cursor: default;
}

.crumb-sep {
  color: var(--ink);
  font-weight: 500;
}

.doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "crumbs"
    "header"
    "body";
  align-items: start;
  column-gap: 2.4rem;
}

.doc.has-toc {
  grid-template-columns: minmax(0, 1fr) 14.25rem;
  grid-template-areas:
    "crumbs crumbs"
    "header toc"
    "body toc";
}

.doc-main {
  grid-area: body;
  min-width: 0;
  margin-top: 0.35rem;
}

.prose {
  min-width: 0;
  max-width: 48rem;
}

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

.prose h2 {
  margin: 2rem 0 0.55rem;
  font-size: 1.5rem;
  padding-top: 0.35rem;
  scroll-margin-top: 6rem;
}

.prose h3 {
  margin: 1.4rem 0 0.4rem;
  font-size: 1.2rem;
  scroll-margin-top: 6rem;
}

.section-topics {
  margin: 1.7rem 0 0.85rem;
  font-size: 1.35rem;
}

.prose a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0.6rem 0;
}

.prose li + li {
  margin-top: 0.25rem;
}

.prose blockquote {
  margin: 1rem 0;
  padding: 0.7rem 0.95rem;
  border-left: 3px solid var(--clay);
  background: var(--callout);
  color: var(--ink);
}

:root[data-theme="light"] .prose blockquote {
  border-left-color: var(--line);
}

:root[data-theme="light"] .prose th {
  color: var(--muted);
}

.prose blockquote p:first-child {
  margin-top: 0;
}

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

.sheet-figure {
  margin: 1rem 0 1.15rem;
}

.sheet-figure a {
  display: block;
  line-height: 0;
  border-radius: 12px;
  text-decoration: none;
}

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

.sheet-figure a:hover img {
  border-color: var(--accent);
}

.sheet-figure figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.table-scroll {
  overflow-x: auto;
  margin: 0.9rem 0 1.2rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table-scroll table {
  margin: 0;
}

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

.prose th {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clay);
}

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

.prose :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--inline-code-bg);
  color: var(--inline-code-fg);
  padding: 0.08em 0.35em;
  border-radius: 4px;
}

div.highlighter-rouge,
.code-wrap {
  position: relative;
  margin: 0.9rem 0 1.1rem;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid #3A3A3C;
  border-radius: 10px;
}

.highlighter-rouge .highlight,
.highlight {
  background: transparent;
  margin: 0;
}

.highlighter-rouge pre,
.code-wrap pre,
.prose pre {
  margin: 0;
  padding: 0.95rem 4.6rem 0.95rem 1rem;
  overflow: auto;
  background: transparent;
  color: var(--code-fg);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.55;
  tab-size: 2;
}

.prose pre code {
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  color: inherit;
  padding: 0;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: 1px solid rgba(242, 240, 234, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: var(--code-fg);
  border-radius: 6px;
  padding: 0.18rem 0.5rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}

/* Prompt glyph only. It is not in the DOM, so Copy leaves it behind. */
div.language-bash.highlighter-rouge pre,
div.language-sh.highlighter-rouge pre,
div.language-shell.highlighter-rouge pre,
div.language-console.highlighter-rouge pre,
div.language-zsh.highlighter-rouge pre {
  padding-left: 2.15rem;
}

div.language-bash.highlighter-rouge::before,
div.language-sh.highlighter-rouge::before,
div.language-shell.highlighter-rouge::before,
div.language-console.highlighter-rouge::before,
div.language-zsh.highlighter-rouge::before {
  content: "$";
  position: absolute;
  z-index: 1;
  top: 0.95rem;
  left: 0.85rem;
  color: var(--prompt);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.55;
  pointer-events: none;
}

.copy-btn:hover,
.copy-btn.is-copied {
  background: rgba(255, 255, 255, 0.16);
}

/* Keywords #E3BF6A, strings #EDE6D3, comments #9A978F, numbers #F5DFA8.
   Shell flags are Rouge .nt; they use the keyword gold so command lines read. */
.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs {
  color: #9A978F;
  font-style: italic;
}

.highlight .k,
.highlight .kc,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt,
.highlight .ow,
.highlight .nt {
  color: #E3BF6A;
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sd,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sx {
  color: #EDE6D3;
}

.highlight .m,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo,
.highlight .il {
  color: #F5DFA8;
}

.highlight .nv,
.highlight .vg,
.highlight .vi,
.highlight .na {
  color: #F5DFA8;
}

.highlight .nb,
.highlight .nc,
.highlight .nf,
.highlight .nn {
  color: var(--code-fg);
}

.toc,
.toc-drawer {
  font-size: 0.9rem;
}

.toc {
  display: none;
}

.doc.has-toc .toc:not([hidden]) {
  display: block;
  grid-area: toc;
  position: sticky;
  top: var(--header-sticky);
  align-self: start;
  width: 100%;
  min-width: 0;
  max-height: calc(100vh - var(--header-sticky) - 1.5rem);
  margin-top: 0;
  padding-top: 0.7rem;
  padding-bottom: 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.toc[hidden],
.toc-drawer[hidden] {
  display: none !important;
}

.toc-label {
  margin: 0 0 0.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol,
.toc-drawer ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li,
.toc-drawer li {
  margin: 0.28rem 0;
}

.toc a,
.toc-drawer a {
  display: inline-block;
  padding: 0.15rem 0.15rem;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.14em;
  overflow-wrap: anywhere;
}

.toc a:hover,
.toc-drawer a:hover {
  color: var(--link-hover);
}

.toc-drawer {
  grid-area: drawer;
  margin: 0.85rem 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
}

.toc-drawer summary {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  list-style: none;
}

.toc-drawer summary::-webkit-details-marker {
  display: none;
}

.toc-drawer summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.55rem;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(-45deg);
  flex: 0 0 auto;
}

.toc-drawer[open] summary::before {
  transform: rotate(45deg) translateY(-2px);
}

.toc-drawer .toc-list {
  margin: 0;
  padding: 0 0.95rem 0.85rem 1.9rem;
}

.topic-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.75rem 1rem;
  align-items: center;
  margin-top: 2.5rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.topic-nav-next {
  text-align: right;
}

.topic-jump {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.12rem;
  min-height: 2.75rem;
  max-width: 100%;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  color: var(--link);
  text-decoration: none;
}

.topic-nav-next .topic-jump {
  align-items: flex-end;
  text-align: right;
}

.topic-jump:hover,
.topic-jump:focus-visible {
  background: var(--pill);
  color: var(--link-hover);
}

.topic-jump-kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.topic-jump-title {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

a.cd-up {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--clay);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

a.cd-up:hover,
a.cd-up:focus-visible {
  background: var(--clay);
  color: var(--accent-contrast);
}

.toc .toc-sub,
.toc-drawer .toc-sub {
  margin-left: 0.75rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.2rem 0 1.6rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-inner p {
  margin: 0;
}

.social {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
}

.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.social svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}

/* Gold is the hover and focus accent. #E3BF6A fails 3:1 on white,
   so light mode uses a darker gold that still clears the non-text bar. */
.social a:hover,
.social a:focus-visible {
  color: #E3BF6A;
}

:root[data-theme="light"] .social a:hover,
:root[data-theme="light"] .social a:focus-visible {
  color: #A07F2C;
  outline-color: #A07F2C;
}

.social-splash {
  margin-top: -0.35rem;
}

.social-splash a {
  width: 2.25rem;
  height: 2.25rem;
  color: #F2F0EA;
}

.social-splash svg {
  width: 1.05rem;
  height: 1.05rem;
}

.social-splash a:hover,
.social-splash a:focus-visible {
  color: #E3BF6A;
  outline-color: #E3BF6A;
}

@media (min-width: 861px) {
  .toc-drawer {
    display: none !important;
  }
}

@media (max-width: 860px) {
  .doc,
  .doc.has-toc {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "crumbs"
      "header"
      "drawer"
      "body";
  }

  .doc.has-toc .toc:not([hidden]) {
    display: none !important;
  }

  .toc-drawer:not([hidden]) {
    display: block;
  }
}

@media (max-width: 640px) {
  .wrap {
    width: min(1120px, calc(100% - 1.6rem));
  }

  .header-inner {
    gap: 0.65rem;
  }

  .search-form {
    flex-basis: 100%;
    order: 5;
  }

  .brand-logo,
  .brand-logo img {
    height: 36px;
  }

  .topic-nav {
    grid-template-columns: 1fr;
  }

  .cd-up {
    order: -1;
    justify-self: start;
  }

  .topic-nav-next,
  .topic-nav-next .topic-jump {
    text-align: left;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a.card:hover { transform: none; }
}

@media print {
  .site-header,
  .site-footer,
  .social,
  .toc,
  .toc-drawer,
  .copy-btn,
  .tag-bar,
  .path-info,
  .path-dialog {
    display: none !important;
  }

  body,
  h1, h2, h3, h4,
  a,
  .prose a {
    background: white;
    color: black;
  }

  .highlighter-rouge,
  .code-wrap {
    border: 1px solid #ccc;
  }

  pre {
    white-space: pre-wrap;
  }
}

/* Splash is black only. It does not follow the light theme or the toggle. */
html.splash-root {
  color-scheme: dark;
  background: #0B0B0C;
}

html.splash-root body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  color: var(--ink);
}

.splash {
  width: min(1040px, calc(100% - 2.4rem));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.35rem;
  padding: 2.5rem 0 3rem;
}

html.splash-root h1 {
  width: min(920px, 100%);
  margin: 0;
  font-size: inherit;
  letter-spacing: 0;
  line-height: 0;
}

.splash-logo {
  display: block;
  width: 100%;
  height: auto;
}

.splash-tagline {
  margin: 0;
  max-width: 36rem;
  color: #ABA9A2;
  font-size: 1.05rem;
  line-height: 1.5;
}

.splash-tracks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

.splash-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.splash-track-name {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #E3BF6A;
}

.splash-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0;
}

a.splash-btn,
.splash-btn.is-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 12.5rem;
  min-height: 2.75rem;
  padding: 0.65rem 1.35rem;
  border: 1px solid #E3BF6A;
  border-radius: 2px;
  background: transparent;
  color: #F2F0EA;
  font-family: var(--mono);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
}

a.splash-btn:hover {
  background: #E3BF6A;
  color: #111111;
}

.splash-btn.is-disabled {
  border-color: #2A2A2C;
  color: #ABA9A2;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .splash {
    width: min(1040px, calc(100% - 1.8rem));
    gap: 1.1rem;
  }

  a.splash-btn,
  .splash-btn.is-disabled {
    width: min(100%, 18rem);
  }
}

.path-info {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--prompt);
  cursor: pointer;
}

.path-info svg {
  width: 1.15rem;
  height: 1.15rem;
}

.path-info:hover,
.path-info:focus-visible {
  border-color: var(--prompt);
  background: var(--pill);
}

:root[data-theme="light"] .path-info {
  color: #A07F2C;
}

:root[data-theme="light"] .path-info:hover,
:root[data-theme="light"] .path-info:focus-visible {
  border-color: #A07F2C;
}

body.path-dialog-open {
  overflow: hidden;
}

.path-dialog[hidden] {
  display: none !important;
}

.path-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  padding: 1.25rem;
}

.path-dialog-backdrop,
.path-dialog-panel {
  grid-area: 1 / 1;
}

.path-dialog-backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.path-dialog-panel {
  position: relative;
  justify-self: center;
  align-self: center;
  width: min(52rem, 100%);
  max-height: min(92vh, 52rem);
  overflow: auto;
  padding: 1.1rem 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.path-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.path-dialog-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.path-dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.path-dialog-close:hover,
.path-dialog-close:focus-visible {
  border-color: var(--prompt);
}

.path-dialog-panel p {
  margin: 0.7rem 0;
  line-height: 1.55;
}

.path-dialog-panel code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--inline-code-bg);
  color: var(--inline-code-fg);
  padding: 0.08em 0.35em;
  border-radius: 4px;
}

.path-dialog-action {
  margin-top: 1rem !important;
}

.lesson-action {
  margin: 2rem 0 0;
}

.module {
  margin-top: 2.1rem;
}

.module h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.module-summary {
  margin: 0 0 0.85rem;
  color: var(--muted);
}

.outline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

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

.outline-item a,
.outline-row {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  gap: 0.2rem 0.85rem;
  align-items: baseline;
  padding: 0.8rem 0.35rem;
  color: inherit;
  text-decoration: none;
}

.outline-item a:hover,
.outline-item a:focus-visible {
  background: var(--pill);
}

.outline-num {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--prompt);
}

:root[data-theme="light"] .outline-num {
  color: #A07F2C;
}

.outline-title {
  display: block;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
}

.outline-item a .outline-title {
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.outline-objective {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.outline-soon {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.demo {
  margin: 1.1rem 0 1.3rem;
}

.demo video,
.demo img,
.demo-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #0B0B0C;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.demo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background:
    linear-gradient(rgba(227, 191, 106, 0.08), rgba(227, 191, 106, 0.08)),
    #0B0B0C;
}

.demo-placeholder-kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #E3BF6A;
}

.demo-placeholder-title {
  font-family: var(--mono);
  font-size: 1.05rem;
  color: #F2F0EA;
}

.demo figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.solution {
  margin: 1.25rem 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
}

.solution summary {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 600;
  list-style: none;
}

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

.solution summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.6rem;
  border-right: 2px solid var(--prompt);
  border-bottom: 2px solid var(--prompt);
  transform: rotate(-45deg);
  flex: 0 0 auto;
}

:root[data-theme="light"] .solution summary::before {
  border-color: #A07F2C;
}

.solution[open] summary::before {
  transform: rotate(45deg) translateY(-2px);
}

.solution[open] {
  border-color: var(--prompt);
}

:root[data-theme="light"] .solution[open] {
  border-color: #A07F2C;
}

.solution > :not(summary) {
  margin-left: 0.95rem;
  margin-right: 0.95rem;
}

.solution > :last-child {
  margin-bottom: 0.95rem;
}

@media (max-width: 640px) {
  .outline-item a,
  .outline-row {
    grid-template-columns: 2.5rem minmax(0, 1fr);
  }

  .outline-soon {
    grid-column: 2;
  }
}
