/* ==========================================================================
   Lab site styles
   Layout idea: a fixed left rail carries the wordmark and the menu, which
   hangs on a hairline "plumb line"; every page hangs to the right of it.
   One typeface throughout (Pagella, the Palatino of the prospectuses).
   ========================================================================== */

:root {
  --film: #0b1a23;        /* radiograph blue-black: home page, board frame */
  --ink: #13232d;         /* text */
  --slate: #566972;       /* secondary text */
  --rule: #cbd4d5;        /* hairlines and field borders */
  --lightbox: #eef1f0;    /* page background, the cool white of a view box */
  --paper: #fbfcfb;       /* sheets, fields */
  --mark: #f2c12e;        /* annotation yellow: active marker, highlights */
  --felt: #1d343f;        /* the pinboard */

  --note-yellow: #f8e389;
  --note-rose: #f3c7cc;
  --note-sky: #bedbee;
  --note-mint: #cbe5c6;

  --font: "TeX Gyre Pagella", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --rail: 15.5rem;
  --gutter: clamp(1.25rem, 4vw, 4rem);

  color-scheme: light;
}

@font-face {
  font-family: "TeX Gyre Pagella";
  src: url("../fonts/texgyrepagella-regular.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "TeX Gyre Pagella";
  src: url("../fonts/texgyrepagella-italic.otf") format("opentype");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "TeX Gyre Pagella";
  src: url("../fonts/texgyrepagella-bold.otf") format("opentype");
  font-weight: 700; font-style: normal; font-display: swap;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--lightbox);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--mark);
  text-decoration-thickness: 0.11em;
  text-underline-offset: 0.2em;
}
a:hover { background: rgba(242, 193, 46, 0.3); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
main:focus { outline: none; }

.skip {
  position: fixed; left: 1rem; top: -4rem; z-index: 50;
  padding: 0.5rem 0.9rem; background: var(--ink); color: var(--paper);
  text-decoration: none;
}
.skip:focus { top: 1rem; }

/* Small caps, letterspaced: the menu, labels and section headings. */
.caps {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
}

/* Placeholders written as [[text]] in the content files. */
mark.todo {
  background: rgba(242, 193, 46, 0.5);
  color: inherit;
  padding: 0 0.2em;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Rail: wordmark, menu on the plumb line, affiliation
   -------------------------------------------------------------------------- */

.rail {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 10;
  width: var(--rail);
  padding: 2.1rem 1.25rem 1.6rem 2rem;
  display: flex; flex-direction: column;
  background: var(--lightbox);
  color: var(--ink);
}

.wordmark {
  display: inline-flex; align-items: center; gap: 0.6rem;
  text-decoration: none;
  font-size: 1.3rem; line-height: 1;
  letter-spacing: 0.04em;
}
.wordmark:hover { background: none; }
.wordmark svg { width: 1.5rem; height: 1.5rem; flex: none; }

.expansion {
  margin: 0.55rem 0 0 2.1rem;
  font-size: 0.82rem; line-height: 1.3; font-style: italic;
  color: var(--slate);
  max-width: 11rem;
}

/* The plumb line: a hairline dropping from the mark, ending in a bob. */
.plumb {
  position: relative;
  margin: 1.4rem 0 0 0.72rem;
  padding: 0.9rem 0 2.6rem 1.38rem;
}
.plumb::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0.55rem;
  border-left: 1px solid currentColor; opacity: 0.4;
}
.plumb::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 0; height: 0; transform: translateX(-50%);
  border-left: 4.5px solid transparent; border-right: 4.5px solid transparent;
  border-top: 11px solid currentColor; opacity: 0.75;
}
.plumb ul { display: flex; flex-direction: column; gap: 0.15rem; }
.plumb a {
  position: relative; display: inline-block;
  padding: 0.28rem 0;
  font-size: 1.12rem;
  text-decoration: none;
}
.plumb a:hover { background: none; text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 0.11em; }
.plumb a[aria-current="page"]::before {
  content: ""; position: absolute; left: -1.38rem; top: 50%;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--mark);
  box-shadow: 0 0 0 3px var(--lightbox);
  transform: translate(-50%, -50%);
}

.rail-foot {
  margin-top: auto;
  font-size: 0.8rem; line-height: 1.4;
  color: var(--slate);
}
.rail-foot .disclaimer { margin-top: 0.6rem; font-style: italic; }

/* --------------------------------------------------------------------------
   Page frame
   -------------------------------------------------------------------------- */

