/* ==========================================================================
   Base styles. Uses only variables from tokens.css — no hard-coded colours.
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; }
h1 { font-size: var(--fs-h1); font-weight: var(--h1-weight); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); font-weight: var(--h2-weight); }
h3 { font-size: 1.1rem; font-weight: var(--h2-weight); }
p  { margin: 0 0 var(--stack); }
p:last-child { margin-bottom: 0; }

.wrap { width: 100%; max-width: var(--page-width); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-small); }

.skip-link {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 10;
  background: var(--text); color: var(--bg); padding: 0.5rem 0.9rem; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 0.75rem; }

/* ---------- Navigation ---------- */

.site-header { border-bottom: var(--rule) solid var(--line); }
.nav { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-block: 1.25rem; }
.monogram {
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text); text-decoration: none; line-height: 1;
}
.monogram span { color: var(--accent); }
.nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.nav a { color: var(--text-muted); text-decoration: none; padding-block: 0.25rem; border-bottom: 1px solid transparent; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.nav a.nav-cta { color: var(--accent-text); font-weight: 600; }
.nav a.nav-cta:hover { color: var(--accent); }

/* ---------- Sections ---------- */

main > section { padding-top: var(--section-gap); }
main > section + section { margin-top: 0; }
/* no divider lines between homepage sections: only the header and footer rules remain */

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.more-link { font-size: 0.95rem; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.more-link:hover { color: var(--accent-text); }

/* ---------- Intro ---------- */

.intro { display: grid; grid-template-columns: 1fr minmax(13rem, 18rem); gap: clamp(1.5rem, 5vw, 3.5rem); align-items: center; }
.intro-text .eyebrow { margin: 0.75rem 0 1.5rem; color: var(--text-muted); line-height: 1.5; }
.eyebrow strong { color: var(--text); font-weight: 600; }
.eyebrow .role { display: block; }
.lede { font-size: 1.15em; max-width: 38em; }
.portrait { margin: 0; }
.portrait img {
  width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 25%; border-radius: var(--radius);
  background: var(--surface); border: var(--rule) solid var(--line);
}

.profile-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; padding: 0; margin: 2rem 0 0; font-size: 0.95rem; }
.profile-links a { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--text-muted); text-decoration: none; }
.profile-links a:hover { color: var(--accent-text); }
.profile-links svg { width: 1.1rem; height: 1.1rem; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Callout ---------- */

.callout {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem;
  background: var(--accent-soft); border: var(--rule) solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 1.5rem clamp(1.25rem, 3vw, 2rem);
}
.callout-body { flex: 1 1 24rem; max-width: 42rem; }
.callout .kicker { margin: 0 0 0.35rem; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); font-weight: 600; }
.callout h2 { font-size: 1.25rem; margin-bottom: 0.4rem; }
.btn {
  display: inline-block; padding: 0.6rem 1.15rem; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 0.95rem;
  background: var(--accent-text); color: var(--on-accent); border: 1px solid transparent;
}
.btn:hover { background: var(--accent); text-decoration: none; }

/* ---------- Research ---------- */

.research-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1rem, 3vw, 2rem); list-style: none; padding: 0; margin: 0; }
.research-item .art {
  aspect-ratio: 4 / 3; background: var(--surface); border: var(--rule) solid var(--line); border-radius: var(--radius);
  display: grid; place-items: center; margin-bottom: 1rem; color: var(--accent-text);
}
.research-item .art svg { width: 78%; height: auto; }
.research-item h3 { margin-bottom: 0.35rem; }
.research-item p { color: var(--text-muted); font-size: 0.95rem; }
.section-lede { max-width: 40em; color: var(--text-muted); margin: -0.75rem 0 1.75rem; }

