:root {
  --paper: #F2F1E8;
  --sky: #C9DCE8;
  --slate: #7FA5C0;
  --steel: #3F6E97;
  --prussian: #1B4472;
  --abyss: #0A2149;
  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: var(--abyss);
  color: var(--paper);
  font-family: var(--font-mono);
}

#sheet { position: absolute; top: 0; left: 0; width: 100%; display: block; }

/* index.html only -- text starts just right of the page's horizontal
   center (main's own left padding does the "just right of" part), leaving
   the left half free for .home-photo. */
.home-page main { max-width: none; margin-left: 50vw; }

.home-photo {
  position: absolute;
  top: calc(clamp(96px, 14vw, 160px) + 24px);
  left: calc(25vw - (min(360px, 40vw) / 2) + 2.5vw);
  z-index: 2;
  width: min(360px, 40vw);
  height: auto;
  box-shadow: 0 20px 60px rgba(10, 33, 73, .5);
}

/* cv-contact.html only -- same left-photo/right-text split as the home
   page, with the CV's first page standing in for a portrait. */
.cv-page main { max-width: none; margin-left: 58vw; }

.cv-plate {
  position: absolute;
  /* fallback for the pre-JS/no-JS instant -- cv-contact.html's inline
     script overwrites this to the real rendered top of the "Contact"
     heading (fluid type makes that offset non-constant across widths, so
     no fixed clamp() here can match it exactly at every size). */
  top: clamp(72px, 10vw, 120px);
  left: clamp(20px, 4vw, 56px);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  /* fills from the page gutter to 2.5rem short of main's 58vw column */
  width: calc(58vw - clamp(20px, 4vw, 56px) - 2.5rem);
  margin-bottom: clamp(48px, 8vw, 96px);
}
.cv-plate img {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 20px 60px rgba(10, 33, 73, .5);
}

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

a { color: inherit; }

/* ---- header / nav ---- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(16px, 3vw, 28px) clamp(20px, 4vw, 56px);
  background: linear-gradient(to bottom, rgba(10, 33, 73, .55), transparent);
}
.site-header .mark {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 26px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
}
.site-header .mark .mark-suffix {
  font-size: 20px;
  letter-spacing: .02em;
  text-transform: none;
}
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
}
.site-header nav a {
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--sky);
  opacity: .75;
  padding: 2px 0;
  border-bottom: 1px solid transparent;
}
.site-header nav a:hover { opacity: 1; }
.site-header nav a[aria-current="page"] {
  color: var(--paper);
  opacity: 1;
  border-bottom-color: var(--sky);
}

/* ---- page content ---- */
main {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: clamp(96px, 14vw, 160px) clamp(20px, 4vw, 56px) clamp(48px, 8vw, 96px);
  max-width: 860px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--sky);
  opacity: .72;
}
.eyebrow span { opacity: .5; }

h1 {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 40, "WONK" 1, "opsz" 120;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: .98;
  letter-spacing: -.02em;
  margin-top: .6rem;
  text-shadow: 0 2px 34px rgba(10, 33, 73, .55);
}
h1 em { font-style: normal; font-weight: 500; }

.tagline {
  margin-top: 1.1rem;
  max-width: 34ch;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  line-height: 1.3;
  color: var(--paper);
}

.lede {
  margin-top: 1.4rem;
  max-width: 58ch;
  font-size: 14px;
  line-height: 1.75;
  color: var(--sky);
  opacity: .9;
}
.lede p + p { margin-top: 1rem; }

h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.3rem;
  letter-spacing: -.01em;
  margin-top: 3.2rem;
  margin-bottom: 1.2rem;
  color: var(--paper);
}

/* publications.html only -- lets .plate-list center its rows across the
   full page width instead of just within main's 860px text column. Title
   card (eyebrow/h1) stays put at main's normal left padding -- same as
   projects-page -- since plain block elements aren't affected by lifting
   max-width, only .plate-list's own centering below does anything. */
.publications-page main { max-width: none; }

/* section subtitles (Published/In Preparation/Patents) share the plate
   rows' 720px centered column, so their left edge lines up with the
   plates' horizontal divider rather than main's fixed padding. */
.publications-page h2 { max-width: 720px; margin-inline: auto; }

