/* ==========================================================================
   Internet Spacejunk - Forest-Green Editorial System (Apple-Refined Craft)
   Fonts: Source Sans 3 (Primary) + Ioskeley Mono (Code, Keycaps & Indices Only)
   Pure CSS Motion · WCAG 2.2 AA · Zero CLS · Underline-Free Link Architecture
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/SourceSans3-Variable.woff2") format("woff2-variations"),
       url("/assets/fonts/SourceSans3-Variable.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/SourceSans3-Italic-Variable.woff2") format("woff2-variations"),
       url("/assets/fonts/SourceSans3-Italic-Variable.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Ioskeley Mono";
  src: url("/assets/fonts/IoskeleyMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ioskeley Mono";
  src: url("/assets/fonts/IoskeleyMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root,
html[data-theme="dark"] {
  /* Deep green-black canvas - strong contrast, restrained verdant ambient wash */
  --bg: #0B1A12;
  --bg-atmosphere:
    radial-gradient(ellipse 80% 54% at 50% -12%, rgba(92, 196, 142, 0.12), rgba(14, 106, 64, 0.06) 56%, transparent 80%),
    radial-gradient(ellipse 56% 44% at 88% 14%, rgba(92, 196, 142, 0.06), transparent 72%);

  --surface: rgba(20, 40, 30, 0.72);
  --surface-hover: rgba(26, 52, 39, 0.88);
  --surface-solid: #11241A;
  --header-bg: rgba(11, 26, 18, 0.86);

  --fg: #F2F7F4;
  --fg-secondary: #BACFC3;
  --fg-subtle: #8BA798;

  /* Unified luminous dark-mode green accent */
  --cobalt: #5CC48E;
  --cobalt-deep: #2F9A66;
  --cobalt-glow: rgba(92, 196, 142, 0.24);
  --cobalt-glow-soft: rgba(92, 196, 142, 0.11);

  --line: rgba(220, 238, 228, 0.105);
  --line-bright: rgba(220, 238, 228, 0.19);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.085);
  --shadow-subtle:
    0 1px 2px rgba(1, 8, 4, 0.36),
    0 8px 20px -4px rgba(2, 10, 6, 0.38),
    0 20px 42px -10px rgba(1, 8, 4, 0.44);
  --shadow-hover:
    0 2px 4px rgba(1, 8, 4, 0.40),
    0 12px 26px -4px rgba(2, 10, 6, 0.46),
    0 26px 52px -10px rgba(1, 8, 4, 0.54);
  --shadow-elevated:
    0 2px 6px rgba(1, 8, 4, 0.44),
    0 14px 32px -6px rgba(2, 10, 6, 0.54),
    0 32px 72px -12px rgba(1, 8, 4, 0.68);

  --font-sans: "Source Sans 3", sans-serif;
  --font-mono: "Ioskeley Mono", monospace;

  --max-w: 68rem;
  /* The full content box of the 68rem container: the home hero and the search, topic
     and 404 lists. Article and standalone pages use the --measure column instead. */
  --prose-w: 65rem;
  /* The reading column. Article and standalone pages set everything in the reading
     flow (meta bar, title, lead, prose, every component, pager, related list) in one
     centered column this wide, so the column is the measure. At the 17px body size
     Source Sans 3 sets about 99 characters per line at 44rem (median 100; measured in
     headless Chrome). */
  --measure: 44rem;
  /* The right margin rail beside the column (On this page, Tufte sidenotes). */
  --rail-w: 12rem;
  --rail-gap: 2.5rem;
  --header-h: 4.25rem;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #F4F7F5;
  --bg-atmosphere:
    radial-gradient(ellipse 68% 42% at 50% -10%, rgba(14, 106, 64, 0.06), transparent 74%),
    radial-gradient(ellipse 48% 34% at 86% 8%, rgba(11, 74, 46, 0.045), transparent 68%);

  --surface: rgba(255, 255, 255, 0.84);
  --surface-hover: #FFFFFF;
  --surface-solid: #FFFFFF;
  --header-bg: rgba(244, 247, 245, 0.88);

  --fg: #0A1F15;
  --fg-secondary: #2E4539;
  --fg-subtle: #506559;

  --cobalt: #0E6A40;
  --cobalt-deep: #0B4A2E;
  --cobalt-glow: rgba(14, 106, 64, 0.20);
  --cobalt-glow-soft: rgba(14, 106, 64, 0.09);

  --line: rgba(10, 31, 21, 0.095);
  --line-bright: rgba(10, 31, 21, 0.18);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.88);
  --shadow-subtle:
    0 1px 2px rgba(10, 31, 21, 0.055),
    0 6px 16px -3px rgba(10, 31, 21, 0.065),
    0 18px 36px -8px rgba(7, 32, 20, 0.075);
  --shadow-hover:
    0 2px 4px rgba(10, 31, 21, 0.065),
    0 10px 24px -4px rgba(10, 31, 21, 0.085),
    0 24px 48px -10px rgba(7, 32, 20, 0.11);
  --shadow-elevated:
    0 2px 5px rgba(10, 31, 21, 0.07),
    0 12px 28px -4px rgba(10, 31, 21, 0.105),
    0 28px 64px -10px rgba(7, 32, 20, 0.165);

  color-scheme: light;
}

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

/* Zero-underline law: no element may fall back to a browser-default underline,
   whatever class it carries. */
a,
u,
ins,
abbr[title] {
  text-decoration: none;
}

/* Two-font law: form controls do not inherit the page font by default. */
button,
input,
select,
textarea {
  font-family: var(--font-sans);
}

::selection {
  background: rgba(92, 196, 142, 0.24);
  color: var(--fg);
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 2rem);
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.72;
  letter-spacing: -0.004em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  /* Clipped overflow is unreachable, so unbreakable words must wrap instead of being cut off. */
  overflow-wrap: break-word;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--bg-atmosphere);
}

/* Coronet-inspired rose-engine guilloché cross-hatch texture - strictly tonal,
   feathered across the upper canopy and architectural flanks while staying
   whisper-quiet behind central reading copy and clear of scrollbar gutters. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("/assets/images/guilloche-dark.svg");
  background-repeat: repeat;
  background-position: center top;
  background-size: 1200px 600px;
  -webkit-mask-image:
    radial-gradient(ellipse 38rem 98% at 50% 52%, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.11) 66%, rgba(0, 0, 0, 0.58) 86%, rgba(0, 0, 0, 0.96) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.38) 0%, rgba(0, 0, 0, 0.96) 11%, rgba(0, 0, 0, 0.84) 46%, rgba(0, 0, 0, 0.28) 80%, transparent 98%),
    linear-gradient(90deg, transparent 0%, #000 3.5%, #000 96.5%, transparent 100%);
  -webkit-mask-composite: source-in, source-in, source-over;
  mask-image:
    radial-gradient(ellipse 38rem 98% at 50% 52%, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.11) 66%, rgba(0, 0, 0, 0.58) 86%, rgba(0, 0, 0, 0.96) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.38) 0%, rgba(0, 0, 0, 0.96) 11%, rgba(0, 0, 0, 0.84) 46%, rgba(0, 0, 0, 0.28) 80%, transparent 98%),
    linear-gradient(90deg, transparent 0%, #000 3.5%, #000 96.5%, transparent 100%);
  mask-composite: intersect;
}

html[data-theme="light"] body::after {
  background-image: url("/assets/images/guilloche-light.svg");
}

@media not all and (min-width: 760px) {
  body::after {
    background-size: 760px 380px;
    -webkit-mask-image:
      radial-gradient(ellipse 92% 52% at 50% 44%, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.16) 58%, rgba(0, 0, 0, 0.58) 100%),
      linear-gradient(180deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.38) 15%, rgba(0, 0, 0, 0.10) 38%, transparent 62%);
    -webkit-mask-composite: source-in, source-over;
    mask-image:
      radial-gradient(ellipse 92% 52% at 50% 44%, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.16) 58%, rgba(0, 0, 0, 0.58) 100%),
      linear-gradient(180deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.38) 15%, rgba(0, 0, 0, 0.10) 38%, transparent 62%);
    mask-composite: intersect;
  }
}

@media (prefers-contrast: more) {
  body::after {
    display: none !important;
  }
}

/* Subtle top specular green edge line */
.horizon-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  z-index: 400;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 8%,
    rgba(92, 196, 142, 0.34) 36%,
    rgba(92, 196, 142, 0.52) 50%,
    rgba(14, 106, 64, 0.34) 64%,
    transparent 92%
  );
}

/* Sub-pixel jade-emerald specular wavefront for optical theme aperture */
.theme-prism-ring {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
  background: linear-gradient(
    135deg,
    rgba(200, 236, 216, 0.94) 0%,
    rgba(108, 206, 153, 0.9) 50%,
    rgba(52, 160, 104, 0.88) 100%
  );
}

html[data-theme="light"] .theme-prism-ring {
  background: linear-gradient(
    135deg,
    rgba(152, 214, 180, 0.92) 0%,
    rgba(52, 160, 104, 0.88) 50%,
    rgba(14, 106, 64, 0.86) 100%
  );
}

html[data-theme-sweep="true"] .theme-prism-ring {
  view-transition-name: theme-prism;
  visibility: hidden;
  opacity: 0;
}

html[data-theme-sweep="true"][data-theme-prism-on="true"] .theme-prism-ring {
  visibility: visible;
  opacity: 1;
}

html[data-theme-sweep="true"]::view-transition-old(root),
html[data-theme-sweep="true"]::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

html[data-theme-sweep="true"]::view-transition-old(root) {
  z-index: 1;
}

html[data-theme-sweep="true"]::view-transition-new(root) {
  z-index: 2;
  clip-path: circle(0px at 100% 0%);
}

html[data-theme-sweep="true"]::view-transition-group(theme-prism) {
  z-index: 3;
  animation: none;
}

html[data-theme-sweep="true"]::view-transition-old(theme-prism) {
  display: none;
}

html[data-theme-sweep="true"]::view-transition-new(theme-prism) {
  animation: none;
  mix-blend-mode: normal;
  opacity: 0;
  clip-path: circle(0px at 100% 0%);
}

/* Shared-Element Cross-Document Morph (Stream Card <-> Article Header) */
@media (prefers-reduced-motion: no-preference) {
  html:not([data-theme-sweep="true"]) .site-header {
    view-transition-name: site-chrome-header;
  }

  html:not([data-theme-sweep="true"]) .stream-article[data-vt-active="true"] .stream-article-title,
  html:not([data-theme-sweep="true"])[data-vt-article="true"] .article-page-header .page-title {
    view-transition-name: article-hero-title;
  }

  html:not([data-theme-sweep="true"]) .stream-article[data-vt-active="true"] .stream-meta-row,
  html:not([data-theme-sweep="true"])[data-vt-article="true"] .article-page-header .article-meta-bar {
    view-transition-name: article-hero-meta;
  }

  ::view-transition-group(site-chrome-header) {
    z-index: 10;
    animation-duration: 220ms;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }

  ::view-transition-group(article-hero-title),
  ::view-transition-group(article-hero-meta) {
    animation-duration: 380ms;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }

  ::view-transition-old(article-hero-title),
  ::view-transition-new(article-hero-title),
  ::view-transition-old(article-hero-meta),
  ::view-transition-new(article-hero-meta) {
    animation-duration: 260ms;
  }
}

html[data-theme-fallback="true"],
html[data-theme-fallback="true"] body,
html[data-theme-fallback="true"] .site-header,
html[data-theme-fallback="true"] .diagram-frame,
html[data-theme-fallback="true"] .telemetry-frame,
html[data-theme-fallback="true"] .code-frame,
html[data-theme-fallback="true"] .bento-card,
html[data-theme-fallback="true"] .schematic-plate,
html[data-theme-fallback="true"] .tl-card,
html[data-theme-fallback="true"] .cmd-dialog,
html[data-theme-fallback="true"] .link-peek-card,
html[data-theme-fallback="true"] .copy-toast {
  transition:
    background-color 380ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 380ms cubic-bezier(0.22, 1, 0.36, 1),
    color 300ms var(--ease),
    box-shadow 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Scroll-Synced Reading Progress Filament (anchored cleanly to bottom of sticky header) */
.reading-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1.5px;
  z-index: 201;
  pointer-events: none;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--cobalt-deep), var(--cobalt));
  opacity: 0;
}

@keyframes scroll-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .reading-progress {
      opacity: 0.9;
      animation: scroll-progress linear both;
      animation-timeline: scroll(root);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  /* Kept as its own rule: a browser that cannot parse ::backdrop would otherwise drop
     the whole selector list above. */
  ::backdrop {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Ring (WCAG 2.2 AA) */
:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--cobalt-glow-soft);
  border-radius: 6px;
}

/* Programmatic jump targets receive focus for sequential keyboard navigation;
   they must never ring whole sections, headings, or article containers. */
#main-content:focus,
#main-content:focus-visible,
#top-now:focus,
#top-now:focus-visible,
[data-tl-item][tabindex="-1"]:focus,
[data-tl-item][tabindex="-1"]:focus-visible,
.prose :is(h2, h3, h4)[tabindex="-1"]:focus,
.prose :is(h2, h3, h4)[tabindex="-1"]:focus-visible {
  outline: none;
  box-shadow: none;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 1.25rem;
  z-index: 500;
  background: var(--surface-solid);
  color: var(--fg);
  border: 1px solid var(--cobalt);
  box-shadow: var(--shadow-subtle);
  padding: 0.55rem 1.05rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

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

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}

/* Article and standalone pages: one centered reading column. The container keeps its
   side padding, so on narrow screens the column is the full padded width as before,
   and once the padded width passes --measure it is --measure wide and centered
   under the header. */
.container.reading-column {
  box-sizing: content-box;
  width: auto;
  max-width: var(--measure);
}

main {
  flex: 1;
}

/* ==========================================================================
   Header - Frosted Vibrancy & Refined Segmented Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px -12px rgba(1, 8, 4, 0.42);
}

html[data-theme="light"] .site-header {
  box-shadow: 0 4px 18px -10px rgba(10, 31, 21, 0.065);
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  font-family: var(--font-sans);
  font-weight: 630;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: -0.026em;
  color: var(--fg);
  text-decoration: none;
  transition: opacity 180ms var(--ease);
}

/* Wordmark: "Internet Spacejunk" + the visitor's own TLD (.com, .net or .org). The three
   TLDs share one grid cell, so the slot is always as wide as the widest one and the name
   never moves while they change. At rest only the visitor's TLD shows: app.js runs in
   <head> and sets html[data-tld-host] from the hostname before the body is parsed, so the
   first paint is already right on every host; without script the markup's ".com" shows.
   When the footer brace widget cycles, app.js walks the slot through the other two TLDs
   and back to the visitor's with soft crossfades in the shared cell (opacity, a 0.14em
   drift and a 3px blur; see app.js). Nothing is clipped, so the blur and drift are never
   cut off; at most a few px of faint blur reach past the glyphs, inside the header's
   padding and the gap before the nav, and filter never affects layout.
   .com, the main domain, always wears the accent; .net and .org the quieter subtle text
   (both pass 4.5:1 on the header in each theme), each keeping its own colour as it fades. */
.wordmark-name {
  white-space: nowrap;
}

.wordmark-tld {
  display: inline-grid;
  white-space: nowrap;
}

.wordmark-tld-opt {
  grid-area: 1 / 1;
  justify-self: start;
  color: var(--fg-subtle);
  opacity: 0;
}

.wordmark-tld-opt[data-tld-opt="com"] {
  color: var(--cobalt);
}

html:not([data-tld-host]) .wordmark-tld-opt[data-tld-opt="com"],
html[data-tld-host="com"] .wordmark-tld-opt[data-tld-opt="com"],
html[data-tld-host="net"] .wordmark-tld-opt[data-tld-opt="net"],
html[data-tld-host="org"] .wordmark-tld-opt[data-tld-opt="org"] {
  opacity: 1;
}

.wordmark-tld[data-cycling] .wordmark-tld-opt {
  will-change: transform, opacity, filter;
}

/* Narrow screens keep the header on one row. Below 640px the nav cluster (About, search,
   theme) is 164.5px wide and the row gap is 12px, so the wordmark has 100vw - 216.5px.
   On one line it needs 9.75px of width per px of font (Source Sans 3 at 630, -0.026em,
   ".com" slot included), so it scales down with about 9px of slack and never goes below
   15px. Under 370px a 15px single line no longer fits, so the name stacks as "Internet"
   over "Spacejunk.com" (6.27px of width per px of font) at 15.5px; the TLD stays on the
   "Spacejunk" line because both rows bottom-align. */
