:root {
  color-scheme: light dark;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-muted: #ededeb;
  --text: #1d2328;
  --muted: #5b6670;
  --line: #d7d9d6;
  --accent: #126c83;
  --accent-strong: #0f5364;
  --accent-soft: #dceff3;
  --code-bg: #eef2f1;
  --shadow: 0 18px 45px rgba(34, 41, 47, 0.08);
  --shadow-soft: 0 10px 30px rgba(34, 41, 47, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101416;
    --surface: #171d20;
    --surface-muted: #20282b;
    --text: #edf1f2;
    --muted: #a9b4b8;
    --line: #2e393d;
    --accent: #66c5d7;
    --accent-strong: #9eddea;
    --accent-soft: #17333a;
    --code-bg: #11191c;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.18);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}
a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 65%, transparent);
  text-underline-offset: 0.2em;
}
a:hover { color: var(--accent-strong); }
a:focus-visible, main:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  transform: translateY(-150%);
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 160ms ease;
}
.skip-link:focus-visible { transform: translateY(0); }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
  text-decoration: none;
}
.brand-mark {
  display: inline-grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 0.82rem;
  letter-spacing: 0;
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.nav-links a {
  border-radius: 6px;
  padding: 0.15rem 0;
  text-decoration: none;
}
.nav-links a[aria-current="page"] { color: var(--accent-strong); font-weight: 800; }
.section {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) 0;
  scroll-margin-top: 6rem;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
  min-height: calc(100vh - 5rem);
}
.hero-copy h1 {
  max-width: 10ch;
  margin: 0;
  font-size: clamp(3.7rem, 12vw, 8rem);
  line-height: 0.9;
  letter-spacing: 0;
}
.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero-text {
  max-width: 680px;
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}
.button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem 1rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}
.button.primary {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #ffffff;
}
.button:hover { transform: translateY(-1px); }
.hero-side { display: grid; gap: 1rem; align-self: center; }
.hero-visual {
  aspect-ratio: 13 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.hero-visual svg { display: block; width: 100%; height: 100%; }
.visual-bg { fill: var(--surface); }
.visual-grid { opacity: 0.5; }
.hero-visual pattern path {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}
.visual-circuit {
  fill: none;
  stroke: var(--accent-strong);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
}
.visual-circuit circle, .visual-circuit rect { fill: var(--surface); }
.visual-labels {
  fill: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}
.focus-panel, .search-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.4rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.focus-panel h2 { margin: 0 0 1rem; font-size: 1rem; }
.focus-panel ul {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}
.section-heading { max-width: 760px; margin-bottom: 1.5rem; }
.section-heading h2, .doc-header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0;
}
.section-heading p { color: var(--muted); }
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.project-card {
  display: flex;
  min-height: 330px;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.project-card:hover, .project-card:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.project-card h3, .package-row h3 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  line-height: 1.25;
}
.project-card p, .package-row p {
  margin: 0;
  color: var(--muted);
}
.tags, .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.tags span, .badges span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.card-links a, .package-row a, .link-panel a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}
.card-links a::after, .package-row a::after, .link-panel a::after { content: " ->"; }
.package-list { display: grid; gap: 0.75rem; }
.package-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 0.45fr) auto;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.package-row:focus-within, .package-row:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow-soft);
}
.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.figure-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.figure-card img {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
}
.figure-card figcaption {
  border-top: 1px solid var(--line);
  padding: 0.85rem 1rem;
  color: var(--muted);
  font-weight: 700;
}
.split-section {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(1.5rem, 5vw, 4rem);
}
.link-panel { display: grid; gap: 0.85rem; }
.search-panel label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-weight: 800;
}
.search-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
}
.search-results {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}
.search-result {
  display: grid;
  gap: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--surface);
  text-decoration: none;
}
.search-result span { color: var(--muted); }
.doc-layout { max-width: 920px; }
.doc-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}
.markdown-body {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1rem, 4vw, 2rem);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  line-height: 1.2;
  letter-spacing: 0;
}
.markdown-body h2 {
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
  margin-top: 2rem;
}
.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: var(--code-bg);
}
code {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.12rem 0.35rem;
  background: var(--code-bg);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}
pre code {
  border: 0;
  padding: 0;
  background: transparent;
}
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: var(--surface);
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--surface-muted);
  color: var(--accent-strong);
}
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem clamp(1rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.site-footer a {
  font-weight: 700;
  text-decoration: none;
}
@media (max-width: 880px) {
  .hero, .split-section { grid-template-columns: 1fr; }
  .hero { min-height: auto; }
  .hero-side { grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr); align-items: stretch; }
  .project-grid, .figure-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .package-row { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .site-header { align-items: flex-start; flex-direction: column; gap: 0.75rem; }
  .nav-links { justify-content: flex-start; }
  .section { width: min(100% - 1rem, 1120px); padding: clamp(2.5rem, 12vw, 4rem) 0; }
  .hero-copy h1 { font-size: clamp(3.2rem, 18vw, 4.8rem); }
  .project-grid, .figure-grid, .hero-side { grid-template-columns: 1fr; }
  .project-card { min-height: 0; }
  .button { width: 100%; }
  .hero-actions { gap: 0.6rem; }
  .site-footer { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .button:hover, .project-card:hover, .project-card:focus-within { transform: none; }
}