/* theme/css/00-tokens.css */
/* Design tokens. Change colours, fonts and sizes here. */
:root {
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif,
    'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
  --font-mono: ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;

  /* WATonomous brand blue (#1F5D96), matching watonomous.ca */
  --c-primary: #1f5d96;
  --c-primary-hover: #1a4f7f;
  --c-primary-soft: rgba(31, 93, 150, 0.08);
  --c-accent: #1f5d96;

  --c-bg: #ffffff;
  --c-surface: #ffffff;
  --c-text: #1c1e21;
  --c-text-muted: #525860;
  --c-border: #dadde1;
  --c-code-bg: #f6f7f8;
  --c-inline-code-bg: rgba(0, 0, 0, 0.05);
  --c-inline-code-border: rgba(0, 0, 0, 0.1);
  --c-hover: rgba(0, 0, 0, 0.05);
  --c-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);

  --c-emph-100: #f5f6f7;
  --c-emph-200: #ebedf0;
  --c-emph-300: #dadde1;
  --c-emph-400: #ccd0d5;
  --c-emph-500: #bec3c9;
  --c-emph-600: #8d949e;
  --c-emph-700: #606770;
  --c-emph-800: #444950;
  --c-emph-900: #1c1e21;

  --navbar-h: 3.75rem;
  --sidebar-w: 300px;
  --toc-w: 260px;
  --content-max: 860px;
  --radius: 0.4rem;
}

[data-theme='dark'] {
  color-scheme: dark;
  --c-primary: #5b9bd5;
  --c-primary-hover: #82afde;
  --c-primary-soft: rgba(91, 155, 213, 0.12);
  --c-accent: #5b9bd5;

  --c-bg: #1b1b1d;
  --c-surface: #242526;
  --c-text: #e3e3e3;
  --c-text-muted: #a9adb3;
  --c-border: #3a3b3e;
  --c-code-bg: #282a36;
  --c-inline-code-bg: rgba(255, 255, 255, 0.07);
  --c-inline-code-border: rgba(255, 255, 255, 0.1);
  --c-hover: rgba(255, 255, 255, 0.05);
  --c-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);

  --c-emph-100: #242526;
  --c-emph-200: #2f3033;
  --c-emph-300: #444950;
  --c-emph-400: #606770;
  --c-emph-500: #8d949e;
  --c-emph-600: #bec3c9;
  --c-emph-700: #ccd0d5;
  --c-emph-800: #dadde1;
  --c-emph-900: #f5f6f7;
}

/* theme/css/10-base.css */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--navbar-h) + 0.75rem); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  color: var(--c-text);
  font: 16px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-hover); text-decoration: underline; }
img, video { max-width: 100%; }
kbd {
  font: 600 0.72rem var(--font-mono);
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--c-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--c-text-muted);
  background: var(--c-bg);
}
button { font: inherit; color: inherit; }
.muted { color: var(--c-text-muted); }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 100; padding: 0.5rem 1rem; background: var(--c-surface); }
.skip-link:focus { left: 0.5rem; }
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.link-button { background: none; border: 0; padding: 0; color: var(--c-primary); cursor: pointer; }
.link-button:hover { text-decoration: underline; }

