/*
  owaistoru.live — shared stylesheet
  No external fonts or frameworks. Light and dark themes follow the visitor's
  operating-system preference. Colours meet WCAG AA contrast in both themes.
*/

/* ---------- 1. Design tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #fbfcfc;
  --bg-alt: #f1f5f6;
  --surface: #ffffff;
  --surface-2: #f5f8f9;
  --border: #dae2e6;
  --border-strong: #c2ced5;
  --ink: #0c1a28;
  --ink-2: #2a3c4e;
  --muted: #566778;
  --accent: #0a6c78;
  --accent-strong: #07525b;
  --accent-ink: #ffffff;
  --accent-soft: #e1f0f1;
  --accent-line: #8fc8cd;
  --deep: #0b1f33;
  --deep-ink: #e9f1f5;
  --deep-muted: #a9bccb;

  --ok: #17734a;
  --ok-soft: #e2f2e9;
  --warn: #855600;
  --warn-soft: #faefd6;
  --info: #1d5a95;
  --info-soft: #e4edf7;
  --idle: #556675;
  --idle-soft: #edf1f4;

  --shadow-sm: 0 1px 2px rgb(12 26 40 / 0.06);
  --shadow: 0 1px 2px rgb(12 26 40 / 0.05), 0 10px 28px rgb(12 26 40 / 0.07);
  --shadow-lg: 0 2px 6px rgb(12 26 40 / 0.06), 0 28px 56px rgb(12 26 40 / 0.13);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --container: 1160px;
  --gutter: 16px;
  --header-h: 64px;
  --section-y: clamp(3.5rem, 2.5rem + 4vw, 6rem);
}

@media (min-width: 640px) {
  :root { --gutter: 24px; }
}

@media (min-width: 1024px) {
  :root { --gutter: 32px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a131d;
    --bg-alt: #0e1a26;
    --surface: #111f2c;
    --surface-2: #142535;
    --border: #22364a;
    --border-strong: #31495f;
    --ink: #e6eef3;
    --ink-2: #c4d1db;
    --muted: #97a9b9;
    --accent: #5fc4cc;
    --accent-strong: #93dde2;
    --accent-ink: #052129;
    --accent-soft: #10303a;
    --accent-line: #2a6c75;
    --deep: #081624;
    --deep-ink: #e6eef3;
    --deep-muted: #9fb3c3;

    --ok: #73d3a3;
    --ok-soft: #0f2d21;
    --warn: #e9c06b;
    --warn-soft: #31260e;
    --info: #8db9ea;
    --info-soft: #132a43;
    --idle: #a5b4c1;
    --idle-soft: #1a2734;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px rgb(0 0 0 / 0.28);
    --shadow-lg: 0 2px 6px rgb(0 0 0 / 0.3), 0 28px 56px rgb(0 0 0 / 0.4);
  }
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

img { height: auto; }

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: clamp(2.2rem, 1.55rem + 2.7vw, 3.5rem); font-weight: 720; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.6rem, 1.25rem + 1.45vw, 2.35rem); font-weight: 700; letter-spacing: -0.028em; }
h3 { font-size: clamp(1.1rem, 1.02rem + 0.35vw, 1.3rem); font-weight: 650; }
h4 { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; }

p, ul, ol, dl, table, figure, blockquote, pre { margin: 0 0 1rem; }
p { text-wrap: pretty; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }

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

strong { font-weight: 650; color: var(--ink); }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

code {
  padding: 0.12em 0.38em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  padding: 0.1em 0.45em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.82em;
  line-height: 1.5;
  white-space: nowrap;
}

pre {
  overflow-x: auto;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  background: var(--deep);
  color: var(--deep-ink);
  font-size: 0.9rem;
  line-height: 1.6;
}

pre code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; }

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

abbr[title] { text-decoration: underline dotted; text-underline-offset: 0.2em; cursor: help; }

sub, sup { line-height: 0; }

::selection { background: var(--accent-soft); color: var(--ink); }

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  text-decoration: none;
}

.skip-link:focus { top: 12px; color: var(--accent-ink); }

/* ---------- 3. Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container-narrow { max-width: calc(780px + 2 * var(--gutter)); }

.section { padding-block: var(--section-y); }
.section + .section { border-top: 1px solid var(--border); }
.section-alt { background: var(--bg-alt); }
.section-tight { padding-block: clamp(2.25rem, 1.75rem + 2vw, 3.5rem); }

.section-head { max-width: 760px; margin-bottom: clamp(1.75rem, 1.25rem + 1.5vw, 2.75rem); }
.section-head p { color: var(--ink-2); font-size: 1.08rem; }
.section-head.center { margin-inline: auto; text-align: center; }

.prose { max-width: 72ch; }
.prose > p,
.prose > ul,
.prose > ol { color: var(--ink-2); }
.prose h2 { margin-top: 2.5rem; }
.prose h3 { margin-top: 2rem; }
.prose li + li { margin-top: 0.35rem; }

.lead {
  font-size: clamp(1.08rem, 1.02rem + 0.35vw, 1.25rem);
  line-height: 1.6;
  color: var(--ink-2);
}

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.mono { font-family: var(--font-mono); }

.grid { display: grid; gap: clamp(1rem, 0.75rem + 1vw, 1.5rem); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

.split {
  display: grid;
  gap: clamp(1.75rem, 1rem + 3vw, 4rem);
  align-items: start;
}

@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
  .split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .split-wide { grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); }
  .split.center { align-items: center; }
}

.stack > * + * { margin-top: 1rem; }

/* ---------- 4. Header and navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand:hover { color: var(--ink); text-decoration: none; }

.brand-mark {
  flex: none;
  width: 36px;
  height: 36px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 700; font-size: 1.02rem; letter-spacing: -0.015em; }
.brand-role {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-desktop { display: none; }

.nav-desktop ul,
.nav-mobile ul { list-style: none; margin: 0; padding: 0; }

.nav-desktop ul { display: flex; align-items: center; gap: 0.15rem; }

.nav-desktop a,
.nav-mobile a {
  display: block;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 550;
  border-radius: 8px;
}

.nav-desktop a { padding: 0.45rem 0.7rem; }

.nav-desktop a:hover,
.nav-mobile a:hover { color: var(--ink); background: var(--surface-2); }

.nav-desktop a[aria-current="page"],
.nav-mobile a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.nav-desktop .nav-cta a {
  margin-left: 0.4rem;
  border: 1px solid var(--border-strong);
  color: var(--ink);
}

.nav-desktop .nav-cta a:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.nav-mobile { position: relative; }

.nav-mobile > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.nav-mobile > summary::-webkit-details-marker { display: none; }

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-icon { position: relative; }
.menu-icon::before,
.menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }

.nav-mobile[open] .menu-icon { background: transparent; }
.nav-mobile[open] .menu-icon::before { transform: translateY(6px) rotate(45deg); }
.nav-mobile[open] .menu-icon::after { transform: translateY(-6px) rotate(-45deg); }

.nav-mobile-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(calc(100vw - 2 * var(--gutter)), 320px);
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.nav-mobile a { padding: 0.75rem 0.9rem; font-size: 1rem; }

@media (min-width: 960px) {
  .nav-desktop { display: block; }
  .nav-mobile { display: none; }
}

@media (min-width: 960px) and (max-width: 1099px) {
  .brand-role { display: none; }
  .nav-desktop a { padding-inline: 0.55rem; }
}

/* ---------- 5. Type helpers ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.9rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.eyebrow.plain::before { display: none; }

.kicker { color: var(--muted); font-size: 0.95rem; }

/* ---------- 6. Buttons, chips and links ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.7rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.97rem;
  font-weight: 620;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); color: var(--accent-ink); }

.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost { padding-inline: 0.4rem; color: var(--accent); }
.btn-ghost:hover { color: var(--accent-strong); }

.btn svg { width: 18px; height: 18px; flex: none; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 620;
  text-decoration: none;
}

.text-link:hover { text-decoration: underline; }

.arrow { transition: transform 0.15s ease; }
a:hover .arrow { transform: translateX(3px); }

.ext::after {
  content: "\2197";
  content: "\2197" / "";
  display: inline-block;
  margin-left: 0.2em;
  font-size: 0.85em;
  text-decoration: none;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0 0 1rem; padding: 0; list-style: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 560;
  line-height: 1.35;
  white-space: nowrap;
}

.chip-mono { font-family: var(--font-mono); font-size: 0.78rem; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.card-status { align-self: flex-start; margin-bottom: 0.7rem; }

.status-verified { color: var(--ok); background: var(--ok-soft); }
.status-implemented { color: var(--info); background: var(--info-soft); }
.status-research { color: var(--warn); background: var(--warn-soft); }
.status-planned,
.status-done { color: var(--idle); background: var(--idle-soft); }

.h3 { font-size: clamp(1.1rem, 1.02rem + 0.35vw, 1.3rem); font-weight: 650; letter-spacing: -0.02em; }

/* ---------- 7. Cards ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(1.25rem, 1rem + 0.8vw, 1.6rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card > :last-child { margin-bottom: 0; }
.card h3 { margin-bottom: 0.45rem; }
.card p { color: var(--ink-2); font-size: 0.98rem; }
.card ul { padding-left: 1.1rem; color: var(--ink-2); font-size: 0.97rem; }
.card li + li { margin-top: 0.3rem; }
.card .chip-row,
.card .list-check,
.card .list-dash { padding-left: 0; }
.card .chip-row { margin-top: 0.4rem; }

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.65rem;
}

.card-head .card-meta { margin: 0; }

.card-head h3 { margin: 0; }

.card-meta {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-link { margin-top: auto; padding-top: 0.75rem; }

.card-interactive { transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease; }
.card-interactive:hover { border-color: var(--accent-line); box-shadow: var(--shadow); }

.card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 1rem;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}

.card-icon svg { width: 22px; height: 22px; }

.card-feature {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 55%);
}

/* Fact list (dl) */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
}

