/* ============================================================
   Eric Kenji Lee — personal site
   Hand-rolled, no build step. Design system + components.
   All colors are tokenized in :root so the whole theme — including
   the hero network graph (drawn from --hero-* vars by site.js) —
   can be swapped by overriding the variables in one block.
   ============================================================ */

/* Self-hosted Computer Modern (the LaTeX serif) — display type only */
@font-face { font-family: "Computer Modern Serif"; src: url("../fonts/cmunrm.woff") format("woff"); font-weight: normal; font-style: normal; font-display: swap; }
@font-face { font-family: "Computer Modern Serif"; src: url("../fonts/cmunbx.woff") format("woff"); font-weight: bold;   font-style: normal; font-display: swap; }
@font-face { font-family: "Computer Modern Serif"; src: url("../fonts/cmunti.woff") format("woff"); font-weight: normal; font-style: italic; font-display: swap; }
@font-face { font-family: "Computer Modern Serif"; src: url("../fonts/cmunbi.woff") format("woff"); font-weight: bold;   font-style: italic; font-display: swap; }

:root {
  /* ---- base palette: Daylight (white + blue + black) ---- */
  --paper:      #ffffff;
  --paper-2:    #f4f6f9;   /* slightly deeper panel */
  --ink:        #14171c;
  --muted:      #5c636e;
  --faint:      #e7eaef;   /* hairlines */
  --accent:     #2563eb;   /* cobalt blue */
  --accent-deep:#1d4ed8;
  --hero-bg:    #f1f6fd;   /* pale hero wash */
  --link:       #1d4ed8;

  /* ---- nav / footer ---- */
  --nav-bg:     rgba(255,255,255,.85);
  --footer-bg:  #0b1220;   /* dark footer anchors the light page */

  /* ---- hero + network-graph tokens ---- */
  --hero-ink:         #14171c;
  --hero-sub:         #2b323e;
  --hero-eyebrow:     #1d4ed8;
  --hero-name-accent: #2563eb;
  --hero-ghost-rgb:   20,23,28;
  --hero-scrim-rgb:   241,246,253;
  --hero-edge-intra:  rgba(37,99,235,0.05);
  --hero-edge-inter:  rgba(37,99,235,0.10);
  --hero-fiber-rgb:   147,197,253;
  --hero-glow:        0;
  --hero-nodes:       #60a5fa,#93c5fd,#bfdbfe,#7dd3fc,#3b82f6,#38bdf8,#93c5fd,#bae6fd;

  /* ---- component accents ---- */
  --badge-bg:         #e8f0ff;
  --card-hover-bd:    #cdddff;
  --social-hover-rgb: 37,99,235;

  --max:   1080px;
  --prose: 720px;

  --serif: "Computer Modern Serif", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --name:  "Computer Modern Serif", Georgia, "Times New Roman", serif;

  --shadow: 0 1px 2px rgba(31,29,27,.04), 0 8px 24px rgba(31,29,27,.06);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; color: var(--ink); }
