/* ==========================================================================
   COMPONENTS — hero, frames, project cards, film index, about, contact,
   lightbox, reveal animations
   ========================================================================== */

/* ---------- Hero ---------- */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  display: grid;
  place-items: center;
  overflow: hidden;
  /* No `isolation` / stacking context here: the docked title inside must layer above later sections */
}

.hero__media {
  position: absolute;
  inset: -4% 0;              /* extra height for the parallax drift */
  z-index: -1;
  will-change: transform;
}

.hero__placeholder,
.hero__video,
.hero__shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Placeholder: slow-drifting light over charcoal, until a showreel exists */
.hero__placeholder {
  background:
    radial-gradient(90% 70% at 50% 110%, #16171a 0%, transparent 70%),
    linear-gradient(180deg, #2a2d33 0%, #1f2125 55%, #1a1b1d 100%);
  overflow: hidden;
}

.hero__placeholder::before,
.hero__placeholder::after {
  content: "";
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}

.hero__placeholder::before {
  top: -30vmax;
  left: -12vmax;
  background: radial-gradient(circle, rgba(118, 132, 150, 0.55), transparent 65%);
  animation: drift-a 26s var(--ease-in-out) infinite alternate;
}

.hero__placeholder::after {
  bottom: -38vmax;
  right: -18vmax;
  background: radial-gradient(circle, rgba(158, 124, 92, 0.42), transparent 65%);
  animation: drift-b 32s var(--ease-in-out) infinite alternate;
}

@keyframes drift-a {
  to { transform: translate(18vmax, 10vmax) scale(1.15); }
}
@keyframes drift-b {
  to { transform: translate(-16vmax, -8vmax) scale(1.1); }
}

.hero__video {
  object-fit: cover;
  opacity: 0;
  transition: opacity 2s var(--ease-out);
}

.hero.has-video .hero__video { opacity: 1; }

.hero__shade {
  background:
    linear-gradient(180deg,
      rgba(20, 21, 23, 0.55) 0%,
      rgba(20, 21, 23, 0.1) 35%,
      rgba(20, 21, 23, 0.25) 65%,
      var(--bg) 100%),
    radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(16, 17, 19, 0.55) 100%);
}

.hero__content {
  text-align: center;
  padding-inline: var(--gutter);
  /* Must not get transform / opacity / will-change: that would trap the fixed title inside */
}

[data-hero-sub] { will-change: transform, opacity; }

.hero__title {
  font-size: clamp(2.4rem, 7.6vw, 9rem);
  font-weight: 400;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--fg);
  margin-right: -0.14em;       /* optically re-centre tracked text */
}

.hero__line {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.04em;
}

.hero__line + .hero__line { margin-left: 0.36em; }

.hero__line > span {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 1.6s var(--ease-out);
}

.hero__line + .hero__line > span { transition-delay: 0.1s; }

/* Title → header dock. JS measures the centred layout, then pins each word
   with position: fixed and drives its translate/scale from scroll position. */
.hero__title.is-fixed .hero__line {
  position: fixed;
  top: 0;
  left: 0;
  margin: 0;
  z-index: 60;                  /* above header (50), below the video player (100) */
  transform-origin: 0 0;
  pointer-events: none;
}

.hero__title.is-docked .hero__line {
  pointer-events: auto;
  transition: opacity var(--dur-fast) ease;
}

.hero__title.is-docked .hero__title-link:hover .hero__line { opacity: 0.7; }

.hero__title-link:focus-visible { outline: none; }
.hero__title-link:focus-visible .hero__line { outline: 1px solid var(--fg); outline-offset: 6px; }

.hero__roles {
  max-width: none;
  margin-top: clamp(20px, 2.6vw, 36px);
  font-size: clamp(0.625rem, 0.9vw, 0.8125rem);
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(235, 233, 228, 0.72);
  margin-right: -0.42em;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.4s var(--ease-out) 0.7s, transform 1.4s var(--ease-out) 0.7s;
}

.hero__roles span { margin-inline: 1.1em; color: var(--fg-dim); }

.hero__foot {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 var(--gutter) clamp(28px, 4vw, 48px);
  opacity: 0;
  transition: opacity 1.4s var(--ease-out) 1.2s;
}

.hero__foot .label { color: rgba(235, 233, 228, 0.55); }

.hero__scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-right: -0.28em;
  transition: color var(--dur-fast) ease;
}

.hero__scroll:hover { color: var(--fg); }

.hero__scroll i {
  position: relative;
  display: block;
  width: 1px;
  height: 48px;
  background: rgba(235, 233, 228, 0.18);
  overflow: hidden;
}

.hero__scroll i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fg);
  transform: translateY(-100%);
  animation: scroll-cue 2.6s var(--ease-in-out) infinite;
}

