/* =========================================================================
   backupvalidation.org — design system
   Light, professional palette. Wide on desktop, elegant on mobile.
   ========================================================================= */

:root {
  /* Brand / accent palette */
  --teal-900: #0e7490;
  --teal-700: #0891b2;
  --teal-500: #14b8a6;
  --teal-100: #cffafe;
  --teal-50:  #ecfeff;

  --amber-500: #f59e0b;
  --green-500: #22c55e;
  --violet-500: #7c3aed;
  --rose-500: #e11d48;

  /* Ink + surfaces */
  --ink:        #0f172a;
  --ink-soft:   #334155;
  --ink-muted:  #64748b;
  --surface:    #ffffff;
  --surface-2:  #f7fafc;
  --surface-3:  #eef2f6;
  --border:     #e2e8f0;
  --border-strong: #cbd5e1;

  /* Links */
  --link:       #0e7490;
  --link-hover: #0b5566;

  /* Code (light theme) */
  --code-bg:        #f6f9fb;
  --code-bar-bg:    #eef4f7;
  --code-border:    #dbe6ec;
  --inline-code-bg: #eef4f7;
  --inline-code-fg: #0b5566;

  /* Radii, shadow, motion */
  --radius:    14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.12);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Layout */
  --header-h: 64px;
  --content-max: 1480px;
  --measure-max: 78ch;

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

/* ------------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px); /* in-page anchors clear sticky header */
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.97rem + 0.18vw, 1.075rem);
  line-height: 1.7;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--teal-50), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, #f0fbff, transparent 55%),
    var(--surface-2);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* sticky footer */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--ink); font-weight: 700; }

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

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

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

.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;
}

.skip-link {
  position: fixed; top: 8px; left: 8px;
  transform: translateY(-150%);
  background: var(--teal-900); color: #fff;
  padding: 0.6rem 1rem; border-radius: var(--radius-sm);
  z-index: 200; transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translateY(0); color: #fff; }

/* ------------------------------------------------------------- containers */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3.5vw, 2.75rem);
}

/* =============================================================== header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand__mark { width: 34px; height: 34px; transition: transform 0.4s var(--ease); }
.brand:hover .brand__mark { transform: rotate(-8deg) scale(1.06); }
.brand__name { font-size: 1.02rem; }
.brand__name b { color: var(--teal-900); }

.nav { margin-left: auto; }
.nav__list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0; padding: 0;
}
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav__link .icon { color: var(--teal-700); transition: transform 0.2s var(--ease); }
.nav__link:hover { background: var(--teal-50); color: var(--teal-900); }
.nav__link:hover .icon { transform: translateY(-1px) scale(1.08); }
.nav__link[aria-current="page"] {
  background: linear-gradient(120deg, var(--teal-900), var(--teal-700));
  color: #fff;
}
.nav__link[aria-current="page"] .icon { color: #fff; }

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
  align-items: center; justify-content: center;
}
.nav-toggle:hover { background: var(--teal-50); }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    margin: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-120%);
    transition: transform 0.28s var(--ease);
    visibility: hidden;
  }
  .nav.is-open { transform: translateY(0); visibility: visible; }
  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem clamp(1rem, 4vw, 1.5rem) 1.1rem;
  }
  .nav__link { padding: 0.8rem 0.9rem; font-size: 1.02rem; }
}

/* ================================================================== main */
main { flex: 1 0 auto; }
.page { padding-block: clamp(1.6rem, 3vw, 2.75rem) clamp(2.5rem, 5vw, 4rem); }