h1 { font-size: clamp(2rem, 4vw, 2.9rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0 0 .6em; }
h3 { font-size: 1.25rem; margin: 0 0 .4em; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.prose { max-width: var(--prose); }

.section { padding: 72px 0; }
.section + .section { padding-top: 0; }
.section-label {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 14px;
}
.eyebrow { /* same vibe, light, for hero */
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .74rem;
  font-weight: 600;
}

/* lead paragraph */
.lead { font-size: 1.18rem; line-height: 1.6; color: #2b2f37; }
.muted { color: var(--muted); }

/* ---------- Top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--faint);
}
.nav-inner {
  max-width: var(--max); margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  font-family: var(--name); font-weight: 600; font-size: 1.12rem; color: var(--ink);
  letter-spacing: .01em; white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent-deep); }
.brand .brand-mark { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a {
  font-family: var(--sans); font-size: .92rem; color: #3a3d44; font-weight: 500;
  padding: 4px 0; position: relative;
}
.nav-links a:hover { color: var(--accent-deep); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.nav-cta {
  font-family: var(--sans); font-size: .88rem; font-weight: 600;
  border: 1px solid var(--faint); border-radius: 999px; padding: 6px 14px; color: var(--ink);
  background: #fff;
}
.nav-cta:hover { border-color: var(--accent); color: var(--accent-deep); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav-toggle svg { width: 26px; height: 26px; stroke: var(--ink); }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--faint);
    padding: 8px 24px 16px; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; width: 100%; border-bottom: 1px solid var(--faint); }
  .nav-links a:last-child { border-bottom: 0; }
  .nav-links .nav-cta { margin-top: 10px; }
}

/* ---------- Hero (network band) ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--hero-bg);
  min-height: 56vh; display: flex; align-items: center;
  border-bottom: 1px solid var(--faint);
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero::after { /* legibility + blend scrim */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 38%, rgba(var(--hero-scrim-rgb),0) 38%, rgba(var(--hero-scrim-rgb),.55) 100%),
    linear-gradient(to bottom, rgba(var(--hero-scrim-rgb),.35), rgba(var(--hero-scrim-rgb),0) 30%, rgba(var(--hero-scrim-rgb),.65));
}
.hero-inner { position: relative; z-index: 2; max-width: var(--max); margin: 0 auto; padding: 64px 24px; width: 100%; }
.hero-content { max-width: 760px; }
.hero .eyebrow { color: var(--hero-eyebrow); margin-bottom: 18px; }
.hero h1 {
  font-family: var(--name); font-weight: 700;
  color: var(--hero-ink); font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1.04; margin: 0 0 .35em;
  letter-spacing: -.01em;
}
.hero h1 .accent { color: var(--hero-name-accent); }
.hero-tagline { color: var(--hero-sub); font-size: clamp(1.05rem, 2.2vw, 1.35rem); line-height: 1.55; max-width: 640px; margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* WaveMAP data hero (Direction 3) */
.hero-wm::after { display: none; }                 /* no scrim — keep the data points crisp */
.hero-hint { margin-top: 18px; font-size: .85rem; color: var(--muted); }
.hero-hint b { color: var(--accent-deep); font-weight: 600; }
.wm-inset {
  position: absolute; right: 24px; bottom: 24px; z-index: 3; width: 234px; margin: 0;
  background: rgba(255,255,255,.92); border: 1px solid var(--faint); border-radius: 12px;
  box-shadow: var(--shadow); padding: 12px 12px 10px; backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .25s ease;
}
.wm-inset canvas { position: static; inset: auto; width: 100%; height: 110px; display: block; }
.wm-inset figcaption { font-size: .74rem; line-height: 1.4; margin-top: 8px; color: var(--ink); text-align: center; }
@media (max-width: 820px) { .wm-inset { right: 12px; bottom: 12px; width: 180px; } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-weight: 600; font-size: .95rem;
  padding: 11px 20px; border-radius: 999px; cursor: pointer; border: 1px solid transparent;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-deep); color: #fff; }
.btn-ghost { background: transparent; color: var(--hero-ink); border-color: rgba(var(--hero-ghost-rgb),.35); }
.btn-ghost:hover { border-color: rgba(var(--hero-ghost-rgb),.9); color: var(--hero-ink); }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--faint); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-deep); }

/* ---------- Intro / bio ---------- */
.intro-grid {
  display: grid; grid-template-columns: 220px 1fr; gap: 44px; align-items: start;
}
.intro-photo {
  width: 220px; height: 220px; border-radius: 50%; object-fit: cover;
  box-shadow: var(--shadow); border: 4px solid #fff;
}
.intro-photo-wrap { position: relative; }
.intro-photo-cap { font-size: .8rem; color: var(--muted); text-align: center; margin-top: 12px; }
@media (max-width: 720px) {
  .intro-grid { grid-template-columns: 1fr; gap: 24px; justify-items: start; }
  .intro-photo { width: 150px; height: 150px; }
}