@keyframes scroll-cue {
  0%   { transform: translateY(-100%); }
  50%  { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* Intro sequence, triggered by .is-loaded on <body> */
.hero__media { opacity: 0; transform: scale(1.06); transition: opacity 2.2s var(--ease-out), transform 3s var(--ease-out); }
.is-loaded .hero__media { opacity: 1; transform: none; }
.is-loaded .hero__line > span { transform: none; }
.is-loaded .hero__roles { opacity: 1; transform: none; }
.is-loaded .hero__foot { opacity: 1; }

/* No-JS fallback: show everything */
html:not(.js) .hero__media,
html:not(.js) .hero__roles,
html:not(.js) .hero__foot { opacity: 1; transform: none; }
html:not(.js) .hero__line > span { transform: none; }

@media (max-width: 760px) {
  .hero__title {
    font-size: 13.5vw;
    letter-spacing: 0.1em;
    margin-right: -0.1em;
    line-height: 1.02;
  }
  /* Stacked, but each line only as wide as its word (the dock animation measures these boxes) */
  .hero__line { display: block; width: fit-content; margin-inline: auto; }
  .hero__line + .hero__line { margin-left: auto; }
  .hero__roles { font-size: 0.5625rem; letter-spacing: 0.34em; margin-right: -0.34em; }
  .hero__roles span { margin-inline: 0.7em; }
}

/* ---------- Media frames ---------- */

.frame {
  position: relative;
  aspect-ratio: var(--ar, 16 / 9);
  overflow: hidden;
  background: var(--bg-frame);
}

.frame__media,
.frame__preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame__media {
  transform: scale(1.08);
  transition: transform 1.8s var(--ease-out);
}

/* Settles into place as it scrolls into view */
.is-visible .frame__media,
.frame.is-visible .frame__media { transform: scale(1); }

/* Hover preview video */
.frame__preview {
  opacity: 0;
  transition: opacity 0.8s var(--ease-out);
  pointer-events: none;
}
.frame__preview.is-playing { opacity: 1; }

/* "Play" hint, only for items that have a video attached */
.frame::after {
  content: "Play";
  position: absolute;
  right: clamp(16px, 2vw, 28px);
  bottom: clamp(14px, 1.8vw, 24px);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--fg);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  z-index: 2;
}

.has-video .frame::after,
.frame.has-video::after { display: block; }

.work:not(.has-video) .frame::after { display: none; }

@media (hover: hover) {
  .work.has-video:hover .frame::after { opacity: 1; transform: none; }
}

/* ---------- Placeholders (remove once real images are in) ---------- */

.ph {
  display: flex;
  align-items: flex-end;
  padding: clamp(14px, 1.8vw, 24px) clamp(16px, 2vw, 28px);
  background:
    radial-gradient(110% 80% at var(--px, 30%) var(--py, 25%), var(--a), transparent 62%),
    linear-gradient(var(--angle, 165deg), var(--b), var(--c));
}

.ph__label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(235, 233, 228, 0.32);
}

