/* ghaith vfx — design tokens + components.
   Every visual value lives here as a token. Never hardcode a colour,
   size or duration in a template. */

:root {
  /* ink / paper */
  --paper: #fafaf9;
  --ink: #0c0c0d;
  --muted: #6e6e73;
  --dim: #8a8a8e;
  --rule-on-paper: rgba(12, 12, 13, 0.1);
  --rule-on-ink: rgba(255, 255, 255, 0.12);

  /* type */
  --font-sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Consolas, monospace;

  --step--1: 0.75rem;
  --step-0: 1rem;
  --step-1: clamp(1.05rem, 0.98rem + 0.35vw, 1.25rem);
  --step-2: clamp(1.5rem, 1.25rem + 1.2vw, 2.5rem);
  --step-3: clamp(2.25rem, 1.6rem + 3.2vw, 4rem);
  --step-4: clamp(3rem, 1.8rem + 6vw, 5.75rem);

  --track-label: 0.16em;
  --track-tight: -0.04em;

  /* space */
  --gutter: clamp(1.25rem, 0.7rem + 2.6vw, 4rem);
  --section-y: clamp(4.5rem, 3rem + 7vw, 9rem);
  --stack: clamp(1.5rem, 1rem + 2vw, 2.75rem);

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-slow: 0.9s;
  --dur-mid: 0.6s;
  --dur-fast: 0.3s;

  --nav-h: 4.5rem;
  --maxw: 96rem;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; height: auto; }
figure { margin: 0; }
h1, h2, h3, p { margin: 0; }

a { color: inherit; text-decoration: none; transition: opacity var(--dur-fast) ease; }
a:hover { opacity: 0.6; }
a:focus-visible, button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: var(--track-label);
}

.wrap { padding-inline: var(--gutter); max-width: var(--maxw); margin-inline: auto; }

/* ---------- inverted sections ---------- */
.ink {
  background: var(--ink);
  color: var(--paper);
  --rule: var(--rule-on-ink);
}
.paper {
  background: var(--paper);
  color: var(--ink);
  --rule: var(--rule-on-paper);
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gutter);
  height: var(--nav-h);
  padding-inline: var(--gutter);
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, currentColor 0%, var(--nav-bg, var(--paper)) 88%);
  backdrop-filter: saturate(1.4) blur(14px);
}
.ink .nav, .nav.ink { --nav-bg: var(--ink); }
.nav__links { display: flex; gap: clamp(1.25rem, 0.6rem + 2vw, 2.5rem); }
.nav__links a[aria-current='page'] { opacity: 0.45; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: clip;
  min-height: min(82svh, 46rem);
  display: grid;
  place-items: center;
  position: relative;
  text-align: center;
  padding: var(--section-y) var(--gutter);
}
.hero__tag { margin-top: clamp(1.75rem, 1rem + 2vw, 2.75rem); color: var(--muted); }

