/* ==========================================================================
   Terry Esguerra — site styles
   A dark gallery wall. Terry's paintings are the light source; everything
   else is glass and typography laid over them.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&family=Outfit:wght@200..700&display=swap');

/* --------------------------------------------------------------- tokens -- */
:root {
  --ink:        #0b0a0d;
  --ink-soft:   #14121a;
  --paper:      #f5f0e8;
  --paper-dim:  rgba(245, 240, 232, 0.66);
  --paper-faint:rgba(245, 240, 232, 0.38);
  --hairline:   rgba(245, 240, 232, 0.16);

  /* overridden per section by [data-bg] — see "painting palettes" below */
  --accent:     #e8b06a;

  --display: 'Fraunces', 'Hoefler Text', Georgia, 'Times New Roman', serif;
  --body:    'Outfit', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* fluid scale */
  --step--1: clamp(0.82rem, 0.79rem + 0.15vw, 0.92rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3.2rem);
  --step-4:  clamp(2.6rem, 1.8rem + 4.2vw, 5.6rem);
  --step-5:  clamp(3.2rem, 1.9rem + 6.4vw, 8rem);

  --gutter: clamp(1.25rem, 5vw, 5rem);
  --measure: 62ch;
  --panel-bg: rgba(12, 11, 15, 0.56);
  --panel-radius: 4px;

  --fade: 1100ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* painting palettes — each background lends its accent to the section it backs */
[data-bg="night-alley"]      { --accent: #f07ec0; }
[data-bg="blue-hour"]        { --accent: #f0b352; }
[data-bg="coral-horizon"]    { --accent: #ff8f76; }
[data-bg="cathedral"]        { --accent: #cfc4b4; }
[data-bg="open-water"]       { --accent: #8fc4e8; }
[data-bg="cafe-terrace"]     { --accent: #ef5a3c; }
[data-bg="monochrome-alley"] { --accent: #ded6c8; }
[data-bg="garden-steps"]     { --accent: #ff9d3c; }
[data-bg="jungle-falls"]     { --accent: #7fd97f; }
[data-bg="sea-cave"]         { --accent: #ffa23d; }
[data-bg="autumn-lake"]      { --accent: #ff8a5c; }
[data-bg="watermill"]        { --accent: #e8b06a; }
[data-bg="venice-boats"]     { --accent: #5fc7d6; }
[data-bg="rialto"]           { --accent: #67c3cf; }
[data-bg="bougainvillea"]    { --accent: #f45fc4; }
[data-bg="lamplit-street"]   { --accent: #f5c65a; }

/* ---------------------------------------------------------------- base -- */
* { box-sizing: border-box; }

html {
  background: var(--ink);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* clip, not hidden: `overflow-x: hidden` turns this into a scroll container
     and breaks the sticky section labels on the résumé. */
  overflow-x: clip;
}

body {
  margin: 0;
  background: transparent;
  color: var(--paper);
  font-family: var(--body);
  font-size: var(--step-0);
  font-weight: 300;
  line-height: 1.68;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

::selection { background: var(--accent); color: var(--ink); }

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: 0; left: 50%;
  transform: translate(-50%, -120%);
  z-index: 200;
  padding: 0.7rem 1.2rem;
  background: var(--paper); color: var(--ink);
  font-size: var(--step--1); text-decoration: none;
  transition: transform 180ms var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* ======================================================== the bg stage ===
   One fixed, full-viewport stack of paintings. Exactly one layer is at
   opacity 1 at any moment; scrolling into a new section crossfades to its
   painting. Transform (drift) lives on the inner <img>, opacity on the
   wrapper, so the two never fight over the same property.
   ======================================================================= */
.bg-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--ink);
  pointer-events: none;
}

.bg-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--fade) var(--ease);
}
.bg-layer.is-active { opacity: 1; }
/* only the pair mid-crossfade gets promoted, so we never hold 6 GPU textures */
.bg-layer.is-active,
.bg-layer.is-leaving { will-change: opacity; }

/* Scale is CSS's business, drift is JavaScript's: site.js only ever writes
   --bg-shift, so a page that wants a different zoom (see .is-hushed) keeps it. */
.bg-layer img {
  --bg-scale: 1.08;
  --bg-shift: 0%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(var(--bg-scale)) translate3d(0, var(--bg-shift), 0);
  transform-origin: center;
}

/* focal points that survive a tall portrait crop */
.bg-layer[data-bg-key="cathedral"] img       { object-position: 50% 35%; }
.bg-layer[data-bg-key="jungle-falls"] img    { object-position: 50% 45%; }
.bg-layer[data-bg-key="open-water"] img      { object-position: 50% 60%; }
.bg-layer[data-bg-key="autumn-lake"] img     { object-position: 50% 55%; }
.bg-layer[data-bg-key="coral-horizon"] img   { object-position: 50% 40%; }
.bg-layer[data-bg-key="venice-boats"] img    { object-position: 55% 45%; }
.bg-layer[data-bg-key="sea-cave"] img        { object-position: 45% 40%; }

/* scrim + vignette: keeps every painting legible under text without
   flattening it. Two stacked gradients — vertical for nav/footer, radial
   to pull the eye to the middle. */
.bg-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 0%, rgba(11, 10, 13, 0.42) 100%),
    linear-gradient(to bottom,
      rgba(11, 10, 13, 0.82) 0%,
      rgba(11, 10, 13, 0.44) 18%,
      rgba(11, 10, 13, 0.40) 70%,
      rgba(11, 10, 13, 0.86) 100%);
}

/* canvas grain — a little tooth over the JPEGs, like paper under paint */
.bg-stage::before {
  content: '';
  position: absolute;
  inset: -50%;
  z-index: 2;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* gallery page: the art on the wall is the subject, so the wall goes quiet.
   The extra scale hides the soft edge the blur leaves at the viewport border. */
.bg-stage.is-hushed .bg-layer img {
  --bg-scale: 1.16;
  filter: blur(7px) saturate(0.7) brightness(0.5);
}

/* -------------------------------------------------------------- shell -- */
.shell { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- nav -- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem var(--gutter);
  background: linear-gradient(to bottom, rgba(11, 10, 13, 0.72), rgba(11, 10, 13, 0));
  transition: background 400ms var(--ease), backdrop-filter 400ms var(--ease);
}
.nav.is-stuck {
  background: rgba(11, 10, 13, 0.74);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--hairline);
}

.nav__mark {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: var(--step-0);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.nav__mark span { color: var(--accent); }

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 2rem);
  list-style: none;
  margin: 0; padding: 0;
}
.nav__links a {
  position: relative;
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper-dim);
  white-space: nowrap;
  transition: color 220ms var(--ease);
}
.nav__links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -6px;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 320ms var(--ease);
}
.nav__links a:hover,
.nav__links a[aria-current="page"] { color: var(--paper); }
.nav__links a:hover::after,
.nav__links a[aria-current="page"]::after { transform: scaleX(1); }
.nav__links a[target="_blank"]::before {
  content: '↗';
  margin-right: 0.3em;
  font-size: 0.8em;
  opacity: 0.5;
}

.nav__toggle {
  display: none;
  width: 42px; height: 42px;
  margin: -8px -8px -8px 0;
  padding: 0;
  background: none; border: 0;
  color: var(--paper);
  cursor: pointer;
}
.nav__toggle svg { width: 22px; height: 22px; margin: auto; }
.nav__toggle .icon-x { display: none; }
.nav[data-open="true"] .nav__toggle .icon-x { display: block; }
.nav[data-open="true"] .nav__toggle .icon-bars { display: none; }

/* ------------------------------------------------------------ sections -- */
.section {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(7rem, 14vh, 11rem) var(--gutter) clamp(5rem, 12vh, 9rem);
}
.section--tall { align-items: flex-start; }
.section--hero { align-items: flex-end; min-height: 100vh; min-height: 100svh; }

.section__inner { width: 100%; max-width: 1180px; margin-inline: auto; }

/* frosted glass — the readable surface the words actually sit on */
.panel {
  padding: clamp(1.6rem, 4vw, 3.4rem);
  background: var(--panel-bg);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
  border: 1px solid var(--hairline);
  border-radius: var(--panel-radius);
  box-shadow: 0 24px 70px -30px rgba(0, 0, 0, 0.9);
}
.panel--narrow { max-width: 72ch; }
.panel--bare {
  background: none; border: 0; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  padding-inline: 0;
}

/* --------------------------------------------------------- typography -- */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
  /* display sizes on a 320px phone: better a rare mid-word break than a
     heading clipped by its own panel */
  overflow-wrap: break-word;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0 0 1.4rem;
  font-family: var(--body);
  font-size: var(--step--1);
  font-weight: 400;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--accent), transparent);
  opacity: 0.5;
}

.display {
  font-size: var(--step-5);
  font-weight: 600;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.6);
}
/* the shadow is what lets a title sit on .panel--bare, straight over a painting */
.title { font-size: var(--step-3); text-shadow: 0 2px 30px rgba(0, 0, 0, 0.7); }
.title--big { font-size: var(--step-4); }

.lede {
  max-width: var(--measure);
  font-size: var(--step-1);
  font-weight: 200;
  line-height: 1.5;
  color: var(--paper);
}

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.35em; color: var(--paper-dim); }
.prose p:last-child { margin-bottom: 0; }
.prose p:first-of-type { color: var(--paper); }
.prose em { font-style: italic; color: var(--paper); }
.prose strong { font-weight: 500; color: var(--paper); }

/* a hand-painted rule, not a border — a masked brush swipe in the section's
   own accent, so the divider is literally the colour of the painting behind */
.brush {
  display: block;
  width: min(230px, 46%);
  height: 14px;
  margin: 1.7rem 0 2rem;
  background: var(--accent);
  opacity: 0.9;
  --swipe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cpath d='M1 7.4c10-2.6 20 .4 31 .9 14 .7 27-2.9 41-2.4 16 .6 31 4.1 47 3.5 14-.5 26-2.7 39-4.2l40-1.2-3 4.8-37 2.2c-13 1.6-25 4-39 4.6-17 .7-32-2.8-48-3.3-14-.5-27 3-41 2.5-11-.4-21-3.3-31-5.6z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask: var(--swipe) no-repeat center / 100% 100%;
  mask: var(--swipe) no-repeat center / 100% 100%;
}

/* -------------------------------------------------------------- hero -- */
.hero__kicker {
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.4rem;
}
.hero__title {
  font-size: var(--step-5);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.92;
  margin: 0;
  text-shadow: 0 4px 60px rgba(0, 0, 0, 0.75);
  overflow-wrap: break-word;   /* display sizes leave no room for a long name */
}
.hero__title em {
  display: block;
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}
.hero__sub {
  max-width: 34ch;
  margin: 1.6rem 0 0;
  font-size: var(--step-1);
  font-weight: 200;
  line-height: 1.4;
  color: var(--paper-dim);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.7);
}

.scroll-cue {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: clamp(2.5rem, 7vh, 5rem);
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--paper-faint);
  text-decoration: none;
}
.scroll-cue::after {
  content: '';
  width: 60px; height: 1px;
  background: currentColor;
  transform-origin: left;
  animation: cue 2.6s var(--ease) infinite;
}
@keyframes cue {
  0%, 100% { transform: scaleX(0.4); opacity: 0.4; }
  50%      { transform: scaleX(1);   opacity: 1; }
}

/* ------------------------------------------------------------- quote -- */
.quote { max-width: 30ch; }
.quote blockquote {
  margin: 0;
  font-family: var(--display);
  font-size: var(--step-3);
  font-style: italic;
  font-weight: 300;
  line-height: 1.22;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.quote blockquote::before {
  content: '“';
  display: block;
  font-size: 3em;
  line-height: 0.5;
  margin-bottom: 0.1em;
  color: var(--accent);
  opacity: 0.6;
}
.quote figcaption {
  margin-top: 1.8rem;
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}

/* -------------------------------------------------------- research list -- */
.research { list-style: none; margin: 0; padding: 0; }
.research li { border-top: 1px solid var(--hairline); }
.research li:last-child { border-bottom: 1px solid var(--hairline); }

.research__row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.4rem 1.8rem;
  padding: 1.7rem 0;
  transition: background 300ms var(--ease), padding-inline 300ms var(--ease);
}
.research li:hover .research__row {
  background: linear-gradient(to right, rgba(245, 240, 232, 0.05), transparent 70%);
}
.research__year {
  font-family: var(--display);
  font-size: var(--step-1);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1.2;
}
.research__title {
  font-family: var(--body);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.42;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}
.research__meta {
  margin: 0;
  font-size: var(--step--1);
  color: var(--paper-faint);
  line-height: 1.5;
}

/* ------------------------------------------------------- course cards -- */
/* One blur for the whole slab rather than one per card — nine backdrop-filter
   surfaces per page is enough to make scrolling stutter on a phone. The 1px
   grid gaps let the container's hairline colour through as dividers. */
.courses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
}
.course {
  padding: clamp(1.6rem, 3vw, 2.4rem);
  background: rgba(12, 11, 15, 0.5);
  transition: background 320ms var(--ease), transform 320ms var(--ease);
}
.course:hover {
  background: rgba(12, 11, 15, 0.72);
  transform: translateY(-3px);
}
.course__no {
  display: block;
  margin-bottom: 1rem;
  font-family: var(--display);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2em;
  color: var(--accent);
}
.course h3 {
  font-size: var(--step-1);
  font-weight: 500;
  margin-bottom: 0.9rem;
}
.course p {
  margin: 0;
  font-size: var(--step--1);
  line-height: 1.62;
  color: var(--paper-dim);
}

/* ------------------------------------------------------------- resume -- */
.cv { display: grid; gap: clamp(2.5rem, 6vh, 4.5rem); }

.cv-head { display: grid; gap: 1.6rem; }
.cv-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--step--1);
  color: var(--paper-dim);
}
.cv-head__meta a { text-decoration: none; border-bottom: 1px solid var(--hairline); }
.cv-head__meta a:hover { color: var(--accent); border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  align-self: start;
  justify-self: start;   /* .cv-head is a grid; without this the button stretches */
  padding: 0.85rem 1.5rem;
  border: 1px solid var(--accent);
  border-radius: 2px;
  font-size: var(--step--1);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
  background: transparent;
  cursor: pointer;
  transition: background 260ms var(--ease), color 260ms var(--ease);
}
.btn:hover { background: var(--accent); color: var(--ink); }
.btn svg { width: 15px; height: 15px; }

