/* ==========================================================================
   Section styles
   ========================================================================== */

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

.hero { background: #000; }

.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero__canvas,
.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Scaled by the scroll engine for the slow push-in. */
  will-change: transform;
}

/* Painted before WebGL reports ready, and the permanent fallback if it never does. */
.hero__poster {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 55% at 50% 46%, rgba(88, 77, 255, 0.55) 0%, rgba(31, 22, 96, 0.35) 38%, rgba(0, 0, 0, 0) 72%),
    radial-gradient(40% 40% at 22% 72%, rgba(140, 128, 255, 0.28) 0%, rgba(0, 0, 0, 0) 70%),
    #000;
  transition: opacity 1.2s var(--ease-out);
}

.hero.is-shader-ready .hero__poster { opacity: 0; }

.hero__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 30%),
    linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 45%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-content: center;
  gap: var(--gutter);
  padding: calc(var(--gutter) * 5) calc(var(--page-x) + var(--rail-space)) calc(var(--gutter) * 4) var(--page-x);
}

/* Left rail of client pills. */
.hero__clients {
  grid-column: 1 / span 3;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
}

.hero__clients .btn {
  opacity: 0;
  transform: translateX(-1.2rem);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.is-loaded .hero__clients .btn { opacity: 1; transform: none; }
.is-loaded .hero__clients .btn:nth-child(1) { transition-delay: 0.5s; }
.is-loaded .hero__clients .btn:nth-child(2) { transition-delay: 0.56s; }
.is-loaded .hero__clients .btn:nth-child(3) { transition-delay: 0.62s; }
.is-loaded .hero__clients .btn:nth-child(4) { transition-delay: 0.68s; }
.is-loaded .hero__clients .btn:nth-child(5) { transition-delay: 0.74s; }
.is-loaded .hero__clients .btn:nth-child(6) { transition-delay: 0.8s; }
.is-loaded .hero__clients .btn:nth-child(7) { transition-delay: 0.86s; }
.is-loaded .hero__clients .btn:nth-child(8) { transition-delay: 0.92s; }
.is-loaded .hero__clients .btn:nth-child(9) { transition-delay: 0.98s; }
.is-loaded .hero__clients .btn:nth-child(10) { transition-delay: 1.04s; }

/* Description sits high-right, opposite the headline. */
.hero__description {
  grid-column: 8 / span 3;
  grid-row: 1;
  align-self: start;
  margin-top: 2vh;
  max-width: 25rem;
  color: #fff;
}

/* Headline anchors the lower half, offset right of centre. */
.hero__title {
  grid-column: 4 / span 9;
  grid-row: 1;
  align-self: end;
  margin-bottom: -0.1em;
  text-align: left;
}

.hero__title .reveal-line > span { transition-duration: 1.4s; }
.is-loaded .hero__title .reveal-line:nth-child(1) > span { transition-delay: 0.15s; }
.is-loaded .hero__title .reveal-line:nth-child(2) > span { transition-delay: 0.28s; }

/* --------------------------------------------------------------------------
   Statement — oversized serif paragraph with per-line reveal
   -------------------------------------------------------------------------- */

.statement { background: var(--bg); }

.statement .panel-content { justify-content: center; }

.statement__eyebrow {
  grid-column: 1 / span 12;
  margin-bottom: calc(var(--gutter) * 2.5);
}

.statement__body {
  grid-column: 2 / span 10;
  text-wrap: balance;
}

.statement__footer {
  grid-column: 2 / span 10;
  margin-top: calc(var(--gutter) * 3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--gutter);
  align-items: baseline;
  justify-content: space-between;
}

/* --------------------------------------------------------------------------
   Case study panels — full-bleed media, oversized serif title
   -------------------------------------------------------------------------- */

.case { background: #000; }

.case__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.case__media img,
.case__media video,
.case__media .case__gradient {
  width: 100%;
  height: 100%;
  transform: scale(1.12);
  will-change: transform;
}

.case__gradient { position: absolute; inset: 0; }

/* Carries the title over whatever the photograph is doing underneath. */
.case__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top,
      rgba(0, 0, 0, 0.88) 0%,
      rgba(0, 0, 0, 0.55) 28%,
      rgba(0, 0, 0, 0.12) 55%,
      rgba(0, 0, 0, 0.45) 100%);
}