.facts > div { padding: 1rem 1.15rem; background: var(--surface); }
.facts dt {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.facts dd { margin: 0; color: var(--ink); font-size: 0.97rem; font-weight: 560; line-height: 1.45; }

/* Metric tiles */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.metric {
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-value {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--ink);
  font-size: clamp(1.45rem, 1.2rem + 0.9vw, 1.9rem);
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.metric-label { display: block; color: var(--ink-2); font-size: 0.92rem; line-height: 1.45; }

/* Callouts */
.grid + h3,
.grid + h2 { margin-top: clamp(2rem, 1.5rem + 1.5vw, 2.75rem); }

.grid + .callout,
.grid + .grid,
.table-wrap + .callout,
.metrics + .callout { margin-top: clamp(1.25rem, 1rem + 1vw, 1.75rem); }

.callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.97rem;
}

.callout > svg { width: 20px; height: 20px; margin-top: 0.15rem; color: var(--accent); }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--ink); }
.callout-warn { border-left-color: var(--warn); }
.callout-warn > svg { color: var(--warn); }

/* ---------- 8. Hero blocks ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 2rem + 5vw, 6.5rem) clamp(3rem, 2rem + 4vw, 5.5rem);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(1100px 520px at 88% -10%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 62%),
    linear-gradient(180deg, var(--bg-alt), var(--bg));
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.45;
  -webkit-mask-image: linear-gradient(115deg, transparent 35%, #000 85%);
  mask-image: linear-gradient(115deg, transparent 35%, #000 85%);
  pointer-events: none;
}

.hero > .container { position: relative; }

.hero-grid { display: grid; gap: clamp(2rem, 1rem + 4vw, 4rem); align-items: center; }

@media (min-width: 980px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
}

.hero h1 { margin-bottom: 0.35em; }
.hero .role { margin: 0 0 1.25rem; color: var(--ink-2); font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem); font-weight: 560; }
.hero .lead { max-width: 58ch; margin-bottom: 1.75rem; }

@media (max-width: 520px) {
  .hero .btn-row .btn,
  .page-hero .btn-row .btn,
  .cta-band .btn-row .btn { flex: 1 1 auto; }
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.93rem;
}

.hero-links a { color: var(--ink-2); font-weight: 560; text-decoration: none; }
.hero-links a:hover { color: var(--accent); text-decoration: underline; }

.page-hero {
  padding-block: clamp(2.75rem, 2rem + 3.5vw, 5rem) clamp(2.25rem, 1.75rem + 2.5vw, 3.75rem);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 380px at 92% -20%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 65%),
    var(--bg-alt);
}

.page-hero h1 { max-width: 20ch; }
.page-hero .lead { max-width: 64ch; margin-bottom: 0; }
.page-hero .btn-row { margin-top: 1.75rem; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.88rem;
}

.breadcrumb li + li::before { content: "/"; margin-right: 0.4rem; color: var(--border-strong); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }

/* On-page navigation */
.on-page {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
}

