/* ============================================================================
   Maritime Shipping Docs — Design System
   Light, elegant, professional maritime palette.
   ========================================================================== */

:root {
  /* Brand palette */
  --c-deep: #0f4c5c;      /* primary deep teal */
  --c-deep-700: #0b3a47;
  --c-teal: #2a9d8f;      /* secondary teal */
  --c-blue: #457b9d;      /* steel blue */
  --c-sand: #e9c46a;      /* gold accent */
  --c-coral: #e76f51;     /* warm accent */
  --c-rose: #d1495b;      /* alert / warm */

  /* Neutrals */
  --ink: #14323b;
  --body: #2c3e44;
  --muted: #5d7177;
  --line: #d7e3e6;
  --line-soft: #e7eff1;
  --bg: #f4f8fb;
  --bg-tint: #eaf2f4;
  --surface: #ffffff;
  --surface-2: #f7fbfc;

  /* Code */
  --code-bg: #f2f7f8;
  --code-border: #dce8ea;
  --code-inline-bg: #e8f1f2;
  --code-ink: #243b41;

  /* Typography */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

  /* Scale */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --step-1: clamp(1.2rem, 1.12rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.45rem, 1.3rem + 0.7vw, 1.85rem);
  --step-3: clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  --step-4: clamp(2.1rem, 1.7rem + 2vw, 3.4rem);

  /* Layout */
  --header-h: 4.25rem;
  --page-max: 1500px;
  --prose-max: 1180px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(15, 76, 92, 0.06), 0 2px 6px rgba(15, 76, 92, 0.05);
  --shadow: 0 6px 20px rgba(15, 76, 92, 0.10);
  --shadow-lg: 0 16px 40px rgba(15, 76, 92, 0.16);
  --ring: 0 0 0 3px rgba(42, 157, 143, 0.35);
  --t-fast: 140ms ease;
  --t: 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* --------------------------------------------------------------- Reset/base */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.7;
  color: var(--body);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--bg-tint), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, #eef6f7, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.2px;
}

a {
  color: var(--c-deep);
  text-decoration: none;
  text-underline-offset: 0.16em;
  transition: color var(--t-fast), text-decoration-color var(--t-fast);
}
a:hover { color: var(--c-teal); text-decoration: underline; text-decoration-color: var(--c-teal); }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 4px; }

.skip-link {
  position: absolute; left: 0.75rem; top: -3rem;
  background: var(--c-deep); color: #fff; padding: 0.6rem 1rem;
  border-radius: var(--radius-sm); z-index: 200; transition: top var(--t);
}
.skip-link:focus { top: 0.75rem; color: #fff; }

/* ----------------------------------------------------------------- Layout */
.wrap { width: min(94vw, var(--page-max)); margin-inline: auto; }
.prose-wrap { width: min(92vw, var(--prose-max)); margin-inline: auto; }

main { flex: 1 0 auto; padding-block: clamp(1.5rem, 1rem + 2vw, 3rem); }

/* ----------------------------------------------------------------- Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.site-header__inner {
  width: min(94vw, var(--page-max)); margin-inline: auto;
  min-height: var(--header-h);
  display: flex; align-items: center; gap: 1rem; justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); }
.brand:hover { color: var(--c-deep); text-decoration: none; }
.brand__mark { width: 2.5rem; height: 2.5rem; transition: transform var(--t); filter: drop-shadow(0 2px 4px rgba(15,76,92,.18)); }
.brand:hover .brand__mark { transform: rotate(-6deg) scale(1.05); }
.brand__name { font-weight: 700; color: var(--c-deep); font-size: 1.12rem; line-height: 1.05; }
.brand__name small { display: block; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-family: var(--font-body); }

.nav { display: flex; align-items: center; gap: 0.35rem; }
.nav a {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.5rem 0.8rem; border-radius: 999px;
  color: var(--ink); font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; transition: all var(--t);
}
.nav a svg { width: 1.15rem; height: 1.15rem; flex: none; }
.nav a:hover { background: var(--bg-tint); color: var(--c-deep); text-decoration: none; transform: translateY(-1px); }
.nav a[aria-current="page"] { background: var(--c-deep); color: #fff; box-shadow: var(--shadow-sm); }
.nav a[aria-current="page"]:hover { background: var(--c-deep-700); color: #fff; }

.nav-toggle { display: none; }

/* ------------------------------------------------------------- Mobile nav */
@media (max-width: 820px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.7rem; height: 2.7rem; border-radius: 10px;
    background: var(--surface); border: 1px solid var(--line); color: var(--c-deep);
    cursor: pointer; transition: all var(--t);
  }
  .nav-toggle:hover { background: var(--bg-tint); }
  .nav {
    position: absolute; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0.25rem;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 0.75rem clamp(0.75rem, 4vw, 2rem); box-shadow: var(--shadow);
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity var(--t), transform var(--t);
  }
  .nav[data-open="true"] { transform: none; opacity: 1; pointer-events: auto; }
  .nav a { justify-content: flex-start; border-radius: 10px; }
}