.plate-list { display: flex; flex-direction: column; align-items: center; gap: 1.8rem; }
.plate {
  display: flex;
  align-items: flex-start;
  gap: 1.8rem;
  width: 100%;
  max-width: 720px;
  border-top: 1px solid rgba(201, 220, 232, .18);
  padding-top: 1.2rem;
}
.plate-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-top: .2rem;
}
.plate-body { flex: 1 1 auto; min-width: 0; }
.plate .eyebrow { margin-bottom: .3rem; }
.plate h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  margin-bottom: .5rem;
}
.plate p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--sky);
  opacity: .9;
  max-width: 60ch;
}
/* own name in author lists: real 700 (loaded on publications.html) in
   paper rather than the sky body color, so it reads at a glance */
.plate p strong {
  font-weight: 700; color: var(--paper);
  background: rgba(242, 241, 232, .08); /* --paper, faint highlight */
  padding: 0 .25em; margin: 0 -.1em; border-radius: 2px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}

/* projects.html only -- lets .project-grid center across the full page
   width instead of just within main's 860px text column. Safe to lift
   main's max-width here specifically because the intro text above the
   grid (eyebrow/h1/lede) is either short or has its own max-width. */
.projects-page main { max-width: none; }

/* all projects in a single row -- one column per project, sized to fit */
.project-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  justify-content: center;
  gap: clamp(0.5rem, 1.6vw, 1.4rem);
  margin-top: 2.4rem;
}
.project-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.5rem, 1.2vw, 0.9rem);
  text-align: center;
  text-decoration: none;
  padding: clamp(0.35rem, 1vw, 0.75rem);
  border-radius: 4px;
}
.project-card:hover, .project-card:focus-visible { background: rgba(201, 220, 232, .05); }

.project-plate { display: flex; align-items: center; justify-content: center; width: 100%; }
/* paper mat around each baked plate -- --paper, never #fff (CLAUDE.md #3);
   the plate's own ragged coated edge fades into the same color */
.project-plate img {
  width: 100%; max-width: 180px; height: auto; object-fit: contain;
  box-sizing: border-box;
  padding: clamp(4px, 0.7vw, 10px);
  background: var(--paper);
  box-shadow: 0 2px 10px rgba(10, 33, 73, .35);
}

.project-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(0.62rem, 1.3vw, 0.85rem);
  line-height: 1.35;
  color: var(--paper);
}

.field-list { display: flex; flex-direction: column; gap: 1rem; margin-top: .5rem; }
.field-list dt {
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sky);
  opacity: .65;
}
.field-list dd {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-top: .2rem;
}

/* ---- project detail pages ---- */
/* content sits over the dark sheet; images are mounted like specimens
   (paper card + the same drop shadow the home photo uses). Colors pull
   from the cyanotype palette instead of PW1's ink-on-white. */
.detail-page main { max-width: none; }

.detail {
  max-width: 62rem;
  margin-inline: auto;
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
}

.detail-text .eyebrow { margin-bottom: 0.5rem; }

.detail-text h2, .detail-text h3, .detail-text h4 {
  font-family: var(--font-display);
  color: var(--paper);
  font-weight: 500;
  line-height: 1.2;
}
.detail-text h2 { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); }
.detail-text h3 { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); }
.detail-text h4 {
  font-size: clamp(1.05rem, 1rem + 0.5vw, 1.25rem);
  font-weight: 300; font-style: italic;
  color: var(--sky); margin-top: 0.4rem;
}
.detail-text p {
  font-size: 14px;
  line-height: 1.75;
  color: var(--sky);
  margin-top: 0.85em;
  max-width: 68ch;
}
.detail-text p strong { color: var(--paper); font-weight: 500; }
.detail-text a { color: var(--paper); text-decoration: underline; text-underline-offset: 2px; }

/* a heading block mid-page reads as a new section — give it extra air */
.detail > .detail-text:not(:first-child):has(> h2, > h3) {
  margin-top: clamp(0.5rem, 2vw, 1.5rem);
}

/* mounted-specimen treatment for every figure */
.detail-figure img, .detail-hero-figure img, .figure-grid img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--paper);
  box-shadow: 0 16px 48px rgba(10, 33, 73, .45);
}
.detail-figure a { display: block; }

/* hero-pair: intro text beside the hero image */
.detail-hero { display: flex; flex-direction: column; gap: 1.5rem; }
.detail-hero-figure figcaption {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--sky);
  opacity: .7;
}
@media (min-width: 800px) {
  .detail-hero { flex-direction: row; align-items: flex-start; gap: clamp(1.5rem, 4vw, 3rem); }
  .detail-hero > .detail-text { flex: 1 1 0; }
  .detail-hero-figure { flex: 1 1 0; max-width: 30rem; }
}

