/* =====================================================================
   OpenSearch ISM & CCR — site styles
   Light, elegant, professional theme inspired by hot→warm→cold tiers.
   ===================================================================== */

/* --------------------------------------------------------- design tokens */
:root {
  --c-bg: #f5f9fb;
  --c-surface: #ffffff;
  --c-surface-2: #eef4f7;
  --c-text: #14313a;
  --c-heading: #0c2b33;
  --c-muted: #506b76;
  --c-primary: #0e7c98;
  --c-primary-dark: #0a5d73;
  --c-primary-light: #e4f2f6;
  --c-hot: #e8482e;
  --c-warm: #ef9f24;
  --c-cold: #3a93c9;
  --c-link: #0c6e88;
  --c-link-hover: #08495b;
  --c-border: #d6e3e9;
  --c-border-strong: #b9ccd4;
  --c-code-bg: #f3f8fa;
  --c-code-border: #e0ebf0;
  --c-inline-code: #0a5d73;
  --c-inline-code-bg: rgba(14, 124, 152, 0.09);

  --grad-tiers: linear-gradient(90deg, var(--c-hot), var(--c-warm), var(--c-cold));
  --grad-primary: linear-gradient(120deg, var(--c-primary), var(--c-primary-dark));

  --header-h: 64px;
  --maxw: 1180px;
  --maxw-wide: 1340px;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(12, 43, 51, 0.06), 0 2px 8px rgba(12, 43, 51, 0.05);
  --shadow-md: 0 6px 22px rgba(12, 43, 51, 0.1);
  --font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 1600px) {
  :root { --maxw: var(--maxw-wide); }
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--c-link); text-decoration: none; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--c-primary-dark);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--c-cold);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--c-border);
}
.site-header::after {
  content: "";
  display: block;
  height: 3px;
  background: var(--grad-tiers);
  opacity: 0.9;
}
.site-header__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--c-heading);
}
.brand__logo { width: 40px; height: 40px; transition: transform 0.4s var(--ease); }
.brand:hover .brand__logo { transform: rotate(-8deg) scale(1.06); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__title { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand__sub { font-size: 0.72rem; color: var(--c-muted); font-weight: 600; }

.site-nav__list {
  display: flex;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  color: var(--c-muted);
  transition: color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}
.site-nav__link .nav-icon { width: 20px; height: 20px; }
.site-nav__link:hover { color: var(--c-primary-dark); background: var(--c-primary-light); transform: translateY(-1px); }
.site-nav__link.is-active { color: #fff; background: var(--grad-primary); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ main */
.site-main {
  flex: 1 0 auto;
  width: 100%;
}
.site-main.is-home { padding-bottom: 3rem; }

/* ------------------------------------------------------------ containers */
.content-shell,
.hero,
.home-about,
.home-sections {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2rem);
}

/* ------------------------------------------------------------------ hero */
.hero { text-align: center; padding-top: clamp(2rem, 5vw, 4rem); }
.hero__logo-row { display: flex; justify-content: center; }
.hero__logo {
  width: clamp(120px, 18vw, 168px);
  height: auto;
  filter: drop-shadow(0 10px 22px rgba(10, 93, 115, 0.25));
  transition: transform 0.5s var(--ease);
}
.hero__logo:hover { transform: translateY(-4px) scale(1.03); }
.hero__title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  margin: 1.4rem auto 0.6rem;
  font-weight: 850;
  letter-spacing: -0.02em;
  color: var(--c-heading);
  max-width: 18ch;
}
.grad-hot { background: linear-gradient(90deg, var(--c-hot), var(--c-warm)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.grad-cold { background: linear-gradient(90deg, var(--c-cold), var(--c-primary)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__lede {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--c-muted);
  max-width: 60ch;
  margin: 0 auto 2rem;
}

.hero__cta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
  max-width: 820px;
  margin: 0 auto;
}
.cta-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
  padding: 1.1rem 1.25rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.cta-btn:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--c-border-strong); }
.cta-btn__icon {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 14px;
  color: #fff;
}
.cta-btn__icon svg { width: 28px; height: 28px; }
.cta-btn--1 .cta-btn__icon { background: linear-gradient(135deg, var(--c-hot), var(--c-warm)); }
.cta-btn--2 .cta-btn__icon { background: linear-gradient(135deg, var(--c-cold), var(--c-primary)); }
.cta-btn__text { display: flex; flex-direction: column; }
.cta-btn__title { font-weight: 750; color: var(--c-heading); font-size: 1.02rem; }
.cta-btn__hint { color: var(--c-muted); font-size: 0.9rem; font-weight: 600; }

/* -------------------------------------------------------- home sections */
.home-about { margin-top: 3.5rem; }
.home-about h2, .home-sections h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--c-heading);
  position: relative;
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}
.home-about h2::after, .home-sections h2::after {
  content: ""; display: block; width: 64px; height: 4px; border-radius: 2px;
  background: var(--grad-tiers); margin-top: 0.5rem;
}
.home-about p { color: var(--c-text); }
.home-sections { margin-top: 3rem; }
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.section-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.section-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.section-card__title { margin: 0 0 0.5rem; font-size: 1.25rem; }
.section-card__title a { color: var(--c-heading); }
.section-card__title a:hover { color: var(--c-primary); }
.section-card__sum { color: var(--c-muted); margin: 0 0 1rem; font-size: 0.98rem; }
.section-card__links { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.section-card__links a {
  display: inline-block;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), padding-left 0.2s var(--ease);
}
.section-card__links a:hover { color: var(--c-link-hover); border-bottom-color: currentColor; padding-left: 4px; }

