:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --text: #1a1c20;
  --muted: #5d6370;
  --line: #e4e4de;
  --accent: #c4441d;
  --accent-soft: #fdeee8;
  --on-accent: #ffffff;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --text: #e8e9ec;
    --muted: #9aa0ac;
    --line: #262a32;
    --accent: #ff7a50;
    --accent-soft: #2a1a14;
    --on-accent: #1a0d08;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.prose a, .card p a { color: var(--accent); text-underline-offset: 3px; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-weight: 700; font-size: 20px; text-decoration: none; letter-spacing: -0.02em; }
.brand .dot { color: var(--accent); }
.nav nav { display: flex; gap: 22px; }
.nav nav a { text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 500; }
.nav nav a:hover { color: var(--text); }

/* Hero */
.hero {
  display: flex; align-items: center; gap: 40px;
  padding-top: 88px; padding-bottom: 72px;
}
.eyebrow { margin: 0; font-family: var(--mono); color: var(--accent); font-size: 14px; }
h1 { margin: 4px 0 12px; font-size: clamp(34px, 6vw, 52px); line-height: 1.1; letter-spacing: -0.03em; }
.lead { margin: 0 0 24px; color: var(--muted); font-size: 19px; max-width: 34em; }

.links { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  text-decoration: none; font-weight: 500; font-size: 15px;
  transition: border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn svg { width: 17px; height: 17px; fill: currentColor; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Sections */
.section { padding-top: 56px; padding-bottom: 56px; border-top: 1px solid var(--line); }
h2 { margin: 0 0 28px; font-size: 28px; letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 12px; }
h2 .num { font-family: var(--mono); font-size: 14px; color: var(--accent); font-weight: 500; }
h3 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }

.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items: start; }
.prose p { margin: 0 0 16px; }
.facts {
  list-style: none; margin: 0; padding: 8px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.facts li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.facts li:last-child { border-bottom: 0; }
.facts .k { color: var(--muted); font-family: var(--mono); font-size: 13px; padding-top: 2px; }
.facts .v { font-weight: 500; text-align: right; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 8px 24px rgba(0, 0, 0, .05); }
.card p { margin: 10px 0 16px; color: var(--muted); font-size: 15.5px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card-foot { margin-top: auto; display: flex; gap: 18px; font-size: 14px; font-weight: 500; }
.card-foot a, .repo { color: var(--accent); text-decoration: none; }
.card-foot a:hover, .repo:hover { text-decoration: underline; text-underline-offset: 3px; }
.repo { font-family: var(--mono); font-size: 13px; }

.lang { font-family: var(--mono); font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.lang i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lang .py { background: #3572a5; }
.lang .c { background: #8a8f98; }
.lang .java { background: #b07219; }

.feature { padding: 28px 30px; border-left: 3px solid var(--accent); }
.feature p { color: var(--text); }
.bullets { margin: 0 0 20px; padding-left: 20px; color: var(--muted); font-size: 15.5px; }
.bullets li { margin-bottom: 8px; }
.bullets strong { color: var(--text); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span {
  font-family: var(--mono); font-size: 12.5px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}

.contact .lead { margin-bottom: 20px; }

.footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-top: 28px; padding-bottom: 40px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 14px; font-family: var(--mono);
}

/* 404 */
.notfound { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; }
.notfound .code { font-family: var(--mono); color: var(--accent); font-size: 15px; margin: 0; }

/* Mobile */
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .nav nav { gap: 14px; }
  .nav nav a { font-size: 14px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 24px; padding-top: 48px; padding-bottom: 48px; }
  .lead { font-size: 17px; }
  .about-grid, .grid { grid-template-columns: 1fr; gap: 20px; }
  .feature { padding: 22px 20px; }
  .section { padding-top: 44px; padding-bottom: 44px; }
}

@media (max-width: 400px) {
  .nav nav a[href="#research"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .card { transition: none; }
}
