/* ————————————————————————————————————————
   Nimitt Jain — personal site v3
   System: image-led dark editorial with
   scroll choreography (GSAP + Lenis).
   Ivory on near-black, amber accent,
   Fraunces display + Archivo body.
   Theme morphs light at About.
   ———————————————————————————————————————— */

:root {
  --bg: #0a0908;
  --bg-soft: #131110;
  --ink: #ece6dc;
  --ink-dim: #97917f;
  --line: #262320;
  --accent: #d9a441;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Archivo", Helvetica, sans-serif;
}
body[data-theme="light"] {
  --bg: #ece6dc;
  --bg-soft: #e2dbcf;
  --ink: #171310;
  --ink-dim: #6d6552;
  --line: #d3cabb;
  --accent: #a86f14;
}

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

html { scroll-behavior: smooth; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.7s ease, color 0.7s ease;
}

::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* Preloader */
.loader {
  position: fixed; inset: 0; z-index: 999;
  background: var(--accent);
  color: #0a0908;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  will-change: transform;
}
.loader-name {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(3rem, 12vw, 10rem); line-height: 1;
  letter-spacing: -0.02em;
}
.loader-name .char { display: inline-block; will-change: transform, opacity; }
.loader-meta {
  position: absolute; bottom: 2rem; left: clamp(1.2rem, 4vw, 3.5rem); right: clamp(1.2rem, 4vw, 3.5rem);
  display: flex; justify-content: space-between;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.18em;
}
body.is-loading { overflow: hidden; }

/* Custom cursor (fine pointers only) */
.cursor-dot, .cursor-ring {
  position: fixed; top: -60px; left: -60px; z-index: 998;
  pointer-events: none; border-radius: 50%;
  display: none;
}
.cursor-dot {
  width: 8px; height: 8px; background: var(--accent);
  transform: translate(-50%, -50%);
}
.cursor-ring {
  width: 36px; height: 36px;
  border: 1px solid var(--accent);
  opacity: 0.5;
  transform: translate(-50%, -50%);
  transition: width 0.25s ease, height 0.25s ease, opacity 0.25s ease;
}
body.cursor-hover .cursor-ring { width: 56px; height: 56px; opacity: 0.9; }
@media (pointer: fine) {
  .cursor-dot, .cursor-ring { display: block; }
}

/* Progress bar */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 100; background: transparent;
}
.progress span { display: block; height: 100%; width: 0; background: var(--accent); }

/* Nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.4rem clamp(1.2rem, 4vw, 3.5rem);
  mix-blend-mode: difference;
  color: #ece6dc;
}
.nav-name {
  font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 600; letter-spacing: 0.01em;
}
.nav-links { display: flex; gap: 1.8rem; font-size: 0.85rem; }
.nav-links a {
  text-transform: uppercase; letter-spacing: 0.14em;
  opacity: 0.75; transition: opacity 0.25s;
}
.nav-links a:hover { opacity: 1; }

/* Hero */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 6rem clamp(1.2rem, 4vw, 3.5rem) 5.5rem;
  isolation: isolate;
  overflow: hidden;
}
.hero-media { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.hero-media img {
  width: 100%; height: 112%; object-fit: cover; object-position: 50% 35%;
  filter: saturate(0.92) contrast(1.02);
  will-change: transform;
}
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10,9,8,0.55) 0%, rgba(10,9,8,0.05) 30%, rgba(10,9,8,0.12) 55%, rgba(10,9,8,0.82) 100%),
    linear-gradient(100deg, rgba(10,9,8,0.5) 0%, rgba(10,9,8,0) 45%);
}
.hero-content { max-width: 1280px; will-change: transform, opacity; }
.hero-eyebrow {
  text-transform: uppercase; letter-spacing: 0.22em;
  font-size: 0.78rem; color: #ece6dc; opacity: 0.85; margin-bottom: 1.2rem;
}
.hero-name {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(3.6rem, 13vw, 11rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: #ece6dc;
  text-shadow: 0 2px 40px rgba(10,9,8,0.45);
}
.hero-name .line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero-name .char { display: inline-block; will-change: transform; }
.accent-dot { color: var(--accent); font-style: normal; }

.hero-sub {
  margin-top: 1.4rem;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  max-width: 30em; color: #ece6dc;
  text-shadow: 0 1px 24px rgba(10,9,8,0.6);
}
.hero-cta { display: flex; gap: 1rem; margin-top: 2.2rem; }
.btn {
  display: inline-block; padding: 0.85rem 1.7rem;
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.14em;
  border-radius: 999px; transition: background 0.3s, color 0.3s, border-color 0.3s;
  will-change: transform;
}
.btn-solid { background: #ece6dc; color: #0a0908; }
.btn-solid:hover { background: var(--accent); }
.btn-ghost { border: 1px solid rgba(236,230,220,0.55); color: #ece6dc; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-credit {
  position: absolute; right: clamp(1.2rem, 4vw, 3.5rem); bottom: 1.6rem;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: #ece6dc; opacity: 0.55;
}

.scroll-cue {
  position: absolute; bottom: 1.4rem; left: 50%;
  width: 1px; height: 48px; overflow: hidden;
}
.scroll-cue span {
  display: block; width: 1px; height: 100%;
  background: rgba(236,230,220,0.7);
  animation: cueDrop 1.8s ease-in-out infinite;
}
@keyframes cueDrop {
  0% { transform: translateY(-100%); }
  55% { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* Marquee */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden; white-space: nowrap;
  padding: 0.9rem 0;
}
.marquee-track { display: inline-flex; will-change: transform; }
.marquee-track span {
  font-family: var(--font-display); font-style: italic; font-weight: 300;
  font-size: 1.1rem; color: var(--ink-dim); padding-right: 1rem;
}

/* Sections */
.section {
  padding: clamp(5rem, 12vh, 9rem) clamp(1.2rem, 4vw, 3.5rem);
  max-width: 1280px; margin: 0 auto;
}
.section-head {
  display: flex; align-items: baseline; gap: 1.2rem;
  margin-bottom: clamp(2.5rem, 6vh, 4rem);
}
.section-num { font-size: 0.8rem; color: var(--accent); letter-spacing: 0.15em; }
.section-head h2 {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(2rem, 4.5vw, 3.4rem); letter-spacing: -0.01em;
}
.section-lede {
  font-family: var(--font-display); font-style: italic; font-weight: 300;
  font-size: clamp(1.15rem, 2vw, 1.5rem); color: var(--ink-dim);
}

/* Work list */
.work-list { list-style: none; border-top: 1px solid var(--line); }
.work-item { border-bottom: 1px solid var(--line); }
.work-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  align-items: baseline; gap: 1.5rem;
  padding: 1.6rem 0.4rem;
  cursor: pointer;
  transition: padding-left 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.work-row:hover, .work-item.open .work-row { padding-left: 1.4rem; }
.work-year { font-size: 0.85rem; color: var(--ink-dim); }
.work-name {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem); line-height: 1.1;
  transition: color 0.3s;
}
.work-row:hover .work-name, .work-item.open .work-name { color: var(--accent); }
.work-role {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-dim);
}
.work-detail {
  max-height: 0; overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.work-item.open .work-detail { max-height: 220px; }
.work-detail p {
  padding: 0 0.4rem 1.8rem; max-width: 46em;
  color: var(--ink-dim); font-size: 1rem;
}

/* Moments: pinned horizontal gallery (desktop).
   Cards fill the pinned viewport height; the image flexes to
   whatever space the caption leaves, so captions always fit
   on screen while the section scrolls sideways. */
.moments { position: relative; }
.moments-pin {
  height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-start;
  overflow: hidden;
  padding: clamp(4.5rem, 9vh, 6rem) 0 clamp(1.2rem, 3vh, 2rem);
}
.moments-head {
  padding: 0 clamp(1.2rem, 4vw, 3.5rem);
  margin-bottom: clamp(1rem, 3vh, 2rem);
}
.moments-head .section-head { margin-bottom: 0.4rem; }
.moments-head h2 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); }
.moments-head .section-lede { font-size: clamp(1rem, 1.6vw, 1.25rem); }
.moments-track {
  display: flex; align-items: flex-start;
  flex: 1; min-height: 0;
  gap: clamp(1.6rem, 3vw, 3rem);
  padding: 0 clamp(1.2rem, 4vw, 3.5rem);
  width: max-content;
  will-change: transform;
}
/* image height budgets the viewport: 100svh minus header, caption and
   padding chrome; width follows from each card's aspect ratio */
.mcard {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: flex-start;
}
.mcard-img {
  height: clamp(280px, calc(100svh - 460px), 540px);
  width: auto; flex: none;
  overflow: hidden; border-radius: 4px; background: var(--bg-soft);
}
.mcard.is-portrait .mcard-img { aspect-ratio: 4 / 4.4; }
.mcard.is-tall .mcard-img { aspect-ratio: 4 / 5.6; }
.mcard.is-wide .mcard-img { aspect-ratio: 16 / 10; }
.mcard-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: filter 0.7s ease;
  filter: saturate(0.9);
  will-change: transform;
}
.mcard:hover .mcard-img img { filter: saturate(1); }
/* caption takes the image's width without widening the card */
.mcard figcaption {
  flex: 0 0 auto;
  width: 0; min-width: 100%;
  padding: 1rem 0.2rem 0;
}
.moment-tag {
  display: block;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--accent); margin-bottom: 0.4rem;
}
.mcard h3 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.1rem, 1.6vw, 1.45rem); line-height: 1.2;
  margin-bottom: 0.45rem;
}
.mcard p { font-size: 0.88rem; line-height: 1.5; color: var(--ink-dim); }

