/*
 * Home: hero with opening animation, statement, section rhythm.
 */

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

/*
 * 824px tall in the mockup (1440x1024 frame: 100px header, 100px below).
 * On shorter screens it shrinks so the logo stays inside the first view.
 */
:root {
  --hero-h: clamp(420px, 100svh - 200px, 824px);
}
.hero {
  position: relative;
  height: var(--hero-h);
}

.hero__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: inset(0);
  background: var(--c-ink);
}
/*
 * Crop from Figma: image 1.9% wider than the frame, shifted up by 10.2% of its
 * own height (105px at 1440). Offsets are relative to the image, not to the
 * frame, so the crop holds on any screen width. The file has a dark strip in
 * its top and bottom 1.6%: both states keep those strips outside the frame,
 * which is why the image is never shorter than 124.4% of the hero.
 */
.hero__media img {
  position: absolute;
  top: 0;
  left: 0;
  width: 101.875%;
  max-width: none;
  height: auto;
  min-height: 124.4%;
  object-fit: cover;
  transform: translateY(-10.24%);
  transform-origin: 0 0;
}
.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
}

.hero__inner {
  position: relative;
  height: 100%;
}
/* 1235x150 at x=103 in the mockup; hangs 10px below the image */
.hero__logo {
  position: absolute;
  left: 0.242%;
  bottom: -10px;
  width: 99.597%;
  color: var(--c-white);
  transform-origin: 0 0;
}
.hero__logo svg {
  width: 100%;
  height: auto;
}

/* ---------- Opening animation ----------
 *
 * While <html> has .is-intro the page shows the splash (blue screen, image
 * cropped to a centred box, small blue logo). Removing the class plays the
 * transition into the hero. main.js sets the logo transform, since its
 * target depends on the viewport, and keeps .intro-lock on until the
 * transition is over, so the visitor cannot scroll past it.
 */

.intro-veil {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--c-blue);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.has-intro .intro-veil {
  transition: opacity 0.9s var(--ease), visibility 0s 0.9s;
}
.has-intro .hero {
  z-index: 40;
}
.has-intro .hero__media {
  transition: clip-path 0.9s var(--ease);
}
.has-intro .hero__media img {
  transition: transform 0.9s var(--ease);
}
.has-intro .hero__logo {
  transition: transform 0.9s var(--ease), color 0.9s var(--ease);
}

/* The page is pinned at the top from the splash until the transition has finished */
.intro-lock,
.intro-lock body {
  overflow: hidden;
}
.intro-lock {
  scrollbar-gutter: stable;
}
.is-intro .intro-veil {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: none;
}
.is-intro .hero__media {
  clip-path: inset(0 21.6%);
}
/* Splash crop from Figma (image at 83.5%, 165px from the left), a touch larger so the dark strips stay hidden */
.is-intro .hero__media img {
  transform: translate(11.25%, -1.7%) scale(0.84);
}
.is-intro .hero__logo {
  color: var(--c-blue);
}
/* Until main.js has moved the logo to its splash position (it then adds .has-intro), keep it out of sight */
.is-intro:not(.has-intro) .hero__logo {
  opacity: 0;
}

/* Scroll cue: sits in the blue band under the image and runs to the bottom edge of the screen */
.scroll-hint {
  position: absolute;
  top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--header-h) + var(--hero-h));
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--fs-link);
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.25s, transform 0.4s var(--ease);
}
.is-intro .scroll-hint {
  opacity: 1;
  transform: none;
}
/* The label is a mask: each letter rises into it */
.scroll-hint__label {
  display: flex;
  flex: none;
  overflow: hidden;
  padding-left: 0.08em;
}
.scroll-hint__label span {
  transform: translateY(110%);
}
.is-intro .scroll-hint__label span {
  animation: scroll-hint-letter 0.7s var(--ease) calc(0.45s + var(--i) * 0.06s) forwards;
}
/* A faint track with a bright stroke that keeps running down it */
.scroll-hint__line {
  position: relative;
  flex: 1;
  width: 1px;
  min-height: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.28);
  transform: scaleY(0);
  transform-origin: 50% 0;
}
.is-intro .scroll-hint__line {
  animation: scroll-hint-grow 0.8s var(--ease) 0.9s forwards;
}
.scroll-hint__line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--c-white);
  transform: translateY(-101%);
}
.is-intro .scroll-hint__line::after {
  animation: scroll-hint-run 1.9s cubic-bezier(0.76, 0, 0.24, 1) 1.6s infinite;
}

@keyframes scroll-hint-letter {
  to {
    transform: none;
  }
}
@keyframes scroll-hint-grow {
  to {
    transform: none;
  }
}
@keyframes scroll-hint-run {
  0% {
    transform: translateY(-101%);
  }
  55% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(101%);
  }
}

/* ---------- Statement ---------- */

.statement {
  margin-top: 112px;
}
.statement p {
  /* 820px box in Figma, with hand-set breaks; 765px gives the same lines */
  max-width: 765px;
  font-size: var(--fs-lead);
  line-height: 1.2778;
}

/* ---------- Section rhythm (distances measured on the 1440px mockup) ---------- */

.home-method {
  margin-top: 112px;
}
.home-method .method-cards {
  margin-top: 73px;
}

.home-latest {
  margin-top: 122px;
}
.home-latest .article-grid {
  margin-top: 49px;
}

.home-works {
  margin-top: 182px;
}
.home-works .mosaic {
  margin-top: 71px;
}

.home-podcast {
  margin-top: 183px;
  padding-bottom: 186px;
  overflow: hidden;
}
.home-podcast .slider {
  margin-top: 65px;
}

/* When the podcast section is missing, whichever section comes last keeps the same air above the footer */
.home-method:last-child,
.home-latest:last-child,
.home-works:last-child {
  padding-bottom: 186px;
}

@media (max-width: 1000px) {
  .statement,
  .home-method,
  .home-latest,
  .home-works,
  .home-podcast {
    margin-top: 80px;
  }
  .home-podcast {
    padding-bottom: 80px;
  }
  .home-method .method-cards,
  .home-works .mosaic,
  .home-podcast .slider {
    margin-top: 40px;
  }
}

/* On phones a 57%-wide splash box would be a thin strip: keep it wider */
@media (max-width: 760px) {
  .is-intro .hero__media {
    clip-path: inset(8% 8%);
  }
  .is-intro .hero__media img {
    transform: translateY(-10.24%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .has-intro .intro-veil,
  .has-intro .hero__media,
  .has-intro .hero__media img,
  .has-intro .hero__logo {
    transition: none;
  }
}
