:root {
  --paper: #f4f2ee;
  --ink: #171615;
  --soft: #6e6961;
  --line: rgba(23, 22, 21, .14);
  --accent: #2c3fd6;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Geist", "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(16px, 4vw, 56px);
  --max: 1360px;
  /* side padding that grows on very wide screens so content stays within --max */
  --gutter: max(var(--pad), calc((100% - var(--max)) / 2));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }
h2, h3 { font-weight: 400; margin: 0; }
::selection { background: var(--accent); color: var(--paper); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.ph:focus-visible { outline-offset: -2px; }

/* ---------- HEADER ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.mark { display: inline-flex; align-items: baseline; gap: 12px; line-height: 1; justify-self: start; }
.mark-name { font-family: var(--serif); font-size: 1.6rem; letter-spacing: -.01em; display: inline-grid; }
/* two spellings stacked on top of each other; hover fades to the Vietnamese one */
.mark-name .n { grid-area: 1 / 1; white-space: nowrap; transition: opacity .5s ease; }
.mark-name .n2 { opacity: 0; }
.mark:hover .n1 { opacity: 0; }
.mark:hover .n2 { opacity: 1; }
.mark-name em { font-style: normal; }
.mark-name em::after {
  content: "."; color: var(--accent); font-style: normal;
  display: inline-block; transition: transform .4s cubic-bezier(.2,.7,.2,1);
}
.mark:hover .mark-name em::after { transform: translateY(-3px); }
.mark-role {
  position: relative; display: inline-block;
  font-family: var(--serif); font-style: italic; font-size: .95rem; color: var(--soft);
  width: 7.2em; height: 1em;
}
.mark-role span {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  opacity: 0; transform: translateY(6px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1);
}
.mark-role span.on { opacity: 1; transform: none; }
.menu { display: flex; gap: 28px; }
.menu a, .menu-contact { position: relative; color: var(--soft); transition: color .2s; }
.menu a:hover, .menu a.on, .menu-contact:hover { color: var(--ink); }
.menu a.on::before {
  content: ""; position: absolute; left: -11px; top: 50%;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  transform: translateY(-50%);
}
.menu-contact { justify-self: end; color: var(--ink); }

main { padding: 0 var(--gutter); }

/* ---------- INTRO ---------- */
.intro {
  text-align: center;
  padding: clamp(72px, 14vh, 150px) 0 clamp(48px, 8vh, 90px);
}
.intro-line {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.25;
  max-width: 24ch;
  margin: 0 auto;
}
/* each word floats up when the page opens */
.intro-line .w {
  display: inline-block;
  opacity: 0; transform: translateY(.5em);
  animation: wordUp 1s cubic-bezier(.2,.7,.2,1) forwards;
  animation-delay: calc(var(--i) * 70ms + 150ms);
}
@keyframes wordUp { to { opacity: 1; transform: none; } }
/* the starred words: italic, and they lead to the two chapters */
.intro-line .k {
  font-style: italic;
  background: linear-gradient(var(--accent), var(--accent)) left 100% / 0 1px no-repeat;
  transition: background-size .5s ease, color .3s;
}
.intro-line .k:hover { color: var(--accent); background-size: 100% 1px; }
.intro-sub {
  margin: 18px 0 0; color: var(--soft); font-size: .85rem;
  opacity: 0; animation: wordUp 1s ease 1.1s forwards;
}
.intro + .chapter { padding-top: 0; }
.intro + .chapter .chapter-head { margin-bottom: 36px; }
.num {
  font-size: .72rem; color: var(--soft); margin-right: 10px;
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
}

/* ---------- CHAPTER HEADINGS ---------- */
.chapter { padding-top: 120px; }
/* room between the last section and the footer line */
.chapter:last-child { padding-bottom: clamp(110px, 18vh, 200px); }
.chapter-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 64px;
}
.chapter-head .num { margin-right: 0; }
.chapter-head h2 { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; }
.chapter-head p { margin: 0 0 0 auto; color: var(--soft); }
h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--soft); }

/* ---------- PHOTO PLACEHOLDER ---------- */
.ph {
  position: relative; margin: 0; overflow: hidden;
  background: #e4e0d9;
  cursor: zoom-in;
}
.ph img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s cubic-bezier(.2,.7,.2,1), opacity .6s; }
.ph.missing img { display: none; }
.ph.missing {
  background:
    radial-gradient(ellipse 30% 22% at 50% 38%, rgba(255,255,255,.22), transparent 70%),
    linear-gradient(170deg, hsl(var(--h, 32) 9% calc(var(--l, 82) * 1%)), hsl(var(--h, 32) 7% calc((var(--l, 82) - 14) * 1%)));
}
.ph.missing::after {
  content: attr(data-label);
  position: absolute; left: 10px; bottom: 8px;
  font-size: .68rem; color: rgba(0,0,0,.42); letter-spacing: .03em;
}