.ph--dusk     { --a: rgba(120, 138, 160, 0.45); --b: #343a44; --c: #1c1f25; --px: 70%; --py: 20%; }
.ph--amber    { --a: rgba(176, 128, 84, 0.42);  --b: #3a3029; --c: #1e1b19; --px: 25%; --py: 70%; }
.ph--steel    { --a: rgba(120, 140, 130, 0.36); --b: #2f3533; --c: #1c1e1e; --px: 50%; --py: 15%; }
.ph--night    { --a: rgba(96, 104, 140, 0.4);   --b: #262833; --c: #17181c; --px: 80%; --py: 80%; }
.ph--ash      { --a: rgba(160, 156, 150, 0.3);  --b: #35363a; --c: #1d1e20; --px: 35%; --py: 30%; --angle: 190deg; }
.ph--ash-2    { --a: rgba(150, 146, 140, 0.26); --b: #313235; --c: #1e1f21; --px: 70%; --py: 60%; }
.ph--sea      { --a: rgba(96, 138, 150, 0.42);  --b: #2c363a; --c: #191d20; --px: 60%; --py: 30%; }
.ph--sea-2    { --a: rgba(110, 146, 158, 0.34); --b: #2e3a3f; --c: #1a1e21; --px: 20%; --py: 50%; --angle: 100deg; }
.ph--sand     { --a: rgba(184, 150, 112, 0.38); --b: #3b342d; --c: #1f1c1a; --px: 50%; --py: 20%; }
.ph--snow     { --a: rgba(196, 202, 210, 0.3);  --b: #3a3d42; --c: #202225; --px: 40%; --py: 10%; }
.ph--portrait { --a: rgba(150, 140, 128, 0.32); --b: #36373a; --c: #232427; --px: 50%; --py: 35%; }

/* ---------- Project card ---------- */

.work { display: block; cursor: default; }
.work.has-video { cursor: pointer; }

@media (hover: hover) {
  .work.has-video:hover .frame__media { transform: scale(1.03); }
}

.work__meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  column-gap: 20px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.work__meta:not(:has(.work__no)) { grid-template-columns: 1fr auto; }

.work__no {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

.work__title {
  font-size: clamp(1.0625rem, 1.4vw, 1.375rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--fg);
}

.work__info {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-align: right;
  white-space: nowrap;
}

/* Travel cards are narrower: stack the caption */
.travel-grid .work__meta,
.travel-grid .work__meta:not(:has(.work__no)) { grid-template-columns: 1fr; row-gap: 6px; }
.travel-grid .work__info { text-align: left; }

@media (max-width: 760px) {
  .work__meta { grid-template-columns: auto 1fr; row-gap: 6px; }
  .work__meta:not(:has(.work__no)) { grid-template-columns: 1fr; }
  .work__info { grid-column: -2 / -1; text-align: left; }
}

/* Underlined text link with arrow */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 40px;
  padding-bottom: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--fg);
  background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat;
  transition: background-size var(--dur) var(--ease-out);
}

.text-link span { transition: transform var(--dur) var(--ease-out); }

.text-link:hover { background-size: 40% 1px; }
.text-link:hover span { transform: translateX(6px); }

/* ---------- Film index list ---------- */

.film-index__list { border-top: 1px solid var(--line); }

.film-row {
  display: grid;
  grid-template-columns: 3.5em minmax(0, 1fr) 12em 5em 2em;
  align-items: baseline;
  gap: 16px;
  padding-block: clamp(22px, 2.4vw, 34px);
  border-bottom: 1px solid var(--line);
  cursor: default;
  transition: padding-left var(--dur) var(--ease-out);
}

.film-row.has-video { cursor: pointer; }

.film-row__no,
.film-row__type,
.film-row__year {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

.film-row__title {
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--fg-muted);
  transition: color var(--dur-fast) ease;
}

.film-row__arrow {
  justify-self: end;
  color: var(--fg-dim);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}

@media (hover: hover) {
  .film-row:hover { padding-left: 12px; }
  .film-row:hover .film-row__title { color: var(--fg); }
  .film-row:hover .film-row__arrow { opacity: 1; transform: none; color: var(--fg); }
}

@media (max-width: 760px) {
  .film-row {
    grid-template-columns: 2.6em 1fr auto;
    row-gap: 6px;
  }
  .film-row__type { grid-column: 2; grid-row: 2; }
  .film-row__year { grid-column: 3; grid-row: 1; }
  .film-row__arrow { display: none; }
}

/* ---------- About ---------- */

.disciplines {
  margin-top: clamp(48px, 5vw, 72px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.disciplines ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--grid-gap);
  margin-top: 20px;
}

.disciplines li {
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
  color: var(--fg);
}

/* ---------- Contact ---------- */

.contact-email {
  display: inline-block;
  font-size: clamp(1.75rem, 6.4vw, 6.5rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--fg);
  padding-bottom: 0.08em;
  background: linear-gradient(currentColor, currentColor) left bottom / 0% 1px no-repeat;
  transition: background-size 1.1s var(--ease-out);
  word-break: break-word;
}

.contact-email:hover { background-size: 100% 1px; }

@media (max-width: 480px) { .contact-email { font-size: 7.1vw; } }   /* (the address on one line, at any phone's width) */

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 16px clamp(28px, 4vw, 64px);
  margin-top: clamp(48px, 6vw, 88px);
}

.socials a {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--fg-muted);
  transition: color var(--dur-fast) ease;
}

.socials a:hover { color: var(--fg); }

.socials__handle { margin-left: 0.7em; text-transform: none; letter-spacing: 0.04em; font-size: 0.9375rem; font-weight: 400; }   /* (a handle reads as typed) */

/* ---------- Lightbox (fullscreen video player) ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(56px, 7vw, 96px) var(--gutter);
  background: rgba(18, 19, 21, 0.96);
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
  /* Swipes on the backdrop must not scroll the page behind (keeps your place on phones) */
  touch-action: none;
  overscroll-behavior: contain;
}

.lightbox[hidden] { display: none; }

/* Shown instead of the YouTube player when the page is opened straight from a file */
.lightbox__notice {
  display: grid;
  place-content: center;
  justify-items: start;
  gap: 8px;
  height: 100%;
  padding: 8%;
  background: var(--bg-raised);
}

.lightbox__notice p { font-size: 0.9375rem; max-width: 46ch; }
.lightbox__notice .text-link { margin-top: 16px; }
.lightbox.is-open { opacity: 1; }

.lightbox__stage {
  width: min(100%, calc((100vh - 180px) * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #000;
  transform: scale(0.98);
  transition: transform 0.8s var(--ease-out);
}

.lightbox.is-open .lightbox__stage { transform: none; }

.lightbox__stage iframe,
.lightbox__stage video {
  width: 100%;
  height: 100%;
  border: 0;
}

.lightbox__close {
  position: absolute;
  top: 0;
  right: var(--gutter);
  height: var(--header-h);
  color: var(--fg-muted);
  transition: color var(--dur-fast) ease;
}

.lightbox__close:hover { color: var(--fg); }

/* ---------- Scroll reveal ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--d, 0s);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}