@media not all and (min-width: 640px) {
  .wordmark {
    font-size: clamp(15px, calc((100vw - 226px) / 9.75), 1.25rem);
  }
}

@media not all and (min-width: 370px) {
  .wordmark {
    align-items: flex-end;
    padding-block: 3px;
    font-size: 15.5px;
  }
  .wordmark-name {
    width: min-content;
    white-space: normal;
  }
}

.wordmark:hover {
  opacity: 0.88;
}

.nav-cluster {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.32rem 0.78rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--fg-secondary);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition:
    color 180ms var(--ease),
    background-color 180ms var(--ease),
    border-color 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

.nav-link:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.055);
}

html[data-theme="light"] .nav-link:hover {
  background: rgba(10, 31, 21, 0.045);
}

.nav-link[aria-current="page"] {
  color: var(--fg);
  font-weight: 500;
  background: rgba(92, 196, 142, 0.13);
  /* A selected state is drawn with a solid accent border (3:1 against the page in
     both themes), not a faint tint alone. */
  border-color: var(--cobalt);
  box-shadow: var(--specular);
}

html[data-theme="light"] .nav-link[aria-current="page"] {
  background: rgba(14, 106, 64, 0.09);
}

/* Header Topics Dropdown (#nav-topics) */
.nav-topics {
  position: relative;
}

summary.nav-topics-trigger {
  list-style: none;
  cursor: pointer;
  gap: 0.32rem;
  user-select: none;
  -webkit-user-select: none;
}

summary.nav-topics-trigger::-webkit-details-marker {
  display: none;
}

summary.nav-topics-trigger::marker {
  content: "";
}

.nav-topics[open] summary.nav-topics-trigger {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.055);
}

html[data-theme="light"] .nav-topics[open] summary.nav-topics-trigger {
  background: rgba(10, 31, 21, 0.045);
}

.nav-topics[data-has-active="true"] summary.nav-topics-trigger {
  color: var(--fg);
  background: rgba(92, 196, 142, 0.13);
  border-color: var(--cobalt);
  box-shadow: var(--specular);
}

html[data-theme="light"] .nav-topics[data-has-active="true"] summary.nav-topics-trigger {
  background: rgba(14, 106, 64, 0.09);
}

.nav-topics-chevron {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  transition: transform 200ms var(--ease-spring);
}

.nav-topics[open]:not([data-closing="true"]) .nav-topics-chevron {
  transform: rotate(180deg);
}

/* The trigger's tag glyph is its narrow-screen form (see the 640px block). */
.nav-topics-glyph {
  display: none;
}

@keyframes dropdown-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dropdown-menu-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-4px) scale(0.975);
  }
}

.nav-topics-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 13.5rem;
  max-height: min(22rem, calc(100dvh - var(--header-h) - 2rem));
  overflow-y: auto;
  padding: 0.4rem;
  border-radius: 12px;
  border: 1px solid var(--line-bright);
  background: var(--surface-solid);
  box-shadow: var(--specular), var(--shadow-elevated);
  z-index: 260;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transform-origin: top right;
  animation: dropdown-menu-in 170ms var(--ease-spring) both;
}

.nav-topics[data-closing="true"] .nav-topics-menu {
  animation: dropdown-menu-out 140ms cubic-bezier(0.32, 0, 0.67, 0) both;
  pointer-events: none;
}

html[data-js] .nav-topics[data-waapi="true"] .nav-topics-menu,
html[data-js] .nav-topics[data-waapi="true"][data-closing="true"] .nav-topics-menu {
  animation: none;
}

.nav-topic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 34px;
  padding: 0.34rem 0.65rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition:
    color 150ms var(--ease),
    background-color 150ms var(--ease),
    border-color 150ms var(--ease);
}

.nav-topic-item:focus-visible {
  outline-offset: -2px;
  box-shadow: none;
}

.nav-topic-item:hover {
  color: var(--fg);
  background: var(--surface-hover);
}

.nav-topic-item[aria-current="true"],
.nav-topic-item[aria-current="page"] {
  color: var(--fg);
  background: rgba(92, 196, 142, 0.14);
  border-color: var(--cobalt);
}

html[data-theme="light"] .nav-topic-item[aria-current="true"],
html[data-theme="light"] .nav-topic-item[aria-current="page"] {
  background: rgba(14, 106, 64, 0.09);
}

.nav-topic-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  padding: 0.05rem 0.42rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg-subtle);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.header-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.2rem;
  padding-left: 0.55rem;
  border-left: 1px solid var(--line);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  min-height: 36px;
  min-width: 36px;
  padding: 0.28rem 0.55rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  cursor: pointer;
  transition:
    color 180ms var(--ease),
    border-color 180ms var(--ease),
    background-color 180ms var(--ease);
}

.ghost-btn:hover {
  color: var(--fg);
  border-color: var(--line-bright);
  background: var(--surface);
}

.ghost-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.65;
  fill: none;
}

#theme-toggle .theme-toggle-svg {
  width: 16px;
  height: 16px;
  overflow: visible;
}

.theme-glyph-sun,
.theme-glyph-moon {
  transform-box: view-box;
  transform-origin: 12px 12px;
  transition:
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 260ms var(--ease);
}

:root .theme-glyph-sun,
html[data-theme="dark"] .theme-glyph-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

:root .theme-glyph-moon,
html[data-theme="dark"] .theme-glyph-moon {
  opacity: 0;
  transform: rotate(-105deg) scale(0.45);
}

html[data-theme="light"] .theme-glyph-sun {
  opacity: 0;
  transform: rotate(105deg) scale(0.45);
}

html[data-theme="light"] .theme-glyph-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Limited Ioskeley Mono accent: keycaps only */
.keycap {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.2;
  color: var(--fg-secondary);
  padding: 0.1rem 0.36rem;
  border: 1px solid var(--line-bright);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.045);
}

html[data-theme="light"] .keycap {
  background: rgba(10, 31, 21, 0.04);
}

/* ==========================================================================
   Hero - Quiet Confidence & Generous Editorial Proportion
   ========================================================================== */
.hero {
  position: relative;
  padding: clamp(3.25rem, 6.5vw, 5.25rem) 0 clamp(2rem, 4vw, 3rem);
}

.hero-inner {
  max-width: var(--prose-w);
}

.hero-title {
  font-size: clamp(2.15rem, 4.2vw, 3.2rem);
  font-weight: 600;
  line-height: 1.13;
  letter-spacing: -0.028em;
  margin: 0 0 1.25rem;
  color: var(--fg);
}

.hero-copy {
  font-size: clamp(1.0625rem, 1.3vw, 1.1875rem);
  line-height: 1.72;
  color: var(--fg-secondary);
  margin: 0;
  max-width: var(--prose-w);
}

.pill-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 40px;
  padding: 0.48rem 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(92, 196, 142, 0.34);
  background: rgba(92, 196, 142, 0.13);
  box-shadow: var(--specular);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 550;
  text-decoration: none;
  transition:
    background-color 200ms var(--ease),
    border-color 200ms var(--ease),
    transform 220ms var(--ease-spring);
}

.pill-cta:hover {
  background: rgba(92, 196, 142, 0.20);
  border-color: rgba(92, 196, 142, 0.52);
  transform: translateY(-1px);
}

/* ==========================================================================
   Section Dividers, Empty States & Topic Chips
   ========================================================================== */
.section {
  padding: 0 0 4.5rem;
}

.section-rule {
  position: relative;
  height: 1px;
  background: var(--line);
  margin-bottom: 2.25rem;
}

.section-rule::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, var(--cobalt), transparent);
}

.empty-frame {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.45rem 1.6rem;
  box-shadow: var(--specular), var(--shadow-subtle);
}

.empty-text {
  margin: 0;
  color: var(--fg-secondary);
  font-size: 0.98rem;
}

.entry-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.entry-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(92, 196, 142, 0.22);
  background: rgba(92, 196, 142, 0.08);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--fg-secondary);
  text-decoration: none;
  transition: color 160ms var(--ease), border-color 160ms var(--ease), background-color 160ms var(--ease);
}

.entry-tag-link {
  text-decoration: none;
  cursor: pointer;
  transition:
    color 160ms var(--ease),
    background-color 160ms var(--ease),
    border-color 160ms var(--ease);
}

a.entry-tag:hover,
.entry-tag-link:hover {
  color: var(--fg);
  border-color: rgba(92, 196, 142, 0.45);
  background: rgba(92, 196, 142, 0.16);
}

.entry-tag-link[data-active-tag="true"],
.entry-tag[data-active-tag="true"] {
  color: var(--fg);
  border-color: rgba(92, 196, 142, 0.52);
  background: rgba(92, 196, 142, 0.20);
}

html[data-theme="light"] .entry-tag-link[data-active-tag="true"],
html[data-theme="light"] .entry-tag[data-active-tag="true"] {
  border-color: rgba(14, 106, 64, 0.42);
  background: rgba(14, 106, 64, 0.14);
}

html[data-js] .home-stream .entry-tag-link[data-active-tag="true"]::after {
  content: " ×";
  /* Decorative glyph: the empty alternative keeps it out of the accessible name
     where supported; the line above is the fallback. */
  content: " ×" / "";
  margin-left: 0.22rem;
  opacity: 0.8;
  font-weight: 500;
}

/* Limited Ioskeley Mono accent: tabular ISO dates */
.entry-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.22rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    color 160ms var(--ease),
    border-color 160ms var(--ease),
    background-color 160ms var(--ease);
}

.tag-pill:hover {
  color: var(--fg);
  border-color: var(--line-bright);
  background: var(--surface-hover);
}

.tag-pill[aria-pressed="true"] {
  color: var(--fg);
  border-color: var(--cobalt);
  background: rgba(92, 196, 142, 0.15);
}

/* ==========================================================================
   Endless-Scroll Front Page Stream, Quarter/Half Card Reveal & Article Pager
   ========================================================================== */
.home-stream {
  padding: 0.5rem 0 4.5rem;
}

.active-topic-drawer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-6px);
  margin-bottom: 0;
  pointer-events: none;
  transition:
    grid-template-rows 380ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 260ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
    margin-bottom 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

.active-topic-drawer[hidden] {
  display: none !important;
}

.active-topic-drawer[data-open="true"] {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
  margin-bottom: 1.4rem;
  pointer-events: auto;
}

.active-topic-drawer-inner {
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

.active-topic-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-bottom: 0;
  padding: 0.55rem 0.85rem 0.55rem 1.05rem;
  border-radius: 12px;
  border: 1px solid rgba(92, 196, 142, 0.30);
  background: rgba(92, 196, 142, 0.09);
  box-shadow: var(--specular);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--fg-secondary);
  transition:
    opacity 150ms var(--ease),
    transform 150ms var(--ease);
}

.active-topic-bar[data-swapping="true"] {
  opacity: 0.45;
  transform: scale(0.992);
}

.active-topic-bar[hidden] {
  display: none !important;
}

.active-topic-bar strong,
#active-topic-name {
  color: var(--fg);
  font-weight: 600;
}

.active-topic-count {
  margin-left: 0.35rem;
  font-size: 0.78rem;
  color: var(--fg-subtle);
}

.active-topic-clear,
#clear-topic-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 28px;
  padding: 0.2rem 0.68rem;
  border-radius: 999px;
  border: 1px solid var(--line-bright);
  background: var(--surface-solid);
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 540;
  cursor: pointer;
  text-decoration: none;
  transition: color 160ms var(--ease), border-color 160ms var(--ease), background-color 160ms var(--ease);
}

.active-topic-clear:hover,
#clear-topic-filter:hover {
  color: var(--fg);
  border-color: rgba(92, 196, 142, 0.45);
  background: var(--surface-hover);
}

.tl-stream.home-tl-stream {
  margin-bottom: 0;
}

.tl-layout.home-stream-layout {
  display: grid;
  grid-template-columns: 7.25rem minmax(0, 1fr);
  gap: 2.25rem;
  align-items: start;
}

.home-article-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.stream-article {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr;
  margin-bottom: 1.85rem;
  opacity: 1;
  transform: scale(1) translateY(0);
  transform-origin: top center;
  transition:
    grid-template-rows 420ms cubic-bezier(0.22, 1, 0.36, 1),
    margin-bottom 420ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 260ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.stream-article:last-child,
.stream-article[data-last-visible="true"] {
  margin-bottom: 0;
}

.stream-article-clip {
  min-height: 0;
  min-width: 0;
  overflow: visible;
}

.stream-article[data-filter-animating="true"] > .stream-article-clip,
.stream-article[data-filter-state="collapsing"] > .stream-article-clip,
.stream-article[data-filter-state="collapsed"] > .stream-article-clip {
  overflow: hidden;
}

.stream-article[data-filter-state="collapsing"],
.stream-article[data-filter-state="collapsed"] {
  grid-template-rows: 0fr;
  margin-bottom: 0;
  opacity: 0;
  transform: scale(0.978) translateY(-8px);
  pointer-events: none;
}

.stream-article[hidden] {
  display: none !important;
}

.stream-card {
  border-radius: 16px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  box-shadow: var(--specular), var(--shadow-subtle);
  padding: clamp(1.35rem, 2.6vw, 1.9rem) clamp(1.35rem, 3vw, 2.15rem);
  cursor: pointer;
  transition:
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.stream-card:hover,
.stream-card:focus-within {
  transform: translateY(-2px);
  border-color: rgba(92, 196, 142, 0.42);
  background: var(--surface-hover);
  box-shadow: var(--specular), var(--shadow-hover);
}

html[data-theme="light"] .stream-card:hover,
html[data-theme="light"] .stream-card:focus-within {
  border-color: rgba(14, 106, 64, 0.32);
}

.stream-article[data-highlighted="true"] .stream-card,
.stream-article[data-returned="true"] .stream-card {
  border-color: rgba(92, 196, 142, 0.52);
  box-shadow: var(--specular), 0 0 0 3px var(--cobalt-glow-soft), var(--shadow-hover);
}

html[data-theme="light"] .stream-article[data-highlighted="true"] .stream-card,
html[data-theme="light"] .stream-article[data-returned="true"] .stream-card {
  border-color: rgba(14, 106, 64, 0.44);
}

.stream-card-head {
  display: block;
  margin-bottom: 1.05rem;
}

.stream-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
}

.stream-meta-sep {
  color: var(--fg-subtle);
  opacity: 0.65;
}

.stream-readtime {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--fg-subtle);
}

.stream-article-title {
  font-family: var(--font-sans);
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  font-weight: 620;
  letter-spacing: -0.022em;
  line-height: 1.2;
  margin: 0.45rem 0 0.5rem;
  padding: 0;
  border: none;
  color: var(--fg);
}

.stream-title-link {
  color: var(--fg);
  text-decoration: none;
  transition: color 180ms var(--ease);
}

.stream-title-link:hover {
  color: var(--cobalt);
}

.stream-article-summary {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.64;
  color: var(--fg-secondary);
}

.stream-peek {
  position: relative;
}

html[data-js] .stream-peek {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

html[data-js] .stream-peek:not([data-short="true"]) {
  max-height: 16.5rem;
  margin-inline: -1.25rem;
  padding-inline: 1.25rem;
  overflow: hidden;
  mask-image: linear-gradient(180deg, #000 0%, #000 46%, rgba(0, 0, 0, 0.32) 76%, transparent 97%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 46%, rgba(0, 0, 0, 0.32) 76%, transparent 97%);
}

.stream-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.stream-read-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 540;
  color: var(--fg-subtle);
  text-decoration: none;
  transition: color 180ms var(--ease);
}

.stream-read-arrow {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.stream-card:hover .stream-read-cue,
.stream-card:focus-within .stream-read-cue {
  color: var(--cobalt);
}

.stream-card:hover .stream-read-arrow,
.stream-card:focus-within .stream-read-arrow {
  transform: translateX(3px);
}

/* Article Meta Bar & Previous / Next Pager */
.article-meta-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  margin-bottom: 1.15rem;
  max-width: var(--measure);
}

.article-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-height: 32px;
  padding: 0.22rem 0.72rem 0.22rem 0.58rem;
  border-radius: 999px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 520;
  text-decoration: none;
  transition:
    color 180ms var(--ease),
    border-color 180ms var(--ease),
    background-color 180ms var(--ease),
    transform 200ms var(--ease-spring);
}

.article-back-link:hover {
  color: var(--fg);
  border-color: rgba(92, 196, 142, 0.42);
  background: var(--surface-hover);
  transform: translateX(-2px);
}

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

