/* ------------------------------------------------------------
   Colors and fonts come from _data/theme.yml (see _includes/head.html).
   Only layout sizes live here.
   ------------------------------------------------------------ */
:root {
  --measure: 680px;
  --wide: 1040px;
  --bar-h: 52px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 20px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--background);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 18px;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

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

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

/* Optional fields and sections with nothing in them stay hidden.
   The on-page editor (assets/js/edit.js) shows them so they can be filled in. */
html:not(.is-editing) [data-edit]:empty,
html:not(.is-editing) :is(.entry-meta, .entry-links, .tile-caption):not(:has(> :not(:empty, template))),
html:not(.is-editing) .block--list:not(:has([data-edit-item])) { display: none; }
ul { list-style: none; }

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 20;
  background: var(--text); color: var(--background); padding: 6px 12px;
  font: 500 14px var(--font-detail);
}
.skip:focus { left: 12px; }

/* ------------------------------------------------------------
   Top bar
   ------------------------------------------------------------ */
.bar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--background) 94%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--lines);
}
.bar-inner {
  max-width: var(--measure);
  height: var(--bar-h);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.bar-name {
  font-family: var(--font-text);
  font-size: 17px;
  color: var(--text);
  white-space: nowrap;
}
.bar-name:hover { text-decoration: none; color: var(--accent); }
.bar-links {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  font-family: var(--font-detail);
  font-size: 14px;
}
.bar-links::-webkit-scrollbar { display: none; }
.bar-links a {
  color: var(--text-soft);
  white-space: nowrap;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}
.bar-links a:hover { color: var(--text); text-decoration: none; }
.bar-links a[aria-current] { color: var(--text); border-bottom-color: var(--accent); }
.bar-links .bar-cv { color: var(--accent); font-weight: 500; }

/* ------------------------------------------------------------
   Page
   ------------------------------------------------------------ */
.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 56px 24px 24px;
}

.intro {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 32px;
  align-items: center;
  margin-bottom: 64px;
}
/* Oval portrait, cropped the same way as the original site */
.portrait {
  width: 120px;
  height: 158px;
  border-radius: 50% / 40%;
  overflow: hidden;
}
.portrait-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.portrait img {
  width: 160%;
  height: 160%;
  max-width: none;
  object-fit: cover;
  object-position: center 15%;
  margin: -15% -30%;
}

.intro h1, .life-head h1 {
  font-family: var(--font-text);
  font-weight: 400;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.tagline { color: var(--text-soft); margin-bottom: 12px; }
.status {
  font-style: italic;
  color: var(--text);
  margin-bottom: 14px;
}
.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-family: var(--font-detail);
  font-size: 14px;
}

/* Sections */
.block { margin-bottom: 56px; }
.block h2 {
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.3;
  padding-bottom: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--lines);
}
.prose p + p { margin-top: 14px; }

/* News */
.news li {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  padding: 6px 0;
}
.news-date {
  font-family: var(--font-detail);
  font-size: 14px;
  color: var(--text-faint);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* Research and project entries */
.entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 4px 0 28px;
}
.entry + .entry { padding-top: 28px; border-top: 1px solid var(--lines); }
.entry--media { grid-template-columns: 1fr 168px; }

.entry-title {
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 19px;
  line-height: 1.35;
}
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 14px;
  font-family: var(--font-detail);
  font-size: 14px;
  color: var(--text-faint);
  margin: 2px 0 10px;
}
.entry-desc p + p { margin-top: 10px; }
.entry-skills {
  font-family: var(--font-detail);
  font-size: 13.5px;
  color: var(--text-faint);
  margin-top: 10px;
}
.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-family: var(--font-detail);
  font-size: 14px;
  font-weight: 500;
  margin-top: 10px;
}
.entry-media {
  align-self: start;
  margin-top: 6px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 3px;
  background: var(--lines);
}
.entry-media img { width: 100%; height: 100%; object-fit: cover; }

/* Awards */
.awards-heading {
  font-family: var(--font-detail);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  margin: 0 0 6px;
}
.awards-group + .awards-group { margin-top: 24px; }
.award-detail { color: var(--text-faint); }
.award-detail:not(:empty)::before { content: ", "; }
.awards li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 5px 0;
}
.award-year {
  font-family: var(--font-detail);
  font-size: 14px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* Footer */
.foot {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 24px 24px 48px;
  border-top: 1px solid var(--lines);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-detail);
  font-size: 13px;
  color: var(--text-faint);
}
.foot a { color: var(--text-soft); }
.foot .foot-edit { margin-left: 18px; color: var(--text-faint); opacity: 0.6; }
.foot .foot-edit:hover { opacity: 1; }