main {
  position: relative; z-index: 1;
  margin-left: var(--rail);
  min-height: 100%;
  padding: 3.6rem var(--gutter) 4rem;
}

.page-head { max-width: 40rem; margin-bottom: 2.4rem; }
.page-head h1 {
  font-size: clamp(2rem, 1.4rem + 2vw, 2.9rem);
  font-weight: 400; line-height: 1.08; letter-spacing: -0.01em;
  text-wrap: balance;
}
.page-head p { margin-top: 0.9rem; color: var(--slate); max-width: 34rem; }

.section-title {
  font-size: 1.05rem; font-weight: 400;
  margin: 3rem 0 1.2rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

.measure { max-width: 38rem; }
.measure p + p { margin-top: 1em; }

.page-foot { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0.5rem 1.15rem;
  border: 1.5px solid var(--ink); border-radius: 3px;
  background: transparent; color: var(--ink);
  font-size: 1rem; line-height: 1.2; text-decoration: none; text-align: center;
  cursor: pointer;
}
.btn:hover { background: rgba(19, 35, 45, 0.07); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #22404f; }
.linklike {
  border: 0; padding: 0; background: none; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--mark);
  text-decoration-thickness: 0.11em; text-underline-offset: 0.2em;
}
.linklike:hover { background: rgba(242, 193, 46, 0.3); }

/* --------------------------------------------------------------------------
   Home: one full-screen moving image, the rail, one sentence
   -------------------------------------------------------------------------- */

#stage { position: fixed; inset: 0; z-index: 0; display: none; background: var(--film); }
#stage video, #stage img, #stage canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
#stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(11, 26, 35, 0.74) 0, rgba(11, 26, 35, 0.28) 34%, rgba(11, 26, 35, 0) 58%),
    linear-gradient(0deg, rgba(11, 26, 35, 0.62) 0, rgba(11, 26, 35, 0) 36%);
}

body.is-home { overflow: hidden; background: var(--film); }
body.is-home #stage { display: block; }
body.is-home .rail { background: none; color: #fff; }
body.is-home .expansion, body.is-home .rail-foot { color: rgba(255, 255, 255, 0.78); }
body.is-home .plumb a[aria-current="page"]::before { box-shadow: none; }
body.is-home :focus-visible { outline-color: var(--mark); }
body.is-home main {
  position: fixed; inset: 0; margin: 0; padding: 0; min-height: 0;
  pointer-events: none;
}
body.is-home main > * { pointer-events: auto; }

.statement {
  position: absolute;
  left: calc(var(--rail) + var(--gutter)); right: var(--gutter); bottom: 2.6rem;
  max-width: 15em;
  color: #fff;
  font-size: clamp(1.7rem, 1rem + 2.3vw, 3.2rem);
  font-weight: 400; line-height: 1.14; letter-spacing: -0.012em;
  text-wrap: balance;
  text-shadow: 0 1px 24px rgba(11, 26, 35, 0.55);
}
.motion-toggle {
  position: absolute; right: var(--gutter); bottom: 2.6rem;
  min-height: 2.75rem; padding: 0.3rem 0.2rem;
  border: 0; background: none; color: rgba(255, 255, 255, 0.85);
  font-size: 1rem; cursor: pointer;
}
.motion-toggle:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--mark); text-underline-offset: 0.3em; }

/* --------------------------------------------------------------------------
   Project board
   -------------------------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.3rem; }
.chip {
  min-height: 2.4rem; padding: 0.25rem 0.9rem;
  border: 1px solid var(--rule); border-radius: 999px;
  background: transparent; cursor: pointer;
  font-size: 0.98rem;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: clamp(1.4rem, 2.6vw, 2.4rem);
  padding: clamp(1.4rem, 3vw, 2.8rem);
  border-radius: 5px;
  background-color: var(--felt);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 3px 18px rgba(0, 0, 0, 0.45),
    0 0 0 7px #d9dfde,
    0 0 0 8px var(--rule);
  margin: 8px;
}
.board :focus-visible { outline-color: var(--mark); }

.note {
  --tint: var(--note-yellow);
  --tilt: 0deg;
  position: relative;
  display: flex; flex-direction: column;
  aspect-ratio: 1 / 1;
  padding: 1.9rem 1.3rem 1rem;
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%) var(--tint);
  color: #1a2730;
  text-decoration: none;
  transform: rotate(var(--tilt));
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 12px 16px -8px rgba(0, 0, 0, 0.55);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.note:hover, .note:focus-visible {
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%) var(--tint);
  transform: rotate(0deg) translateY(-4px) scale(1.025);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 22px 26px -10px rgba(0, 0, 0, 0.6);
  z-index: 2;
}
/* the pin */
.note::before {
  content: ""; position: absolute; top: 0.6rem; left: 50%;
  width: 0.72rem; height: 0.72rem; border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 36% 30%, #ffffff 0 14%, #9aa7ae 38%, #45555e 100%);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.4);
}
.note.yellow { --tint: var(--note-yellow); }
.note.rose { --tint: var(--note-rose); }
.note.sky { --tint: var(--note-sky); }
.note.mint { --tint: var(--note-mint); }

