/* Experimental redesign, after the layout of rsms.me/inter */

/* Inter (SIL OFL 1.1, see ../fonts/OFL.txt) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #fff;
  --fg: #000;
  --fg-muted: rgba(0, 0, 0, 0.5);
  --fg-faint: rgba(0, 0, 0, 0.08);
  --underline: rgba(0, 0, 0, 0.3);
  --underline-strong: rgba(0, 0, 0, 0.7);
  --rule: #ccc;
  --accent: #000;
  --accent-fg: #fff;
  --crowd: rgba(0, 72, 68, 0.5);
  --crowd-shadow: rgba(0, 0, 0, 0.5);
  --map-filter: grayscale(1);

  --header-height: 56px; /* includes --header-gap */
  --header-gap: 8px;
  --row-padding: 4rem;
  --row-padding-vertical: 4rem;
  --column-gap: 2rem;

  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  font-feature-settings: "liga" 1, "calt" 1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111;
    --fg: #fafafa;
    --fg-muted: rgba(255, 255, 255, 0.5);
    --fg-faint: rgba(255, 255, 255, 0.08);
    --underline: rgba(255, 255, 255, 0.3);
    --underline-strong: rgba(255, 255, 255, 0.7);
    --rule: #444;
    --accent: #fafafa;
    --accent-fg: #111;
    --crowd: rgba(0, 97, 92, 0.9);
    --crowd-shadow: rgba(0, 0, 0, 0.6);
    --map-filter: grayscale(1) invert(0.9) contrast(0.9);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111;
  --fg: #fafafa;
  --fg-muted: rgba(255, 255, 255, 0.5);
  --fg-faint: rgba(255, 255, 255, 0.08);
  --underline: rgba(255, 255, 255, 0.3);
  --underline-strong: rgba(255, 255, 255, 0.7);
  --rule: #444;
  --accent: #fafafa;
  --accent-fg: #111;
  --crowd: rgba(0, 97, 92, 0.9);
  --crowd-shadow: rgba(0, 0, 0, 0.6);
  --map-filter: grayscale(1) invert(0.9) contrast(0.9);
  color-scheme: dark;
}

@media (max-width: 719px) {
  :root { --row-padding: 2rem; --row-padding-vertical: 3rem; }
}
@media (max-width: 500px) {
  :root { --row-padding: 16px; --row-padding-vertical: 2.5rem; }
  body { font-size: 0.9375rem; }
}
/* Scale everything with the window on very wide screens, like rsms.me */
@media (min-width: 1392px) {
  :root { font-size: calc(100vw / 87); }
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--header-height); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
p, dl { margin-bottom: 1.5em; }
p:last-child, dl:last-child { margin-bottom: 0; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.15s;
}
a:hover { text-decoration-color: var(--underline-strong); }

strong { font-weight: 600; }

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

button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.muted { color: var(--fg-muted); }

/* ---------- Grid ---------- */
.row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--column-gap);
  padding: var(--row-padding-vertical) var(--row-padding);
}
.row > * { grid-column: 1 / -1; }
.col-label { grid-column: 1 / span 3; }
.col-text  { grid-column: span 4; }
.col-wide  { grid-column: 4 / -1; }
.intro > .col-text:nth-child(2) { grid-column: 4 / span 4; }
.intro > .col-text:nth-child(3)  { grid-column: 9 / -1; }

@media (max-width: 1000px) {
  .intro > .col-text:nth-child(2),
  .intro > .col-text:nth-child(3) { grid-column: 4 / -1; }
  .intro .col-text + .col-text { margin-top: 2rem; }
}
@media (max-width: 719px) {
  /* One column: 12 columns' worth of gaps alone would be wider than a small phone */
  .row { grid-template-columns: minmax(0, 1fr); }
  .row > *,
  .col-label, .col-text, .col-wide,
  .intro > .col-text:nth-child(2),
  .intro > .col-text:nth-child(3),
  .contact .col-text { grid-column: 1 / -1; }
  .col-label { margin-bottom: 1.5rem; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-height);
  padding-top: var(--header-gap);
  background: var(--bg);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--row-padding);
  font-size: 0.875rem;
}
.header-name {
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}
.header-name.visible { opacity: 1; pointer-events: auto; }
.menu {
  display: flex;
  align-items: center;
  gap: 2em;
  margin-left: auto;
}
.menu a { text-decoration: none; }
.menu a.active {
  background: var(--accent);
  color: var(--accent-fg);
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 3px;
}
.theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--fg); }

@media (max-width: 719px) {
  .header-name { display: none; }
  .menu { gap: 0.25em; margin: 0 auto; }
  /* Same padding on every link so the active highlight never overlaps a neighbour */
  .menu a { padding: 4px 6px; border-radius: 3px; }
  .menu a.active { margin: 0; padding: 4px 6px; }
  .menu a[href="#projects"] { display: none; }
}
@media (max-width: 380px) {
  .menu { gap: 0; font-size: 0.8125rem; }
}

