/* =========================================================================
   Personal site — warm editorial theme (Anthropic-adjacent).
   Palette tokens are shared with the two embedded visualizations so the
   iframes feel native. Light + dark via prefers-color-scheme.
   ========================================================================= */

:root {
  color-scheme: light;
  --surface:  #fcfcfb;   /* page background   */
  --plane:    #f6f5f1;   /* panels / chips    */
  --plane-2:  #f0efe9;   /* hover fill        */
  --ink:      #1a1915;   /* primary text      */
  --ink-2:    #52514e;   /* secondary text    */
  --muted:    #8a8880;   /* tertiary / meta   */
  --border:   #e4e2d9;   /* hairlines         */
  --border-2: #d8d6cb;   /* stronger hairline */
  --accent:   #bd5b3d;   /* clay — links/CTA  */
  --accent-h: #a34a2f;   /* clay hover        */
  --accent-2: #eb6834;   /* orange (from viz) */
  --ring:     rgba(189, 91, 61, .28);

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
                Georgia, "Times New Roman", serif;
  --font-sans:  system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:  ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", Consolas, monospace;

  --maxw: 940px;
  --gutter: clamp(20px, 5vw, 48px);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface:  #1a1a19;
    --plane:    #222220;
    --plane-2:  #2a2a27;
    --ink:      #f3f1ea;
    --ink-2:    #c3c2b7;
    --muted:    #8f8d84;
    --border:   #2f2f2c;
    --border-2: #3a3a36;
    --accent:   #e08a63;
    --accent-h: #eea27f;
    --accent-2: #eb6834;
    --ring:     rgba(224, 138, 99, .32);
  }
}

/* ---------- reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

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

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }

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

/* skip link */
.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--surface);
  padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; color: var(--surface); }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }

section { padding-block: clamp(56px, 9vw, 104px); }
section + section { border-top: 1px solid var(--border); }

/* anchor offset for sticky nav */
:where(#about, #research, #portfolio, #publications, #contact) { scroll-margin-top: 84px; }

/* ---------- headings ---------- */
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; line-height: 1.15;
  letter-spacing: -.01em; color: var(--ink); margin: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: var(--accent); opacity: .6;
}

.section-head { max-width: 62ch; margin-bottom: clamp(28px, 5vw, 44px); }
.section-head h2 { font-size: clamp(26px, 4vw, 34px); }
.section-head p { color: var(--ink-2); margin: 12px 0 0; font-size: 16px; }
/* Full-page-width variant: intro text spans the whole .wrap instead of the 62ch reading measure. */
.section-head.wide { max-width: none; }
.section-head.wide p em { font-style: italic; }

/* ============================ NAV ============================ */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 13px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  font-family: var(--font-serif); font-size: 19px; font-weight: 600;
  color: var(--ink); letter-spacing: -.01em; white-space: nowrap;
}
.brand .dot { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--ink-2); font-size: 15px; padding: 7px 12px; border-radius: 8px;
  position: relative; transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--ink); background: var(--plane); }
.nav-cta {
  color: var(--surface) !important; background: var(--accent);
  font-weight: 500; padding: 7px 15px !important;
}
.nav-cta:hover { background: var(--accent-h) !important; color: var(--surface) !important; }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--border-2);
  border-radius: 8px; padding: 7px 9px; cursor: pointer; color: var(--ink);
}
.nav-toggle svg { display: block; }

@media (max-width: 660px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: 100%; right: var(--gutter); left: var(--gutter);
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 8px; margin-top: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,.12);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 14px; }
  .nav-cta { text-align: center; margin-top: 4px; }
}

/* ============================ HERO / ABOUT ============================ */
.hero { padding-top: clamp(48px, 8vw, 88px); }
.hero-grid {
  display: grid; grid-template-columns: 1fr 260px; gap: clamp(28px, 5vw, 56px);
  align-items: start;
}
@media (max-width: 720px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; }
}

.hero h1 { font-size: clamp(34px, 6.4vw, 56px); letter-spacing: -.02em; }
.hero .tagline {
  font-family: var(--font-mono); font-size: 14px; color: var(--ink-2);
  margin: 18px 0 0; line-height: 1.55;
}
.hero .bio { color: var(--ink-2); font-size: 17.5px; max-width: 54ch; margin: 22px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 0; padding: 0; list-style: none; }
.chips li {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2);
  background: var(--plane); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 999px;
}

.jobmarket {
  display: inline-flex; align-items: center; gap: 9px; margin: 26px 0 0;
  font-size: 14.5px; color: var(--ink-2);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 32%, transparent);
  padding: 8px 14px; border-radius: 999px;
}
.jobmarket .pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2);
  box-shadow: 0 0 0 0 var(--ring); animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--ring); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 0; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 500; padding: 11px 20px; border-radius: 10px;
  border: 1px solid transparent; transition: background .15s, border-color .15s, transform .15s;
}
.btn-primary { background: var(--accent); color: var(--surface); }
.btn-primary:hover { background: var(--accent-h); color: var(--surface); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--plane); color: var(--ink); }

.socials { display: flex; flex-wrap: wrap; gap: 4px; margin: 22px 0 0; padding: 0; list-style: none; }
.socials a {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--ink-2); font-size: 14px; padding: 6px 10px; border-radius: 8px;
  transition: color .15s, background .15s;
}
.socials a:hover { color: var(--accent); background: var(--plane); }
.socials svg { width: 16px; height: 16px; }

.portrait {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--plane);
  aspect-ratio: 4 / 5;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
  pointer-events: none;
}

