/* Yijiang Wu — rebuilt from the Cargo site.
   Layout: one centred column (62.5vw on desktop, full width on phones),
   nav/back link top-right, image-led galleries below a coloured title. */
@font-face { font-family: "Overpass"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/overpass-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Overpass"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/overpass-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Karla"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/karla-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 700; font-style: italic; font-display: swap; src: url(fonts/instrument-sans-latin-700-italic.woff2) format("woff2"); }

:root {
  --bg: #ffffff;
  --text: rgba(0, 0, 0, 0.75);      /* Cargo body copy */
  --heading: #606060;               /* project descriptions */
  --muted: rgba(0, 0, 0, 0.35);     /* Cargo "small" */
  --ink: rgb(35, 33, 29);           /* back link */
  --overlay: rgba(255, 255, 255, 0.97);

  --f-body: "Overpass", "Interstate", "Helvetica Neue", Arial, sans-serif;   /* stands in for Interstate */
  --f-display: "Karla", "Helvetica Neue", Arial, sans-serif;                 /* same face as Cargo */
  --f-small: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;         /* stands in for Nitti Grotesk */

  --col: 62.5vw;
  --gutter: 16px;
  color-scheme: light;
}

html { font-size: clamp(11px, 1.386vw, 24px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 700 1.3rem/1.3 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:active { opacity: 0.7; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.page {
  width: var(--col);
  max-width: calc(100% - 2 * var(--gutter));
  margin-inline: auto;
  padding-block: 1.2rem 5rem;
}

/* Top bar: nav on home, "back" on inner pages */
.topbar { display: flex; justify-content: flex-end; gap: 1.1rem; padding-block: 0.6rem 3.5rem; }
.nav a { font: italic 700 1.4rem/1 var(--f-small); }
.nav a:hover, .back:hover { opacity: 0.6; }
.back { color: var(--ink); border-bottom: 1px solid currentColor; line-height: 1.1; }

/* Project header */
.proj-head { margin-bottom: 3.2rem; max-width: 46rem; }
.proj-title { margin: 0; font: 700 1.3rem/1.3 var(--f-body); }
.proj-desc { margin: 0.4rem 0 0; font: 400 2.4rem/1.3 var(--f-display); color: var(--heading); text-wrap: balance; }
.proj-desc.small { font: italic 700 1.4rem/1.2 var(--f-small); color: #585858; margin-top: 0.3rem; }

figure { margin: 0; }
.shot { cursor: zoom-in; background: rgba(0, 0, 0, 0.03); }
.shot img { width: 100%; }

/* Justify: rows of equal height, flex-grow by aspect ratio */
.justify { display: flex; flex-wrap: wrap; gap: var(--gap); container-type: inline-size; }
.justify figure { flex: calc(var(--ar) * 1000) 1 calc(var(--ar) * var(--rh) * 1cqw); }
.justify::after { content: ""; flex: 1e9 1 0; }

/* Columns: masonry via CSS columns */
.columns { column-count: var(--cols); column-gap: var(--gap); }
.columns figure { break-inside: avoid; margin-bottom: var(--gap); }

/* Freeform (Cargo "Montessori"): positions in % of gallery width */
.free { position: relative; aspect-ratio: 100 / var(--h); max-width: 100%; }
.free > * { position: absolute; left: var(--x); top: var(--y); width: var(--w); }
.free .shot, .free a { display: block; }
.home .free + .free { margin-top: 5rem; }
.free a img { transition: opacity 0.25s; }
.free a:hover img { opacity: 0.85; }

/* Inline rows (Introvert Guide) */
.rows { display: grid; gap: 3.5rem; }
.row { display: flex; flex-wrap: wrap; align-items: flex-start; row-gap: 3.5rem; }
.row figure { margin-left: var(--indent); width: var(--w); }

/* Slideshow */
.slideshow { position: relative; }
.slides { position: relative; height: min(78vh, calc(var(--col) * 0.8)); }
.slides figure { position: absolute; inset: 0; opacity: 0; transition: opacity 0.5s; display: grid; place-items: center; }
.slides figure.on { opacity: 1; }
.slides img { width: auto; max-height: 100%; max-width: 100%; object-fit: contain; cursor: pointer; }
.ss-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; font: italic 700 1.4rem/1 var(--f-small); color: var(--muted); }
.ss-bar button { font: inherit; color: var(--text); background: none; border: 0; padding: 0.4rem 0; cursor: pointer; }
.ss-bar button:hover { opacity: 0.6; }
.ss-count { font-variant-numeric: tabular-nums; }

/* Info */
.info { max-width: 38rem; margin-left: calc(100% / 12); font: italic 700 1.4rem/1.35 var(--f-small); color: #1a1c1b; display: grid; gap: 1.4rem; }
.info p { margin: 0; }
.info .links { display: flex; gap: 1.2rem; }
.info .links a { border-bottom: 1px solid currentColor; }
.info .meta { color: rgb(44, 44, 44); }

/* Lightbox */
.lb-open, .lb-open body { overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 60000; background: var(--overlay); display: grid; place-items: center; padding: 3.5rem var(--gutter); }
.lb img { max-width: 100%; max-height: calc(100vh - 7rem); width: auto; object-fit: contain; }
.lb button { position: absolute; background: none; border: 0; cursor: pointer; font: italic 700 1.4rem/1 var(--f-small); color: var(--text); padding: 1rem; }
.lb .close { top: 0.4rem; right: 0.6rem; }
.lb .prev { left: 0.2rem; top: 50%; transform: translateY(-50%); }
.lb .next { right: 0.2rem; top: 50%; transform: translateY(-50%); }
.lb .count { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); font: italic 700 1.4rem/1 var(--f-small); color: var(--muted); }

footer.foot { margin-top: 6rem; font: italic 700 1.1rem/1 var(--f-small); color: var(--muted); }

@media (max-width: 760px) {
  :root { --col: 100vw; }
  html { font-size: 11px; }
  .topbar { padding-bottom: 2.5rem; }
  .justify figure { flex-basis: calc(var(--ar) * var(--mrh) * 1cqw); }
  .columns { column-count: var(--mcols); }
  .free { aspect-ratio: auto; display: block; column-count: var(--mcols); column-gap: var(--gap); }
  .free > * { position: static; width: auto; break-inside: avoid; margin-bottom: var(--gap); }
  .home .free + .free { margin-top: var(--gap); }
  .row { display: grid; gap: 1.5rem; }
  .row figure { margin-left: 0; width: auto; }
  .rows { gap: 1.5rem; }
  .info { margin-left: 0; }
  .slides { height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Info page: Cargo "Pixelation" backdrop recreated on a canvas */
canvas.mosaic { position: fixed; inset: 0; z-index: 0; display: block; }
.info-page > :not(canvas) { position: relative; z-index: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Unified page system (matches the homepage) =====
   Spacing scale: 8 · 16 · 24 · 40 · 64 · 104 · 168 */
:root { --g-gap: clamp(8px, 0.85vw, 14px); }
.page.project, .page.info-page { width: var(--field); max-width: calc(100% - 32px); padding-block: 136px 64px; }

/* project header: meta row, then title (left) and statement (right) */
.proj-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: 64px; row-gap: 24px; align-items: start; margin: 0 0 64px; }
.proj-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 0; font: 400 var(--t-meta)/1 var(--f-sans);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--h-soft); font-variant-numeric: tabular-nums; }
.proj-meta { flex-wrap: wrap; row-gap: 8px; }
.proj-meta .m { white-space: nowrap; }
.proj-meta .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent, var(--h-nav)); flex: none; }
.proj-meta .sep { width: 24px; height: 1px; background: currentColor; opacity: 0.4; }
.proj-title { margin: 0; font: 400 var(--t-title)/1.04 var(--f-serif); color: var(--h-ink); letter-spacing: -0.015em; text-wrap: balance; }
.proj-desc, .proj-desc.small { margin: 0; max-width: 30em; font: 400 var(--t-text)/1.5 var(--f-sans); color: var(--h-soft); text-wrap: pretty; padding-top: 0.55em; }
.proj-head:not(:has(.proj-desc)) .proj-title { grid-column: 1 / -1; }

/* galleries share one gap */
.justify, .columns { --gap: var(--g-gap) !important; }
.columns figure { margin-bottom: var(--g-gap); }
.ss-bar, .lb button, .lb .count { font: 400 17px/1 var(--f-serif); }
.ss-bar { color: var(--h-soft); margin-top: 16px; font-variant-numeric: tabular-nums; }
.ss-bar button { color: var(--h-ink); }
.slides { background: transparent; height: min(70vh, calc(var(--field) * 0.56)); }
.justify figure { flex-basis: calc(var(--ar) * max(var(--rh), 18) * 1cqw); }

/* previous / next */
.proj-next { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 104px; padding-top: 24px; border-top: 1px solid rgba(0, 0, 0, 0.12); }
.proj-next a { font: 400 clamp(22px, 2vw, 30px)/1.2 var(--f-serif); color: var(--h-ink); transition: color 0.3s; }
.proj-next a:last-child { text-align: right; }
.proj-next a:hover { color: var(--h-nav); }
.proj-next small { display: block; margin-bottom: 10px; font: 400 var(--t-meta)/1 var(--f-sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--h-soft); }
footer.foot { margin-top: 64px; font: 400 var(--t-meta)/1 var(--f-sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--h-soft); }
.h-overlay .page.project { padding-top: 96px; }
.h-overlay .h-back { position: fixed; }

/* Info: pink panel (same as the homepage panels) over the mosaic */
.page.info-page { padding-top: 20vh; }
.info-card { position: relative; z-index: 1; max-width: 620px; padding: 32px 32px 36px; background: var(--h-info-bg); color: var(--h-info-fg);
  font: 400 19px/1.5 var(--f-sans); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.info-card .lead { margin: 0 0 14px; font: 400 clamp(24px, 2vw, 30px)/1.3 var(--f-serif); text-wrap: balance; }
.info-card .bio { margin: 0 0 32px; max-width: 32em; }
.info-card dl, .h-panel dl { margin: 0; display: grid; grid-template-columns: 120px 1fr; column-gap: 24px; row-gap: 18px; }
.info-card dt, .h-panel dt { font: 400 12px/1.6 var(--f-sans); letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.85; padding-top: 0.25em; }
.info-card dd, .h-panel dd { margin: 0; }
.info-card a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.info-card a:hover { text-decoration-thickness: 2px; }
.info-page footer.foot { position: relative; z-index: 1; color: var(--h-ink); }

@media (max-width: 768px) {
  .page.project, .page.info-page { padding-top: 92px; }
  .proj-head { grid-template-columns: 1fr; row-gap: 16px; margin-bottom: 40px; }
  .proj-meta .sep { width: 14px; }
  .proj-next { margin-top: 64px; }
  .proj-next a { font-size: 20px; }
  .info-card { padding: 24px; font-size: 17px; }
  .slides { height: calc((100vw - 32px) * 0.75); }
  .justify figure { flex-basis: calc(var(--ar) * var(--mrh) * 1cqw); }
  .info-card dl, .h-panel dl { grid-template-columns: 1fr; row-gap: 4px; }
  .info-card dd, .h-panel dd { margin-bottom: 14px; }
}
/* navigation keeps the same tags over the mosaic (no page-specific overrides) */

/* ===== Film strip (Prefab Nocturne): one height for every frame ===== */
.strip { position: relative; --sh: clamp(260px, min(66vh, 44vw), 760px); }
.strip-track { display: flex; gap: var(--g-gap); overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; padding-right: 12vw; }
.strip-track::-webkit-scrollbar { display: none; }
.strip-track:focus-visible { outline: 2px solid var(--h-nav); outline-offset: 6px; }
.strip-track figure { flex: none; height: var(--sh); aspect-ratio: var(--ar); scroll-snap-align: start; background: rgba(0, 0, 0, 0.04); }
.strip-track img { height: 100%; width: 100%; object-fit: cover; }
.strip-btn { position: absolute; top: calc(var(--sh) / 2); transform: translateY(-50%); width: 56px; height: 56px; padding: 12px;
  border: 0; background: none; color: #fff; cursor: pointer; z-index: 2; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
  transition: transform 0.25s ease, opacity 0.25s ease; opacity: 0.9; }
.strip-btn svg { display: block; width: 100%; height: auto; }
.strip-btn.next { right: 6px; }
.strip-btn.prev { left: 6px; }
.strip-btn.next:hover { transform: translate(4px, -50%); opacity: 1; }
.strip-btn.prev:hover { transform: translate(-4px, -50%); opacity: 1; }
.strip-btn:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.strip-bar { display: flex; justify-content: flex-start; align-items: baseline; margin-top: 16px;
  font: 400 var(--t-meta)/1 var(--f-sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--h-soft); font-variant-numeric: tabular-nums; }
.strip-count { font: 400 17px/1 var(--f-serif); letter-spacing: 0; text-transform: none; color: var(--h-ink); }
@media (max-width: 768px) {
  .strip { --sh: min(62vh, 72vw); margin-right: -16px; }
  .strip-track { padding-right: 16px; }
  .strip-btn { width: 48px; height: 48px; }
  .strip-btn.next { right: 18px; }
}