/* --------------------------------------------------------- content shell */
.content-shell {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

/* ----------------------------------------------------------- breadcrumbs */
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.55rem;
  padding: 0;
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--c-muted);
}
.breadcrumbs li { display: inline-flex; align-items: center; gap: 0.55rem; }
.breadcrumbs li + li::before { content: "/"; color: var(--c-border-strong); }
.breadcrumbs a { color: var(--c-muted); font-weight: 600; }
.breadcrumbs a:hover { color: var(--c-primary); }
.breadcrumbs [aria-current="page"] span { color: var(--c-heading); font-weight: 700; }

/* ---------------------------------------------------------------- prose */
.prose { color: var(--c-text); }
.prose > * { scroll-margin-top: calc(var(--header-h) + 1rem); }

.prose h1, .page-title {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  line-height: 1.15;
  font-weight: 850;
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
  background: linear-gradient(120deg, var(--c-primary-dark), var(--c-cold) 55%, var(--c-hot));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.prose h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  color: var(--c-heading);
  margin: 2.4rem 0 0.9rem;
  padding-left: 0.85rem;
  border-left: 5px solid transparent;
  border-image: var(--grad-tiers) 1;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.prose h3 {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  color: var(--c-primary-dark);
  margin: 1.8rem 0 0.6rem;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.prose h4 { font-size: 1.1rem; color: var(--c-heading); margin: 1.4rem 0 0.5rem; scroll-margin-top: calc(var(--header-h) + 1rem); }
.prose p { margin: 0 0 1.1rem; }
.prose strong { color: var(--c-heading); font-weight: 700; }

.heading-anchor {
  margin-left: 0.4rem;
  color: var(--c-border-strong);
  opacity: 0;
  text-decoration: none;
  transition: opacity 0.2s var(--ease), color 0.2s var(--ease);
}
.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose h4:hover .heading-anchor { opacity: 1; }
.heading-anchor:hover { color: var(--c-primary); }

/* prose links */
.prose a:not(.related__card):not(.toc-tree__link):not(.toc-tree__sublink) {
  color: var(--c-link);
  font-weight: 600;
  border-bottom: 1px solid rgba(12, 110, 136, 0.35);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.prose a:not(.related__card):hover {
  color: var(--c-link-hover);
  border-bottom-color: var(--c-link-hover);
  background: rgba(12, 110, 136, 0.07);
}

.page-intro { font-size: 1.15rem; color: var(--c-muted); max-width: 78ch; }

/* lists */
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1.2rem; }
.prose li { margin: 0.35rem 0; }
.prose li::marker { color: var(--c-primary); }

/* blockquote */
.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.6rem 1.2rem;
  border-left: 4px solid var(--c-cold);
  background: var(--c-primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--c-heading);
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* horizontal rule */
.prose hr { border: none; height: 2px; background: var(--c-border); margin: 2.5rem 0; }

/* ----------------------------------------------------------- inline code */
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--c-inline-code-bg);
  color: var(--c-inline-code);
  padding: 0.12em 0.4em;
  border-radius: 5px;
  border: none;
  word-break: break-word;
}