.pager-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.38rem;
  padding: 1.1rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  box-shadow: var(--specular), var(--shadow-subtle);
  color: var(--fg);
  text-decoration: none;
  transition:
    border-color 200ms var(--ease),
    background-color 200ms var(--ease),
    transform 220ms var(--ease-spring),
    box-shadow 200ms var(--ease);
}

.pager-card:hover {
  border-color: rgba(92, 196, 142, 0.46);
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--specular), var(--shadow-hover);
}

html[data-theme="light"] .pager-card:hover {
  border-color: rgba(14, 106, 64, 0.36);
}

.pager-older {
  text-align: right;
  align-items: flex-end;
  grid-column: 2;
}

.pager-dir {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 560;
  color: var(--cobalt);
}

.pager-title {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.012em;
  color: var(--fg);
}

.pager-date {
  font-size: 0.76rem;
  color: var(--fg-subtle);
}

/* "Updated <date>" in the article meta bar (only when revised after publication) */
.entry-updated {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--fg-subtle);
  white-space: nowrap;
}

/* Related Articles: one quiet grouped list after the pager */
.related-articles {
  margin-top: 2.25rem;
}

.related-heading {
  margin: 0 0 0.7rem 0.1rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: var(--fg-secondary);
}

.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  box-shadow: var(--specular), var(--shadow-subtle);
}

/* Inset hairline between rows, aligned with the row text */
.related-item + .related-item::before {
  content: "";
  display: block;
  margin-left: 1.25rem;
  border-top: 1px solid var(--line);
}

.related-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "title meta chevron";
  align-items: center;
  gap: 0.3rem 1rem;
  min-height: 3.25rem;
  padding: 0.78rem 1rem 0.78rem 1.25rem;
  color: var(--fg);
  text-decoration: none;
  transition: background-color 180ms var(--ease);
}

.related-item:first-child .related-link {
  border-radius: 13px 13px 0 0;
}

.related-item:last-child .related-link {
  border-radius: 0 0 13px 13px;
}

.related-item:only-child .related-link {
  border-radius: 13px;
}

.related-link:hover {
  background-color: var(--surface-hover);
}

html[data-theme="light"] .related-link:hover {
  background-color: rgba(14, 106, 64, 0.045);
}

.related-link:focus-visible {
  outline-offset: -3px;
  box-shadow: none;
}

.related-title {
  grid-area: title;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--fg);
}

.related-meta {
  grid-area: meta;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.related-date {
  font-size: 0.76rem;
}

.related-chevron {
  grid-area: chevron;
  color: var(--fg-subtle);
  transition:
    color 180ms var(--ease),
    transform 220ms var(--ease-spring);
}

.related-link:hover .related-chevron,
.related-link:focus-visible .related-chevron {
  color: var(--cobalt);
  transform: translateX(2px);
}

/* Narrow screens: "Updated <date>" starts the second meta line instead of leaving a
   separator dangling after the publish date. Row spacing moves from the row gap to item
   margins so the zero-height break adds no extra space. */
@media not all and (min-width: 640px) {
  .article-meta-bar:has(> .meta-sep-updated) {
    row-gap: 0;
    margin-top: -0.225rem;
    margin-bottom: 0.925rem;
  }
  .article-meta-bar:has(> .meta-sep-updated) > * {
    margin-block: 0.225rem;
  }
  .article-meta-bar > .meta-sep-updated {
    flex-basis: 100%;
    height: 0;
    margin-block: 0;
    overflow: hidden;
  }
  .related-link {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title chevron"
      "meta chevron";
    padding: 0.75rem 0.9rem 0.75rem 1rem;
  }
  .related-item + .related-item::before {
    margin-left: 1rem;
  }
  .related-meta {
    justify-content: flex-start;
  }
}

@media print {
  .related-articles {
    display: none !important;
  }
}

/* ==========================================================================
   Subpage Headers, Underline-Free Links, Sidebar TOC, Sidenotes & Prose
   ========================================================================== */
.page-header {
  padding: clamp(3.25rem, 6vw, 4.75rem) 0 2rem;
}

.page-title {
  font-size: clamp(1.9rem, 3.3vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.16;
  margin: 0 0 0.65rem;
  max-width: var(--measure);
}

.page-lead {
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--fg-secondary);
  max-width: var(--measure);
  margin: 0;
}

/* Underline-Free Refined Tonal Link Chip */
.prose a:not(.heading-anchor, .bento-card-link, .tl-nav-stop),
.page-lead a {
  display: inline;
  text-decoration: none;
  color: var(--fg);
  font-weight: 500;
  padding: 0.04em 0.4em 0.07em;
  margin: 0 0.03em;
  border-radius: 6px;
  background: rgba(92, 196, 142, 0.11);
  border: 1px solid rgba(92, 196, 142, 0.24);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition:
    background-color 180ms var(--ease),
    border-color 180ms var(--ease),
    color 180ms var(--ease);
}

html[data-theme="light"] .prose a:not(.heading-anchor, .bento-card-link, .tl-nav-stop),
html[data-theme="light"] .page-lead a {
  background: rgba(14, 106, 64, 0.075);
  border-color: rgba(14, 106, 64, 0.20);
}

.prose a:not(.heading-anchor, .bento-card-link, .tl-nav-stop):hover,
.page-lead a:hover {
  background: rgba(92, 196, 142, 0.19);
  border-color: rgba(92, 196, 142, 0.44);
  color: var(--fg);
}

html[data-theme="light"] .prose a:not(.heading-anchor, .bento-card-link, .tl-nav-stop):hover,
html[data-theme="light"] .page-lead a:hover {
  background: rgba(14, 106, 64, 0.13);
  border-color: rgba(14, 106, 64, 0.40);
}

.prose a:not(.heading-anchor, .bento-card-link, .tl-nav-stop)::after,
.page-lead a::after {
  content: "›";
  content: "›" / "";
  font-family: var(--font-sans);
  font-size: 0.88em;
  line-height: 1;
  margin-left: 0.22em;
  color: var(--cobalt);
  display: inline-block;
  transition: transform 180ms var(--ease);
}

.prose a:not(.heading-anchor, .bento-card-link, .tl-nav-stop):hover::after,
.page-lead a:hover::after {
  transform: translateX(2px);
}

.prose a:not(.heading-anchor, .bento-card-link, .tl-nav-stop)[href^="http"]::after,
.prose a:not(.heading-anchor, .bento-card-link, .tl-nav-stop)[href^="mailto:"]::after,
.page-lead a[href^="http"]::after,
.page-lead a[href^="mailto:"]::after {
  content: "↗";
  content: "↗" / "";
  font-size: 0.74em;
}

.prose a:not(.heading-anchor, .bento-card-link, .tl-nav-stop)[href^="http"]:hover::after,
.prose a:not(.heading-anchor, .bento-card-link, .tl-nav-stop)[href^="mailto:"]:hover::after,
.page-lead a[href^="http"]:hover::after,
.page-lead a[href^="mailto:"]:hover::after {
  transform: translate(1.5px, -1.5px);
}

.prose a code,
.page-lead a code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 0.9em;
}

/* Sticky Margin TOC & Continuous Section Progress Minimap */
.doc-grid {
  display: block;
}

.doc-toc {
  margin: 0.5rem 0 1.75rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--specular), var(--shadow-subtle);
}

.doc-toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.doc-toc-title {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--fg);
  margin: 0 0 0.5rem;
}

.doc-toc-head .doc-toc-title {
  margin: 0;
}

.doc-toc-pct {
  font-size: 0.72rem;
  color: var(--fg-subtle);
  opacity: 0.88;
  transition: color 180ms var(--ease);
}

html[data-theme="light"] .doc-toc-pct {
  opacity: 1;
}

.doc-toc-track-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr);
  column-gap: 0.55rem;
  align-items: start;
}

html:not([data-js]) .doc-toc-rail-svg,
html:not([data-js]) .doc-toc-pct {
  display: none;
}

html:not([data-js]) .doc-toc-track-wrap {
  display: block;
}

.doc-toc-rail-svg {
  display: block;
  width: 6px;
  overflow: visible;
  margin-top: 0;
}

.doc-toc-rail-bg {
  stroke: var(--line-bright);
  stroke-width: 1.25;
  stroke-linecap: round;
}

html[data-theme="light"] .doc-toc-rail-bg {
  stroke: rgba(10, 31, 21, 0.22);
}

.doc-toc-rail-tick {
  stroke: var(--fg-subtle);
  stroke-width: 1;
  opacity: 0.38;
}

html[data-theme="light"] .doc-toc-rail-tick {
  opacity: 0.5;
}

.doc-toc-rail-thumb {
  fill: var(--cobalt);
  filter: drop-shadow(0 0 5px var(--cobalt-glow));
}

.doc-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-toc-list li {
  margin: 0;
}

.doc-toc-link {
  display: block;
  padding: 0.28rem 0.65rem;
  border-left: 1.5px solid var(--line);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.44;
  color: var(--fg-subtle);
  text-decoration: none;
  transition:
    color 160ms var(--ease),
    border-color 160ms var(--ease),
    background-color 160ms var(--ease);
}

.doc-toc-link[data-level="3"] {
  padding-left: 1.15rem;
  font-size: 0.84rem;
}

.doc-toc-link:hover,
.doc-toc-link[aria-current="true"] {
  color: var(--fg);
  border-left-color: var(--cobalt);
}

html[data-js] .doc-toc[data-rail-ready="true"] .doc-toc-list {
  border-left: none;
}

html[data-js] .doc-toc[data-rail-ready="true"] .doc-toc-link {
  border-left: none;
  border-radius: 6px;
  padding: 0.28rem 0.55rem;
}

html[data-js] .doc-toc[data-rail-ready="true"] .doc-toc-link[data-level="3"] {
  padding-left: 1.05rem;
}

html[data-js] .doc-toc[data-rail-ready="true"] .doc-toc-link:hover {
  color: var(--fg);
  background: rgba(92, 196, 142, 0.07);
}

html[data-theme="light"][data-js] .doc-toc[data-rail-ready="true"] .doc-toc-link:hover {
  background: rgba(14, 106, 64, 0.065);
}

html[data-js] .doc-toc[data-rail-ready="true"] .doc-toc-link[aria-current="true"] {
  color: var(--fg);
  font-weight: 560;
  background: rgba(92, 196, 142, 0.065);
}

html[data-theme="light"][data-js] .doc-toc[data-rail-ready="true"] .doc-toc-link[aria-current="true"] {
  background: rgba(14, 106, 64, 0.055);
}

/* Margin rail breakpoint (TOC and sidenotes): the rail hangs to the right of the
   centered column, so it needs --measure + 2 x (--rail-gap + --rail-w + 1.5rem
   container padding) = 76rem, plus up to 17px for a classic scrollbar: 77.5em. Em, not
   px, so a larger default font size moves the breakpoint with the rem-sized column.
   Below it the TOC is a card above the content and notes are inline callouts. */
@media (min-width: 77.5em) {
  /* The grid's first track is exactly the column; the rail track overhangs the
     column's right edge by the negative margin, so the column stays centered. */
  .doc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--rail-w);
    column-gap: var(--rail-gap);
    align-items: start;
    margin-right: calc(-1 * (var(--rail-gap) + var(--rail-w)));
  }

  .doc-toc {
    order: 2;
    position: sticky;
    top: calc(var(--header-h) + 2rem);
    margin: 0.15rem 0 0;
    padding: 0;
    max-width: none;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-height: calc(100vh - var(--header-h) - 4rem);
    max-height: calc(100dvh - var(--header-h) - 4rem);
    overflow-y: auto;
  }

  /* The list scrolls and has no padding here, so an outset ring would be clipped. */
  .doc-toc-link:focus-visible {
    outline-offset: -2px;
    box-shadow: none;
  }
}

/* The body fills the reading column: running text and every wide component (diagrams,
   code, telemetry, bento, plates, timelines, tables, figures) share one left and one
   right edge. */
.prose-shell {
  padding: 0;
  min-width: 0;
}

/* Line breaking: headings and titles balance their lines and running text avoids a
   lone last word. Longhands only, so no element's wrap mode (white-space) changes. */
.prose p,
.prose li,
.prose blockquote,
.hero-copy,
.page-lead,
.stream-article-summary,
.cmd-preview-summary,
.empty-text,
.sidenote,
figcaption {
  text-wrap-style: pretty;
}

h1,
h2,
h3,
h4,
.pager-title,
.related-title,
.cmd-preview-title,
.prose .telemetry-title {
  text-wrap-style: balance;
}

/* Tufte Margin Sidenotes (Limited Ioskeley Mono numeric index) */
.sidenote-ref {
  white-space: nowrap;
}

.sidenote-num,
.sidenote-index {
  font-family: var(--font-mono);
  font-size: 0.68em;
  color: var(--cobalt);
  padding: 0 0.15em;
  vertical-align: super;
  line-height: 1;
}

sup.sidenote-num[data-sidenote-trigger] {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68em;
  line-height: 1;
  vertical-align: super;
  min-width: 1.42em;
  padding: 0.14em 0.38em;
  margin-left: 0.12em;
  margin-block: -0.32em;
  border-radius: 999px;
  background: rgba(92, 196, 142, 0.12);
  border: 1px solid rgba(92, 196, 142, 0.28);
  transition:
    background-color 160ms var(--ease),
    border-color 160ms var(--ease),
    color 160ms var(--ease);
}

html[data-theme="light"] sup.sidenote-num[data-sidenote-trigger] {
  /* The deeper accent keeps the index at 4.5:1 on its own tinted chip. */
  color: var(--cobalt-deep);
  background: rgba(14, 106, 64, 0.08);
  border-color: rgba(14, 106, 64, 0.22);
}

sup.sidenote-num[data-sidenote-trigger]:hover,
sup.sidenote-num[data-sidenote-trigger][aria-expanded="true"],
sup.sidenote-num[data-sidenote-trigger]:focus-visible {
  background: rgba(92, 196, 142, 0.22);
  border-color: var(--cobalt);
  color: var(--fg);
}

html[data-theme="light"] sup.sidenote-num[data-sidenote-trigger]:hover,
html[data-theme="light"] sup.sidenote-num[data-sidenote-trigger][aria-expanded="true"],
html[data-theme="light"] sup.sidenote-num[data-sidenote-trigger]:focus-visible {
  background: rgba(14, 106, 64, 0.16);
  border-color: var(--cobalt);
  color: var(--fg);
}

.sidenote .sidenote-index {
  font-size: 0.75rem;
  vertical-align: baseline;
  margin-right: 0.3rem;
  padding: 0;
}

.sidenote {
  transition:
    color 180ms var(--ease),
    border-color 180ms var(--ease),
    background-color 180ms var(--ease);
}

@media not all and (min-width: 77.5em) {
  .sidenote {
    display: block;
    white-space: normal;
    margin: 0.55rem 0 0.75rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 2px solid var(--cobalt);
    border-radius: 0 8px 8px 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--fg-secondary);
  }

  html[data-theme="light"] .sidenote {
    background: rgba(14, 106, 64, 0.045);
    border-color: rgba(14, 106, 64, 0.14);
    border-left: 2px solid var(--cobalt);
  }
}

@media (min-width: 77.5em) {
  /* Without the reserved rail (a TOC column is present) notes stay inline callouts. */
  .prose:not(.prose-with-rail) .sidenote {
    display: block;
    white-space: normal;
    margin: 0.55rem 0 0.75rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 2px solid var(--cobalt);
    border-radius: 0 8px 8px 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--fg-secondary);
  }

  html[data-theme="light"] .prose:not(.prose-with-rail) .sidenote {
    background: rgba(14, 106, 64, 0.045);
    border-color: rgba(14, 106, 64, 0.14);
    border-left: 2px solid var(--cobalt);
  }

  /* Notes float beside their reference and hang into the margin rail: the negative
     right margin puts each note --rail-gap past the column's right edge (paragraphs,
     list items, quotes and headings all end at that edge), so running text keeps the
     full column and notes never overlap it. */
  .prose-with-rail .sidenote {
    float: right;
    clear: right;
    white-space: normal;
    width: var(--rail-w);
    margin: 0.15rem calc(-1 * (var(--rail-gap) + var(--rail-w))) 1rem 0;
    padding: 0.2rem 0.5rem 0.25rem 0.75rem;
    border-left: 1.5px solid rgba(92, 196, 142, 0.32);
    border-radius: 0 6px 6px 0;
    font-size: 0.825rem;
    line-height: 1.52;
    color: var(--fg-subtle);
  }

  /* A note in a timeline card starts from the card's inner edge (1px border and 1.2rem
     padding inside the column), so it reaches that much further to the same rail. */
  .prose-with-rail .tl-card .sidenote {
    margin-right: calc(-1 * (var(--rail-gap) + var(--rail-w) + 1.2rem + 1px));
  }
}

