/* ============================================================
   SAMI TAWIL — 3D/VFX   ·   "render-farm brutalism"
   All design tokens live here. No hardcoded values below the fold.
   ============================================================ */

:root {
  --bg:        #0B0B0C;
  --bg-2:      #101012;
  --ink:       #F2F2EF;
  --muted:     #85857E;
  --acid:      #D9FF3F;
  --line:      #232325;

  --font-disp: 'Clash Display', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --pad: clamp(20px, 4vw, 64px);
  --gap: clamp(14px, 2vw, 28px);

  --mega:  clamp(72px, 17vw, 280px);
  --big:   clamp(44px, 9vw, 140px);
  --mid:   clamp(24px, 3.4vw, 48px);
  --body:  clamp(15px, 1.15vw, 18px);
  --tiny:  clamp(10px, 0.78vw, 12px);

  --ease:  cubic-bezier(.65, .05, 0, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-disp);
  font-size: var(--body);
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; }
.mono { font-family: var(--font-mono); font-size: var(--tiny); letter-spacing: .14em; }
.acid { color: var(--acid); }

/* outline ("ghost") display text */
.ghost {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
}

::selection { background: var(--acid); color: var(--bg); }

/* ---------------- grain ---------------- */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none; z-index: 2000;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); } 25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); } 75% { transform: translate(-1%, 2%); }
  100% { transform: translate(2%, -1%); }
}

/* ---------------- cursor ---------------- */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 3000;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--acid);
  pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  transition: width .3s var(--ease), height .3s var(--ease), background-color .2s;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
.cursor span {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  color: var(--bg); opacity: 0; white-space: nowrap; transition: opacity .2s;
}
.cursor.is-play { width: 76px; height: 76px; mix-blend-mode: normal; }
.cursor.is-play span { opacity: 1; }
@media (pointer: coarse) { .cursor { display: none; } }

/* ---------------- preloader: full-page acid flood ----------------
   --p (0% -> 100%) drives a bottom-up clip on the acid layer AND on a
   duplicate dark-text layer, so the type flips color as the flood passes. */
.loader {
  position: fixed; inset: 0; z-index: 5000;
  background: var(--bg);
  --p: 0%;
}
.loader-layer {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-end;
  padding: var(--pad);
}
.loader-acid {
  position: absolute; inset: 0;
  background: var(--acid);
  clip-path: inset(calc(100% - var(--p)) 0 0 0);
}
.loader-layer.flood {
  clip-path: inset(calc(100% - var(--p)) 0 0 0);
}
.loader-layer.flood .loader-name,
.loader-layer.flood .loader-count { color: var(--bg); }
.loader-name {
  font-size: var(--mid); font-weight: 600; letter-spacing: .02em;
}
.loader-count {
  position: absolute; right: var(--pad); bottom: var(--pad);
  font-family: var(--font-mono);
  font-size: var(--big); font-weight: 400; line-height: 1;
  color: var(--acid);
}

/* ---------------- nav ---------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--pad);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.nav-logo { font-weight: 700; font-size: 18px; letter-spacing: .04em; }
.nav-links { display: flex; gap: clamp(16px, 2.4vw, 40px); }
.nav-links a {
  font-family: var(--font-mono); font-size: var(--tiny); letter-spacing: .14em;
  position: relative; padding: 4px 0;
}
.nav-links a::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform .35s var(--ease);
}
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-home {
  font-family: var(--font-mono); font-size: var(--tiny); letter-spacing: .14em;
  border: 1px solid var(--acid); border-radius: 999px; padding: 8px 16px;
  color: var(--acid);
  transition: background-color .25s, color .25s;
}
.nav-home:hover { background: var(--acid); color: var(--bg); }
.nav-meta { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: var(--tiny); letter-spacing: .14em; }
.nav-meta .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------------- burger + full-screen mobile menu ---------------- */
.burger {
  display: none;
  position: relative; z-index: 1002;
  width: 44px; height: 44px; margin-right: -8px;
  flex-direction: column; align-items: center; justify-content: center; gap: 7px;
}
.burger span {
  display: block; width: 26px; height: 2px; background: var(--ink);
  transition: transform .35s var(--ease), background-color .25s;
}
body.menu-open .burger span:first-child { transform: translateY(4.5px) rotate(45deg); background: var(--acid); }
body.menu-open .burger span:last-child  { transform: translateY(-4.5px) rotate(-45deg); background: var(--acid); }