/* ------------------------------------------------------------ code blocks */
.code-block {
  margin: 1.5rem 0;
  border: 1px solid var(--c-code-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--c-code-bg);
}
.code-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem 0.4rem 1rem;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-code-border);
}
.code-block__lang {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-muted);
}
.code-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--c-primary-dark);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.code-copy::before {
  content: "";
  width: 13px; height: 13px;
  background: currentColor;
  -webkit-mask: var(--copy-icon) center / contain no-repeat;
  mask: var(--copy-icon) center / contain no-repeat;
  --copy-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="9" y="9" width="11" height="11" rx="2" fill="none" stroke="black" stroke-width="2"/><path d="M5 15V5a2 2 0 0 1 2-2h8" fill="none" stroke="black" stroke-width="2"/></svg>');
}
.code-copy:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.code-copy.is-copied { background: #1f9d57; color: #fff; border-color: #1f9d57; }
.code-copy.is-error { background: var(--c-hot); color: #fff; border-color: var(--c-hot); }
.code-block__pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: var(--c-code-bg);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.6;
  tab-size: 2;
}
.code-block__pre code { font-family: inherit; background: none; padding: 0; color: #1f3d47; white-space: pre; }

/* PrismJS — light token palette tuned to the site scheme */
.token.comment, .token.prolog, .token.cdata { color: #6a8a93; font-style: italic; }
.token.punctuation { color: #5b7884; }
.token.property, .token.tag, .token.constant, .token.symbol, .token.deleted { color: #1a6fb0; }
.token.boolean, .token.number { color: #b25000; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #0a7d4d; }
.token.operator, .token.entity, .token.url, .token.variable { color: #b5285d; }
.token.atrule, .token.attr-value, .token.keyword { color: #b5285d; }
.token.function, .token.class-name { color: #0c6e88; }
.token.regex, .token.important { color: #b25000; }
.token.important, .token.bold { font-weight: 700; }
.token.italic { font-style: italic; }

/* ----------------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}
.table-wrap table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 0.95rem; }
.table-wrap th, .table-wrap td { padding: 0.7rem 1rem; text-align: left; border-bottom: 1px solid var(--c-border); vertical-align: top; }
.table-wrap thead th { background: var(--c-primary-dark); color: #fff; font-weight: 650; white-space: nowrap; }
.table-wrap tbody tr:nth-child(even) { background: var(--c-surface-2); }
.table-wrap tbody tr:hover { background: var(--c-primary-light); }
.table-wrap code { white-space: nowrap; }

/* ----------------------------------------------------- task-list checkboxes */
.prose ul.contains-task-list { list-style: none; padding-left: 0.25rem; }
.prose ul.contains-task-list .contains-task-list { padding-left: 1.5rem; }
.task-list-item { display: flex; align-items: flex-start; gap: 0.65rem; margin: 0.5rem 0; }
.task-list-item::marker { content: ""; }
.task-list-item-checkbox {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 1.2em; height: 1.2em;
  margin-top: 0.18em;
  border: 2px solid var(--c-border-strong);
  border-radius: 5px;
  background: var(--c-surface);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.task-list-item-checkbox::before {
  content: "";
  width: 0.65em; height: 0.65em;
  transform: scale(0);
  transform-origin: center;
  background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transition: transform 0.16s var(--ease);
}
.task-list-item-checkbox:checked { background: var(--c-primary); border-color: var(--c-primary); }
.task-list-item-checkbox:checked::before { transform: scale(1); }
.task-list-item-checkbox:hover { border-color: var(--c-primary); }
.task-list-item label { cursor: pointer; }
.task-list-item.is-checked > label,
.task-list-item:has(> input:checked) > label,
.task-list-item:has(> .task-list-item-checkbox:checked) { text-decoration: line-through; color: var(--c-muted); }

/* --------------------------------------------------------------- accordion */
.accordion { margin: 1.5rem 0; display: grid; gap: 0.75rem; }
.accordion__item {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.accordion__q {
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1.1rem;
  font-weight: 700;
  color: var(--c-heading);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: background 0.2s var(--ease);
}
.accordion__q::-webkit-details-marker { display: none; }
.accordion__q::before {
  content: "";
  width: 12px; height: 12px;
  border-right: 2px solid var(--c-primary);
  border-bottom: 2px solid var(--c-primary);
  transform: rotate(-45deg);
  transition: transform 0.2s var(--ease);
}
.accordion__item[open] .accordion__q::before { transform: rotate(45deg); }
.accordion__q:hover { background: var(--c-primary-light); }
.accordion__a { padding: 0 1.1rem 1rem; }
.accordion__a > *:first-child { margin-top: 0; }

/* ------------------------------------------------------------- mermaid / math */
pre.mermaid {
  position: relative;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
  text-align: center;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
pre.mermaid.viz { cursor: zoom-in; transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease); }
pre.mermaid.viz:hover { box-shadow: var(--shadow-md); border-color: var(--c-cold); }
pre.mermaid svg { max-width: 100%; height: auto; }

/* Expand affordance on diagrams */
.viz-expand {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--c-primary-dark);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--c-border);
  border-radius: 9px;
  cursor: zoom-in;
  opacity: 0;
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.viz-expand svg { width: 18px; height: 18px; }
.viz:hover .viz-expand,
.viz-expand:focus-visible { opacity: 1; }
.viz-expand:hover { background: var(--c-primary); color: #fff; transform: scale(1.06); }
@media (hover: none) { .viz-expand { opacity: 1; } }

/* Fullscreen diagram viewer */
body.viz-open { overflow: hidden; }
.viz-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 2.5rem);
  background: rgba(12, 43, 51, 0.82);
  backdrop-filter: blur(4px);
  animation: viz-fade 0.18s var(--ease);
}
.viz-modal[hidden] { display: none; }
.viz-modal__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(96vw, 1500px);
  height: min(92vh, 1100px);
  padding: 1.25rem;
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  animation: viz-pop 0.2s var(--ease);
}
.viz-modal__canvas {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  min-height: 0;
}
.viz-modal__canvas svg { width: 100%; height: 100%; max-width: 100%; max-height: 100%; }
.viz-modal__hint {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--c-muted);
}
.viz-close {
  position: absolute;
  top: -0.6rem;
  right: -0.6rem;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  line-height: 1;
  color: #fff;
  background: var(--c-primary-dark);
  border: 2px solid #fff;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.viz-close:hover { background: var(--c-hot); transform: scale(1.08); }
@keyframes viz-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes viz-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .viz-modal, .viz-modal__dialog { animation: none; }
}
.math-block { overflow-x: auto; margin: 1.5rem 0; padding: 0.5rem 0; }
.katex-error { color: var(--c-hot); }

/* -------------------------------------------------------- related content */
.related { margin-top: 3rem; display: grid; gap: 2rem; }
.related__title {
  font-size: 1.25rem;
  color: var(--c-heading);
  margin: 0 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--c-border);
}
.related__list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.related__card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  padding: 1rem 1.1rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.related__card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--c-cold); }
.related__card-title { font-weight: 700; color: var(--c-primary-dark); }
.related__card-sum { font-size: 0.88rem; color: var(--c-muted); }

/* ------------------------------------------------------ content landing toc */
.toc-section { margin: 2.2rem 0; }
.toc-section__title { font-size: 1.5rem; margin: 0 0 0.4rem; }
.toc-section__title a { color: var(--c-heading); }
.toc-section__title a:hover { color: var(--c-primary); }
.toc-section__sum { color: var(--c-muted); margin: 0 0 0.9rem; max-width: 80ch; }
.toc-tree { list-style: none; padding-left: 0; margin: 0; }
.toc-tree > li { padding: 0.35rem 0; border-bottom: 1px dashed var(--c-border); }
.toc-tree__link { font-weight: 650; color: var(--c-link); }
.toc-tree__link:hover { color: var(--c-link-hover); }
.toc-tree ul { list-style: none; padding-left: 1.25rem; margin: 0.35rem 0 0; }
.toc-tree__sublink { color: var(--c-muted); font-size: 0.95rem; }
.toc-tree__sublink:hover { color: var(--c-primary); }

/* ---------------------------------------------------------------- footer */
.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  background: var(--c-heading);
  color: #cfe0e6;
}
.site-footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem clamp(1rem, 3vw, 2rem);
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) 2fr;
  gap: 2rem;
}
.site-footer__brand { display: flex; flex-direction: column; gap: 0.8rem; }
.site-footer__logo { width: 44px; height: 44px; }
.site-footer__tagline { color: #9fbcc6; font-size: 0.95rem; margin: 0; max-width: 42ch; }
.site-footer__nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.5rem;
}
.footer-col__title { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; color: #fff; margin: 0 0 0.6rem; }
.footer-col__title a { color: #fff; }
.footer-col__title a:hover { color: var(--c-warm); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.footer-col a { color: #aecdd6; font-size: 0.92rem; transition: color 0.2s var(--ease), padding-left 0.2s var(--ease); }
.footer-col a:hover { color: #fff; padding-left: 3px; }
.site-footer__bar {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  color: #8fb0ba;
}
.site-footer__bar p { margin: 0; }

/* ---------------------------------------------------------------- mobile */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .brand__sub { display: none; }
  .site-nav__link span:not(.nav-icon) { font-size: 0.9rem; }
  .site-footer__inner { grid-template-columns: 1fr; }
  .hero__cta { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .site-nav__link { padding: 0.5rem 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
