/* ==========================================================================
   PostgreSQL Extension Lifecycle — light, elegant, professional theme
   ========================================================================== */
:root {
  /* palette */
  --bg: #f4f8fb;
  --surface: #ffffff;
  --surface-2: #eef4f9;
  --surface-3: #e6eef6;
  --ink: #16242f;
  --ink-2: #2c3e4c;
  --muted: #5a6b78;
  --border: #e1e9f0;
  --border-strong: #cdd9e4;

  --brand: #1c5b8c;
  --brand-strong: #0f3d5e;
  --brand-soft: #e8f1f8;
  --teal: #0d9488;
  --teal-bright: #0fb27d;
  --amber: #e6951b;
  --coral: #ec6a67;
  --violet: #6f63d8;

  --link: #1565a0;
  --link-hover: #0f3d5e;

  /* code */
  --code-bg: #f5f9fd;
  --code-border: #e0ebf4;
  --inline-bg: #eaf1f8;
  --inline-ink: #0f4c75;

  /* shape */
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 61, 94, .06), 0 1px 3px rgba(15, 61, 94, .08);
  --shadow: 0 6px 18px rgba(15, 61, 94, .08), 0 2px 6px rgba(15, 61, 94, .06);
  --shadow-lg: 0 18px 48px rgba(15, 61, 94, .14);

  --header-h: 66px;
  --maxw: 1320px;
  --measure: 78ch;

  --font: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background-image:
    radial-gradient(1100px 480px at 88% -8%, #e4f0f8 0%, rgba(228,240,248,0) 60%),
    radial-gradient(900px 420px at -6% 4%, #e7f6f0 0%, rgba(231,246,240,0) 55%);
  background-attachment: fixed;
}

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

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

a { color: var(--link); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--link-hover); }

