/*
  Type system — three styles only:
  1. Display: Cormorant Garamond, uppercase, wide tracking (wordmark, hero title, footer).
  2. Text:    Montserrat Light (headings, captions, body copy).
  3. Label:   Montserrat Regular, small uppercase (nav, eyebrows, links).
*/
:root {
  --ivory: #f4f0ea;   /* light warm page background */
  --paper: #faf7f3;
  --sand: #e8e0d5;    /* image placeholders, hero base */
  --body: #5f5750;    /* paragraph text */
  --ink: #2a2622;     /* headings, logo */
  --muted: #958b80;
  --line: #e2dad0;
  --display: "Cormorant Garamond", "Times New Roman", serif;
  --text: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 2.6vw, 40px);
  --header-h: 84px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--text);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { font-weight: 300; }
img, video { display: block; max-width: 100%; }
html, body { overflow-x: clip; } /* the page itself never slides sideways */
html { overscroll-behavior-y: none; } /* no rubber-band stretch at the top and bottom of the page */
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
main:focus { outline: none; }

/* Style 1 — display */
.wordmark, .hero-title, .footer-mark, .signature {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .3em;
  line-height: 1;
}
/* Style 3 — label */
.eyebrow, .site-nav a, .text-link, .chapters a,
.lb-close, .lb-count, .footer-meta, .play-tag {
  font-family: var(--text);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .26em;
  text-transform: uppercase;
}
.eyebrow { color: var(--muted); }
.location { font-size: 11px; margin-top: 8px; }
.page-head .location { margin-top: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter);
  transition: background .5s ease, border-color .5s ease;
  border-bottom: 1px solid transparent;
}
.site-header.solid { background: rgba(244, 240, 234, .94); backdrop-filter: blur(8px); border-color: var(--line); }
.wordmark { font-size: 18px; white-space: nowrap; }
.site-nav { display: flex; gap: 40px; }
.site-nav a { position: relative; padding: 6px 0; }
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: currentColor;
  transition: right .4s ease;
}
.site-nav a:hover::after, .site-nav a.active::after { right: 0; }
.menu-toggle { display: none; width: 32px; height: 32px; position: relative; }
.menu-toggle span { position: absolute; left: 4px; right: 4px; height: 1px; background: currentColor; transition: transform .3s ease, top .3s ease; }
.menu-toggle span:first-child { top: 12px; }
.menu-toggle span:last-child { top: 20px; }

/* ---------- Page transitions ---------- */
.page { animation: fadeIn .8s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 1.1s ease, transform 1.1s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Hero: textured paper cover, soft drifting light + film grain ---------- */
.hero {
  position: relative; height: 42vh; height: 42svh; min-height: 300px; max-height: 440px; overflow: hidden;
  background: var(--sand);
}
.hero-light {
  position: absolute; inset: -30%;
  background:
    radial-gradient(38% 42% at 30% 40%, rgba(252, 249, 244, .95), rgba(252, 249, 244, 0) 70%),
    radial-gradient(34% 38% at 72% 62%, rgba(205, 188, 166, .5), rgba(205, 188, 166, 0) 70%),
    radial-gradient(30% 30% at 60% 25%, rgba(226, 214, 198, .7), rgba(226, 214, 198, 0) 70%);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(-4%, -2%, 0) rotate(0deg) scale(1); }
  50%  { transform: translate3d(3%, 3%, 0) rotate(4deg) scale(1.06); }
  100% { transform: translate3d(5%, -3%, 0) rotate(-3deg) scale(1.02); }
}
.hero-grain {
  position: absolute; inset: -50%; opacity: .32; pointer-events: none; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45  0 0 0 0 .4  0 0 0 0 .33  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.hero-content {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: var(--header-h) var(--gutter) 0;
}
.hero-title { font-size: clamp(23px, 3.87vw, 53px); margin: 16px 0 18px; padding-left: .3em; /* balance trailing tracking */ }
/* Both lines around the hero title share one style: small caps, wide tracking, same color. */
.hero-line { font-size: clamp(11px, 1vw, 13px); font-weight: 400; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); margin: 0; }
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- Project cards (home carousel + work grid) ---------- */
.card { display: block; }
.card .img-wrap { overflow: hidden; background: var(--sand); aspect-ratio: 1 / 1; }
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.6s cubic-bezier(.2,.7,.2,1); }
.card:hover img { transform: scale(1.03); }
.card-title { font-size: clamp(16px, 1.36vw, 20px); line-height: 1.3; margin: 18px 0 0; letter-spacing: 0; }

.home-work { padding: clamp(56px, 7vw, 96px) 0 clamp(80px, 9vw, 120px); }
.carousel { position: relative; }
.carousel-track {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * var(--gutter) - 2 * 18px) / 3);
  gap: 18px; padding: 0 var(--gutter);
  overflow-x: auto; overflow-y: hidden; /* sideways only: captions never move up or down */
  scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter);
  touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; overscroll-behavior-x: contain;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track .card { scroll-snap-align: start; }
