:root {
  --bg: #fafbfc;
  --bg-subtle: #f1f3f5;
  --surface: #ffffff;
  --border: #e2e6ea;
  --border-strong: #cdd3da;
  --text: #111418;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --accent: #0f4c5c;
  --accent-light: #e8f4f6;
  --accent-hover: #0a3a47;
  --positive: #047857;
  --max: 1080px;
  --narrow: 640px;
  --radius: 8px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html {
  scroll-behavior: smooth;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--bg-subtle);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.container {
  width: min(var(--max), calc(100% - 2rem));
  margin-inline: auto;
  padding-inline: max(0px, env(safe-area-inset-left)) max(0px, env(safe-area-inset-right));
}

/* —— Nav —— */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 251, 252, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
  gap: 1rem;
}

.logo {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-size: 0.875rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-cta {
  padding: 0.4rem 0.9rem;
  background: var(--accent);
  color: #fff !important;
  border-radius: var(--radius);
  font-weight: 500;
}

.nav-cta:hover {
  background: var(--accent-hover);
}

.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text);
}

/* —— Hero —— */
.hero {
  padding: clamp(3.5rem, 8vw, 5.5rem) 0 clamp(3rem, 6vw, 4rem);
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  max-width: 18ch;
}

.hero-lead {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: var(--narrow);
  margin: 0 0 2.5rem;
  line-height: 1.65;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2rem;
  max-width: 720px;
}

.metric {
  background: var(--surface);
  padding: 1.25rem 1.5rem;
}

.metric-value {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.metric-value span {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.metric-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid transparent;
}

.btn:hover {
  text-decoration: none;
}

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

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

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

.btn-outline:hover {
  border-color: var(--text-muted);
}

/* —— Sections —— */
section {
  padding: clamp(3.5rem, 7vw, 5rem) 0;
}

section + section {
  border-top: 1px solid var(--border);
}

.section-header {
  margin-bottom: 2.5rem;
}

.section-header h2 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

.section-header p {
  margin: 0;
  color: var(--text-secondary);
  max-width: 52ch;
  font-size: 1rem;
}

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

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

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

th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-subtle);
}

tr:last-child td {
  border-bottom: none;
}

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

tr.highlight td:first-child {
  font-weight: 600;
  color: var(--accent);
}

tr.highlight {
  background: var(--accent-light);
}

td.na {
  color: var(--text-muted);
}

.caption {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.bench-grid {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 900px) {
  .bench-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

/* —— Architecture —— */
.arch-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.arch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}

.arch-row:last-child {
  border-bottom: none;
}

.arch-node {
  flex: 1;
  min-width: 120px;
  padding: 1rem 1.25rem;
  border-right: 1px solid var(--border);
  font-size: 0.8125rem;
}

.arch-node:last-child {
  border-right: none;
}

.arch-node strong {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.arch-node span {
  color: var(--text-secondary);
}

.arch-center {
  background: var(--bg-subtle);
  text-align: center;
  font-weight: 500;
}

.arch-pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.arch-step {
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.arch-step em {
  display: block;
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

/* —— Features —— */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.feature h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.feature p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* —— Stack —— */
.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.stack-list span {
  font-size: 0.8125rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.info-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.info-card h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.info-card p {
  margin: 0;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
  word-break: normal;
}

.info-card p + p {
  margin-top: 0.5rem;
}

/* —— Footer —— */
footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

/* —— Mobile —— */
@media (max-width: 768px) {
  .container {
    width: min(var(--max), calc(100% - 1.25rem));
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 3.5rem;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem max(1rem, env(safe-area-inset-bottom));
    box-shadow: 0 8px 24px rgba(17, 20, 24, 0.08);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-links a:last-child {
    border-bottom: none;
  }

  .nav-cta {
    justify-content: center;
    margin-top: 0.25rem;
  }

  .nav-inner {
    position: relative;
  }

  .menu-btn {
    display: block;
    min-width: 44px;
    min-height: 44px;
  }

  .hero {
    padding-top: max(2.5rem, env(safe-area-inset-top));
  }

  .hero h1 {
    max-width: none;
    font-size: clamp(1.85rem, 8vw, 2.5rem);
  }

  .hero-lead {
    max-width: none;
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .metrics {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .metric {
    padding: 1rem 1.125rem;
  }

  .metric-value {
    font-size: 1.35rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    justify-content: center;
    width: 100%;
    min-height: 44px;
  }

  section {
    padding: clamp(2.5rem, 6vw, 3.5rem) 0;
  }

  .section-header {
    margin-bottom: 1.75rem;
  }

  .section-header p {
    max-width: none;
    font-size: 0.9375rem;
  }

  .bench-grid {
    gap: 2rem;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .bench-table table {
    min-width: 520px;
  }

  th,
  td {
    padding: 0.65rem 0.75rem;
    font-size: 0.8125rem;
  }

  .caption {
    font-size: 0.75rem;
    line-height: 1.5;
  }

  .arch-row {
    flex-direction: column;
  }

  .arch-node {
    min-width: 0;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1rem;
  }

  .arch-node:last-child {
    border-bottom: none;
  }

  .arch-pipeline {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .features {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .stack-list span {
    font-size: 0.75rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }

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

@media (max-width: 480px) {
  .hero-eyebrow {
    font-size: 0.75rem;
    line-height: 1.45;
  }

  .bench-table table {
    min-width: 0;
    font-size: 0.75rem;
  }

  .bench-table thead {
    display: none;
  }

  .bench-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
  }

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

  .bench-table tbody tr.highlight {
    background: var(--accent-light);
  }

  .bench-table td {
    border: none;
    padding: 0;
  }

  .bench-table td:first-child {
    grid-column: 1 / -1;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.15rem;
  }

  .bench-table td.num::before,
  .bench-table td.na::before {
    display: block;
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
    font-family: var(--font);
  }

  .bench-table tr.highlight td:nth-child(2)::before { content: "Overall"; }
  .bench-table tr.highlight td:nth-child(3)::before { content: "Retention"; }
  .bench-table tr.highlight td:nth-child(4)::before { content: "Feedback"; }
  .bench-table tr.highlight td:nth-child(5)::before { content: "Belief"; }

  .bench-table tr:not(.highlight) td:nth-child(2)::before { content: "Overall"; }
  .bench-table tr:not(.highlight) td:nth-child(3)::before { content: "Retention"; }
  .bench-table tr:not(.highlight) td:nth-child(4)::before { content: "Feedback"; }
  .bench-table tr:not(.highlight) td:nth-child(5)::before { content: "Belief"; }

  /* LongMemEval table has KU/Temporal/Abstain columns */
  .bench-card:last-child .bench-table tr.highlight td:nth-child(3)::before { content: "KU"; }
  .bench-card:last-child .bench-table tr.highlight td:nth-child(4)::before { content: "Temporal"; }
  .bench-card:last-child .bench-table tr.highlight td:nth-child(5)::before { content: "Abstain."; }
  .bench-card:last-child .bench-table tr:not(.highlight) td:nth-child(3)::before { content: "KU"; }
  .bench-card:last-child .bench-table tr:not(.highlight) td:nth-child(4)::before { content: "Temporal"; }
  .bench-card:last-child .bench-table tr:not(.highlight) td:nth-child(5)::before { content: "Abstain."; }
}