.mobimenu {
  position: fixed; inset: 0; z-index: 1001;
  background: var(--bg);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 96px 7vw 28px;
  opacity: 0; visibility: hidden;
  transition: opacity .35s ease, visibility .35s;
}
body.menu-open .mobimenu { opacity: 1; visibility: visible; }
.mobimenu-links { display: flex; flex-direction: column; }
.mobimenu-links a {
  display: flex; align-items: baseline; gap: 16px;
  font-family: var(--font-disp); font-weight: 600;
  font-size: clamp(36px, 11vw, 56px); line-height: 1;
  text-transform: uppercase; letter-spacing: -0.01em;
  padding: 4vw 0;
  border-bottom: 1px solid var(--line);
  opacity: 0; transform: translateY(28px);
  transition: opacity .45s ease, transform .45s var(--ease);
}
body.menu-open .mobimenu-links a { opacity: 1; transform: translateY(0); }
body.menu-open .mobimenu-links a:nth-child(1) { transition-delay: .08s; }
body.menu-open .mobimenu-links a:nth-child(2) { transition-delay: .14s; }
body.menu-open .mobimenu-links a:nth-child(3) { transition-delay: .20s; }
body.menu-open .mobimenu-links a:nth-child(4) { transition-delay: .26s; }
body.menu-open .mobimenu-links a:nth-child(5) { transition-delay: .32s; }
.mobimenu-links .num { font-size: 11px; color: var(--acid); letter-spacing: .1em; }
.mobimenu-foot {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted);
}
.mobimenu-foot a { color: var(--ink); }
body.menu-open { overflow: hidden; }
body.menu-open .nav { z-index: 1002; }   /* keep the bar (and the ✕) above the overlay */