.sidenote[data-sidenote-highlighted="true"],
.prose-with-rail .sidenote[data-sidenote-highlighted="true"],
.prose:not(.prose-with-rail) .sidenote[data-sidenote-highlighted="true"] {
  color: var(--fg);
  border-color: rgba(92, 196, 142, 0.34);
  border-left-color: var(--cobalt);
  background: rgba(92, 196, 142, 0.09);
  border-radius: 0 8px 8px 0;
}

html[data-theme="light"] .sidenote[data-sidenote-highlighted="true"],
html[data-theme="light"] .prose-with-rail .sidenote[data-sidenote-highlighted="true"],
html[data-theme="light"] .prose:not(.prose-with-rail) .sidenote[data-sidenote-highlighted="true"] {
  border-color: rgba(14, 106, 64, 0.28);
  border-left-color: var(--cobalt);
  background: rgba(14, 106, 64, 0.08);
}

/* Frosted-Glass Internal Link & Sidenote Peek Popover (#link-peek-card) */
.link-peek-card {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 360;
  width: min(21.5rem, calc(100vw - 1.5rem));
  padding: 0.88rem 1.02rem;
  border-radius: 13px;
  border: 1px solid rgba(92, 196, 142, 0.3);
  background: rgba(14, 33, 24, 0.96);
  backdrop-filter: saturate(185%) blur(22px);
  -webkit-backdrop-filter: saturate(185%) blur(22px);
  box-shadow: var(--specular), var(--shadow-elevated);
  color: var(--fg);
  pointer-events: auto;
  transform-origin: center top;
}

.link-peek-card[data-placement="above"] {
  transform-origin: center bottom;
}

html[data-theme="light"] .link-peek-card {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(14, 106, 64, 0.24);
}

.link-peek-card[hidden] {
  display: none !important;
}

.link-peek-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.42rem;
  font-size: 0.76rem;
  line-height: 1.3;
  color: var(--fg-subtle);
}

.link-peek-meta .stream-readtime {
  font-size: inherit;
  line-height: inherit;
}

.link-peek-section {
  padding: 0.08rem 0.48rem;
  border-radius: 999px;
  background: rgba(92, 196, 142, 0.12);
  border: 1px solid rgba(92, 196, 142, 0.3);
  color: var(--cobalt);
  font-size: 0.74rem;
  font-weight: 540;
}

html[data-theme="light"] .link-peek-section {
  background: rgba(14, 106, 64, 0.09);
  border-color: rgba(14, 106, 64, 0.26);
  color: var(--cobalt-deep);
}

.link-peek-title {
  margin: 0 0 0.28rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 620;
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: var(--fg);
}

.link-peek-body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  line-height: 1.52;
  color: var(--fg-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-peek-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.prose {
  color: var(--fg-secondary);
  overflow-wrap: break-word;
}

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

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

.prose img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  border-radius: 11px;
  border: 1px solid var(--line-bright);
  background: var(--surface-solid);
  box-shadow:
    0 2px 5px rgba(1, 8, 4, 0.36),
    0 10px 24px -4px rgba(2, 10, 6, 0.42),
    0 22px 46px -10px rgba(1, 8, 4, 0.48);
  transition:
    border-color 200ms var(--ease),
    transform 220ms var(--ease-spring),
    box-shadow 200ms var(--ease);
}

html[data-theme="light"] .prose img {
  border-color: rgba(10, 31, 21, 0.13);
  box-shadow:
    0 1px 2px rgba(10, 31, 21, 0.06),
    0 6px 16px -3px rgba(10, 31, 21, 0.075),
    0 18px 40px -8px rgba(7, 32, 20, 0.11);
}

.prose > img,
.prose figure:not(.diagram-frame, .telemetry-frame, .schematic-plate) img {
  display: block;
  margin: 1.5rem auto;
}

.prose a:has(> img:only-child) {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 11px;
}

.prose > a:has(> img:only-child),
.prose figure:not(.diagram-frame, .telemetry-frame, .schematic-plate) a:has(> img:only-child) {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 1.5rem auto;
}

.prose figure:not(.diagram-frame, .telemetry-frame, .schematic-plate) a:has(> img:only-child) {
  margin: 0 auto;
}

.prose a:has(> img:only-child):focus-visible {
  border-radius: 13px;
}

html[data-theme="light"] .prose a:has(> img:only-child),
.prose a:has(> img:only-child):hover,
html[data-theme="light"] .prose a:has(> img:only-child):hover {
  background: transparent;
  border: none;
}

.prose a:has(> img:only-child)::after {
  content: none;
  display: none;
}

.prose a:has(> img:only-child):hover img {
  border-color: rgba(92, 196, 142, 0.45);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

html[data-theme="light"] .prose a:has(> img:only-child):hover img {
  border-color: rgba(14, 106, 64, 0.36);
}

.prose :is(h1, h2, h3, h4) img,
.prose :is(p, li) > img:not(:only-child),
.prose :is(p, li) > a:not(:only-child) > img,
.prose img[data-inline],
.prose img:is([width="12"], [width="14"], [width="16"], [width="18"], [width="20"], [width="22"], [width="24"], [width="28"], [width="32"], [width="36"], [height="14"], [height="16"], [height="18"], [height="20"], [height="24"]) {
  display: inline-block;
  margin: 0 0.18em;
  border: none;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  vertical-align: -0.16em;
}

html[data-theme="light"] .prose :is(h1, h2, h3, h4) img,
html[data-theme="light"] .prose :is(p, li) > img:not(:only-child),
html[data-theme="light"] .prose :is(p, li) > a:not(:only-child) > img,
html[data-theme="light"] .prose img[data-inline],
html[data-theme="light"] .prose img:is([width="12"], [width="14"], [width="16"], [width="18"], [width="20"], [width="22"], [width="24"], [width="28"], [width="32"], [width="36"], [height="14"], [height="16"], [height="18"], [height="20"], [height="24"]),
.prose :is(p, li) > a:not(:only-child):has(> img:only-child):hover img,
.prose a:has(> img:only-child):hover img:is([data-inline], [width="12"], [width="14"], [width="16"], [width="18"], [width="20"], [width="22"], [width="24"], [width="28"], [width="32"], [width="36"], [height="14"], [height="16"], [height="18"], [height="20"], [height="24"]) {
  border: none;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.prose figure:not(.diagram-frame, .telemetry-frame, .schematic-plate) {
  margin: 1.65rem 0;
}

.prose figure:not(.diagram-frame, .telemetry-frame, .schematic-plate) img {
  margin: 0 auto;
}

.prose figure:not(.diagram-frame, .telemetry-frame, .schematic-plate) figcaption {
  margin-top: 0.6rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--fg-subtle);
  text-align: center;
}

.prose strong {
  color: var(--fg);
  font-weight: 600;
}

.prose h2 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--fg);
  margin: 2.5rem 0 0.8rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
}

.prose h3 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--fg);
  margin: 1.8rem 0 0.55rem;
}

.prose h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin: 1.45rem 0 0.45rem;
}

.prose :is(h2, h3, h4)[data-deep-linked="true"] {
  color: var(--cobalt);
  transition: color 350ms var(--ease);
}

.heading-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 0.82em;
  font-weight: 450;
  line-height: 1;
  vertical-align: middle;
  transform: translateY(-0.06em);
  color: var(--fg-subtle);
  text-decoration: none;
  margin-left: 0.35rem;
  opacity: 0;
  padding: 0.18rem 0.34rem;
  border-radius: 5px;
  transition:
    opacity 160ms var(--ease),
    color 160ms var(--ease),
    background-color 160ms var(--ease);
}

.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose h4:hover .heading-anchor {
  opacity: 1;
}

/* Touch devices have no hover, so the anchor must not be an invisible tap target. */
@media (hover: none) {
  .heading-anchor {
    opacity: 1;
  }
}

/* Stream previews are inert, so their heading anchors could be seen but never used. */
html[data-js] .stream-peek .heading-anchor {
  display: none;
}

.heading-anchor:hover,
.heading-anchor:focus-visible,
.heading-anchor[data-copied="true"],
.prose :is(h2, h3, h4)[data-deep-linked="true"] .heading-anchor {
  opacity: 1 !important;
  color: var(--cobalt);
  background: rgba(92, 196, 142, 0.12);
}

html[data-theme="light"] .heading-anchor:hover,
html[data-theme="light"] .heading-anchor:focus-visible,
html[data-theme="light"] .heading-anchor[data-copied="true"],
html[data-theme="light"] .prose :is(h2, h3, h4)[data-deep-linked="true"] .heading-anchor {
  color: var(--cobalt-deep);
  background: rgba(14, 106, 64, 0.09);
}

.prose p,
.prose ul,
.prose ol,
.prose pre,
.prose blockquote,
.prose .table-wrap {
  margin: 0 0 1.3rem;
}

.prose > .table-wrap:last-child {
  margin-bottom: 0;
}

.prose blockquote {
  padding: 0.55rem 0 0.55rem 1.1rem;
  border-left: 2px solid var(--cobalt);
  color: var(--fg-secondary);
}

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

.prose hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 2.2rem 0;
}

.prose li {
  margin-bottom: 0.45rem;
}

/* Limited Ioskeley Mono: inline code & preformatted code blocks */
.prose code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
}

.prose pre {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: hidden;
}

.prose pre code {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--fg);
}

.code-frame {
  --halo-base-shadow: var(--specular), var(--shadow-subtle);
  margin: 0 0 1.35rem;
  border: 1px solid var(--line-bright);
  border-radius: 11px;
  background: var(--surface-solid);
  box-shadow: var(--specular), var(--shadow-subtle);
  overflow: hidden;
}

.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.42rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(92, 196, 142, 0.045);
}

.code-lang {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--fg-subtle);
}

.code-copy-btn {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 520;
  min-height: 26px;
  padding: 0.15rem 0.62rem;
  border-radius: 6px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  color: var(--fg-secondary);
  cursor: pointer;
  transition:
    color 160ms var(--ease),
    border-color 160ms var(--ease),
    background-color 160ms var(--ease);
}

.code-copy-btn:hover {
  color: var(--fg);
  border-color: rgba(92, 196, 142, 0.42);
  background: var(--surface-hover);
}

.code-copy-btn[data-copied="true"] {
  color: var(--fg);
  border-color: var(--cobalt);
  background: rgba(92, 196, 142, 0.12);
}

.code-frame pre {
  margin: 0;
  border: none;
  border-radius: 0;
}

/* The frame clips overflow, so the keyboard focus ring is drawn inside the scroll area. */
.code-frame pre:focus-visible {
  outline-offset: -2px;
  box-shadow: none;
}

/* Tabular numeric indices & readouts (limited Ioskeley Mono role) */
.mono-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Enhanced Code Headers, Multi-Tab Code Groups, Line Numbers, Focus & Diff Rows */
.code-title-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.code-filename {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 560;
  color: var(--fg);
}

.code-lang-pill {
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--fg-subtle);
}

.cg-bar {
  padding: 0.22rem 0.65rem 0.22rem 0.35rem;
}

.cg-tablist {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 3px;
  overflow-x: auto;
  min-width: 0;
  scrollbar-width: none;
}

.cg-tablist::after {
  content: "";
  flex: 0 0 2px;
  height: 1px;
}

.cg-tablist::-webkit-scrollbar {
  display: none;
}

.cg-tab-slider {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms var(--ease);
}

.cg-tablist[data-slider-ready="true"] .cg-tab-slider {
  width: auto;
  height: auto;
  opacity: 1;
}

.cg-tab-pill {
  fill: rgba(92, 196, 142, 0.16);
  stroke: var(--cobalt);
  stroke-width: 1;
}

html[data-theme="light"] .cg-tab-pill {
  fill: rgba(14, 106, 64, 0.10);
}

.cg-tab {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  min-height: 30px;
  padding: 0.24rem 0.75rem;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-subtle);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 520;
  cursor: pointer;
  transition:
    color 160ms var(--ease),
    background-color 160ms var(--ease),
    border-color 160ms var(--ease);
}

.cg-tab:hover {
  color: var(--fg);
}

.cg-tab[aria-selected="true"] {
  color: var(--fg);
  background: rgba(92, 196, 142, 0.14);
  border-color: var(--cobalt);
  box-shadow: var(--specular);
}

html[data-theme="light"] .cg-tab[aria-selected="true"] {
  background: rgba(14, 106, 64, 0.09);
}

.cg-tablist[data-slider-ready="true"] .cg-tab[aria-selected="true"] {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.cg-panels {
  position: relative;
}

.cg-panels[data-resizing="true"] {
  overflow: hidden;
}

.cg-panel {
  scroll-margin-top: 2.75rem;
}

.cg-panel[hidden] {
  display: none !important;
}

/* Progressive enhancement. Scripted (html[data-js]): inactive code tabs collapse
   before first paint and the static fallbacks are hidden. Unscripted: every tab is
   shown with its label, simulation stages are listed, and inert controls are hidden. */
html[data-js] .cg-panel[data-cg-inactive],
html[data-js] .sim-static-list {
  display: none;
}

html:not([data-js]) .cg-tablist,
html:not([data-js]) .code-copy-btn,
html:not([data-js]) .diagram-controls,
html:not([data-js]) .sim-next-btn,
html:not([data-js]) .sim-rail,
html:not([data-js]) .sim-console,
html:not([data-js]) .tl-filter-bar,
html:not([data-js]) .focus-expand-btn,
html:not([data-js]) [data-telem-reset],
html:not([data-js]) .sim-badge {
  display: none;
}

html:not([data-js]) .cg-panel::before {
  content: attr(data-cg-label);
  display: block;
  padding: 0.5rem 1.15rem 0;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 560;
  color: var(--fg-subtle);
}

.prose .sim-static-list,
.sim-static-list {
  margin: 0;
  padding: 0.75rem 1rem 0.9rem 2.2rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--fg-secondary);
}

.sim-static-list li {
  margin: 0.4rem 0;
}

.sim-static-list p {
  margin: 0.15rem 0 0;
}

.sim-static-meta {
  color: var(--fg-subtle);
}

/* `.prose pre` sets its own padding with higher specificity; match it so line
   backgrounds and accent bars run edge to edge. */
.prose pre.code-pre-lines,
.code-pre-lines {
  padding: 0.75rem 0;
}

/* The tablist is a scroll container, which would clip an outset ring: draw it inside. */
.cg-tab:focus-visible {
  outline-offset: -2px;
  box-shadow: none;
}

.code-pre-lines code {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

.code-line {
  display: block;
  padding: 0.08rem 1.15rem;
  line-height: 1.62;
  /* Blank lines are emitted empty (so copied text is exact) and keep their height here. */
  min-height: 1.62em;
  box-sizing: border-box;
  border-left: 2px solid transparent;
  transition: opacity 180ms var(--ease), background-color 180ms var(--ease);
}

.code-line-body {
  display: block;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Two-column hanging-indent grid so wrapped lines align with code, never under the gutter. */
.code-pre-lines.has-line-numbers .code-line {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  column-gap: 0.95rem;
  align-items: baseline;
}

.code-pre-lines.has-diff-lines:not(.has-line-numbers) .code-line {
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1fr);
  column-gap: 0.65rem;
  align-items: baseline;
}

.code-pre-lines.has-line-numbers.has-diff-lines .code-line {
  display: grid;
  grid-template-columns: 3.3rem minmax(0, 1fr);
  column-gap: 0.95rem;
  align-items: baseline;
}

.code-pre-lines.has-line-numbers .code-line::before {
  content: attr(data-ln);
  display: block;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--fg-subtle);
  user-select: none;
  -webkit-user-select: none;
}

/* Diff rows carry a "+" / "-" sign in a gutter, so added and removed lines are
   distinguishable without relying on colour. The sign is generated content and is
   never part of copied text. */