.case__content {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--gutter);
  padding: calc(var(--gutter) * 5) calc(var(--page-x) + var(--rail-space)) calc(var(--gutter) * 3) var(--page-x);
}

.case__index {
  position: absolute;
  top: calc(var(--gutter) * 5);
  right: calc(var(--page-x) + var(--rail-space));
  z-index: 2;
}

.case__logo {
  height: 2.4rem;
  width: auto;
  margin-bottom: 0.8rem;
  opacity: 0.9;
}

/* A real screen from the product, floated over the artwork the way the
   reference shows a device beside each case study. */
.case__device {
  position: absolute;
  right: calc(var(--page-x) + var(--rail-space));
  bottom: calc(var(--gutter) * 3);
  z-index: 3;
  width: min(22rem, 24vw);
  aspect-ratio: 590 / 1070;
  border-radius: 1.8rem;
  overflow: hidden;
  box-shadow:
    0 2.4rem 6rem rgba(0, 0, 0, 0.55),
    0 0 0 1px hsla(0, 0%, 100%, 0.09);
  will-change: transform;
}

.case__device img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 900px) { .case__device { display: none; } }

.case__lede {
  max-width: 42ch;
  margin-left: 1.6rem;
  color: var(--text-regular);
}

.case__title {
  /* Breaks come from the .line spans — a max-width here would re-wrap them. */
  padding-left: 1.6rem;
  border-left: 1px solid hsla(0, 0%, 100%, 0.25);
}

.case__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  padding-left: 1.6rem;
}

.case__tags { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.tag {
  display: inline-flex;
  align-items: center;
  height: var(--button-height);
  padding: 0 1.2rem;
  border: 1px solid hsla(0, 0%, 100%, 0.22);
  border-radius: var(--border-radius-pill);
  font-size: var(--fs-small);
  color: var(--text-regular);
}

/* --------------------------------------------------------------------------
   Horizontal gallery — pinned panel, track driven by panel progress
   -------------------------------------------------------------------------- */

.gallery { background: var(--bg-subtle); }

.gallery__head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gutter);
  padding: calc(var(--gutter) * 5) calc(var(--page-x) + var(--rail-space)) 0 var(--page-x);
}

.gallery__viewport {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  min-height: 0;
}

.gallery__track {
  display: flex;
  /* Without this the cards stretch to the track height and lose their ratio. */
  align-items: center;
  /* A definite height is what lets the cards resolve their own percentage. */
  height: 100%;
  gap: var(--gutter);
  padding: 0 var(--page-x);
  will-change: transform;
}

.gallery__card {
  position: relative;
  flex: none;
  /* Height-led so the shelf always fits the pinned viewport; width follows. */
  height: min(52rem, 100%);
  width: auto;
  aspect-ratio: 3 / 4;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  background: var(--neutral-10);
  transition: transform var(--dur) var(--ease-out);
}

.gallery__card:hover { transform: translateY(-0.8rem); }

.gallery__card figure { position: absolute; inset: 0; }
.gallery__card img,
.gallery__card video,
.gallery__card .case__gradient { width: 100%; height: 100%; object-fit: cover; }

.gallery__card figcaption {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: var(--gutter);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
}

.gallery__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gutter);
  padding: 0 calc(var(--page-x) + var(--rail-space)) calc(var(--gutter) * 3) var(--page-x);
}

.progress-bar {
  position: relative;
  flex: 1;
  max-width: 32rem;
  height: 1px;
  background: hsla(0, 0%, 100%, 0.18);
  overflow: hidden;
}

.progress-bar__fill {
  position: absolute;
  inset: 0;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left center;
}

/* --------------------------------------------------------------------------
   Services — numbered rows that open on hover
   -------------------------------------------------------------------------- */

.services { background: var(--bg); }

.services__head { grid-column: 1 / span 12; margin-bottom: calc(var(--gutter) * 2); }

