/* Zeyad Sabri — motion & AI design. Dark digital ground, light that glows. */
:root {
  --bg: #04050a;
  --bg-2: #080b16;
  --ink: #eef1ff;
  --muted: #9aa3c4;
  --line: rgba(160, 180, 255, .14);
  --blue: #4d7cff;
  --cyan: #46e0ff;
  --pink: #ff5aa8;
  --soul: #e9f0ff;
  --radius: 14px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --wrap: min(1280px, 100% - 2 * clamp(20px, 4vw, 56px));
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.is-locked { overflow: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.55 var(--font); -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
/* the faint field the hands work in: two cold pools of light and a fine grain of stars */
body::before {
  content: ""; position: fixed; inset: -10vh 0 -20vh; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60vw 50vh at 18% 82%, rgba(255, 90, 168, .07), transparent 70%),
    radial-gradient(55vw 55vh at 85% 12%, rgba(77, 124, 255, .10), transparent 70%),
    radial-gradient(50vw 40vh at 80% 95%, rgba(70, 224, 255, .06), transparent 70%),
    var(--bg);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(220, 230, 255, .55), transparent 60%),
    radial-gradient(1px 1px at 68% 14%, rgba(220, 230, 255, .4), transparent 60%),
    radial-gradient(1px 1px at 42% 64%, rgba(220, 230, 255, .35), transparent 60%),
    radial-gradient(1px 1px at 88% 58%, rgba(220, 230, 255, .45), transparent 60%),
    radial-gradient(1px 1px at 26% 88%, rgba(220, 230, 255, .3), transparent 60%),
    radial-gradient(1px 1px at 57% 36%, rgba(220, 230, 255, .3), transparent 60%);
  background-size: 420px 420px;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.05; }
p { margin: 0; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
.wrap { width: var(--wrap); margin-inline: auto; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
a, button { scroll-margin-top: 96px; scroll-margin-bottom: 24px; }

.skip {
  position: fixed; left: max(clamp(20px, 4vw, 56px), (100vw - 1280px) / 2); top: -60px; z-index: 50; padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-weight: 600; text-decoration: none;
  transition: top .2s var(--ease-out);
}
.skip:focus { top: 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: 999px;
  font: 600 15px/1 var(--font); letter-spacing: .01em; text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: transform .16s var(--ease-out), background-color .2s ease, border-color .2s ease, box-shadow .25s ease;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--ink); color: var(--bg); box-shadow: 0 0 0 0 rgba(120, 160, 255, 0); }
.btn--ghost { background: rgba(255, 255, 255, .03); color: var(--ink); border-color: var(--line); }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 14px max(clamp(20px, 4vw, 56px), (100vw - 1280px) / 2);
  background: rgba(4, 5, 10, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(160, 180, 255, .08);
}
.nav__mark { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; text-decoration: none; min-height: 44px; }
.nav__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--soul); box-shadow: 0 0 12px 3px rgba(200, 220, 255, .7); }
.nav nav { display: flex; gap: 4px; margin-left: auto; }
.nav nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--muted); text-decoration: none; font-size: 15px; transition: color .2s ease; }
.nav__cta { min-height: 44px; padding: 0 18px; }

