/* =========================================================================
   Spatial Infrastructure as Code — theme
   Light, elegant, professional. Wide on desktop, responsive on mobile.
   ========================================================================= */

:root {
  /* Brand palette */
  --teal-900: #0a4f49;
  --teal-700: #0d7d74;
  --teal-500: #14b8a6;
  --teal-100: #cdf3ec;
  --teal-50: #eafaf7;
  --indigo: #6366f1;
  --indigo-50: #eef0ff;
  --sky: #0ea5e9;
  --amber: #f59e0b;
  --emerald: #10b981;
  --rose: #f43f5e;

  /* Neutrals (slightly teal-tinted for warmth) */
  --ink: #112b2c;
  --body: #2c3f41;
  --muted: #5f7274;
  --bg: #f5f9f8;
  --surface: #ffffff;
  --surface-2: #f0f6f5;
  --border: rgba(13, 125, 116, 0.16);
  --border-strong: rgba(13, 125, 116, 0.28);

  /* Code */
  --code-bg: #f3f7f7;
  --code-border: rgba(13, 125, 116, 0.18);
  --inline-bg: rgba(20, 184, 166, 0.13);
  --inline-ink: #0b6b62;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(10, 79, 73, 0.06), 0 1px 3px rgba(10, 79, 73, 0.08);
  --shadow-md: 0 6px 18px rgba(10, 79, 73, 0.10);
  --shadow-lg: 0 18px 40px rgba(10, 79, 73, 0.16);
  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 66px;
  --container: 1280px;
  --container-wide: 1500px;
  --ease: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  --grad-brand: linear-gradient(115deg, var(--teal-700) 0%, var(--teal-500) 45%, var(--indigo) 100%);
}