.note h2 {
  font-size: 1.22rem; font-weight: 700; line-height: 1.18;
  text-wrap: balance;
}
.note p { margin-top: 0.55rem; font-size: 0.93rem; line-height: 1.38; }
.note .note-foot {
  margin-top: auto; padding-top: 0.8rem;
  display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline;
  font-size: 0.95rem; line-height: 1.2; white-space: nowrap;
}
.note.filled { filter: saturate(0.35); opacity: 0.8; }
.note .stamp {
  position: absolute; right: 0.8rem; top: 0.75rem;
  padding: 0.05rem 0.4rem; border: 1.5px solid currentColor; border-radius: 2px;
  font-size: 0.85rem; transform: rotate(6deg);
}

.board-after { margin-top: 1.8rem; color: var(--slate); }
.empty { color: #dfe7e9; grid-column: 1 / -1; }

/* The sheet a note opens into */
.sheet {
  --tint: var(--note-yellow);
  width: min(41rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 0; border: 0; border-radius: 3px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  overflow: auto;
}
.sheet::backdrop { background: rgba(11, 26, 35, 0.62); }
.sheet[open] { animation: sheet-in 0.2s ease-out; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.sheet-body { padding: 0 clamp(1.25rem, 4vw, 2.5rem) 2rem; border-top: 0.65rem solid var(--tint); }
.sheet-body:focus { outline: none; }
.sheet-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: 0.9rem; color: var(--slate); line-height: 1.3; }
.sheet-close {
  min-width: 2.75rem; min-height: 2.75rem; margin-right: -0.6rem;
  border: 0; background: none; cursor: pointer; font-size: 1rem; color: var(--ink);
}
.sheet-close:hover { text-decoration: underline; text-decoration-color: var(--mark); text-underline-offset: 0.3em; }
.sheet h2 { margin-top: 0.5rem; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); font-weight: 400; line-height: 1.12; text-wrap: balance; }
.sheet .lead { margin-top: 0.9rem; }
.sheet h3 { margin: 1.5rem 0 0.35rem; font-size: 1rem; font-weight: 400; color: var(--slate); }
.sheet ul.plain { padding-left: 1.1rem; list-style: disc; }
.sheet ul.plain li + li { margin-top: 0.3rem; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.8rem; }
.sheet-help { margin-top: 0.9rem; font-size: 0.93rem; line-height: 1.5; color: var(--slate); }
.sheet-help a, .sheet-help button { color: var(--ink); }
.address { overflow-wrap: anywhere; }

/* --------------------------------------------------------------------------
   People
   -------------------------------------------------------------------------- */

.lead-person {
  display: grid; grid-template-columns: 9.5rem 1fr; gap: 1.6rem; align-items: center;
  max-width: 38rem;
}
.lead-person h2 { font-size: 1.5rem; font-weight: 400; line-height: 1.15; }
.lead-person p { color: var(--slate); margin-top: 0.25rem; }

.people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 2.6rem 2rem;
  max-width: 68rem;
}
.person h3 { margin-top: 0.9rem; font-size: 1.22rem; font-weight: 700; line-height: 1.2; }
.person .role { color: var(--slate); font-size: 0.98rem; line-height: 1.35; margin-top: 0.15rem; }
.person .blurb { margin-top: 0.55rem; font-size: 0.98rem; line-height: 1.5; }
.person .on { margin-top: 0.6rem; font-size: 0.93rem; line-height: 1.4; color: var(--slate); }
.person .on a { color: var(--ink); }