@media (hover: hover) and (pointer: fine) {
  .carousel-track { cursor: grab; user-select: none; -webkit-user-select: none; }
  .carousel-track img { -webkit-user-drag: none; }
}
.carousel-track.dragging { cursor: grabbing; scroll-snap-type: none; }
.carousel-track.dragging .card { pointer-events: none; }
.carousel-btn {
  position: absolute; top: 0; z-index: 3;
  width: 58px; height: 58px; border-radius: 50%;
  background: rgba(42, 38, 34, .55); color: #fff; backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .35s ease, background .3s ease;
}
.carousel-btn:hover { background: rgba(42, 38, 34, .8); }
.carousel-btn svg { width: 24px; height: 24px; }
.carousel-btn.prev { left: calc(var(--gutter) + 22px); }
.carousel-btn.next { right: calc(var(--gutter) + 22px); }
.carousel-btn[disabled] { opacity: 0; pointer-events: none; }

/* ---------- Work index ---------- */
.page-head { padding: calc(var(--header-h) + clamp(36px, 4.5vw, 64px)) var(--gutter) clamp(28px, 3vw, 40px); max-width: 1000px; }
.page-head h1 { font-size: clamp(25px, 2.82vw, 37px); line-height: 1.15; margin: 0; letter-spacing: 0; }
.page-head p { max-width: 58ch; color: var(--body); margin: 0; }
.work-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 36px 16px; padding: 0 var(--gutter) clamp(72px, 8vw, 112px); }
.work-grid .card { grid-column: span 2; }
.work-grid .card:nth-child(-n+2) { grid-column: span 3; }
.work-grid .card:nth-child(-n+2) .img-wrap { aspect-ratio: 4 / 3; }

/* ---------- Project page ---------- */

.chapters {
  position: sticky; top: var(--header-h); z-index: 20;
  background: rgba(244, 240, 234, .94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; gap: 36px; padding: 0 var(--gutter); scrollbar-width: none;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; /* one line that slides sideways only */
}
.chapters::-webkit-scrollbar { display: none; }
.chapters a { padding: 18px 0; white-space: nowrap; color: var(--muted); border-bottom: 1px solid transparent; transition: color .3s; }
.chapters a:hover, .chapters a.active { color: var(--ink); border-color: var(--ink); }

.chapter { padding: clamp(36px, 4vw, 56px) var(--gutter) 0; scroll-margin-top: calc(var(--header-h) + 54px); }
.chapter:last-of-type { padding-bottom: clamp(64px, 7vw, 96px); }
.chapter-head { display: flex; align-items: baseline; gap: 20px; margin-bottom: 18px; }
.chapter-head h2 { font-size: clamp(16px, 1.41vw, 19px); margin: 0; letter-spacing: 0; }

/* Uniform grid: every vertical photo is the same 2:3 size; horizontal photos span two columns at the same height. */
.gallery {
  --cols: 5; --gap: 10px;
  container-type: inline-size;
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) * 1.5);
  grid-auto-flow: dense;
}
.gallery .tile.wide { grid-column: span 2; }
/* All-horizontal galleries (Film): three across, centered, last row included. */
.gallery.landscape { display: flex; flex-wrap: wrap; justify-content: center; }
.gallery.landscape .tile { width: calc((100% - 2 * var(--gap)) / 3); aspect-ratio: 3 / 2; }
.gallery .tile { cursor: zoom-in; position: relative; overflow: hidden; background: var(--sand); }
.gallery .tile img, .gallery .tile video { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease, transform 1.2s cubic-bezier(.2,.7,.2,1); }
.gallery .tile img.loaded, .gallery .tile video { opacity: 1; }
.gallery .tile:hover img { transform: scale(1.025); }
.gallery .tile .play-tag { position: absolute; left: 12px; bottom: 10px; color: #fff; font-size: 9px; text-shadow: 0 1px 6px rgba(0,0,0,.4); }

.next-project { display: block; border-top: 1px solid var(--line); padding: clamp(44px, 6vw, 80px) var(--gutter); text-align: center; transition: background .5s; }
.next-project:hover { background: var(--paper); }
.next-project h3 { font-size: clamp(21px, 2.64vw, 33px); letter-spacing: 0; margin: 14px 0 0; line-height: 1.1; }

/* ---------- About ---------- */
.about-hero { display: grid; grid-template-columns: 5fr 6fr; gap: clamp(32px, 6vw, 96px); padding: calc(var(--header-h) + clamp(48px, 7vw, 96px)) var(--gutter) clamp(80px, 10vw, 140px); align-items: center; }
.about-hero .about-img img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.about-hero h1 { font-size: clamp(28px, 3.17vw, 44px); line-height: 1.15; margin: 16px 0 28px; letter-spacing: 0; }
.about-hero p { color: var(--body); max-width: 56ch; }
.about-hero p.lead { font-size: clamp(16px, 1.32vw, 18px); line-height: 1.6; color: var(--ink); }
.signature { font-size: 13px; margin-top: 34px; }
.based { margin-top: 10px; }

.approach { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gutter); padding: 0 var(--gutter) clamp(96px, 12vw, 160px); }
.approach h4 { font-size: 19px; margin: 14px 0 10px; }
.approach p { margin: 0; color: var(--body); }
.approach > div { border-top: 1px solid var(--ink); padding-top: 22px; }