/* Numbers */
.numbers { padding-top: 2rem; padding-bottom: 2rem; }
.numbers-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.num-cell { padding: 2.6rem 1.5rem; border-right: 1px solid var(--line); }
.num-cell:last-child { border-right: none; }
.num {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(2.2rem, 4.5vw, 3.6rem); color: var(--ink);
  display: block; line-height: 1;
}
.num-label {
  display: block; margin-top: 0.7rem;
  font-size: 0.82rem; color: var(--ink-dim);
  text-transform: uppercase; letter-spacing: 0.1em;
}

/* About */
.about-grid {
  display: grid; grid-template-columns: minmax(260px, 420px) 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.about-photo { overflow: hidden; border-radius: 4px; }
.about-photo img { width: 100%; height: auto; filter: saturate(0.95); }
.about-text .lede {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.35;
  margin-bottom: 1.6rem;
}
.about-text p + p { margin-top: 1.1rem; color: var(--ink-dim); }
.about-facts { margin-top: 2.2rem; border-top: 1px solid var(--line); }
.fact {
  display: flex; flex-direction: column; gap: 0.25rem;
  padding: 1.1rem 0; border-bottom: 1px solid var(--line);
}
.fact-k {
  font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--accent);
}
.fact-v { font-size: 0.95rem; color: var(--ink); }

/* Contact */
.contact { text-align: center; padding-bottom: 6rem; }
.contact-eyebrow {
  text-transform: uppercase; letter-spacing: 0.2em;
  font-size: 0.8rem; color: var(--ink-dim); margin-bottom: 2rem;
}
.contact-big {
  display: inline-block;
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(3rem, 10vw, 8rem); line-height: 1.02;
  letter-spacing: -0.02em;
  transition: color 0.35s;
  will-change: transform;
}
.contact-big em { font-style: italic; color: var(--accent); }
.contact-big:hover { color: var(--accent); }
.contact-big:hover em { color: var(--ink); }
.contact-links { display: flex; justify-content: center; gap: 2.5rem; margin-top: 3rem; }
.contact-links a {
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.15em;
  border-bottom: 1px solid var(--line); padding-bottom: 0.3rem;
  transition: border-color 0.3s, color 0.3s;
  will-change: transform;
}
.contact-links a:hover { color: var(--accent); border-color: var(--accent); }

/* Footer */
.footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.6rem clamp(1.2rem, 4vw, 3.5rem);
  border-top: 1px solid var(--line);
  font-size: 0.8rem; color: var(--ink-dim);
}
.footer a { transition: color 0.3s; }
.footer a:hover { color: var(--accent); }

/* Reveal on scroll */
.reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Mobile: vertical moments, simpler chrome */
@media (max-width: 899px) {
  .moments-pin { height: auto; display: block; overflow: visible; }
  .moments-track {
    display: block; width: auto;
    padding: 0 clamp(1.2rem, 4vw, 3.5rem);
  }
  .mcard { width: auto !important; height: auto; }
  .mcard + .mcard { margin-top: 3rem; }
  .mcard-img { aspect-ratio: auto !important; flex: none; }
  .mcard figcaption { width: auto; min-width: 0; }
}
@media (max-width: 760px) {
  .nav-links { gap: 1.1rem; }
  .nav-links a:nth-child(2) { display: none; }
  .hero { padding-bottom: 4.5rem; }
  .hero-media img { object-position: 62% 35%; }
  .hero-cta { flex-wrap: wrap; }
  .hero-credit { display: none; }
  .scroll-cue { display: none; }
  .work-row { grid-template-columns: 3.4rem 1fr; }
  .work-role { grid-column: 2; font-size: 0.72rem; }
  .numbers-grid { grid-template-columns: 1fr 1fr; }
  .num-cell:nth-child(2) { border-right: none; }
  .num-cell:nth-child(1), .num-cell:nth-child(2) { border-bottom: 1px solid var(--line); }
  .about-grid { grid-template-columns: 1fr; }
  .about-photo { max-width: 340px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .loader { display: none; }
  .cursor-dot, .cursor-ring { display: none !important; }
  .reveal { opacity: 1; transform: none; }
}
