:root {
  color-scheme: light dark;
  --bg: #fafaf9;
  --surface: #ffffff;
  --fg: #1c1917;
  --muted: #57534e;
  --border: #e7e5e4;
  --accent: #4f46e5;
  --accent-fg: #ffffff;
  --accent-soft: #eef2ff;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0a09;
    --surface: #171412;
    --fg: #f5f5f4;
    --muted: #a8a29e;
    --border: #292524;
    --accent: #818cf8;
    --accent-fg: #0c0a09;
    --accent-soft: #1e1b4b;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font: 16px/1.6 Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
ul { list-style: none; margin: 0; padding: 0; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

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

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 20px; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg);
  font-weight: 600; font-size: 15px; text-decoration: none;
  border: 1px solid var(--accent);
  transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); opacity: .92; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* Hero */
.hero {
  display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: center;
  padding-top: 96px; padding-bottom: 96px;
}
.avatar {
  width: 160px; height: 160px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--surface); box-shadow: 0 0 0 1px var(--border);
}
.avatar-ph {
  display: grid; place-items: center; font-size: 48px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.eyebrow { margin: 0 0 12px; color: var(--accent); font-weight: 600; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 700; }
.lede { margin: 20px 0 0; font-size: 18px; color: var(--muted); max-width: 60ch; }

/* Sections */
.section { padding-top: 72px; padding-bottom: 72px; border-top: 1px solid var(--border); }
.section h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.section-sub { margin: 8px 0 0; color: var(--muted); }

/* Projects */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 32px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { font-size: 19px; }
.card p { margin: 0; color: var(--muted); }
.card .tag { color: var(--accent); font-size: 13px; font-weight: 600; }
.stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.stack li { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* Full library */
.library { margin-top: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.library summary {
  cursor: pointer; padding: 16px 22px; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.library summary::-webkit-details-marker { display: none; }
.library summary::after { content: "+"; color: var(--accent); font-size: 22px; line-height: 1; }
.library[open] summary::after { content: "−"; }
.library-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 40px; padding: 8px 22px 26px; }
.library h3 { font-size: 15px; margin-bottom: 10px; color: var(--accent); }
.library li { font-size: 14px; color: var(--muted); padding: 6px 0; border-top: 1px solid var(--border); }
.library li strong { color: var(--fg); font-weight: 600; }

/* Side projects */
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.grid-2 .card h3 { font-size: 22px; }
.card-link { color: var(--accent); font-weight: 600; font-size: 15px; text-decoration: none; }
.card-link::after { content: " ↗"; }
.card-link:hover { text-decoration: underline; }

/* Skills */
.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 32px; }
.skills h3 { font-size: 17px; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 14px; background: var(--surface); }

.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; }
.download {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px; border-radius: var(--radius); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .15s ease;
}
.download:hover { border-color: var(--accent); }
.dl-title { font-weight: 600; }
.dl-meta { font-size: 13px; color: var(--muted); }
.dl-meta::after { content: " ↓"; color: var(--accent); }
.dl-link::after { content: " ↗"; }

/* Contact + footer */
.contact { text-align: center; }
.contact .actions { justify-content: center; }
.footer { padding-top: 32px; padding-bottom: 48px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 48px; padding-bottom: 56px; }
  .avatar { width: 112px; height: 112px; }
  .avatar-ph { font-size: 36px; }
  .skills, .downloads, .library-cols { grid-template-columns: 1fr; }  .nav nav a:not(.btn) { display: none; }
  .section { padding-top: 56px; padding-bottom: 56px; }
}