.cv-block { display: grid; grid-template-columns: 13rem 1fr; gap: 1rem 2.5rem; }
.cv-block > h2 {
  font-size: var(--step-1);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
  position: sticky;
  top: 6rem;
  align-self: start;
}
.cv-block__body { display: grid; gap: 2rem; min-width: 0; }

.cv-item { display: grid; gap: 0.45rem; }
.cv-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 1.5rem;
}
.cv-item h3 {
  font-family: var(--body);
  font-size: var(--step-0);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.35;
}
.cv-item__when {
  flex: none;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--accent);
  white-space: nowrap;
}
.cv-item__where {
  margin: 0;
  font-size: var(--step--1);
  font-style: italic;
  color: var(--paper-dim);
}
.cv-item ul {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}
.cv-item li {
  position: relative;
  padding-left: 1.15rem;
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--paper-dim);
}
.cv-item li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.72em;
  width: 5px; height: 1px;
  background: var(--accent);
  opacity: 0.8;
}
.cv-item__note { margin: 0; font-size: var(--step--1); color: var(--paper-faint); }

/* an accent-coloured inline link inside body copy */
.ilink {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.ilink:hover { border-bottom-color: var(--accent); }

.pub { display: grid; gap: 0.3rem; }
.pub h3 {
  font-family: var(--body);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.45;
}
.pub p { margin: 0; font-size: var(--step--1); color: var(--paper-faint); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.9rem 0 0; padding: 0; list-style: none; }
.chips li {
  padding: 0.32rem 0.75rem;
  border: 1px solid var(--hairline);
  border-radius: 100px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--paper-dim);
}
.chips--stack li { border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--paper); }

