:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --ink: #1c1b19;
  --muted: #625f58;
  --line: #e4e0d7;
  --accent: #6b3fc9;
  --accent-ink: #ffffff;
  --chip: #efece5;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131217;
    --surface: #1b1a21;
    --ink: #ebe9ee;
    --muted: #a6a3b0;
    --line: #2e2c38;
    --accent: #b9a1f7;
    --accent-ink: #1b1233;
    --chip: #24222d;
  }
}

:root[data-theme="dark"] {
  --bg: #131217;
  --surface: #1b1a21;
  --ink: #ebe9ee;
  --muted: #a6a3b0;
  --line: #2e2c38;
  --accent: #b9a1f7;
  --accent-ink: #1b1233;
  --chip: #24222d;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}

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

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

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

.wrap {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--surface);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.bar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  margin-right: auto;
  white-space: nowrap;
}

nav {
  display: flex;
  gap: 22px;
}

nav a {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}

nav a:hover {
  color: var(--ink);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

/* Hero */

.hero {
  padding-top: 88px;
  padding-bottom: 72px;
}

.eyebrow {
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 24px;
  max-width: 17em;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 5.4vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lede {
  margin: 0 0 32px;
  max-width: 62ch;
  font-size: 1.1rem;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

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

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

.btn.primary:hover {
  filter: brightness(1.08);
  color: var(--accent-ink);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 64px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stats > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  padding: 22px 20px 22px 0;
}

.stats > div + div {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.stats dd {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.1;
}

.stats dt {
  margin-top: 6px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
}

/* Sections */

.section {
  padding-top: 56px;
  padding-bottom: 56px;
}

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

h2 {
  margin: 0 0 32px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h3 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.3;
}

ul {
  margin: 0;
  padding-left: 1.1em;
}

li {
  margin-bottom: 8px;
  padding-left: 4px;
}

li::marker {
  color: var(--accent);
}

.role {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 24px;
}

.role + .role {
  margin-top: 40px;
}

.when {
  padding-top: 5px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.org {
  display: block;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1rem;
  color: var(--accent);
}

/* Projects */

.cards {
  display: grid;
  gap: 20px;
}

.card {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 12px 36px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.card-meta {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.card {
  position: relative;
  transition: border-color 0.15s;
}

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

.card h3 a {
  text-decoration: none;
}

/* Stretch the title link over the whole card so the card is one tap target. */
.card h3 a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
}

.card h3 a::after {
  content: " \2197";
  color: var(--accent);
  font-family: var(--sans);
  font-weight: 400;
}

.card li {
  font-size: 0.95rem;
}

.tags,
.skills dd {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.tags {
  margin-top: 18px;
}

.tags span,
.skills dd span {
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--chip);
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

.card-link {
  position: relative;
  z-index: 1;
  margin: 16px 0 0;
  font-size: 0.9rem;
}

/* Data-flow rows at the bottom of a project card. */
.pipeline {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.flow {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: baseline;
}

.flow-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.flow ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

.flow li + li::before {
  content: "\2192";
  color: var(--accent);
}

.flow li span {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

/* Smaller repos */

.subhead {
  margin: 48px 0 20px;
  font-size: 1.15rem;
}

.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.repo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s;
}

.repo:hover {
  border-color: var(--accent);
  color: inherit;
}

.repo-name {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.repo-name::after {
  content: " \2197";
  color: var(--accent);
}

.repo-desc {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}

.repo-tech {
  margin-top: auto;
  padding-top: 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.all-repos {
  margin: 20px 0 0;
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* Skills */

.skills {
  margin: 0;
}

.skills > div {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 24px;
  align-items: baseline;
}

.skills > div + div {
  margin-top: 18px;
}

.skills dt {
  font-weight: 500;
}

.education {
  margin-top: 56px;
}

.education h2 {
  margin-bottom: 16px;
}

.education p {
  margin: 0;
}

/* Contact */

.contact-line {
  margin: 0 0 12px;
  color: var(--muted);
}

.email {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.4rem, 4.6vw, 2.4rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 24px 0 0;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.site-footer {
  padding-top: 28px;
  padding-bottom: 40px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

/* Small screens */

@media (max-width: 760px) {
  nav {
    display: none;
  }

  .hero {
    padding-top: 56px;
    padding-bottom: 48px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 48px;
  }

  .stats > div:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .stats > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .role,
  .skills > div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

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

  .flow {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .wrap {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media print {
  .site-header,
  .actions {
    display: none;
  }
}