/* ---------- Recent & Upcoming feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
  display: grid; grid-template-columns: 130px 1fr; gap: 20px;
  padding: 18px 0; border-top: 1px solid var(--faint);
}
.feed li:last-child { border-bottom: 1px solid var(--faint); }
.feed .when { font-size: .82rem; font-weight: 700; letter-spacing: .04em; color: var(--accent); text-transform: uppercase; padding-top: 2px; }
.feed .what { margin: 0; }
.feed .what .venue { font-style: italic; color: var(--muted); }
@media (max-width: 620px) {
  .feed li { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Cards (quick links / highlights) ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 820px) { .cards { grid-template-columns: 1fr; } }
.card {
  background: rgba(255,255,255,.6); border: 1px solid var(--faint); border-radius: 14px; padding: 24px;
  box-shadow: var(--shadow); transition: transform .1s ease, border-color .15s ease;
  display: flex; flex-direction: column; gap: 8px;
}
.card:hover { transform: translateY(-2px); border-color: var(--card-hover-bd); }
.card h3 { margin: 0; }
.card .card-kicker { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card .card-link { margin-top: auto; font-weight: 600; font-size: .92rem; }

/* ---------- Research page ---------- */
.theme { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; margin-bottom: 64px; }
.theme:nth-child(even) .theme-media { order: 2; }
.theme-media img { border-radius: 12px; border: 1px solid var(--faint); box-shadow: var(--shadow); background:#fff; }
.theme-fig { background: var(--hero-bg); border-radius:12px; border:1px solid var(--faint); }
@media (max-width: 760px) { .theme { grid-template-columns: 1fr; gap: 20px; } .theme:nth-child(even) .theme-media { order: 0; } }

/* ---------- Publications ---------- */
.pub-group { margin-bottom: 48px; }
.pub-year {
  font-family: var(--serif); font-size: 1.4rem; color: var(--ink);
  border-bottom: 1px solid var(--faint); padding-bottom: 8px; margin: 0 0 18px;
  display: flex; align-items: baseline; gap: 12px;
}
.pub { padding: 16px 0; border-bottom: 1px solid var(--faint); }
.pub:last-child { border-bottom: 0; }
.pub-title { font-weight: 600; color: var(--ink); }
.pub-authors { color: #3a3d44; font-size: .96rem; }
.pub-authors .me { color: var(--accent-deep); font-weight: 700; }
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.badge {
  font-family: var(--sans); font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent-deep); background: var(--badge-bg);
  border-radius: 999px; padding: 3px 10px;
}
.badge.soft { color: var(--muted); background: var(--paper-2); }
.pub-links a { font-size: .85rem; font-weight: 600; }
.pub-links a + a { margin-left: 14px; }

/* ---------- Outreach ---------- */
.ofeature { background: var(--paper-2); border:1px solid var(--faint); border-radius:14px; padding: 28px 28px; margin-bottom: 40px; }
.olist { list-style: none; margin: 0; padding: 0; }
.olist li { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 14px 0; border-top: 1px solid var(--faint); }
.olist li:last-child { border-bottom: 1px solid var(--faint); }
.olist .role { font-weight: 600; }
.olist .org { color: var(--muted); font-size: .95rem; }
.olist .yr { color: var(--muted); font-size: .85rem; white-space: nowrap; text-align: right; }
@media (max-width: 560px){ .olist li { grid-template-columns: 1fr; } .olist .yr { text-align: left; } }

/* ---------- Writing list ---------- */
.posts { list-style: none; margin: 0; padding: 0; }
.post-item { padding: 26px 0; border-top: 1px solid var(--faint); }
.post-item:last-child { border-bottom: 1px solid var(--faint); }
.post-item h3 { margin: 0 0 6px; }
.post-item .post-date { font-size: .82rem; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.post-item p { margin: 8px 0 0; color: var(--muted); }
.post-tag { display:inline-block; font-size:.7rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); border:1px solid var(--faint); border-radius:999px; padding:2px 9px; margin-left:8px; vertical-align: middle; }

/* ---------- Footer ---------- */
.footer { background: var(--footer-bg); color: #c6c8cd; margin-top: 80px; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 54px 24px 40px; }
.footer h2 { color: #f3f3f0; }
.footer p { color: #9aa0a8; max-width: 520px; }
.social { display: flex; gap: 14px; margin: 22px 0 28px; flex-wrap: wrap; }
.social a {
  width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.14); color: #d7d9de; transition: all .15s ease;
}
.social a:hover { border-color: var(--accent); color: #fff; background: rgba(var(--social-hover-rgb),.18); text-decoration: none; transform: translateY(-2px); }
.social svg { width: 19px; height: 19px; fill: currentColor; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 20px; font-size: .82rem; color: #7e848d; display:flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.footer-bottom a { color: #aeb3ba; }

/* entrance animation */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
.rise-2 { animation-delay: .08s; }
.rise-3 { animation-delay: .16s; }
@media (prefers-reduced-motion: reduce) { .rise, .rise-2, .rise-3 { animation: none; } }

/* ---------- Article (blog posts) ---------- */
.post-head { margin: 4px 0 28px; }
.post-head .post-meta { font-size: .82rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.post-head h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); margin: 0; line-height: 1.1; }
.post-head .post-sub { color: var(--muted); margin: 14px 0 0; font-size: 1.1rem; line-height: 1.5; }
.post-hero { width: 100%; max-height: 400px; object-fit: cover; border-radius: 14px; border: 1px solid var(--faint); box-shadow: var(--shadow); }
.article { font-size: 1.06rem; line-height: 1.75; color: #24272e; }
.article p { margin: 0 0 1.2em; }
.article h2 { font-size: 1.55rem; margin: 1.9em 0 .55em; padding-bottom: .25em; border-bottom: 1px solid var(--faint); }
.article h3 { font-size: 1.2rem; margin: 1.5em 0 .45em; color: var(--ink); }
.article h4 { font-size: .82rem; margin: 1.6em 0 .5em; color: var(--accent-deep); font-family: var(--sans); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.article ul, .article ol { margin: 0 0 1.2em; padding-left: 1.3em; }
.article li { margin: .45em 0; }
.article blockquote { margin: 1.5em 0; padding: 14px 22px; border-left: 3px solid var(--accent); background: var(--paper-2); border-radius: 0 10px 10px 0; color: #2f333a; font-size: .98rem; }
.article blockquote p { margin: 0 0 .4em; }
.article blockquote cite { display: block; font-size: .84rem; color: var(--muted); font-style: normal; }
.article figure { margin: 1.8em 0; }
.article figure img { width: 100%; border-radius: 12px; border: 1px solid var(--faint); box-shadow: var(--shadow); }
.article figcaption { font-size: .82rem; color: var(--muted); text-align: center; margin-top: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 1.6em 0; align-items: start; }
.gallery.logos { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); align-items: center; }
.gallery a { display: block; }
.gallery img { width: 100%; border-radius: 10px; border: 1px solid var(--faint); box-shadow: var(--shadow); background: #fff; transition: transform .1s ease; }
.gallery.logos img { border: 0; box-shadow: none; background: transparent; }
.gallery a:hover img { transform: translateY(-2px); }
.gallery-note { font-size: .8rem; color: var(--muted); margin: -.6em 0 1.6em; }
.pw { border: 1px solid var(--faint); border-radius: 8px; padding: 7px 11px; font-size: .95rem; margin: 2px 8px 2px 0; font-family: var(--sans); }
.post-nav { display: flex; justify-content: space-between; gap: 16px; margin: 52px 0 0; padding-top: 22px; border-top: 1px solid var(--faint); font-weight: 600; font-size: .95rem; }

/* small helpers */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.stack > * + * { margin-top: 1em; }
hr.rule { border: 0; border-top: 1px solid var(--faint); margin: 40px 0; }

/* ---------- Scroll-reveal + hand-drawn tool sketches ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* faint hand-drawn watermarks, half-tucked behind the text (out of flow) */
.has-sketch { position: relative; overflow: hidden; }
.has-sketch > .container { position: relative; z-index: 1; }
.sketch-bg { position: absolute; z-index: 0; pointer-events: none; opacity: 0; transform: translateY(28px); transition: opacity 1.1s ease, transform 1.1s cubic-bezier(.2,.7,.2,1); }
.sketch-bg.in { opacity: .18; transform: none; }
.sketch-brain { width: min(368px, 38vw); right: -5%; top: 10%; }
.sketch-task  { width: min(352px, 37vw); right: -4%; left: auto; top: 0; }
.sketch-probe { left: 2%; right: auto; width: min(1060px, 96vw); top: 0; }
@media (prefers-reduced-motion: reduce) { .sketch-bg { opacity: .15; transform: none; transition: none; } }
@media (max-width: 760px) { .sketch-bg { opacity: .08; } .sketch-probe { width: 92vw; right: -24%; } .sketch-brain { width: 74vw; } .sketch-task { width: 66vw; } }