/* ---------------- hero ---------------- */
.hero {
  position: relative; height: 100svh; min-height: 560px;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: var(--pad);
  overflow: hidden;
}
.hero-media { position: absolute; inset: 0; overflow: hidden; }
.hero-media video {
  position: absolute; left: 0; top: -20%;
  width: 100%; height: 120%;          /* headroom so the parallax never exposes an edge */
  object-fit: cover;
  filter: saturate(.92) contrast(1.04);
}
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11,11,12,.55) 0%, rgba(11,11,12,.18) 38%, rgba(11,11,12,.82) 100%);
}
.hero-kicker {
  position: relative; z-index: 2; color: var(--acid); margin-bottom: 14px;
}
.hero-title {
  position: relative; z-index: 2;
  font-size: var(--mega); font-weight: 600;
  line-height: .86; letter-spacing: -0.02em;
  text-transform: uppercase;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .word { display: inline-block; will-change: transform; }
/* hero stays hidden until the loader has swiped away; the title words are
   pre-hidden by gsap.set in app.js (CSS transform would fight gsap's yPercent) */
.hero-kicker, .hero-meta > div, .hero-scroll { opacity: 0; visibility: hidden; }
.hero-title .ghost { -webkit-text-stroke: 2px var(--ink); }
.hero-title .sup { font-size: .18em; vertical-align: super; -webkit-text-stroke: 0; margin-left: .25em; }
.hero-meta {
  position: relative; z-index: 2;
  display: flex; gap: clamp(24px, 6vw, 96px);
  margin-top: clamp(18px, 3vh, 36px);
  color: var(--muted); line-height: 1.7;
}
.hero-scroll {
  position: absolute; right: var(--pad); bottom: var(--pad); z-index: 2;
  display: flex; align-items: center; gap: 10px; color: var(--ink);
}
.hero-scroll .arr { display: inline-block; animation: bob 1.6s var(--ease) infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

/* ---------------- marquee ---------------- */
.marquee {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  overflow: hidden; white-space: nowrap;
  padding: clamp(10px, 1.4vh, 18px) 0;
  background: var(--bg);
}
.marquee-track { display: inline-flex; will-change: transform; }
.marquee-track span {
  font-size: var(--mid); font-weight: 500; text-transform: uppercase;
  letter-spacing: .01em; padding-right: .8em;
}
.marquee-track span i { font-style: normal; color: var(--acid); padding-right: .8em; }
.marquee-track .ghost { -webkit-text-stroke: 1px var(--ink); }

/* ---------------- work sections ---------------- */
/* Koto-style wall: full-bleed 2-col grid, 8px gutters, mixed tile ratios,
   masonry placement done in JS (column + row-start + row-span on 8px rows). */
.work { padding: clamp(60px, 10vh, 140px) 0; }
.sec-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: clamp(28px, 5vh, 64px);
  padding: 0 var(--pad);
}
.sec-title {
  font-size: var(--big); font-weight: 600; line-height: .9;
  text-transform: uppercase; letter-spacing: -0.015em;
}
.sec-title .ghost { -webkit-text-stroke-color: var(--acid); }
.sec-count {
  font-size: var(--mid); color: var(--acid); line-height: 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  grid-auto-rows: 8px;       /* fine row unit — JS spans tiles across it */
  align-items: start;        /* items size to content, not to the 8px track */
}
@media (min-width: 1600px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
.card { position: relative; cursor: pointer; }

.card-frame {
  position: relative; overflow: hidden; background: var(--bg-2);
  aspect-ratio: var(--ar, 16 / 9);   /* per-tile ratio set inline by app.js */
}
/* media lives in a bleeding wrapper that parallax-drifts inside the frame */
.frame-media {
  position: absolute; left: 0; right: 0; top: -7%; bottom: -7%;
  will-change: transform;
}
.frame-media img, .frame-media video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  transition: scale .8s var(--ease), opacity .4s;   /* scale prop — composes with gsap transform */
}
.frame-media video { opacity: 0; }
.card.playing .frame-media video { opacity: 1; }
.card.playing .frame-media img { opacity: 0; }
.card:hover .frame-media img, .card:hover .frame-media video { scale: 1.045; }
.card-frame::after {
  content: ''; position: absolute; inset: 0;
  border: 0 solid var(--acid);
  transition: border-width .25s var(--ease);
  pointer-events: none;
}
.card:hover .card-frame::after { border-width: 2px; }

.card-meta {
  display: flex; align-items: baseline; gap: 12px;
  padding: 12px 12px 18px;
}
.card-idx { font-family: var(--font-mono); font-size: var(--tiny); color: var(--acid); letter-spacing: .1em; }
.card-title {
  font-size: clamp(16px, 1.6vw, 24px); font-weight: 500;
  text-transform: uppercase; letter-spacing: .01em;
  flex: 1; min-width: 0;
}
.card-desc {
  font-family: var(--font-mono); font-size: var(--tiny);
  color: var(--muted); letter-spacing: .08em;
  text-align: right; max-width: 38%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------------- about ---------------- */
.about {
  border-top: 1px solid var(--line);
  padding: clamp(80px, 14vh, 180px) var(--pad);
}
.about-statement {
  font-size: var(--big); font-weight: 600; line-height: .95;
  text-transform: uppercase; letter-spacing: -0.015em;
  max-width: 14ch;
  margin-bottom: clamp(48px, 8vh, 110px);
}
.about-cols {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr;
  gap: clamp(28px, 4vw, 72px);
}
.about-label { color: var(--acid); margin-bottom: 18px; }
.about-block p { color: var(--muted); line-height: 1.75; max-width: 44ch; }
.about-block p.about-lead {
  color: var(--ink);
  font-size: clamp(20px, 1.75vw, 30px);
  font-weight: 400; line-height: 1.5;
  letter-spacing: .005em;
  max-width: 34ch;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-family: var(--font-mono); font-size: clamp(13px, 1vw, 16px); letter-spacing: .06em;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 18px; color: var(--ink);
  transition: border-color .25s, color .25s;
}
.chips li:hover { border-color: var(--acid); color: var(--acid); }
.ghost-chips li { color: var(--muted); }

/* ---------------- contact ---------------- */
.contact {
  border-top: 1px solid var(--line);
  padding: clamp(80px, 14vh, 160px) var(--pad) clamp(28px, 4vh, 48px);
}
.contact-label { color: var(--muted); margin-bottom: 20px; }
.contact-mega {
  display: inline-block;
  font-size: var(--mega); font-weight: 600; line-height: .86;
  text-transform: uppercase; letter-spacing: -0.02em;
}
.contact-mega .line { display: block; overflow: hidden; }
.contact-mega .word { display: inline-block; transition: color .3s; }
.contact-mega:hover .word { color: var(--acid); }
.contact-mega:hover .ghost { -webkit-text-stroke-color: var(--acid); color: transparent; }
.contact-foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: clamp(48px, 8vh, 100px); padding-top: 22px;
}
.contact-foot a:hover { color: var(--acid); }

/* ---------------- lightbox ---------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(11, 11, 12, .96);
  display: flex; flex-direction: column;
  padding: var(--pad);
  opacity: 0; visibility: hidden;
  transition: opacity .35s, visibility .35s;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lb-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 18px; }
.lb-info { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.lb-index { color: var(--acid); }
.lb-title { font-size: var(--mid); font-weight: 600; text-transform: uppercase; line-height: 1; }
.lb-desc { color: var(--muted); }
.lb-close { letter-spacing: .14em; padding: 6px 0; }
.lb-close:hover, .lb-nav button:hover { color: var(--acid); }
#lb-video { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; }
.lb-nav { display: flex; justify-content: space-between; padding-top: 18px; }
.lb-nav button { letter-spacing: .14em; padding: 6px 0; }

/* ---------------- reveals (GSAP sets initial state via .reveal) ---------------- */
.reveal { opacity: 0; }

/* ---------------- mobile ---------------- */
@media (max-width: 820px) {
  .nav { padding: 14px 5vw; }
  .nav-meta, .nav-home { display: none; }
  .nav-links { display: none; }
  .burger { display: flex; }

  .hero { padding: 5vw; }
  .hero-meta { flex-direction: column; gap: 10px; }
  .hero-scroll { display: none; }

  .work { padding: 64px 0; }
  .sec-head { padding: 0 5vw; }
  .grid { grid-template-columns: 1fr; grid-auto-rows: auto; gap: 26px; }
  .card-desc { display: none; }

  .about { padding: 80px 5vw; }
  .about-cols { grid-template-columns: 1fr; gap: 40px; }

  .contact { padding: 80px 5vw 24px; }
  .contact-foot { flex-direction: column; gap: 8px; }

  .lightbox { padding: 5vw; }
  .lb-title { font-size: 22px; }
}
