:root {
  --font-display: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --container: 1120px;
}

[data-theme="dark"] {
  --bg: #0F1115;
  --surface: #171A20;
  --surface-alt: #1E232B;
  --text: #F0EEE9;
  --muted: #A3A8B2;
  --accent: #2DC49A;
  --accent-ink: #0B0E11;
  --border: #2C323D;
  --border-strong: #5C6577;
  --bar-mid: #748094;
  --bar-base: #4A5260;
}

[data-theme="light"] {
  --bg: #F5F3EE;
  --surface: #FFFFFF;
  --surface-alt: #EAE6DD;
  --text: #14171D;
  --muted: #4B5260;
  --accent: #0E7A5C;
  --accent-ink: #FFFFFF;
  --border: #D2CDC2;
  --border-strong: #6E7685;
  --bar-mid: #636C7C;
  --bar-base: #9AA1AE;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a[href],
button,
summary,
select,
[role="tab"],
[role="button"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1rem;
  font-weight: 600;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  min-height: 44px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.desktop-nav {
  display: none;
  align-items: center;
  gap: 1.25rem;
}

.desktop-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0.25rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.desktop-nav a:hover {
  color: var(--text);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ctrl-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.85rem;
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
}

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

.mobile-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1.25rem 1.25rem;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.mobile-nav[hidden] {
  display: none;
}

.mobile-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.75rem 0.25rem;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.mobile-nav a:last-child {
  border-bottom: 0;
}

/* Hero */
.hero {
  padding: 3rem 0 3.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

.hero-copy h1 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.hero-sub {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 1.0625rem;
  max-width: 58ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
}

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

.btn-primary:hover {
  filter: brightness(1.06);
}

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

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

.spec-panel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.spec-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  background-color: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.spec-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.spec-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.12rem 0.45rem;
}

.spec-list {
  margin: 0;
  padding: 0.25rem 1.15rem;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.spec-row:last-child {
  border-bottom: 0;
}

.spec-row dt {
  color: var(--muted);
}

.spec-row dd {
  margin: 0;
  text-align: right;
  color: var(--text);
}

/* Sections */
.section {
  padding: 3.25rem 0;
  border-bottom: 1px solid var(--border);
}

.section-tinted {
  background-color: var(--surface);
}

.section-head {
  margin-bottom: 2rem;
}

.section-head h2,
.split-grid h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.section-sub {
  margin: 0;
  color: var(--muted);
  max-width: 66ch;
}

/* Benchmarks */
.bench-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.bench-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.bench-table th,
.bench-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.bench-table thead th {
  background-color: var(--surface-alt);
  font-weight: 600;
  color: var(--text);
}

.bench-table tbody tr:last-child td {
  border-bottom: 0;
}

.bench-table .highlight {
  color: var(--accent);
  font-weight: 500;
}

.bench-table .total-row td {
  font-weight: 600;
  background-color: var(--surface-alt);
}

.bar-panel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.bar-panel h3 {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  font-family: var(--font-display);
}

.bar-group {
  margin-bottom: 1rem;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.bar-track {
  width: 100%;
  height: 12px;
  background-color: var(--surface-alt);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
}

.bar-accent {
  background-color: var(--accent);
}

.bar-mid {
  background-color: var(--bar-mid);
}

.bar-base {
  background-color: var(--bar-base);
}

.bench-repro {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
}

.bench-repro code {
  font-family: var(--font-mono);
  color: var(--text);
  background-color: var(--surface-alt);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

/* Pipeline */
.pipeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.pipe-step {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.pipe-num {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.pipe-step h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.pipe-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

/* Interfaces Tabs */
.tabs-shell {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  background-color: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.tablist [role="tab"] {
  min-height: 44px;
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
}

.tablist [role="tab"][aria-selected="true"] {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.code-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.tabpanel pre {
  margin: 0;
  padding: 1.15rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}

/* Roadmap & License */
.split-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.roadmap-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
}

.roadmap-list li {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.roadmap-list li:last-child {
  border-bottom: 0;
}

.ver {
  color: var(--accent);
  font-weight: 500;
}

.license-box {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.license-box p {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.license-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Footer */
.site-footer {
  padding: 2rem 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: space-between;
}

.footer-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
}

.footer-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 0.92rem;
}

.footer-links a:hover {
  color: var(--text);
}

/* Tablet breakpoint (>= 640px) */
@media (min-width: 640px) {
  .pipeline-list {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-inner {
    flex-direction: row;
    align-items: center;
  }
}

/* Desktop breakpoint (>= 960px) */
@media (min-width: 960px) {
  .desktop-nav {
    display: flex;
  }
  .mobile-only {
    display: none;
  }
  .hero {
    padding: 4.5rem 0 4.5rem;
  }
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2.5rem;
  }
  .section {
    padding: 4.5rem 0;
  }
  .bench-layout {
    grid-template-columns: 1.35fr 0.65fr;
    align-items: start;
  }
  .pipeline-list {
    grid-template-columns: repeat(4, 1fr);
  }
  .split-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition: none !important;
    animation: none !important;
  }
}
