/* =================================================================
   OJAS JAIN — DIRECTOR OF PHOTOGRAPHY
   Cinematic. Clean (charmer) + motion (noomo).
   Geometric Jost for nav/labels/body, editorial Fraunces serif for
   the large project titles and statement lines.
   ================================================================= */

:root {
  /* Colour */
  --black: #0a0a0a;
  --white: #ffffff;
  --magenta: #c0006a;

  /* Type */
  --sans: "Jost", system-ui, sans-serif;
  --serif: "Fraunces", "Times New Roman", Georgia, serif;
  --track: 0.15em;
  --track-wide: 0.28em;

  /* Layout */
  --gap: 6px;
  --nav-h: 72px;
  --about-gap: 160px;
  --cols: 6;          /* grid base columns; overridden per breakpoint */
  --row: 8px;         /* masonry row unit (JS computes row spans) */

  /* Timing — deliberate, filmic */
  --t-fast: 200ms;
  --t-mid: 300ms;
  --t-slow: 600ms;
  --crossfade: 700ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);     /* ease-out, no overshoot */
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);     /* in-out */
}

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; background: var(--black); }

body {
  font-family: var(--sans);
  font-weight: 300;
  background: var(--black);
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: var(--track);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.lock { overflow: hidden; }

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; letter-spacing: inherit; text-transform: inherit; }

/* serif helper — natural case, editorial */
.serif { font-family: var(--serif); text-transform: none; font-weight: 340; letter-spacing: 0; }
.serif em, .ital { font-style: italic; }

/* =================================================================
   FILM GRAIN
   ================================================================= */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none; z-index: 9000; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.6s steps(2) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0,0); } 50% { transform: translate(-3%,2%); } 100% { transform: translate(2%,-2%); }
}

/* =================================================================
   MAGENTA TOP LINE
   ================================================================= */
.topline { position: fixed; top: 0; left: 0; width: 100%; height: 2px; background: var(--magenta); z-index: 1000; }

/* =================================================================
   CUSTOM CURSOR
   ================================================================= */
