/* =========================================================================
   serializationautomation.org — light, elegant, professional design system
   ========================================================================= */

:root {
  /* Palette — light & easy on the eyes */
  --teal-900: #0b5b63;
  --teal-700: #0e7c86;
  --teal-500: #14b8a6;
  --violet-700: #7c3aed;
  --violet-500: #a855f7;
  --amber-600: #c2410c;
  --amber-500: #f97316;

  --ink: #1b2733;          /* primary text */
  --ink-soft: #475569;     /* secondary text */
  --ink-faint: #64748b;    /* tertiary text */
  --line: #e2e8f0;         /* borders */
  --line-soft: #eef2f6;
  --bg: #f7fafc;           /* page background */
  --surface: #ffffff;      /* cards / header */
  --surface-2: #f1f6f8;    /* subtle fills, inline code */
  --code-bg: #f6f8fb;      /* code block background (light) */

  --brand: var(--teal-700);
  --brand-strong: var(--teal-900);
  --link: #0e7490;
  --link-hover: var(--violet-700);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 42, 51, .06), 0 1px 3px rgba(15, 42, 51, .08);
  --shadow-md: 0 6px 18px rgba(15, 42, 51, .08), 0 2px 6px rgba(15, 42, 51, .06);
  --shadow-lg: 0 18px 48px rgba(15, 42, 51, .12);

  --header-h: 68px;
  --content-max: 1280px;
  --prose-max: 78ch;

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

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---- Reset-ish ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: clamp(16px, 0.55vw + 14.6px, 18px);
  line-height: 1.7;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(124, 58, 237, .06), transparent 60%),
    radial-gradient(1000px 520px at -10% 0%, rgba(20, 184, 166, .08), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; }
svg { display: block; }

/* ---- Shared layout ------------------------------------------------------ */
.wrap { width: min(100% - 2.5rem, var(--content-max)); margin-inline: auto; }
.icon { width: 1.25em; height: 1.25em; flex: none; }

main { flex: 1 0 auto; }

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color .18s var(--ease);
}
a:hover { color: var(--link-hover); text-decoration: underline; text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--violet-500) 55%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* =========================================================================
   Header
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 700; color: var(--ink); }
.brand:hover { color: var(--brand); text-decoration: none; }
.brand__logo { width: 38px; height: 38px; filter: drop-shadow(0 2px 4px rgba(11, 91, 99, .25)); transition: transform .25s var(--ease); }
.brand:hover .brand__logo { transform: rotate(-4deg) scale(1.05); }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__text b { font-size: 1.02rem; letter-spacing: -.01em; }
.brand__text span { font-size: .72rem; color: var(--ink-faint); font-weight: 600; letter-spacing: .02em; }

.nav { display: flex; align-items: center; gap: .35rem; }
.nav a {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .85rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .95rem;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav a .icon { color: var(--brand); }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"], .nav a.is-active {
  background: color-mix(in srgb, var(--teal-500) 16%, transparent);
  color: var(--brand-strong);
}
.nav a[aria-current="page"] .icon, .nav a.is-active .icon { color: var(--brand-strong); }

