/* MUL documentation site. Colours, type and contrast ratios are documented in
   docs/site-style.md; change them there and here together. */

@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

/* ---- Tokens ---------------------------------------------------------- */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f8f9fa;
  --code-bg: #f8f9fa;
  --inline-code: #f1f3f4;
  --border: #dadce0;
  --text: #202124;
  --muted: #5f6368;
  --link: #1967d2;
  --accent: #1967d2;
  --header-bg: rgb(255 255 255 / 0.85);
  /* the hero and terminals are dark in both schemes */
  --night: #17181b;
  --night-2: #202124;
  --night-3: #2d2e31;
  --night-border: #3c4043;
  --night-text: #e8eaed;
  --night-muted: #bdc1c6;
  /* syntax colours, light (docs/site-style.md#syntax-highlighting) */
  --hl-com: #5f6368;
  --hl-str: #137333;
  --hl-kw: #8430ce;
  --hl-eff: #8430ce;
  --hl-type: #8a4a00;
  --hl-num: #1967d2;
  --hl-fn: #174ea6;
  --hl-op: #5f6368;
  --hl-var: #8a4a00;
  --hl-label: #137333;
  --hl-err: #c5221f;
  --hl-prompt: #137333;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 10px;
}

/* dark syntax colours, reused by the always-dark terminal and hero blocks */
.night,
.terminal {
  --code-bg: var(--night-2);
  --border: var(--night-border);
  --text: var(--night-text);
  --muted: var(--night-muted);
  --hl-com: #9aa0a6;
  --hl-str: #81c995;
  --hl-kw: #c58af9;
  --hl-eff: #c58af9;
  --hl-type: #fcad70;
  --hl-num: #8ab4f8;
  --hl-fn: #78d9ec;
  --hl-op: #bdc1c6;
  --hl-var: #fcad70;
  --hl-label: #81c995;
  --hl-err: #f28b82;
  --hl-prompt: #81c995;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181b;
    --surface: #202124;
    --code-bg: #202124;
    --inline-code: #2d2e31;
    --border: #3c4043;
    --text: #e8eaed;
    --muted: #bdc1c6;
    --link: #8ab4f8;
    --accent: #8ab4f8;
    --header-bg: rgb(23 24 27 / 0.85);
    --hl-com: #9aa0a6;
    --hl-str: #81c995;
    --hl-kw: #c58af9;
    --hl-eff: #c58af9;
    --hl-type: #fcad70;
    --hl-num: #8ab4f8;
    --hl-fn: #78d9ec;
    --hl-op: #bdc1c6;
    --hl-var: #fcad70;
    --hl-label: #81c995;
    --hl-err: #f28b82;
    --hl-prompt: #81c995;
  }
}

/* ---- Base ------------------------------------------------------------ */

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

html { scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.7 var(--sans);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link { position: absolute; left: -999px; top: 0.5rem; padding: 0.5rem 0.75rem; background: var(--bg); border: 2px solid var(--link); z-index: 20; }
.skip-link:focus { left: 0.5rem; }

.wrap { max-width: 80rem; margin: 0 auto; padding: 0 1.5rem; }

h1, h2, h3 { line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 4vw, 2.5rem); margin: 0 0 1rem; }
h2 { font-size: 1.5rem; margin: 2.75rem 0 0.75rem; padding-top: 0.5rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }

code, pre, kbd { font-family: var(--mono); }
:not(pre) > code { font-size: 0.875em; background: var(--inline-code); border-radius: 4px; padding: 0.12em 0.35em; }

/* ---- Header ---------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); font-weight: 600; font-size: 1.2rem; text-decoration: none; letter-spacing: -0.01em; }
.brand img { width: 30px; height: 30px; }
.version { font: 400 0.75rem/1 var(--mono); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.3rem 0.55rem; }
.site-nav { margin-left: auto; overflow-x: auto; }
.site-nav ul { display: flex; align-items: center; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.site-nav a { display: inline-flex; align-items: center; color: var(--muted); text-decoration: none; padding: 0.45rem 0.7rem; border-radius: 6px; font-size: 0.9375rem; white-space: nowrap; }
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.site-nav .icon svg { width: 20px; height: 20px; fill: currentColor; }

/* ---- Footer (one line, centred) -------------------------------------- */