.on-page a {
  display: inline-block;
  padding: 0.38rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.86rem;
  font-weight: 560;
  text-decoration: none;
}

.on-page a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 9. Figures and screenshots ---------- */
.shot { margin: 0; }

.shot-frame {
  display: block;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.shot-frame img { width: 100%; }

a.shot-frame { transition: border-color 0.15s ease, box-shadow 0.15s ease; }
a.shot-frame:hover { border-color: var(--accent-line); }

.shot figcaption,
.figure-caption {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.shot figcaption strong { color: var(--ink-2); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: clamp(1.25rem, 1rem + 1.5vw, 2rem);
  align-items: start;
}

.gallery .shot-frame { box-shadow: var(--shadow); }

.feature-shot { margin-bottom: clamp(2rem, 1.5rem + 2vw, 3rem); }

/* ---------- 10. Diagrams ---------- */
.diagram {
  margin: 0;
  padding: clamp(1rem, 0.75rem + 1vw, 1.5rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.diagram svg { width: 100%; height: auto; }

.d-box { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.25; }
.d-box-accent { fill: var(--accent-soft); stroke: var(--accent-line); stroke-width: 1.25; }
.d-box-deep { fill: var(--deep); stroke: var(--deep); }
.d-title { fill: var(--ink); font: 650 15px var(--font-sans); }
.d-text { fill: var(--ink-2); font: 400 12.5px var(--font-sans); }
.d-label { fill: var(--muted); font: 600 11px var(--font-mono); letter-spacing: 0.08em; }
.d-title-inv { fill: #ffffff; font: 650 15px var(--font-sans); }
.d-text-inv { fill: #c9d8e3; font: 400 12.5px var(--font-sans); }
.d-line { stroke: var(--border-strong); stroke-width: 1.5; fill: none; }
.d-arrow { stroke: var(--accent); stroke-width: 1.75; fill: none; }
.d-arrow-head { fill: var(--accent); }

/* Chain (process flow) */
.chain-title { margin: 2.75rem 0 1rem; }

.chain {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: chain;
}

@media (min-width: 720px) {
  .chain { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.chain li {
  position: relative;
  min-width: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  counter-increment: chain;
}

.chain li::before {
  content: counter(chain, decimal-leading-zero);
  display: block;
  margin-bottom: 0.3rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.chain strong { display: block; font-size: 0.95rem; line-height: 1.3; }
.chain span { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.84rem; line-height: 1.4; }

/* Layer stack (architecture) */
.layers { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }

.layer {
  display: grid;
  gap: 0.35rem 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

@media (min-width: 760px) {
  .layer { grid-template-columns: 230px 1fr; align-items: baseline; }
}

.layer-name { font-weight: 680; color: var(--ink); }
.layer-name small {
  display: block;
  margin-top: 0.15rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.layer p { margin: 0; color: var(--ink-2); font-size: 0.96rem; }
.layer-core { border-color: var(--deep); background: var(--deep); }
.layer-core .layer-name { color: #ffffff; }
.layer-core .layer-name small { color: #8fd7dc; }
.layer-core p { color: #c9d8e3; }
.layer-bridge { border-style: dashed; background: var(--surface-2); }

/* Workflow steps (numbered) */
.workflow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: wf;
}

.workflow li {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  counter-increment: wf;
}

.workflow li::before {
  content: counter(wf, decimal-leading-zero);
  display: block;
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.workflow strong { display: block; margin-bottom: 0.2rem; }
.workflow span { display: block; color: var(--ink-2); font-size: 0.93rem; line-height: 1.5; }

/* ---------- 11. Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }

caption {
  padding: 0.9rem 1.1rem 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: left;
  caption-side: top;
}

th, td { padding: 0.75rem 1.1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
thead th {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface-2);
}
tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }
tbody th { color: var(--ink); font-weight: 650; }
td { color: var(--ink-2); }

@media (max-width: 640px) {
  .table-stack thead { display: none; }
  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack th,
  .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack th,
  .table-stack td { padding: 0.15rem 0; border: 0; }
  .table-stack th { margin-bottom: 0.35rem; font-size: 1rem; }
  .table-stack td::before {
    content: attr(data-label);
    display: block;
    margin-top: 0.35rem;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
}

/* ---------- 12. Timeline (CV) ---------- */
.timeline { margin: 0; padding: 0; list-style: none; }

.timeline > li {
  position: relative;
  display: grid;
  gap: 0.25rem 2rem;
  padding: 0 0 2rem 1.6rem;
  border-left: 2px solid var(--border);
}

.timeline > li:last-child { padding-bottom: 0.25rem; }

.timeline > li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.45rem;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

@media (min-width: 820px) {
  .timeline > li { grid-template-columns: 170px 1fr; padding-left: 2rem; }
}

.tl-when { color: var(--muted); font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.9; }

/* Compact timeline inside cards: the date sits above the entry. */
.card .timeline > li { grid-template-columns: 1fr; gap: 0.1rem; padding: 0 0 1.35rem 1.4rem; }
.card .timeline > li:last-child { padding-bottom: 0.25rem; }
.card .timeline h4 { margin: 0.1rem 0 0.15rem; font-size: 1rem; }
.card .timeline .tl-org { margin-bottom: 0; font-size: 0.93rem; }
.tl-body h3 { margin-bottom: 0.15rem; font-size: 1.12rem; }
.tl-org { margin: 0 0 0.6rem; color: var(--accent); font-weight: 600; font-size: 0.97rem; }
.tl-body ul { margin: 0; padding-left: 1.1rem; color: var(--ink-2); font-size: 0.98rem; }
.tl-body li + li { margin-top: 0.3rem; }
.tl-body p { color: var(--ink-2); font-size: 0.98rem; }

/* ---------- 13. Publications ---------- */
.pub-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 1rem; }

.pub {
  padding: clamp(1.15rem, 1rem + 0.8vw, 1.6rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.pub-feature { border-color: var(--accent-line); box-shadow: var(--shadow); }

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.6rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pub h3 { margin-bottom: 0.45rem; font-size: clamp(1.08rem, 1rem + 0.4vw, 1.3rem); line-height: 1.3; }
.pub h3 a { color: var(--ink); text-decoration: none; }
.pub h3 a:hover { color: var(--accent); text-decoration: underline; }
.pub-authors { margin-bottom: 0.25rem; color: var(--ink-2); font-size: 0.97rem; }
.pub-authors .me { color: var(--ink); font-weight: 680; }
.pub-venue { margin-bottom: 0.85rem; color: var(--muted); font-size: 0.95rem; }
.pub-venue em { color: var(--ink-2); }
.pub-summary { max-width: 80ch; color: var(--ink-2); font-size: 0.98rem; }
.pub h3 { max-width: 62ch; }
.pub-actions { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; font-size: 0.93rem; }

details.cite { margin-top: 0.85rem; }
details.cite > summary { cursor: pointer; color: var(--accent); font-size: 0.93rem; font-weight: 600; }
details.cite pre { margin-top: 0.75rem; white-space: pre-wrap; word-break: break-word; font-size: 0.82rem; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 14. Guide layout ---------- */
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }

@media (min-width: 1080px) {
  .guide-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 3.5rem; }
  .toc { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; }
}

.toc {
  align-self: start;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.92rem;
}

.toc-title {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.toc ol { margin: 0; padding-left: 1.35rem; color: var(--muted); }
.toc li { margin: 0.28rem 0; padding-left: 0.15rem; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover,
.toc a.is-active { color: var(--accent); text-decoration: underline; }

.guide-step {
  padding-block: 0 2.75rem;
  margin-bottom: 2.75rem;
  border-bottom: 1px solid var(--border);
}

.guide-step:last-child { border-bottom: 0; margin-bottom: 0; }

.step-head { display: flex; align-items: baseline; gap: 0.85rem; margin-bottom: 0.75rem; }

.step-num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  transform: translateY(-0.15rem);
}

.step-head h2 { margin: 0; font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem); }

.guide-step > p,
.guide-step > ul,
.guide-step > ol { max-width: 75ch; color: var(--ink-2); }
.guide-step li + li { margin-top: 0.35rem; }
.guide-step .shot { margin-block: 1.5rem; }
.guide-step h3 { margin-top: 1.5rem; font-size: 1.08rem; }

.tip {
  max-width: 75ch;
  margin-block: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--ink-2);
  font-size: 0.95rem;
}

.tip strong { color: var(--accent-strong); }

.glossary { display: grid; gap: 0; margin: 0; }
.glossary > div { display: grid; gap: 0.2rem 1.5rem; padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.glossary > div:last-child { border-bottom: 0; }
@media (min-width: 760px) { .glossary > div { grid-template-columns: 220px 1fr; } }
.glossary dt { font-weight: 650; color: var(--ink); }
.glossary dd { margin: 0; color: var(--ink-2); font-size: 0.97rem; }

/* ---------- 15. Contact ---------- */
.contact-card { display: grid; gap: 1rem; }

.link-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; }

.link-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.link-list a:hover { border-color: var(--accent); color: var(--ink); }
.link-list span.desc { display: block; color: var(--muted); font-size: 0.88rem; font-weight: 450; }
.link-list .go { color: var(--accent); font-family: var(--font-mono); font-size: 0.85rem; white-space: nowrap; }

/* ---------- 16. CTA band ---------- */
.cta-band {
  padding: clamp(2rem, 1.5rem + 2vw, 3rem);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(700px 300px at 100% 0%, rgb(95 196 204 / 0.18), transparent 60%),
    var(--deep);
  color: var(--deep-ink);
}

.cta-band h2 { color: #ffffff; }
.cta-band p { max-width: 60ch; color: var(--deep-muted); }
.cta-band .btn-secondary { background: transparent; border-color: rgb(255 255 255 / 0.35); color: #ffffff; }
.cta-band .btn-secondary:hover { border-color: #ffffff; color: #ffffff; }
.cta-band .btn-primary { background: #5fc4cc; color: #052129; }
.cta-band .btn-primary:hover { background: #93dde2; color: #052129; }

/* ---------- 17. Footer ---------- */
.site-footer {
  margin-top: 0;
  padding-block: 3rem 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: 0.93rem;
}

.footer-grid { display: grid; gap: 2rem; }

@media (min-width: 820px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}

.footer-grid p { margin: 0.6rem 0 0; color: var(--muted); max-width: 40ch; }
.footer-title {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.footer-grid ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.4rem; }
.footer-grid a { color: var(--ink-2); text-decoration: none; }
.footer-grid a:hover { color: var(--accent); text-decoration: underline; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.86rem;
}

/* ---------- 18. Misc components ---------- */
.list-check { margin: 0 0 1rem; padding: 0; list-style: none; }
.list-check li { position: relative; padding-left: 1.6rem; color: var(--ink-2); }
.list-check li + li { margin-top: 0.45rem; }
.list-check li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.55em;
  width: 0.7rem;
  height: 0.38rem;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.list-dash { margin: 0 0 1rem; padding: 0; list-style: none; }
.list-dash li { position: relative; padding-left: 1.2rem; color: var(--ink-2); }
.list-dash li + li { margin-top: 0.4rem; }
.list-dash li::before { content: ""; position: absolute; left: 0; top: 0.75em; width: 0.6rem; height: 2px; background: var(--accent-line); }

.status-legend { display: flex; flex-wrap: wrap; gap: 0.6rem 1.25rem; margin: 0 0 1.5rem; padding: 0; list-style: none; font-size: 0.9rem; color: var(--ink-2); }
.status-legend li { display: inline-flex; align-items: center; gap: 0.5rem; }

.updates { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.9rem; }
.updates li { display: grid; gap: 0.2rem 1.5rem; padding: 1rem 1.15rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
@media (min-width: 760px) { .updates li { grid-template-columns: 180px 1fr; } }
.updates time { color: var(--muted); font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.8; }
.updates strong { display: block; margin-bottom: 0.15rem; }
.updates p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }

.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 1rem; }
.skill-group h3 { margin-bottom: 0.7rem; font-size: 1.02rem; }
.skill-group .chip-row { margin-bottom: 0; }

.columns-2 { columns: 2 260px; column-gap: 2.5rem; }
.columns-2 > * { break-inside: avoid; }

.notice-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  align-items: center;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.anchor-target { scroll-margin-top: calc(var(--header-h) + 20px); }

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

/* ---------- 20. Print ---------- */
@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .on-page,
  .btn-row,
  .toc,
  .copy-btn { display: none !important; }

  body { background: #ffffff; color: #000000; font-size: 11pt; }
  .hero,
  .page-hero,
  .section-alt { background: none !important; }
  .hero::before { display: none; }
  .card,
  .pub,
  .metric,
  .shot-frame { box-shadow: none; }
  a { color: #000000; }
  .section { padding-block: 1.5rem; }
}