/* ------------------------------------------------------------ gallery -- */
.gallery-grid {
  columns: 3;
  column-gap: clamp(0.75rem, 1.6vw, 1.4rem);
  margin-top: clamp(2.5rem, 6vh, 4rem);
}
.art {
  break-inside: avoid;
  margin: 0 0 clamp(0.75rem, 1.6vw, 1.4rem);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
  display: block;
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}
.art img {
  width: 100%;
  height: auto;
  background: var(--ink-soft);
  transition: transform 700ms var(--ease), filter 700ms var(--ease);
}
.art figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2.6rem 1.1rem 1rem;
  background: linear-gradient(to top, rgba(8, 7, 10, 0.92), transparent);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 380ms var(--ease), transform 380ms var(--ease);
}
.art__title {
  display: block;
  font-family: var(--display);
  font-size: var(--step-1);
  font-weight: 500;
  line-height: 1.15;
}
.art__medium {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.art:hover img, .art:focus-visible img { transform: scale(1.04); filter: brightness(1.06); }
.art:hover figcaption, .art:focus-visible figcaption { opacity: 1; transform: none; }

/* lightbox */
.lightbox {
  width: 100%; max-width: 100%;
  height: 100%; max-height: 100%;
  margin: 0; padding: 0;
  border: 0;
  background: rgba(6, 5, 8, 0.94);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: var(--paper);
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(6, 5, 8, 0.9); }
.lightbox__stage {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 1rem;
  height: 100%;
  padding: clamp(3.2rem, 7vh, 4.5rem) clamp(1rem, 5vw, 5rem) clamp(1.4rem, 4vh, 2.5rem);
}
/* The painting fills its grid cell and letterboxes inside it. Sizing by the
   container (not by max-height:100%) is what keeps it honest — a percentage
   max-height against a 1fr track is indefinite and gets ignored, which lets
   tall works overflow onto the caption. drop-shadow follows the contained
   pixels, so the art still lifts off the backdrop. */
.lightbox__img-wrap { position: relative; min-height: 0; }
.lightbox img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 30px 70px rgba(0, 0, 0, 0.95));
}
.lightbox__caption { text-align: center; }
.lightbox__caption h2 {
  font-size: var(--step-2);
  font-weight: 500;
  margin: 0 0 0.35rem;
}
.lightbox__caption p {
  margin: 0;
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.lightbox__count {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.16em;
  color: var(--paper-faint);
}
.lb-btn {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  padding: 0;
  background: rgba(245, 240, 232, 0.07);
  border: 1px solid var(--hairline);
  border-radius: 50%;
  color: var(--paper);
  cursor: pointer;
  transition: background 220ms var(--ease), transform 220ms var(--ease);
}
.lb-btn:hover { background: rgba(245, 240, 232, 0.18); }
.lb-btn svg { width: 18px; height: 18px; }
.lb-close { top: clamp(0.9rem, 3vh, 1.6rem); right: clamp(0.9rem, 3vw, 1.6rem); }
.lb-prev  { top: 50%; left: clamp(0.5rem, 2vw, 1.6rem); transform: translateY(-50%); }
.lb-next  { top: 50%; right: clamp(0.5rem, 2vw, 1.6rem); transform: translateY(-50%); }
.lb-prev:hover, .lb-next:hover { transform: translateY(-50%) scale(1.08); }

/* ------------------------------------------------------------- footer -- */
/* The closing section, not a strip of small print: it carries its own painting,
   so it needs enough height to actually be the section you are looking at. */
.footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  min-height: 68vh;
  min-height: 68svh;
  padding: clamp(4rem, 10vh, 7rem) var(--gutter) clamp(2rem, 5vh, 3rem);
  background: linear-gradient(to bottom, transparent, rgba(8, 7, 10, 0.9) 60%);
}
.footer__inner { width: 100%; max-width: 1180px; margin-inline: auto; }
/* An email address is a single unbreakable token — at display sizes it is wide
   enough to push the page sideways, so it gets its own line and a smaller size
   on narrow screens, and may break mid-word as a last resort. */