/* figureGrid: two-column captioned image grid */
.figure-grid {
  list-style: none;
  display: grid;
  gap: 2rem;
  margin-top: 1rem;
}
@media (min-width: 700px) { .figure-grid { grid-template-columns: 1fr 1fr; } }
.figure-caption {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--sky);
  opacity: .85;
}
.figure-caption em { font-style: italic; opacity: .7; }

/* size tiers for portrait/near-square figures */
.detail-figure--narrow { max-width: 24rem; margin-inline: auto; }
.detail-figure--medium { max-width: 38rem; margin-inline: auto; }

/* captioned single image: image + text side by side */
.detail-figure-captioned { display: grid; gap: 1.25rem; }
.detail-figure-captioned figcaption { font-size: 13px; line-height: 1.7; color: var(--sky); }
.detail-figure-captioned figcaption p + p { margin-top: 0.85em; }
@media (min-width: 800px) {
  .detail-figure-captioned { grid-template-columns: 1fr 1fr; align-items: center; }
}

/* slideshow: main viewport + thumbnail strip. --slide-ar lets each page
   match the viewport to its deck's shape (16/9 decks, wide banners, ...)
   so contained images don't float in empty paper. */
.slideshow { display: grid; gap: 0.75rem; max-width: 62rem; margin-inline: auto; }
.slideshow-viewport {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--slide-ar, 16 / 9);
  background: var(--paper);
  box-shadow: 0 16px 48px rgba(10, 33, 73, .45);
}
.slideshow-track { display: flex; height: 100%; transition: translate 0.35s ease; }
.slideshow-track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; display: block; }
.slideshow-arrow {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(242, 241, 232, .85);
  color: var(--abyss);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
/* keep arrows a comfortable 44px tap target on touch devices */
@media (pointer: coarse) { .slideshow-arrow { width: 2.75rem; height: 2.75rem; } }
.slideshow-prev { left: 0.75rem; }
.slideshow-next { right: 0.75rem; }
.slideshow-thumbs { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; }
.slideshow-thumb {
  flex: 0 0 auto;
  width: 4.5rem;
  padding: 0;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}
.slideshow-thumb img { display: block; width: 100%; height: auto; }
.slideshow-thumb.is-active, .slideshow-thumb:hover { opacity: 1; }
.slideshow-thumb.is-active { border-color: var(--sky); }

/* CTA button under a detail hero figure */
.detail-cta {
  display: inline-block;
  align-self: flex-start;
  margin-top: 1rem;
  padding: 0.7rem 1.5rem;
  font-family: var(--font-mono, inherit);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--sky);
  background: rgba(10, 33, 73, .4);
  border: 1px solid rgba(201, 220, 232, .3);
  transition: background .2s ease;
}
.detail-cta:hover { background: rgba(10, 33, 73, .65); }

/* back-to-projects pager */
.detail-pager {
  max-width: 62rem;
  margin: clamp(2.5rem, 6vw, 4rem) auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(201, 220, 232, .18);
}
.detail-pager a {
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--sky);
  opacity: .8;
}
.detail-pager a:hover { opacity: 1; }

@media (max-width: 640px) {
  .site-header { justify-content: flex-start; }
  .home-page main { margin-left: 0; }
  /* relative, not static: z-index only applies to positioned boxes, and
     without it the #sheet canvas paints over these. top:auto drops the
     desktop offset; the margin clears the fixed header instead, and main
     no longer needs its own header clearance below them. */
  .home-photo, .cv-plate { position: relative; top: auto; left: auto; margin: clamp(96px, 14vw, 160px) clamp(20px, 4vw, 56px) 0; }
  .home-photo { display: block; width: min(270px, 60vw); margin-inline: auto; }
  .cv-plate { width: auto; }
  .home-page main, .cv-page main { padding-top: 2rem; }
  .cv-page main { margin-left: 0; }

  /* phones get the whole row's width per card -- stack single-column
     instead of cramming all 5 into one tight strip, and size back up
     since each plate now has room to breathe. */
  .project-grid { grid-template-columns: minmax(0, 320px); gap: 2.2rem; }
  .project-plate img { max-width: 240px; }
  .project-card h3 { font-size: 1rem; }
}

/* Below ~480px the fixed nav wraps to three rows (~127px tall); the default
   96px content inset no longer clears it, so the plate/title collide with
   the nav. Push detail-page content down to clear the wrapped header. */
@media (max-width: 480px) {
  .detail-page main, .projects-page main { padding-top: 145px; }
  .home-photo, .cv-plate { margin-top: 145px; }
}