/* ---------- Hero ---------- */
.hero-band {
  position: relative;
  overflow: hidden;
  min-height: clamp(180px, 22vw, 260px);
  display: flex;
  align-items: flex-end;
}
#crowd {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.hero-title { position: relative; z-index: 1; width: 100%; padding-top: 2rem; padding-bottom: 1.5rem; pointer-events: none; }
.hero-title h1 {
  font-size: clamp(2.25rem, 5.5vw, 4.75rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-left: -0.03em;
}
.hero-title .first-name { font-weight: 300; letter-spacing: -0.02em; }
.crowd-credit {
  position: absolute;
  z-index: 1;
  right: var(--row-padding);
  bottom: 0.5rem;
  font-size: 0.5rem;
  color: var(--fg-muted);
  text-decoration: none;
}
.crowd-credit:hover { color: var(--fg); }

.intro { padding-top: 2rem; }
.lede { font-weight: 500; }
.intro .portrait { width: 100%; max-width: 200px; aspect-ratio: 1; object-fit: cover; border-radius: 2px; }
.intro .portrait { margin-bottom: 1.25rem; }

.button {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--fg);
  border-radius: 4px;
  background: var(--bg);
  text-decoration: none;
  font-weight: 500;
}
.button:hover { background: var(--fg); color: var(--bg); }

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1.5rem;
  row-gap: 0.5rem;
}
.facts dt { font-weight: 600; }

/* ---------- Section headings ---------- */
h2 { font-size: 0.875rem; font-weight: 600; }
.section-head { padding-bottom: 0; }
.display {
  font-size: clamp(2rem, 4.5vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}

/* ---------- Timeline (resume) ---------- */
.entry {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  column-gap: var(--column-gap);
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}
.entry:first-child { border-top: 0; padding-top: 0; }
.entry-date { color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.entry h3 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
@media (max-width: 500px) {
  .entry { grid-template-columns: 1fr; }
}

/* ---------- Details / disclosure ---------- */
details { margin-top: 0.5rem; }
summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  cursor: pointer;
  list-style: none;
  color: var(--fg-muted);
  user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "+";
  display: inline-block;
  width: 1ch;
  font-variant-numeric: tabular-nums;
}
details[open] > summary::before { content: "\2212"; }
summary:hover { color: var(--fg); }
details > :not(summary) { margin-top: 0.75rem; max-width: 46rem; }

/* ---------- Publications ---------- */
.pub { border-top: 1px solid var(--rule); margin: 0 var(--row-padding); padding-left: 0; padding-right: 0; }
.section-head + .pub { border-top: 0; }
.pub h3 {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}
.pub h3 a { text-decoration: none; }
.pub h3 a:hover { text-decoration: underline; text-decoration-color: var(--underline); }
.pub p { margin-bottom: 0.25rem; }
.pub-venue {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--fg-muted);
  margin-bottom: 0.5rem !important;
}
.pub-links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 0.75rem; }
.pub-links a { font-weight: 500; }
.badge {
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  border-radius: 3px;
  padding: 1px 7px;
  font-weight: 400;
  cursor: zoom-in;
}
.zoomable { cursor: zoom-in; }
.pub .col-label img { border-radius: 2px; }

/* ---------- Projects ---------- */
.projects { column-gap: var(--column-gap); padding-top: 3rem; }
.project { grid-column: span 6; }
.project-logo { width: 56px; height: 56px; object-fit: contain; margin-bottom: 1rem; }
.project h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 0.5rem; }
@media (max-width: 719px) {
  .project { grid-column: 1 / -1; }
  .project + .project { margin-top: 2.5rem; }
}

/* ---------- Contact ---------- */
.contact { padding-top: 3rem; }
.contact .col-text:first-of-type { grid-column: 1 / span 4; }
.contact .col-text:last-of-type { grid-column: 5 / -1; }
.map {
  display: block;
  width: 100%;
  height: 260px;
  border: 0;
  border-radius: 2px;
  filter: var(--map-filter);
}
@media (max-width: 719px) {
  .contact .col-text:first-of-type,
  .contact .col-text:last-of-type { grid-column: 1 / -1; }
  .contact .col-text + .col-text { margin-top: 2rem; }
  /* Shorter crowd band so the name sits closer to the top bar */
  .hero-band { min-height: 140px; }
  .hero-title { padding-top: 1rem; }

  /* Paper thumbnails don't need the full screen width */
  .pub .col-label img { max-width: 200px; }

  /* Photo on the left, role and button beside it */
  .intro .col-label {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 1.25rem;
  }
  .intro .portrait { grid-row: 1 / 3; max-width: 140px; margin-bottom: 0; }
  .intro .lede { align-self: start; margin-bottom: 0.75rem; }
  .intro .col-label .button { justify-self: start; align-self: start; }
}

/* ---------- Footer ---------- */
.site-footer {
  opacity: 0.4;
  transition: opacity 0.2s;
  padding-top: 3rem;
  padding-bottom: 3rem;
}
.site-footer:hover { opacity: 1; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: flex-end; }
@media (max-width: 719px) {
  .footer-links { justify-content: flex-start; }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem var(--row-padding);
  background: var(--bg);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 80vh; width: auto; }
.lightbox p { color: var(--fg-muted); text-align: center; }
.lightbox-close {
  position: absolute;
  top: 12px;
  right: var(--row-padding);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
}

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