.code-pre-lines.has-diff-lines .code-line::before {
  content: "\00a0";
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

.code-pre-lines.has-diff-lines .code-line[data-diff]::before {
  content: attr(data-diff);
  font-weight: 600;
}

.code-pre-lines.has-line-numbers.has-diff-lines .code-line::before {
  content: attr(data-ln) "\00a0\00a0";
  text-align: right;
}

.code-pre-lines.has-line-numbers.has-diff-lines .code-line[data-diff]::before {
  content: attr(data-ln) "\00a0" attr(data-diff);
}

/* The diff sign is the non-colour cue, so it is always drawn at full text contrast. */
.code-pre-lines.has-diff-lines .code-line[data-diff]::before,
.code-pre-lines.has-line-numbers.has-diff-lines .code-line[data-diff]::before {
  color: var(--fg-secondary);
  opacity: 1;
}

/* Context lines are never faded: syntax colours cannot stay above 4.5:1 at reduced
   opacity. Spotlighted lines are marked by their background and accent bar instead. */
.code-line-focus {
  background: rgba(92, 196, 142, 0.15);
  border-left-color: var(--cobalt);
}

.code-line-add {
  background: rgba(94, 214, 150, 0.095);
  border-left-color: #5ED696;
}

.code-line-del {
  background: rgba(248, 113, 113, 0.085);
  border-left-color: rgba(248, 113, 113, 0.65);
}

/* A line that is both spotlighted and added/removed keeps a visible spotlight bar
   (the tints are not stacked, which would lower text contrast). */
.code-line-focus.code-line-add,
.code-line-focus.code-line-del {
  box-shadow: inset 3px 0 0 var(--cobalt);
}

/* ==========================================================================
   General-Purpose Interactive Diagrammer (.diagram-frame)
   ========================================================================== */
.diagram-frame,
.telemetry-frame,
.bento-grid,
.schematic-grid,
.tl-stream {
  margin: 0 0 1.6rem;
}

.focus-slot-spacer {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 1.6rem;
  pointer-events: none;
  visibility: hidden;
}

.focus-slot-spacer[hidden] {
  display: none !important;
}

.diagram-frame {
  border: 1px solid var(--line-bright);
  border-radius: 13px;
  background: var(--surface-solid);
  box-shadow: var(--specular), var(--shadow-subtle);
  overflow: hidden;
}

.diagram-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.52rem 0.75rem 0.52rem 0.95rem;
  border-bottom: 1px solid var(--line);
  background: rgba(92, 196, 142, 0.045);
}

.diagram-title {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  min-width: 0;
}

.diagram-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  justify-self: end;
  align-self: start;
  flex-shrink: 0;
}

.diag-ctrl-btn {
  min-height: 26px;
  min-width: 26px;
  padding: 0.14rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 540;
  cursor: pointer;
  transition:
    color 160ms var(--ease),
    border-color 160ms var(--ease),
    background-color 160ms var(--ease);
}

.diag-ctrl-btn:hover:not(:disabled) {
  color: var(--fg);
  border-color: rgba(92, 196, 142, 0.42);
  background: var(--surface-hover);
}

.diag-ctrl-btn[hidden] {
  display: none !important;
}

.diagram-stage {
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  background: radial-gradient(ellipse 75% 65% at 50% 0%, rgba(92, 196, 142, 0.08), transparent 76%);
}

html:not([data-js]) .diagram-stage {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Live vector viewBox camera scales cleanly inside the stage without layout reflow;
   no-JS viewports retain a 34rem floor so dense diagrams stay horizontally scrollable. */
.diagram-svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

html:not([data-js]) .diagram-svg {
  min-width: 34rem;
}

.diagram-stage[data-zoomed="true"],
.telemetry-stage[data-zoomed="true"] {
  cursor: grab;
  touch-action: none;
}

.diagram-stage[data-panning="true"],
.telemetry-stage[data-panning="true"],
.diagram-stage[data-panning="true"] *,
.telemetry-stage[data-panning="true"] * {
  cursor: grabbing !important;
}

.diag-ctrl-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.diagram-legend {
  border-top: 1px solid var(--line);
  padding: 0.5rem 0.95rem;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  color: var(--fg-secondary);
}

.diagram-legend summary {
  cursor: pointer;
  color: var(--fg-subtle);
  font-weight: 540;
}

.diagram-legend summary:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
  border-radius: 4px;
}

.prose .diagram-legend-list,
.diagram-legend-list {
  margin: 0.5rem 0 0.25rem;
  padding-left: 1.1rem;
}

.diagram-legend-list li {
  margin: 0.2rem 0;
}

.diag-grid-dot {
  fill: rgba(220, 238, 228, 0.085);
}

html[data-theme="light"] .diag-grid-dot {
  fill: rgba(10, 31, 21, 0.09);
}

/* Zone borders, lifelines, and the swarm band carry information, so they keep at
   least 3:1 against the stage in both themes. */
.diag-zone-rect {
  fill: rgba(92, 196, 142, 0.035);
  stroke: rgba(92, 196, 142, 0.72);
  stroke-width: 1;
}

html[data-theme="light"] .diag-zone-rect {
  stroke: rgba(14, 106, 64, 0.78);
}

.diag-zone-label {
  fill: var(--fg-subtle);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 560;
}

.diag-lifeline {
  stroke: rgba(186, 207, 195, 0.45);
  stroke-width: 1;
}

html[data-theme="light"] .diag-lifeline {
  stroke: rgba(10, 31, 21, 0.52);
}

.diag-edge {
  stroke: rgba(186, 207, 195, 0.58);
  stroke-width: 1.45;
  transition: stroke 180ms var(--ease), opacity 180ms var(--ease), stroke-width 180ms var(--ease);
}

html[data-theme="light"] .diag-edge {
  stroke: rgba(10, 31, 21, 0.6);
}

.diag-arrow-head {
  fill: rgba(186, 207, 195, 0.55);
}

html[data-theme="light"] .diag-arrow-head {
  fill: rgba(10, 31, 21, 0.48);
}

.diag-arrow-head-active {
  fill: var(--cobalt);
}

.diag-seq-dot {
  fill: var(--cobalt);
}

.diag-edge-pill {
  fill: var(--surface-solid);
  stroke: var(--line-bright);
  stroke-width: 1;
}

.diag-edge-label {
  fill: var(--fg-subtle);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 520;
}

.diag-node {
  cursor: pointer;
  transition: opacity 180ms var(--ease);
}

.diag-node:focus-visible {
  outline: none;
}

/* A node's fill is nearly the stage colour, so its outline is the only boundary and
   is held at 3:1 against the stage in every tone and both themes. */
.diag-node-box {
  fill: #13281D;
  stroke: rgba(186, 207, 195, 0.5);
  stroke-width: 1.15;
  filter: drop-shadow(0 2px 4px rgba(1, 8, 4, 0.42)) drop-shadow(0 6px 12px rgba(1, 8, 4, 0.24));
  transition: fill 180ms var(--ease), stroke 180ms var(--ease), stroke-width 180ms var(--ease);
}

html[data-theme="light"] .diag-node-box {
  fill: #FFFFFF;
  stroke: rgba(10, 31, 21, 0.5);
  filter: drop-shadow(0 1px 2px rgba(10, 31, 21, 0.065)) drop-shadow(0 5px 11px rgba(7, 32, 20, 0.075));
}

.diag-tone-cobalt .diag-node-box {
  fill: #173426;
  stroke: rgba(92, 196, 142, 0.72);
}

html[data-theme="light"] .diag-tone-cobalt .diag-node-box {
  fill: #EFF6F2;
  stroke: rgba(14, 106, 64, 0.78);
}

.diag-tone-accent .diag-node-box {
  stroke: rgba(148, 174, 162, 0.6);
}

/* The sky accent cannot reach 3:1 on a light stage at any opacity; a deeper tone
   of the same hue is used instead. */
html[data-theme="light"] .diag-tone-accent .diag-node-box {
  stroke: rgba(69, 110, 88, 0.85);
}

.diag-node-icon {
  color: var(--cobalt);
}

.diag-node-title {
  fill: var(--fg);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
}

.diag-node-sub {
  fill: var(--fg-subtle);
  font-family: var(--font-sans);
  font-size: 11px;
}

.diag-node-divider {
  stroke: var(--line);
  stroke-width: 1;
}

.diag-status-dot {
  fill: var(--cobalt);
}

.diag-node-meta {
  fill: var(--fg-secondary);
  font-size: 10.5px;
}

/* Interactive Path Isolation States */
/* A focused node is excluded from dimming, so its focus ring stays at full contrast. */
.diagram-frame[data-has-active="true"] .diag-node:not([data-node-active="true"]):not([data-node-neighbor="true"]):not(:focus-visible) {
  /* Dimmed nodes stay operable, so their titles stay above 4.5:1 in every tone and
     both themes. */
  opacity: 0.62;
}

.diagram-frame[data-has-active="true"] .diag-edge-group:not([data-edge-active="true"]) {
  opacity: 0.22;
}

.diag-edge-group[data-edge-active="true"] .diag-edge {
  stroke: var(--cobalt);
  stroke-width: 2;
}

.diag-edge-group[data-edge-active="true"] .diag-edge-pill {
  stroke: rgba(92, 196, 142, 0.55);
}

.diag-edge-group[data-edge-active="true"] .diag-edge-label {
  fill: var(--fg);
}

/* State rules are scoped under .diagram-frame so they outrank the per-tone rules
   (including the light-theme tone override) on every node. */
.diagram-frame .diag-node:hover .diag-node-box,
.diagram-frame .diag-node[data-node-neighbor="true"] .diag-node-box {
  stroke: rgba(92, 196, 142, 0.86);
}

/* Hover and neighbour outlines must stay at least as strong as the resting outline.
   :where() keeps this below the selected and keyboard-focus rules that follow. */
html[data-theme="light"] .diagram-frame .diag-node:where(:hover, [data-node-neighbor="true"]):where(:not([data-node-active="true"])) .diag-node-box {
  stroke: rgba(14, 106, 64, 0.86);
}

.diagram-frame .diag-node[data-node-active="true"] .diag-node-box {
  fill: #1C4430;
  stroke: var(--cobalt);
  stroke-width: 1.75;
  /* Drawn in screen pixels, so the outline does not thin out when a wide diagram
     is scaled down to a narrow viewport. */
  vector-effect: non-scaling-stroke;
}

.diagram-frame .diag-node[data-node-active="true"] .diag-node-sub {
  fill: var(--fg-secondary);
}

html[data-theme="light"] .diagram-frame .diag-node[data-node-active="true"] .diag-node-box {
  fill: #E6F2EB;
}

/* Keyboard focus is drawn in the text colour at a heavier weight, so it is distinct
   from the cobalt "selected" outline. Declared last so it wins over the state rules. */
html .diagram-frame .diag-node:focus-visible .diag-node-box,
html .diagram-frame .diag-node[data-node-active="true"]:focus-visible .diag-node-box {
  stroke: var(--fg);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.diagram-inspector {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.58rem 0.95rem;
  border-top: 1px solid var(--line);
  background: rgba(11, 26, 18, 0.45);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  line-height: 1.48;
  color: var(--fg-subtle);
}

html[data-theme="light"] .diagram-inspector {
  background: rgba(10, 31, 21, 0.025);
}

.diagram-inspector[data-active="true"] {
  color: var(--fg);
  background: rgba(92, 196, 142, 0.085);
}

html[data-theme="light"] .diagram-inspector[data-active="true"] {
  background: rgba(14, 106, 64, 0.06);
}

.diag-inspector-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-subtle);
  transition: background-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.diagram-inspector[data-active="true"] .diag-inspector-dot {
  background: var(--cobalt);
  box-shadow: 0 0 0 3px var(--cobalt-glow-soft);
}

/* ==========================================================================
   Radial-Lit Specular Bento Cards & Precision Isometric Schematics
   ========================================================================== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem;
}

.bento-cols-1 {
  grid-template-columns: minmax(0, 1fr);
}

.bento-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bento-span-2 {
  grid-column: span 2;
}

.bento-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 14px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  box-shadow: var(--specular), var(--shadow-subtle);
  padding: 1.15rem 1.2rem 1.2rem;
  overflow: hidden;
  text-decoration: none;
  color: var(--fg);
  transition:
    border-color 220ms var(--ease),
    transform 240ms var(--ease-spring),
    box-shadow 220ms var(--ease);
}

.bento-card:hover {
  border-color: rgba(92, 196, 142, 0.42);
  transform: translateY(-2px);
  box-shadow: var(--specular), var(--shadow-hover);
}

html[data-theme="light"] .bento-card:hover {
  border-color: rgba(14, 106, 64, 0.34);
}

.bento-spotlight-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 240ms var(--ease);
}

.bento-card[data-hovered="true"] .bento-spotlight-svg {
  opacity: 1;
}

.bento-visual {
  position: relative;
  z-index: 1;
  height: 7.4rem;
  margin: -0.25rem -0.25rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(11, 26, 18, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

html[data-theme="light"] .bento-visual {
  background: rgba(14, 106, 64, 0.035);
}

.iso-svg {
  width: 100%;
  max-width: 15rem;
  height: 100%;
}

.iso-stroke-muted {
  fill: none;
  stroke: rgba(186, 207, 195, 0.28);
  stroke-width: 1.15;
}

html[data-theme="light"] .iso-stroke-muted {
  stroke: rgba(10, 31, 21, 0.24);
}

.iso-stroke-bright {
  fill: none;
  stroke: var(--cobalt);
  stroke-width: 1.4;
}

.iso-plate-accent {
  fill: rgba(92, 196, 142, 0.14);
  stroke: var(--cobalt);
  stroke-width: 1.35;
  transition: fill 220ms var(--ease);
}

.bento-card:hover .iso-plate-accent,
.schematic-plate:hover .iso-plate-accent {
  fill: rgba(92, 196, 142, 0.24);
}

.iso-guide {
  stroke: rgba(92, 196, 142, 0.35);
  stroke-width: 1;
}

.iso-node-dot {
  fill: var(--cobalt);
}

.bento-content {
  position: relative;
  z-index: 1;
}

.bento-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.bento-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 560;
  color: var(--cobalt);
}

.bento-stat {
  font-size: 0.74rem;
  color: var(--fg-subtle);
}

.prose .bento-title,
.bento-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-sans);
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.014em;
  color: var(--fg);
}

.prose .bento-copy,
.bento-copy {
  margin: 0;
  font-size: 0.89rem;
  line-height: 1.56;
  color: var(--fg-secondary);
}

.schematic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.schematic-cols-1 {
  grid-template-columns: minmax(0, 1fr);
}

.schematic-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.schematic-plate {
  margin: 0;
  padding: 0.95rem 1rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line-bright);
  background: var(--surface-solid);
  box-shadow: var(--specular), var(--shadow-subtle);
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.schematic-plate:hover {
  border-color: rgba(92, 196, 142, 0.42);
}

html[data-theme="light"] .schematic-plate:hover {
  border-color: rgba(14, 106, 64, 0.34);
}

.schematic-art {
  height: 6.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.schematic-caption {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.84rem;
  line-height: 1.48;
  color: var(--fg-subtle);
}

.schematic-caption strong {
  color: var(--fg);
  font-size: 0.9rem;
}

/* ==========================================================================
   Scrubbable Telemetry Plots, Swarm Distributions & Step Simulations
   ========================================================================== */
.telemetry-frame {
  position: relative;
  border: 1px solid var(--line-bright);
  border-radius: 13px;
  background: var(--surface-solid);
  box-shadow: var(--specular), var(--shadow-subtle);
  overflow: hidden;
}

.telemetry-head {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem 0.75rem 0.75rem 1.05rem;
  border-bottom: 1px solid var(--line);
  background: rgba(92, 196, 142, 0.04);
}

.telemetry-head-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
}

.telemetry-titles {
  min-width: 0;
}

.telemetry-corner-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  justify-self: end;
  align-self: start;
  flex-shrink: 0;
}

.telemetry-readout-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.prose .telemetry-title,
.telemetry-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--fg);
}

.prose .telemetry-sub,
.telemetry-sub {
  margin: 0.15rem 0 0;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--fg-subtle);
}

.telemetry-readout,
.sim-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.28rem 0.72rem;
  border-radius: 10px;
  border: 1px solid rgba(92, 196, 142, 0.32);
  background: rgba(92, 196, 142, 0.11);
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--fg);
}

.telemetry-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.telemetry-kpi {
  padding: 0.6rem 1.05rem;
  background: var(--surface-solid);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.telemetry-kpi-label {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  color: var(--fg-subtle);
}

.telemetry-kpi-val {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg);
}