.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-2); }

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute;
    top: var(--header-h); left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
    padding: .75rem 1.25rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    transform: translateY(-8px);
    opacity: 0; pointer-events: none;
    transition: opacity .18s var(--ease), transform .18s var(--ease);
  }
  .nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav a { padding: .7rem .9rem; }
  .brand__text span { display: none; }
}

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  flex-shrink: 0;
  margin-top: 4rem;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--teal-700) 6%, transparent));
  border-top: 1px solid var(--line);
}
.site-footer__inner { padding: 2.5rem 0 2rem; display: grid; gap: 1.75rem; }
.footer-top { display: flex; flex-wrap: wrap; gap: 2rem 3rem; align-items: flex-start; justify-content: space-between; }
.footer-brand { max-width: 32ch; }
.footer-brand .brand { margin-bottom: .6rem; }
.footer-brand p { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.footer-cols { display: flex; flex-wrap: wrap; gap: 2rem 3rem; }
.footer-col h4 { margin: 0 0 .6rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.footer-col a { color: var(--ink-soft); font-weight: 500; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--line); padding-top: 1.25rem; color: var(--ink-faint); font-size: .85rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }

/* =========================================================================
   Hero / Homepage
   ========================================================================= */
.hero { text-align: center; padding: clamp(2.5rem, 6vw, 5rem) 0 2rem; }
.hero__logo {
  width: clamp(116px, 16vw, 168px);
  height: auto;
  margin: 0 auto 1.5rem;
  filter: drop-shadow(0 12px 28px rgba(124, 58, 237, .25));
  transition: transform .4s var(--ease);
}
.hero__logo:hover { transform: translateY(-4px) scale(1.03); }
.hero h1 {
  margin: 0 auto .9rem;
  max-width: 22ch;
  font-size: clamp(2rem, 4.6vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -.02em;
  background: linear-gradient(100deg, var(--teal-700), var(--violet-700) 60%, var(--amber-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lede { max-width: 62ch; margin: 0 auto 1.4rem; color: var(--ink-soft); font-size: clamp(1.02rem, 1.4vw, 1.18rem); }

.cta-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-top: 1.6rem; }
.cta {
  display: inline-flex; align-items: center; gap: .7rem;
  padding: .85rem 1.3rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-weight: 650;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.cta:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; border-color: color-mix(in srgb, var(--cta-color, var(--brand)) 45%, var(--line)); }
.cta__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px; color: #fff;
  background: linear-gradient(135deg, var(--cta-color, var(--brand)), var(--cta-accent, var(--violet-500)));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--cta-color, var(--brand)) 35%, transparent);
}
.cta__icon .icon { width: 20px; height: 20px; }
.cta .arrow { color: var(--ink-faint); transition: transform .2s var(--ease); width: 18px; height: 18px; }
.cta:hover .arrow { transform: translateX(4px); color: var(--cta-color, var(--brand)); }

/* Section cards */
.section-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1.4rem;
  margin-top: 1rem;
}
.card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--cta-color, var(--brand)), var(--cta-accent, var(--violet-500)));
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--cta-color, var(--brand)) 35%, var(--line)); }
.card__icon {
  width: 48px; height: 48px; border-radius: 13px; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--cta-color, var(--brand)), var(--cta-accent, var(--violet-500)));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--cta-color, var(--brand)) 32%, transparent);
  margin-bottom: 1rem;
}
.card__icon .icon { width: 26px; height: 26px; }
.card h3 { margin: 0 0 .5rem; font-size: 1.2rem; letter-spacing: -.01em; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--cta-color, var(--brand)); text-decoration: none; }
.card p { margin: 0 0 1rem; color: var(--ink-soft); font-size: .95rem; }
.card ul { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; gap: .35rem; }
.card ul a { display: inline-flex; align-items: center; gap: .4rem; font-weight: 550; font-size: .92rem; }
.card ul a::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--cta-accent, var(--violet-500)); flex: none; }
.card__more { margin-top: auto; display: inline-flex; align-items: center; gap: .4rem; font-weight: 650; color: var(--cta-color, var(--brand)); }
.card__more .icon { width: 18px; height: 18px; transition: transform .2s var(--ease); }
.card__more:hover { text-decoration: none; }
.card:hover .card__more .icon { transform: translateX(4px); }

.home-section { padding: 2.5rem 0; }
.home-section > h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); letter-spacing: -.02em; margin: 0 0 .4rem; }
.home-section > .home-section__sub { color: var(--ink-soft); margin: 0 0 1.6rem; max-width: none; }

/* =========================================================================
   Content pages
   ========================================================================= */
.page { padding: 1.5rem 0 1rem; }
.page__layout { display: grid; gap: 2.5rem; }
@media (min-width: 1060px) {
  .page__layout { grid-template-columns: minmax(0, 1fr) 16rem; align-items: start; }
}

.prose { min-width: 0; }
.prose > * { max-width: var(--prose-max); }
.prose > .table-wrap, .prose > pre, .prose > .mermaid, .prose > .embed-wide { max-width: 100%; }

/* On wide desktops, let prose breathe wider than a narrow column */
@media (min-width: 1280px) { :root { --prose-max: 86ch; } }
@media (min-width: 1600px) { :root { --prose-max: 92ch; } }

.prose h1 {
  font-size: clamp(1.85rem, 3.2vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -.02em;
  margin: .2rem 0 1rem;
  background: linear-gradient(100deg, var(--teal-700), var(--violet-700));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.prose h2 {
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  letter-spacing: -.015em;
  margin: 2.4rem 0 .9rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--line-soft);
}
.prose h3 { font-size: clamp(1.18rem, 1.6vw, 1.4rem); margin: 1.9rem 0 .7rem; color: var(--brand-strong); letter-spacing: -.01em; }
.prose h4 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; color: var(--ink); }
.prose h2, .prose h3, .prose h4 { scroll-margin-top: calc(var(--header-h) + 1.2rem); }

.prose p { margin: 0 0 1.1rem; }
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.4rem; }
.prose li { margin: .35rem 0; }
.prose li::marker { color: var(--brand); }
.prose strong { color: var(--ink); font-weight: 700; }
.prose blockquote {
  margin: 1.4rem 0; padding: .6rem 1.2rem;
  border-left: 4px solid var(--teal-500);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
}
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.2rem 0; }

