/* v2 — refined: quiet, editorial, work-first. Paper-white ground, serif display, no ornament. */
:root {
  --lb-bg: rgba(247, 245, 241, .985); --lb-fg: #1d1c1a; --lb-muted: #8b867d; --lb-line: #e2ddd4;
  --bg: #f7f5f1;          /* drawing-paper white */
  --surface: #efebe4;     /* placeholder / empty tiles */
  --ink: #1d1c1a;
  --text: #3a3833;
  --muted: #8b867d;
  --line: #e2ddd4;
  --pad: clamp(20px, 5vw, 72px);
  --measure: 640px;
  --wide: 1240px;
  --serif: "Cormorant Garamond", "Cormorant", "Songti SC", "Noto Serif SC", "STSong", "SimSun", Georgia, serif;
  --sans: Jost, "Futura", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.7 var(--sans); letter-spacing: .01em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-synthesis: none;   /* never fake-italicise or fake-bold Chinese glyphs */
}
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: #e9e1d3; }
.visually-hidden, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--bg); padding: 6px 10px; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* Small caps label style, used for nav, meta and captions */
.site-nav a, .tile-sub, .tile-lock, .project-sub, .block-text h3, figcaption, .project-nav, .next-project span,
.site-footer, .carousel-title, .lb-count, .lock-note, .about h3 {
  font-family: var(--sans); font-size: 12px; line-height: 1.6; letter-spacing: .16em; text-transform: uppercase;
}

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 36px var(--pad); max-width: calc(var(--wide) + 2 * var(--pad)); margin: 0 auto;
}
.branding { display: flex; flex-direction: column; gap: 2px; }
.site-title { font: 500 28px/1.1 var(--serif); color: var(--ink); letter-spacing: .01em; }
.site-tagline { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.site-nav { display: flex; gap: 36px; }
.site-nav a { color: var(--muted); position: relative; padding: 4px 0; transition: color .3s var(--ease); }
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease);
}
.site-nav a:hover, .site-nav a.is-active { color: var(--ink); }
.site-nav a.is-active::after, .site-nav a:hover::after { transform: scaleX(1); }
.menu-toggle, .mobile-menu { display: none; }

/* ---------- Main ---------- */
.site-main { max-width: calc(var(--wide) + 2 * var(--pad)); margin: 0 auto; padding: 0 var(--pad); }

/* ---------- Home: work index ---------- */
.page-home .site-main { padding-top: clamp(24px, 6vw, 80px); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(48px, 6vw, 88px) clamp(24px, 3vw, 44px); }
.tile { display: block; color: var(--ink); }
.tile-media {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  background: var(--tile-bg, var(--surface));
}
.tile.no-image .tile-media { background: color-mix(in srgb, var(--tile-bg, var(--surface)) 55%, var(--bg)); }
.tile .pic, .tile .pic img, .tile-video { width: 100%; height: 100%; object-fit: cover; }
.tile .pic img { object-position: 50% 22%; transition: transform 1.2s var(--ease); }
.tile:hover .pic img { transform: scale(1.025); }
.tile-video, .tile-yt { position: absolute; inset: 0; opacity: 0; transition: opacity 1s var(--ease); pointer-events: none; }
.tile.video-ready .tile-video, .tile.video-ready .tile-yt { opacity: 1; }
.tile-yt { container-type: size; }
.tile-yt iframe {
  position: absolute; top: 50%; left: 50%; border: 0; max-width: none;
  width: max(125cqw, 222.2cqh); height: max(125cqh, 70.3cqw);   /* oversized: crops YouTube branding at the edges */ transform: translate(-50%, -50%);
}
.tile-text { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding-top: 18px; }
.tile-title { margin: 0; font: 400 clamp(24px, 2.3vw, 32px)/1.15 var(--serif); letter-spacing: .005em; }
.tile-title { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .5s var(--ease); }
.tile:hover .tile-title { background-size: 100% 1px; }
.tile-sub { margin: 0; color: var(--muted); }
.tile-lock { display: none; }
.tile.is-private .tile-media::after {   /* quiet label on a private tile */
  content: "Private · Password required"; position: absolute; inset: 0; display: grid; place-items: center;
  font: 12px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: rgba(29, 28, 26, .5);
}
.tile.is-private:not(.no-image) .tile-media::after { color: rgba(255, 255, 255, .94); text-shadow: 0 1px 14px rgba(0, 0, 0, .28); }
/* Blurred teaser: a 32px thumbnail, blurred and oversized so the edges stay soft */
.tile-blur {
  position: absolute; inset: -12%; width: 124%; height: 124%; max-width: none; object-fit: cover;
  filter: blur(22px) saturate(1.15); transition: transform 1.2s var(--ease);
}
.tile:hover .tile-blur { transform: scale(1.03); }
/* Slow cross-fade through a few images of the project */
.tile .pic.tile-slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s var(--ease); }
.tile .pic.tile-slide.is-on { opacity: 1; }

