/* ==========================================================================
   Colors and fonts
   ========================================================================== */

:root {
  --bg: #ffffff;
  --fg: #1c1a17;
  --muted: #7a7266;
  --accent: #c42b20;
  --rule: #eae7e1;
  --image-bg: #f4f2ee;

  --serif: 'Gentium Book Plus', serif;
  --sans: 'Commissioner', sans-serif;
}

/* ==========================================================================
   Base
   ========================================================================== */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }

h1, h2, h3 { margin: 0; }

.page {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ==========================================================================
   Top navigation
   ========================================================================== */

.topnav {
  position: absolute;
  top: 40px;
  right: 32px;
  z-index: 5;
  display: flex;
  gap: 36px;
  font-family: var(--serif);
  font-size: 1.2rem;
  letter-spacing: .01em;
  line-height: 1;
}

.topnav a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .28em;
  text-decoration-color: color-mix(in srgb, var(--muted) 55%, transparent);
  transition: color .15s, text-decoration-color .15s;
}

.topnav a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ==========================================================================
   Landing (name, bio, links, photo) — fills the first screen, centered
   ========================================================================== */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 64px;
  align-items: center;
  align-content: center;
  min-height: 100svh;
  padding: 56px 0;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-variant-caps: small-caps;
  font-size: clamp(3rem, 5.6vw, 4.2rem);
  letter-spacing: .03em;
  line-height: 1.02;
}

.hero .tagline { color: var(--muted); margin: .45em 0 1.4em; font-size: 1.04em; }
.hero h1 + .bio { margin-top: 1.6rem; } /* when there's no tagline */
.hero .bio p { margin: 0 0 1em; }
.hero .bio p:last-child { margin-bottom: 0; }

.hero .links { display: flex; flex-wrap: wrap; gap: .3em 1.5em; margin-top: 1.5em; font-weight: 500; }
.hero .links .email { color: var(--accent); }

.hero .photo { display: flex; justify-content: center; }
.hero .photo img { display: block; width: 100%; max-width: 400px; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 50%; }

/* ==========================================================================
   Sections — any <section> with an <h2> gets a heading with a rule after it
   ========================================================================== */

section { padding-top: 32px; }
section:first-of-type { padding-top: 24px; }

section > h2 {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.6rem;
}

section > h2::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

section > p { margin: 0 0 1em; }
.muted { color: var(--muted); }

/* ---------- News: a dated list ---------- */

ul.news { list-style: none; margin: 0; padding: 0; }
ul.news li { display: grid; grid-template-columns: 7em 1fr; gap: 1em; padding: .12em 0; }
ul.news time { color: var(--muted); font-size: .9em; padding-top: .1em; font-variant-numeric: tabular-nums; }

/* ---------- Projects: image on the left, text on the right ---------- */

.project {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

.project:last-child { border-bottom: 0; }
section > h2 + .project { padding-top: 6px; }

.project > img,
.project > video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: var(--image-bg);
}

.project h3 { font-family: var(--sans); font-weight: 500; font-size: 1.18em; line-height: 1.3; letter-spacing: -.01em; }
.project h3 a { color: var(--fg); }
.project .venue { font-size: .85em; color: var(--muted); margin: .1em 0 .3em; }
.project p { margin: .2em 0 .4em; }
.project .project-links { display: flex; flex-wrap: wrap; gap: 1em; font-size: .85em; }

/* ==========================================================================
   Footer and the "Projects ↓" scroll cue
   ========================================================================== */

footer { padding: 48px 16px 40px; text-align: center; font-size: .8em; color: var(--muted); }

.scroll-fade {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 120px;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12px;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg) 72%);
  transition: opacity .35s;
}

.scroll-fade a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  animation: rise .9s cubic-bezier(.2, .7, .2, 1) 1s backwards;
}

.scroll-fade a:hover { color: var(--accent); }
.scroll-fade svg { width: 16px; height: 16px; animation: bob 2.4s ease-in-out infinite; }
.scroll-fade.cue-gone a { opacity: 0; pointer-events: none; }
.scroll-fade.gone { opacity: 0; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Photo intro: the portrait emerges from noise (see site.js)
   ========================================================================== */

.intro .hero .photo img { opacity: 0; }
.photo-noise { position: relative; display: block; width: 100%; max-width: 400px; }
.photo-noise img { width: 100%; }
.photo-noise canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
}

/* ==========================================================================
   Small screens and reduced motion
   ========================================================================== */

@media (max-width: 820px) {
  .page { padding: 0 16px; }
  .topnav { position: static; justify-content: flex-end; gap: 24px; padding-top: 24px; font-size: 1.1rem; }
  .hero { grid-template-columns: 1fr; gap: 28px; min-height: auto; padding-top: 48px; }
  .hero .photo { order: -1; justify-content: flex-start; }
  .hero .photo img, .hero .photo-noise { max-width: 180px; }
  .project { grid-template-columns: 1fr; gap: 16px; }
  ul.news li { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-fade a, .scroll-fade svg { animation: none; }
}