/* ----------------------------------------------------------------- Footer */
.site-footer {
  flex-shrink: 0;
  margin-top: 3rem;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border-top: 1px solid var(--line);
  color: var(--body);
}
.site-footer__inner {
  width: min(94vw, var(--page-max)); margin-inline: auto;
  display: grid; gap: 2rem; padding-block: 2.5rem 1.5rem;
  grid-template-columns: 1.4fr repeat(3, 1fr);
}
.site-footer h2 { font-size: 1.05rem; color: var(--c-deep); margin-bottom: 0.75rem; }
.footer-brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.footer-brand img { width: 2.4rem; height: 2.4rem; }
.footer-col ul { list-style: none; padding: 0; display: grid; gap: 0.4rem; }
.footer-col a { color: var(--body); font-size: 0.95rem; }
.footer-col a:hover { color: var(--c-teal); }
.footer-bottom {
  border-top: 1px solid var(--line-soft); padding: 1rem 0 2rem;
  width: min(94vw, var(--page-max)); margin-inline: auto;
  color: var(--muted); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between;
}
@media (max-width: 820px) {
  .site-footer__inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .site-footer__inner { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------- Buttons/CTA */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.8rem 1.3rem; border-radius: 999px;
  font-weight: 700; font-size: 1rem; cursor: pointer;
  border: 1px solid transparent; transition: transform var(--t), box-shadow var(--t), background var(--t);
}
.btn svg { width: 1.3rem; height: 1.3rem; flex: none; }
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn--primary { background: var(--c-deep); color: #fff; box-shadow: var(--shadow); }
.btn--primary:hover { background: var(--c-deep-700); color: #fff; box-shadow: var(--shadow-lg); }
.btn--ghost { background: var(--surface); color: var(--c-deep); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn--ghost:hover { background: var(--bg-tint); color: var(--c-deep); }

/* CTA cards with colorful icons */
.cta-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 1.5rem; }
.cta {
  display: flex; align-items: center; gap: 0.9rem; text-align: left;
  padding: 1.1rem 1.2rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  color: var(--ink); font-weight: 600; transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.cta:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--c-teal); text-decoration: none; color: var(--ink); }
.cta__icon {
  flex: none; width: 3rem; height: 3rem; border-radius: 14px;
  display: grid; place-items: center; color: #fff;
}
.cta__icon svg { width: 1.6rem; height: 1.6rem; }
.cta__icon--1 { background: linear-gradient(135deg, var(--c-teal), var(--c-deep)); }
.cta__icon--2 { background: linear-gradient(135deg, var(--c-blue), #2c5f7c); }
.cta__icon--3 { background: linear-gradient(135deg, var(--c-coral), var(--c-rose)); }
.cta__icon--4 { background: linear-gradient(135deg, var(--c-sand), var(--c-coral)); }
.cta small { display: block; font-weight: 500; color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; }

/* ----------------------------------------------------------------- Hero */
.hero { text-align: center; padding-block: clamp(1rem, 2vw, 2.5rem) 1rem; }
.hero__logo { width: clamp(7rem, 16vw, 11rem); height: auto; margin: 0 auto 1.25rem; display: block;
  filter: drop-shadow(0 10px 24px rgba(15,76,92,.22)); transition: transform var(--t); }
.hero__logo:hover { transform: translateY(-4px) rotate(-2deg); }
.hero h1 {
  font-size: var(--step-4);
  background: linear-gradient(120deg, var(--c-deep), var(--c-teal) 55%, var(--c-blue));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 0.5rem;
}
.hero__tagline { font-size: var(--step-1); color: var(--c-deep); font-family: var(--font-display); }
.hero__lead { max-width: min(94vw, 1280px); margin: 1.25rem auto 0; color: var(--body); }
.hero__cta { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; margin-top: 1.75rem; }

.section-head { text-align: center; margin: 3rem 0 0.5rem; }
.section-head h2 { font-size: var(--step-3); color: var(--ink); }
.section-head p { color: var(--muted); max-width: 60ch; margin: 0.5rem auto 0; }

/* ----------------------------------------------------------------- Cards */
.card-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); margin-top: 1.75rem; }
.card {
  display: flex; flex-direction: column; gap: 0.6rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-sm);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--c-teal); }
