:root {
  --bg: #f3efec;
  --bg-2: #e8e3dd;
  --ink: #1d1b19;
  --ink-2: #5f5852;
  --ink-3: #8f8780;
  --line: rgba(29, 27, 25, 0.14);
  --accent: #b98f86;
  --dark: #1d1b19;
  --on-dark: #f3efec;

  --serif: 'Frank Ruhl Libre', 'Times New Roman', serif;
  --sans: 'Heebo', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ease: cubic-bezier(0.77, 0, 0.18, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(16px, 4vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.is-loading, body.is-locked { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
::selection { background: var(--ink); color: var(--bg); }

.eyebrow {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  font-weight: 400;
}
.en { direction: ltr; letter-spacing: 0.18em; text-transform: uppercase; font-size: 11px; }

/* Masked line reveals ------------------------------------------------------ */
.mask { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.mask > span { display: inline-block; transform: translateY(110%); transition: transform 1.2s var(--ease-out); transition-delay: var(--d, 0s); }
.view.is-in .hero .mask > span { transform: none; }

.fade { opacity: 0; transform: translateY(18px); transition: opacity 1s var(--ease-out), transform 1s var(--ease-out); transition-delay: var(--d, 0s); }
.view.is-in .fade { opacity: 1; transform: none; }

[data-reveal] { opacity: 0; transform: translateY(40px); transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out); transition-delay: var(--d, 0s); }
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal="img"] { opacity: 1; transform: none; clip-path: inset(100% 0 0 0); transition: clip-path 1.4s var(--ease); }
[data-reveal="img"] img { transform: scale(1.15); transition: transform 1.8s var(--ease-out); }
[data-reveal="img"].in { clip-path: inset(0 0 0 0); }
[data-reveal="img"].in img { transform: none; }

/* Loader ----------------------------------------------------------------- */
.loader {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--dark); color: var(--on-dark);
  display: grid; place-items: center;
}
.loader-name { font-family: var(--serif); font-size: clamp(48px, 9vw, 130px); line-height: 1; font-weight: 300; text-align: center; }
.loader-name .mask > span { transform: translateY(110%); animation: rise 1.1s var(--ease-out) forwards; }
.loader-name .mask:nth-child(2) > span { animation-delay: 0.12s; }
.loader-bar { position: absolute; bottom: 48px; inset-inline: var(--gutter); height: 1px; background: rgba(243, 239, 236, 0.15); }
.loader-bar span { display: block; height: 100%; width: 100%; background: var(--on-dark); transform: scaleX(0); transform-origin: right; transition: transform 0.4s var(--ease-out); }
.loader-count { position: absolute; bottom: 64px; inset-inline-start: var(--gutter); font-size: 13px; letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
@keyframes rise { to { transform: none; } }

/* Nav -------------------------------------------------------------------- */
.nav {
  position: fixed; top: 0; inset-inline: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px var(--gutter);
  color: #fff; mix-blend-mode: difference;
  pointer-events: none;
}
.nav a { pointer-events: auto; }
.nav-logo { display: flex; align-items: center; gap: 14px; }
.nav-mono { display: block; height: 36px; width: auto; }
.nav-name { font-size: 14px; opacity: 0.85; }
.nav-links { display: flex; gap: clamp(16px, 3vw, 40px); font-size: 14px; }
.nav-links a { position: relative; }
.nav-links a::after { content: ''; position: absolute; inset-inline: 0; bottom: -3px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform 0.5s var(--ease); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: right; }

/* Home: hero ------------------------------------------------------------- */
.hero {
  min-height: 100vh; min-height: 100svh;
  padding: 120px var(--gutter) 40px;
  display: grid;
  grid-template-columns: 1fr minmax(240px, 30vw);
  grid-template-rows: auto 1fr auto;
  column-gap: clamp(24px, 5vw, 80px);
}
.hero-top { grid-column: 1 / -1; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.hero-title {
  grid-column: 1; align-self: end;
  margin: 0; font-family: var(--serif); font-weight: 300;
  font-size: clamp(64px, 13.5vw, 230px); line-height: 0.92; letter-spacing: -0.01em;
}
.hero-title .mask:nth-child(2) { padding-inline-start: 0.6em; }
.hero-portrait {
  grid-column: 2; grid-row: 2 / 4; align-self: end; margin: 40px 0 0;
  aspect-ratio: 4 / 5; overflow: hidden; background: var(--bg-2);
  clip-path: inset(100% 0 0 0); transition: clip-path 1.5s var(--ease) 0.2s;
}
.hero-portrait img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.25); transition: transform 2s var(--ease-out) 0.2s; }
.view.is-in .hero-portrait { clip-path: inset(0 0 0 0); }
.view.is-in .hero-portrait img { transform: none; }
.hero-bottom { grid-column: 1; display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-top: 40px; }
.hero-bottom p { margin: 0; font-size: 18px; line-height: 1.5; }
.scroll-cue { font-size: 13px; letter-spacing: 0.08em; color: var(--ink-2); display: flex; align-items: center; gap: 10px; }
.scroll-cue i { display: block; width: 1px; height: 40px; background: var(--ink); transform-origin: top; animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* Marquee */
.marquee { border-block: 1px solid var(--line); overflow: hidden; padding: 22px 0; direction: ltr; }
.marquee-track { display: flex; width: max-content; animation: marquee 40s linear infinite; }
.marquee span { font-family: var(--serif); font-size: clamp(28px, 4vw, 54px); font-weight: 300; white-space: nowrap; padding-inline: 0.5em; direction: rtl; }
.marquee span::after { content: '✦'; font-size: 0.4em; vertical-align: middle; margin-inline-start: 1em; color: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* Sections */
.section { padding: clamp(80px, 12vw, 180px) var(--gutter); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 0; }
.section-head h2 { margin: 0; font-family: var(--serif); font-weight: 300; font-size: clamp(36px, 5vw, 72px); line-height: 1; }
.section-head .num { font-size: 13px; color: var(--ink-2); letter-spacing: 0.1em; }

/* Project index */
.index { list-style: none; margin: 0; padding: 0; }
.row {
  position: relative;
  display: grid; grid-template-columns: 80px 1fr 180px 140px 40px; align-items: center; gap: 24px;
  padding: clamp(24px, 3.2vw, 44px) 0;
  border-bottom: 1px solid var(--line);
  transition: color 0.5s var(--ease);
}
.row::before { content: ''; position: absolute; inset: 0; background: var(--ink); transform: scaleY(0); transform-origin: bottom; transition: transform 0.6s var(--ease); z-index: -1; }
.index li { position: relative; z-index: 0; }
.row-no { font-size: 13px; color: var(--ink-3); letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
.row-title { font-family: var(--serif); font-size: clamp(30px, 4.4vw, 68px); font-weight: 300; line-height: 1.05; transition: transform 0.7s var(--ease); }
.row-cat, .row-loc { font-size: 14px; color: var(--ink-2); }
.row-arrow { font-size: 22px; justify-self: end; transform: translateX(10px); opacity: 0; transition: transform 0.6s var(--ease), opacity 0.6s; }
.row-thumb { display: none; }
.index:hover .row { color: var(--ink-3); }
.index .row:hover { color: var(--ink); }
.row:hover .row-title { transform: translateX(-24px); }
.row:hover .row-arrow { transform: none; opacity: 1; }

/* Floating hover preview (desktop only) */
.preview {
  position: fixed; top: 0; left: 0; z-index: 40; pointer-events: none;
  width: clamp(260px, 28vw, 460px); aspect-ratio: 16 / 10;
}
.preview-inner { width: 100%; height: 100%; overflow: hidden; clip-path: inset(50% 50% 50% 50%); transition: clip-path 0.7s var(--ease); background: var(--bg-2); }
.preview.is-on .preview-inner { clip-path: inset(0 0 0 0); }
.preview img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.2); transition: transform 1s var(--ease-out); }
.preview.is-on img { transform: scale(1); }

.cursor {
  position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none;
  width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%;
  background: var(--accent); color: var(--ink);
  display: grid; place-items: center; font-size: 13px; letter-spacing: 0.06em;
  transform: scale(0);
}

/* About */
.about-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: clamp(32px, 6vw, 120px); padding-top: clamp(40px, 6vw, 80px); }
.about-statement { margin: 0; font-family: var(--serif); font-weight: 300; font-size: clamp(26px, 3.2vw, 48px); line-height: 1.25; }
.about-statement em { font-style: normal; color: var(--accent); }
.disciplines { list-style: none; margin: 0; padding: 0; }
.disciplines li { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.disciplines li span:last-child { color: var(--ink-3); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: clamp(48px, 8vw, 120px); border-top: 1px solid var(--line); padding-top: 32px; }
.stat b { display: block; font-family: var(--serif); font-weight: 300; font-size: clamp(56px, 8vw, 120px); line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 14px; color: var(--ink-2); }

/* Contact / footer */
.contact { background: var(--dark); color: var(--on-dark); padding: clamp(80px, 12vw, 180px) var(--gutter) 32px; }
.contact .eyebrow { color: rgba(243, 239, 236, 0.6); }
.big-link { display: inline-flex; align-items: baseline; gap: 0.3em; margin-top: 24px; font-family: var(--serif); font-weight: 300; font-size: clamp(56px, 11vw, 190px); line-height: 1; position: relative; }
.big-link::after { content: ''; position: absolute; inset-inline: 0; bottom: 0.04em; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform 0.8s var(--ease); }
.big-link:hover::after { transform: scaleX(1); transform-origin: right; }
.big-link small { font-size: 0.35em; transition: transform 0.6s var(--ease); }
.big-link:hover small { transform: translate(-8px, -8px); }
.footer-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: clamp(80px, 12vw, 160px); padding-top: 24px; border-top: 1px solid rgba(243, 239, 236, 0.15); font-size: 13px; color: rgba(243, 239, 236, 0.6); }
.footer-bar a:hover { color: var(--on-dark); }

/* Project sections --------------------------------------------------------- */
.project { position: relative; scroll-margin-top: 0; }
.p-cover { position: relative; height: 170vh; }
.p-cover-sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; color: #fff; }
.p-cover-frame { position: absolute; inset: 0; overflow: hidden; background: var(--dark); clip-path: inset(22% 16% 22% 16%); will-change: clip-path; }
.p-cover-frame img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.35); will-change: transform; }
.p-cover-frame::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(20, 18, 16, 0.75), rgba(20, 18, 16, 0.25) 45%, rgba(20, 18, 16, 0) 70%); }
.p-hero-content { position: absolute; z-index: 1; inset-inline: var(--gutter); bottom: clamp(28px, 5vw, 64px); }
.p-count { margin: 0 0 18px; font-size: 13px; letter-spacing: 0.1em; opacity: 0.85; }
.p-title { margin: 0; font-family: var(--serif); font-weight: 300; font-size: clamp(52px, 10vw, 170px); line-height: 0.95; }
.p-title .mask { display: inline-block; vertical-align: top; margin-inline-end: 0.22em; }
.p-hero-content.is-in .mask > span { transform: none; }
.p-hero-content .mask > span { transition-duration: 1s; }
.p-hero-content:not(.is-in) .mask > span { transition-delay: 0s; transition-duration: 0.6s; }