/* Buttons (also usable from Markdown: <a class="button button--primary button--lg">) */
.button {
  display: inline-block;
  padding: 0.375rem 1.25rem;
  border: 2px solid var(--c-primary);
  border-radius: var(--radius);
  font-weight: 700;
  line-height: 1.5;
  color: var(--c-primary);
  transition: background 0.15s, color 0.15s;
}
.button:hover { text-decoration: none; background: var(--c-primary-soft); }
.button--primary { background: var(--c-primary); color: #fff; }
.button--primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); color: #fff; }
[data-theme='dark'] .button--primary, [data-theme='dark'] .button--primary:hover { color: #11161c; }
.button--lg { padding: 0.6rem 1.35rem; font-size: 1rem; font-weight: 600; border-radius: 0.5rem; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(31, 93, 150, 0.18); }
.button--lg:hover { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 6px 16px rgba(31, 93, 150, 0.25); }

/* theme/css/20-layout.css */
/* ---- Navbar ------------------------------------------------------------ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--navbar-h);
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  box-shadow: var(--c-shadow);
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}
/* dark-glass look while the ASCII art behind the footer is scrolled up underneath it */
.navbar.over-dark {
  background: color-mix(in srgb, #07080d 93%, transparent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.35);
}
.navbar.over-dark .brand,
.navbar.over-dark .nav-link,
.navbar.over-dark .theme-toggle,
.navbar.over-dark .navbar-toggle {
  color: #e8eaef;
}
.navbar.over-dark .nav-link:hover,
.navbar.over-dark .nav-link.active {
  color: #5b9bd5;
}
.navbar.over-dark .theme-toggle:hover,
.navbar.over-dark .navbar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}
.navbar.over-dark .search-button {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  color: #b7bcc4;
}
.navbar.over-dark .search-button:hover {
  border-color: #5b9bd5;
  color: #e8eaef;
}
.navbar-inner { display: flex; align-items: center; gap: 0.25rem; height: 100%; padding: 0 1rem; }
.brand { display: flex; align-items: center; margin-right: 1rem; color: var(--c-text); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.brand:hover { color: var(--c-text); text-decoration: none; }
.nav-link { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.75rem; color: var(--c-text); font-weight: 500; border-radius: var(--radius); }
.nav-link:hover, .nav-link.active { color: var(--c-primary); text-decoration: none; }
.nav-left, .nav-right { display: flex; align-items: center; }
.nav-spacer { flex: 1; }
.icon-external { opacity: 0.8; margin-left: 0.1rem; }
.search-button {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0 0.5rem; padding: 0.3rem 0.5rem 0.3rem 0.75rem; min-width: 9rem;
  border: 1px solid var(--c-border); border-radius: 999px; background: var(--c-emph-100);
  color: var(--c-text-muted); cursor: pointer; font-size: 0.9rem;
}
.search-button:hover { border-color: var(--c-primary); color: var(--c-text); }
.search-button span { flex: 1; text-align: left; }
.theme-toggle, .navbar-toggle, .drawer-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--c-text); cursor: pointer;
}
.theme-toggle:hover, .navbar-toggle:hover, .drawer-close:hover { background: var(--c-hover); }
.theme-toggle svg { display: none; }
/* the icon shows the mode a click switches to */
[data-theme='light'] .theme-toggle .i-dark,
[data-theme='dark'] .theme-toggle .i-light { display: block; }
.navbar-toggle { display: none; margin-right: 0.25rem; }

/* ---- Page columns -------------------------------------------------------- */
.layout { display: flex; flex: 1; width: 100%; }
.main { flex: 1; min-width: 0; }
.sidebar {
  position: sticky; top: var(--navbar-h);
  flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  height: calc(100vh - var(--navbar-h)); overflow-y: auto;
  padding: 0.5rem 0.5rem 2rem;
  border-right: 1px solid var(--c-border);
  scrollbar-width: thin;
}
.drawer-head, .drawer-extra { display: none; }
.doc-row { display: flex; justify-content: center; gap: 2rem; padding: 1rem 2rem 3rem; }
.doc, .blog-main { flex: 1; min-width: 0; max-width: var(--content-max); }
.toc { flex: 0 0 var(--toc-w); width: var(--toc-w); }
.layout-blog .doc-row { justify-content: flex-start; }

/* ---- Sidebar menu ---------------------------------------------------------- */
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-sub { padding-left: 0.75rem; margin-top: 0.15rem; }
.menu-list li { margin: 0.15rem 0; }
.menu-link {
  display: block; flex: 1;
  padding: 0.375rem 0.75rem; border-radius: 0.25rem;
  color: var(--c-emph-700); line-height: 1.25; font-size: 1rem;
}
.menu-link:hover { background: var(--c-hover); color: var(--c-text); text-decoration: none; }
.menu-link.active { color: var(--c-primary); background: var(--c-hover); }
.menu-cat > summary { display: flex; align-items: center; list-style: none; cursor: pointer; border-radius: 0.25rem; }
.menu-cat > summary::-webkit-details-marker { display: none; }
.menu-cat > summary:hover { background: var(--c-hover); }
.menu-cat > summary .menu-link:hover { background: none; }
.menu-cat.has-active > summary > .menu-cat-link:not(.active) { color: var(--c-primary); }
.menu-caret { display: flex; padding: 0.3rem 0.5rem; color: var(--c-emph-700); border-radius: 0.25rem; }
.menu-caret:hover { background: var(--c-hover); }
.chevron { transition: transform 0.15s; }
.menu-cat[open] > summary .chevron { transform: rotate(90deg); }