.cursor {
  position: fixed; top: 0; left: 0;
  width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: var(--white); border: 1px solid var(--white);
  pointer-events: none; z-index: 9999; display: none;
  transition: width var(--t-fast) var(--ease), height var(--t-fast) var(--ease),
              margin var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.cursor span { font-size: 8px; letter-spacing: 0.1em; opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.cursor.is-view { width: 32px; height: 32px; margin: -16px 0 0 -16px; background: transparent; display: flex; align-items: center; justify-content: center; }
.cursor.is-view span { opacity: 1; }
@media (pointer: fine) {
  .cursor { display: block; }
  body.cursor-ready, body.cursor-ready a, body.cursor-ready button { cursor: none; }
}

/* =================================================================
   NAV
   ================================================================= */
.nav {
  position: fixed; top: 2px; left: 0; width: 100%; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; z-index: 900; background: transparent;
  transition: background var(--t-mid) var(--ease);
}
.nav.scrolled { background: rgba(10,10,10,0.9); backdrop-filter: blur(6px); }
.nav__brand { font-size: 14px; letter-spacing: var(--track); white-space: nowrap; }
.nav__brand b { font-weight: 500; }
.nav__brand .dim { font-weight: 300; opacity: 0.5; }
.nav__links { display: flex; gap: 30px; font-size: 11px; font-weight: 300; letter-spacing: var(--track-wide); }
.nav__links a { position: relative; padding: 4px 0; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 1px;
  background: var(--magenta); transform: scaleX(0); transform-origin: left;
  transition: transform var(--t-mid) var(--ease);
}
.nav__links a:hover::after, .nav__links a.active::after { transform: scaleX(1); }
.nav__back { font-size: 11px; font-weight: 300; letter-spacing: var(--track-wide); }

/* =================================================================
   PAGE FADE
   ================================================================= */
body.page-fade { opacity: 0; transition: opacity var(--t-fast) var(--ease); }
body.page-fade.ready { opacity: 1; }
body.page-fade.leaving { opacity: 0; }

/* =================================================================
   ABOUT
   ================================================================= */
.about { margin-top: var(--about-gap); padding: 0 32px 120px; max-width: 1180px; margin-left: auto; margin-right: auto; }
.about__typed {
  font-family: var(--serif); text-transform: none; font-weight: 340;
  font-size: clamp(28px, 5vw, 62px); letter-spacing: 0; line-height: 1.08;
  min-height: 1.2em; margin-bottom: 72px;
}
.about__typed em { font-style: italic; }
.about__typed .caret { display: inline-block; width: 2px; height: 0.9em; background: var(--magenta); margin-left: 4px; vertical-align: -0.05em; animation: blink 1s steps(2) infinite; }
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }

.about__cols { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 64px; align-items: start; }
.about__photo { overflow: hidden; }
.about__photo img { width: 100%; filter: grayscale(1); transition: filter var(--t-slow) var(--ease), transform 1.2s var(--ease); }
.about__photo img:hover { filter: grayscale(0); transform: scale(1.03); }
.about__bio { font-weight: 300; font-size: 13px; letter-spacing: var(--track); line-height: 2; max-width: 48ch; opacity: 0.85; }
.about__contact { margin-top: 44px; font-size: 12px; }
.about__contact .label { font-weight: 400; letter-spacing: var(--track-wide); opacity: 0.5; margin-bottom: 16px; }
.about__contact a { display: inline-block; font-weight: 300; letter-spacing: var(--track); }
.about__contact .line { display: block; margin-bottom: 6px; }
.about__contact a:hover { color: var(--magenta); }
.about__socials { display: flex; gap: 18px; margin-top: 24px; }
.about__socials a { width: 22px; height: 22px; opacity: 0.7; transition: opacity var(--t-fast) var(--ease); }
.about__socials a:hover { opacity: 1; }
.about__socials svg { width: 100%; height: 100%; fill: var(--white); }

/* =================================================================
   FOOTER
   ================================================================= */
.footer { padding: 32px; font-size: 11px; font-weight: 300; letter-spacing: var(--track-wide); opacity: 0.6; }

/* =================================================================
   PHOTOGRAPHY GRID
   ================================================================= */
.photo-grid { padding: calc(var(--nav-h) + 2px + var(--gap)) var(--gap) var(--gap); display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.photo-cell { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: #141414; opacity: 0; transform: translateY(30px); transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease); }
.photo-cell.in { opacity: 1; transform: none; }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow) var(--ease); }
@media (hover: hover) and (pointer: fine) { .photo-cell:hover img { transform: scale(1.06); } }

/* =================================================================
   LIGHTBOX
   ================================================================= */
.lightbox { position: fixed; inset: 0; background: var(--black); z-index: 9500; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.lightbox.open { display: flex; opacity: 1; }
.lightbox img { max-width: 92vw; max-height: 88vh; object-fit: contain; }
.lightbox__close { position: absolute; top: 20px; right: 26px; font-size: 26px; font-weight: 300; line-height: 1; }
.lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 30px; font-weight: 300; opacity: 0.6; padding: 20px; transition: opacity var(--t-fast) var(--ease); }
.lightbox__nav:hover { opacity: 1; }
.lightbox__nav.prev { left: 12px; }
.lightbox__nav.next { right: 12px; }

/* =================================================================
   SHOWREEL
   ================================================================= */
.reel { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--nav-h) 28px 28px; text-align: center; }
.reel__title { font-family: var(--serif); text-transform: none; font-weight: 340; font-size: clamp(32px, 6vw, 76px); letter-spacing: 0; margin-bottom: 48px; }
.reel__title em { font-style: italic; }
.reel__frame { width: 100%; max-width: 960px; aspect-ratio: 16 / 9; position: relative; background: #000; }
.reel__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.reel__facade { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background-size: cover; background-position: center; cursor: pointer; }
.reel__facade::before { content: ""; position: absolute; inset: 0; background: rgba(10,10,10,0.45); }
.reel__play { position: relative; width: 70px; height: 70px; border: 1px solid var(--white); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background var(--t-fast) var(--ease); }
.reel__play::after { content: ""; margin-left: 4px; border-left: 15px solid var(--white); border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
.reel__facade:hover .reel__play { background: rgba(192,0,106,0.25); }
.reel__hq { margin-top: 36px; font-weight: 300; font-size: 12px; letter-spacing: var(--track-wide); }
.reel__hq:hover { color: var(--magenta); }

/* =================================================================
   PROJECT PAGE
   ================================================================= */
.project-head { padding: calc(var(--nav-h) + 2px + 56px) 32px 40px; max-width: 1400px; margin: 0 auto; }
.project-head .ptag { font-size: 11px; font-weight: 400; letter-spacing: var(--track-wide); opacity: 0.6; }
.project-head .ptitle { font-family: var(--serif); text-transform: none; font-weight: 340; letter-spacing: 0; line-height: 1; font-size: clamp(44px, 9vw, 132px); margin: 18px 0 0; }
.project-head .ptitle em { font-style: italic; }
.project-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-top: 22px; font-size: 11px; font-weight: 300; letter-spacing: var(--track); opacity: 0; transition: opacity 700ms var(--ease); }
.project-meta.in { opacity: 0.6; }
.project-stills { display: block; }
.project-stills img { width: 100vw; display: block; }
.project-foot { text-align: center; padding: 70px 20px 90px; font-size: 12px; font-weight: 300; letter-spacing: var(--track-wide); }
.project-foot a:hover { color: var(--magenta); }

/* =================================================================
   RESPONSIVE GRID COUNTS — fewer/bigger as it narrows
   ================================================================= */
@media (max-width: 1080px) {
  .nav__brand .dim { display: none; }   /* keep brand + links on one line */
  .nav__links { gap: 22px; }
}
@media (max-width: 760px) {
  :root { --nav-h: 56px; }
  .nav { padding: 0 18px; height: 56px; }
  .nav__brand { font-size: 12px; }
  .nav__brand .dim { display: none; }
  .nav__links { gap: 15px; font-size: 10px; letter-spacing: 0.16em; }
  .nav__links > :first-child { display: none; }   /* hide redundant Cinematography link; logo goes home */
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .about { padding: 0 18px 80px; }
  .about__cols { grid-template-columns: 1fr; gap: 36px; }
}

/* =================================================================
   REDUCED MOTION
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain { animation: none; }
  .about__typed .caret { animation: none; }
  .photo-cell { opacity: 1 !important; transform: none !important; transition: none; }
  body.page-fade { opacity: 1 !important; transition: none; }
}

/* =================================================================
   FILM-STRIP COIL (homepage)
   ================================================================= */
.film { position: relative; width: 100%; background: var(--black); }
.film__pin { position: relative; height: 100vh; width: 100%; overflow: hidden; }
.film__stage {
  position: absolute; inset: 0;
  perspective: 1200px;
  transform-style: preserve-3d;
}
/* WebGL coil canvas */
.coil-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* dark gap between the coil and About */
.film-gap { height: 70vh; background: var(--black); }

/* a single film frame on the coil */
.frame {
  position: absolute; left: 50%; top: 50%;
  width: clamp(230px, 32vw, 460px);
  aspect-ratio: 3 / 2;
  background: #000;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.05);
}
.frame img {
  position: absolute; inset: 15px 9px;       /* film border (sprocket strips top/bottom) */
  width: auto; height: auto;
  object-fit: cover;
}
.frame::before, .frame::after {
  content: ""; position: absolute; left: 9px; right: 9px; height: 8px;
  background: repeating-linear-gradient(to right, rgba(225,225,225,0.85) 0 9px, transparent 9px 19px);
  border-radius: 2px; opacity: 0.75;
}
.frame::before { top: 4px; }
.frame::after  { bottom: 4px; }

/* intro / scroll cue */
.film__cue {
  position: absolute; inset: 0; z-index: 60; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.film__title { font-family: var(--serif); text-transform: none; font-weight: 340; font-size: clamp(46px, 11vw, 150px); line-height: 0.95; }
.film__title em { font-style: italic; }
.film__sub { margin-top: 14px; font-size: clamp(11px, 1.4vw, 14px); font-weight: 300; letter-spacing: var(--track-wide); opacity: 0.6; }
.film__scroll { margin-top: 46px; display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 10px; letter-spacing: var(--track-wide); opacity: 0.7; }
.film__arrow { width: 1px; height: 54px; background: linear-gradient(var(--white), transparent); position: relative; overflow: hidden; }
.film__arrow::after { content: ""; position: absolute; left: 0; top: -50%; width: 1px; height: 50%; background: var(--magenta); animation: scrolldrop 1.8s var(--ease-io) infinite; }
@keyframes scrolldrop { 0% { top: -50%; } 100% { top: 100%; } }
.film__cue.is-hidden { display: none; }

/* gate caption — locks in beneath the focused frame on snap settle */
.gate-caption {
  position: absolute; left: 50%; bottom: 6vh; transform: translateX(-50%);
  z-index: 70; text-align: center; pointer-events: none; opacity: 0;
  display: flex; flex-direction: column; gap: 7px; width: min(84vw, 720px);
}
.gate-caption:not(.is-on) { visibility: hidden; }
.gate-caption__title {
  font-family: var(--serif); text-transform: none; font-style: italic;
  font-weight: 340; letter-spacing: 0; line-height: 1.1;
  font-size: clamp(20px, 2.6vw, 34px);
}
.gate-caption__meta {
  font-size: 10px; font-weight: 300; letter-spacing: var(--track-wide);
  opacity: 0.6; font-variant-numeric: tabular-nums;
}

/* static / reduced / mobile fallback: vertical sprocketed strip */
.film--static .film__pin { height: auto; overflow: visible; }
/* the cue becomes the page opening on the static path — the name MUST render */
.film__cue--static {
  position: static; inset: auto; min-height: 72vh; pointer-events: auto;
  padding: calc(var(--nav-h) + 24px) 16px 0;
}
/* labeled project groups in the static strip */
.strip-head { width: min(720px, 92vw); margin: 44px auto 4px; align-self: center; text-align: left; }
.strip-head:first-of-type { margin-top: 0; }
.strip-head__name {
  font-family: var(--serif); text-transform: none; font-style: italic;
  font-weight: 340; letter-spacing: 0; line-height: 1.05;
  font-size: clamp(24px, 6vw, 40px);
}
.strip-head__meta { margin-top: 6px; font-size: 10px; font-weight: 300; letter-spacing: var(--track-wide); opacity: 0.55; }
.film__stage--static {
  position: static; perspective: none; transform-style: flat;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: calc(var(--nav-h) + 40px) 16px 80px;
}
.film--static .frame {
  position: static; left: auto; top: auto;
  width: min(720px, 92vw); aspect-ratio: 3 / 2;
  transform: translateY(40px); opacity: 0; filter: none !important;
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.film--static .frame.in { opacity: 1; transform: none; }

/* =================================================================
   PROJECT COLLAGE (Pothier-style asymmetric, scroll-revealed)
   ================================================================= */
.collage { display: flex; flex-direction: column; gap: clamp(48px, 9vh, 140px); padding: 30px 0 0; overflow: hidden; }
.col-img { overflow: hidden; }
.col-img img { width: 100%; display: block; }

.col-full  .col-img { width: 100%; }
.col-center .col-img { width: min(900px, 84vw); margin: 0 auto; }
.col-left  .col-img { width: min(560px, 62vw); margin-left: clamp(16px, 8vw, 180px); }
.col-right .col-img { width: min(680px, 66vw); margin-left: auto; margin-right: clamp(16px, 8vw, 180px); }
.col-duo { display: flex; gap: clamp(16px, 3vw, 48px); align-items: flex-start; justify-content: center; padding: 0 clamp(16px, 6vw, 140px); }
.col-duo .col-img--a { width: 56%; }
.col-duo .col-img--b { width: 40%; margin-top: clamp(40px, 10vh, 140px); }

/* reveal — CSS fallback when motion libs are off (heavy mode uses GSAP) */
.col-block { opacity: 0; transform: translateY(44px); }
html:not(.motion-heavy) .col-block { transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
html:not(.motion-heavy) .col-block.in { opacity: 1; transform: none; }
.motion-heavy .col-img img { will-change: transform; }

@media (max-width: 760px) {
  .col-left .col-img, .col-right .col-img, .col-center .col-img { width: 90vw; margin: 0 auto; }
  .col-duo { flex-direction: column; padding: 0 16px; }
  .col-duo .col-img--a, .col-duo .col-img--b { width: 100%; margin-top: 0; }
}

/* reduced motion: everything visible & still */
@media (prefers-reduced-motion: reduce) {
  .film__arrow::after { animation: none; }
  .frame { transition: none !important; }
  .col-block { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* =================================================================
   PHASE 1 — motion polish
   ================================================================= */

/* living ambient background (drifting filmic light) */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ambient__glow { position: absolute; border-radius: 50%; filter: blur(90px); will-change: transform; }
.ambient__glow--1 { width: 62vmax; height: 62vmax; left: -12vmax; top: -14vmax; background: radial-gradient(circle, rgba(192,0,106,0.20), transparent 70%); animation: drift1 28s ease-in-out infinite; }
.ambient__glow--2 { width: 52vmax; height: 52vmax; right: -12vmax; bottom: -8vmax; background: radial-gradient(circle, rgba(255,150,60,0.13), transparent 70%); animation: drift2 34s ease-in-out infinite; }
.ambient__glow--3 { width: 44vmax; height: 44vmax; left: 38%; top: 28%; background: radial-gradient(circle, rgba(70,120,255,0.10), transparent 70%); animation: drift3 40s ease-in-out infinite; }
@keyframes drift1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(13vmax,9vmax); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-11vmax,-9vmax); } }
@keyframes drift3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(7vmax,-11vmax) scale(1.16); } }

/* DoP timecode (scroll progress) */
.timecode { position: fixed; left: 28px; bottom: 22px; z-index: 800; font-family: var(--sans); font-size: 11px; font-weight: 300; letter-spacing: 0.22em; color: var(--white); opacity: 0; font-variant-numeric: tabular-nums; pointer-events: none; }

/* cursor: adaptive blend, trailing echo, focus-box reticle */
.cursor { mix-blend-mode: difference; }
.cursor.is-view { width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 2px; }
.cursor.is-view::before { content: ""; position: absolute; width: 4px; height: 4px; background: var(--white); border-radius: 50%; }
.cursor-echo {
  position: fixed; top: 0; left: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border: 1px solid rgba(255,255,255,0.35); border-radius: 50%;
  pointer-events: none; z-index: 9998; display: none; mix-blend-mode: difference;
}
@media (pointer: fine) { body.cursor-ready .cursor-echo { display: block; } }

/* kinetic type — masked word reveals */
.kw { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.kw__i { display: inline-block; will-change: transform; }

/* scroll-velocity skew on non-pinned content */
#collage, .photo-grid { transform: skewY(var(--vskew, 0deg)); transform-origin: center top; will-change: transform; }

@media (prefers-reduced-motion: reduce) {
  .ambient__glow { animation: none !important; }
  #collage, .photo-grid { transform: none !important; }
  .kw__i { transform: none !important; }
}