/* =============================================================== hero */
.hero { text-align: center; padding-block: clamp(1.5rem, 4vw, 3.25rem) clamp(1rem, 3vw, 2rem); }
.hero__logo {
  display: block;
  width: clamp(110px, 18vw, 168px);
  height: auto;
  margin: 0 auto clamp(1rem, 2.5vw, 1.75rem);
  filter: drop-shadow(0 12px 24px rgba(8, 145, 178, 0.22));
  transition: transform 0.5s var(--ease);
}
.hero__logo:hover { transform: translateY(-4px) rotate(-2deg); }
.hero h1 {
  font-size: clamp(2rem, 1.3rem + 3.2vw, 3.4rem);
  letter-spacing: -0.02em;
  margin: 0 auto 0.75rem;
  max-width: 20ch;
  background: linear-gradient(120deg, var(--teal-900), var(--teal-500) 60%, var(--violet-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__lead {
  max-width: 72ch;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.2rem);
}
.hero__sub { max-width: 88ch; margin: 1rem auto 0; color: var(--ink-muted); }

/* CTA buttons with colorful icons — span the full container, like the sections below */
.cta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
  margin: clamp(1.75rem, 4vw, 2.75rem) auto 0;
  max-width: none;
}
@media (max-width: 860px) { .cta-grid { grid-template-columns: 1fr; } }
.cta {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
  padding: 1.05rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.cta:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--teal-100);
}
.cta__icon {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 13px;
  color: #fff;
}
.cta__icon .icon { width: 26px; height: 26px; }
.cta--architecture .cta__icon { background: linear-gradient(135deg, var(--teal-700), var(--teal-500)); }
.cta--integrity   .cta__icon { background: linear-gradient(135deg, var(--violet-500), #a855f7); }
.cta--drills      .cta__icon { background: linear-gradient(135deg, var(--amber-500), #fbbf24); }
.cta__body { display: flex; flex-direction: column; }
.cta__title { font-weight: 700; color: var(--ink); }
.cta__desc { font-size: 0.9rem; color: var(--ink-muted); }
.cta__arrow { margin-left: auto; color: var(--teal-700); transition: transform 0.2s var(--ease); }
.cta:hover .cta__arrow { transform: translateX(4px); }

/* =============================================================== sections */
.section { margin-top: clamp(2.5rem, 5vw, 4rem); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section__title {
  font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.9rem);
  letter-spacing: -0.01em;
}
.section__title .accent { color: var(--teal-700); }
.section__intro { color: var(--ink-soft); max-width: var(--measure-max); margin-top: 0.4rem; }

/* card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.1rem;
  margin-top: 1.4rem;
  list-style: none; padding: 0;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.25rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0;
  height: 4px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--teal-700), var(--teal-500), var(--violet-500));
  opacity: 0; transition: opacity 0.25s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--teal-100); }
.card:hover::before { opacity: 1; }
.card__kicker { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--teal-700); font-weight: 700; }
.card__title { font-size: 1.12rem; margin: 0; }
.card__title a { color: var(--ink); }
.card__title a:hover { color: var(--teal-900); }
.card__title a::after { content: ""; position: absolute; inset: 0; } /* full-card click */
.card__desc { color: var(--ink-muted); font-size: 0.95rem; margin: 0; }

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

/* =============================================================== article */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
}
@media (min-width: 1080px) {
  .article-layout.has-toc { grid-template-columns: minmax(0, 1fr) 250px; }
}

.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.4rem, 3.5vw, 3rem);
}
/* Article text uses the full width of its container (the card), not a narrow column. */
.article > * { max-width: 100%; }

.article h1 {
  font-size: clamp(1.85rem, 1.3rem + 2vw, 2.85rem);
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
  background: linear-gradient(110deg, var(--teal-900), var(--teal-600, #0a6b86) 40%, var(--violet-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.article h2 {
  font-size: clamp(1.35rem, 1.1rem + 0.9vw, 1.7rem);
  margin: 2.2rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--surface-3);
}
.article h2 .header-anchor,
.article h3 .header-anchor,
.article h1 .header-anchor { color: inherit; }
.article h2 .header-anchor:hover,
.article h3 .header-anchor:hover { color: var(--teal-700); }
.article h3 { font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.35rem); margin: 1.6rem 0 0.6rem; color: var(--ink); }
.article h4 { font-size: 1.08rem; margin: 1.3rem 0 0.5rem; color: var(--ink-soft); }
.article p { margin: 0 0 1.05rem; color: var(--ink-soft); }
.article ul, .article ol { margin: 0 0 1.1rem; padding-left: 1.4rem; color: var(--ink-soft); }
.article li { margin: 0.3rem 0; }
.article li::marker { color: var(--teal-700); }
.article strong { color: var(--ink); }
.article a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--teal-100);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  transition: color 0.18s var(--ease), text-decoration-color 0.18s var(--ease);
}
.article a:hover { color: var(--link-hover); text-decoration-color: var(--teal-500); }