/* ----------------------------- Reset / base ---------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--body);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(1rem, 0.97rem + 0.15vw, 1.08rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.site-main { flex: 1 0 auto; }

.container {
  width: min(92%, var(--container));
  margin-inline: auto;
}
@media (min-width: 1600px) {
  .container { width: min(90%, var(--container-wide)); }
}

a { color: var(--teal-700); }

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

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

/* ------------------------------- Header -------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  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;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark { transition: transform var(--ease); }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; letter-spacing: -0.01em; font-size: 1.05rem; }
.brand-tagline { font-size: 0.72rem; color: var(--muted); font-weight: 600; }

.primary-nav { display: flex; }
.nav-list {
  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.8rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--body);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background var(--ease), color var(--ease), transform var(--ease);
}
.nav-link .icon { width: 22px; height: 22px; }
.nav-link:hover { background: var(--surface-2); transform: translateY(-1px); }
.nav-link.is-current {
  background: var(--teal-50);
  color: var(--teal-900);
  box-shadow: inset 0 0 0 1px var(--teal-100);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--teal-700);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle .nav-toggle-close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-close { display: inline-flex; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 0.6rem;
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ease), transform var(--ease), visibility var(--ease);
  }
  .primary-nav.is-open { transform: translateY(0); opacity: 1; visibility: visible; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0.2rem; }
  .nav-link { padding: 0.85rem 1rem; border-radius: 10px; }
}

/* ------------------------------ Footer --------------------------------- */
.site-footer {
  margin-top: 4rem;
  background: linear-gradient(180deg, var(--teal-900), #073a35);
  color: #d7efe9;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  justify-content: space-between;
  align-items: center;
  padding: 2.25rem 0 1.25rem;
}
.footer-brand { display: flex; align-items: center; gap: 0.85rem; }
.footer-mark { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3)); }
.footer-name { margin: 0; font-weight: 800; color: #fff; }
.footer-tagline { margin: 0.1rem 0 0; font-size: 0.85rem; color: #9fd3ca; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-links a {
  color: #cdeee7;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: color var(--ease), border-color var(--ease);
}
.footer-links a:hover { color: #fff; border-color: var(--teal-500); }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1rem 0 1.75rem;
}
.footer-bottom p { margin: 0; font-size: 0.82rem; color: #95c8c0; }

/* ------------------------------- Hero ---------------------------------- */
.hero {
  position: relative;
  text-align: center;
  padding: clamp(2.5rem, 5vw, 5rem) 0 clamp(2rem, 4vw, 3.5rem);
  background:
    radial-gradient(60% 70% at 50% -10%, var(--teal-50), transparent 70%),
    radial-gradient(40% 50% at 90% 0%, var(--indigo-50), transparent 70%);
  overflow: hidden;
}
.hero-logo {
  display: block;
  margin: 0 auto 1.25rem;
  width: clamp(108px, 14vw, 168px);
  height: auto;
  filter: drop-shadow(0 14px 30px rgba(13, 125, 116, 0.25));
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.hero-title {
  margin: 0 0 0.6rem;
  font-size: clamp(1.85rem, 1.1rem + 3.4vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 850;
  overflow-wrap: break-word;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lede {
  margin: 0 auto;
  max-width: 48rem;
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.45rem);
  color: var(--muted);
}
.hero-lede strong { color: var(--teal-700); }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}
.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.3rem 0.9rem 0.95rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
  min-width: 220px;
}
.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.cta-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface-2);
}
.cta-icon .icon { width: 28px; height: 28px; }
.cta-text { display: flex; flex-direction: column; text-align: left; }
.cta-label { font-weight: 800; color: var(--ink); font-size: 1.05rem; }
.cta-sub {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--teal-700);
  font-size: 0.85rem;
  font-weight: 600;
}
.cta-sub .icon { width: 16px; height: 16px; transition: transform var(--ease); }
.cta-button:hover .cta-sub .icon { transform: translateX(4px); }
.cta-spatial-iac-architecture-fundamentals .cta-icon { background: var(--indigo-50); }
.cta-geospatial-resource-provisioning .cta-icon { background: #e7faf1; }
.cta-network-security-access-control .cta-icon { background: #ffe9ec; }

@media (max-width: 520px) {
  .hero-cta { flex-direction: column; }
  .cta-button { width: 100%; min-width: 0; }
}

/* --------------------------- Home sections ----------------------------- */
.home-body { padding: clamp(2rem, 4vw, 3.5rem) 0 1rem; }
.intro {
  max-width: none;
  margin: 0;
}
.intro p { margin: 0 0 1.1rem; font-size: 1.08rem; }
.intro strong { color: var(--teal-700); }

.section-heading {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 2.75rem 0 1.25rem;
  position: relative;
  padding-bottom: 0.5rem;
}
.section-heading::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 64px;
  height: 4px;
  border-radius: 4px;
  background: var(--grad-brand);
}

.diagram-section { margin-top: 2.5rem; }

.cards {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--teal-500);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease), box-shadow var(--ease);
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-spatial-iac-architecture-fundamentals { border-top-color: var(--indigo); }
.card-geospatial-resource-provisioning { border-top-color: var(--emerald); }
.card-network-security-access-control { border-top-color: var(--rose); }
.card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
}
.card-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--surface-2);
}
.card-icon .icon { width: 26px; height: 26px; }
.card-title { margin: 0; font-size: 1.25rem; font-weight: 800; }
.card-summary { color: var(--muted); margin: 0.9rem 0 1rem; font-size: 0.96rem; }
.card-links { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.35rem; }
.card-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  color: var(--teal-700);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 8px;
  padding: 0.25rem 0;
}
.card-links a .icon { width: 15px; height: 15px; opacity: 0; transform: translateX(-4px); transition: var(--ease); }
.card-links a:hover { color: var(--teal-900); }
.card-links a:hover .icon { opacity: 1; transform: translateX(0); }
.card-more {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  background: var(--grad-brand);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  align-self: flex-start;
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease), box-shadow var(--ease);
}
.card-more .icon { width: 17px; height: 17px; transition: transform var(--ease); }
.card-more:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-more:hover .icon { transform: translateX(3px); }

/* ---------------------------- Article shell ---------------------------- */
.article-shell { padding: 1.25rem 0 2rem; }