/* ---------- the hands ---------- */
.stage { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.hand {
  position: absolute; left: 0; top: 0; width: var(--s, 480px); height: var(--s, 480px);
  background-repeat: no-repeat; background-size: 1200% 100%; background-position: 0 0;
  mix-blend-mode: screen; transform-origin: 50% 86%; will-change: transform, background-position;
  opacity: 0;
  /* the frame's edges fade to nothing, so no square ever shows round a hand */
  -webkit-mask-image: radial-gradient(62% 56% at 50% 46%, #000 60%, transparent 100%);
  mask-image: radial-gradient(62% 56% at 50% 46%, #000 60%, transparent 100%);
}
.hand--human { background-image: url(media/hands/human.webp); }
.hand--soul { background-image: url(media/hands/soul.webp); }
.hand--machine { background-image: url(media/hands/machine.webp); }
.stage.is-ready .hand { opacity: 1; transition: opacity .9s ease; }
.stage.is-ready.is-away .hand, .stage.is-ready.is-away .orb { opacity: 0; transition: opacity .45s ease; }
.orb {
  position: absolute; left: 0; top: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 18px 6px rgba(210, 225, 255, .9), 0 0 60px 18px rgba(110, 150, 255, .45);
  opacity: 0; transition: opacity .6s ease; will-change: transform;
}
.stage.is-ready .orb { opacity: 1; }

/* ---------- hero ---------- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: grid; align-items: center; padding: 120px 0 96px; }
.hero__inner { position: relative; z-index: 6; }
.hero-text { display: grid; justify-items: center; text-align: center; gap: 22px; }
.eyebrow { color: var(--muted); font-size: 13px; letter-spacing: .22em; text-transform: uppercase; }
.hero h1 { max-width: 13ch; font-size: clamp(2.7rem, 7.2vw, 6.4rem); line-height: .98; letter-spacing: -.035em; }
.hero h1 em { color: inherit; text-shadow: 0 0 34px rgba(120, 160, 255, .55); }
.hero__sub { max-width: 46ch; color: var(--muted); font-size: clamp(1rem, 1.3vw, 1.15rem); }
.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 6px; }
.hero__hint { margin-top: 10px; color: #8f98bb; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }

/* hero entrance, once on load */
html.m-enter [data-enter] .hero-text > * { opacity: 0; transform: translateY(18px); }
html.m-enter.is-in [data-enter] .hero-text > * {
  opacity: 1; transform: none;
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}
html.m-enter.is-in [data-enter] .hero-text > :nth-child(2) { transition-delay: .08s; }
html.m-enter.is-in [data-enter] .hero-text > :nth-child(3) { transition-delay: .16s; }
html.m-enter.is-in [data-enter] .hero-text > :nth-child(4) { transition-delay: .24s; }

/* ---------- sections ---------- */
main > section:not(.hero) { position: relative; z-index: 6; padding: clamp(88px, 11vh, 128px) 0; min-height: calc(var(--h, 1) * 100svh); }
.head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 48px; align-items: end; margin-bottom: clamp(28px, 4vh, 48px); }
.head h2 { font-size: clamp(2rem, 4vw, 3.4rem); max-width: 16ch; }
.head p { color: var(--muted); max-width: 44ch; justify-self: end; }

/* ---------- work grid ---------- */
main > section.work { padding: 78px 0 44px; }
.work .head { margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(12px, 1.4vw, 20px); }
.card {
  position: relative; grid-column: span 2; display: block; padding: 0; border: 0; cursor: pointer;
  border-radius: var(--radius); overflow: hidden; background: var(--bg-2); color: var(--ink); text-align: left;
  aspect-ratio: 4 / 5; isolation: isolate;
  box-shadow: 0 0 0 1px var(--line);
  transition: transform .3s var(--ease-out), box-shadow .3s ease;
}
.card--wide { grid-column: span 6; aspect-ratio: 16 / 9; }
.card img, .card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card img { transition: transform .5s var(--ease-out); }
.card video { opacity: 0; transition: opacity .35s ease; }
.card.is-playing video { opacity: 1; }
.card__label {
  position: absolute; inset: auto 0 0; z-index: 2; display: grid; gap: 2px; padding: 10px 14px 11px;
  background: rgba(4, 5, 10, .94); border-top: 1px solid rgba(160, 180, 255, .1);
}
.card__label strong { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.card__label span { color: #b4bcdb; font-size: 12.5px; }
.card:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.card.is-taken { visibility: hidden; }
.card:active { transform: scale(.985); }

/* a copy of the card that the hand carries to the middle */
.carry {
  position: fixed; z-index: 40; border-radius: var(--radius); overflow: hidden; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(200, 215, 255, .25), 0 30px 120px rgba(80, 120, 255, .35);
}
.carry img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- three hands section ---------- */
.trio { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); }
.trio__item { display: grid; gap: 12px; align-content: start; padding: 18px 18px 24px; border-radius: var(--radius); background: rgba(255, 255, 255, .02); box-shadow: 0 0 0 1px var(--line); }
.trio__art { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #000; }
.sprite {
  position: absolute; inset: 0; background-repeat: no-repeat; background-size: 1200% 100%;
  background-position: 0 0; animation: reach 3.2s steps(1) infinite;
}
.sprite[data-sprite="human"] { background-image: url(media/hands/human.webp); }
.sprite[data-sprite="soul"] { background-image: url(media/hands/soul.webp); animation-delay: -1.06s; }
.sprite[data-sprite="machine"] { background-image: url(media/hands/machine.webp); animation-delay: -2.13s; }
.trio__item h3 { font-size: clamp(1.2rem, 1.6vw, 1.45rem); margin-top: 6px; }
.trio__item p { color: var(--muted); }
.trio__item--human h3 { color: #ffd3e7; }
.trio__item--machine h3 { color: #c6f4ff; }
/* each hand reaches and settles back, on a loop */
@keyframes reach {
  0% { background-position: 0% 0; } 4% { background-position: 9.09% 0; } 8% { background-position: 18.18% 0; }
  12% { background-position: 27.27% 0; } 16% { background-position: 36.36% 0; } 20% { background-position: 45.45% 0; }
  24% { background-position: 54.54% 0; } 28% { background-position: 63.63% 0; } 32% { background-position: 72.72% 0; }
  36% { background-position: 81.81% 0; } 40% { background-position: 90.9% 0; } 44% { background-position: 100% 0; }
  70% { background-position: 90.9% 0; } 73% { background-position: 72.72% 0; } 76% { background-position: 54.54% 0; }
  79% { background-position: 36.36% 0; } 82% { background-position: 18.18% 0; } 85%, 100% { background-position: 0% 0; }
}

/* ---------- contact ---------- */
.contact { display: block; }
.contact__inner { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; row-gap: 32px; align-items: center; }
.contact__text { grid-column: 1 / 7; }
.contact__art { grid-column: 7 / 13; }
.contact__foot { grid-column: 1 / -1; color: var(--muted); font-size: 13.5px; padding-top: 8px; }
.contact__text { display: grid; justify-items: start; gap: 20px; }
.contact h2 { font-size: clamp(2rem, 4vw, 3.4rem); max-width: 14ch; }
.contact__text p { color: var(--muted); max-width: 40ch; }
.contact__links { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.contact__links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: #b4bcdb; transition: color .2s ease, border-color .2s ease; }
.contact__art { width: 100%; height: auto; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--line); }

/* ---------- footer ---------- */
.closing { position: relative; z-index: 6; border-top: 1px solid var(--line); padding: 26px 0 34px; color: var(--muted); font-size: 13.5px; }
.closing__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; }

/* ---------- viewer ---------- */
.viewer {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: transparent; color: var(--ink); overflow: hidden;
}
.viewer::backdrop { background: rgba(2, 3, 8, .86); backdrop-filter: blur(6px); }
.viewer__frame {
  position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(16px, 2.4vw, 40px); padding: clamp(56px, 7vh, 80px) clamp(16px, 3vw, 48px) clamp(20px, 4vh, 48px);
}
.viewer__stage { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; }
/* the film always fits inside the stage, tall or wide */
.viewer__stage video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent;
  opacity: 0; transition: opacity .3s ease;
}
.viewer.is-shown .viewer__stage video { opacity: 1; }
.viewer__info { align-self: center; display: grid; gap: 12px; align-content: center; }
.viewer__client { color: var(--cyan); font-size: 13px; letter-spacing: .16em; text-transform: uppercase; }
.viewer__title { font-size: clamp(1.8rem, 2.6vw, 2.6rem); }
.viewer__meta { color: var(--muted); font-size: 14px; }
.viewer__text { color: #c7cde6; }
.viewer__nav { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.viewer__copy { justify-self: start; min-height: 44px; padding: 0; border: 0; background: none; color: var(--muted); font: 500 14px var(--font); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.viewer__close {
  position: absolute; top: 14px; right: clamp(16px, 3vw, 48px); min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--ink);
  font: 600 14px var(--font); cursor: pointer; transition: transform .16s var(--ease-out), background-color .2s ease;
}
.viewer__close:active { transform: scale(.96); }

/* ---------- pointer devices only: hover ---------- */
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { box-shadow: 0 0 34px 4px rgba(120, 160, 255, .45); transform: translateY(-1px); }
  .btn--ghost:hover { border-color: rgba(200, 215, 255, .45); background: rgba(255, 255, 255, .07); transform: translateY(-1px); }
  .btn:active { transform: scale(.97); }
  .nav nav a:hover { color: var(--ink); }
  .card:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(200, 215, 255, .35), 0 18px 60px rgba(70, 110, 255, .22); }
  .card:hover img { transform: scale(1.03); }
  .contact__links a:hover { color: var(--ink); border-color: rgba(200, 215, 255, .45); }
  .viewer__copy:hover, .viewer__close:hover { color: var(--ink); background-color: rgba(255, 255, 255, .08); }
}

/* ---------- tablet and phone ---------- */
@media (max-width: 1024px) {
  .card { grid-column: span 4; }
  .card--wide { grid-column: span 12; }
  .head { grid-template-columns: minmax(0, 1fr); }
  .head p { justify-self: start; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav nav { display: none; }
  .nav__cta { margin-left: auto; }
  .card { grid-column: span 6; }
  .trio { grid-template-columns: minmax(0, 1fr); }
  .contact__text, .contact__art, .contact__foot { grid-column: 1 / -1; }
  .trio__item { grid-template-columns: 120px minmax(0, 1fr); column-gap: 16px; align-items: center; }
  .trio__art { grid-row: span 2; }
  .trio__item h3 { margin-top: 0; }
  .hero__actions { width: 100%; flex-direction: column; }
  .hero__actions .btn { width: 100%; }
  .viewer__frame { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; padding: 64px 14px 18px; }
  .viewer__info { max-height: 38dvh; overflow: auto; }
}

@media (hover: none) { .hero__hint { display: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  html.m-enter [data-enter] .hero-text > * { opacity: 1; transform: none; }
}
