:root {
  --bg: #0a0e13;
  --fg: #f3f1ec;
  --muted: #9aa3ad;
  --card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
  --a: #d8b47a;
  --b: #1f8f78;
  --c: #7f95e8;
  --grad: linear-gradient(120deg, #ecd3a6, var(--a) 35%, #6fcdb3 75%, #9fb0f5);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.7 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--c); outline-offset: 3px; border-radius: 6px; }

/* ---------- background ---------- */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; }
.blob {
  position: absolute;
  width: 55vmax; height: 55vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.38;
  animation: drift 24s ease-in-out infinite alternate;
}
.b1 { background: #1a6f66; top: -20vmax; left: -15vmax; }
.b2 { background: #b8894a; bottom: -25vmax; right: -15vmax; animation-duration: 30s; animation-delay: -8s; opacity: 0.32; }
.b3 { background: #3b4a9e; top: 30vh; left: 40vw; width: 35vmax; height: 35vmax; animation-duration: 36s; animation-delay: -15s; opacity: 0.2; }

@keyframes drift {
  to { transform: translate(12vmax, 8vmax) scale(1.2) rotate(30deg); }
}

.spotlight {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, 0.07), transparent 60%);
}

/* ---------- layout ---------- */
.site-header, main, footer {
  width: min(100% - 2rem, 62rem);
  margin-inline: auto;
}

.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 0;
}
.site-header::before {
  content: ""; position: absolute; inset: 0 -50vw; z-index: -1;
  background: linear-gradient(var(--bg) 40%, transparent);
  backdrop-filter: blur(8px);
  mask-image: linear-gradient(#000 60%, transparent);
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.4rem; letter-spacing: -0.03em; }
.brand span { color: var(--a); }
nav a { margin-left: 1.5rem; color: var(--muted); font-size: 0.95rem; transition: color 0.2s; }
nav a:hover { color: var(--fg); }

section { padding: 5rem 0; }

/* ---------- hero ---------- */
.hero {
  min-height: 82vh;
  position: relative;
  padding-bottom: 6rem;
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; align-items: center;
}
.eyebrow { color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.85rem; margin: 0 0 1rem; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; }
h1 {
  font-size: clamp(2.8rem, 10vw, 6.5rem);
  line-height: 1.02; letter-spacing: -0.03em;
  margin: 0 0 1.5rem; font-weight: 400;
}
.grad {
  background: var(--grad); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 8s linear infinite;
}
@keyframes shimmer { to { background-position: 200% 0; } }

.lead { font-size: clamp(1.15rem, 2.8vw, 1.6rem); color: var(--muted); max-width: 36rem; margin: 0 0 2rem; line-height: 1.45; }
.rotator { color: var(--fg); font-weight: 600; white-space: nowrap; border-bottom: 2px solid var(--a); }
.rotator-word { display: inline-block; transition: opacity 0.35s, transform 0.35s; }
.rotator-word.out { opacity: 0; transform: translateY(0.4em); }

.cta { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.btn {
  padding: 0.8rem 1.5rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); font-weight: 600; font-size: 0.98rem;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.3); }
.btn.primary { background: var(--grad); border-color: transparent; color: #0a0e13; box-shadow: 0 8px 30px -10px var(--a); }
.btn.primary:hover { box-shadow: 0 12px 40px -8px var(--a); }

.scroll-hint {
  position: absolute; bottom: 1.5rem; left: 0;
  color: var(--muted); font-size: 1.5rem; animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(8px); } }

/* ---------- sections ---------- */
h2 { font-size: clamp(1.9rem, 5vw, 2.7rem); font-weight: 400; letter-spacing: -0.02em; margin: 0 0 2rem; }
h2 .num { font-size: 0.9rem; color: var(--a); font-weight: 600; letter-spacing: 0.1em; vertical-align: super; margin-right: 0.6rem; }

.about-grid { display: grid; gap: 2.5rem; grid-template-columns: 1.4fr 1fr; align-items: start; }
.about-grid p { margin: 0 0 1.2rem; color: #d6d2e4; }
.about-grid strong { color: var(--fg); }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chips li {
  padding: 0.4rem 0.95rem; border-radius: 999px; font-size: 0.9rem;
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.chips li:hover { color: var(--fg); border-color: var(--a); transform: translateY(-2px); }

/* ---------- cards ---------- */
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }

.card {
  position: relative; display: flex; flex-direction: column; gap: 0.5rem;
  padding: 1.6rem; border-radius: 1.2rem;
  background: var(--card); border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.15s ease-out, border-color 0.3s, box-shadow 0.3s;
}
a.card:hover { border-color: transparent; box-shadow: 0 0 0 1px var(--a), 0 20px 60px -24px var(--a); }
.card h3 { margin: 0.2rem 0 0; font-size: 1.3rem; letter-spacing: -0.02em; }
.card p { margin: 0; color: var(--muted); font-size: 0.98rem; flex: 1; }
.tag { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: #6fcdb3; font-weight: 600; }
.more { margin-top: 0.8rem; font-weight: 600; font-size: 0.95rem; }
.more i { display: inline-block; font-style: normal; transition: transform 0.2s; }
.ico { width: 1em; height: 1em; vertical-align: -0.12em; margin-left: 0.15em; }
a.card:hover .more i { transform: translateX(6px); }
.card.soon { border-style: dashed; background: transparent; }
.card.soon .tag { color: var(--a); }

/* ---------- links ---------- */
.links { display: grid; gap: 0.8rem; }
.links a {
  display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.4rem;
  border: 1px solid var(--border); border-radius: 1rem; background: var(--card);
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.links a:hover { border-color: var(--a); transform: translateX(6px); background: rgba(216, 180, 122, 0.07); }
.links b { min-width: 5rem; }
.links span { color: var(--muted); flex: 1; overflow-wrap: anywhere; }
.links i { font-style: normal; color: var(--a); display: grid; }

footer { padding: 3rem 0 4rem; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--border); }
footer p { margin: 0; }

/* ---------- reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.8s ease, transform 0.8s ease; }
.js .reveal.in { opacity: 1; transform: none; }
.js .card.reveal.in { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }

@media (max-width: 40rem) {
  .about-grid { grid-template-columns: 1fr; }
  nav a { margin-left: 1rem; }
  .links a { flex-wrap: wrap; gap: 0.2rem 1rem; }
  .links span { flex-basis: 100%; order: 3; }
  .links i { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- portrait ---------- */
.portrait { margin: 0; justify-self: center; width: min(100%, 23rem); }
.frame {
  position: relative; aspect-ratio: 4 / 5;
  border-radius: 999px 999px 1.4rem 1.4rem;
  padding: 0.5rem; background: linear-gradient(160deg, rgba(216, 180, 122, 0.7), rgba(255, 255, 255, 0.04) 45%, rgba(111, 205, 179, 0.5));
  box-shadow: 0 30px 80px -30px rgba(216, 180, 122, 0.45);
  transform: translate3d(var(--px, 0), var(--py, 0), 0);
  transition: transform 0.2s ease-out;
}
.frame::after {
  content: ""; position: absolute; inset: 0.5rem; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 -60px 60px -40px rgba(10, 14, 19, 0.5);
}
.frame picture, .frame img { display: block; width: 100%; height: 100%; }
.frame img {
  object-fit: cover; object-position: 50% 28%;
  border-radius: 999px 999px 1rem 1rem;
  filter: saturate(1.03) contrast(1.02);
}
.portrait figcaption { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; margin-top: 1.1rem; text-align: center; }
.portrait figcaption b { font-family: var(--serif); font-weight: 400; font-size: 1.15rem; }
.portrait figcaption span { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0 0 3.5rem; padding: 0 0 0 1.6rem; border-left: 1px solid var(--border); }
.timeline li { position: relative; padding-bottom: 2rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: calc(-1.6rem - 5px); top: 0.55rem;
  width: 9px; height: 9px; border-radius: 50%; background: var(--a);
  box-shadow: 0 0 0 4px var(--bg), 0 0 14px var(--a);
}
.when { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: #6fcdb3; font-weight: 600; }
.timeline h3 { margin: 0.2rem 0 0; font-size: 1.2rem; letter-spacing: -0.02em; }
.timeline .org { margin: 0 0 0.4rem; color: var(--a); font-size: 0.95rem; }
.timeline p:last-child { margin: 0; color: var(--muted); font-size: 0.98rem; max-width: 40rem; }

.edu h3 { font-size: 1.3rem; margin: 0 0 1rem; letter-spacing: -0.02em; }
.edu-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.edu-grid > div {
  display: flex; flex-direction: column; gap: 0.3rem; padding: 1.2rem 1.3rem;
  border: 1px solid var(--border); border-radius: 1rem; background: var(--card);
}
.edu-grid span { color: var(--muted); font-size: 0.92rem; }
.edu-grid small { color: var(--muted); font-size: 0.82rem; line-height: 1.5; margin-top: 0.3rem; }

@media (max-width: 48rem) {
  .hero { grid-template-columns: 1fr; gap: 2rem; min-height: 0; padding-top: 1.5rem; }
  .portrait { order: -1; width: min(72%, 17rem); justify-self: start; }
  .portrait figcaption { align-items: flex-start; text-align: left; }
  .scroll-hint { display: none; }
}

/* ---------- project page additions ---------- */
.brand-link { display: flex; align-items: baseline; gap: 0.7rem; }
.crumb { color: var(--muted); font-size: 0.9rem; font-family: "Inter", system-ui, sans-serif; letter-spacing: 0; font-weight: 400; }
.site-header nav { display: flex; align-items: center; overflow-x: auto; white-space: nowrap; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.6rem); }
.hero { min-height: 74vh; }
.frame.wide { aspect-ratio: 4 / 5; }
.frame img { object-position: 50% 40%; }
.prose { max-width: 42rem; }
.prose p { margin: 0 0 1.2rem; color: #d6d2e4; }
.prose strong { color: var(--fg); }
.prose a, .note a, section p a:not(.btn), figcaption a, li a { color: var(--a); border-bottom: 1px solid rgba(216, 180, 122, 0.35); transition: border-color 0.2s; }
.prose a:hover, .note a:hover, section p a:not(.btn):hover, figcaption a:hover, li a:hover { border-color: var(--a); }
h3.sub { font-size: 1.35rem; letter-spacing: -0.02em; margin: 3rem 0 1rem; font-weight: 400; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 0.95rem; max-width: 42rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin: 3rem 0 2rem; }
.stat { padding: 1.3rem; border-radius: 1.2rem; background: var(--card); border: 1px solid var(--border); color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: 2.6rem; line-height: 1.1; margin-bottom: 0.3rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.mapbox { margin: 2rem 0; border-radius: 1.2rem; overflow: hidden; border: 1px solid var(--border); background: var(--card); box-shadow: 0 30px 80px -40px rgba(216, 180, 122, 0.4); }
.mapbox iframe { display: block; width: 100%; height: 34rem; border: 0; background: #fff; }
.mapbox figcaption { padding: 0.8rem 1.2rem; font-size: 0.9rem; color: var(--muted); border-top: 1px solid var(--border); }

.legend { display: flex; flex-wrap: wrap; gap: 0.6rem; list-style: none; padding: 0; margin: 0; }
.legend li { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.95rem 0.3rem 0.35rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--muted); font-size: 0.9rem; }
.legend img { width: 1.9rem; height: 1.9rem; background: #fff; border-radius: 50%; padding: 3px; }

.clusters { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.25rem; margin: 1.5rem 0; }
.cluster { padding: 1.6rem; border-radius: 1.2rem; background: var(--card); border: 1px solid var(--border); border-top: 4px solid var(--cc); }
.cluster .n { font-family: var(--serif); font-size: 2.8rem; line-height: 1; }
.cluster h4 { margin: 0.3rem 0 0.6rem; font-family: var(--serif); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.02em; }
.cluster ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.97rem; }
.cluster li { margin-bottom: 0.3rem; }

.callout { margin: 2rem 0; padding: 1.3rem 1.6rem; border-radius: 1.2rem; border: 1px solid var(--border); border-left: 3px solid var(--a); background: rgba(216, 180, 122, 0.07); color: #d6d2e4; }
.callout strong { color: var(--fg); }

.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 1.25rem; }
.gallery figure { margin: 0; padding: 0.7rem; border-radius: 1.2rem; background: #f6f4ef; border: 1px solid var(--border); }
.gallery img { display: block; width: 100%; height: auto; border-radius: 0.7rem; }
.gallery figcaption { text-align: center; font-size: 0.88rem; color: #4a463e; padding: 0.5rem 0 0.2rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 1.2rem; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: #6fcdb3; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
td { color: var(--muted); }
tr:last-child td { border-bottom: 0; }
code { background: rgba(255, 255, 255, 0.07); padding: 0.1rem 0.4rem; border-radius: 0.35rem; font-size: 0.88em; color: var(--fg); }
pre { margin: 0 0 1.5rem; padding: 1.2rem 1.4rem; border-radius: 1.2rem; overflow-x: auto; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); font-size: 0.88rem; line-height: 1.6; }
pre code { background: none; padding: 0; }

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem 2rem; }
footer a { color: var(--a); }

@media (max-width: 40rem) {
  .crumb { display: none; }
  .mapbox iframe { height: 26rem; }
  section { padding: 3.5rem 0; }
}