.telemetry-stage {
  position: relative;
  padding: 0.65rem 0.65rem 0.35rem;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

html:not([data-js]) .telemetry-stage {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.telemetry-svg {
  display: block;
  width: 100%;
  height: auto;
}

html:not([data-js]) .telemetry-svg {
  min-width: 30rem;
}

.telem-grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.telem-axis-num {
  fill: var(--fg-subtle);
  font-size: 10.5px;
}

.telem-line-primary {
  stroke: var(--cobalt);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.telem-line-secondary {
  stroke: rgba(186, 207, 195, 0.55);
  stroke-width: 1.5;
}

html[data-theme="light"] .telem-line-secondary {
  stroke: rgba(10, 31, 21, 0.6);
}

.telem-crosshair {
  stroke: rgba(92, 196, 142, 0.55);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.telem-cursor-halo {
  fill: rgba(92, 196, 142, 0.22);
  pointer-events: none;
}

.telem-cursor-dot {
  fill: var(--fg);
  stroke: var(--cobalt);
  stroke-width: 2;
  pointer-events: none;
}

.swarm-row {
  cursor: pointer;
}

.swarm-row:focus-visible {
  outline: none;
}

.swarm-hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 2;
  transition: fill 160ms var(--ease);
}

/* Visible focus ring (the default outline is replaced, not removed). */
.swarm-row:focus-visible .swarm-hit {
  stroke: var(--cobalt);
  vector-effect: non-scaling-stroke;
}

.swarm-row:hover .swarm-hit,
.swarm-row[data-active="true"] .swarm-hit,
.swarm-row:focus-visible .swarm-hit {
  fill: rgba(92, 196, 142, 0.075);
}

.swarm-label {
  fill: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 540;
}

.swarm-whisker {
  stroke: var(--fg-subtle);
  stroke-width: 1.25;
}

.swarm-iqr {
  fill: rgba(92, 196, 142, 0.14);
  stroke: rgba(92, 196, 142, 0.72);
  stroke-width: 1;
}

html[data-theme="light"] .swarm-iqr {
  stroke: rgba(14, 106, 64, 0.78);
}

.swarm-dot {
  fill: #66C895;
  opacity: 0.82;
}

html[data-theme="light"] .swarm-dot {
  fill: var(--cobalt);
}

.swarm-median {
  stroke: var(--fg);
  stroke-width: 2;
}

.focus-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  min-width: 5.25rem;
}

.focus-btn-icon {
  flex-shrink: 0;
}

.focus-icon-expand,
.focus-icon-collapse {
  transform-box: view-box;
  transform-origin: 8px 8px;
  transition:
    opacity 200ms var(--ease),
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.focus-icon-collapse {
  opacity: 0;
  transform: scale(0.72);
}

.focus-expand-btn[aria-expanded="true"] .focus-icon-expand {
  opacity: 0;
  transform: scale(0.72);
}

.focus-expand-btn[aria-expanded="true"] .focus-icon-collapse {
  opacity: 1;
  transform: scale(1);
}

/* Full-Viewport Focus Modal for Diagrams, Telemetry Charts & Protocol Steppers */
@keyframes focus-dialog-in {
  0% {
    opacity: 0;
    transform: scale(0.935) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes focus-dialog-out {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.955) translateY(6px);
  }
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes backdrop-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.cmd-dialog.focus-dialog {
  width: min(86rem, calc(100vw - 2rem));
  max-width: none;
  margin: auto;
  max-height: calc(100dvh - 2rem);
  transform-origin: center center;
}

.cmd-dialog.focus-dialog[open] {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
}

.cmd-dialog.focus-dialog[open][data-css-fallback="true"] {
  animation: focus-dialog-in 290ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cmd-dialog.focus-dialog[open][data-css-fallback="true"]::backdrop,
.cmd-dialog.focus-dialog[open][data-backdrop-css="true"]::backdrop {
  animation: backdrop-in 260ms var(--ease) both;
}

.cmd-dialog.focus-dialog[data-closing="true"] {
  pointer-events: none;
}

.cmd-dialog.focus-dialog[data-closing="true"][data-css-fallback="true"] {
  animation: focus-dialog-out 220ms cubic-bezier(0.32, 0, 0.67, 0) both;
}

.cmd-dialog.focus-dialog[data-closing="true"][data-css-fallback="true"]::backdrop,
.cmd-dialog.focus-dialog[data-closing="true"][data-backdrop-css="true"]::backdrop {
  animation: backdrop-out 240ms var(--ease) both;
}

.cmd-dialog.focus-dialog[data-flip-active="true"] {
  position: fixed;
  inset: 0 auto auto 0;
  margin: 0;
  max-width: none;
  max-height: none;
  overflow: hidden;
}

.cmd-dialog.focus-dialog[data-flip-active="true"] .focus-dialog-stage {
  overflow: hidden;
}

.focus-dialog-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.focus-dialog-stage .diagram-frame,
.focus-dialog-stage .telemetry-frame {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  /* The stage is the scroller here; a clipping frame would defeat the sticky header. */
  overflow: visible;
}

/* The Collapse control lives in the figure's own header: keep it in view while the stage scrolls. */
.focus-dialog-stage .diagram-bar,
.focus-dialog-stage .telemetry-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.7rem 1.25rem 0.7rem 1.5rem;
  /* Opaque while content scrolls beneath, keeping the header's cobalt tint. */
  background-color: var(--surface-solid);
}

.focus-dialog-stage .diagram-bar {
  background-image: linear-gradient(rgba(92, 196, 142, 0.045), rgba(92, 196, 142, 0.045));
}

.focus-dialog-stage .telemetry-head {
  background-image: linear-gradient(rgba(92, 196, 142, 0.04), rgba(92, 196, 142, 0.04));
}

.focus-dialog-stage .diagram-stage,
.focus-dialog-stage .telemetry-stage {
  padding: 1.25rem 1.5rem;
}

.focus-dialog-stage .diagram-inspector,
.focus-dialog-stage .diagram-legend {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.focus-dialog-stage .diagram-svg,
.focus-dialog-stage .telemetry-svg {
  width: 100%;
  height: auto;
}

.focus-dialog-stage .sim-rail {
  padding: 1.25rem 1.5rem;
  gap: 0.75rem;
}

.focus-dialog-stage .sim-step-btn {
  min-height: 52px;
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
}

.focus-dialog-stage .sim-console {
  padding: 1.1rem 1.5rem 1.35rem;
}

.focus-dialog-stage .sim-console-title {
  font-size: 1rem;
}

.focus-dialog-stage .sim-console-detail {
  font-size: 0.96rem;
  max-width: 60rem;
}

.sim-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.5rem;
  padding: 0.85rem 1.05rem;
}

.sim-step-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 520;
  text-align: left;
  cursor: pointer;
  transition:
    color 160ms var(--ease),
    border-color 160ms var(--ease),
    background-color 160ms var(--ease);
}

.sim-step-btn:hover {
  color: var(--fg);
  border-color: var(--line-bright);
}

.sim-step-btn[aria-pressed="true"] {
  color: var(--fg);
  border-color: var(--cobalt);
  background: rgba(92, 196, 142, 0.14);
  box-shadow: var(--specular);
}

.sim-step-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-subtle);
}

.sim-step-btn[aria-pressed="true"] .sim-step-dot {
  background: var(--cobalt);
  box-shadow: 0 0 0 3px var(--cobalt-glow-soft);
}

.sim-step-name {
  flex: 1;
  min-width: 0;
}

.sim-step-val {
  font-size: 0.74rem;
  color: var(--fg-subtle);
}

.sim-console {
  padding: 0.75rem 1.05rem 0.9rem;
  border-top: 1px solid var(--line);
  background: rgba(11, 26, 18, 0.42);
  overflow-x: clip;
}

.sim-console[data-resizing="true"] {
  overflow: hidden;
}

html[data-theme="light"] .sim-console {
  background: rgba(10, 31, 21, 0.025);
}

.sim-console-title {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.2rem;
}

.prose .sim-console-detail,
.sim-console-detail {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.54;
  color: var(--fg-secondary);
}

/* ==========================================================================
   Chronological Timeline / Log Rail (.tl-stream)
   Proportional SVG navigation line immediately to the right of the dates
   ========================================================================== */
.tl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-bottom: 1.25rem;
}

.tl-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tl-layout {
  display: grid;
  grid-template-columns: 7.25rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.tl-chrono-rail {
  position: sticky;
  top: calc(var(--header-h) + 2rem);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  /* A long stream's rail must stay reachable while sticky: scroll inside the viewport. */
  max-height: calc(100dvh - var(--header-h) - 3.5rem);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  user-select: none;
  -webkit-user-select: none;
}

.tl-chrono-rail:focus,
.tl-chrono-rail:focus-visible,
.tl-chrono-svg:focus,
.tl-chrono-svg:focus-visible {
  outline: none;
  box-shadow: none;
}

[data-home-stream] .tl-chrono-rail {
  top: calc(var(--header-h) + 1.25rem);
  max-height: calc(100dvh - var(--header-h) - 2rem);
  scrollbar-width: none;
}

[data-home-stream] .tl-chrono-rail::-webkit-scrollbar {
  display: none;
}

.tl-chrono-svg {
  display: block;
  width: 10.5rem;
  max-width: none;
  flex-shrink: 0;
  height: auto;
  overflow: visible;
}

.tl-chrono-svg[data-scrub-ready="true"] {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tl-chrono-svg[data-scrubbing="true"],
.tl-chrono-svg[data-scrubbing="true"] .tl-nav-stop {
  cursor: ns-resize;
}

.tl-scrub-hairline {
  stroke: var(--cobalt);
  stroke-width: 1.25;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms var(--ease);
}

.tl-chrono-svg[data-hovering="true"] .tl-scrub-hairline,
.tl-chrono-svg[data-scrubbing="true"] .tl-scrub-hairline {
  opacity: 0.75;
}

.tl-axis-spine {
  stroke: rgba(186, 207, 195, 0.26);
  stroke-width: 1;
}

html[data-theme="light"] .tl-axis-spine {
  stroke: rgba(10, 31, 21, 0.22);
}

.tl-axis-cap {
  stroke: rgba(186, 207, 195, 0.38);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-theme="light"] .tl-axis-cap {
  stroke: rgba(10, 31, 21, 0.34);
}

.tl-axis-tick {
  stroke: rgba(186, 207, 195, 0.22);
  stroke-width: 1;
}

html[data-theme="light"] .tl-axis-tick {
  stroke: rgba(10, 31, 21, 0.18);
}

.tl-nav-stop {
  cursor: pointer;
  text-decoration: none;
}

.tl-nav-stop[data-exiting="true"] {
  pointer-events: none;
}

.tl-nav-stop:focus,
.tl-nav-stop:focus-visible {
  outline: none;
  box-shadow: none;
}

.tl-stop-hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1.5;
  transition: fill 150ms var(--ease);
}

.tl-nav-stop:hover .tl-stop-hit,
.tl-nav-stop[data-preview="true"] .tl-stop-hit,
.tl-nav-stop:focus-visible .tl-stop-hit {
  fill: rgba(92, 196, 142, 0.09);
}

.tl-nav-stop:focus-visible .tl-stop-hit {
  stroke: var(--cobalt);
}

.tl-stop-date {
  fill: var(--fg-subtle);
  font-size: 10.5px;
  transition: fill 150ms var(--ease), opacity 150ms var(--ease);
}

.tl-nav-stop[data-tier="day"] .tl-stop-date {
  fill: var(--fg-secondary);
}

.tl-nav-stop[data-tier="month"] .tl-stop-date {
  fill: var(--fg-subtle);
}

.tl-nav-stop[data-tier="year"] .tl-stop-date {
  fill: var(--fg-subtle);
  opacity: 0.85;
}

/* At 0.85 the light-theme year label drops below 4.5:1. */
html[data-theme="light"] .tl-nav-stop[data-tier="year"] .tl-stop-date {
  opacity: 1;
}

.tl-nav-stop[data-active="true"] .tl-stop-date,
.tl-nav-stop[data-preview="true"] .tl-stop-date,
.tl-nav-stop:hover .tl-stop-date,
.tl-nav-stop:focus-visible .tl-stop-date {
  fill: var(--fg);
  opacity: 1;
  font-weight: 500;
}

.tl-stop-leader {
  stroke: rgba(186, 207, 195, 0.22);
  stroke-width: 1;
  transition: stroke 150ms var(--ease), opacity 150ms var(--ease);
}

html[data-theme="light"] .tl-stop-leader {
  stroke: rgba(10, 31, 21, 0.20);
}

.tl-nav-stop[data-display-date=""]:not([data-preview="true"]):not(:hover):not(:focus-visible) .tl-stop-leader {
  opacity: 0;
}

.tl-nav-stop:hover .tl-stop-leader,
.tl-nav-stop:focus-visible .tl-stop-leader,
.tl-nav-stop[data-preview="true"] .tl-stop-leader,
.tl-nav-stop[data-active="true"] .tl-stop-leader {
  stroke: rgba(92, 196, 142, 0.62);
  opacity: 1;
}

.tl-stop-dot {
  fill: var(--surface-solid);
  stroke: rgba(186, 207, 195, 0.52);
  stroke-width: 1.4;
  transition: fill 150ms var(--ease), stroke 150ms var(--ease);
}

html[data-theme="light"] .tl-stop-dot {
  stroke: rgba(10, 31, 21, 0.48);
}

.tl-nav-stop[data-preview="true"] .tl-stop-dot,
.tl-nav-stop:focus-visible .tl-stop-dot {
  stroke: var(--cobalt);
}

.tl-nav-stop:hover .tl-stop-dot,
.tl-nav-stop[data-active="true"] .tl-stop-dot {
  fill: var(--cobalt);
  stroke: var(--cobalt);
}

html[data-js] .tl-chrono-svg:has(.tl-active-puck) .tl-nav-stop[data-active="true"]:not(:hover) .tl-stop-dot {
  fill: var(--surface-solid);
  stroke: var(--cobalt);
}

.tl-now-label {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--fg-subtle);
  transition: fill 180ms var(--ease);
}

.tl-now-stop[data-active="true"] .tl-now-label,
.tl-now-stop:hover .tl-now-label,
.tl-now-stop:focus-visible .tl-now-label {
  fill: var(--fg);
}

.tl-active-puck {
  fill: var(--cobalt);
  stroke: var(--bg);
  stroke-width: 1.5;
  pointer-events: none;
}

.tl-list:not(.home-article-list) {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tl-list:not(.home-article-list) > .tl-item {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr;
  margin-bottom: 1.15rem;
  opacity: 1;
  transform: scale(1) translateY(0);
  transform-origin: top center;
  /* No scroll-margin here: html's scroll-padding-top already clears the header, and
     stacking both would land a jumped-to entry below the rail's scroll-sync threshold. */
  transition:
    grid-template-rows 380ms cubic-bezier(0.22, 1, 0.36, 1),
    margin-bottom 380ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 240ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tl-list:not(.home-article-list) > .tl-item:last-child,
.tl-list:not(.home-article-list) > .tl-item[data-last-visible="true"] {
  margin-bottom: 0;
}

.tl-item-clip {
  min-height: 0;
  min-width: 0;
  overflow: visible;
}

.tl-list:not(.home-article-list) > .tl-item[data-filter-animating="true"] > .tl-item-clip,
.tl-list:not(.home-article-list) > .tl-item[data-filter-state="collapsing"] > .tl-item-clip,
.tl-list:not(.home-article-list) > .tl-item[data-filter-state="collapsed"] > .tl-item-clip {
  overflow: hidden;
}

.tl-list:not(.home-article-list) > .tl-item[data-filter-state="collapsing"],
.tl-list:not(.home-article-list) > .tl-item[data-filter-state="collapsed"] {
  grid-template-rows: 0fr;
  margin-bottom: 0;
  opacity: 0;
  transform: scale(0.978) translateY(-8px);
  pointer-events: none;
}

.tl-item[hidden] {
  display: none !important;
}

.tl-card {
  position: relative;
  border-radius: 13px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  box-shadow: var(--specular), var(--shadow-subtle);
  padding: 1rem 1.2rem 1.05rem;
  transition: border-color 180ms var(--ease), box-shadow 200ms var(--ease);
}

.tl-item[data-highlighted="true"] .tl-card {
  border-color: rgba(92, 196, 142, 0.52);
  box-shadow: var(--specular), 0 0 0 3px var(--cobalt-glow-soft), var(--shadow-hover);
}

html[data-theme="light"] .tl-item[data-highlighted="true"] .tl-card {
  border-color: rgba(14, 106, 64, 0.44);
}

.tl-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.5rem;
}

@media (min-width: 560px) {
  .tl-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.35rem 0.85rem;
  }
}

.tl-card-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.tl-card-date {
  font-size: 0.76rem;
}

.prose .tl-title,
.tl-title {
  margin: 0;
  border: none;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--fg);
}

.tl-badge {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line-bright);
  background: var(--surface-solid);
  font-size: 0.72rem;
  color: var(--fg-secondary);
}

.tl-media-card {
  height: 6.6rem;
  margin: 0.55rem 0 0.75rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tl-body p {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  line-height: 1.62;
  color: var(--fg-secondary);
}

.tl-body p:last-child {
  margin-bottom: 0;
}

.tl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.7rem;
}

