/* ---------- Tokens ---------- */
:root {
  --paper: #f5f0e8;
  --paper-2: #ece5d9;
  --ink: #1d1b18;
  --muted: #6d665c;
  --line: #d9d0c2;
  --accent: #2f4a3b;
  --max: 78rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --display: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.05; margin: 0; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow {
  font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 1rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 4.5rem; }
.logo { font-family: var(--display); font-size: 1.35rem; text-decoration: none; letter-spacing: .01em; }
.nav { display: flex; gap: 2rem; }
.nav a { text-decoration: none; font-size: .95rem; color: var(--muted); padding: .25rem 0; border-bottom: 1px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.nav-toggle { display: none; background: none; border: 0; padding: .5rem; cursor: pointer; color: var(--ink); }
.nav-toggle span { display: block; width: 22px; height: 1.5px; background: currentColor; margin: 5px 0; transition: transform .2s; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.25px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.25px) rotate(-45deg); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 6rem; padding: 3rem 0 2.5rem; }
.site-footer .wrap { display: grid; grid-template-columns: 1.2fr 1.4fr .6fr; gap: clamp(2rem, 4vw, 3.5rem); align-items: start; }
.site-footer h2 { font-size: clamp(2rem, 5vw, 3.25rem); }
.site-footer h3 { font-family: var(--sans); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .75rem; font-weight: 500; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .35rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.copyright { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; margin-top: 2rem; }

/* ---------- Home ---------- */
.intro { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(2rem, 6vw, 6rem); align-items: end; padding: clamp(3rem, 8vw, 7rem) 0 clamp(3rem, 6vw, 5rem); }
.intro h1 { font-size: clamp(3.5rem, 11vw, 9rem); letter-spacing: -.03em; }
.intro h1 em { font-style: italic; color: var(--accent); }
.intro .bio { font-size: 1.1rem; max-width: 34rem; margin-top: 2rem; }
.intro .tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; padding: 0; list-style: none; }
.intro .tags li { border: 1px solid var(--line); border-radius: 999px; padding: .3rem .85rem; font-size: .85rem; color: var(--muted); }
.intro figure { margin: 0; }
.intro figure img { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; border-radius: 2px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--ink); padding-top: 1rem; margin-bottom: 2rem; }
.section-head h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
.section-head span { color: var(--muted); font-size: .9rem; }

.projects { display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(1.5rem, 3vw, 2.5rem) clamp(1rem, 2vw, 1.5rem); }
.project { grid-column: span 2; text-decoration: none; }
.project:nth-child(1), .project:nth-child(2) { grid-column: span 3; }
.project .thumb { overflow: hidden; background: var(--paper-2); aspect-ratio: 4 / 5; }
.project:nth-child(1) .thumb, .project:nth-child(2) .thumb { aspect-ratio: 5 / 4; }
.project .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.project .thumb img.contain { object-fit: contain; background: #efe9e0; padding: 1.5rem 0; }
.project:hover .thumb img { transform: scale(1.04); }
.project .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: .9rem; }
.project h3 { font-size: 1.6rem; }
.project p { color: var(--muted); font-size: .9rem; margin: 0; text-align: right; }

