/* Academic portfolio */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #1b1b1b;
  --soft: #5b5f66;
  --rule: #e3e3e3;
  --link: #1f4f99;
  --tint: #f4f6f9;
  --serif: "Source Serif 4", Charter, Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: light; }
* { box-sizing: border-box; min-width: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17.5px/1.65 var(--serif); overflow-x: clip; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }
p { margin: 0 0 14px; }
h1, h2, h3 { font-weight: 600; margin: 0; line-height: 1.3; }
.muted { color: var(--soft); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--bg); padding: 6px 10px; z-index: 5; }

.draft { margin: 0; padding: 7px 16px; text-align: center; font: 13px var(--sans); background: #fff6d1; color: #5c4a00; }
.confirm { display: inline-block; margin-left: 6px; padding: 1px 5px; font: 500 10.5px/1.4 var(--sans); vertical-align: 2px; border-radius: 3px; background: #fff1b0; color: #6b5500; }
.note { font: 13.5px/1.5 var(--sans); color: #6b5500; border-left: 2px solid #e2c84f; padding-left: 10px; }

/* Header */
.top, main, .foot { max-width: 872px; margin: 0 auto; padding-inline: 24px; }
.top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; padding-top: 28px; padding-bottom: 8px; }
.brand { color: var(--ink); font-weight: 600; font-size: 18px; }
#nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font: 14px var(--sans); }
#nav a { color: var(--soft); }
#nav a:hover { color: var(--link); }

/* Intro */
.intro { padding: clamp(38px, 7vw, 80px) 0 30px; }
h1 { font-size: clamp(42px, 8vw, 68px); letter-spacing: -.045em; line-height: 1.04; }
.role { color: var(--soft); font-style: italic; margin: 6px 0 22px; }
.intro-text { max-width: 650px; }
.role { font: 500 14px/1.5 var(--sans); margin: 12px 0 23px; }
.intro .linkrow { margin-top: 23px; gap: 10px 18px; }
.intro .linkrow a::before { content: none; }
.intro .linkrow a:first-child { color: var(--bg); background: var(--link); border-radius: 5px; padding: 10px 14px; }

.linkrow { font: 14.5px var(--sans); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; }
.linkrow > a + a::before, .linkrow > a + button::before { content: "·"; color: var(--soft); padding: 0 10px; display: inline-block; }
.linkrow.small { font-size: 13.5px; margin-top: -6px; }

/* Sections */
section { padding-top: 34px; }
h2 { font-size: 27px; padding-bottom: 10px; margin-bottom: 20px; border-bottom: 1px solid var(--rule); }
h3 { font-size: 17.5px; }
h3.sub { font: 500 12.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--soft); margin: 26px 0 6px; }
h3.sub:first-of-type { margin-top: 0; }
.src { font: 12.5px var(--sans); white-space: nowrap; }
.src::after { content: " ↗"; }

.date { font: 13.5px/1.7 var(--sans); color: var(--soft); }
.research-list { border: 1px solid #d9e1ec; border-radius: 8px; background: #f7f9fc; padding: 0 clamp(16px, 4vw, 32px); }
.research-list .item { margin: 0; padding: 20px 0; }
.research-list .item + .item { border-top: 1px solid #d9e1ec; }
.research-list p:last-child { margin-bottom: 0; }
.research-list h3 { font-size: 21px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Photo (appears once assets/profile.jpg exists) */
.intro.has-photo { --photo: 220px; display: grid; grid-template-columns: minmax(0, 1fr) var(--photo); gap: 44px; align-items: start; }
.photo { margin: 10px 0 0; }
.photo img { width: 100%; max-width: var(--photo, 220px); height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.08); }
/* Laptops: wider page so a larger portrait doesn't squeeze the bio */
@media (min-width: 1024px) {
  .top, main, .foot { max-width: 940px; }
  .intro.has-photo { --photo: 260px; gap: 52px; }
}
/* Large desktop monitors */
@media (min-width: 1440px) {
  .top, main, .foot { max-width: 1000px; }
  .intro.has-photo { --photo: 300px; gap: 60px; }
}

/* News */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 18px; padding: 6px 0; }
.news p { margin: 0; }

/* Honors highlight */
.wins { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.win { border: 1px solid #e7e1d2; border-radius: 8px; padding: 18px 20px 16px; background: #fff; }
.win svg { width: 30px; height: 30px; color: #a77d22; display: block; margin-bottom: 10px; }
.win p { margin: 0; }
.win-rank { font: 600 21px/1.25 var(--serif); }
.win-title { font-size: 16.5px; margin-top: 2px !important; }
.win-by { font: 13px/1.5 var(--sans); color: var(--soft); margin-top: 8px !important; }
.win-note { font: 12.5px/1.5 var(--sans); color: var(--soft); }
.badge { display: inline-block; font: 600 11.5px/1.5 var(--sans); color: #7a5a00; background: #fbf3dc; border-radius: 4px; padding: 1px 7px; margin-left: 6px; vertical-align: 2px; }
.cell-detail { font: 13.5px/1.5 var(--sans); color: var(--soft); margin: 4px 0 0; }
.outside { font-style: italic; color: var(--soft); margin-top: 18px; }

/* Award photo beside the honors */
.honors-grid { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 18px; }
.honors-grid .wins { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.moment { margin: 0; }
.moment img { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; display: block; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.08); }
.moment figcaption { font: 12.5px/1.5 var(--sans); color: var(--soft); margin-top: 10px; }
@media (max-width: 780px) {
  .honors-grid { grid-template-columns: 1fr; }
  .moment { max-width: 340px; }
}
@media (max-width: 480px) {
  .honors-grid .wins, .wins { grid-template-columns: 1fr; gap: 10px; }
  .moment { max-width: 300px; }
  .win { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 14px; padding: 14px 16px; }
  .win svg { grid-row: 1 / span 4; width: 28px; height: 28px; margin: 2px 0 0; }
  .win-rank { font-size: 19px; }
  .win-title { font-size: 16px; }
  .win-by { margin-top: 4px !important; }
}

/* Record page */
.intro-record { padding-bottom: 6px; }
.intro-record h1 { font-size: clamp(38px, 6vw, 54px); }
.crumb { font: 14px var(--sans); margin-bottom: 18px; }
.lede { color: var(--soft); max-width: 640px; margin-top: 16px; }

/* Papers / projects */
.item { margin-bottom: 24px; }
.item h3 { margin-bottom: 3px; }
.meta { color: var(--soft); margin-bottom: 8px; font: 500 13px/1.5 var(--sans); }
.more { color: var(--soft); font-size: 16px; }

/* Timeline rows */
.row { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 18px; padding: 10px 0; }
.row h3 { margin-bottom: 0; }
.org { color: var(--soft); font-style: italic; margin-bottom: 4px; }
.row p:last-child { margin-bottom: 0; }
.skills { font-size: 16px; color: var(--soft); }

/* Awards table */
.awards { width: 100%; border-collapse: collapse; font-size: 16.5px; }
.awards th { font: 500 11.5px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--soft); text-align: left; padding: 0 12px 10px 0; border-bottom: 1.5px solid var(--ink); }
.awards td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.awards td:nth-child(2) { color: var(--soft); }
.awards td:last-child { white-space: nowrap; font: 14px/1.9 var(--sans); color: var(--soft); padding-right: 0; }

/* Contact */
.mail { font-size: 18px; }
#copy { font: 14.5px var(--sans); color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; }
#copy:hover { text-decoration: underline; }

.foot { display: flex; justify-content: space-between; gap: 16px; font: 13.5px var(--sans); color: var(--soft); border-top: 1px solid var(--rule); margin-top: 56px; padding-top: 22px; padding-bottom: 40px; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .row, .news li { grid-template-columns: 1fr; gap: 3px; }
  .intro.has-photo { grid-template-columns: 1fr; gap: 20px; }
  .photo { order: -1; }
  .photo { margin: 0; }
  .photo img { width: clamp(170px, 50vw, 215px); max-width: 100%; }
  .top, main, .foot { padding-inline: 20px; }
  #nav { gap: 8px 14px; }
  .intro { padding-top: 32px; }
  .intro .linkrow { gap: 12px 16px; }
  .mail, .awards td, .item { overflow-wrap: anywhere; }
  .row .date:empty { display: none; }
  .awards thead { display: none; }
  .awards tr { display: grid; padding: 10px 0; border-bottom: 1px solid var(--rule); }
  .awards td { border: 0; padding: 0; }
  .awards td:last-child { line-height: 1.6; }
}

@media print {
  .top, .draft, .confirm, .note, #copy, .foot a, .crumb { display: none !important; }
  .win { break-inside: avoid; }
  body { font-size: 11pt; }
  section { break-inside: auto; padding-top: 14px; }
  .item, .row, tr { break-inside: avoid; }
}