/* Restrained Forest-Green Syntax Token Palette */
/* Token colours are chosen to stay at or above 4.5:1 on plain lines and on the
   focus / added / removed line tints, in both themes. */
.tok-cm {
  color: #8BA798;
  font-style: italic;
}

.tok-kw {
  color: #6FCF9E;
  font-weight: 500;
}

.tok-str {
  color: #D2E3D9;
}

.tok-fn {
  color: #F2F7F4;
}

.tok-num {
  color: #8FD9B0;
}

.tok-type {
  color: #D2E3D9;
}

.tok-op {
  color: #9DB5A8;
}

html[data-theme="light"] .tok-cm {
  color: #536A5E;
}

html[data-theme="light"] .tok-kw,
html[data-theme="light"] .tok-str {
  color: var(--cobalt-deep);
}

html[data-theme="light"] .tok-fn {
  color: #0A1F15;
  font-weight: 600;
}

html[data-theme="light"] .tok-num {
  color: var(--cobalt-deep);
}

html[data-theme="light"] .tok-type {
  color: #2E4539;
}

html[data-theme="light"] .tok-op {
  color: var(--fg-subtle);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border: 1px solid var(--line-bright);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--specular), var(--shadow-subtle);
}

.prose table:not(.sr-only) {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.55;
}

.prose table:not(.sr-only) th,
.prose table:not(.sr-only) td {
  text-align: left;
  padding: 0.78rem 0.95rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.prose table:not(.sr-only) tr:last-child td {
  border-bottom: none;
}

.prose table:not(.sr-only) th {
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: -0.004em;
  background: rgba(92, 196, 142, 0.055);
}

/* ==========================================================================
   Search Page, Command Palette & Keyboard Shortcuts Modal (<dialog>)
   ========================================================================== */
.sr-only {
  position: absolute;
  left: 0;
  width: 1px;
  min-width: 0;
  max-width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.search-wrap {
  margin: 0 0 1rem;
  max-width: var(--prose-w);
}

.search-input {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
  color: var(--fg);
  background: var(--surface);
  /* The field boundary is the only thing separating the input from the page, so it
     is drawn at 3:1 rather than with the hairline token. */
  border: 1px solid rgba(220, 238, 228, 0.42);
  border-radius: 10px;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

html[data-theme="light"] .search-input {
  border-color: rgba(10, 31, 21, 0.5);
}

/* Single concentric focus ring matching the 10px input radius. */
.search-input:focus,
html[data-theme="light"] .search-input:focus {
  outline: none;
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px var(--cobalt-glow-soft);
}

.search-input:focus-visible,
html[data-theme="light"] .search-input:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: -1px;
  border-radius: 10px;
  box-shadow: 0 0 0 4px var(--cobalt-glow-soft);
}

/* Both search labels are visually hidden, so the placeholder is the visible
   instruction and must not fall back to a low-contrast browser default. */
.search-input::placeholder,
.cmd-input::placeholder {
  color: var(--fg-subtle);
  opacity: 1;
}

.search-status {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--fg-subtle);
  margin: 0 0 1rem;
}

.cmd-dialog {
  width: min(50rem, calc(100vw - 2rem));
  margin: 10vh auto auto;
  padding: 0;
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  background: var(--surface-solid);
  color: var(--fg);
  box-shadow: var(--specular), var(--shadow-elevated);
  overscroll-behavior: contain;
}

.cmd-dialog[open] {
  display: flex;
  flex-direction: column;
  /* The 10vh top margin counts against the viewport, so it is subtracted too. */
  max-height: calc(100vh - 10vh - 1rem);
  max-height: calc(100dvh - 10vh - 1rem);
  overflow: hidden;
}

.cmd-dialog::backdrop {
  background: rgba(3, 12, 7, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#search-dialog[open],
#shortcuts-dialog[open] {
  /* No fill mode: a transform left applied after the entrance would make the dialog
     the containing block for the fixed copy toast shown inside it. */
  animation: focus-dialog-in 220ms var(--ease-spring);
}

#search-dialog[open]::backdrop,
#shortcuts-dialog[open]::backdrop {
  animation: backdrop-in 180ms var(--ease) both;
}

#search-dialog[data-closing="true"],
#shortcuts-dialog[data-closing="true"] {
  animation: focus-dialog-out 150ms cubic-bezier(0.32, 0, 0.67, 0) both;
  pointer-events: none;
}

#search-dialog[data-closing="true"]::backdrop,
#shortcuts-dialog[data-closing="true"]::backdrop {
  animation: backdrop-out 150ms var(--ease) both;
}

.cmd-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.cmd-dialog-title {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
}

.cmd-input {
  flex: 1;
  min-height: 36px;
  padding: 0.25rem 0.45rem;
  border: none;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}

.cmd-input:focus,
.cmd-input:focus-visible {
  outline: none;
  box-shadow: none;
}

.cmd-close {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  min-height: 30px;
  padding: 0.2rem 0.52rem;
  border-radius: 6px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  color: var(--fg-secondary);
  cursor: pointer;
}

.cmd-close:hover {
  color: var(--fg);
}

.cmd-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  min-height: 0;
  flex: 1;
}

@media (min-width: 760px) {
  .cmd-split {
    min-height: min(21rem, calc(100dvh - 10vh - 5.5rem));
  }
}

.cmd-body {
  flex: 1;
  min-height: 0;
  padding: 0.5rem;
  max-height: 22rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.cmd-pane-preview {
  border-left: 1px solid var(--line);
  padding: 1rem 1.15rem;
  background: rgba(92, 196, 142, 0.032);
  max-height: 22rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

html[data-theme="light"] .cmd-pane-preview {
  background: rgba(14, 106, 64, 0.028);
}

.cmd-preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.cmd-preview-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--fg);
}

.cmd-preview-summary {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.56;
  color: var(--fg-secondary);
}

.cmd-preview-outline {
  margin-top: 0.25rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.cmd-outline-label {
  margin: 0 0 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-subtle);
}

.cmd-outline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cmd-outline-link {
  display: block;
  padding: 0.24rem 0.5rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.825rem;
  color: var(--fg-secondary);
  text-decoration: none;
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}

.cmd-outline-link:hover {
  color: var(--fg);
  background: var(--surface-hover);
}

.cmd-status {
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--fg-subtle);
}

.cmd-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.page-cmd-list {
  max-width: var(--prose-w);
}

.page-cmd-list .cmd-item a {
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}

/* ==========================================================================
   Article Index (Topic Pages & 404) and 404 Recovery
   ========================================================================== */
.article-index {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: var(--prose-w);
  display: grid;
  gap: 1rem;
}

.article-index-item {
  position: relative;
  padding: clamp(1.15rem, 2.2vw, 1.5rem) clamp(1.2rem, 2.6vw, 1.75rem);
  border-radius: 16px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  box-shadow: var(--specular), var(--shadow-subtle);
  transition:
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.article-index-item:hover,
.article-index-item:focus-within {
  transform: translateY(-2px);
  border-color: rgba(92, 196, 142, 0.42);
  background: var(--surface-hover);
  box-shadow: var(--specular), var(--shadow-hover);
}

html[data-theme="light"] .article-index-item:hover,
html[data-theme="light"] .article-index-item:focus-within {
  border-color: rgba(14, 106, 64, 0.32);
}

.article-index-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
}

/* Topic pills sit above the card-wide title link so each stays its own target. */
.article-index-meta .entry-tags {
  position: relative;
  z-index: 1;
}

.article-index-title {
  font-family: var(--font-sans);
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  font-weight: 620;
  letter-spacing: -0.02em;
  line-height: 1.24;
  margin: 0.45rem 0 0.4rem;
  padding: 0;
  border: none;
  color: var(--fg);
}

.article-index-link {
  color: var(--fg);
  text-decoration: none;
  transition: color 180ms var(--ease);
}

/* The title link covers the whole card, so the card opens the article without script. */
.article-index-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
}

.article-index-item:hover .article-index-link {
  color: var(--cobalt);
}

/* Keyboard focus rings the card the link covers rather than the title text. */
.article-index-link:focus-visible {
  outline: none;
  box-shadow: none;
}

.article-index-link:focus-visible::after {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--cobalt-glow-soft);
}

.article-index-summary {
  margin: 0;
  font-size: 1rem;
  line-height: 1.62;
  color: var(--fg-secondary);
}

.notfound-search {
  margin: 0 0 2.5rem;
}

/* Search runs in the browser; without script the 404 page offers its static list. */
html:not([data-js]) .notfound-search {
  display: none;
}

.notfound-label {
  display: block;
  margin: 0 0 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 560;
  color: var(--fg);
}

.notfound-search .search-status:empty {
  margin: 0;
}

.notfound-heading {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.3;
  margin: 0 0 1rem;
  color: var(--fg);
}

.notfound-home {
  margin-top: 2.25rem;
}

.cmd-item a,
.cmd-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  min-height: 40px;
  padding: 0.5rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.34;
  text-align: left;
  text-decoration: none;
  color: var(--fg);
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}

.cmd-item a:hover,
.cmd-item a[data-active="true"],
.cmd-item-btn:hover,
.cmd-item-btn[data-active="true"] {
  background: var(--surface-hover);
  border-color: rgba(92, 196, 142, 0.22);
}

/* The active row is the keyboard cursor of the list, so its outline is a solid,
   high-contrast border rather than a faint tint. */
.cmd-item a[data-active="true"],
.cmd-item-btn[data-active="true"] {
  border-color: var(--cobalt);
}

.cmd-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmd-item-tag {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--fg-subtle);
}

.cmd-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--fg-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.shortcuts-dialog {
  width: min(26rem, calc(100vw - 2rem));
}

.shortcuts-dialog .cmd-top {
  padding: 0.75rem 1.15rem;
}

.shortcut-grid {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.3rem 0.65rem;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.42rem 0;
  border-radius: 7px;
  font-size: 0.9rem;
  color: var(--fg-secondary);
}

.shortcut-keys {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* The shortcut sheet is short and fixed: let it show whole (the dialog's own
   max-height still bounds it on small viewports) so the preference row is never
   hidden below an unmarked scroll fold. */
.shortcuts-dialog .cmd-body {
  max-height: none;
}

/* Opt-out for single-character shortcuts (WCAG 2.1.4). */
.shortcut-pref {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0.35rem 0 0.2rem;
  padding: 0.7rem 0.65rem 0.35rem;
  border-top: 1px solid var(--line);
}

.shortcut-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 32px;
  padding: 0.24rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line-bright);
  background: var(--surface);
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 540;
  cursor: pointer;
  transition:
    color 160ms var(--ease),
    border-color 160ms var(--ease),
    background-color 160ms var(--ease);
}

/* The leading dot carries the on/off state without relying on colour alone:
   filled when on, hollow when off. */
.shortcut-toggle::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--fg-subtle);
}

.shortcut-toggle:hover {
  color: var(--fg);
  background: var(--surface-hover);
}

.shortcut-toggle[aria-pressed="true"] {
  color: var(--fg);
  border-color: var(--cobalt);
  background: rgba(92, 196, 142, 0.14);
}

.shortcut-toggle[aria-pressed="true"]::before {
  border-color: var(--cobalt);
  background: var(--cobalt);
}

.shortcut-pref-note {
  font-size: 0.82rem;
  color: var(--fg-subtle);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  position: relative;
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding: 2.15rem 0 max(2.15rem, calc(1.5rem + env(safe-area-inset-bottom)));
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--fg-subtle);
}

/* Footer brace widget: { Internet Spacejunk } periodically collapses and reopens as a topic line.
   Resting state is pure CSS; app.js only drives transform and clip-path animations. */
.brace-widget {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 14rem;
  min-width: 0;
  min-height: 1.5em;
  line-height: 1.5;
  white-space: nowrap;
}

.brace-widget[data-lines="2"] {
  min-height: 3em;
}

.brace-widget[data-lines="3"] {
  min-height: 4.5em;
}

.brace-widget[data-lines="4"] {
  min-height: 6em;
}

.brace-glyph {
  flex: none;
  width: 0.55em;
  text-align: center;
  color: var(--cobalt);
  transform-origin: 50% 50%;
  user-select: none;
}

.brace-widget[data-busy] .brace-glyph,
.brace-widget[data-busy] .brace-word {
  will-change: transform, clip-path;
}

.brace-word {
  flex: none;
  padding: 0 0.18em;
}

.brace-b {
  position: absolute;
  left: 0.55em;
  top: 50%;
  width: max-content;
  max-width: calc(100% - 1.1em);
  white-space: normal;
  transform: translateY(-50%);
  clip-path: inset(0 50% 0 50%);
  pointer-events: none;
  user-select: none;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.85rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: var(--fg-subtle);
  text-decoration: none;
  transition: color 180ms var(--ease), background-color 180ms var(--ease);
}

.footer-nav a:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.045);
}

html[data-theme="light"] .footer-nav a:hover {
  background: rgba(10, 31, 21, 0.04);
}

.footer-nav a[href^="mailto:"]::after {
  content: "↗";
  content: "↗" / "";
  font-family: var(--font-sans);
  font-size: 0.76em;
  margin-left: 0.22em;
  color: var(--cobalt);
}

/* Deep-Link Arrival Halo & Whisper-Quiet Copy Toast (#copy-toast) */
@keyframes deep-link-halo {
  0% {
    box-shadow: var(--halo-base-shadow, var(--specular), var(--shadow-subtle)), 0 0 0 0 rgba(92, 196, 142, 0.45);
  }
  35% {
    box-shadow: var(--halo-base-shadow, var(--specular), var(--shadow-subtle)), 0 0 0 4px rgba(92, 196, 142, 0.24);
  }
  100% {
    box-shadow: var(--halo-base-shadow, var(--specular), var(--shadow-subtle)), 0 0 0 0 rgba(92, 196, 142, 0);
  }
}

.diagram-frame[data-deep-linked="true"],
.telemetry-frame[data-deep-linked="true"],
.code-group[data-deep-linked="true"],
.code-frame[data-deep-linked="true"] {
  border-color: var(--cobalt);
  animation: deep-link-halo 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: max(1.35rem, calc(0.85rem + env(safe-area-inset-bottom)));
  transform: translate(-50%, 0);
  z-index: 420;
  max-width: calc(100vw - 2rem);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.44rem 0.92rem;
  line-height: 1.25;
  border-radius: 999px;
  border: 1px solid rgba(92, 196, 142, 0.42);
  background: rgba(14, 33, 24, 0.96);
  backdrop-filter: saturate(185%) blur(20px);
  -webkit-backdrop-filter: saturate(185%) blur(20px);
  box-shadow: var(--specular), var(--shadow-elevated);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 540;
  white-space: nowrap;
  pointer-events: none;
}

html[data-theme="light"] .copy-toast {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(14, 106, 64, 0.34);
}

.copy-toast[hidden] {
  display: none !important;
}

.copy-toast-icon {
  color: var(--cobalt);
  flex-shrink: 0;
}

@media (pointer: coarse) {
  sup.sidenote-num[data-sidenote-trigger] {
    min-width: 1.5em;
    padding: 0.14em 0.42em;
    margin-block: -0.36em;
  }
  .ghost-btn {
    min-height: 44px;
    min-width: 44px;
  }
  .nav-link,
  .nav-topic-item,
  .cmd-item a,
  .footer-nav a {
    min-height: 44px;
  }
  .tag-pill,
  .cmd-close,
  .code-copy-btn,
  .cg-tab,
  .diag-ctrl-btn,
  .sim-step-btn,
  .article-back-link,
  .shortcut-toggle,
  #clear-topic-filter {
    min-height: 38px;
  }
  .diag-ctrl-btn {
    min-width: 38px;
  }
  /* Topic chips keep their compact look; the tap area grows around them. */
  .entry-tag-link {
    position: relative;
  }
  .entry-tag-link::before {
    content: "";
    position: absolute;
    inset: -6px -2px;
  }
}

@media (min-width: 760px) and (max-width: 959.98px) {
  .tl-layout.home-stream-layout {
    gap: 1.5rem;
  }
}

@media not all and (min-width: 760px) {
  .cmd-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .cmd-pane-preview {
    display: none;
  }
  /* With the preview pane hidden, a truncated title could not be read anywhere. */
  .cmd-item-label {
    white-space: normal;
  }
  .bento-grid,
  .bento-cols-3,
  .schematic-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .bento-span-2 {
    grid-column: span 1;
  }
  .tl-layout.home-stream-layout,
  .tl-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }
  .tl-chrono-rail {
    display: none;
  }
}