/* Breadcrumbs */
.breadcrumbs { margin: 0.5rem 0 1.25rem; }
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.breadcrumbs li { display: inline-flex; align-items: center; gap: 0.5rem; }
.breadcrumbs li + li::before { content: "/"; color: var(--border-strong); }
.breadcrumbs a { color: var(--teal-700); text-decoration: none; font-weight: 600; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* --------------------------- Prose content ----------------------------- */
/* Text fills the full width of its container on desktop (not a narrow column). */
.prose { max-width: none; }
.prose > * { max-width: 100%; }
.code-wrap { position: relative; margin: 1.4rem 0; }
.code-wrap > pre[class*="language-"] { margin: 0; }

.prose h1 {
  font-size: clamp(1.9rem, 1.4rem + 2.4vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 850;
  margin: 0.2rem 0 1.1rem;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.prose h2 {
  font-size: clamp(1.45rem, 1.2rem + 1vw, 1.95rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 2.4rem 0 1rem;
  padding-left: 0.85rem;
  border-left: 5px solid var(--teal-500);
}
.prose h3 {
  font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.5rem);
  color: var(--teal-900);
  margin: 1.9rem 0 0.8rem;
}
.prose h4 { font-size: 1.15rem; color: var(--ink); margin: 1.5rem 0 0.6rem; }
.prose p { margin: 0 0 1.15rem; }
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.4rem; }
.prose li { margin: 0.35rem 0; }
.prose li::marker { color: var(--teal-500); }

.prose strong { color: var(--ink); font-weight: 700; }

.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.8rem 1.2rem;
  border-left: 4px solid var(--teal-500);
  background: var(--teal-50);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--teal-900);
}

/* In-content links */
.prose a:not(.heading-anchor) {
  color: var(--teal-700);
  text-decoration: underline;
  text-decoration-color: var(--teal-100);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: color var(--ease), text-decoration-color var(--ease);
}
.prose a:not(.heading-anchor):hover {
  color: var(--indigo);
  text-decoration-color: currentColor;
}

/* Heading anchors (markdown-it-anchor headerLink) */
.heading-anchor { color: inherit; text-decoration: none; position: relative; }
.heading-anchor::before {
  content: "#";
  position: absolute;
  left: -1.1em;
  color: var(--teal-500);
  opacity: 0;
  transition: opacity var(--ease);
}
.prose h2:hover .heading-anchor::before,
.prose h3:hover .heading-anchor::before,
.prose h4:hover .heading-anchor::before { opacity: 0.7; }

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

/* ----------------------------- Inline code ----------------------------- */
.prose :not(pre) > code {
  background: var(--inline-bg);
  color: var(--inline-ink);
  padding: 0.12em 0.42em;
  border-radius: 6px;
  font-size: 0.88em;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  border: 0;
  white-space: break-spaces;
}

/* ---------------------------- Code blocks ------------------------------ */
.prose pre[class*="language-"],
.prose pre:not([class]) {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  margin: 1.4rem 0;
  overflow: auto;
  font-size: 0.9rem;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
  tab-size: 2;
}
.prose pre[class*="language-"] code,
.prose pre code {
  background: none;
  color: #1f3b3a;
  padding: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: inherit;
}