/* SVG illustration palette (inline SVGs use these classes) */
.art .s  { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.art .f  { fill: var(--accent-mid); }
.art .fs { fill: var(--accent-soft); }
.art .fm { fill: var(--line); }
.art .d  { stroke-dasharray: 4 5; }

/* ---------- Selected work (2x2 cards) ----------
   Sized from the research cards above: --rw is the width of one research card (3 columns),
   so these cards are 40% wider (--work-scale) and their drawing boxes are a bit shorter (--tile-ratio). */

main.wrap { container-type: inline-size; }

.work-grid {
  --rw: calc((100cqw - 2 * clamp(1rem, 3vw, 2rem)) / 3);
  --work-scale: 1.4;   /* card width relative to a research card */
  --tile-ratio: 0.65;  /* drawing-box height relative to a research card's width (research boxes use 0.75) */
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(2, calc(var(--rw) * var(--work-scale)));
  grid-template-rows: auto auto; grid-auto-flow: column;  /* fills down the left column, then the right */
  gap: 1.75rem clamp(1.25rem, 3vw, 2rem);
}
.work-card .tile {
  height: calc(var(--rw) * var(--tile-ratio)); margin-bottom: 0.75rem; text-decoration: none;
  background: var(--surface); border: var(--rule) solid var(--line); border-radius: var(--radius);
  display: grid; place-items: center; color: var(--accent-text);
}
.work-card .tile svg { width: auto; height: 78%; }
.work-card .tile img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.work-card .venue { margin: 0 0 0.2rem; font-size: var(--fs-small); color: var(--accent-text); }
.work-card h3 { font-size: 1.05rem; line-height: 1.3; margin-bottom: 0.35rem; }
.work-card h3 a { color: var(--text); text-decoration: none; }
.work-card h3 a:hover { color: var(--accent-text); text-decoration: underline; }
.work-card .why { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

/* ---------- About / Connect ---------- */

.prose { max-width: 40em; }
.connect { text-align: left; }
.connect .actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; margin-top: 1.5rem; }
.email-link { font-family: var(--font-display); font-size: 1.25rem; }

/* ---------- Footer ---------- */

.site-footer { margin-top: var(--section-gap); border-top: var(--rule) solid var(--line); padding-block: 1.75rem 2.5rem; color: var(--text-muted); font-size: var(--fs-small); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; }

/* ---------- Placeholder pages ---------- */

.stub { padding-block: var(--section-gap); }
.stub p { max-width: 36em; color: var(--text-muted); }


/* ---------- Responsive ---------- */

@media (max-width: 52rem) {
  .work-grid { grid-template-columns: repeat(2, 1fr); }
  .work-card .tile { height: auto; aspect-ratio: 16 / 10; }
  .research-grid { grid-template-columns: 1fr; max-width: 32rem; }
  .research-item { display: grid; grid-template-columns: 9rem 1fr; gap: 0 1.25rem; align-items: start; }
  .research-item .art { margin: 0; grid-row: span 2; }
}

@media (max-width: 40rem) {
  .intro { grid-template-columns: 1fr; }
  .portrait { order: -1; max-width: 11rem; }
  .intro-text { order: 0; }
  .nav { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .research-item { grid-template-columns: 6.5rem 1fr; }
}

@media print { .skip-link, .nav ul { display: none; } }

/* ---------- Publications page ---------- */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pubs { padding-block: var(--section-gap) 0; }
.pub-intro { margin-top: 0.75rem; }
.pub-tools { margin: 1.5rem 0 0.5rem; }
.pub-tools input {
  width: 100%; max-width: 24rem; padding: 0.55rem 0.9rem; font: inherit; font-size: 0.95rem; color: var(--text);
  background: var(--surface); border: var(--rule) solid var(--line); border-radius: 999px;
}
.pub-tools input::placeholder { color: var(--text-muted); }
.pub-years, .pub-items { list-style: none; margin: 0; padding: 0; }
.pub-year { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0 1.5rem; padding-top: 2rem; margin-top: 2rem; border-top: var(--rule) solid var(--line); }
.pub-year[hidden], .pub[hidden] { display: none; }
.pub-year > h2 { font-size: 1.5rem; color: var(--accent-text); }
.pub { padding-bottom: 1.6rem; }
.pub:last-child { padding-bottom: 0; }
.pub-title { font-size: 1.1rem; line-height: 1.3; margin-bottom: 0.25rem; }
.pub-authors { margin: 0; font-size: 0.95rem; color: var(--text-muted); }
.pub-authors strong { color: var(--text); font-weight: 600; }
.pub-venue { margin: 0.2rem 0 0.35rem; font-size: var(--fs-small); }
.pub-venue abbr { text-decoration: none; font-weight: 600; }
.pub-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.1rem; font-size: 0.9rem; }
.pub-links a { color: var(--accent-text); }
.pub-links a { text-decoration: none; }
.pub-links a:hover { text-decoration: underline; }
.cites { color: var(--text-muted); }
.linklike { font: inherit; padding: 0; background: none; border: 0; color: var(--accent-text); cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.linklike[aria-expanded="true"] { color: var(--text); }
.bib { position: relative; margin-top: 0.5rem; }
.bib[hidden] { display: none; }
.bib pre {
  margin: 0; padding: 0.8rem 1rem; padding-right: 4.5rem; overflow-x: auto; font-size: 0.8rem; line-height: 1.5;
  background: var(--surface); border: var(--rule) solid var(--line); border-radius: var(--radius-sm); color: var(--text);
}
.bib .copy { position: absolute; top: 0.5rem; right: 0.5rem; }
.copy { display: none; }
.copy { font: inherit; font-size: 0.8rem; color: var(--text-muted); background: none; border: var(--rule) solid var(--line); border-radius: 999px; padding: 0 0.6rem; cursor: pointer; }
.copy:hover { color: var(--accent-text); border-color: var(--accent); }
@media (max-width: 40rem) { .pub-year { grid-template-columns: 1fr; gap: 0.75rem; } }

/* small award tag (publications page) */
.badge {
  display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.55rem; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent-text); font-size: 0.78rem; font-weight: 600; vertical-align: 1px;
}

/* ---------- Research page ---------- */

.research { padding-top: var(--section-gap); }
.research-intro { margin-top: 1.25rem; }
.research > section { padding-top: var(--section-gap); }
.research > section.research-intro { padding-top: 0; }
.research h2 { margin-bottom: 2rem; }
.interest { display: grid; grid-template-columns: clamp(7rem, 30%, 18rem) 1fr; gap: 0 clamp(1rem, 4vw, 3rem); align-items: start; margin-bottom: 2.5rem; }
.interest:last-child { margin-bottom: 0; }
.interest .art {
  aspect-ratio: 4 / 3; background: var(--surface); border: var(--rule) solid var(--line); border-radius: var(--radius);
  display: grid; place-items: center; color: var(--accent-text);
}
.interest .art svg { width: 78%; height: auto; }
.interest h3 { font-size: 1.25rem; margin-bottom: 0.6rem; }
.interest-text { max-width: 40em; }
@media (max-width: 30rem) {
  .work-grid { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
  .work-card .tile { aspect-ratio: 16 / 9; }
}
@media (max-width: 30rem) { .interest { grid-template-columns: 6rem 1fr; } .interest h3 { font-size: 1.1rem; } }