/* ---- TOC --------------------------------------------------------------- */
.toc-inner {
  position: sticky; top: calc(var(--navbar-h) + 1rem);
  max-height: calc(100vh - var(--navbar-h) - 2rem); overflow-y: auto;
  padding-left: 0.75rem; border-left: 1px solid var(--c-border);
  scrollbar-width: thin;
}
.toc-list { list-style: none; margin: 0; padding: 0; font-size: 0.8rem; line-height: 1.4; }
.toc-list li { margin: 0.45rem 0; }
.toc-list .toc-d3 { padding-left: 1rem; }
.toc-list a { color: var(--c-emph-700); display: block; }
.toc-list a:hover { color: var(--c-primary); text-decoration: none; }
.toc-list a.active { color: var(--c-primary); font-weight: 600; }
.toc-list code { font-size: 0.9em; }
.toc-edit { margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px solid var(--c-border); font-size: 0.8rem; }
.toc-edit .edit-link { font-size: 0.8rem; gap: 0.35rem; color: var(--c-emph-700); }
.toc-edit .edit-link:hover { color: var(--c-primary); }
.toc-edit svg { width: 13px; height: 13px; }
.toc-mobile { display: none; margin: 0 0 1.5rem; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-emph-100); }
.toc-mobile summary { padding: 0.5rem 1rem; cursor: pointer; font-weight: 600; }
.toc-mobile .toc-list { padding: 0 1rem 0.75rem; }