/* ---------- Contact ---------- */
.contact { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.contact-img { background-size: cover; background-position: center; min-height: 50vh; }
.contact-body { padding: calc(var(--header-h) + 48px) var(--gutter) 64px clamp(24px, 6vw, 96px); display: flex; flex-direction: column; justify-content: center; }
.contact-body h1 { font-size: clamp(32px, 3.87vw, 53px); line-height: 1.08; margin: 16px 0 24px; letter-spacing: 0; }
.contact-body p { max-width: 44ch; color: var(--body); }
.contact-email { font-size: clamp(18px, 1.76vw, 23px); border-bottom: 1px solid var(--line); padding-bottom: 6px; align-self: flex-start; margin-top: 22px; transition: border-color .3s; }
.contact-email:hover { border-color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 48px var(--gutter) 36px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.footer-mark { font-size: clamp(16px, 1.76vw, 21px); }
.footer-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--muted); }
body.no-footer .site-footer { display: none; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(22, 20, 18, .97); display: flex; align-items: center; justify-content: center; animation: fadeIn .4s ease; }
.lightbox[hidden] { display: none; }
.lb-stage { margin: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 64px 88px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; animation: fadeIn .5s ease; }
.lb-close { position: absolute; top: 24px; right: var(--gutter); color: #eee; z-index: 2; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); color: #eee; font-size: 23px; padding: 20px; z-index: 2; opacity: .7; transition: opacity .3s; }
.lb-prev:hover, .lb-next:hover { opacity: 1; }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
.lb-count { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: #aaa; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .gallery { --cols: 3; }
  .carousel-track { grid-auto-columns: calc((100% - 2 * var(--gutter) - 14px) / 2); gap: 14px; }
  .work-grid { grid-template-columns: repeat(2, 1fr); }
  .work-grid .card, .work-grid .card:nth-child(-n+2) { grid-column: span 1; }
  .work-grid .card:nth-child(-n+2) .img-wrap { aspect-ratio: 1 / 1; }
  .work-grid .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .work-grid .card:last-child:nth-child(odd) .img-wrap { aspect-ratio: 2 / 1; }
}
@media (max-width: 760px) {
  :root { --header-h: 68px; }
  .wordmark { font-size: 13px; letter-spacing: .26em; }
  .menu-toggle { display: block; z-index: 2; }
  /* Dropdown under the header, aligned right. Positioned against the header itself so the
     header's frosted (backdrop-filter) state can't clip it. */
  .site-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--ivory); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: flex-end; gap: 4px;
    padding: 14px var(--gutter) 22px;
    opacity: 0; transform: translateY(-6px); pointer-events: none;
    transition: opacity .3s ease, transform .3s ease;
  }
  .site-nav a { font-size: 13px; padding: 12px 0; }
  .site-nav a::after { bottom: 8px; }
  body.menu-open .site-header { background: var(--ivory); border-color: var(--line); }
  body.menu-open .site-nav { opacity: 1; transform: none; pointer-events: auto; }
  body.menu-open .menu-toggle span:first-child { top: 16px; transform: rotate(45deg); }
  body.menu-open .menu-toggle span:last-child { top: 16px; transform: rotate(-45deg); }

  .chapters { gap: 26px; }

  .carousel-track { grid-auto-columns: 78%; gap: 12px; }
  .carousel-btn { width: 46px; height: 46px; }
  .carousel-btn.prev { left: calc(var(--gutter) + 12px); }
  .carousel-btn.next { right: calc(var(--gutter) + 12px); }
  .work-grid { grid-template-columns: 1fr 1fr; gap: 28px 10px; }
  .card-title { font-size: 12px; margin-top: 10px; }
  .gallery { --cols: 2; --gap: 6px; }
  .gallery.landscape .tile { width: 100%; }
  .about-hero, .contact { grid-template-columns: 1fr; }
  .contact-img { order: 2; min-height: 60vh; }
  .contact-body { padding-left: var(--gutter); }
  .approach { grid-template-columns: 1fr; gap: 40px; }
  .lb-stage { padding: 56px 8px; }
  .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; }
  .footer-meta { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