.prose a { font-weight: 550; color: var(--link); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent); text-decoration-thickness: 1.5px; }
.prose a:hover { color: var(--link-hover); text-decoration-color: currentColor; }

/* heading anchor link */
.heading-anchor { margin-left: .4rem; color: var(--ink-faint); opacity: 0; font-weight: 400; transition: opacity .15s var(--ease); text-decoration: none; }
h2:hover .heading-anchor, h3:hover .heading-anchor, h4:hover .heading-anchor { opacity: 1; }

/* ---- Inline code -------------------------------------------------------- */
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--surface-2);
  color: #0f5b66;
  padding: .12em .4em;
  border-radius: 6px;
  border: 0;
  white-space: break-spaces;
}

/* ---- Code blocks -------------------------------------------------------- */
.code-block {
  position: relative;
  margin: 1.4rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--code-bg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.code-block__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .45rem .55rem .45rem .9rem;
  background: color-mix(in srgb, var(--teal-700) 7%, var(--code-bg));
  border-bottom: 1px solid var(--line);
}
.code-block__lang { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.copy-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font: inherit; font-size: .78rem; font-weight: 600;
  padding: .32rem .6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.copy-btn .icon { width: 15px; height: 15px; }
.copy-btn:hover { background: var(--surface-2); color: var(--ink); border-color: color-mix(in srgb, var(--teal-500) 45%, var(--line)); }
.copy-btn.is-copied { color: #0f766e; border-color: color-mix(in srgb, var(--teal-500) 55%, var(--line)); background: color-mix(in srgb, var(--teal-500) 12%, var(--surface)); }

.code-block pre[class*="language-"] { margin: 0; padding: 1rem 1.1rem; background: transparent; overflow-x: auto; font-size: .86rem; line-height: 1.6; tab-size: 4; }
.code-block code[class*="language-"] { font-family: var(--font-mono); }
pre[class*="language-"]::-webkit-scrollbar { height: 10px; }
pre[class*="language-"]::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

/* Prism light theme tuned to brand */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #7a8a99; font-style: italic; }
.token.punctuation { color: #5b6b7a; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted { color: #b4530b; }
.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: #6d28d9; }
.token.atrule, .token.attr-value, .token.keyword { color: #7c3aed; font-weight: 600; }
.token.function, .token.class-name { color: #0e7490; }
.token.regex, .token.important, .token.variable { color: #c2410c; }

/* ---- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 1.4rem 0; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); -webkit-overflow-scrolling: touch; }
.prose table { border-collapse: collapse; width: 100%; min-width: 32rem; font-size: .92rem; }
.prose thead th { background: color-mix(in srgb, var(--teal-700) 9%, var(--surface)); color: var(--brand-strong); text-align: left; font-weight: 700; }
.prose th, .prose td { padding: .65rem .9rem; border-bottom: 1px solid var(--line); }
.prose tbody tr:nth-child(even) { background: var(--surface-2); }
.prose tbody tr:hover { background: color-mix(in srgb, var(--teal-500) 7%, transparent); }

/* ---- Task lists (toggleable checkboxes) --------------------------------- */
.prose ul.contains-task-list { list-style: none; padding-left: .2rem; }
.prose ul.contains-task-list .task-list-item { position: relative; padding-left: 0; display: flex; align-items: flex-start; gap: .6rem; }
.prose ul.contains-task-list .task-list-item::marker { content: ""; }
.task-list-item input.task-list-item-checkbox {
  appearance: none; -webkit-appearance: none;
  width: 1.2em; height: 1.2em; margin-top: .28em; flex: none;
  border: 2px solid color-mix(in srgb, var(--teal-700) 45%, var(--line));
  border-radius: 6px; background: var(--surface);
  cursor: pointer; position: relative;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.task-list-item input.task-list-item-checkbox:hover { border-color: var(--teal-500); }
.task-list-item input.task-list-item-checkbox:checked { background: linear-gradient(135deg, var(--teal-500), var(--teal-700)); border-color: var(--teal-700); }
.task-list-item input.task-list-item-checkbox:checked::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(42deg);
}
.task-list-item input.task-list-item-checkbox:checked ~ * ,
.task-list-item.is-checked > label { text-decoration: line-through; color: var(--ink-faint); }

/* ---- FAQ accordions ----------------------------------------------------- */
.accordion { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin: .7rem 0; box-shadow: var(--shadow-sm); overflow: hidden; }
.accordion > summary {
  cursor: pointer; list-style: none; padding: 1rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-weight: 650; color: var(--brand-strong);
}
.accordion > summary::-webkit-details-marker { display: none; }
.accordion > summary:hover { background: var(--surface-2); }
.accordion > summary .icon { transition: transform .2s var(--ease); color: var(--brand); flex: none; }
.accordion[open] > summary .icon { transform: rotate(90deg); }
.accordion__body { padding: 0 1.2rem 1.1rem; color: var(--ink-soft); }
.accordion__body > :first-child { margin-top: 0; }

/* ---- Breadcrumbs -------------------------------------------------------- */
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .1rem; font-size: .85rem; color: var(--ink-faint); margin: 0 0 .8rem; }
.breadcrumbs a { color: var(--ink-faint); font-weight: 550; }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs .sep { width: 14px; height: 14px; opacity: .55; }
.breadcrumbs [aria-current="page"] { color: var(--ink-soft); font-weight: 600; }

/* ---- Related nav / sidebar --------------------------------------------- */
.aside { position: sticky; top: calc(var(--header-h) + 1.5rem); display: grid; gap: 1.5rem; }
@media (max-width: 1059px) { .aside { position: static; } }
.aside__box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.25rem; box-shadow: var(--shadow-sm); }
.aside__box h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin: 0 0 .8rem; border: 0; padding: 0; }
.aside__box ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.aside__box li a { display: inline-flex; gap: .5rem; align-items: baseline; font-weight: 550; font-size: .92rem; color: var(--ink-soft); }
.aside__box li a::before { content: ""; width: 6px; height: 6px; margin-top: .5em; border-radius: 50%; background: var(--teal-500); flex: none; }
.aside__box li a:hover { color: var(--brand); }
.aside__box li[aria-current] a { color: var(--brand-strong); font-weight: 700; }

/* "Continue reading" related grid at the foot of an article */
.related { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.related h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); border: 0; padding: 0; margin: 0 0 1rem; }
.related__grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.related__card { display: block; padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); }
.related__card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--teal-500) 40%, var(--line)); text-decoration: none; }
.related__card span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); margin-bottom: .3rem; }
.related__card b { color: var(--ink); font-weight: 650; line-height: 1.3; }
.related__card:hover b { color: var(--brand); }