/* ---- Breadcrumbs, doc footer, pager --------------------------------------- */
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.25rem 0 1rem; font-size: 0.8rem; }
.breadcrumbs a { color: var(--c-text-muted); }
.breadcrumbs a:hover { color: var(--c-primary); }
.crumb-home { display: inline-flex; }
.crumb-sep { display: inline-flex; color: var(--c-emph-600); }
.crumb-current { color: var(--c-primary); background: var(--c-primary-soft); padding: 0.1rem 0.55rem; border-radius: 999px; }
.doc-footer { margin-top: 3rem; }
/* the right-hand column already has "Edit this page"; the one under the article is for narrow windows */
@media (min-width: 1201px) { .doc-row:has(.toc-edit) .edit-link:not(.toc-edit .edit-link) { display: none; } }
.edit-link { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2rem; }
.pager-link { display: flex; flex-direction: column; gap: 0.25rem; padding: 1.1rem 1.35rem; border: 1px solid var(--c-border); border-radius: 0.6rem; transition: border-color 0.15s, box-shadow 0.15s; }
.pager-link:hover .pager-title { color: var(--c-primary); }
.pager-link:hover { border-color: var(--c-primary); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); text-decoration: none; }
.pager-link.next { text-align: right; }
.pager-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.pager-link.has-thumb { flex-direction: row; align-items: stretch; gap: 0; padding: 0; overflow: hidden; }
.pager-link.has-thumb.next { flex-direction: row-reverse; }
.pager-link.has-thumb .pager-body { justify-content: center; flex: 1; padding: 1.1rem 1.35rem; }
.pager-thumb { flex: 0 0 7.5rem; min-height: 6rem; background: #111 center / cover no-repeat; }
.pager-sub { font-size: 0.875rem; color: var(--c-text-muted); font-weight: 500; }
.pager-title { font-weight: 650; font-size: 1.12rem; line-height: 1.4; color: var(--c-text); transition: color 0.15s; word-break: break-word; }

/* ---- Footer ------------------------------------------------------------------ */
.footer { position: relative; background: #14151a; color: #d8dadf; padding: 2rem 1rem; overflow: hidden; }
.footer-ascii-backdrop {
  position: absolute; inset: 0;
  background: center / cover no-repeat;
  opacity: calc(0.5 + var(--k, 0) * 0.3);   /* always there behind the links, brighter as the art scrolls in */
  filter: grayscale(0.2) brightness(0.62) contrast(1.05);
  pointer-events: none;
  will-change: opacity;
}
.footer-inner { position: relative; z-index: 1; max-width: 1140px; margin: 0 auto; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 14px rgba(0, 0, 0, 0.6); }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; }
.footer-title { font-weight: 700; margin-bottom: 0.5rem; color: #f2f3f5; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin: 0.25rem 0; }
.footer-link { padding: 0; color: #c2c7d0; font-weight: 400; }
.footer-link:hover { color: #5b9bd5; text-decoration: underline; }
.footer-copy { margin-top: 2rem; text-align: center; font-size: 0.9rem; color: #9ba1ab; }

/* ---- Responsive -------------------------------------------------------------- */
@media (max-width: 1200px) {
  .toc { display: none; }
  .toc-mobile { display: block; }
}
@media (max-width: 996px) {
  .navbar-toggle { display: inline-flex; }
  .nav-left, .nav-right { display: none; }
  .search-button { min-width: 0; flex-shrink: 0; } /* the brand gives way on narrow phones, not the icon */
  .brand { min-width: 0; margin-right: 0.5rem; }
  .brand-text { overflow: hidden; text-overflow: ellipsis; }
  .search-button span, .search-button kbd { display: none; }
  .sidebar, .blog-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    width: min(83vw, 320px); height: 100vh;
    background: var(--c-surface); border-right: 0;
    transform: translateX(-100%); transition: transform 0.2s ease, visibility 0.2s;
    visibility: hidden; padding: 0 0.5rem 2rem;
  }
  body.drawer-open .sidebar, body.drawer-open .blog-sidebar { transform: none; visibility: visible; box-shadow: 0 0 30px rgba(0, 0, 0, 0.25); }
  .drawer-head { display: flex; align-items: center; justify-content: space-between; height: var(--navbar-h); padding: 0 0.5rem 0 0.75rem; font-weight: 700; }
  .drawer-extra { display: block; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--c-border); }
  .drawer-extra .menu-link { display: flex; }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.4); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }
  .doc-row { padding: 1rem 1rem 3rem; }
}
@media (max-width: 576px) {
  .pager { grid-template-columns: 1fr; }
}

/* theme/css/30-markdown.css */
/* Rendered Markdown content */
.markdown { line-height: 1.7; overflow-wrap: break-word; }
.markdown > :first-child { margin-top: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 {
  font-weight: 700; line-height: 1.25; margin: 2.2rem 0 1rem; color: var(--c-text);
}
.markdown h1 { font-size: 3rem; letter-spacing: -0.01em; margin: 0 0 1.5rem; }
.markdown h2 { font-size: 2rem; }
.markdown h3 { font-size: 1.5rem; }
.markdown h4 { font-size: 1.25rem; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote, .markdown pre, .markdown .table-wrap, .markdown figure { margin: 0 0 1.25rem; }
.markdown ul, .markdown ol { padding-left: 2rem; }
.markdown li + li, .markdown li > ul, .markdown li > ol { margin-top: 0.25rem; }
.markdown li > p { margin: 0; }
/* An equation (or second paragraph) under a list item's text needs a little air. */
.markdown li > p + p { margin: 0.75rem 0 1.25rem; }
.markdown img { height: auto; }
.markdown hr { border: 0; border-top: 1px solid var(--c-border); margin: 2rem 0; }
.markdown blockquote { padding: 0 1rem; border-left: 0.25rem solid var(--c-emph-300); color: var(--c-emph-800); }
.markdown em > img:only-child, .markdown p > img { display: block; }

/* Heading anchors */
.anchor { position: relative; }
.hash-link { opacity: 0; padding-left: 0.5rem; color: var(--c-primary); transition: opacity 0.15s; user-select: none; }
.anchor:hover .hash-link, .hash-link:focus { opacity: 1; text-decoration: none; }

/* Inline code */
.markdown code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.1rem 0.3rem;
  border: 1px solid var(--c-inline-code-border);
  border-radius: var(--radius);
  background: var(--c-inline-code-bg);
  vertical-align: middle;
}
.markdown a code { color: inherit; }

/* Code blocks (Shiki dual-theme: colours come from CSS variables) */
.markdown pre {
  position: relative;
  overflow: auto;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--c-code-bg);
  font-size: 0.875rem;
  line-height: 1.55;
  box-shadow: inset 0 0 0 1px var(--c-inline-code-border);
}
.markdown pre code { padding: 0; border: 0; background: none; font-size: inherit; vertical-align: baseline; }
.shiki { background-color: var(--shiki-light-bg) !important; }
.shiki, .shiki span { color: var(--shiki-light); }
[data-theme='dark'] .shiki { background-color: var(--shiki-dark-bg) !important; }
[data-theme='dark'] .shiki, [data-theme='dark'] .shiki span { color: var(--shiki-dark); }
.shiki span { font-style: var(--shiki-light-font-style); font-weight: var(--shiki-light-font-weight); }
[data-theme='dark'] .shiki span { font-style: var(--shiki-dark-font-style); font-weight: var(--shiki-dark-font-weight); }
.code-copy {
  position: absolute; top: 0.5rem; right: 0.5rem;
  padding: 0.2rem 0.5rem; border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-surface); color: var(--c-text-muted);
  font: 0.75rem var(--font-mono); cursor: pointer; opacity: 0; transition: opacity 0.15s;
}
.code-wrap { position: relative; }
.code-wrap:hover .code-copy, .code-copy:focus { opacity: 1; }
.code-lang { position: absolute; top: 0.45rem; right: 0.75rem; font: 0.7rem var(--font-mono); color: var(--c-text-muted); opacity: 0.7; pointer-events: none; text-transform: lowercase; }
.code-wrap:hover .code-lang { opacity: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
.markdown table { border-collapse: collapse; width: max-content; max-width: 100%; display: table; }
.table-wrap table { max-width: none; min-width: 50%; }
.markdown th, .markdown td { padding: 0.5rem 0.75rem; border: 1px solid var(--c-emph-300); text-align: left; vertical-align: top; }
.markdown th { font-weight: 700; background: var(--c-emph-100); }
.markdown tr:nth-child(2n) td { background: color-mix(in srgb, var(--c-emph-100) 55%, transparent); }

/* Math */
.katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 0.25rem 0; }