.card__badge { width: 2.8rem; height: 2.8rem; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.card__badge svg { width: 1.5rem; height: 1.5rem; }
.card h3 { font-size: var(--step-1); }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--c-deep); }
.card p { color: var(--body); font-size: 0.97rem; }
.card__links { list-style: none; padding: 0; margin-top: auto; display: grid; gap: 0.3rem; }
.card__links a { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.92rem; }
.card__links a::before { content: "›"; color: var(--c-teal); font-weight: 700; }

/* ----------------------------------------------------------- Breadcrumbs */
.breadcrumbs { font-size: 0.88rem; color: var(--muted); margin-bottom: 1.25rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 0.4rem; }
.breadcrumbs li:not(:last-child)::after { content: "›"; color: var(--c-teal); }
.breadcrumbs a { color: var(--muted); font-weight: 600; }
.breadcrumbs a:hover { color: var(--c-deep); }
.breadcrumbs [aria-current="page"] { color: var(--c-deep); font-weight: 700; }

/* ----------------------------------------------------------------- Prose */
.prose { font-size: var(--step-0); }
.prose > * + * { margin-top: 1.15rem; }
.prose h1 {
  font-size: var(--step-3); margin-bottom: 0.4rem;
  background: linear-gradient(110deg, var(--c-deep), var(--c-teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.prose h2 {
  font-size: var(--step-2); margin-top: 2.4rem; padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--line); color: var(--c-deep);
  position: relative;
}
.prose h2::before {
  content: ""; position: absolute; left: 0; bottom: -2px; width: 3.5rem; height: 2px;
  background: linear-gradient(90deg, var(--c-teal), var(--c-sand));
}
.prose h3 { font-size: var(--step-1); margin-top: 1.8rem; color: var(--c-deep-700); }
.prose h4 { font-size: 1.1rem; margin-top: 1.4rem; color: var(--ink); }
.prose p { color: var(--body); }
.prose strong { color: var(--ink); font-weight: 700; }
.prose a { color: var(--c-blue); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(69,123,157,.35); }
.prose a:hover { color: var(--c-deep); text-decoration-color: var(--c-deep); }

.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-block: 0.35rem; }
.prose ul > li::marker { color: var(--c-teal); }
.prose ol > li::marker { color: var(--c-blue); font-weight: 700; }

.prose blockquote {
  border-left: 4px solid var(--c-teal); background: var(--surface-2);
  padding: 0.8rem 1.1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink);
}
.prose hr { border: none; height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); margin: 2rem 0; }

/* Heading anchor link */
.heading-anchor {
  margin-left: 0.5rem; color: var(--c-teal); opacity: 0; font-weight: 400;
  text-decoration: none; transition: opacity var(--t);
}
h2:hover .heading-anchor, h3:hover .heading-anchor, h4:hover .heading-anchor { opacity: 0.8; }
.heading-anchor:hover { opacity: 1; text-decoration: none; }
:is(h1,h2,h3,h4)[id] { scroll-margin-top: calc(var(--header-h) + 1rem); }

/* ----------------------------------------------------------- Inline code */
.prose :not(pre) > code {
  font-family: var(--font-mono); font-size: 0.88em;
  background: var(--code-inline-bg); color: var(--code-ink);
  padding: 0.12em 0.4em; border-radius: 6px; border: none;
  white-space: break-spaces;
}