/* ============================ RESEARCH ============================ */
.work { margin-top: clamp(36px, 6vw, 56px); }
.work:first-of-type { margin-top: 0; }
.work-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.work-head h3 { font-size: clamp(20px, 3vw, 25px); }
.work-tag {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
/* Description now sits BELOW the frame as a full abstract, so it spans the
   frame's full width instead of being capped at a reading measure. */
.work p.desc { color: var(--ink-2); margin: 18px 0 0; max-width: none; font-size: 16px; }

.frame {
  margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  transition: box-shadow .2s, border-color .2s;
}
.frame:hover { box-shadow: 0 10px 30px rgba(0,0,0,.08); border-color: var(--border-2); }
.frame iframe { width: 100%; border: 0; display: block; background: var(--surface); }
/* Chart: the widget is responsive and reports its own height via postMessage
   (see index.html); this is the pre-JS / no-JS fallback, sized to the chart's
   natural maximum so it never clips. */
.frame.chart iframe { height: 596px; }
/* Map: a fixed golden-ratio figure box (1000x618) centered in its own doc, so
   the frame must be exactly 618px tall or the box overflows and scrolls. */
.frame.map iframe { height: 618px; }
@media (max-width: 600px) {
  .frame.chart iframe { height: 560px; }
}
.frame-foot {
  display: flex; justify-content: flex-end; padding: 10px 14px;
  border-top: 1px solid var(--border); background: var(--plane);
  font-size: 13.5px;
}
.frame-foot a { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }

.more-card {
  margin-top: clamp(36px, 6vw, 56px);
  border: 1px dashed var(--border-2); border-radius: var(--radius);
  padding: 28px; text-align: center; color: var(--muted);
  font-size: 15px; background: var(--plane);
}
.more-card strong { color: var(--ink-2); font-weight: 600; }

/* ============================ PORTFOLIO ============================ */
.pf-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: clamp(22px, 3.4vw, 34px);
}
@media (max-width: 640px) { .pf-grid { grid-template-columns: 1fr; } }

.pf-item { display: flex; flex-direction: column; }

/* Screenshot: same visual language as the .frame cards (border, radius, hover lift). */
.pf-shot {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 16 / 10; background: var(--plane);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  transition: box-shadow .2s, border-color .2s, transform .2s;
}
.pf-shot:hover, .pf-shot:focus-visible {
  box-shadow: 0 10px 30px rgba(0,0,0,.08); border-color: var(--border-2);
  transform: translateY(-2px);
}
.pf-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* "Visit" affordance, mirrors the frame's "Open full screen" — reveals on hover/focus. */
.pf-visit {
  position: absolute; right: 10px; bottom: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--surface);
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  padding: 6px 11px; border-radius: 999px;
  opacity: 0; transform: translateY(4px);
  transition: opacity .18s, transform .18s; pointer-events: none;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.pf-shot:hover .pf-visit, .pf-shot:focus-visible .pf-visit { opacity: 1; transform: none; }
.pf-visit svg { width: 13px; height: 13px; }

.pf-item h3 { font-size: clamp(18px, 2.4vw, 21px); margin: 16px 0 0; }
.pf-item .pf-desc { color: var(--ink-2); margin: 8px 0 0; font-size: 15.5px; line-height: 1.55; }

/* ============================ PUBLICATIONS ============================ */
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pub {
  padding: 22px 0; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: 92px 1fr; gap: 20px; align-items: start;
}
.pub:first-child { border-top: 0; }
@media (max-width: 560px) { .pub { grid-template-columns: 1fr; gap: 6px; } }
.pub-year {
  font-family: var(--font-mono); font-size: 13px; color: var(--muted);
  padding-top: 3px; white-space: nowrap;
}
.pub-status {
  display: inline-block; font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .05em; text-transform: uppercase; color: var(--accent);
  margin-top: 6px;
}
.pub h3 { font-size: 19px; line-height: 1.35; }
.pub .authors { color: var(--ink-2); font-size: 15px; margin: 6px 0 0; }
.pub .authors .me { color: var(--ink); font-weight: 600; }
.pub .summary { color: var(--ink-2); font-size: 15.5px; margin: 10px 0 0; max-width: 66ch; }
.pub-links { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 0; }
.pub-links a { font-family: var(--font-mono); font-size: 13px; }
.pub-links a::before { content: "→ "; color: var(--muted); }

/* ============================ CONTACT ============================ */
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(28px, 5vw, 56px); align-items: start; }
@media (max-width: 680px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-lead { font-size: clamp(20px, 3.2vw, 26px); font-family: var(--font-serif); color: var(--ink); line-height: 1.4; }
.contact-lead a { color: var(--accent); }
.contact-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 2px; }
.contact-list a {
  display: flex; align-items: center; gap: 12px; color: var(--ink);
  padding: 12px 14px; border-radius: 10px; border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.contact-list a:hover { background: var(--plane); border-color: var(--border); }
.contact-list svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.contact-list .label { color: var(--ink); }
.contact-list .val { color: var(--muted); font-size: 14px; margin-left: auto; font-family: var(--font-mono); }
@media (max-width: 400px) { .contact-list .val { display: none; } }

/* ============================ FOOTER ============================ */
.foot {
  border-top: 1px solid var(--border); padding-block: 32px;
  color: var(--muted); font-size: 13.5px;
}
.foot-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.foot a { color: var(--ink-2); }
.foot .built { font-family: var(--font-mono); font-size: 12.5px; }

/* ============================ SCROLL REVEAL ============================ */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
