/* =================================================================
   OJAS JAIN — DIRECTOR OF PHOTOGRAPHY
   Shared stylesheet. Cinematic. Uncompromising.
   All colours, spacing and timing live as custom properties below.
   ================================================================= */

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

  /* Type */
  --font: "Jost", system-ui, sans-serif;
  --track: 0.15em;          /* minimum letter spacing */
  --track-wide: 0.28em;

  /* Spacing */
  --gap: 3px;               /* grid gap */
  --nav-h: 64px;
  --about-gap: 120px;

  /* Timing — deliberate, filmic. Nothing bouncy. */
  --t-fast: 200ms;
  --t-mid: 250ms;
  --t-slow: 400ms;
  --crossfade: 600ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);   /* ease-out, no overshoot */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
}

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

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

body {
  font-family: var(--font);
  font-weight: 300;
  background: var(--black);
  color: var(--white);
  text-transform: uppercase;          /* visual all-caps; HTML keeps real case */
  letter-spacing: var(--track);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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; }

/* =================================================================
   FILM GRAIN — barely-visible analogue noise over the whole page
   ================================================================= */
.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 — 2px, fixed, above everything
   ================================================================= */
.topline {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: var(--magenta);
  z-index: 1000;
}

/* =================================================================
   CUSTOM CURSOR (desktop / fine-pointer only)
   ================================================================= */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 8px; height: 8px;
  margin: -4px 0 0 -4px;          /* centre on the point */
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--white);
  pointer-events: none;
  z-index: 9999;
  display: none;                   /* shown only on fine pointers via JS/media */
  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);
}
/* morph state — thin 32px outline with VIEW inside */
.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,
  body.cursor-ready .card { 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 28px;
  z-index: 900;
  background: transparent;
  transition: background var(--t-mid) var(--ease);
}
.nav.scrolled { background: rgba(10, 10, 10, 0.9); }

.nav__brand {
  font-size: 13px;
  letter-spacing: var(--track);
  white-space: nowrap;
}
.nav__brand b { font-weight: 400; }
.nav__brand .dim { font-weight: 300; opacity: 0.5; }

.nav__links {
  display: flex;
  gap: 28px;
  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); }

/* back arrow used on project pages */
.nav__back { font-size: 11px; font-weight: 300; letter-spacing: var(--track-wide); }

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

/* =================================================================
   CINEMATOGRAPHY GRID — masonry via CSS columns
   ================================================================= */
.grid {
  padding: calc(var(--nav-h) + 2px + var(--gap)) var(--gap) var(--gap);
  column-count: 3;
  column-gap: var(--gap);
}
.card {
  position: relative;
  display: block;
  width: 100%;
  margin-bottom: var(--gap);
  break-inside: avoid;
  overflow: hidden;
  background: #141414;

  /* fade-up on scroll (Intersection Observer toggles .in) */
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--t-slow) var(--ease),
              transform var(--t-slow) var(--ease);
}
.card.in { opacity: 1; transform: none; }

/* aspect boxes so the 3 cycling stills crossfade in a stable frame */
.card[data-ratio="landscape"] { aspect-ratio: 3 / 2; }
.card[data-ratio="portrait"]  { aspect-ratio: 2 / 3; }

.card__stills { position: absolute; inset: 0; }
.card__stills img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--crossfade) var(--ease);
}
.card__stills img.show { opacity: 1; }

/* hover vignette */
.card__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center,
              rgba(0,0,0,0) 30%, rgba(0,0,0,0.6) 100%);
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease);
  pointer-events: none;
}
/* slide-up info strip */
.card__info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 18px 20px;
  transform: translateY(100%);
  transition: transform var(--t-mid) var(--ease);
  pointer-events: none;
}
.card__info .rule { width: 100%; height: 1px; background: var(--white); margin-bottom: 12px; }
.card__info .name { font-size: 13px; font-weight: 400; letter-spacing: var(--track); }
.card__info .dir  { font-size: 11px; font-weight: 300; letter-spacing: var(--track); opacity: 0.7; margin-top: 4px; }

@media (hover: hover) and (pointer: fine) {
  .card:hover .card__vignette { opacity: 1; }
  .card:hover .card__info { transform: translateY(0); transition: transform var(--t-mid) var(--ease); }
  .card .card__info { transition: transform var(--t-mid) var(--ease-in); } /* clean ease-in on leave */
}

/* =================================================================
   ABOUT
   ================================================================= */
.about {
  margin-top: var(--about-gap);
  padding: 0 28px 100px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.about__typed {
  font-weight: 300;
  font-size: clamp(18px, 3vw, 30px);
  letter-spacing: var(--track);
  min-height: 1.4em;
  margin-bottom: 56px;
}
.about__typed .caret {
  display: inline-block;
  width: 2px; height: 1em;
  background: var(--magenta);
  margin-left: 2px;
  vertical-align: -0.12em;
  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: 56px;
  align-items: start;
}
.about__photo img { width: 100%; filter: grayscale(1); }
.about__bio { font-weight: 300; font-size: 13px; letter-spacing: var(--track); line-height: 1.9; max-width: 46ch; opacity: 0.85; }

.about__contact { margin-top: 40px; font-size: 12px; }
.about__contact .label { font-weight: 400; letter-spacing: var(--track-wide); opacity: 0.5; margin-bottom: 14px; }
.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: 22px; }
.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: 28px;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: var(--track-wide);
  opacity: 0.6;
}

/* =================================================================
   PHOTOGRAPHY PAGE — uniform 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; }

/* =================================================================
   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; color: var(--white);
}
.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 PAGE
   ================================================================= */
.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-weight: 300; font-size: clamp(20px, 4vw, 36px); letter-spacing: var(--track-wide); margin-bottom: 40px; }
.reel__frame {
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  position: relative;
  background: #000;
}
.reel__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* lightweight Vimeo facade */
.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: 64px; height: 64px;
  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: 14px solid var(--white);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
}
.reel__facade:hover .reel__play { background: rgba(192,0,106,0.25); }
.reel__hq { margin-top: 34px; font-weight: 300; font-size: 12px; letter-spacing: var(--track-wide); }
.reel__hq:hover { color: var(--magenta); }

/* =================================================================
   PROJECT PAGE
   ================================================================= */
.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding: calc(var(--nav-h) + 2px + 22px) 28px 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: 60px 20px 80px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: var(--track-wide);
}
.project-foot a:hover { color: var(--magenta); }

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 980px) {
  .about__cols { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 680px) {
  .nav { padding: 0 18px; height: 56px; }
  :root { --nav-h: 56px; }
  .nav__brand { font-size: 11px; }
  .nav__brand .dim { display: none; }     /* keep the brand on one line on small screens */
  .nav__links { gap: 16px; font-size: 10px; letter-spacing: 0.18em; }

  .grid { column-count: 1; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .about { padding: 0 18px 80px; }
}

/* =================================================================
   REDUCED MOTION — disable grain shimmer, typing caret, cycling, fades
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain { animation: none; }
  .about__typed .caret { animation: none; }
  .card, .photo-cell { opacity: 1 !important; transform: none !important; transition: none; }
  .card__stills img { transition: none; }
  body.page-fade { opacity: 1 !important; transition: none; }
}
