/* =================================================================
   Automated Spatial Reporting & Document Generation
   Global stylesheet — light, professional, cartographic palette.
   ================================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* surfaces & text */
  --c-bg: #f6faf9;
  --c-bg-tint: #eef6f4;
  --c-surface: #ffffff;
  --c-surface-2: #f1f7f5;
  --c-text: #19303a;
  --c-muted: #51666c;
  --c-border: #d8e6e2;
  --c-border-strong: #c2d8d2;

  /* brand + accents */
  --c-primary: #0f766e;
  --c-primary-strong: #0b5d56;
  --c-primary-soft: #d8f1ec;
  --c-blue: #0ea5e9;
  --c-indigo: #6366f1;
  --c-amber: #f59e0b;
  --c-coral: #fb7185;
  --c-link: #0e7490;
  --c-link-hover: #0b5d56;

  /* code */
  --c-code-bg: #f2f8f6;
  --c-code-border: #dcebe7;
  --c-inline-code-bg: #e7f2ef;
  --c-inline-code-text: #0b5d56;

  /* gradients */
  --grad-brand: linear-gradient(120deg, #14b8a6 0%, #0ea5e9 55%, #6366f1 100%);
  --grad-brand-text: linear-gradient(120deg, #0f766e 0%, #0e7490 50%, #4f46e5 100%);

  /* shape & motion */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(16, 49, 45, 0.06), 0 1px 3px rgba(16, 49, 45, 0.08);
  --shadow: 0 6px 20px -6px rgba(13, 79, 72, 0.18), 0 2px 6px rgba(13, 79, 72, 0.08);
  --shadow-lg: 0 24px 48px -16px rgba(13, 79, 72, 0.28);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* layout */
  --header-h: 4.25rem;
  --w-max: 1280px;
  --space: clamp(1rem, 2.5vw, 2rem);

  /* type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas,
    "Liberation Mono", monospace;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* in-page anchors clear the sticky header */
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
svg {
  display: block;
  max-width: 100%;
}
button {
  font: inherit;
  cursor: pointer;
}
:focus-visible {
  outline: 3px solid var(--c-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Layout helpers ---------- */
.container {
  width: min(var(--w-max), 92vw);
  margin-inline: auto;
}
.site-main {
  flex: 1 0 auto;
  width: 100%;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 200;
  background: var(--c-primary);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Links ---------- */
a {
  color: var(--c-link);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}
a:hover {
  color: var(--c-link-hover);
}
.prose a {
  background-image: linear-gradient(var(--c-primary), var(--c-primary));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.25s var(--ease), color 0.18s var(--ease);
}
.prose a:hover,
.prose a:focus-visible {
  background-size: 100% 2px;
  color: var(--c-link-hover);
}

/* ================================================================
   Header
   ================================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-text);
  flex: 0 0 auto;
}
.brand__mark {
  width: 2.35rem;
  height: 2.35rem;
  filter: drop-shadow(0 2px 4px rgba(13, 79, 72, 0.18));
  transition: transform 0.3s var(--ease);
}
.brand:hover .brand__mark {
  transform: rotate(-4deg) scale(1.06);
}
.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand__title {
  font-size: 1.02rem;
  background: var(--grad-brand-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand__sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--c-muted);
  letter-spacing: 0.02em;
}

.site-nav {
  margin-left: auto;
}
.site-nav__list {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
}
.site-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: var(--c-muted);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease),
    transform 0.2s var(--ease);
}
.site-nav__link .icon {
  width: 1.15rem;
  height: 1.15rem;
}
.site-nav__link:hover {
  color: var(--c-primary-strong);
  background: var(--c-primary-soft);
  transform: translateY(-1px);
}
.site-nav__link[aria-current="page"] {
  color: var(--c-primary-strong);
  background: var(--c-primary-soft);
  box-shadow: inset 0 0 0 1px var(--c-border-strong);
}

/* mobile nav */
.nav-toggle {
  display: none;
  margin-left: auto;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-primary);
  align-items: center;
  justify-content: center;
}
.nav-toggle .icon {
  width: 1.4rem;
  height: 1.4rem;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }
  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    box-shadow: var(--shadow);
    transform: translateY(-150%);
    transition: transform 0.3s var(--ease);
    margin: 0;
  }
  .site-nav.is-open {
    transform: translateY(0);
  }
  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem;
    width: min(100%, var(--w-max));
    margin-inline: auto;
  }
  .site-nav__link {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
  }
}

/* ================================================================
   Footer
   ================================================================ */
.site-footer {
  flex-shrink: 0;
  margin-top: 4rem;
  background: #0c2b2a;
  color: #cfe6e1;
}
.site-footer__inner {
  display: grid;
  gap: 2rem;
  padding: 3rem 0 2rem;
  grid-template-columns: 1.4fr repeat(3, 1fr);
}
.site-footer h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7fcabc;
  margin-bottom: 0.9rem;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.footer-brand img {
  width: 2.2rem;
  height: 2.2rem;
}
.site-footer p {
  color: #a9cfc8;
  font-size: 0.92rem;
  max-width: 38ch;
}
.site-footer ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.site-footer a {
  color: #cfe6e1;
  font-size: 0.92rem;
}
.site-footer a:hover {
  color: #fff;
}
.site-footer__bar {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1.1rem 0;
  font-size: 0.85rem;
  color: #8fb8b0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}
@media (max-width: 760px) {
  .site-footer__inner {
    grid-template-columns: 1fr 1fr;
  }
  .footer-col--brand {
    grid-column: 1 / -1;
  }
}
@media (max-width: 460px) {
  .site-footer__inner {
    grid-template-columns: 1fr;
  }
}

/* ================================================================
   Hero / Home
   ================================================================ */
.hero {
  position: relative;
  text-align: center;
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 4vw, 3rem);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% 50% auto;
  width: 120%;
  height: 120%;
  transform: translateX(-50%);
  background: radial-gradient(
      60% 50% at 50% 0%,
      rgba(14, 165, 233, 0.16),
      transparent 70%
    ),
    radial-gradient(40% 40% at 80% 10%, rgba(99, 102, 241, 0.12), transparent 70%);
  z-index: -1;
}
.hero__logo {
  width: clamp(7rem, 16vw, 11rem);
  height: auto;
  margin: 0 auto 1.5rem;
  filter: drop-shadow(0 16px 30px rgba(13, 79, 72, 0.25));
  animation: floaty 7s var(--ease) infinite;
}
@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero__logo,
  * {
    animation: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}
.hero h1 {
  font-size: clamp(2rem, 1.3rem + 3.4vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 800;
  max-width: 20ch;
  margin-inline: auto;
}
.hero h1 .grad {
  background: var(--grad-brand-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__lead {
  margin: 1.25rem auto 0;
  max-width: 65ch;
  color: var(--c-muted);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
}

/* CTA cards */
.cta-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: clamp(2rem, 4vw, 3rem);
}
.cta-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
  padding: 1.6rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--c-text);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    border-color 0.25s var(--ease);
}
.cta-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--grad-brand);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.cta-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-border-strong);
}
.cta-card:hover::after {
  opacity: 1;
}
.cta-card__icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--c-primary-soft);
}
.cta-card__icon .icon {
  width: 1.9rem;
  height: 1.9rem;
}
.cta-card[data-accent="teal"] .cta-card__icon {
  background: #d8f1ec;
}
.cta-card[data-accent="blue"] .cta-card__icon {
  background: #dcf0fb;
}
.cta-card[data-accent="amber"] .cta-card__icon {
  background: #fdf0d8;
}
.cta-card h3 {
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.cta-card p {
  color: var(--c-muted);
  font-size: 0.95rem;
}
.cta-card__more {
  margin-top: auto;
  font-weight: 600;
  color: var(--c-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.cta-card:hover .cta-card__more .icon {
  transform: translateX(3px);
}
.cta-card__more .icon {
  width: 1rem;
  height: 1rem;
  transition: transform 0.25s var(--ease);
}

/* Home section blocks */
.home-section {
  padding: clamp(2.5rem, 5vw, 4rem) 0;
}
.section-head {
  max-width: none;
  margin-bottom: 2rem;
}
.section-head h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
  letter-spacing: -0.02em;
}
.section-head p {
  color: var(--c-muted);
  margin-top: 0.6rem;
}
.pillar-block {
  display: grid;
  gap: 1.5rem 2.5rem;
  grid-template-columns: minmax(0, 1fr);
  padding: 1.75rem 0;
  border-top: 1px solid var(--c-border);
}
.pillar-block__head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.pillar-block__icon {
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--c-primary-soft);
}
.pillar-block__icon .icon {
  width: 1.8rem;
  height: 1.8rem;
}
.pillar-block h3 {
  font-size: 1.35rem;
}
.pillar-block h3 a {
  color: var(--c-text);
}
.pillar-block h3 a:hover {
  color: var(--c-primary);
}
.pillar-block__desc {
  color: var(--c-muted);
  margin-top: 0.4rem;
}
.subpage-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.subpage-list a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-weight: 500;
  font-size: 0.95rem;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}