.services__list { grid-column: 1 / span 12; border-top: 1px solid var(--border-subtle); }

.service {
  position: relative;
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--gutter);
  padding: 2.4rem 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: color var(--dur) var(--ease-out);
}

.service::before {
  content: "";
  position: absolute;
  inset: 0 -1.6rem;
  z-index: -1;
  background: var(--bg-highlight);
  opacity: 0;
  transform: scaleY(0.4);
  transform-origin: center;
  transition:
    opacity var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
  border-radius: var(--border-radius);
}

.service:hover::before,
.service.is-open::before { opacity: 1; transform: scaleY(1); }

.service__num { color: var(--text-subtle); transition: color var(--dur) var(--ease-out); }
.service:hover .service__num,
.service.is-open .service__num { color: hsla(0, 0%, 100%, 0.7); }

.service__name {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.4rem, 3vw, 4.4rem);
  line-height: 1.1;
  letter-spacing: var(--ls-display);
}

.service__desc {
  max-width: 42ch;
  color: var(--text-regular);
  opacity: 0.75;
  transition: opacity var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

.service:hover .service__desc,
.service.is-open .service__desc { opacity: 1; color: #fff; }

.service__arrow {
  align-self: center;
  transition: transform var(--dur) var(--ease-out);
}

.service:hover .service__arrow { transform: translateX(0.6rem); }

/* --------------------------------------------------------------------------
   Stats
   -------------------------------------------------------------------------- */

.stats { background: var(--bg-subtle); }

.stats__head { grid-column: 1 / span 12; margin-bottom: calc(var(--gutter) * 3); }

.stat { grid-column: span 3; border-top: 1px solid var(--border-subtle); padding-top: var(--gutter); }

.stat__value {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(4rem, 6vw, 9.6rem);
  line-height: 1;
  letter-spacing: var(--ls-display);
}

.stat__label { margin-top: 0.8rem; color: var(--text-regular); }

/* --------------------------------------------------------------------------
   Press marquee
   -------------------------------------------------------------------------- */

.press { background: var(--bg); }

.press__head { grid-column: 1 / span 12; }

/* Head sits at the top; the ticker rows take the space that is left. */
.press .panel-content.press__intro { flex: 0 0 auto; justify-content: flex-start; }

.press__rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.press__foot { padding: 0 var(--page-x) calc(var(--gutter) * 3); }

.marquee {
  position: relative;
  overflow: hidden;
  padding: 1.2rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}

.marquee + .marquee { border-top: 0; }

.marquee__track {
  display: flex;
  width: max-content;
  gap: 4rem;
  will-change: transform;
}

.marquee__item {
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2rem, 2.4vw, 3.6rem);
  line-height: 1.2;
  letter-spacing: var(--ls-display);
  white-space: nowrap;
  color: var(--text-regular);
  transition: color var(--dur-fast) linear;
}

.marquee__item:hover { color: #fff; }

.marquee__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--purple);
  flex: none;
}

/* --------------------------------------------------------------------------
   Quote
   -------------------------------------------------------------------------- */

.quote { background: var(--bg-highlight); }

.quote .panel-content { justify-content: center; }

.quote__body { grid-column: 2 / span 10; text-wrap: balance; }

.quote__cite {
  grid-column: 2 / span 10;
  margin-top: calc(var(--gutter) * 2);
  display: flex;
  align-items: center;
  gap: 1.2rem;
  color: hsla(0, 0%, 100%, 0.8);
}

.quote__avatar {
  width: 4.8rem;
  height: 4.8rem;
  border-radius: 50%;
  background: hsla(0, 0%, 100%, 0.2);
  flex: none;
  display: grid;
  place-items: center;
  font-size: var(--fs-small);
}

/* --------------------------------------------------------------------------
   Contact CTA + footer (one panel)
   -------------------------------------------------------------------------- */

.contact { background: var(--bg); }

.contact .panel-content { justify-content: center; }

.contact__head { grid-column: 1 / span 12; }

.contact__list {
  grid-column: 1 / span 12;
  margin-top: calc(var(--gutter) * 2);
  border-top: 1px solid var(--border-subtle);
}