.article blockquote {
  margin: 1.2rem 0;
  padding: 0.8rem 1.1rem;
  border-left: 4px solid var(--teal-500);
  background: var(--teal-50);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
}
.article hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* inline code — light, borderless, blends with text */
.article :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--inline-code-bg);
  color: var(--inline-code-fg);
  padding: 0.12em 0.4em;
  border-radius: 6px;
  border: 0;
  word-break: break-word;
}

/* =============================================================== code blocks */
.code-block {
  margin: 1.4rem 0;
  border: 1px solid var(--code-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: var(--shadow-sm);
}
.code-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  background: var(--code-bar-bg);
  border-bottom: 1px solid var(--code-border);
}
.code-block__lang {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 700;
}
.code-block__copy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--code-border);
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.32rem 0.6rem;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.code-block__copy:hover { background: var(--teal-50); color: var(--teal-900); border-color: var(--teal-100); }
.code-block__copy.is-copied { background: var(--green-500); color: #fff; border-color: var(--green-500); }
.code-block__pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.6;
  color: #25313c;
  tab-size: 4;
}
.code-block__pre code { font-family: inherit; background: none; padding: 0; }

/* Prism light token theme tuned to the site palette */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #8a99a6; font-style: italic; }
.token.punctuation { color: #5b6b78; }
.token.namespace { opacity: 0.7; }
.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: #0a7d6b; }
.token.operator, .token.entity, .token.url,
.language-css .token.string, .style .token.string { color: #0e7490; }
.token.atrule, .token.attr-value, .token.keyword { color: #7c3aed; }
.token.function, .token.class-name { color: #0369a1; }
.token.regex, .token.important, .token.variable { color: #be185d; }
.token.important, .token.bold { font-weight: 700; }
.token.italic { font-style: italic; }

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

/* =============================================================== task lists */
.article ul.contains-task-list { list-style: none; padding-left: 0.2rem; }
.task-list-item { display: flex; align-items: flex-start; gap: 0.6rem; }
.task-list-item::marker { content: ""; }
.task-list-item-checkbox {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 1.15em; height: 1.15em;
  margin-top: 0.28em;
  border: 2px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  display: grid; place-content: center;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.task-list-item-checkbox::before {
  content: "";
  width: 0.62em; height: 0.62em;
  transform: scale(0);
  transform-origin: center;
  transition: transform 0.12s var(--ease);
  box-shadow: inset 1em 1em #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.task-list-item-checkbox:checked { background: var(--teal-700); border-color: var(--teal-700); }
.task-list-item-checkbox:checked::before { transform: scale(1); }
.task-list-item.is-done > label,
.task-list-item.is-done { text-decoration: line-through; color: var(--ink-muted); text-decoration-color: var(--teal-500); }

/* =============================================================== accordions (FAQ) */
.accordion { margin: 1.4rem 0; display: flex; flex-direction: column; gap: 0.6rem; }
.accordion__item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.accordion__item[open] { border-color: var(--teal-100); box-shadow: var(--shadow-sm); }
.accordion__q {
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.95rem 1.1rem;
  font-weight: 650;
  color: var(--ink);
  background: var(--surface);
  transition: background 0.18s var(--ease);
}
.accordion__q::-webkit-details-marker { display: none; }
.accordion__q:hover { background: var(--teal-50); }
.accordion__q::after {
  content: "";
  flex: 0 0 auto;
  width: 11px; height: 11px;
  border-right: 2px solid var(--teal-700);
  border-bottom: 2px solid var(--teal-700);
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease);
}
.accordion__item[open] .accordion__q::after { transform: rotate(-135deg); }
.accordion__a { padding: 0 1.1rem 1.1rem; color: var(--ink-soft); }
.accordion__a > :first-child { margin-top: 0; }

/* =============================================================== mermaid */
.mermaid-wrap {
  margin: 1.4rem 0;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  text-align: center;
}
.mermaid:not([data-processed]) { color: transparent; } /* hide raw text until rendered */
.mermaid svg { max-width: 100%; height: auto; }

/* Zoomable diagram + expand affordance */
.mermaid-wrap.is-zoomable { position: relative; cursor: zoom-in; }
.mermaid-wrap.is-zoomable:hover { border-color: var(--teal-100); box-shadow: var(--shadow-md); }
.diagram-expand {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--teal-900);
  cursor: zoom-in;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), background 0.18s var(--ease);
}
.mermaid-wrap.is-zoomable:hover .diagram-expand,
.diagram-expand:focus-visible { opacity: 1; transform: translateY(0); }
.diagram-expand:hover { background: var(--teal-50); }
@media (hover: none) { .diagram-expand { opacity: 1; transform: none; } } /* always visible on touch */

.diagram-caption {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.86rem;
  color: var(--ink-muted);
}
.diagram-caption strong { color: var(--ink-soft); }

/* Full-screen diagram modal */
body.modal-open { overflow: hidden; }
.diagram-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  animation: bv-fade 0.18s var(--ease);
}
.diagram-modal[hidden] { display: none; }
@keyframes bv-fade { from { opacity: 0; } to { opacity: 1; } }
.diagram-modal__toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
}
.diagram-modal__btn {
  min-width: 42px;
  height: 42px;
  padding: 0 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.diagram-modal__btn:hover { background: rgba(255, 255, 255, 0.24); border-color: rgba(255, 255, 255, 0.5); }
.diagram-modal__btn--close { background: rgba(225, 29, 72, 0.85); border-color: transparent; }
.diagram-modal__btn--close:hover { background: #e11d48; }
.diagram-modal__stage {
  flex: 1 1 auto;
  overflow: hidden;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}
.diagram-modal__stage.is-grabbing { cursor: grabbing; }
.diagram-modal__canvas {
  transform-origin: center center;
  will-change: transform;
}
/* No size cap here — JS computes a fit-to-screen scale so small diagrams enlarge. */
.diagram-modal__canvas svg {
  display: block;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 1.2rem;
  box-shadow: var(--shadow-lg);
}

/* =============================================================== TOC */
.toc {
  position: sticky;
  top: calc(var(--header-h) + 1.2rem);
  align-self: start;
  font-size: 0.9rem;
}
.toc__title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); font-weight: 700; margin-bottom: 0.6rem; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc li { margin: 0; }
.toc a { display: block; padding: 0.3rem 0 0.3rem 0.9rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--ink-muted); }
.toc a:hover { color: var(--teal-900); border-left-color: var(--teal-500); }
@media (max-width: 1079px) { .toc { display: none; } }

/* =============================================================== related nav */
.related { margin-top: 2.25rem; }
.related__title { font-size: 1.05rem; margin-bottom: 0.8rem; color: var(--ink); }
.pager { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }
.pager a {
  flex: 1 1 220px;
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.pager a:hover { border-color: var(--teal-100); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pager .pager__dir { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-muted); }
.pager .pager__title { font-weight: 650; color: var(--ink); }
.pager .pager--next { text-align: right; }

/* =============================================================== footer */
.site-footer {
  flex-shrink: 0;
  margin-top: clamp(2.5rem, 6vw, 5rem);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border-top: 1px solid var(--border);
}
.site-footer__inner { padding-block: 2.25rem 2rem; display: grid; gap: 1.75rem; grid-template-columns: 1.3fr 2fr; }
@media (max-width: 720px) { .site-footer__inner { grid-template-columns: 1fr; } }
.footer-brand { display: flex; gap: 0.7rem; align-items: flex-start; }
.footer-brand__mark { width: 40px; height: 40px; flex: 0 0 auto; }
.footer-brand__text { color: var(--ink-muted); font-size: 0.92rem; max-width: 42ch; }
.footer-brand__text strong { color: var(--ink); display: block; margin-bottom: 0.2rem; }
.footer-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.25rem; }
.footer-nav h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); margin: 0 0 0.6rem; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; }
.footer-nav li { margin: 0.3rem 0; }
.footer-nav a { color: var(--ink-soft); font-size: 0.92rem; }
.footer-nav a:hover { color: var(--teal-900); }
.footer-bottom { border-top: 1px solid var(--border); }
.footer-bottom__inner { padding-block: 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; justify-content: space-between; color: var(--ink-muted); font-size: 0.85rem; }

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

/* =============================================================== utilities */
.lead { font-size: 1.15rem; color: var(--ink-soft); }
.center { text-align: center; }