.subpage-list a::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--grad-brand);
  flex: 0 0 auto;
}
.subpage-list a:hover {
  border-color: var(--c-primary);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 880px) {
  .pillar-block {
    grid-template-columns: 0.9fr 1.1fr;
    align-items: start;
  }
}

/* ================================================================
   Content page layout
   ================================================================ */
.content-wrap {
  width: min(var(--w-max), 92vw);
  margin-inline: auto;
  padding: 1.5rem 0 2rem;
}
.content-layout {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1080px) {
  .content-layout {
    grid-template-columns: minmax(0, 1fr) 17rem;
  }
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--c-muted);
  margin-bottom: 1.25rem;
}
.breadcrumbs ol {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.breadcrumbs li:not(:last-child)::after {
  content: "/";
  color: var(--c-border-strong);
}
.breadcrumbs a {
  color: var(--c-muted);
}
.breadcrumbs a:hover {
  color: var(--c-primary);
}
.breadcrumbs [aria-current="page"] {
  color: var(--c-primary-strong);
  font-weight: 600;
}

/* ---------- Prose / article typography ---------- */
.prose {
  /* fill the container width, not a narrow column */
  max-width: none;
}
.prose > * + * {
  margin-top: 1.1rem;
}
.prose h1 {
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 800;
  background: var(--grad-brand-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.4rem;
}
.prose h2 {
  font-size: clamp(1.45rem, 1.2rem + 1vw, 1.85rem);
  letter-spacing: -0.015em;
  margin-top: 2.4rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--c-border);
  color: var(--c-primary-strong);
}
.prose h3 {
  font-size: 1.3rem;
  margin-top: 1.8rem;
  color: var(--c-text);
}
.prose h4 {
  font-size: 1.1rem;
  margin-top: 1.4rem;
  color: var(--c-primary-strong);
}
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.prose h2 .header-anchor,
.prose h3 .header-anchor,
.prose h4 .header-anchor,
.prose h1 .header-anchor {
  color: inherit;
  text-decoration: none;
}
.prose p,
.prose li {
  color: #20393f;
}
.prose strong {
  color: var(--c-text);
  font-weight: 700;
}
.prose ul,
.prose ol {
  padding-left: 1.4rem;
  display: grid;
  gap: 0.4rem;
}
.prose li::marker {
  color: var(--c-primary);
}
.prose blockquote {
  border-left: 4px solid var(--c-primary);
  background: var(--c-surface-2);
  padding: 0.8rem 1.2rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--c-muted);
}