/* Contents bar on long project pages (built by site.js from the big headings) */
.page-toc {
  position: sticky; top: var(--sticky-top, 0px); z-index: 15;
  margin: calc(-1 * clamp(16px, 3vw, 40px)) calc(-1 * var(--pad)) clamp(32px, 5vw, 64px); padding: 0 var(--pad);
  background: rgba(247, 245, 241, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.page-toc-inner { position: relative; display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none; }
.page-toc-inner::-webkit-scrollbar { display: none; }
.page-toc a {
  flex: none; padding: 14px 0 12px; margin-bottom: -1px; border-bottom: 1px solid transparent; white-space: nowrap;
  font: 12px/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  transition: color .3s, border-color .3s;
}
.page-toc a:hover, .page-toc a.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.blocks .block-text h1 { scroll-margin-top: calc(var(--sticky-top, 0px) + 80px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* ---------- Project pages ---------- */
.project-head { max-width: var(--wide); margin: clamp(24px, 6vw, 88px) 0 clamp(40px, 6vw, 80px); }
.project-title { margin: 0; font: 400 clamp(44px, 6.4vw, 92px)/1 var(--serif); color: var(--ink); letter-spacing: -.01em; }
.project-sub { margin: 18px 0 0; color: var(--muted); }

.blocks { display: flow-root; }
.block { margin: 0 0 clamp(28px, 3.4vw, 48px); }
.block-text { max-width: 920px; }
.block-text p, .block-text blockquote { max-width: var(--measure); }
.block-text > :first-child { margin-top: 0; }
.block-text > :last-child { margin-bottom: 0; }
.block-text h1 {
  font: 400 clamp(30px, 3.4vw, 46px)/1.15 var(--serif); color: var(--ink); margin: 0 0 14px; letter-spacing: 0;
}
.block-text h1 strong { font-weight: 500; }
.block-text h2 { font: 400 clamp(24px, 2.4vw, 32px)/1.25 var(--serif); color: var(--ink); margin: 40px 0 10px; }
.block-text h3 { font-weight: 500; color: var(--muted); margin: 28px 0 0; }
.block-text p { margin: 0 0 1em; font-size: 17px; }
.block-text h1 + p { color: var(--muted); font-size: 14px; letter-spacing: .06em; }
.block-text blockquote {
  margin: 18px 0 0; padding: 0; border: 0;
  font: italic 400 clamp(20px, 1.8vw, 24px)/1.45 var(--serif); color: var(--text);
}
.block-text blockquote p { margin: 0; font-size: inherit; }
.block-text a { border-bottom: 1px solid var(--line); transition: border-color .3s; }
.block-text a:hover { border-color: currentColor; }

.block-image .pic img, .block-row .pic img { width: 100%; height: auto; background: var(--surface); }
figcaption { margin-top: 12px; color: var(--muted); letter-spacing: .12em; }
.block-row { display: grid; gap: clamp(16px, 2.4vw, 32px); align-items: start; }
.block-row.cols-2 { grid-template-columns: 1fr 1fr; }
.block-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.block-row.cols-4 { grid-template-columns: repeat(4, 1fr); }
.block-row figure { margin: 0; }
.blocks a.lb { display: block; cursor: zoom-in; }

/* Section break: a short rule with breathing room, not a full-width line */
.block-divider { border: 0; height: 1px; background: var(--line); margin: clamp(56px, 8vw, 120px) 0; }
.blocks > .block-divider:first-child { display: none; }
.block-spacer { height: clamp(24px, 4vw, 56px); margin: 0; }

.video { position: relative; aspect-ratio: 16 / 9; background: #151413; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-caption { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
/* Short films: title + role read like a credit line above each film */
.page-new-page .block-text h1 { font-size: clamp(26px, 2.6vw, 36px); }
.page-new-page .block-video + .block-text { margin-top: clamp(56px, 7vw, 104px); }

.block-pagelink { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 20px; color: var(--ink); }
.pagelink-media { grid-column: 1 / -1; display: block; aspect-ratio: 21 / 6; overflow: hidden; background: var(--surface); }
.pagelink-media .pic, .pagelink-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.block-pagelink:hover .pagelink-media img { transform: scale(1.02); }
.pagelink-title { font: 400 28px/1.2 var(--serif); }
.pagelink-title::after { content: " →"; font-family: var(--sans); font-size: .7em; }

.block-carousel { margin-top: clamp(40px, 6vw, 88px); }
.carousel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.carousel-title { color: var(--ink); border-bottom: 1px solid var(--line); }
.carousel-arrows { display: flex; gap: 6px; }
.carousel-arrows button {
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--text); transition: border-color .3s, color .3s;
}
.carousel-arrows button:hover { border-color: var(--ink); color: var(--ink); }
.carousel-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 40px) / 3); column-gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-item { scroll-snap-align: start; aspect-ratio: 4 / 5; overflow: hidden; background: #fff; }
.carousel-item .pic, .carousel-item img { width: 100%; height: 100%; object-fit: cover; }

/* Gallery: masonry on white cards so sketches on white paper sit naturally */
.gallery { --cols: 3; --gap: clamp(14px, 2vw, 28px); columns: var(--cols); column-gap: var(--gap); }
.gallery.is-masonry { display: flex; gap: var(--gap); columns: auto; }
.gallery-col { flex: 1; min-width: 0; }
.gallery-item { margin: 0 0 var(--gap); break-inside: avoid; }
.gallery.is-masonry .gallery-item:last-child { margin-bottom: 0; }
.gallery-item a { display: block; cursor: zoom-in; background: #fff; overflow: hidden; }
.gallery-item img { width: 100%; height: auto; transition: transform 1s var(--ease), opacity .4s; }
.gallery-item a:hover img { transform: scale(1.02); }

/* Project footer navigation */
.next-project {
  display: block; margin: clamp(80px, 12vw, 180px) 0 0; padding-top: 32px; border-top: 1px solid var(--line);
  font: 400 clamp(36px, 5vw, 72px)/1.05 var(--serif); color: var(--ink);
}
.next-project span { display: block; color: var(--muted); margin-bottom: 14px; }
.next-project:hover { font-style: italic; }
.project-nav { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 48px 0 0; color: var(--muted); }
.project-nav a { transition: color .3s; }
.project-nav a:hover, .project-nav a.is-active { color: var(--ink); }

/* ---------- About ---------- */
.about {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px);
  padding-top: clamp(24px, 6vw, 88px); align-items: start;
}
.about-portrait { grid-column: 1; grid-row: 1 / span 2; }
.about-portrait img { width: 100%; height: auto; }
.about-right { grid-column: 2; grid-row: 1; }
.about-left { grid-column: 2; grid-row: 2; }
.about:not(:has(.about-portrait)) { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); }
.about:not(:has(.about-portrait)) .about-right { grid-column: 1; }
.about:not(:has(.about-portrait)) .about-left { grid-column: 2; grid-row: 1; padding-top: 10px; }
.about-right p { font: 400 clamp(22px, 2.1vw, 30px)/1.4 var(--serif); color: var(--ink); margin: 0 0 .8em; }
.about-right p a { border-bottom: 1px solid var(--line); }
.about h3 { color: var(--muted); font-weight: 400; margin: 0 0 16px; }
.about-left p { margin: 0 0 6px; font-size: 16px; }
.social { display: flex; gap: 14px; margin-top: 36px !important; }
.social a { display: block; width: 22px; height: 22px; color: var(--ink); opacity: .7; transition: opacity .3s; }
.social a:hover { opacity: 1; }
.social svg { width: 100%; height: 100%; }

/* ---------- Footer ---------- */
.site-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  max-width: calc(var(--wide) + 2 * var(--pad)); margin: clamp(96px, 12vw, 160px) auto 0; padding: 28px var(--pad) 40px;
  color: var(--muted);
}
.footer-links { display: flex; gap: 28px; }
.footer-links a:hover { color: var(--ink); }

/* ---------- Password page ---------- */
.lock { max-width: 440px; margin: clamp(40px, 10vw, 140px) auto; text-align: center; }
.lock-icon { width: 22px; height: 22px; margin: 0 auto 22px; color: var(--muted); }
.lock-title { font: 400 34px/1.2 var(--serif); color: var(--ink); margin: 0 0 32px; }
.lock-form { display: flex; border-bottom: 1px solid var(--ink); }
.lock-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 12px 2px; border: 0; background: transparent; color: var(--ink);
}
.lock-form input:focus { outline: none; }
.lock-form button {
  border: 0; background: none; cursor: pointer; padding: 12px 2px 12px 16px;
  font: 12px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--ink);
}
.lock-error { color: #9b3b2a; font-size: 14px; margin: 16px 0 0; }
.lock-note { color: var(--muted); margin-top: 40px; letter-spacing: .1em; }
.lock-note a { text-transform: none; letter-spacing: .02em; border-bottom: 1px solid var(--line); }

/* ---------- Gentle image reveal (only once, only if motion is welcome) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .blocks .pic img, .js .gallery .pic img { opacity: 0; transition: opacity .8s var(--ease), transform 1s var(--ease); }
  .js .blocks .pic img.is-loaded, .js .gallery .pic img.is-loaded { opacity: 1; }
}

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .tiles { gap: 48px 20px; }
  .about, .about:not(:has(.about-portrait)) { grid-template-columns: 1fr; }
  .about > * { grid-column: 1 !important; grid-row: auto !important; }
}

/* ---------- Phone ---------- */
@media (max-width: 640px) {
  .site-header {
    position: sticky; top: 0; z-index: 20; padding: 16px var(--pad);
    background: rgba(247, 245, 241, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .site-title { font-size: 24px; }
  .site-tagline { font-size: 10px; }
  .site-nav { display: none; }
  .menu-toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 7px;
    width: 44px; height: 44px; margin-right: -10px; padding: 0 10px; background: none; border: 0; cursor: pointer;
  }
  .menu-toggle span { display: block; height: 1px; background: var(--ink); transition: transform .3s var(--ease); }
  .menu-open .menu-toggle span:first-child { transform: translateY(4px) rotate(45deg); }
  .menu-open .menu-toggle span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .mobile-menu {
    display: block; position: fixed; inset: 0; z-index: 19; background: var(--bg);
    padding: 120px var(--pad) 40px; overflow-y: auto;
  }
  .mobile-menu[hidden] { display: none; }
  .mobile-menu nav { display: flex; flex-direction: column; gap: 14px; }
  .mobile-menu a { font: 400 34px/1.15 var(--serif); color: var(--ink); }
  .mobile-menu a.sub { font-size: 22px; color: var(--muted); padding-left: 2px; }
  .mobile-menu a.sub:last-of-type { margin-bottom: 14px; }
  body.menu-open { overflow: hidden; }

  .page-home .site-main { padding-top: 16px; }
  .tiles { grid-template-columns: 1fr; gap: 44px; }
  .tile-text { padding-top: 14px; }
  .project-head { margin: 28px 0 40px; }
  .block-text p { font-size: 16px; }
  .block-row { grid-template-columns: 1fr !important; }
  .carousel-track { grid-auto-columns: 72%; column-gap: 12px; }
  .gallery { --cols: 2; --gap: 10px; }
  .next-project { margin-top: 80px; }
  .site-footer { flex-direction: column; margin-top: 80px; }
}