.icon { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -0.18em; flex: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

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

/* ===================== Header ===================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem clamp(1rem, 3vw, 2rem);
  min-height: var(--header-h);
}
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); }
.brand-logo { display: block; filter: drop-shadow(0 2px 4px rgba(15,61,94,.18)); transition: transform .2s ease; }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.05); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 800; font-size: 1.06rem; letter-spacing: -.01em; color: var(--brand-strong); }
.brand-sub { font-size: .72rem; color: var(--muted); font-weight: 600; letter-spacing: .02em; }

.primary-nav { margin-left: auto; }
.primary-nav ul { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .8rem; border-radius: 999px; color: var(--ink-2);
  font-weight: 650; font-size: .95rem; position: relative;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nav-link:hover { background: var(--brand-soft); color: var(--brand-strong); transform: translateY(-1px); }
.nav-link.is-active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.nav-link.is-active:hover { color: #fff; }
.nav-ico { display: inline-flex; }
.nav-ico--home { color: var(--brand); }
.nav-ico--1 { color: var(--teal); }
.nav-ico--2 { color: var(--violet); }
.nav-ico--3 { color: var(--amber); }
.nav-link.is-active .nav-ico { color: #fff; }

.nav-toggle {
  display: none; margin-left: auto; background: var(--surface);
  border: 1px solid var(--border-strong); color: var(--brand-strong);
  width: 44px; height: 44px; border-radius: 11px; cursor: pointer; align-items: center; justify-content: center;
}
.nav-toggle .icon { width: 22px; height: 22px; }

/* ===================== Footer ===================== */
.site-footer {
  flex-shrink: 0; margin-top: 3rem;
  background: linear-gradient(180deg, #0f3d5e 0%, #0c2f49 100%);
  color: #cfe1ee;
}
.footer-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 2rem 3rem; justify-content: space-between;
  padding: 2.4rem clamp(1rem, 3vw, 2rem) 1.6rem;
}
.footer-brand { display: flex; gap: .9rem; align-items: flex-start; max-width: 460px; }
.footer-brand .brand-logo { filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }
.footer-title { margin: 0 0 .25rem; font-weight: 800; color: #fff; font-size: 1.05rem; }
.footer-tagline { margin: 0; font-size: .9rem; color: #9fbcd2; line-height: 1.55; }
.footer-heading { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: #7fa6c2; margin: 0 0 .7rem; font-weight: 700; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.footer-nav a { display: inline-flex; align-items: center; gap: .5rem; color: #cfe1ee; font-weight: 600; }
.footer-nav a:hover { color: #fff; }
.footer-nav .icon { color: var(--teal-bright); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 1rem clamp(1rem, 3vw, 2rem); text-align: center; font-size: .85rem; color: #8fb0c8;
}
.footer-bottom p { margin: 0; }

/* ===================== Hero / Home ===================== */
.hero { padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 2rem) clamp(1.5rem, 3vw, 2.5rem); }
.hero-inner { max-width: var(--maxw); margin: 0 auto; text-align: left; }
.hero-logo {
  display: block; margin: 0 0 1.4rem;
  width: clamp(120px, 18vw, 168px); height: auto;
  filter: drop-shadow(0 10px 26px rgba(15,61,94,.22));
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.hero-title {
  font-size: clamp(1.9rem, 4.6vw, 3.4rem); line-height: 1.08; margin: 0 0 .2rem;
  letter-spacing: -.02em; font-weight: 850; color: var(--brand-strong); max-width: 24ch;
  background: linear-gradient(100deg, #0f3d5e 0%, #1c7fb8 45%, #0fb27d 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-title span { -webkit-text-fill-color: var(--amber); }
/* Lede fills the container width (like the rest of the page); columns on
   wide screens keep line length readable without a narrow centered column. */
.hero-lede { max-width: none; margin: 1.4rem 0 0; }
.hero-lede p { margin: 0 0 .9rem; color: var(--ink-2); font-size: 1.05rem; max-width: 75ch; }
@media (min-width: 1000px) {
  .hero-lede { columns: 2; column-gap: 2.4rem; }
  .hero-lede p { max-width: none; break-inside: avoid; }
}

.hero-cta {
  display: grid; gap: 1rem; margin: 2.2rem auto 0; max-width: none;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); text-align: left;
}
.cta {
  display: flex; align-items: center; gap: .9rem; padding: 1.05rem 1.15rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); color: var(--ink); position: relative; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.cta::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c, var(--brand)); }
.cta:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); color: var(--ink); }
.cta-ico {
  flex: none; width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, var(--c), var(--c2)); box-shadow: var(--shadow-sm);
}
.cta-ico .icon { width: 26px; height: 26px; }
.cta-body { display: flex; flex-direction: column; }
.cta-label { font-weight: 800; font-size: 1.08rem; color: var(--brand-strong); }
.cta-sub { font-size: .86rem; color: var(--muted); line-height: 1.45; }
.cta-arrow { margin-left: auto; color: var(--c); transition: transform .18s ease; }
.cta:hover .cta-arrow { transform: translateX(4px); }
.cta--1 { --c: #0d9488; --c2: #0fb27d; }
.cta--2 { --c: #6f63d8; --c2: #8a7ef0; }
.cta--3 { --c: #e6951b; --c2: #f5b133; }

.home-section { padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem) 1rem; }
.home-section-inner { max-width: var(--maxw); margin: 0 auto; }
.section-title { font-size: clamp(1.5rem, 3vw, 2.1rem); color: var(--brand-strong); margin: 0 0 .4rem; letter-spacing: -.01em; }
.section-intro { color: var(--muted); max-width: 70ch; margin: 0 0 1.8rem; font-size: 1.05rem; }

.pillars { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.pillar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.2rem; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.pillar:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.pillar-title { display: flex; align-items: center; gap: .7rem; margin: 0 0 .55rem; font-size: 1.2rem; }
.pillar-title a { color: var(--brand-strong); }
.pillar-ico { width: 40px; height: 40px; flex: none; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.pillar-ico .icon { width: 22px; height: 22px; }
.pillar-ico--1 { background: linear-gradient(135deg, #0d9488, #0fb27d); }
.pillar-ico--2 { background: linear-gradient(135deg, #6f63d8, #8a7ef0); }
.pillar-ico--3 { background: linear-gradient(135deg, #e6951b, #f5b133); }
.pillar-blurb { color: var(--muted); margin: 0 0 1rem; font-size: .95rem; }
.pillar-links { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .35rem; }
.pillar-links a { display: flex; align-items: center; gap: .35rem; color: var(--ink-2); font-weight: 600; font-size: .94rem; padding: .25rem 0; }
.pillar-links a:hover { color: var(--brand); }
.pillar-links .icon { width: 1rem; height: 1rem; color: var(--teal); }
.pillar-more { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; }
.pillar-more:hover .icon { transform: translateX(3px); }
.pillar-more .icon { transition: transform .15s ease; }

/* ===================== Content page shell ===================== */
.page-shell {
  max-width: var(--maxw); margin: 0 auto;
  padding: 1.2rem clamp(1rem, 3vw, 2rem) 1rem;
}

.breadcrumbs { margin: .4rem 0 1.2rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; margin: 0; padding: 0; font-size: .88rem; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: .15rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: .25rem; }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 700; }
.crumb-sep .icon { width: .9rem; height: .9rem; color: var(--border-strong); }
.breadcrumbs li:first-child .icon { width: 1rem; height: 1rem; }

/* ===================== Prose ===================== */
/* Fill the full width of the article container (not a narrow column), while
   the container itself stays inset from the page edges. */
.prose { max-width: none; width: 100%; }

.prose h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem); line-height: 1.12; letter-spacing: -.02em;
  margin: .2rem 0 1.1rem; font-weight: 850; color: var(--brand-strong);
  background: linear-gradient(100deg, #0f3d5e, #1c7fb8 60%, #0d9488);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.prose h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.8rem); margin: 2.2rem 0 .8rem; font-weight: 800; color: var(--brand-strong);
  padding-bottom: .35rem; border-bottom: 2px solid var(--surface-3); letter-spacing: -.01em;
}
.prose h3 { font-size: 1.25rem; margin: 1.7rem 0 .6rem; font-weight: 750; color: var(--brand); }
.prose h4 { font-size: 1.08rem; margin: 1.4rem 0 .5rem; font-weight: 700; color: var(--ink); }
.prose :is(h1, h2, h3, h4, h5, h6) { scroll-margin-top: calc(var(--header-h) + 16px); }

.prose p { margin: 0 0 1.05rem; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose ul, .prose ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.prose li { margin: .35rem 0; }
.prose li::marker { color: var(--teal); }

.prose blockquote {
  margin: 1.2rem 0; padding: .8rem 1.2rem; border-left: 4px solid var(--teal);
  background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink-2); box-shadow: var(--shadow-sm);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* links inside prose */
.prose a {
  color: var(--link); font-weight: 600; text-decoration: underline;
  text-decoration-color: rgba(21,101,160,.32); text-underline-offset: 3px; text-decoration-thickness: 1.5px;
  transition: color .15s ease, text-decoration-color .15s ease, background .15s ease;
}
.prose a:hover { color: var(--link-hover); text-decoration-color: var(--link-hover); }

.heading-anchor {
  margin-left: .4rem; color: var(--border-strong); text-decoration: none; font-weight: 700;
  opacity: 0; transition: opacity .15s ease, color .15s ease;
}
.prose :is(h1,h2,h3,h4):hover .heading-anchor { opacity: 1; }
.heading-anchor:hover { color: var(--teal); }

/* inline code — light bg, no border, low focus */
.prose :not(pre) > code {
  font-family: var(--mono); font-size: .88em;
  background: var(--inline-bg); color: var(--inline-ink);
  padding: .12em .42em; border-radius: 6px; border: none; white-space: break-spaces;
}

/* ===================== Code blocks ===================== */
.prose pre[class*="language-"], .prose pre {
  position: relative; margin: 1.3rem 0; padding: 1.05rem 1.15rem;
  background: var(--code-bg); border: 1px solid var(--code-border); border-radius: var(--radius);
  overflow: auto; box-shadow: var(--shadow-sm); font-size: .9rem; line-height: 1.6;
  -webkit-overflow-scrolling: touch; tab-size: 2;
}
.prose pre code { font-family: var(--mono); background: none; padding: 0; color: #243b4a; font-size: inherit; }
.prose pre::-webkit-scrollbar { height: 10px; }
.prose pre::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }

.code-copy {
  position: absolute; top: .55rem; right: .55rem;
  display: inline-flex; align-items: center; gap: .3rem;
  font: 600 .76rem/1 var(--font); color: var(--brand);
  background: rgba(255,255,255,.9); border: 1px solid var(--border-strong);
  padding: .35rem .55rem; border-radius: 8px; cursor: pointer; opacity: 0;
  transition: opacity .15s ease, background .15s ease, color .15s ease, transform .1s ease;
}
.prose pre:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { background: var(--brand); color: #fff; }
.code-copy .icon { width: 14px; height: 14px; }
.code-copy.copied { background: var(--teal-bright); color: #fff; border-color: var(--teal-bright); opacity: 1; }

/* Prism light token colors (match scheme) */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #7c8b97; font-style: italic; }
.token.punctuation { color: #5a6b78; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol { color: #b5561f; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #0a7d4d; }
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { color: #1565a0; }
.token.atrule, .token.attr-value, .token.keyword { color: #8a3ffc; }
.token.function, .token.class-name { color: #1c5b8c; font-weight: 600; }
.token.regex, .token.important, .token.variable { color: #b5561f; }
.token.important, .token.bold { font-weight: 700; }
.token.italic { font-style: italic; }

/* ===================== Tables ===================== */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.4rem 0;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--surface);
}
.prose table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: .92rem; }
.prose th, .prose td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose thead th { background: var(--brand-strong); color: #fff; font-weight: 700; white-space: nowrap; position: sticky; top: 0; }
.prose tbody tr:nth-child(even) { background: var(--surface-2); }
.prose tbody tr:hover { background: var(--brand-soft); }
.prose td code { white-space: nowrap; }

/* ===================== Task-list checkboxes ===================== */
.prose ul.contains-task-list { list-style: none; padding-left: .2rem; }
.prose ul.contains-task-list ul.contains-task-list { padding-left: 1.4rem; }
.prose li.task-list-item { display: flex; align-items: flex-start; gap: .6rem; margin: .45rem 0; }
.prose li.task-list-item::marker { content: ""; }
.prose li.task-list-item input.task-list-item-checkbox {
  appearance: none; -webkit-appearance: none; flex: none; cursor: pointer;
  width: 1.2em; height: 1.2em; margin: .15em 0 0; border: 2px solid var(--border-strong);
  border-radius: 6px; background: var(--surface); display: grid; place-content: center;
  transition: background .15s ease, border-color .15s ease;
}
.prose li.task-list-item input.task-list-item-checkbox:hover { border-color: var(--teal); }
.prose li.task-list-item input.task-list-item-checkbox::before {
  content: ""; width: .62em; height: .62em; transform: scale(0); transition: transform .12s ease;
  box-shadow: inset 1em 1em #fff; clip-path: polygon(14% 44%, 0 65%, 40% 100%, 100% 16%, 84% 0, 38% 70%);
}
.prose li.task-list-item input.task-list-item-checkbox:checked {
  background: linear-gradient(135deg, var(--teal), var(--teal-bright)); border-color: var(--teal);
}
.prose li.task-list-item input.task-list-item-checkbox:checked::before { transform: scale(1); }
.prose li.task-list-item input.task-list-item-checkbox:checked ~ * ,
.prose li.task-list-item.is-checked label { text-decoration: line-through; color: var(--muted); }

/* ===================== FAQ accordions ===================== */
.faq-accordion { display: grid; gap: .7rem; margin: 1.2rem 0; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.faq-item > summary {
  cursor: pointer; list-style: none; padding: .95rem 1.1rem; font-weight: 700; color: var(--brand-strong);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: "+"; font-size: 1.4rem; line-height: 1; color: var(--teal); transition: transform .2s ease;
}
.faq-item[open] > summary::after { transform: rotate(45deg); }
.faq-item:hover { border-color: var(--border-strong); }
.faq-answer { padding: 0 1.1rem 1rem; color: var(--ink-2); }

/* ===================== Mermaid / KaTeX ===================== */
pre.mermaid {
  position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; text-align: center; box-shadow: var(--shadow-sm); overflow-x: auto;
  cursor: zoom-in; transition: box-shadow .18s ease, border-color .18s ease;
}
pre.mermaid:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
pre.mermaid svg { max-width: 100%; height: auto; }
pre.mermaid::after {
  content: "⤢ Click to enlarge";
  position: absolute; top: .55rem; right: .7rem;
  font: 600 .72rem/1 var(--font); color: var(--brand);
  background: rgba(255,255,255,.92); border: 1px solid var(--border-strong);
  padding: .32rem .55rem; border-radius: 8px; opacity: 0;
  transition: opacity .15s ease; pointer-events: none;
}
pre.mermaid:hover::after, pre.mermaid:focus-visible::after { opacity: 1; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: .4rem 0; }

/* Fullscreen diagram lightbox */
.diagram-lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(1rem, 3vw, 2.5rem);
  background: rgba(12, 31, 47, .82); backdrop-filter: blur(4px);
  animation: lb-fade .15s ease;
}
.diagram-lightbox[hidden] { display: none; }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
.diagram-lightbox-inner {
  position: relative; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: clamp(1.6rem, 3vw, 2.6rem) clamp(1rem, 3vw, 2.4rem);
  width: 100%; max-width: 1400px; max-height: 94vh; overflow: auto;
}
.diagram-lightbox-content { display: flex; align-items: center; justify-content: center; }
.diagram-lightbox-content svg {
  width: 100%; height: auto; max-width: none !important; max-height: 84vh;
}
.diagram-lightbox-close {
  position: absolute; top: .6rem; right: .6rem; z-index: 1;
  width: 42px; height: 42px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--brand-strong);
  font-size: 1.6rem; line-height: 1; display: grid; place-items: center;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.diagram-lightbox-close:hover { background: var(--brand); color: #fff; }
.diagram-lightbox-hint { margin: .8rem 0 0; text-align: center; font-size: .82rem; color: var(--muted); }
body.lightbox-open { overflow: hidden; }

/* ===================== Related content ===================== */
.related { max-width: 100%; margin: 2.6rem 0 1rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.related-group { margin-bottom: 1.8rem; }
.related-heading { display: flex; align-items: center; gap: .55rem; font-size: 1.15rem; color: var(--brand-strong); margin: 0 0 1rem; }
.related-heading .icon { color: var(--teal); }
.related-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.related-cards a {
  display: flex; flex-direction: column; gap: .3rem; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); color: var(--ink);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.related-cards a:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.related-title { font-weight: 750; color: var(--brand-strong); line-height: 1.3; }
.related-desc { font-size: .85rem; color: var(--muted); line-height: 1.5; }
.related-cta { margin-top: auto; display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; font-weight: 700; color: var(--teal); }
.related-cta .icon { width: 1rem; height: 1rem; transition: transform .15s ease; }
.related-cards a:hover .related-cta .icon { transform: translateX(3px); }
.related-cards--compact a { flex-direction: row; align-items: center; justify-content: space-between; }
.related-cards--compact .related-title { font-size: .95rem; }
.related-up { display: inline-flex; align-items: center; gap: .35rem; font-weight: 650; }
.related-up .icon { transform: rotate(180deg); width: 1rem; height: 1rem; color: var(--muted); }

/* ===================== Responsive ===================== */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    position: fixed; inset: var(--header-h) 0 auto 0; margin: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow); padding: .6rem clamp(1rem, 3vw, 2rem) 1rem;
    transform: translateY(-130%); transition: transform .25s ease; visibility: hidden;
  }
  .primary-nav.open { transform: translateY(0); visibility: visible; }
  .primary-nav ul { flex-direction: column; gap: .25rem; }
  .nav-link { width: 100%; font-size: 1rem; padding: .7rem .9rem; border-radius: var(--radius-sm); }
}
@media (max-width: 560px) {
  .brand-sub { display: none; }
  .cta { flex-wrap: wrap; }
}

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