/* ------------------------------------------------------------- Code blocks */
.code-block { position: relative; margin-block: 1.4rem; }
.prose pre[class*="language-"] {
  background: var(--code-bg); color: var(--code-ink);
  border: 1px solid var(--code-border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; overflow: auto; font-size: 0.86rem; line-height: 1.6;
  box-shadow: var(--shadow-sm); tab-size: 4;
}
.prose pre[class*="language-"] code { font-family: var(--font-mono); background: none; padding: 0; border: none; font-size: inherit; color: inherit; }

.code-copy {
  position: absolute; top: 0.55rem; right: 0.55rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.76rem; font-weight: 600; font-family: var(--font-body);
  background: var(--surface); color: var(--c-deep);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.3rem 0.55rem;
  cursor: pointer; opacity: 0; transition: opacity var(--t), background var(--t), color var(--t);
}
.code-block:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { background: var(--c-deep); color: #fff; border-color: var(--c-deep); }
.code-copy svg { width: 0.95rem; height: 0.95rem; }
.code-copy.is-copied { background: var(--c-teal); color: #fff; border-color: var(--c-teal); opacity: 1; }

/* Prism light token theme tuned to palette */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #7c8f95; font-style: italic; }
.token.punctuation { color: #5d7177; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol { color: #b5562f; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #1f7a6d; }
.token.operator, .token.entity, .token.url { color: #457b9d; }
.token.atrule, .token.attr-value, .token.keyword { color: #0f6f8a; font-weight: 600; }
.token.function, .token.class-name { color: #c25a35; }
.token.regex, .token.important, .token.variable { color: #d1495b; }
.token.deleted { color: #d1495b; }

/* ----------------------------------------------------------------- Tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-block: 1.4rem; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.92rem; min-width: 32rem; }
.prose thead { background: var(--c-deep); color: #fff; }
.prose th, .prose td { padding: 0.7rem 0.95rem; text-align: left; border-bottom: 1px solid var(--line); }
.prose th { font-family: var(--font-body); font-weight: 700; }
.prose tbody tr:nth-child(even) { background: var(--surface-2); }
.prose tbody tr:hover { background: var(--bg-tint); }

/* --------------------------------------------------------- Task list items */
.prose ul.contains-task-list, .prose .contains-task-list { list-style: none; padding-left: 0.2rem; }
.prose li.task-list-item { display: flex; align-items: flex-start; gap: 0.6rem; margin-block: 0.5rem; list-style: none; }
.prose li.task-list-item::marker { content: ""; }
.prose li.task-list-item input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 1.2rem; height: 1.2rem; margin-top: 0.25rem;
  border: 2px solid var(--c-teal); border-radius: 6px; background: var(--surface);
  cursor: pointer; display: grid; place-content: center; transition: all var(--t-fast);
}
.prose li.task-list-item input[type="checkbox"]::before {
  content: ""; width: 0.7rem; height: 0.7rem; transform: scale(0); transform-origin: center;
  transition: transform var(--t-fast); background: #fff;
  clip-path: polygon(14% 44%, 0 60%, 40% 100%, 100% 22%, 86% 8%, 40% 72%);
}
.prose li.task-list-item input[type="checkbox"]:checked { background: var(--c-teal); border-color: var(--c-teal); }
.prose li.task-list-item input[type="checkbox"]:checked::before { transform: scale(1); }
.prose li.task-list-item input[type="checkbox"]:hover { border-color: var(--c-deep); box-shadow: 0 0 0 4px rgba(42,157,143,.12); }
.prose li.task-list-item label, .prose li.task-list-item > span { transition: color var(--t-fast), opacity var(--t-fast); }
.prose li.task-list-item input[type="checkbox"]:checked + label,
.prose li.task-list-item.is-checked label,
.prose li.task-list-item.is-checked > span { text-decoration: line-through; color: var(--muted); }

/* ------------------------------------------------------------- Accordion/FAQ */
.faq { margin-block: 1.4rem; display: grid; gap: 0.7rem; }
details.accordion, .prose details {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow var(--t);
}
details.accordion[open], .prose details[open] { box-shadow: var(--shadow); }
details > summary, .prose details > summary {
  cursor: pointer; list-style: none; padding: 1rem 1.2rem; font-weight: 700;
  font-family: var(--font-display); color: var(--c-deep); display: flex; align-items: center;
  justify-content: space-between; gap: 1rem;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: "+"; font-size: 1.4rem; color: var(--c-teal); transition: transform var(--t); line-height: 1;
}
details[open] > summary::after { transform: rotate(45deg); }
details > summary:hover { background: var(--bg-tint); }
.accordion__body, details > *:not(summary) { padding: 0 1.2rem 1.1rem; color: var(--body); }

/* ------------------------------------------------------------- Related links */
.related { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.related h2 { font-size: var(--step-1); color: var(--c-deep); margin-bottom: 1rem; }
.related__grid { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.related__item {
  display: block; padding: 0.9rem 1.1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  font-weight: 600; color: var(--ink); transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.related__item:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--c-teal); color: var(--c-deep); text-decoration: none; }
.related__item span { display: block; font-weight: 500; font-size: 0.82rem; color: var(--muted); margin-top: 0.15rem; }

/* ----------------------------------------------------------------- Mermaid */
.mermaid {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem; margin-block: 1.4rem; box-shadow: var(--shadow-sm); text-align: center; overflow-x: auto;
}
.mermaid:not([data-processed]) { color: var(--muted); font-family: var(--font-mono); font-size: 0.85rem; }
.mermaid[data-processed] { transition: box-shadow var(--t), border-color var(--t); }
.mermaid[data-zoom-ready]:hover { box-shadow: var(--shadow); border-color: var(--c-teal); }

/* --------------------------------------------- Zoomable visualizations */
.viz { position: relative; cursor: zoom-in; }
.viz svg { pointer-events: none; }   /* let clicks bubble to the container */
.viz__expand {
  position: absolute; top: 0.6rem; right: 0.6rem; z-index: 2;
  display: inline-flex; align-items: center; gap: 0.35rem; cursor: zoom-in;
  font-size: 0.74rem; font-weight: 600; font-family: var(--font-body);
  background: var(--surface); color: var(--c-deep);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.3rem 0.55rem;
  opacity: 0; transition: opacity var(--t), background var(--t), color var(--t);
}
.viz:hover .viz__expand, .viz__expand:focus-visible { opacity: 1; }
.viz__expand:hover { background: var(--c-deep); color: #fff; border-color: var(--c-deep); }
.viz__expand svg { width: 0.95rem; height: 0.95rem; pointer-events: none; }

/* Fullscreen lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 1000; display: none;
  place-items: center; padding: clamp(0.75rem, 3vw, 2.5rem);
  background: rgba(11, 33, 41, 0.82); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: lb-fade var(--t) ease;
}
.lightbox[data-open="true"] { display: grid; }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox__stage {
  position: relative; background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: clamp(1.25rem, 3vw, 2.5rem);
  max-width: 97vw; max-height: 94vh; overflow: auto; display: grid; place-items: center;
}
.lightbox__content { display: grid; place-items: center; }
.lightbox__content svg { display: block; height: auto; }
.lightbox__close {
  position: absolute; top: 0.7rem; right: 0.7rem; z-index: 3;
  width: 2.5rem; height: 2.5rem; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--c-deep);
  display: grid; place-items: center; transition: all var(--t);
}
.lightbox__close:hover { background: var(--c-rose); color: #fff; border-color: var(--c-rose); }
.lightbox__close svg { width: 1.3rem; height: 1.3rem; }
.lightbox__hint { position: absolute; bottom: 0.45rem; left: 50%; transform: translateX(-50%);
  color: var(--muted); font-size: 0.76rem; pointer-events: none; }
@media (max-width: 600px) { .lightbox__hint { display: none; } }

/* ----------------------------------------------------------------- KaTeX */
.katex { font-size: 1.04em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding-block: 0.4rem; }

/* ----------------------------------------------------------------- Page head */
.page-intro { margin-bottom: 1.5rem; }

/* Utility */
.center { text-align: center; }
.muted { color: var(--muted); }
.lead { font-size: var(--step-1); color: var(--ink); }