.footer__cta {
  display: block;
  font-family: var(--display);
  font-size: var(--step-3);
  font-weight: 400;
  letter-spacing: -0.02em;
  text-decoration: none;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.footer__cta span {
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  transition: border-color 260ms var(--ease), color 260ms var(--ease);
}
.footer__cta:hover span { color: var(--accent); border-color: var(--accent); }

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin: 2.4rem 0 0;
  padding: 0;
  list-style: none;
}
.socials a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper-dim);
  transition: color 220ms var(--ease);
}
.socials a:hover { color: var(--accent); }
.socials svg { width: 17px; height: 17px; }

.footer__base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 2rem;
  margin-top: clamp(3rem, 8vh, 5rem);
  padding-top: 1.6rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-faint);
}
.footer__base p { margin: 0; }

/* ------------------------------------------------------------ reveal -- */
/* Scoped to .js (set by a one-line inline script in each <head>) so that with
   JavaScript off or broken the content is simply visible, never a blank page. */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 900ms var(--ease), transform 900ms var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* -------------------------------------------------------- responsive -- */
@media (max-width: 1080px) {
  .gallery-grid { columns: 2; }
  .cv-block { grid-template-columns: 1fr; gap: 1.2rem; }
  .cv-block > h2 { position: static; }
}

@media (max-width: 760px) {
  /* the third flex child (<nav>) goes fixed and zero-width, so space-between
     would leave the toggle stranded mid-bar — auto margin pins it right */
  .nav__toggle { display: grid; place-items: center; margin-left: auto; }
  .nav__mark { font-size: var(--step--1); letter-spacing: 0.12em; }
  .nav__links {
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    gap: 1.6rem;
    padding: var(--gutter);
    background: rgba(9, 8, 11, 0.97);
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 320ms var(--ease), visibility 320ms;
  }
  .nav[data-open="true"] .nav__links { opacity: 1; visibility: visible; }
  .nav__links a { font-size: var(--step-1); letter-spacing: 0.1em; }
  .nav__mark, .nav__toggle { position: relative; z-index: 1; }

  .research__row { grid-template-columns: 1fr; gap: 0.5rem; padding: 1.35rem 0; }
  .research__year { font-size: var(--step-0); }
  .footer__cta { font-size: var(--step-2); }
  .footer__cta span { display: block; margin-top: 0.2em; }
  .footer__base { flex-direction: column; align-items: flex-start; }
  .lb-prev { left: 0.4rem; }
  .lb-next { right: 0.4rem; }
}