.contact__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gutter);
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: padding var(--dur) var(--ease-out);
}

.contact__row:hover { padding-left: 1.6rem; }

.contact__row-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.8rem, 4vw, 6.4rem);
  line-height: 1.1;
  letter-spacing: var(--ls-display);
}

.contact__row .btn { flex: none; }

/* Pinned to the foot of the last panel rather than flowing with the CTAs. */
.footer {
  flex: 0 0 auto;
  margin: 0 var(--page-x) 0;
  padding-bottom: calc(var(--gutter) * 1.5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--gutter);
  padding-top: var(--gutter);
  border-top: 1px solid var(--border-subtle);
}

.footer__links { display: flex; flex-wrap: wrap; gap: 1.6rem; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  /* Without the client rail the two blocks would share one cell, so give the
     hero explicit rows: description on top, headline pinned to the bottom. */
  .hero__content {
    grid-template-rows: auto 1fr auto;
    align-content: stretch;
  }
  .hero__clients { display: none; }
  .hero__description {
    grid-column: 1 / span 12;
    grid-row: 1;
    align-self: start;
    margin-top: 0;
    max-width: 46ch;
  }
  .hero__title {
    grid-column: 1 / span 12;
    grid-row: 3;
    align-self: end;
  }
  .statement__body,
  .quote__body,
  .quote__cite { grid-column: 1 / span 12; }
  .stat { grid-column: span 6; }
  .service { grid-template-columns: 4rem minmax(0, 1fr) auto; }
  .service__desc { display: none; }
}

@media (max-width: 640px) {
  .case__content { padding-bottom: calc(var(--gutter) * 2); }
  /* Drop the caption so the progress bar keeps its width next to the CTA. */
  .gallery__foot > .label { display: none; }
  .stat { grid-column: span 12; }
  .contact__row { flex-direction: column; align-items: flex-start; }
  .gallery__card { height: auto; width: 74vw; }
  .footer { flex-direction: column; align-items: flex-start; }
}

/* --------------------------------------------------------------------------
   Hero case switcher — hovering the left rail swaps the whole hero over to
   that piece of work, the way the reference previews a case study.
   -------------------------------------------------------------------------- */

.hero__swap {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s var(--ease-out);
  pointer-events: none;
}

.hero__swap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  transition: transform 1.6s var(--ease-out);
}

.hero.is-previewing .hero__swap { opacity: 1; }
.hero.is-previewing .hero__swap video { transform: scale(1); }

/* The shader keeps running underneath; it just steps back. */
.hero__canvas { transition: opacity 0.7s var(--ease-out); }
.hero.is-previewing .hero__canvas { opacity: 0.25; }

/* Default and preview copy occupy the same cell and cross-fade. */
.hero__description { position: relative; }

.hero__desc-default,
.hero__desc-swap {
  transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out);
}

.hero__desc-swap {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(0.8rem);
}

.hero.is-previewing .hero__desc-default { opacity: 0; transform: translateY(-0.8rem); }
.hero.is-previewing .hero__desc-swap { opacity: 1; transform: none; }

.hero__title { position: relative; }

.hero__title-default,
.hero__title-swap {
  transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out);
}

.hero__title-swap {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  opacity: 0;
  transform: translateY(1.2rem);
}

.hero__swap-tag { color: hsla(0, 0%, 100%, 0.75); }

.hero.is-previewing .hero__title-default { opacity: 0; transform: translateY(-1.2rem); }
.hero.is-previewing .hero__title-swap { opacity: 1; transform: none; }

/* Hovering one entry dims the rest of the rail. */
.hero__clients:hover .btn { opacity: 0.45; }
.hero__clients .btn:hover,
.hero__clients .btn:focus-visible {
  opacity: 1;
  background: transparent;
  border-color: hsla(0, 0%, 100%, 0.55);
}

/* Status chip on a case that has not shipped yet. */
.tag--status {
  border-color: hsla(252, 100%, 71%, 0.5);
  color: #b9b3ff;
}

/* Marquee items became links once they pointed at the journal. */
a.marquee__item:hover { color: var(--text-bold); }