.portrait {
  aspect-ratio: 4 / 5; width: 100%;
  background: #dde3e2; color: #9aa8ac;
  display: grid; place-items: center;
  overflow: hidden; border-radius: 2px;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait svg { width: 34%; height: auto; }

.alumni li { padding: 0.5rem 0; border-bottom: 1px solid var(--rule); max-width: 38rem; }
.alumni span { color: var(--slate); }

/* --------------------------------------------------------------------------
   Profile
   -------------------------------------------------------------------------- */

.profile { display: grid; grid-template-columns: minmax(12rem, 17rem) minmax(0, 38rem); gap: clamp(1.6rem, 4vw, 3.5rem); align-items: start; }
.profile .titles { color: var(--slate); margin-top: 0.7rem; line-height: 1.4; }
.profile .bio { margin-top: 1.7rem; }
.profile .section-title { margin-top: 2.4rem; }
.profile ul.plain { padding-left: 1.1rem; list-style: disc; }
.profile ul.plain li + li { margin-top: 0.25rem; }
.work li { display: grid; grid-template-columns: 4.2rem 1fr; gap: 0.75rem; padding: 0.3rem 0; }
.work .year { color: var(--slate); }
.link-row { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin-top: 1.6rem; }

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.contact { display: grid; grid-template-columns: minmax(0, 32rem) minmax(0, 24rem); gap: clamp(1.8rem, 4vw, 4rem); align-items: start; }
.field { display: block; margin-bottom: 1.1rem; }
.field > span { display: block; margin-bottom: 0.25rem; font-size: 1rem; color: var(--slate); }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.6rem 0.7rem;
  border: 1px solid var(--rule); border-radius: 2px;
  background: var(--paper);
}
.field textarea { min-height: 7.5rem; resize: vertical; line-height: 1.45; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline-offset: 0; border-color: var(--ink); }
.send-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.5rem; }
.send-help { margin-top: 0.9rem; font-size: 0.93rem; line-height: 1.5; color: var(--slate); }

.draft {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 2px;
  padding: 1.1rem 1.25rem 1.3rem;
  font-size: 0.96rem; line-height: 1.5;
}
.draft dl { margin: 0 0 0.9rem; display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.8rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--rule); }
.draft dt { color: var(--slate); }
.draft dd { margin: 0; overflow-wrap: anywhere; }
.draft pre { margin: 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.draft-title { margin-bottom: 0.6rem; color: var(--slate); font-size: 1rem; }
.where { margin-top: 1.4rem; font-size: 0.98rem; color: var(--slate); line-height: 1.5; }
.where strong { color: var(--ink); font-weight: 400; }

/* --------------------------------------------------------------------------
   Narrow screens: the rail becomes a top bar
   -------------------------------------------------------------------------- */

@media (max-width: 56rem) {
  .rail {
    position: sticky; top: 0; bottom: auto; width: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 0.2rem 1.4rem;
    padding: 0.8rem 1.1rem 0.7rem;
    border-bottom: 1px solid var(--rule);
  }
  .expansion, .rail-foot { display: none; }
  .wordmark { font-size: 1.2rem; }
  .plumb { margin: 0; padding: 0; }
  .plumb::before, .plumb::after { display: none; }
  .plumb ul { flex-direction: row; flex-wrap: wrap; gap: 0 0.95rem; }
  .plumb a { padding: 0.3rem 0; font-size: 1rem; letter-spacing: 0.06em; }
  .plumb a[aria-current="page"]::before { display: none; }
  .plumb a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 0.13em; text-underline-offset: 0.32em; }

  main { margin-left: 0; padding: 2.2rem 1.1rem 3rem; }
  body.is-home .rail { position: fixed; left: 0; right: 0; border-bottom: 0; }
  .statement { left: 1.1rem; right: 1.1rem; bottom: 4.6rem; }
  .motion-toggle { right: auto; left: 1.1rem; bottom: 1.2rem; }

  .board { padding: 1.5rem 1.1rem; margin: 8px 8px; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); }
  .profile, .contact { grid-template-columns: 1fr; }
  .profile .portrait { max-width: 15rem; }
  .lead-person { grid-template-columns: 6.5rem 1fr; gap: 1.1rem; }

  .page-foot {
    display: block; margin-top: 3.5rem; padding-top: 1rem;
    border-top: 1px solid var(--rule);
    font-size: 0.82rem; line-height: 1.45; color: var(--slate);
  }
  .page-foot .disclaimer { font-style: italic; margin-top: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .note, .sheet[open] { transition: none; animation: none; }
}

@media print {
  .rail, #stage, .filters, .motion-toggle { display: none; }
  main { margin: 0; padding: 0; }
}