/* Mermaid diagrams: rendered at natural size, scroll if wider than the column */
.markdown pre.mermaid {
  display: flex; justify-content: center;
  padding: 1rem; overflow-x: auto;
  background: var(--c-bg); box-shadow: inset 0 0 0 1px var(--c-border);
  font-family: var(--font-sans); white-space: pre;
}
.markdown pre.mermaid:not([data-processed]) { color: transparent; min-height: 6rem; }
.markdown pre.mermaid svg { max-width: none !important; height: auto; }

/* Images open in a lightbox */
.markdown img.zoomable { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem; background: rgba(10, 12, 16, 0.85); cursor: zoom-out;
  animation: fade-in 0.15s ease;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); background: #fff; }
@keyframes fade-in { from { opacity: 0; } }

/* Generated-index cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.markdown .card-grid .link-card { margin: 0; max-width: none; }

@media (max-width: 576px) {
  .markdown h1 { font-size: 2.1rem; }
  .markdown h2 { font-size: 1.6rem; }
}

/* Videos written as ![alt](/img/clip.mp4) */
.markdown video { display: block; width: 100%; height: auto; margin: 0 0 1.25rem; border-radius: 6px; background: #000; }
.markdown p > video:only-child { margin: 0; }

/* Link card: generated-index cards and <a class="link-card"> in Markdown share it */
.markdown .link-card { display: flex; max-width: 34rem; margin: 1.5rem 0 0; border: 1px solid var(--c-border); border-radius: 0.75rem; overflow: hidden; background: var(--c-bg); color: var(--c-text); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.markdown .link-card:hover { border-color: var(--c-primary); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1); transform: translateY(-2px); text-decoration: none; color: var(--c-text); }
.link-card-thumb { flex: 0 0 9rem; background: #111 center / cover no-repeat; }
.link-card-body { display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem 1.25rem; }
.link-card-kicker { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-primary); }
.link-card-title { font-size: 1.1rem; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
.link-card-desc { font-size: 0.9rem; line-height: 1.5; color: var(--c-text-muted); }
.link-card-cta { margin-top: auto; padding-top: 0.4rem; font-size: 0.9rem; font-weight: 600; color: var(--c-primary); }
.link-card-cta span { display: inline-block; transition: transform 0.15s; }
.link-card:hover .link-card-cta span { transform: translateX(4px); }
@media (max-width: 480px) { .link-card-thumb { flex-basis: 6.5rem; } }

/* theme/css/40-blog.css */
/* Blog */
.blog-sidebar { overflow-y: auto; scrollbar-width: thin; }
/* Desktop only: this file loads after 20-layout.css, so unscoped it would override the
   phone drawer there and leave an invisible 300px column squeezing the posts. */
@media (min-width: 997px) {
  .blog-sidebar {
    position: sticky; top: var(--navbar-h);
    flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
    height: calc(100vh - var(--navbar-h));
    padding: 2rem 1rem 2rem 2.5rem;
  }
}
.blog-side-title { font-weight: 700; font-size: 1.25rem; margin-bottom: 1rem; }
.blog-side-year { font-weight: 700; font-size: 1.15rem; margin: 1rem 0 0.4rem; }
.blog-sidebar ul { list-style: none; margin: 0; padding: 0; }
.blog-sidebar li { margin: 0.6rem 0; line-height: 1.4; font-size: 0.95rem; }
.blog-sidebar li a { color: var(--c-text); }
.blog-sidebar li a:hover, .blog-sidebar li a.active { color: var(--c-primary); text-decoration: none; }
.layout-blog .doc-row { padding-top: 2rem; }

.post-list { display: flex; flex-direction: column; gap: 2rem; }
.post-card { padding: 1.5rem 2rem 1rem; border: 1px solid var(--c-border); border-radius: 0.5rem; background: var(--c-surface); }
.post-card-title { font-size: 1.6rem; line-height: 1.3; margin: 0 0 0.5rem; }
.post-card-title a { color: var(--c-primary); }
.post-title { font-size: 3rem; line-height: 1.2; margin: 0 0 0.75rem; }
.post-meta { color: var(--c-emph-800); font-size: 0.95rem; margin-bottom: 0.75rem; }
.post-authors { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; margin-bottom: 1.5rem; }
.post-author { font-weight: 700; display: inline-flex; align-items: center; gap: 0.5rem; }
.post-author small { font-weight: 400; color: var(--c-text-muted); }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; }
.post-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.5rem 0 0.5rem; }
.post-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 3rem; }
.read-more { font-weight: 700; }
.post-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.tag {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.15rem 0.6rem; border: 1px solid var(--c-emph-400); border-radius: var(--radius);
  font-size: 0.9rem; color: var(--c-primary); background: var(--c-bg);
}
.tag:hover { border-color: var(--c-primary); text-decoration: none; }
.tag-count { font: 0.75rem var(--font-mono); color: var(--c-text-muted); background: var(--c-emph-200); padding: 0 0.4rem; border-radius: 999px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-group h2 { font-size: 1.5rem; border-bottom: 1px solid var(--c-border); padding-bottom: 0.25rem; }
.list-header { margin-bottom: 2rem; }
.list-header h1 { font-size: 2.25rem; margin: 0 0 0.5rem; }
.archive-list { list-style: none; padding: 0; }
.archive-list time { display: inline-block; min-width: 11rem; color: var(--c-text-muted); font-size: 0.9rem; }

@media (max-width: 576px) {
  .post-card { padding: 1rem 1.1rem; }
  .post-title { font-size: 2rem; }
  .post-card-title { font-size: 1.3rem; }
}

/* theme/css/50-widgets.css */
/* Search modal */
.search-modal[hidden] { display: none; }
.search-modal { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 1rem 1rem; }
.search-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 16, 0.5); backdrop-filter: blur(2px); }
.search-panel {
  position: relative; width: min(640px, 100%); max-height: 75vh; display: flex; flex-direction: column;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 0.6rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); overflow: hidden;
}
.search-input-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--c-border); color: var(--c-text-muted); }
.search-input-row input { flex: 1; border: 0; outline: 0; background: none; color: var(--c-text); font: 1.05rem var(--font-sans); }
.search-input-row input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 0.5rem; overflow-y: auto; }
.search-results:empty { display: none; }
.search-results a { display: block; padding: 0.6rem 0.75rem; border-radius: var(--radius); color: var(--c-text); }
.search-results a:hover, .search-results a.selected { background: var(--c-primary-soft); text-decoration: none; }
.search-results .sr-path { font: 0.72rem var(--font-mono); color: var(--c-text-muted); display: block; margin-bottom: 0.1rem; }
.search-results .sr-title { font-weight: 600; display: block; }
.search-results .sr-snip { font-size: 0.85rem; color: var(--c-text-muted); display: block; margin-top: 0.15rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-results mark { background: color-mix(in srgb, var(--c-primary) 25%, transparent); color: inherit; border-radius: 2px; }
.search-empty { padding: 1rem; color: var(--c-text-muted); text-align: center; }

/* 404 */
.not-found { max-width: 760px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }
.not-found h1 { font-size: 2.5rem; margin: 0 0 0.5rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* theme/css/60-pioneer.css */
/* ASCII Pioneer (theme/js/ascii-pioneer.js) */
/* Faint Pioneer behind every page */
.pioneer-bg {
  --ascii-color: #111111;
  --ascii-glow: rgba(0, 0, 0, 0.25);
  --ascii-opacity: 0.22;
  position: fixed;
  right: 0;
  top: var(--navbar-h);
  width: min(42vw, 620px);
  height: calc(100vh - var(--navbar-h));
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.pioneer-bg.ready { opacity: 1; }
[data-theme='dark'] .pioneer-bg { --ascii-color: #f2f2f2; --ascii-glow: rgba(255, 255, 255, 0.5); --ascii-opacity: 0.22; }
.has-pioneer-bg .layout { position: relative; z-index: 1; }


/* Keep the right-hand "On this page" links readable over the figure */
.has-pioneer-bg .toc-inner {
  background: color-mix(in srgb, var(--c-bg) 80%, transparent);
  backdrop-filter: blur(2px);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}
.has-pioneer-bg .footer { position: relative; z-index: 1; }
@media (max-width: 996px) {
  .pioneer-bg { display: none; }
  /* No background on phones, so no stacking layer either: otherwise the slide-out menu is
     trapped inside it, under the dark overlay. */
  .has-pioneer-bg .layout { position: static; z-index: auto; }
}

/* Boxes sit on a solid page background so the figure never shows through behind their text. */
.has-pioneer-bg .pager-link,
.has-pioneer-bg .link-card,
.has-pioneer-bg .post-card,
.has-pioneer-bg .toc-mobile,
.has-pioneer-bg .markdown table,
.has-pioneer-bg .markdown img,
.has-pioneer-bg .markdown svg,
.has-pioneer-bg .ajn-figure,
.has-pioneer-bg .markdown pre.mermaid,
.has-pioneer-bg .tag {
  background-color: var(--c-bg);
}
.has-pioneer-bg .post-card { background-color: var(--c-surface); }
/* Cards and page links read as frosted glass over the figure instead of white blocks cut out of it */
.has-pioneer-bg .pager-link,
.has-pioneer-bg .link-card {
  background-color: color-mix(in srgb, var(--c-bg) 72%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
/* Tinted callouts: keep the tint, but over solid page colour */
.has-pioneer-bg .admonition { background: linear-gradient(var(--adm-bg), var(--adm-bg)), var(--c-bg); }

/* Rocket pages (`ascii: rocket` in front matter): colour ASCII rocket instead of Pioneer */
.rocket-bg { --ascii-opacity: 0.75; }
[data-theme='dark'] .rocket-bg { --ascii-opacity: 0.9; }

/* ASCII art past the footer (site.config.js footerArt): a screen of it, fading in on scroll */
.footer-art { --footer-bg: #14151a; height: 100vh; background: var(--footer-bg); position: relative; z-index: 1; overflow: hidden; }
.footer-art-img { position: absolute; inset: 0; background: center / cover no-repeat; opacity: var(--k, 0); filter: brightness(1.1) saturate(1.15); will-change: opacity; }
/* no hard edge under the footer: the art starts in the footer's colour and blends into the picture */
.footer-art::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 45%; pointer-events: none;
  opacity: calc(1 - var(--k, 0)); /* blends the seam on the way in, gone once the art is in full view */
  background: linear-gradient(to bottom, var(--footer-bg) 0%, color-mix(in srgb, var(--footer-bg) 70%, transparent) 30%, transparent 100%);
}
@media (prefers-reduced-motion: reduce) { .footer-art { --k: 1 !important; } }
/* the arts are 16:9: in a window narrower than that, a full-height box would crop away the sides
   (the humanoid, the rocket). Each art keeps its subjects in the middle ~60% of its width, so
   86vw tall shows the middle 65%: only the outer edges go, and the box keeps some height */
@media (max-aspect-ratio: 16/9) { .footer-art { height: min(100vh, 86vw); } }
/* the title over the footer art (site.config.js footerArtTitle), in the dark sky, fading in with the art */
.footer-art-title {
  position: absolute; left: 0; right: 0; top: 16%; z-index: 2; text-align: center; pointer-events: none;
  font-family: 'Michroma', var(--font-sans); color: #eef2fb; text-transform: uppercase;
  opacity: calc(var(--k, 0) * 0.95); transform: translateY(calc((1 - var(--k, 0)) * 18px));
  text-shadow: 0 0 24px rgba(170, 195, 255, 0.35), 0 2px 18px rgba(4, 6, 16, 0.7);
}
.footer-art-title { white-space: nowrap; }
.footer-art-title span { font-size: clamp(1.1rem, 3.4vw, 3.4rem); letter-spacing: 0.32em; line-height: 1.15; }
.footer-art-title span:first-child { padding-left: 0.32em; }
.footer-art-title span + span { margin-left: 0.9em; }
/* hero (front matter `hero: true`): the page's art full-screen under the navbar, title over its sky */
.hero { position: relative; height: calc(100svh - var(--navbar-h)); min-height: 420px; overflow: hidden; background: #05060d; }
.hero-img { position: absolute; inset: 0; background: center 62% / cover no-repeat; animation: hero-in 1.6s ease-out both; }
.hero { --fade: color-mix(in srgb, var(--c-bg) calc(var(--hero-p, 0) * 100%), #05060d); }
/* the bottom fades to black at first, and to the page colour as you scroll down into the docs */
.hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 48%; pointer-events: none;
  background: linear-gradient(to bottom, transparent 0%, color-mix(in srgb, var(--fade) 10%, transparent) 25%, color-mix(in srgb, var(--fade) 35%, transparent) 50%, color-mix(in srgb, var(--fade) 75%, transparent) 75%, var(--fade) 100%); }
/* on a hero page the faint background Pioneer waits until the hero has scrolled away, then fades in */
.has-hero .pioneer-bg.ready { opacity: var(--hero-out, 0); transition: none; }
.hero-title {
  position: absolute; left: 0; right: 0; top: 17%; margin: 0; text-align: center; white-space: nowrap;
  font: 400 clamp(1.1rem, 3.6vw, 3.6rem) / 1.15 'Michroma', var(--font-sans); letter-spacing: 0.32em; padding-left: 0.32em;
  color: #eef2fb; text-transform: uppercase; text-shadow: 0 0 24px rgba(170, 195, 255, 0.35), 0 2px 18px rgba(4, 6, 16, 0.7);
  animation: hero-title-in 1.8s 0.3s ease-out both;
}
.hero-title span + span { margin-left: 0.6em; }
/* the 1.1rem floor is wider than a 360px phone in Michroma's spacing */
@media (max-width: 400px) { .hero-title { font-size: 4.2vw; } }
.hero-cue { position: absolute; left: 50%; bottom: 7%; z-index: 1; width: 22px; height: 22px; margin-left: -11px; border-right: 1.5px solid #dfe6f5; border-bottom: 1.5px solid #dfe6f5; transform: rotate(45deg); opacity: 0.7; animation: hero-cue 2.2s ease-in-out infinite; }
@keyframes hero-in { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes hero-title-in { from { opacity: 0; letter-spacing: 0.5em; } to { opacity: 1; } }
@keyframes hero-cue { 0%, 100% { translate: 0 0; opacity: 0.35; } 50% { translate: 0 8px; opacity: 0.8; } }
@media (prefers-reduced-motion: reduce) { .hero-img, .hero-title, .hero-cue { animation: none; } }

/* components/Admonition.css */
.admonition {
  --adm: var(--c-primary);
  --adm-bg: var(--c-primary-soft);
  margin: 0 0 1.25rem;
  padding: 0.9rem 1.1rem;
  border-left: 4px solid var(--adm);
  border-radius: var(--radius);
  background: var(--adm-bg);
}
.admonition-tip { --adm: #2e8555; --adm-bg: rgba(46, 133, 85, 0.1); }
.admonition-warning, .admonition-caution { --adm: #c77c00; --adm-bg: rgba(230, 167, 0, 0.12); }
.admonition-danger { --adm: #d03a3a; --adm-bg: rgba(225, 50, 56, 0.1); }
.admonition-info { --adm: #3578a8; --adm-bg: rgba(84, 199, 236, 0.1); }
[data-theme='dark'] .admonition-tip { --adm: #4cc28a; }
[data-theme='dark'] .admonition-warning, [data-theme='dark'] .admonition-caution { --adm: #f0b429; }
[data-theme='dark'] .admonition-danger { --adm: #f06a6a; }
[data-theme='dark'] .admonition-info { --adm: #6cc4ee; }
.admonition-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  color: var(--adm);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
}
.admonition-content > :last-child { margin-bottom: 0; }

/* components/ArmJointNaming.css */
.ajn-figure {
  margin: 1.5rem 0;
}

.ajn-svg {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  --arm-new: #b45309;
}

[data-theme='dark'] .ajn-svg {
  --arm-new: #f59e0b;
}

.ajn-band {
  fill: var(--c-emph-100);
}

.ajn-group-label {
  fill: var(--c-emph-600);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ajn-torso {
  fill: var(--c-emph-200);
  stroke: var(--c-emph-500);
  stroke-width: 1.5;
}

.ajn-link {
  fill: none;
  stroke: var(--c-emph-500);
  stroke-width: 6;
  stroke-linecap: round;
}

.ajn-link-label {
  fill: var(--c-emph-700);
  font-size: 12px;
  font-style: italic;
}

.ajn-leader,
.ajn-leader-new {
  stroke: var(--c-emph-400);
  stroke-width: 1;
}

.ajn-leader-new {
  stroke: var(--arm-new);
}

.ajn-joint,
.ajn-joint-new {
  fill: var(--c-bg);
  stroke: var(--c-primary);
  stroke-width: 2.5;
}

.ajn-joint-new {
  stroke: var(--arm-new);
  stroke-dasharray: 4 3;
}

.ajn-index,
.ajn-index-new {
  fill: var(--c-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.ajn-index-new {
  fill: var(--arm-new);
}

.ajn-name,
.ajn-name-new {
  fill: var(--c-text);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.ajn-name-new {
  fill: var(--arm-new);
}

.ajn-desc {
  fill: var(--c-emph-800);
  font-size: 13px;
}

.ajn-new-tag {
  fill: var(--arm-new);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ajn-note {
  fill: var(--c-emph-700);
  font-size: 12px;
}

/* components/Gallery.css */
.gallery {
  display: grid;
  grid-template-columns: var(--gallery-cols, repeat(auto-fill, minmax(280px, 1fr)));
  gap: 12px;
  align-items: start;
  margin: 0 0 1.25rem;
}
.gallery > p { display: contents; }
.gallery img, .gallery video { display: block; width: 100%; margin: 0; border-radius: 8px; }
@media (max-width: 576px) {
  .gallery { grid-template-columns: 1fr; }
}