.cue {
  position: absolute;
  bottom: clamp(1.5rem, 1rem + 2vw, 3rem);
  left: 50%;
  width: 1px;
  height: 3.25rem;
  background: currentColor;
  animation: cue 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes cue {
  0%   { transform: scaleY(0); transform-origin: top; }
  45%  { transform: scaleY(1); transform-origin: top; }
  55%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- section headings ---------- */
.section { padding-block: var(--section-y); }
.display {
  font-size: var(--step-4);
  font-weight: 500;
  letter-spacing: var(--track-tight);
  line-height: 1;
}
.display--sm { font-size: var(--step-3); }

/* ---------- poster wall ---------- */
.wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 0.6rem + 2vw, 2.25rem) clamp(1rem, 0.5rem + 1.4vw, 1.75rem);
  margin-top: clamp(2.5rem, 1.5rem + 4vw, 5.5rem);
}
@media (min-width: 40rem) { .wall { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .wall { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 90rem) { .wall { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile { display: block; }
.tile__frame {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  background: color-mix(in srgb, currentColor 8%, transparent);
}
.tile__frame picture { display: block; height: 100%; }
.tile__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.02);
  transform: scale(1.001);
  transition: filter var(--dur-mid) ease, transform var(--dur-slow) var(--ease);
}
.tile:hover .tile__frame img,
.tile:focus-visible .tile__frame img,
.tile.is-lit .tile__frame img {
  filter: grayscale(0) contrast(1);
  transform: scale(1.04);
}
.tile__meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.9rem;
}
.tile__title { font-size: var(--step-1); font-weight: 500; }
a.tile:hover { opacity: 1; }

/* ---------- the mark ----------
   23 centre-line strokes reconstructed from the final artwork, each one module
   wide, every bend a quarter turn of the same radius. Stroking them reproduces
   the filled master files exactly. Two inks, each carrying a gradient across the
   whole mark so tone comes from where a stroke sits. The hero draws itself once
   on arrival — the bowls open first, then outward — and then rests.

   Hover is a light passing over the mark, not a scan line: a second copy of the
   strokes fades up and down in that same outward order. It is opacity only —
   a dashed twin cut a notch out of the circular bowls. */
.logo {
  display: block;
  /* the box includes one module of clear space on every side, so the mark
     can never touch an edge. Sizes below are the BOX, not the mark. */
  aspect-ratio: 1883.24 / 2477.62;

  /* The brand colourway, from the identity manual: magenta is the primary ink,
     deep the secondary. Each carries a short gradient so the mark has depth
     rather than reading as flat vinyl — near the bowls, then the far corner. */
  --g0a: #d4145a;   /* magenta, near the bowls */
  --g0b: #b30b4b;   /* magenta, far corner     */
  --g1a: #a00041;   /* deep, near              */
  --g1b: #7d0033;   /* deep, far               */
  --lift: #ff6ba0;  /* the light that passes over it */
}
/* On ink grounds the manual calls for the white cut. */
.ink .logo {
  --g0a: #ffffff;
  --g0b: #e6e6e8;
  --g1a: #c1c1c1;
  --g1b: #9a9aa0;
  --lift: #d4145a;
}

.logo svg { width: 100%; height: auto; display: block; }
.logo path { fill: none; stroke-linecap: butt; stroke-linejoin: miter; }

.logo .gs0 .a { stop-color: var(--g0a); }
.logo .gs0 .b { stop-color: var(--g0b); }
.logo .gs1 .a { stop-color: var(--g1a); }
.logo .gs1 .b { stop-color: var(--g1b); }

.logo .logo__lift path { stroke: var(--lift); opacity: 0; }

@keyframes logo-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes logo-lift {
  0%   { opacity: 0; }
  38%  { opacity: .58; }
  100% { opacity: 0; }
}

.logo--intro .logo__base path {
  stroke-dasharray: 1;
  animation: logo-draw calc(var(--dur) * 1ms) cubic-bezier(.62, 0, .32, 1) calc(var(--d) * 1ms) both;
}

.logo:hover .logo__lift path,
.logo:focus-visible .logo__lift path {
  animation: logo-lift 900ms cubic-bezier(.4, 0, .3, 1) calc(var(--d) * 1ms * 0.5) 1 both;
}

@media (prefers-reduced-motion: reduce) {
  .logo--intro .logo__base path { animation: none; stroke-dasharray: none; }
  .logo:hover .logo__lift path, .logo:focus-visible .logo__lift path { animation: none; }
}

/* Sizes are the BOX, and the box carries one module of clear space each side,
   so the mark itself is 84.4% of the width set here. The identity manual puts
   the mark's floor at 24px — below that the module drops under two pixels and
   the VFX row closes up — which makes 1.78rem the smallest legal box. */
.nav__logo { width: 1.85rem; }
.hero__logo { width: clamp(8.6rem, 5.9rem + 11.3vw, 12.45rem); }
.hero > * { z-index: 1; }
.hero::before {
  content: '';
  position: absolute;
  inset: -8%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 36% at 26% 18%, rgba(96, 100, 130, .10), rgba(96, 100, 130, 0) 66%),
    radial-gradient(36% 32% at 78% 34%, rgba(136, 110, 122, .07), rgba(136, 110, 122, 0) 64%),
    radial-gradient(54% 44% at 50% 92%, rgba(88, 100, 126, .085), rgba(88, 100, 126, 0) 70%);
  animation: ambient 54s ease-in-out infinite alternate;
}
.footer__logo { width: 1.85rem; }

/* ---------- ambient light ----------
   Every full-width band carries a few very low-contrast radial washes, offset
   from each other so the light never reads as a straight ramp, and drifting on
   a minute-long cycle. It is felt rather than seen. */
section.paper, section.ink { position: relative; isolation: isolate; overflow: clip; }
section.paper > *, section.ink > * { position: relative; z-index: 1; }
section.paper::before, section.ink::before {
  content: '';
  position: absolute;
  inset: -10% -5%;
  z-index: 0;
  pointer-events: none;
  animation: ambient 54s ease-in-out infinite alternate;
}
section.paper::before {
  background:
    radial-gradient(46% 38% at 14% 10%, rgba(96, 100, 130, .085), rgba(96, 100, 130, 0) 68%),
    radial-gradient(38% 34% at 88% 26%, rgba(132, 108, 118, .062), rgba(132, 108, 118, 0) 66%),
    radial-gradient(56% 46% at 62% 96%, rgba(88, 100, 126, .072), rgba(88, 100, 126, 0) 70%);
}
section.ink::before {
  background:
    radial-gradient(48% 40% at 82% 8%, rgba(150, 158, 200, .10), rgba(150, 158, 200, 0) 68%),
    radial-gradient(40% 36% at 10% 40%, rgba(190, 150, 165, .062), rgba(190, 150, 165, 0) 66%),
    radial-gradient(60% 48% at 46% 100%, rgba(130, 145, 190, .085), rgba(130, 145, 190, 0) 70%);
}
@keyframes ambient {
  from { transform: translate3d(-1.6%, -1.2%, 0) scale(1.04); }
  to   { transform: translate3d(1.8%, 1.6%, 0) scale(1.10); }
}
@media (prefers-reduced-motion: reduce) {
  section.paper::before, section.ink::before { animation: none; }
}