@media not all and (min-width: 640px) {
  .container {
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
  }
  .header-inner {
    gap: 0.45rem 0.75rem;
    padding-block: 0.35rem;
  }
  .primary-nav {
    flex-wrap: wrap;
  }
  .nav-link {
    padding: 0.32rem 0.62rem;
    font-size: 0.875rem;
  }
  .header-controls {
    margin-left: 0.1rem;
    padding-left: 0.4rem;
  }
  /* With a Topics menu (two or more topics) the header still holds one 68px row, as
     one compact toolbar. The trigger becomes an icon button like search and theme, the
     nav and control groups close up without the group divider (the 36/44px boxes
     already space the glyphs evenly, and a divider would crowd About's selected pill),
     About tightens to 0.5rem, and the control group bleeds past the container edge by
     the theme glyph's inset, so the glyph, not its box, lines up with the content
     edge. The cluster then takes 157.5px (fine pointer) or 177.5px (coarse) beside the
     wordmark: inside the 100vw - 226px the wordmark clamp above already leaves, and
     5.5px spare at 320px beside the stacked wordmark. */
  .header-has-topics {
    column-gap: 0.375rem;
  }
  .header-has-topics .nav-cluster {
    position: relative;
    gap: 0;
  }
  .header-has-topics .primary-nav {
    gap: 0;
  }
  .header-has-topics a.nav-link {
    padding-inline: 0.5rem;
  }
  .header-has-topics .header-controls {
    gap: 0;
    margin-left: 0;
    padding-left: 0;
    margin-right: -0.625rem;
    border-left: 0;
  }
  /* The trigger as a header icon button: ghost-button box, glyph, hover and open
     treatment. On a topic page it keeps the selected tint and accent border. */
  summary.nav-topics-trigger {
    justify-content: center;
    min-width: 36px;
    padding: 0.28rem 0.55rem;
    border-radius: 8px;
  }
  .nav-topics-label,
  .nav-topics-chevron {
    display: none;
  }
  .nav-topics-glyph {
    display: block;
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.65;
    fill: none;
  }
  .nav-topics > summary.nav-topics-trigger:hover,
  .nav-topics[open] > summary.nav-topics-trigger,
  html[data-theme="light"] .nav-topics[open] > summary.nav-topics-trigger {
    color: var(--fg);
    border-color: var(--line-bright);
    background: var(--surface);
  }
  .nav-topics[data-has-active="true"] > summary.nav-topics-trigger {
    border-color: var(--cobalt);
    background: rgba(92, 196, 142, 0.13);
  }
  html[data-theme="light"] .nav-topics[data-has-active="true"] > summary.nav-topics-trigger {
    border-color: var(--cobalt);
    background: rgba(14, 106, 64, 0.09);
  }
  /* The menu keeps its desktop surface, items and motion, and right-aligns to the
     header controls: with .nav-topics static, .nav-cluster (right edge = content edge)
     is its containing block, so it opens 0.5rem below the trigger row, and it never
     grows past the viewport inside the container padding and safe-area insets. */
  .nav-topics {
    position: static;
  }
  .nav-topics-menu {
    max-width: calc(100vw - max(1.25rem, env(safe-area-inset-left)) - max(1.25rem, env(safe-area-inset-right)));
  }
  #open-shortcuts,
  .keycap,
  .cmd-footer {
    display: none;
  }
  .shortcut-keys .keycap {
    display: inline-block;
  }
  .hero {
    padding: 3.5rem 0 2.5rem;
  }
  .page-header {
    padding: 2.5rem 0 1.5rem;
  }
  .article-pager {
    grid-template-columns: minmax(0, 1fr);
  }
  .pager-older {
    grid-column: 1;
    text-align: left;
    align-items: flex-start;
  }
  .pager-spacer {
    display: none;
  }
  .cmd-dialog {
    width: calc(100vw - 1.5rem);
    margin: max(0.75rem, env(safe-area-inset-top)) auto auto;
  }
  .cmd-dialog[open] {
    max-height: calc(100dvh - 1.5rem);
  }
  .cmd-dialog.focus-dialog {
    width: calc(100vw - 1rem);
    margin: auto;
    max-height: calc(100dvh - 1rem);
  }
  .cmd-dialog.focus-dialog[open] {
    max-height: calc(100dvh - 1rem);
  }
  .focus-dialog-stage .diagram-bar,
  .focus-dialog-stage .telemetry-head {
    padding: 0.62rem 0.85rem;
  }
  .focus-dialog-stage .diagram-stage,
  .focus-dialog-stage .telemetry-stage {
    padding: 0.75rem 0.65rem;
  }
  .focus-dialog-stage .diagram-inspector,
  .focus-dialog-stage .diagram-legend {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
  .focus-dialog-stage .sim-rail {
    padding: 0.85rem 0.95rem;
    gap: 0.5rem;
  }
  .focus-dialog-stage .sim-step-btn {
    min-height: 42px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
  .focus-dialog-stage .sim-console {
    padding: 0.8rem 0.95rem 1rem;
  }
  .doc-toc-link {
    padding: 0.45rem 0.65rem;
  }
  html[data-js] .doc-toc[data-rail-ready="true"] .doc-toc-link {
    padding: 0.45rem 0.55rem;
  }
}

/* Touch screens below 640px: the Topics icon button takes the 44px box of its
   neighbours, and the control group bleeds by that box's larger glyph inset. */
@media (pointer: coarse) and (max-width: 639.98px) {
  summary.nav-topics-trigger {
    min-width: 44px;
  }
  .header-has-topics .header-controls {
    margin-right: -0.875rem;
  }
}

@media not all and (min-width: 560px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }
  .brace-widget {
    flex: 0 0 auto;
    width: 100%;
  }
  .footer-nav a {
    padding-left: 0;
  }
}

@media not all and (min-width: 480px) {
  .diagram-bar {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
  }
  .diagram-controls {
    justify-self: start;
  }
}

@media (max-height: 520px) {
  .cmd-dialog {
    margin-top: max(0.5rem, env(safe-area-inset-top));
  }
  .cmd-dialog[open] {
    max-height: calc(100dvh - 1rem);
  }
  .cmd-dialog.focus-dialog {
    margin: auto;
  }
}

/* ==========================================================================
   Forced Colours (Windows High Contrast and similar)
   Tints and shadows are dropped by the browser here, so every state that relied
   on them is redrawn with system colours.
   ========================================================================== */
@media (forced-colors: active) {
  body::before,
  body::after {
    display: none !important;
  }

  .reading-progress {
    forced-color-adjust: none;
    background: Highlight;
  }

  /* Selected / pressed / current states. A focused control is excluded so the
     keyboard focus ring is never replaced by the selection ring. */
  :is(
    .nav-link[aria-current="page"],
    .nav-topics[data-has-active="true"] summary.nav-topics-trigger,
    .nav-topic-item[aria-current="true"],
    .tag-pill[aria-pressed="true"],
    .entry-tag-link[data-active-tag="true"],
    .cg-tab[aria-selected="true"],
    .sim-step-btn[aria-pressed="true"],
    .shortcut-toggle[aria-pressed="true"],
    .doc-toc-link[aria-current="true"],
    .cmd-item a[data-active="true"],
    .cmd-item-btn[data-active="true"]
  ):not(:focus-visible) {
    outline: 2px solid Highlight;
    outline-offset: -3px;
  }

  /* While focused, the same controls keep the focus ring; a heavier ring marks the
     selected state so toggling with the keyboard is still visible. */
  :is(
    .nav-link[aria-current="page"],
    .nav-topic-item[aria-current="true"],
    .tag-pill[aria-pressed="true"],
    .entry-tag-link[data-active-tag="true"],
    .cg-tab[aria-selected="true"],
    .sim-step-btn[aria-pressed="true"],
    .shortcut-toggle[aria-pressed="true"]
  ):focus-visible {
    outline-width: 4px;
  }

  /* The on/off dot loses its accent fill here; system colours keep filled vs hollow. */
  .shortcut-toggle[aria-pressed="true"]::before {
    background: ButtonText;
    border-color: ButtonText;
  }

  /* The palette and search inputs suppress default outlines; restore a visible one. */
  .cmd-input:focus,
  .cmd-input:focus-visible,
  .search-input:focus,
  .search-input:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }

  /* Code lines carry a transparent gutter border that would otherwise show on
     every line; only marked lines keep a visible bar. */
  .code-line {
    border-left-color: Canvas;
  }

  .code-line-focus,
  .code-line-add,
  .code-line-del {
    border-left-color: Highlight;
  }

  /* SVG label text follows the system text colour, so the shapes behind it must
     follow the system background rather than the site theme. */
  .diag-node-box,
  .diag-edge-pill {
    fill: Canvas !important;
    stroke: CanvasText !important;
    filter: none !important;
  }

  .diagram-frame .diag-node[data-node-active="true"] .diag-node-box {
    stroke: Highlight !important;
  }

  .diagram-frame .diag-node:focus-visible .diag-node-box {
    stroke: Highlight !important;
    stroke-width: 3 !important;
  }

  /* Remaining figure linework follows the system text colour too, so a stored theme
     that is the opposite of the system palette cannot make it vanish. */
  .diag-edge,
  .diag-lifeline,
  .telem-line-secondary,
  .swarm-whisker,
  .swarm-median,
  .tl-axis-spine,
  .tl-axis-cap,
  .tl-axis-tick,
  .tl-stop-leader,
  .tl-stop-dot {
    stroke: CanvasText !important;
  }

  .diag-arrow-head {
    fill: CanvasText !important;
  }

  .diag-edge-group[data-edge-active="true"] .diag-edge {
    stroke: Highlight !important;
  }

  .diag-arrow-head-active,
  .doc-toc-rail-thumb {
    fill: Highlight !important;
  }

  .tl-active-puck {
    fill: Highlight !important;
    stroke: Canvas !important;
  }

  .tl-nav-stop[data-active="true"] .tl-stop-dot {
    fill: Highlight !important;
    stroke: Highlight !important;
  }

  .tl-nav-stop:focus-visible .tl-stop-hit {
    stroke: Highlight !important;
  }
}

/* ==========================================================================
   Print / PDF Editorial Stylesheet
   ========================================================================== */
@media print {
  @page {
    margin: 18mm 16mm;
  }

  body::before,
  body::after {
    display: none !important;
  }
  :root,
  html[data-theme="dark"],
  html[data-theme="light"] {
    --bg: #FFFFFF;
    --fg: #0A1410;
    --fg-secondary: #1E2B25;
    --fg-subtle: #4A5A52;
    --line: #D2D8D4;
    --line-bright: #9EA8A2;
    --surface: #F8FAF9;
    --surface-solid: #F8FAF9;
    --cobalt: #0B4A2E;
    --cobalt-deep: #0B4A2E;
    /* Screen elevation has no meaning on paper. */
    --specular: 0 0 0 transparent;
    --shadow-subtle: 0 0 0 transparent;
    --shadow-hover: 0 0 0 transparent;
    --shadow-elevated: 0 0 0 transparent;
    color-scheme: light;
  }

  /* An external link's destination is spelled out, since paper cannot be clicked. */
  .prose a[href^="http"]:not(.heading-anchor):not(:has(> img:only-child))::after {
    content: " (" attr(href) ")" !important;
    display: inline !important;
    margin-left: 0 !important;
    font-size: 0.8em !important;
    color: #4A5A52 !important;
    overflow-wrap: anywhere;
  }

  .prose img {
    box-shadow: none !important;
  }

  /* Syntax tokens use literal dark-theme colours; force legible ink on paper. */
  .tok-fn,
  .tok-str,
  .tok-type,
  .tok-op {
    color: #0A1410 !important;
  }

  .tok-cm {
    color: #4A5A52 !important;
  }

  .tok-kw,
  .tok-num {
    color: #0B4A2E !important;
  }

  body {
    background: #FFFFFF !important;
    color: #0A1410 !important;
    font-size: 11pt;
    line-height: 1.6;
  }

  .horizon-track,
  .theme-prism-ring,
  .reading-progress,
  .site-header,
  .cmd-dialog,
  .code-copy-btn,
  .doc-toc,
  .doc-toc-rail-svg,
  .doc-toc-pct,
  .link-peek-card,
  .copy-toast,
  .footer-nav,
  .heading-anchor {
    display: none !important;
  }

  sup.sidenote-num[data-sidenote-trigger] {
    background: transparent !important;
    border-color: transparent !important;
    padding: 0 0.15em !important;
  }

  .container,
  .prose-shell {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .doc-grid {
    display: block !important;
    margin: 0 !important;
  }

  .sidenote {
    float: none !important;
    display: block !important;
    width: auto !important;
    margin: 0.4rem 0 0.6rem !important;
    padding: 0.35rem 0.65rem !important;
    border-left: 2px solid #9EA8A2 !important;
    background: #F8FAF9 !important;
  }

  .code-frame,
  .diagram-frame,
  .telemetry-frame,
  .bento-card,
  .schematic-plate,
  .tl-card,
  table,
  blockquote,
  .empty-frame {
    break-inside: avoid;
  }

  .diagram-controls,
  .focus-expand-btn,
  [data-telem-reset],
  .focus-slot-spacer,
  .sim-next-btn,
  .sim-rail,
  .sim-console,
  .cg-tablist,
  .tl-toolbar,
  .tl-chrono-rail,
  .bento-spotlight-svg,
  .active-topic-drawer,
  .active-topic-bar,
  .stream-read-cue,
  .stream-card-footer,
  .article-pager,
  .article-back-link {
    display: none !important;
  }

  /* Paper shows everything: every code tab (labelled), every timeline entry
     regardless of the active filter, and every simulation stage. */
  .cg-panels,
  .cg-panels[data-resizing="true"] {
    overflow: visible !important;
  }

  .cg-panel,
  .cg-panel[hidden],
  .cg-panel[data-cg-inactive] {
    display: block !important;
  }

  .cg-panel::before {
    content: attr(data-cg-label);
    display: block;
    padding: 0.5rem 1.15rem 0;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 560;
    color: #4A5A52;
  }

  /* The rail is hidden in print: release its grid track so entries use the full width. */
  .tl-layout {
    display: block !important;
  }

  .stream-article,
  .stream-article[hidden],
  .stream-article[data-filter-state="collapsing"],
  .stream-article[data-filter-state="collapsed"] {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    margin-bottom: 1.85rem !important;
  }

  .tl-list:not(.home-article-list) > .tl-item,
  .tl-item[hidden],
  .tl-list:not(.home-article-list) > .tl-item[data-filter-state="collapsing"],
  .tl-list:not(.home-article-list) > .tl-item[data-filter-state="collapsed"] {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    margin-bottom: 1.15rem !important;
  }

  .stream-article:last-child,
  .tl-list:not(.home-article-list) > .tl-item:last-child {
    margin-bottom: 0 !important;
  }

  .stream-article-clip,
  .tl-item-clip {
    overflow: visible !important;
  }

  .stream-peek {
    max-height: none !important;
    margin-inline: 0 !important;
    padding-inline: 0 !important;
    mask-image: none !important;
    -webkit-mask-image: none !important;
    overflow: visible !important;
    pointer-events: auto !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
  }

  /* Long code lines wrap on paper instead of being clipped by the scroll container. */
  pre {
    white-space: pre-wrap !important;
    overflow: visible !important;
  }

  .code-pre-lines code {
    min-width: 0 !important;
  }

  .sim-static-list {
    display: block !important;
  }

  .diagram-svg {
    max-width: 100% !important;
    height: auto !important;
  }

  /* SVG widgets use literal dark-theme colours; force paper-legible ink for both themes. */
  .diag-node-box,
  .diag-node[data-node-active="true"] .diag-node-box {
    fill: #FFFFFF !important;
    stroke: #6A766F !important;
    filter: none !important;
  }

  .diag-tone-cobalt .diag-node-box {
    fill: #EEF5F1 !important;
    stroke: #0B4A2E !important;
  }

  .diag-edge,
  .diag-lifeline,
  .iso-stroke-muted,
  .telem-line-secondary {
    stroke: #4A5A52 !important;
  }

  .diag-zone-rect,
  .swarm-iqr {
    stroke: #0B4A2E !important;
  }

  .diag-arrow-head {
    fill: #4A5A52 !important;
  }

  .diag-grid-dot {
    fill: #E4E9E6 !important;
  }

  .swarm-dot {
    fill: #0B4A2E !important;
  }

  .diagram-frame[data-has-active="true"] .diag-node,
  .diagram-frame[data-has-active="true"] .diag-edge-group {
    opacity: 1 !important;
  }

  .diagram-inspector,
  .bento-visual {
    background: #F8FAF9 !important;
  }

  h1,
  h2,
  h3 {
    break-after: avoid;
  }
}