/* ------------------------------------------------------------
   Small screens
   ------------------------------------------------------------ */
@media (max-width: 620px) {
  body { font-size: 17px; }
  .bar-inner { padding: 0 20px; }
  .bar-links { gap: 18px; }

  .page { padding: 36px 20px 16px; }
  .intro { grid-template-columns: 1fr; gap: 20px; margin-bottom: 48px; }
  .portrait { width: 96px; height: 126px; }
  .intro h1, .life-head h1 { font-size: 36px; }

  .news li { grid-template-columns: 1fr; gap: 0; padding: 8px 0; }
  .entry--media { grid-template-columns: 1fr; }
  .entry--media .entry-media { order: -1; max-width: 360px; aspect-ratio: 16 / 9; }
}

/* ------------------------------------------------------------
   Life gallery
   ------------------------------------------------------------ */
.page--wide, .wide .bar-inner, .wide .foot { max-width: var(--wide); }
.life-head { max-width: var(--measure); margin-bottom: 40px; }

/* Every tile is the same 4:3 frame; photos and videos are cropped to fill it
   and open full size in the viewer (_includes/lightbox.html). */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px 20px;
}
.tile-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 3px;
  background: var(--lines);
}
.tile-media > *, .tile-media img, .tile-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile-open {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.tile-open img, .tile-open video { transition: opacity 0.2s; }
.tile-open:hover img, .tile-open:hover video { opacity: 0.9; }
.tile--video .tile-open { cursor: pointer; }
.tile-play {
  position: absolute;
  inset: 0;
  width: 46px;
  height: 46px;
  margin: auto;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
}
.tile-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #fff;
}

.tile-file {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 20px;
  border: 1px solid var(--lines);
  border-radius: 3px;
  background: var(--background);
  font-family: var(--font-detail);
}
.tile-file:hover { text-decoration: none; border-color: var(--accent); }
.tile-file-ext { font-size: 13px; font-weight: 500; color: var(--accent); }
.tile-file-name { font-size: 14px; color: var(--text-soft); word-break: break-all; }

.tile-caption {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
}
.tile-date {
  display: block;
  margin-top: 2px;
  font-family: var(--font-detail);
  font-size: 13px;
  color: var(--text-faint);
}
.empty { color: var(--text-soft); }

/* Folders. Every folder's contents are on the page; the script in life/index.html
   marks the open folder (.is-open) and the list it's in (.has-open). */
.tile--folder > .folder-view { display: none; }
.gallery.has-open { display: block; }
.gallery.has-open > li:not(.is-open) { display: none; }
.tile--folder.is-open > :not(.folder-view) { display: none; }
.tile--folder.is-open > .folder-view { display: block; }
.in-folder .life-head .tagline { display: none; }

.folder-open { display: block; }
.folder-open:hover { text-decoration: none; }
.folder-cover {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 3px;
  background: var(--lines);
  /* a second sheet peeking out behind, so it reads as a folder */
  box-shadow: 6px -6px 0 -1px var(--background), 6px -6px 0 0 var(--lines);
}
.folder-cover img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.2s; }
.folder-open:hover .folder-cover img { opacity: 0.9; }
.folder-cover:empty::after { content: "Folder"; font: 13px var(--font-detail); color: var(--text-faint); }
.folder-name { margin-top: 8px; font-size: 16px; line-height: 1.45; }
.folder-count { display: block; font-family: var(--font-detail); font-size: 13px; color: var(--text-faint); }
.folder-head { margin-bottom: 24px; }
.folder-back { font-family: var(--font-detail); font-size: 14px; }
.folder-head h2 { font-weight: 400; font-size: 30px; line-height: 1.2; margin-top: 6px; }

/* Lightbox */
.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(12, 12, 12, 0.94);
  color: #eee;
}
.lightbox::backdrop { background: transparent; }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: min(92vw, 1100px);
  pointer-events: none;
}
.lightbox img, .lightbox video {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 2px;
}
.lightbox video { pointer-events: auto; background: #000; }
.lightbox [hidden] { display: none; } /* "img { display: block }" above would otherwise win */
.lightbox figcaption {
  font-family: var(--font-text);
  font-size: 17px;
  text-align: center;
  max-width: 60ch;
  color: #e6e3df;
}
.lb-btn {
  position: absolute;
  background: none;
  border: 0;
  color: #ddd;
  font: 300 40px/1 var(--font-detail);
  padding: 12px 18px;
  cursor: pointer;
}
.lb-btn:hover { color: #fff; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }
.lb-close { top: 8px; right: 8px; font-size: 34px; }

@media (max-width: 620px) {
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 12px; }
  .tile-caption { font-size: 15px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
}