/* A fine grain over the washes. Very low-contrast gradients band into visible
   rings on 8-bit screens; the noise dithers them away and gives the ground a
   little tooth. */
section.paper::after, section.ink::after, .hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,<svg%20xmlns='http://www.w3.org/2000/svg'%20width='180'%20height='180'><filter%20id='n'><feTurbulence%20type='fractalNoise'%20baseFrequency='0.9'%20numOctaves='4'%20stitchTiles='stitch'/><feColorMatrix%20type='saturate'%20values='0'/></filter><rect%20width='180'%20height='180'%20filter='url%28%23n%29'/></svg>");
  background-size: 180px 180px;
}
.ink::after { opacity: .07; }

/* ---------- clients ---------- */
.clients__label { display: block; color: var(--dim); margin-bottom: clamp(2rem, 1.2rem + 3vw, 3.5rem); }
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  width: max-content;
  animation: drift 42s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes drift { to { transform: translateX(-50%); } }
.marquee__group {
  display: flex;
  align-items: center;
  gap: clamp(3rem, 1.8rem + 5vw, 6.5rem);
  padding-right: clamp(3rem, 1.8rem + 5vw, 6.5rem);
}
.marquee__group img {
  height: calc(clamp(3.25rem, 2.4rem + 2.6vw, 5rem) * var(--s, 1));
  width: auto;
  opacity: 0.7;
  transition: opacity var(--dur-mid) ease;
}
.marquee__group img:hover { opacity: 1; }

/* ---------- project page ---------- */
.project {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
  align-items: start;
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem) var(--section-y);
}
@media (min-width: 60rem) {
  .project {
    grid-template-columns: minmax(0, 21rem) minmax(0, 1fr);
    gap: clamp(3rem, 1rem + 6vw, 6rem);
  }
  /* the poster stays with you while the credits scroll */
  .project__art { position: sticky; top: calc(var(--nav-h) + 2rem); }
}
.project__art { width: min(21rem, 100%); }
.project__art img { width: 100%; }

.project__body { display: flex; flex-direction: column; align-items: flex-start; }
.back { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--dim); }
.project__title { margin-top: clamp(1.25rem, 0.8rem + 1.6vw, 2rem); }
.project__sub { margin-top: clamp(0.9rem, 0.6rem + 1vw, 1.4rem); color: var(--dim); }
.project__synopsis {
  margin-top: clamp(1.75rem, 1rem + 2.5vw, 3rem);
  max-width: 44rem;
  font-size: var(--step-1);
}

.credits__list {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 44rem;
  margin-top: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
}
.credits__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem 1.5rem;
  padding-block: clamp(0.9rem, 0.6rem + 0.8vw, 1.4rem);
  border-top: 1px solid var(--rule);
}
.credits__row:last-child { border-bottom: 1px solid var(--rule); }
.credits__val { font-size: var(--step-1); }
.credits__row--me .credits__val { font-weight: 500; }

.next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--stack);
  padding-block: clamp(3rem, 2rem + 4vw, 5rem);
  border-top: 1px solid var(--rule);
}
.next:hover { opacity: 1; }
.next__label { display: block; color: var(--dim); }
.next__title {
  display: inline-flex;
  align-items: center;
  gap: clamp(0.75rem, 0.4rem + 1.2vw, 1.5rem);
  margin-top: 0.75rem;
}
.next__thumb { display: block; width: min(9rem, 40%); overflow: hidden; }
.next__thumb picture { display: block; }
.next__thumb img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  filter: grayscale(1);
  transition: filter var(--dur-mid) ease, transform var(--dur-slow) var(--ease);
}
.next:hover .next__thumb img { filter: grayscale(0); transform: scale(1.04); }

/* ---------- contact ---------- */
.contact { display: flex; flex-direction: column; gap: var(--stack); }
.mail {
  position: relative;
  align-self: flex-start;
  font-size: var(--step-3);
  letter-spacing: -0.03em;
  line-height: 1.1;
  word-break: break-word;
}
.mail::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -0.4rem;
  height: 2px;
  width: 100%;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-mid) var(--ease);
}
.mail:hover { opacity: 1; }
.mail:hover::after, .mail:focus-visible::after { transform: scaleX(1); }

/* ---------- footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem var(--gutter);
  padding: clamp(1.75rem, 1.2rem + 1.6vw, 2.75rem) var(--gutter);
  border-top: 1px solid var(--rule);
}
.footer__meta { color: var(--dim); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(1.25rem); }
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.is-in { opacity: 1; transform: none; transition: none; }
  .cue { animation: none; opacity: 0.5; }
  .marquee__track { animation: none; }
  .tile__frame img, .next__thumb img { transition: filter var(--dur-fast) ease; }
  .tile:hover .tile__frame img, .next:hover .next__thumb img { transform: none; }
}

.imdb {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  align-self: flex-start;
  margin-top: clamp(1.25rem, 0.8rem + 1.4vw, 2rem);
  color: var(--dim);
}