.feature { display: grid; grid-template-columns: 1fr 1fr; margin-top: 6rem; text-decoration: none; background: #4b2f45; color: #f3e6b0; overflow: hidden; }
.feature { height: clamp(24rem, 38vw, 32rem); }
.feature img { width: 100%; height: 100%; object-fit: cover; object-position: center 70%; }
.feature .copy { padding: clamp(2rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: center; }
.feature .eyebrow { color: #c9c78f; }
.feature h2 { font-size: clamp(2.5rem, 5vw, 4rem); font-style: italic; margin-bottom: 1rem; }
.feature .cta { margin-top: 1rem; font-size: .95rem; }
.feature:hover .cta { text-decoration: underline; }

/* ---------- Project pages ---------- */
.case-head { padding: clamp(3rem, 7vw, 6rem) 0 clamp(2rem, 4vw, 3rem); display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: end; }
.case-head h1 { font-size: clamp(3.5rem, 10vw, 8rem); letter-spacing: -.03em; }
.case-head .kind { font-family: var(--display); font-style: italic; font-size: clamp(1.25rem, 2vw, 1.6rem); color: var(--accent); margin-top: .75rem; }
.case-head .desc { font-size: 1.05rem; }
.back { display: inline-block; font-size: .9rem; color: var(--muted); text-decoration: none; margin-bottom: 1.5rem; }
.back:hover { color: var(--ink); }

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(.75rem, 1.5vw, 1.25rem); }
.gallery figure { margin: 0; background: var(--paper-2); overflow: hidden; cursor: zoom-in; }
.gallery figure.wide { grid-column: 1 / -1; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery .scroller { grid-column: 1 / -1; background: var(--paper-2); display: flex; justify-content: center; padding: clamp(1.5rem, 4vw, 3rem); cursor: default; }
.gallery .scroller > div { max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 50px rgb(0 0 0 / .15); border-radius: 6px; }
.gallery .scroller img { width: min(430px, 80vw); height: auto; }
.scroller-note { text-align: center; color: var(--muted); font-size: .85rem; margin-top: .5rem; grid-column: 1 / -1; }

.pager { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ink); margin-top: 5rem; }
.pager a { text-decoration: none; padding: 1.5rem 0; }
.pager a:last-child { text-align: right; }
.pager small { display: block; color: var(--muted); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.pager span { font-family: var(--display); font-size: clamp(1.5rem, 3vw, 2.25rem); }
.pager a:hover span { font-style: italic; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgb(20 18 16 / .94); display: none; align-items: center; justify-content: center; padding: 2rem; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-height: 100%; max-width: 100%; object-fit: contain; }
.lightbox button { position: absolute; background: none; border: 0; color: #fff; font-size: 2rem; cursor: pointer; padding: 1rem; line-height: 1; }
.lightbox .close { top: .5rem; right: .75rem; }
.lightbox .prev { left: .5rem; top: 50%; transform: translateY(-50%); }
.lightbox .next { right: .5rem; top: 50%; transform: translateY(-50%); }

/* ---------- Resume ---------- */
.cv-head { display: grid; grid-template-columns: 1fr 18rem; gap: clamp(2rem, 5vw, 5rem); align-items: end; padding: clamp(3rem, 7vw, 6rem) 0 3rem; }
.cv-head h1 { font-size: clamp(3rem, 9vw, 7rem); letter-spacing: -.03em; }
.cv-head .now { font-family: var(--display); font-style: italic; font-size: clamp(1.2rem, 2vw, 1.5rem); color: var(--accent); margin-top: 1rem; }
.cv-head img { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; }
.cv-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.75rem; }
.btn { display: inline-block; padding: .7rem 1.25rem; border: 1px solid var(--ink); border-radius: 999px; text-decoration: none; font-size: .9rem; transition: background .15s, color .15s; }
.btn:hover, .btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: var(--accent); border-color: var(--accent); }

.cv-section { display: grid; grid-template-columns: 14rem 1fr; gap: 2rem; border-top: 1px solid var(--ink); padding: 2rem 0 3rem; }
.cv-section > h2 { font-size: 1.75rem; }
.entries { display: grid; gap: 2rem; }
.entry { display: grid; grid-template-columns: 1fr 9rem; gap: 1.5rem; align-items: start; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; padding-bottom: 0; }
.entry.no-img { grid-template-columns: 1fr; }
.entry h3 { font-family: var(--sans); font-size: 1.05rem; font-weight: 500; line-height: 1.35; }
.entry .role { color: var(--accent); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; margin: .25rem 0 0; }
.entry .date { color: var(--muted); font-size: .9rem; margin: .25rem 0 .6rem; }
.entry p:last-child { margin-bottom: 0; }
.entry img { width: 100%; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; }
.entry figcaption { font-size: .8rem; color: var(--muted); margin-top: .4rem; line-height: 1.4; }
.entry figure { margin: 0; }

.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.cols-3 h3 { font-family: var(--sans); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: .75rem; }
.cols-3 ul { list-style: none; padding: 0; margin: 0; }
.cols-3 li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.chips li { border: 1px solid var(--line); border-radius: 999px; padding: .25rem .75rem; font-size: .85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 56rem) {
  .intro, .case-head, .cv-head { grid-template-columns: 1fr; }
  .intro figure { max-width: 22rem; }
  .cv-head img { max-width: 16rem; }
  .projects { grid-template-columns: 1fr 1fr; }
  .project, .project:nth-child(1), .project:nth-child(2) { grid-column: span 1; }
  .project:nth-child(1) { grid-column: 1 / -1; }
  .feature { grid-template-columns: 1fr; height: auto; }
  .feature img { aspect-ratio: 3 / 2; }
  .cv-section { grid-template-columns: 1fr; gap: 1.25rem; }
  .cols-3 { grid-template-columns: 1fr 1fr; }
  .site-footer .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 40rem) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 4.5rem; left: 0; right: 0; flex-direction: column; gap: 0; background: var(--paper); border-bottom: 1px solid var(--line); padding: .5rem var(--gutter) 1rem; }
  .nav.open { display: flex; }
  .nav a { padding: .75rem 0; font-size: 1.1rem; border-bottom: 1px solid var(--line); }
  .nav a[aria-current="page"] { border-bottom-color: var(--line); }
  .projects { grid-template-columns: 1fr; }
  .project .thumb, .project:nth-child(1) .thumb, .project:nth-child(2) .thumb { aspect-ratio: 4 / 3; }
  .gallery { grid-template-columns: 1fr; }
  .entry { grid-template-columns: 1fr 5.5rem; gap: 1rem; }
  .cols-3 { grid-template-columns: 1fr; }
  .pager span { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Logo tiles on the resume */
.entry img.logo-tile { background: #31412a; object-fit: contain; padding: 1.1rem; cursor: default; }
.cv-head .now a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.entry h3 a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.intro.solo { grid-template-columns: 1fr; }
.intro.solo .bio { max-width: 42rem; }

/* Contact form */
.contact-form { display: grid; gap: 1rem; }
.contact-form h3 { margin-bottom: 0; }
.contact-form label { display: grid; gap: .4rem; font-size: .85rem; color: var(--muted); }
.contact-form input, .contact-form textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: 4px; padding: .7rem .85rem; width: 100%;
  transition: border-color .15s;
}
.contact-form textarea { resize: vertical; min-height: 7rem; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--ink); }
.contact-form button { justify-self: start; cursor: pointer; font: inherit; font-size: .9rem; }
.contact-form button:disabled { opacity: .6; cursor: wait; }
.form-status { margin: 0; font-size: .9rem; min-height: 1.2em; }
.form-status.ok { color: #2f6b4f; }
.form-status.err { color: #a5432f; }
.butter .contact-form input, .butter .contact-form textarea { color: var(--plum); border-color: color-mix(in srgb, var(--plum) 25%, transparent); }

/* Collapsible group on the resume (e.g. summer schools) */
.entry-group { border-bottom: 1px solid var(--line); padding-bottom: 2rem; }
.entry-group summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.entry-group summary::-webkit-details-marker { display: none; }
.entry-group summary::after { content: "+"; font-size: 1.5rem; line-height: 1; color: var(--muted); transition: transform .2s; }
.entry-group[open] summary::after { transform: rotate(45deg); }
.entry-group summary h3 { font-family: var(--sans); font-size: 1.05rem; font-weight: 500; line-height: 1.35; }
.entry-group summary .date { color: var(--muted); font-size: .9rem; margin: .25rem 0 0; }
.entry-group summary:hover h3 { text-decoration: underline; text-underline-offset: 3px; }
.entry-group > .entries { margin-top: 1.5rem; padding-left: 1.25rem; border-left: 2px solid var(--line); }
.entry p a { text-underline-offset: 3px; }