.site-footer { margin-top: 5rem; border-top: 1px solid var(--border); background: var(--surface); padding: 1.5rem 0; }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.75rem; font-size: 0.85rem; color: var(--muted); }
.footer-bottom img { width: 20px; height: 20px; }
.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--link); }
.footer-sep { color: var(--border); }
.home .site-footer { margin-top: 0; }

/* ---- Code blocks ----------------------------------------------------- */

pre { margin: 0; font-size: 0.875rem; line-height: 1.6; overflow-x: auto; padding: 1rem 1.15rem; background: var(--code-bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); }
.code-block { margin: 1.25rem 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); color: var(--text); overflow: hidden; }
.code-block pre { border: 0; border-radius: 0; background: transparent; padding-top: 0.75rem; }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0.6rem 0.4rem 1.15rem; border-bottom: 1px solid var(--border); font: 600 0.75rem/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.copy { font: 400 0.75rem/1 var(--sans); color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 0.35rem 0.6rem; cursor: pointer; text-transform: none; letter-spacing: 0; }
.copy:hover { color: var(--text); border-color: var(--muted); }
.code-tools { display: flex; gap: 0.4rem; }

.hl-com { color: var(--hl-com); font-style: italic; }
.hl-str { color: var(--hl-str); }
.hl-kw { color: var(--hl-kw); font-weight: 600; }
.hl-eff { color: var(--hl-eff); font-style: italic; }
.hl-type { color: var(--hl-type); }
.hl-num { color: var(--hl-num); }
.hl-fn { color: var(--hl-fn); }
.hl-op { color: var(--hl-op); }
.hl-var { color: var(--hl-var); }
.hl-label { color: var(--hl-label); font-weight: 600; }
.hl-err { color: var(--hl-err); font-weight: 600; }
.hl-prompt { color: var(--hl-prompt); user-select: none; }

/* ---- Tables and quotes ----------------------------------------------- */

table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; font-size: 0.9375rem; display: block; overflow-x: auto; }
th, td { border-bottom: 1px solid var(--border); padding: 0.55rem 0.75rem; text-align: left; vertical-align: top; }
th { font-weight: 600; border-bottom-width: 2px; white-space: nowrap; }
td[style*="right"], th[style*="right"] { text-align: right; font-variant-numeric: tabular-nums; }
blockquote { margin: 1.5rem 0; padding: 0.75rem 1rem; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
blockquote p { margin: 0; }

/* ---- Documentation: navigation | text | on this page ------------------ */

.doc { display: grid; grid-template-columns: 15rem minmax(0, 1fr) 13rem; grid-template-areas: "nav main toc"; gap: 3rem; align-items: start; }
.doc-main { grid-area: main; min-width: 0; max-width: 48rem; padding-top: 2.5rem; }
.doc-nav { grid-area: nav; position: sticky; top: 4rem; max-height: calc(100vh - 4rem); overflow-y: auto; padding: 2.5rem 0 2rem; font-size: 0.9rem; }
.doc-toc { grid-area: toc; position: sticky; top: 4rem; max-height: calc(100vh - 4rem); overflow-y: auto; padding: 2.5rem 0 2rem; font-size: 0.85rem; }
.doc-nav h2, .doc-toc h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 0.5rem; padding: 0; }
.doc-nav ul, .doc-toc ul { list-style: none; margin: 0 0 1.75rem; padding: 0; }
.doc-toc ul ul { margin: 0; padding-left: 0.75rem; }
.doc-nav a { display: block; padding: 0.3rem 0.75rem; border-radius: 6px; color: var(--muted); text-decoration: none; }
.doc-nav a:hover { color: var(--text); background: var(--surface); }
.doc-nav a[aria-current="page"] { color: var(--link); background: var(--surface); font-weight: 600; }
.doc-toc a { display: block; padding: 0.2rem 0 0.2rem 0.75rem; border-left: 1px solid var(--border); color: var(--muted); text-decoration: none; }
.doc-toc a:hover { color: var(--link); border-left-color: var(--link); }
.eyebrow { font: 600 0.8rem/1 var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.75rem; }
.doc-source { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.875rem; }