/* ---------- MODELING: GRID ---------- */
.airy {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 44px 20px;
}
.work { margin: 0; }
.work .ph { aspect-ratio: 3/4; }
.work:hover .ph img { transform: scale(1.03); }
.work figcaption {
  display: flex; justify-content: space-between; gap: 12px;
  padding-top: 10px; font-size: .8rem;
}
.work figcaption b { font-weight: 400; }
.work figcaption span { color: var(--soft); text-align: right; }

/* profile: digitals + measurements */
.profile {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(32px, 6vw, 96px);
  margin-top: 160px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.digi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px;
}
.digi { margin: 0; }
.digi .ph { aspect-ratio: 3/4; }
.digi figcaption { font-size: .78rem; color: var(--soft); padding-top: 6px; }

.measure-head { display: flex; justify-content: space-between; align-items: center; }
.units, .filters { display: inline-flex; gap: 4px; }
.units button, .filters button {
  font-size: .78rem; padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--soft);
  transition: all .2s;
}
.units button.on, .filters button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.units button:hover:not(.on), .filters button:hover:not(.on) { color: var(--ink); border-color: var(--ink); }

.stat-table { margin: 16px 0 28px; }
.stat-table div {
  display: flex; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.stat-table dt { color: var(--soft); }
.stat-table dd { margin: 0; font-family: var(--serif); font-size: 1.3rem; line-height: 1; }

.link-btn { border-bottom: 1px solid var(--ink); padding-bottom: 2px; transition: color .2s, border-color .2s; }
.link-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- PHOTOGRAPHY PAGE: one quiet gallery ---------- */
.photo-head { padding: clamp(64px, 12vh, 140px) 0 clamp(40px, 7vh, 80px); text-align: center; }
.photo-head h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; margin: 0; }
.photo-head p { margin: 12px 0 0; color: var(--soft); font-size: .85rem; }
/* every photo keeps its own shape; how many columns depends on how many photos there are */
/* rows fill left to right, so photos stay in file-name order (a series stays together) */
.gallery {
  --gap: clamp(16px, 2.6vw, 40px);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); align-items: start;
  padding-bottom: clamp(80px, 12vh, 160px);
}
.gallery .shot { margin: 0; }
.gallery .ph { aspect-ratio: var(--ratio, 4/5); }
.gallery figcaption { padding-top: 8px; font-size: .78rem; color: var(--soft); }
.gallery.some { grid-template-columns: repeat(2, 1fr); max-width: 1080px; margin-inline: auto; }
.gallery.some .shot.wide { grid-column: 1 / -1; }
/* a few favourites: one at a time, centred, never taller than the screen */
.gallery.few { grid-template-columns: 1fr; --gap: clamp(48px, 10vh, 120px); }
.gallery.few .shot { width: min(100%, 760px, calc(82svh * var(--ratio, 4/5))); margin-inline: auto; }
.gallery .ph:hover img { opacity: .92; }
.gallery .ph.missing::after { display: none; }

/* ---------- CREDITS ---------- */
.chapter-head .filters { margin-left: auto; }
.credit {
  display: grid;
  grid-template-columns: 80px 2fr 1.4fr 1.2fr 90px;
  gap: 16px;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  transition: padding .3s ease, color .2s;
}
.credit.hidden { display: none; }
.credit .y { color: var(--soft); font-variant-numeric: tabular-nums; }
.credit .y.dim { visibility: hidden; }
.credit .t { font-family: var(--serif); font-size: 1.45rem; line-height: 1.1; }
.credit .c, .credit .b { color: var(--soft); }
.credit .r {
  justify-self: end; font-size: .72rem; padding: 2px 8px; border-radius: 99px;
  border: 1px solid var(--line);
}
.credit[data-role="photographer"] .r { border-color: var(--accent); color: var(--accent); }
@media (hover: hover) {
  .credit:hover { padding-left: 12px; }
  .credit:hover .t { color: var(--accent); }
}

.peek {
  position: fixed; left: 0; top: 0; z-index: 30;
  width: 200px; aspect-ratio: 4/5;
  pointer-events: none; opacity: 0;
  transition: opacity .25s ease;
}
.peek.show { opacity: 1; }
.peek .ph { width: 100%; height: 100%; }

/* ---------- ABOUT (bio sits on the grainy photo, facts below it) ---------- */
.about-facts { max-width: 560px; margin: 0 auto; padding-top: clamp(64px, 10vh, 120px); }
.bio { font-size: 1.05rem; line-height: 1.6; max-width: 44ch; margin: 0 0 28px; }
.facts div { display: grid; grid-template-columns: 120px 1fr; padding: 9px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--soft); }
.facts dd { margin: 0; }

