/* ============================================================
   Spatial Epidemiology & Public Health GIS Automation
   Light, professional theme — self-hosted, no external assets.
   ============================================================ */

:root {
  --primary: #0e7c86;
  --primary-dark: #0a5b63;
  --primary-2: #1f6f9e;
  --indigo: #2b3f8c;
  --accent: #ef6f5c;
  --accent-dark: #d9543f;
  --accent-soft: #fff1ec;

  --bg: #f4f9fa;
  --surface: #ffffff;
  --surface-2: #ecf4f5;
  --text: #16313b;
  --text-muted: #55707b;
  --border: #d8e6e9;
  --border-strong: #c3d8dc;

  --code-bg: #f4f8f9;
  --code-border: #e1ecee;
  --inline-code-bg: #e8f2f3;
  --inline-code-text: #0a5b63;

  --ring: rgba(14, 124, 134, 0.35);
  --shadow-sm: 0 1px 2px rgba(16, 49, 59, 0.06), 0 1px 3px rgba(16, 49, 59, 0.08);
  --shadow-md: 0 6px 20px rgba(16, 49, 59, 0.08), 0 2px 6px rgba(16, 49, 59, 0.06);
  --shadow-lg: 0 18px 48px rgba(16, 49, 59, 0.14);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --header-height: 66px;
  --w-wide: 1480px;
  --w-prose: 1100px;
  --gutter: clamp(1rem, 4vw, 3rem);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1 0 auto; width: 100%; }

img, svg { max-width: 100%; }
img { height: auto; }