@media (max-width: 75rem) {
  .doc { grid-template-columns: 14rem minmax(0, 1fr); grid-template-areas: "nav main"; }
  .doc-toc { display: none; }
}
@media (max-width: 52rem) {
  .doc { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "nav"; gap: 0; }
  .doc-nav { position: static; max-height: none; border-top: 1px solid var(--border); margin-top: 3rem; }
  .site-header .wrap { gap: 0.75rem; }
  .version { display: none; }
}

/* ---- Blog ------------------------------------------------------------ */

.blog-head, .post-head { position: relative; overflow: hidden; }
.blog-head::before, .post-head::before {
  content: ""; position: absolute; inset: -60% -10% auto auto; width: 50rem; height: 50rem;
  background: radial-gradient(closest-side, rgb(25 103 210 / 0.35), transparent 70%); pointer-events: none;
}
.blog-head .wrap { position: relative; padding-top: 4rem; padding-bottom: 3.5rem; }
.blog-head h1 { font-size: clamp(2.2rem, 4.5vw, 3.25rem); letter-spacing: -0.03em; margin: 0 0 1rem; }
.blog-head p { color: var(--night-muted); font-size: 1.15rem; max-width: 40rem; margin: 0 0 0.75rem; }
.night .eyebrow, .night .eyebrow a { color: #8ab4f8; text-decoration: none; }

.post-grid { list-style: none; margin: 3rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: 2rem; }
.post-card { position: relative; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--bg); transition: border-color 0.15s, transform 0.15s; }
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-card img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--night); }
.post-card > div { padding: 1.25rem 1.5rem 1.6rem; }
.post-card .meta, .post-card time { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.4rem; display: block; }
.post-card h2, .post-card h3 { margin: 0 0 0.5rem; padding: 0; font-size: 1.3rem; }
.post-card h2 a, .post-card h3 a { color: var(--text); text-decoration: none; }
.post-card h2 a::after, .post-card h3 a::after { content: ""; position: absolute; inset: 0; }
.post-card p { margin: 0; color: var(--muted); }
.post-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; }
.post-card.featured > div { padding: 2rem 2.5rem; }
.post-card.featured h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.02em; }
.post-card.featured p { font-size: 1.05rem; }

.post-head .wrap { position: relative; max-width: 56rem; padding-top: 3.5rem; text-align: center; }
.post-head h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.03em; margin: 0 0 0.75rem; }
.post-head .meta { color: var(--night-muted); margin: 0 0 2.5rem; }
.post-head .cover { display: block; width: 100%; height: auto; border-radius: 16px 16px 0 0; border: 1px solid var(--night-border); border-bottom: 0; margin-bottom: -1px; }
.post-head:not(:has(.cover)) .wrap { padding-bottom: 3rem; }

.prose { max-width: 42rem; margin: 0 auto; padding-top: 2.5rem; font-size: 1.0625rem; line-height: 1.75; }
.prose > p:first-child { font-size: 1.2rem; color: var(--text); }
.prose h2 { font-size: 1.6rem; margin-top: 3rem; }
.prose li { margin-bottom: 0.4rem; }
.prose .back { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

@media (max-width: 52rem) {
  .post-card.featured { grid-template-columns: minmax(0, 1fr); }
  .post-card.featured > div { padding: 1.25rem 1.5rem 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { .post-card { transition: none; } .post-card:hover { transform: none; } }

/* ---- Landing --------------------------------------------------------- */

.night { background: var(--night); color: var(--night-text); }
.night a { color: #8ab4f8; }

.hero { position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 60rem; height: 60rem;
  background: radial-gradient(closest-side, rgb(25 103 210 / 0.35), transparent 70%);
  pointer-events: none;
}
.hero .wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 3.5rem; align-items: center; padding-top: 5rem; padding-bottom: 5rem; }
.hero h1 { font-size: clamp(2.4rem, 5.2vw, 3.75rem); letter-spacing: -0.03em; line-height: 1.05; margin-bottom: 1.25rem; }
.hero h1 span { color: #8ab4f8; }
.hero .lead { font-size: 1.2rem; color: var(--night-muted); max-width: 36rem; margin: 0 0 2rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }
.button { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.25rem; border-radius: 8px; font-weight: 600; text-decoration: none; border: 1px solid transparent; }
.night .button.primary, .button.primary { background: #8ab4f8; color: #17181b; }
.night .button.primary:hover { background: #aecbfa; }
.night .button.ghost { color: var(--night-text); border-color: var(--night-border); }
.night .button.ghost:hover { border-color: var(--night-muted); }

.window { border: 1px solid var(--night-border); border-radius: 12px; background: var(--night-2); box-shadow: 0 30px 80px rgb(0 0 0 / 0.45); overflow: hidden; }
.window-bar { display: flex; align-items: center; gap: 0.45rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--night-border); font: 400 0.8rem/1 var(--mono); color: var(--night-muted); }
.window-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--night-border); }
.window-bar span { margin-left: 0.6rem; }
.window pre, .window .code-block { margin: 0; border: 0; border-radius: 0; background: transparent; }
.window .code-bar { display: none; }
.window .out { border-top: 1px solid var(--night-border); background: var(--night); }

.quick { border-bottom: 1px solid var(--border); background: var(--surface); }
.quick .wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.5rem 2.5rem; align-items: center; padding-top: 2rem; padding-bottom: 2rem; }
.quick h2 { margin: 0; font-size: 1.1rem; padding: 0; }
.quick p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; }
.quick .code-block { margin: 0; }

.section { padding: 5rem 0 0; }
.section-head { max-width: 44rem; margin-bottom: 2.5rem; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0 0 0.75rem; padding: 0; }
.section-head p { color: var(--muted); font-size: 1.075rem; margin: 0; }

.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; margin: 0; padding: 0; list-style: none; }
.feature { border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem; background: var(--bg); display: flex; flex-direction: column; }
.feature h3 { margin: 0 0 0.4rem; }
.feature p { margin: 0 0 1rem; color: var(--muted); }
.feature .code-block { margin: 0.5rem 0 0; }
.feature .terminal { margin-top: 0.75rem; }