/* ---------- 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-text);
  padding: 0.12em 0.4em;
  border-radius: 5px;
  border: 0;
  white-space: break-spaces;
}

/* ---------- Code blocks ---------- */
.code-block {
  margin: 1.5rem 0;
  border: 1px solid var(--c-code-border);
  border-radius: var(--radius);
  background: var(--c-code-bg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.code-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.5rem 0.45rem 1rem;
  background: #e8f3f0;
  border-bottom: 1px solid var(--c-code-border);
}
.code-block__lang {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-primary-strong);
}
.code-block__copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--c-border-strong);
  background: var(--c-surface);
  color: var(--c-primary-strong);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    transform 0.18s var(--ease);
}
.code-block__copy:hover {
  background: var(--c-primary);
  color: #fff;
  transform: translateY(-1px);
}
.code-block__copy.is-copied {
  background: var(--c-primary-strong);
  color: #fff;
}
.code-block__pre {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  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;
  white-space: pre;
}

/* Prism token colours — light theme matching palette */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #7a8f8b;
  font-style: italic;
}
.token.punctuation {
  color: #5a6f74;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #b5395b;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #0a7a55;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #936a12;
}
.token.atrule,
.token.attr-value,
.token.keyword {
  color: #0e7490;
  font-weight: 600;
}
.token.function,
.token.class-name {
  color: #4f46e5;
}
.token.regex,
.token.important,
.token.variable {
  color: #c2410c;
}

/* ---------- Task-list checkboxes ---------- */
.prose ul.contains-task-list {
  list-style: none;
  padding-left: 0;
}
.prose .task-list-item {
  padding: 0;
}
.prose .task-list-item::marker {
  content: "";
}
.prose .task-list-item > label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.18s var(--ease),
    opacity 0.18s var(--ease);
}
.prose .task-list-item > label:hover {
  background: var(--c-surface-2);
}
.prose .task-list-item.is-checked > label {
  text-decoration: line-through;
  color: var(--c-muted);
  opacity: 0.8;
}
.prose .task-list-item-checkbox {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.28rem;
  border: 2px solid var(--c-border-strong);
  border-radius: 5px;
  background: var(--c-surface);
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.prose .task-list-item-checkbox::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  transform: scale(0);
  transform-origin: center;
  transition: transform 0.15s var(--ease);
  background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 40% 100%, 100% 18%, 82% 0, 38% 70%);
}
.prose .task-list-item-checkbox:checked {
  background: var(--c-primary);
  border-color: var(--c-primary);
}
.prose .task-list-item-checkbox:checked::before {
  transform: scale(1);
}