@media (max-width: 520px) {
  .gallery-grid { columns: 1; }
  .socials { gap: 1.1rem 1.6rem; }
}

/* ------------------------------------------ motion & display prefs -- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .bg-layer { transition: none; }
  .bg-layer img { --bg-shift: 0% !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* Safari/Firefox without backdrop-filter: fall back to a solid-enough scrim */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel, .courses { background: rgba(10, 9, 12, 0.86); }
  .course { background: rgba(10, 9, 12, 0.5); }
  .nav.is-stuck { background: rgba(10, 9, 12, 0.95); }
}

/* Cmd-P on the résumé should give a résumé, not a screenshot of a website. */
@media print {
  @page { margin: 14mm 14mm 12mm; }

  .bg-stage, .nav, .scroll-cue, .footer, .btn, .brush,
  .eyebrow::after, .skip-link { display: none !important; }

  html, body {
    background: #fff;
    color: #111;
    font-size: 10pt;
    line-height: 1.4;
  }

  .section {
    display: block;
    min-height: 0;
    padding: 0;
    margin: 0 0 5mm;
  }
  .section--hero { margin-bottom: 4mm; }
  .panel, .panel--bare {
    background: none; border: 0; box-shadow: none; padding: 0;
    -webkit-backdrop-filter: none; backdrop-filter: none;
    max-width: none;
  }

  /* masthead: name, role, contacts — compact, no display-scale type */
  .hero__kicker { font-size: 7.5pt; letter-spacing: 0.2em; color: #666; margin: 0 0 1mm; }
  .hero__title {
    font-size: 22pt; font-weight: 600; line-height: 1.05;
    letter-spacing: -0.01em; text-shadow: none;
  }
  /* the surname is a block element on screen; inline it, and put back the
     space that the block display was providing */
  .hero__title em { display: inline; font-style: normal; color: inherit; font-weight: 600; }
  .hero__title em::before { content: ' '; }
  .cv-head { display: block; margin-top: 2mm !important; }
  .lede { font-size: 10.5pt; font-weight: 400; margin: 0 0 1.5mm; max-width: none; }
  .cv-head__meta { font-size: 8.5pt; gap: 0 4mm; }
  .cv-head__meta a { border: 0; }

  /* Light-on-dark tokens must not survive onto white paper. These selectors
     are written to outbid the on-screen ones (e.g. .prose p:first-of-type). */
  .lede,
  .prose p, .prose p:first-of-type, .prose strong, .prose em,
  .cv-item h3, .pub h3, .quote blockquote { color: #111; }
  .eyebrow, .hero__kicker, .cv-item__when, .cv-item__note,
  .research__meta, .quote figcaption, .art__medium { color: #555; }
  .cv-item__where, .cv-item li, .pub p, .chips li,
  .cv-head__meta, .research__title { color: #333; }
  .research__year { color: #111; }

  /* body */
  .cv { display: block; }
  .cv-block {
    display: block;
    margin: 0 0 4mm;
    border-top: 0.4pt solid #bbb;
    padding-top: 2mm;
  }
  .cv-block > h2 {
    position: static;
    font-size: 10.5pt; font-weight: 600; color: #111;
    letter-spacing: 0.06em; text-transform: uppercase;
    margin: 0 0 2mm;
  }
  .cv-block__body { display: block; }
  .cv-item, .pub { margin: 0 0 3mm; }
  .cv-item h3, .pub h3 { font-size: 10pt; font-weight: 600; }
  .cv-item__when { font-size: 8.5pt; color: #555; }
  .cv-item__where { font-size: 9pt; color: #333; }
  .cv-item ul { gap: 0.6mm; margin-top: 1mm; }
  .cv-item li, .pub p, .cv-item__note, .prose p { font-size: 9pt; }
  .cv-item li::before { background: #666; top: 0.62em; }
  .prose p { margin-bottom: 1.8mm; }
  .chips { gap: 1mm; margin-top: 1.5mm; }
  .chips li { font-size: 8pt; padding: 0.3mm 1.6mm; border-color: #bbb; color: #333; }

  /* keep records whole across page breaks */
  .cv-item, .pub, .cv-block > h2 { break-inside: avoid; page-break-inside: avoid; }
  .cv-block > h2 { break-after: avoid; page-break-after: avoid; }

  a { text-decoration: none; color: #111; }
  .ilink { color: #111; border-bottom: 0; font-style: italic; }
}