/* Copy button (injected by main.js) */
.code-wrap { position: relative; }
.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--teal-700);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity var(--ease), transform var(--ease), background var(--ease), color var(--ease);
}
.code-wrap:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; transform: translateY(0); }
.copy-btn:hover { background: #fff; }
.copy-btn .icon { width: 16px; height: 16px; }
.copy-btn.is-copied { color: #fff; background: var(--emerald); border-color: var(--emerald); }

/* Prism token colors tuned to the brand */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #7a8c8a; font-style: italic; }
.token.punctuation { color: #5a6b6a; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant,
.token.symbol, .token.deleted { color: #b45309; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin,
.token.inserted { color: #0f766e; }
.token.operator, .token.entity, .token.url, .language-css .token.string,
.style .token.string { color: #b9357a; }
.token.atrule, .token.attr-value, .token.keyword { color: #4f46e5; font-weight: 600; }
.token.function, .token.class-name { color: #0369a1; }
.token.regex, .token.important, .token.variable { color: #c2410c; }

/* ------------------------------- Tables -------------------------------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.94rem;
}
.prose thead th {
  background: var(--teal-50);
  color: var(--teal-900);
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
}
.prose th, .prose td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.prose tbody tr:nth-child(even) { background: var(--surface-2); }
.prose tbody tr:hover { background: var(--teal-50); }
.prose td:first-child { font-weight: 600; color: var(--ink); }

/* ------------------------- Task list checkboxes ------------------------ */
.contains-task-list { list-style: none; padding-left: 0.2rem; }
.task-list-item { list-style: none; display: flex; align-items: flex-start; gap: 0.6rem; }
.task-list-item::marker { content: ""; }
.task-list-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 1.25em;
  height: 1.25em;
  margin-top: 0.18em;
  border: 2px solid var(--teal-500);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background var(--ease), border-color var(--ease);
}
.task-list-item input[type="checkbox"]::before {
  content: "";
  width: 0.7em;
  height: 0.7em;
  transform: scale(0);
  transform-origin: center;
  clip-path: polygon(14% 44%, 0 65%, 43% 100%, 100% 16%, 80% 0%, 41% 62%);
  background: #fff;
  transition: transform var(--ease);
}
.task-list-item input[type="checkbox"]:checked {
  background: var(--teal-600, var(--teal-700));
  border-color: var(--teal-700);
}
.task-list-item input[type="checkbox"]:checked::before { transform: scale(1); }
.task-list-item.is-checked,
.task-list-item:has(input:checked) { color: var(--muted); }
.task-list-item.is-checked > label,
.task-list-item:has(input:checked) > label { text-decoration: line-through; }

/* ------------------------------ Accordions ----------------------------- */
details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin: 0.8rem 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
details > summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.2rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: "";
  width: 12px;
  height: 12px;
  border-right: 2.5px solid var(--teal-700);
  border-bottom: 2.5px solid var(--teal-700);
  transform: rotate(45deg);
  transition: transform var(--ease);
  flex: 0 0 auto;
}
details[open] > summary::after { transform: rotate(-135deg); }
details > summary:hover { background: var(--teal-50); }
details > *:not(summary) { padding: 0 1.2rem 1.1rem; }

/* ------------------------------- Mermaid ------------------------------- */
.mermaid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
  text-align: center;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  font-family: ui-sans-serif, system-ui, sans-serif;
  /* hide raw definition until mermaid renders */
  color: transparent;
}
.mermaid[data-processed="true"] { color: inherit; }
.mermaid svg { max-width: 100%; height: auto; }

/* ------------------------------- Related ------------------------------- */
.related { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.related-group + .related-group { margin-top: 2rem; }
.related-title { font-size: 1.15rem; color: var(--ink); margin: 0 0 1rem; }
.related-list {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}
.related-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  height: 100%;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.related-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.related-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--ink);
}
.related-card-title .icon { width: 18px; height: 18px; color: var(--teal-700); flex: 0 0 auto; transition: transform var(--ease); }
.related-card:hover .related-card-title .icon { transform: translateX(3px); }
.related-card-summary { color: var(--muted); font-size: 0.9rem; }
.related-list--compact .related-card { padding: 0.8rem 1.05rem; }

/* ------------------------------ 404 page ------------------------------- */
.error-page { text-align: center; padding: clamp(3rem, 8vw, 6rem) 0; }
.error-code {
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 850;
  line-height: 1;
  margin: 0;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.error-title {
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
  color: var(--ink);
  margin: 0.5rem 0 1rem;
}
.error-lede { color: var(--muted); max-width: 46rem; margin: 0 auto 2rem; }
.error-links { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }
.error-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease), box-shadow var(--ease);
}
.error-link .icon { width: 22px; height: 22px; }
.error-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

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