/* ---------- 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;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  min-width: 32rem;
  font-size: 0.92rem;
}
.prose thead {
  background: var(--c-primary-soft);
}
.prose th {
  text-align: left;
  font-weight: 700;
  color: var(--c-primary-strong);
  padding: 0.7rem 0.9rem;
  border-bottom: 2px solid var(--c-border-strong);
  white-space: nowrap;
}
.prose td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
.prose tbody tr:nth-child(even) {
  background: var(--c-surface-2);
}
.prose tbody tr:hover {
  background: #eaf5f2;
}

/* ---------- KaTeX ---------- */
.math-block {
  overflow-x: auto;
  padding: 0.5rem 0;
}
.katex {
  font-size: 1.05em;
}
.katex-error {
  color: var(--c-coral);
}

/* ---------- Mermaid ---------- */
.mermaid-figure {
  margin: 1.75rem 0;
  padding: 1.25rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.mermaid {
  display: flex;
  justify-content: center;
  min-height: 2rem;
}
.mermaid:not([data-processed]) {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--c-muted);
  white-space: pre;
}

/* ---------- Inline SVG / figure diagrams ---------- */
.diagram {
  margin: 1.75rem 0;
  padding: 1.25rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: center;
  overflow-x: auto;
}
.diagram svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}
.diagram figcaption {
  margin: 0.9rem auto 0;
  max-width: 62ch;
  font-size: 0.85rem;
  color: var(--c-muted);
  text-align: center;
}

/* ---------- FAQ accordions ---------- */
.faq {
  margin: 1rem 0;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-surface);
}
.faq + .faq {
  margin-top: 0.6rem;
}
.faq > summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.2rem;
  font-weight: 600;
  color: var(--c-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: background 0.18s var(--ease);
}
.faq > summary::-webkit-details-marker {
  display: none;
}
.faq > summary::after {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-right: 2px solid var(--c-primary);
  border-bottom: 2px solid var(--c-primary);
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease);
  flex: 0 0 auto;
}
.faq[open] > summary::after {
  transform: rotate(-135deg);
}
.faq > summary:hover {
  background: var(--c-surface-2);
}
.faq__body {
  padding: 0 1.2rem 1.1rem;
  color: var(--c-muted);
}

/* ---------- Related / child navigation ---------- */
.content-aside {
  align-self: start;
}
@media (min-width: 1080px) {
  .content-aside {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
  }
}
.aside-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow-sm);
}
.aside-card h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-primary-strong);
  margin-bottom: 0.8rem;
}
.aside-card ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}
.aside-card a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--c-text);
  font-size: 0.9rem;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.aside-card a:hover {
  background: var(--c-primary-soft);
  color: var(--c-primary-strong);
}
.aside-card a[aria-current="page"] {
  background: var(--c-primary-soft);
  color: var(--c-primary-strong);
  font-weight: 600;
}

/* ---------- "On this page" table of contents ---------- */
.toc-card + .aside-card {
  margin-top: 1rem;
}
.toc-card ul {
  gap: 0.1rem;
}
.toc-card a {
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--c-muted);
  font-size: 0.85rem;
  line-height: 1.35;
  padding: 0.3rem 0.55rem;
}
.toc-card a.toc-lvl-3 {
  padding-left: 1.3rem;
  font-size: 0.82rem;
}
.toc-card a:hover {
  background: var(--c-surface-2);
  color: var(--c-primary-strong);
}
.toc-card a.is-active {
  border-left-color: var(--c-primary);
  background: var(--c-primary-soft);
  color: var(--c-primary-strong);
  font-weight: 600;
}
@media (max-width: 1079px) {
  .toc-card {
    display: none;
  }
}

.related {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--c-border);
}
.related h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
.related-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.related-card {
  display: block;
  padding: 1rem 1.1rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
    border-color 0.2s var(--ease);
}
.related-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--c-primary);
}
.related-card strong {
  display: block;
  margin-bottom: 0.25rem;
}
.related-card span {
  font-size: 0.85rem;
  color: var(--c-muted);
}

/* ---------- Icons ---------- */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: 0 0 auto;
}