/* ---- Section index (pillar/sub pages get a child list) ------------------ */
.child-nav { margin: 2rem 0 .5rem; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); max-width: 100% !important; }

/* ---- Mermaid diagrams + lightbox --------------------------------------- */
.mermaid { margin: 1.6rem 0; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; box-shadow: var(--shadow-sm); }
.mermaid svg { max-width: 100%; height: auto; }
.mermaid--pending { visibility: hidden; min-height: 80px; }

figure.diagram {
  position: relative;
  margin: 1.9rem 0;
  padding: 1.1rem 1.1rem 1rem;
  max-width: 100% !important;
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--teal-500) 7%, transparent), transparent 55%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
figure.diagram:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--teal-500) 40%, var(--line)); }
figure.diagram .mermaid { margin: 0; padding: .2rem; background: transparent; border: 0; box-shadow: none; }
.diagram__hint {
  position: absolute; top: .6rem; right: .6rem;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .6rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; color: var(--ink-soft);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(4px);
  opacity: 0; transform: translateY(-4px);
  transition: opacity .18s var(--ease), transform .18s var(--ease), color .18s var(--ease);
  pointer-events: none;
}
.diagram__hint .icon { width: 14px; height: 14px; color: var(--brand); }
figure.diagram:hover .diagram__hint, figure.diagram:focus-visible .diagram__hint { opacity: 1; transform: none; color: var(--brand-strong); }

/* full-screen modal */
.diagram-modal { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: clamp(.75rem, 3vw, 2.5rem); }
.diagram-modal.is-open { display: flex; }
.diagram-modal__backdrop { position: absolute; inset: 0; background: rgba(15, 33, 41, .55); backdrop-filter: blur(6px); animation: dlg-fade .2s var(--ease); }
.diagram-modal__panel {
  position: relative;
  width: min(1400px, 100%);
  max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: dlg-pop .22s var(--ease);
  overflow: hidden;
}
.diagram-modal__close {
  position: absolute; top: .7rem; right: .7rem; z-index: 2;
  width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); cursor: pointer;
  box-shadow: var(--shadow-sm); transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.diagram-modal__close:hover { background: var(--surface-2); color: var(--brand-strong); border-color: color-mix(in srgb, var(--teal-500) 45%, var(--line)); }
.diagram-modal__stage { overflow: auto; padding: clamp(1.2rem, 4vw, 2.5rem); -webkit-overflow-scrolling: touch; }
.diagram-modal__stage svg { display: block; margin: 0 auto; width: 100%; height: auto; max-width: none; }
@keyframes dlg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dlg-pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ---- Skip link ---------------------------------------------------------- */
.skip-link { position: absolute; left: -999px; top: .5rem; background: var(--surface); padding: .6rem 1rem; border-radius: 10px; box-shadow: var(--shadow-md); z-index: 100; }
.skip-link:focus { left: .75rem; }

/* ---- Utilities ---------------------------------------------------------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