.p-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; padding: 40px var(--gutter); border-bottom: 1px solid var(--line); }
.p-meta dt { font-size: 12px; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 6px; }
.p-meta dd { margin: 0; font-size: 17px; }
.p-back { justify-self: end; align-self: center; font-size: 14px; display: inline-flex; gap: 10px; align-items: center; }
.p-back span { transition: transform 0.5s var(--ease); }
.p-back:hover span { transform: translateX(6px); }

.p-gallery { padding: clamp(60px, 9vw, 140px) var(--gutter); display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(16px, 2.4vw, 36px); row-gap: clamp(48px, 7vw, 110px); }
.shot { margin: 0; cursor: zoom-in; }
.shot-media { overflow: hidden; background: var(--bg-2); }
.shot img { width: 100%; height: auto; transition: transform 1.2s var(--ease-out), filter 0.6s; }
.shot:hover img { transform: scale(1.03); }
.shot figcaption { display: flex; justify-content: space-between; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.shot.wide { grid-column: 1 / -1; }
.shot.half-a { grid-column: 1 / span 6; }
.shot.half-b { grid-column: 7 / span 6; margin-top: clamp(40px, 8vw, 140px); }
.shot.offset { grid-column: 3 / span 8; }

.p-intro { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1.6fr; gap: clamp(24px, 6vw, 120px); }
.p-intro h2 { margin: 0; font-family: var(--serif); font-weight: 300; font-size: clamp(30px, 3.6vw, 54px); line-height: 1.15; }
.p-intro p { margin: 0; color: var(--ink-2); max-width: 46ch; }

.p-sheets { padding: 0 var(--gutter) clamp(80px, 10vw, 160px); }
.sheet { display: grid; grid-template-columns: 60px 1fr auto 40px; gap: 24px; align-items: center; padding: 26px 0; border-bottom: 1px solid var(--line); position: relative; isolation: isolate; transition: color 0.5s var(--ease), padding 0.5s var(--ease); }
.sheet::before { content: ''; position: absolute; inset: 0 calc(var(--gutter) * -1); background: var(--accent); transform: scaleY(0); transform-origin: bottom; transition: transform 0.55s var(--ease); z-index: -1; }
.sheet:hover::before { transform: scaleY(1); }
.sheet:hover { padding-inline: 16px; }
.sheet-no { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sheet-title { font-family: var(--serif); font-size: clamp(22px, 2.4vw, 34px); font-weight: 300; }
.sheet-type { font-size: 12px; letter-spacing: 0.12em; border: 1px solid currentColor; padding: 3px 10px; border-radius: 40px; color: var(--ink-2); }
.sheet { grid-template-columns: 60px 1fr auto auto; }
.sheet-arrow { font-size: 14px; letter-spacing: 0.04em; justify-self: end; white-space: nowrap; transition: transform 0.5s var(--ease); }
.sheet:hover .sheet-arrow { transform: translateX(-6px); }

/* Current-project indicator */
.indicator {
  position: fixed; z-index: 45; bottom: 24px; inset-inline-end: var(--gutter);
  display: flex; align-items: center; gap: 14px;
  color: #fff; mix-blend-mode: difference; font-size: 13px; letter-spacing: 0.04em;
  opacity: 0; transform: translateY(12px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  pointer-events: none;
}
.indicator.is-on { opacity: 1; transform: none; }
.indicator-dots { display: flex; flex-direction: column; gap: 5px; }
.indicator-dots i { display: block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.35; transition: opacity 0.4s, transform 0.4s; }
.indicator-dots i.on { opacity: 1; transform: scale(1.6); }
.indicator-label { position: relative; overflow: hidden; height: 1.6em; min-width: 220px; }
.indicator-label span { position: absolute; inset-inline-start: 0; top: 0; white-space: nowrap; }
.indicator-label b { font-weight: 500; }

/* Transition layers ------------------------------------------------------ */
.curtain {
  position: fixed; inset: 0; z-index: 900; pointer-events: none;
  background: var(--dark); color: var(--on-dark);
  display: grid; place-items: center;
  transform: translateY(100%);
}
.curtain-label { font-family: var(--serif); font-weight: 300; font-size: clamp(40px, 7vw, 110px); overflow: hidden; line-height: 1.1; }
.curtain-label span { display: inline-block; }

/* PDF viewer */
.viewer {
  position: fixed; inset: 0; z-index: 950;
  background: var(--dark); color: var(--on-dark);
  display: grid; grid-template-rows: auto 1fr;
  clip-path: inset(100% 0 0 0); transition: clip-path 0.7s var(--ease);
}
.viewer[hidden] { display: none; }
.viewer.is-open { clip-path: inset(0 0 0 0); }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 18px var(--gutter); border-bottom: 1px solid rgba(243, 239, 236, 0.12); }
.viewer-count { font-size: 12px; letter-spacing: 0.08em; opacity: 0.6; }
.viewer-title { margin: 2px 0 0; font-family: var(--serif); font-weight: 300; font-size: clamp(22px, 2.4vw, 32px); line-height: 1.2; }
.viewer-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.viewer-actions > * { font-size: 13px; padding: 8px 14px; border: 1px solid rgba(243, 239, 236, 0.25); border-radius: 40px; transition: background 0.3s, color 0.3s, border-color 0.3s; white-space: nowrap; }
.viewer-actions > *:hover { background: var(--on-dark); color: var(--dark); border-color: var(--on-dark); }
.viewer-actions > [hidden] { display: none; }
.viewer-body { position: relative; padding: 16px var(--gutter) 20px; min-height: 0; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #2a2724; border-radius: 4px; opacity: 0; transition: opacity 0.5s; }
.viewer-body iframe.is-ready { opacity: 1; }
.viewer-loading { position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 16px; font-size: 14px; opacity: 0.7; }
.viewer-loading.is-on { display: grid; }
.viewer-loading i { display: block; width: 120px; height: 1px; background: rgba(243, 239, 236, 0.2); position: relative; overflow: hidden; }
.viewer-loading i::after { content: ''; position: absolute; inset: 0; background: var(--on-dark); animation: load 1.2s var(--ease) infinite; }
@keyframes load { from { transform: translateX(100%); } to { transform: translateX(-100%); } }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 950; background: rgba(20, 18, 16, 0.96); color: var(--on-dark); display: grid; grid-template-columns: 80px 1fr 80px; align-items: center; opacity: 0; transition: opacity 0.4s; }
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lb-figure { margin: 0; display: grid; justify-items: center; gap: 14px; }
.lb-figure img { max-height: 82vh; max-width: 100%; object-fit: contain; }
.lb-figure figcaption { font-size: 13px; opacity: 0.7; }
.lb-prev, .lb-next { font-size: 28px; height: 100%; opacity: 0.7; transition: opacity 0.3s; }
.lb-prev:hover, .lb-next:hover { opacity: 1; }
.lb-close { position: absolute; top: 22px; inset-inline-end: var(--gutter); font-size: 14px; opacity: 0.8; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
  .nav-name { display: none; }
  .hero { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; }
  .hero-portrait { grid-column: 1; grid-row: 2; width: 62%; justify-self: end; margin-top: 32px; }
  .hero-title { grid-row: 3; margin-top: 28px; }
  .hero-bottom { grid-row: 4; }
  .row { grid-template-columns: 40px 1fr 32px; gap: 12px 16px; }
  .row-cat, .row-loc { display: none; }
  .row-arrow { opacity: 1; transform: none; }
  .row-thumb { display: block; grid-column: 2 / -1; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin-top: 6px; }
  .about-grid, .p-intro { grid-template-columns: 1fr; }
  .p-meta { grid-template-columns: 1fr 1fr; }
  .p-back { justify-self: start; }
  .shot.half-a, .shot.half-b, .shot.offset { grid-column: 1 / -1; margin-top: 0; }
  .sheet { grid-template-columns: 32px 1fr auto; gap: 12px; }
  .p-cover { height: 150vh; }
  .indicator { bottom: 16px; }
  .indicator-label { min-width: 0; width: 60vw; }
  .viewer-bar { flex-direction: column; align-items: stretch; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
  .viewer-actions { justify-content: flex-start; }
  .viewer-body { padding: 10px 8px 12px; }
  .sheet-type { display: none; }
  .lightbox { grid-template-columns: 44px 1fr 44px; }
}
@media (max-width: 560px) {
  .nav-links { gap: 14px; font-size: 13px; }
  .hero-top .en { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .next-title { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}
