:root {
  --bg: #0b0b0c;
  --surface: #151517;
  --surface-hover: #1c1c1f;
  --border: #2a2a2e;
  --text: #ecebe8;
  --muted: #a3a09a;
  --accent: #ef4444;
  --accent-strong: #e5383b;
  --on-accent: #ffffff;
  --code-bg: #111113;
  --ok: #4ade80;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfaf8;
    --surface: #ffffff;
    --surface-hover: #f4f2ee;
    --border: #dedad3;
    --text: #1b1a18;
    --muted: #5f5b54;
    --accent: #b91c1c;
    --accent-strong: #b91c1c;
    --code-bg: #f3f1ec;
    --ok: #15803d;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.wrap { width: 100%; max-width: 62rem; margin: 0 auto; padding: 0 1.25rem; }

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 0; padding: 0.5rem 1rem; background: var(--surface); }
.skip:focus { left: 0; z-index: 10; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }

/* Header and footer */

.site-header { border-bottom: 1px solid var(--border); }
.site-header nav { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding-top: 1rem; padding-bottom: 1rem; }
.site-header ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.site-header a { color: var(--muted); text-decoration: none; }
.site-header a:hover, .site-header a[aria-current="page"] { color: var(--text); }
.site-header .brand { color: var(--text); font-weight: 700; }

main.wrap { flex: 1; padding-top: 3.5rem; padding-bottom: 4rem; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1.5rem; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; margin: 0; padding: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.site-footer p { margin: 0; }

/* Home */

.hero { max-width: 46rem; }
.hero h1 { font-size: clamp(2.5rem, 7vw, 4rem); margin: 0.75rem 0 0; }
.hero .role { margin: 0.5rem 0 0; font-size: clamp(1.15rem, 3vw, 1.5rem); color: var(--accent); font-weight: 600; }
.hero .lede { margin: 1.5rem 0 0; font-size: 1.2rem; color: var(--muted); }

.status { display: inline-flex; align-items: center; gap: 0.6rem; margin: 0; padding: 0.3rem 0.85rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.9rem; color: var(--muted); }
.status .dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--ok); flex: none; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0 0; }
.button { display: inline-block; padding: 0.6rem 1.15rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; }
.button:hover { background: var(--surface-hover); border-color: var(--muted); }
.button.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.button.primary:hover { filter: brightness(1.1); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin: 3.5rem 0 0; }
.stats div { padding: 1.25rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.stats dt { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.stats dd { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }

.seeking { margin: 1.5rem 0 0; color: var(--muted); font-size: 0.95rem; }

#projects, #writing { margin-top: 4rem; scroll-margin-top: 1.5rem; }
#projects h2, #writing h2 { font-size: 1.5rem; margin: 0 0 1.25rem; }

.project { padding: 1.6rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.project + .project { margin-top: 1rem; }
.project h3 { margin: 0; font-size: 1.3rem; }
.project p { margin: 0.75rem 0 0; color: var(--muted); max-width: 46rem; }
.project ul { margin: 0.9rem 0 0; padding-left: 1.2rem; color: var(--muted); max-width: 46rem; }
.project li { margin-bottom: 0.3rem; }
.project .meta { margin-top: 1.1rem; }
.project-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-weight: 600; }

.articles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.articles a { display: flex; flex-direction: column; height: 100%; padding: 1.4rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: inherit; text-decoration: none; transition: border-color 0.15s, background-color 0.15s; }
.articles a:hover { border-color: var(--accent); background: var(--surface-hover); }
.articles h3 { margin: 0; font-size: 1.15rem; }
.articles p { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.97rem; line-height: 1.55; }
.articles .meta { margin-top: auto; padding-top: 1rem; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--muted); }
.tag { padding: 0.1rem 0.55rem; border: 1px solid var(--border); border-radius: 999px; white-space: nowrap; }
.meta .date { margin-left: 0.25rem; }

/* Articles and pages */

.prose { max-width: 46rem; margin: 0 auto; }
.prose > header { margin-bottom: 2rem; }
.prose h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin: 0.75rem 0 0; }
.prose h2 { font-size: 1.45rem; margin: 2.75rem 0 0.75rem; }
.prose h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.15rem; }
.prose li { margin-bottom: 0.35rem; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 650; }

.prose code { font-family: var(--mono); font-size: 0.88em; padding: 0.12em 0.35em; border-radius: 4px; background: var(--code-bg); border: 1px solid var(--border); overflow-wrap: anywhere; }
.prose pre { margin: 0 0 1.4rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--code-bg); overflow-x: auto; font-size: 0.86rem; line-height: 1.55; tab-size: 2; }
.prose pre code { padding: 0; border: 0; background: none; font-size: inherit; overflow-wrap: normal; }

.code { position: relative; }
.code pre { padding-top: 2.4rem; }
.copy { position: absolute; top: 0.45rem; right: 0.45rem; padding: 0.15rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--muted); font: inherit; font-size: 0.75rem; cursor: pointer; }
.copy:hover { color: var(--text); border-color: var(--muted); }

.prose table { display: block; overflow-x: auto; width: 100%; margin: 0 0 1.4rem; border-collapse: collapse; font-size: 0.93rem; line-height: 1.5; }
.prose th, .prose td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose td:not(:first-child) { min-width: 9rem; }
.prose td code { white-space: nowrap; }
.prose th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }

.prose blockquote { margin: 0 0 1.4rem; padding: 0.1rem 0 0.1rem 1.1rem; border-left: 3px solid var(--accent); color: var(--muted); }
.prose blockquote p:last-child { margin-bottom: 0; }

.back { margin-top: 3rem; }

/* About */

.job { margin-top: 2rem; }
.job h3 { margin: 0; }
.job .when { margin: 0.15rem 0 0.5rem; color: var(--muted); font-size: 0.92rem; }
.job .roles { list-style: none; padding: 0; margin: 0 0 0.75rem; font-weight: 600; }
.job .roles li { margin: 0; }

.skills dt { font-weight: 650; margin-top: 1rem; }
.skills dd { margin: 0.15rem 0 0; color: var(--muted); }

/* Contact */

.contact { list-style: none; padding: 0; border-top: 1px solid var(--border); }
.contact li { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: 0; padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
.contact span { width: 6rem; color: var(--muted); }

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