a { color: var(--primary); text-decoration: none; }

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

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

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--w-wide);
  margin-inline: auto;
  padding: 0 var(--gutter);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-right: auto;
  color: var(--text);
}
.brand-logo { display: block; border-radius: 10px; transition: transform 0.25s ease; }
.brand:hover .brand-logo { transform: rotate(-6deg) scale(1.05); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.primary-nav ul {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.nav-link .icon { width: 1.15em; height: 1.15em; }
.nav-link:hover { color: var(--primary-dark); background: var(--surface-2); }
.nav-link.is-active {
  color: var(--primary-dark);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 44px;
  height: 40px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle-bar {
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------------- Hero (home) ---------------- */
.hero {
  background:
    radial-gradient(900px 460px at 80% -10%, rgba(43, 179, 191, 0.16), transparent 60%),
    radial-gradient(720px 420px at 0% 0%, rgba(43, 63, 140, 0.12), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: var(--w-wide);
  margin-inline: auto;
  padding: clamp(2.5rem, 6vw, 5rem) var(--gutter) clamp(2rem, 5vw, 4rem);
  text-align: center;
}
.hero-eyebrow {
  margin: 0 0 1.25rem;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
}
.hero-logo-row { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.hero-logo {
  width: clamp(108px, 16vw, 168px);
  height: auto;
  filter: drop-shadow(0 14px 30px rgba(14, 124, 134, 0.28));
  transition: transform 0.35s ease;
}
.hero-logo:hover { transform: translateY(-4px) scale(1.03); }
.hero-title {
  margin: 0 auto 1.5rem;
  max-width: 22ch;
  font-size: clamp(2rem, 1.3rem + 3.4vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--text);
}
.hero-title .accent {
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-2) 55%, var(--indigo) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-copy { max-width: 58rem; margin: 0 auto; color: var(--text-muted); }
.hero-copy p { margin: 0 0 1rem; font-size: 1.07rem; }
@media (min-width: 1024px) {
  .hero-copy {
    max-width: 68rem;
    columns: 2;
    column-gap: 3.5rem;
    text-align: left;
  }
  .hero-copy p { break-inside: avoid; margin: 0 0 1.1rem; }
  .hero-copy p:last-child { margin-bottom: 0; }
}

.hero-cta {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
  text-align: left;
}
.cta-button {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.cta-button:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.cta-icon {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: 12px;
}
.cta-icon svg { width: 30px; height: 30px; }
.cta-text { display: flex; flex-direction: column; min-width: 0; }
.cta-label { font-weight: 800; letter-spacing: -0.01em; }
.cta-sub { font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.cta-arrow { margin-left: auto; color: var(--primary); font-weight: 700; transition: transform 0.22s ease; }
.cta-button:hover .cta-arrow { transform: translateX(4px); }

/* ---------------- Section cards (home) ---------------- */
.sections { padding: clamp(2.5rem, 5vw, 4.5rem) 0; }
.section-wrap { max-width: var(--w-wide); margin-inline: auto; padding-inline: var(--gutter); }
.block-heading {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
  letter-spacing: -0.02em;
  color: var(--text);
}
.block-intro { margin: 0 0 2rem; color: var(--text-muted); max-width: 60ch; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}
.section-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.section-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.section-card-head { display: flex; align-items: center; gap: 0.75rem; color: var(--text); }
.section-card-icon {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--indigo));
}
.section-card-icon .icon { width: 24px; height: 24px; }
.section-card-head h3 { margin: 0; font-size: 1.18rem; letter-spacing: -0.01em; line-height: 1.25; }
.section-card-head:hover h3 { color: var(--primary-dark); }
.section-card-desc { color: var(--text-muted); font-size: 0.95rem; margin: 0.9rem 0 1rem; }
.section-card-list { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; gap: 0.25rem; }
.section-card-list a {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  transition: background 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
}
.section-card-list a:hover { background: var(--surface-2); color: var(--primary-dark); padding-left: 0.85rem; }
.section-card-cta { margin-top: auto; font-weight: 700; color: var(--primary); }
.section-card-cta:hover { color: var(--accent-dark); }

/* ---------------- Content layout ---------------- */
.breadcrumbs {
  max-width: var(--w-wide);
  margin: 0 auto;
  padding: 1.1rem var(--gutter) 0;
}
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.breadcrumbs li { display: flex; align-items: center; gap: 0.4rem; }
.breadcrumbs li + li::before { content: "/"; color: var(--border-strong); }
.breadcrumbs a { color: var(--text-muted); font-weight: 600; }
.breadcrumbs a:hover { color: var(--primary-dark); }
.breadcrumbs [aria-current="page"] { color: var(--text); font-weight: 700; }

.content-grid {
  max-width: var(--w-wide);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 3.5rem;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 3.25rem);
  align-items: start;
}

.section-nav {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--header-height) - 2rem);
  overflow: auto;
}
.section-nav-eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
}
.section-nav-root {
  display: block;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.section-nav-root:hover, .section-nav a:hover { color: var(--primary-dark); }
.section-nav-list, .section-nav-list ul { list-style: none; margin: 0; padding: 0; }
.section-nav-list > li { margin-bottom: 0.35rem; }
.section-nav-list a {
  display: block;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.18s ease, color 0.18s ease;
}
.section-nav-list a:hover { background: var(--surface-2); }
.section-nav-list ul { margin: 0.15rem 0 0.4rem 0.4rem; border-left: 2px solid var(--border); padding-left: 0.5rem; }
.section-nav-list ul a { font-weight: 500; font-size: 0.88rem; color: var(--text-muted); }
.section-nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px rgba(239, 111, 92, 0.3);
}
.section-nav-root.is-active { color: var(--primary-dark); }

/* ---------------- Article typography ---------------- */
.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3vw, 3rem);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.article > h1:first-child,
.prose > :first-child { margin-top: 0; }
.article h1 {
  font-size: clamp(1.85rem, 1.3rem + 2.4vw, 2.85rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin: 0 0 1.25rem;
  background: linear-gradient(115deg, var(--primary) 0%, var(--primary-2) 50%, var(--indigo) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.article h2 {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.85rem);
  letter-spacing: -0.015em;
  margin: 2.4rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--surface-2);
  color: var(--text);
}
.article h3 { font-size: 1.3rem; margin: 1.9rem 0 0.75rem; color: var(--primary-dark); letter-spacing: -0.01em; }
.article h4 { font-size: 1.1rem; margin: 1.5rem 0 0.6rem; color: var(--text); }
.article p { margin: 0 0 1.15rem; }
.article strong { color: var(--text); font-weight: 700; }

/* Prose lists: custom markers (unordered) + numbered badges (ordered) */
.prose ul:not(.contains-task-list),
.prose ol {
  list-style: none;
  margin: 0 0 1.3rem;
  padding-left: 0;
}
.prose ul:not(.contains-task-list) > li,
.prose ol > li {
  position: relative;
  margin: 0.55rem 0;
}
.prose ul:not(.contains-task-list) > li { padding-left: 1.7rem; }
.prose ol > li { padding-left: 2.5rem; }

.prose ul:not(.contains-task-list) > li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.62em;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 1px 2px rgba(14, 124, 134, 0.4);
}
.prose ul:not(.contains-task-list) ul > li::before {
  background: transparent;
  border: 2px solid var(--primary);
  box-shadow: none;
}

.prose ol { counter-reset: prose-counter; }
.prose ol > li { counter-increment: prose-counter; }
.prose ol > li::before {
  content: counter(prose-counter);
  position: absolute;
  left: 0;
  top: 0.02em;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--indigo));
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(14, 124, 134, 0.32);
}

.prose li > ul,
.prose li > ol { margin: 0.4rem 0 0.4rem; }
.prose li::marker { content: ""; }
.article hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.article blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 4px solid var(--primary);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}

/* Anchored headings clear the sticky header */
.article :is(h1, h2, h3, h4, h5, h6)[id],
[id] { scroll-margin-top: calc(var(--header-height) + 1.25rem); }

/* Links in prose */
.article a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(14, 124, 134, 0.35);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1.5px;
  transition: color 0.18s ease, text-decoration-color 0.18s ease, background 0.18s ease;
  border-radius: 3px;
}
.article a:hover {
  color: var(--accent-dark);
  text-decoration-color: var(--accent);
  background: var(--accent-soft);
}

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

