:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --fg: #16181d;
  --muted: #5d636e;
  --accent: #2456d6;
  --accent-2: #0f9d8a;
  --edu: #d6457a;
  --rule: #e4e4df;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.04), 0 6px 20px rgb(16 24 40 / 0.06);
  --shadow-hi: 0 2px 4px rgb(16 24 40 / 0.06), 0 14px 32px rgb(16 24 40 / 0.12);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a20; --fg: #e9eaec; --muted: #9aa1ac;
    --accent: #7fa6ff; --accent-2: #4fd1bd; --edu: #f07aa6; --rule: #262a33;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.25);
    --shadow-hi: 0 2px 4px rgb(0 0 0 / 0.35), 0 14px 32px rgb(0 0 0 / 0.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.65 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
a:hover { text-decoration: underline; }
p { margin: 0 0 0.8rem; }

/* ---------------------------------------------------------------- nav */
nav.float {
  position: fixed; top: 0.9rem; left: 50%; transform: translateX(-50%); z-index: 10;
  display: flex; gap: 0.15rem; padding: 0.3rem; max-width: calc(100% - 2rem);
  overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid var(--rule); border-radius: 999px; box-shadow: var(--shadow);
}
nav.float::-webkit-scrollbar { display: none; }
nav.float a {
  flex: none; padding: 0.35rem 0.8rem; border-radius: 999px;
  color: var(--muted); font-size: 0.82rem; font-weight: 500; white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
nav.float a:hover { text-decoration: none; color: var(--fg); background: var(--rule); }
nav.float a.on { color: #fff; background: var(--accent); }
nav.float .home { font-weight: 700; color: var(--fg); }

/* --------------------------------------------------------------- hero */
.hero {
  position: relative; max-width: 58rem; margin: 0 auto; padding: 7.5rem 1rem 3rem;
}
.hero::before {
  content: ""; position: absolute; inset: -20rem -50vw auto; height: 42rem; z-index: -1;
  background:
    radial-gradient(38rem 20rem at 30% 60%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(30rem 18rem at 75% 50%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 70%);
}
.hero-inner { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.6rem; }
.avatar {
  flex: none; width: 7.5rem; height: 7.5rem; border-radius: 50%; object-fit: cover;
  box-shadow: var(--shadow-hi); border: 4px solid var(--surface);
}
.avatar.mono {
  display: grid; place-items: center; color: #fff;
  font: 600 2.6rem/1 Fraunces, Georgia, serif; letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
h1 {
  margin: 0; font: 600 clamp(2.2rem, 5vw, 3.3rem)/1.05 Fraunces, Georgia, serif;
  letter-spacing: -0.025em;
}
h1 .cred { font-size: 0.5em; color: var(--muted); letter-spacing: 0; }
.headline { margin: 0.5rem 0 0; color: var(--muted); font-size: 1.05rem; }
.lead { font-size: 1.12rem; line-height: 1.7; max-width: 46rem; color: color-mix(in srgb, var(--fg) 88%, var(--muted)); }

.contacts, .downloads { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0 0; }
.pill, .btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.42rem 0.9rem; border-radius: 999px; font-size: 0.88rem; font-weight: 500;
  background: var(--surface); color: var(--fg); border: 1px solid var(--rule);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.pill svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--accent); }
a.pill:hover, .btn:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.pill.quiet { color: var(--muted); background: transparent; border-color: transparent; padding-left: 0.2rem; }
.btn { padding: 0.6rem 1.25rem; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ----------------------------------------------------------- sections */
main { max-width: 58rem; margin: 0 auto; padding: 0 1rem; }
section { padding: 2.75rem 0 1rem; scroll-margin-top: 4rem; }
h2 {
  display: flex; align-items: center; gap: 0.8rem; margin: 0 0 1.5rem;
  font: 600 1.6rem/1.2 Fraunces, Georgia, serif; letter-spacing: -0.015em;
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
h3 { margin: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.35; }

.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 14px;
  padding: 1.25rem 1.4rem; box-shadow: var(--shadow);
  transition: box-shadow 0.25s, transform 0.25s;
}
.card:hover { box-shadow: var(--shadow-hi); transform: translateY(-2px); }
.card .when { display: block; margin-top: 0.15rem; font-size: 0.82rem; font-weight: 500; color: var(--accent); }
.org { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.93rem; }
.desc { margin: 0.75rem 0 0; }
.card ul { margin: 0.75rem 0 0; padding-left: 1.1rem; font-size: 0.95rem; }
.card li { margin-bottom: 0.45rem; }
.card li::marker { color: var(--accent); }
.prior { margin: 0.75rem 0 0; padding-top: 0.6rem; border-top: 1px dashed var(--rule); color: var(--muted); font-size: 0.86rem; }
details summary {
  cursor: pointer; list-style: none; display: inline-block; margin-top: 0.25rem;
  color: var(--accent); font-size: 0.86rem; font-weight: 600;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: " ↓"; }
details[open] summary { display: none; }
details ul { margin-top: 0 !important; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 8.5rem; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 7rem; top: 0.4rem; bottom: 0.4rem; width: 2px;
  background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent-2) 60%, transparent));
}
.tl-item { position: relative; margin-bottom: 1.4rem; }
.tl-date {
  position: absolute; left: -8.5rem; width: 6rem; top: 1.15rem; text-align: right;
  font-size: 0.82rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tl-dot {
  position: absolute; left: calc(-1.5rem - 7px); top: 1.35rem; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}
[data-kind="education"] .tl-dot { border-color: var(--edu); box-shadow: 0 0 0 4px color-mix(in srgb, var(--edu) 15%, transparent); }
[data-kind="education"] .timeline::before { background: linear-gradient(var(--edu), color-mix(in srgb, var(--edu) 30%, transparent)); }

/* card grid (awards) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.tag {
  display: inline-block; margin-bottom: 0.6rem; padding: 0.15rem 0.6rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* reference lists */
.refs { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.refs li {
  padding: 0.85rem 1.1rem; font-size: 0.94rem; line-height: 1.55;
  background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: 10px; transition: box-shadow 0.2s, border-color 0.2s;
}
.refs li:hover { box-shadow: var(--shadow); }
.refs li strong { color: var(--accent); font-weight: 600; }
.refs li.card-link { position: relative; padding-right: 2.6rem; transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s; }
.refs li.card-link a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.refs li.card-link::after {
  content: "↗"; position: absolute; right: 1rem; top: 0.85rem;
  color: var(--muted); font-weight: 600; transition: color 0.2s, transform 0.2s;
}
.refs li.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-hi); border-color: var(--accent); }
.refs li.card-link:hover::after { color: var(--accent); transform: translate(2px, -2px); }
.refs li.card-link:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.refs li.card-link a:focus-visible { outline: none; }
#peer_review .refs { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
#peer_review .refs li { border-left-color: var(--accent-2); padding: 0.6rem 0.9rem; }
.lead-sm { color: var(--muted); }
.note { color: var(--muted); font-style: italic; margin-top: 0.8rem; }

/* skills */
.chip-row { margin-bottom: 1.2rem; }
.chip-row h3 { margin-bottom: 0.5rem; font-size: 0.95rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; }
.chips span {
  padding: 0.3rem 0.75rem; border-radius: 999px; font-size: 0.86rem;
  background: var(--surface); border: 1px solid var(--rule);
}

footer { max-width: 58rem; margin: 3rem auto 0; padding: 1.5rem 1rem 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.8rem; }

/* scroll reveal: only when JS is running and motion is welcome */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
  .js .reveal.in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .pill, .btn { transition: none; }
}

/* ------------------------------------------------------------- mobile */
@media (max-width: 640px) {
  .hero { padding-top: 5.5rem; }
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .avatar { width: 5.5rem; height: 5.5rem; }
  .avatar.mono { font-size: 1.9rem; }
  .timeline { padding-left: 1.5rem; }
  .timeline::before { left: 0.25rem; }
  .tl-date { position: static; display: block; width: auto; text-align: left; margin-bottom: 0.35rem; }
  .tl-dot { left: calc(-1.25rem - 7px); top: 0.35rem; }
  .card { padding: 1.1rem; }
}
@media print {
  nav.float, .hero::before { display: none; }
  .js .reveal { opacity: 1; transform: none; }
  details > ul { display: block; }
}