.pipeline { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; align-items: center; }
.pipeline img { width: 100%; height: auto; }
.pipeline ol { margin: 0; padding-left: 1.25rem; }
.pipeline li { margin-bottom: 0.6rem; }
.pipeline li::marker { color: var(--accent); font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.5rem; margin: 0; padding: 0; list-style: none; }
.card { position: relative; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--bg); transition: border-color 0.15s, transform 0.15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card img { display: block; width: 100%; height: auto; }
.card div { padding: 1.1rem 1.25rem 1.35rem; }
.card h3 { margin: 0 0 0.4rem; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }

@media (max-width: 60rem) {
  .hero .wrap, .pipeline { grid-template-columns: minmax(0, 1fr); }
  .hero .wrap { padding-top: 3rem; padding-bottom: 3rem; gap: 2.5rem; }
  .features { grid-template-columns: minmax(0, 1fr); }
  .quick .wrap { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Code that wraps instead of scrolling (narrow panels) ------------- */

.window pre, .feature pre, .quick pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- Charts (docs/site-style.md#charts) ------------------------------ */

.chart { margin: 2rem 0; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .s1 { fill: #1967d2; } .chart .s2 { fill: #e37400; } .chart .s3 { fill: #a142f4; } .chart .s4 { fill: #188038; } .chart .s5 { fill: #d01884; }
.chart rect:hover { opacity: 0.8; }
.chart-label { font: 600 13px var(--sans); fill: var(--text); }
.chart-value { font: 400 11px var(--mono); fill: var(--muted); }
.chart-axis { stroke: var(--border); stroke-width: 1; }
.chart figcaption { display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: center; margin-top: 0.75rem; font-size: 0.875rem; color: var(--muted); }
.chart .key::before { content: ""; display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 3px; margin-right: 0.4rem; vertical-align: -0.05rem; background: var(--key); }
.chart .key.s1 { --key: #1967d2; } .chart .key.s2 { --key: #e37400; } .chart .key.s3 { --key: #a142f4; } .chart .key.s4 { --key: #188038; } .chart .key.s5 { --key: #d01884; }
@media (prefers-color-scheme: dark) {
  .chart .s1 { fill: #4285f4; } .chart .s2 { fill: #c26401; } .chart .s4 { fill: #1e8e3e; } .chart .s5 { fill: #e52592; }
  .chart .key.s1 { --key: #4285f4; } .chart .key.s2 { --key: #c26401; } .chart .key.s4 { --key: #1e8e3e; } .chart .key.s5 { --key: #e52592; }
}
.post-card .meta time { display: inline; margin: 0; }