/* ---------- CONTACT ---------- */
.contact { text-align: center; padding: 140px 0 110px; }
.contact-kicker { color: var(--soft); margin: 0 0 10px; }
.contact-mail {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2.6rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 2px no-repeat;
  transition: background-size .5s ease, color .3s;
}
.contact-mail:hover { color: var(--accent); background-size: 100% 2px; }
.contact-links { display: flex; justify-content: center; gap: 28px; margin-top: 32px; }
.contact-links a { color: var(--soft); transition: color .2s; }
.contact-links a:hover { color: var(--ink); }

/* ---------- FOOTER ---------- */
.foot {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 18px var(--gutter) 26px;
  border-top: 1px solid var(--line);
  color: var(--soft); font-size: .82rem;
}

/* ---------- LIGHTBOX ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: var(--paper);
  display: grid; grid-template-rows: auto 1fr;
}
.lightbox[hidden] { display: none; }
.lb-bar {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 16px var(--pad); font-size: .85rem; position: relative; z-index: 2;
}
.lb-bar #lbCount { color: var(--soft); }
.lb-stage { display: grid; place-items: center; padding: 0 var(--pad) 32px; min-height: 0; }
.lb-stage .ph { height: 100%; max-width: 100%; cursor: default; aspect-ratio: var(--ratio, 4/5); max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px); }
.lb-stage .ph:not(.missing) { aspect-ratio: auto; background: none; }
.lb-stage .ph img { object-fit: contain; }
.lb-side { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 1; }
.lb-prev { left: 0; cursor: w-resize; }
.lb-next { right: 0; cursor: e-resize; }

/* ---------- REVEAL ---------- */
.rv { opacity: 0; transform: translateY(18px); transition: opacity .9s ease, transform .9s cubic-bezier(.2,.7,.2,1); }
.rv.in { opacity: 1; transform: none; }

.print-card { display: none; }

/* ---------- RESPONSIVE ---------- */
@media (pointer: coarse) {
  .units button, .filters button { padding: 8px 14px; }
}
@media (max-width: 960px) {
  .gallery.many { grid-template-columns: repeat(2, 1fr); }
  .profile { grid-template-columns: 1fr; }
  .credit { grid-template-columns: 56px 1fr auto; }
  .credit .c { grid-column: 2; }
  .credit .b { display: none; }
  .credit .r { grid-column: 3; grid-row: 1; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .top { grid-template-columns: 1fr auto; row-gap: 8px; }
  .menu { grid-column: 1 / -1; grid-row: 2; flex-wrap: wrap; gap: 4px 20px; font-size: .9rem; }
  .menu a.on::before { display: none; }
  .menu a.on { color: var(--accent); }
  .airy { grid-template-columns: repeat(2, 1fr); gap: 28px 10px; }
  .work figcaption { flex-direction: column; gap: 0; }
  .work figcaption span { text-align: left; }
  .digi-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery.many, .gallery.some { grid-template-columns: 1fr; }
  .chapter { padding-top: 88px; }
  .chapter-head { margin-bottom: 40px; }
  .chapter-head p { margin-left: 0; width: 100%; }
  .chapter-head .filters { margin-left: 0; width: 100%; }
  .credit .t { font-size: 1.2rem; }
  .facts div { grid-template-columns: 96px 1fr; }
  .contact { padding: 110px 0 80px; }
  .foot { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, .rv { transition: none !important; transform: none !important; opacity: 1; }
  .intro-line .w, .intro-sub { animation: none; opacity: 1; }
}

/* ---------- PRINT: comp card only ---------- */
@media print {
  @page { size: A4 landscape; margin: 0; }
  body { background: #fff; }
  body > *:not(.print-card) { display: none !important; }
  /* one landscape A4 page: big photo + name on the left, 4 photos + measurements on the right.
     Slightly under 210mm tall so rounding never spills onto a second page. */
  .print-card {
    display: grid !important; grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr);
    width: 297mm; height: 209mm; padding: 10mm; gap: 10mm; overflow: hidden;
  }
  .pc-front, .pc-back { min-height: 0; overflow: hidden; border: .3mm solid #ccc; padding: 6mm; display: flex; flex-direction: column; gap: 4mm; }
  /* photos shrink to fit the page instead of pushing it taller */
  .pc-front .ph { flex: 1; min-height: 0; }
  .pc-name { font-family: var(--serif); font-size: 26pt; line-height: 1; }
  .pc-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 3mm; }
  .pc-grid .ph { min-height: 0; }
  .pc-stats { display: flex; flex-wrap: wrap; gap: 1mm 5mm; font-size: 8.5pt; }
  .pc-stats b { font-weight: 500; }
  .pc-contact { font-size: 8pt; color: #777; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