/* ---------------- Code blocks + copy button ---------------- */
.code-block { position: relative; margin: 1.5rem 0; }
.article pre[class*="language-"] {
  margin: 0;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  overflow: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  -moz-tab-size: 4;
  tab-size: 4;
}
.article pre[class*="language-"] code {
  font-family: var(--font-mono);
  background: none;
  color: #1f3b44;
  padding: 0;
  white-space: pre;
}
.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-sans);
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.code-block:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }
.copy-btn.is-copied { background: var(--primary); color: #fff; opacity: 1; }
.copy-btn svg { width: 13px; height: 13px; }

/* PrismJS light token theme (palette-matched) */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #8aa1a6; font-style: italic; }
.token.punctuation { color: #5d7780; }
.token.keyword, .token.control, .token.atrule { color: #b5388f; }
.token.boolean, .token.number, .token.constant { color: #b66417; }
.token.string, .token.char, .token.attr-value { color: #0a7d52; }
.token.function, .token.class-name { color: #1f6f9e; }
.token.operator, .token.entity, .token.url { color: #c2554a; }
.token.builtin, .token.tag, .token.selector { color: #0e7c86; }
.token.decorator, .token.annotation { color: #8a5cd1; }
.token.property, .token.attr-name { color: #2b3f8c; }
.token.important { color: var(--accent-dark); font-weight: 700; }
.token.deleted { color: #c0392b; }
.token.inserted { color: #0a7d52; }

/* ---------------- KaTeX ---------------- */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.5rem 0; }
.katex { font-size: 1.05em; }
.katex-display > .katex { white-space: nowrap; }

/* ---------------- Tables ---------------- */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.table-scroll table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: 0.92rem; }
.table-scroll th, .table-scroll td { padding: 0.7rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.table-scroll thead th { background: var(--surface-2); color: var(--text); font-weight: 700; border-bottom: 2px solid var(--border-strong); }
.table-scroll tbody tr:nth-child(even) { background: rgba(236, 244, 245, 0.45); }
.table-scroll tbody tr:hover { background: var(--accent-soft); }
.table-scroll td:first-child, .table-scroll th:first-child { padding-left: 1.1rem; }

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

/* ---------------- FAQ accordions ---------------- */
.faq { display: grid; gap: 0.75rem; margin: 1.25rem 0; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.2rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--primary);
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { color: var(--primary-dark); background: var(--surface-2); }
.faq-answer { padding: 0 1.2rem 1.1rem; color: var(--text-muted); }
.faq-answer > :first-child { margin-top: 0; }

/* ---------------- Mermaid ---------------- */
pre.mermaid {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
  text-align: center;
  overflow-x: auto;
}
pre.mermaid:not([data-processed]) { color: transparent; min-height: 2rem; }

/* ---------------- Related content ---------------- */
.related { margin-top: 2.75rem; padding-top: 1.75rem; border-top: 1px solid var(--border); }
.related-group { margin-bottom: 1.75rem; }
.related-group h2 { font-size: 1.2rem; margin: 0 0 0.9rem; border: none; padding: 0; }
.related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.related-list a {
  display: block;
  padding: 0.9rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.related-list a:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); border-color: var(--border-strong); background: var(--surface); }
.related-title { display: block; font-weight: 700; color: var(--primary-dark); margin-bottom: 0.2rem; }
.related-desc { display: block; font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }
.related-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.related-chips a {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.related-chips a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.related-up { margin: 0; }
.related-up a { font-weight: 700; }

/* ---------------- Footer ---------------- */
.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  background: #0c2730;
  color: #cfe2e6;
}
.footer-inner {
  max-width: var(--w-wide);
  margin-inline: auto;
  padding: 2.5rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 4rem;
  justify-content: space-between;
}
.footer-brand { display: flex; gap: 1rem; align-items: center; max-width: 420px; }
.footer-logo { border-radius: 10px; }
.footer-name { margin: 0; font-weight: 800; color: #fff; font-size: 1.1rem; }
.footer-desc { margin: 0.25rem 0 0; font-size: 0.9rem; color: #9fc0c6; }
.footer-heading { margin: 0 0 0.75rem; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: #7fa6ad; font-weight: 700; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.footer-nav a { color: #cfe2e6; font-weight: 600; transition: color 0.18s ease; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.footer-bottom p { max-width: var(--w-wide); margin: 0 auto; padding: 1rem var(--gutter); font-size: 0.82rem; color: #8fb1b7; }

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
  .content-grid { grid-template-columns: 1fr; }
  .section-nav {
    position: static;
    max-height: none;
    order: -1;
  }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    clip-path: inset(0 0 100% 0);
    transition: clip-path 0.25s ease;
  }
  .primary-nav.is-open { clip-path: inset(0 0 0 0); }
  .primary-nav ul { flex-direction: column; align-items: stretch; gap: 0.15rem; padding: 0.75rem var(--gutter) 1rem; }
  .nav-link { padding: 0.7rem 0.85rem; border-radius: 10px; }
  .hero-cta { grid-template-columns: 1fr; }
}

@media (min-width: 1600px) {
  :root { --w-wide: 1620px; }
}

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

html { scroll-behavior: smooth; }
