/* Homepage: hero slider, intro, clients, news. */

@layer pages {
  .home-hero {
    position: relative;
    display: grid;
    align-items: end;
    min-height: 100svh;
    overflow: hidden;
    background: var(--theme-color-inverse);
    color: var(--theme-color-inverse-text);
  }

  .home-hero__slides,
  .home-hero__slide {
    position: absolute;
    inset: 0;
  }

  /* Slide change: the next photo slides in from the right over the current
     one, while its image moves the other way (parallax) and the current
     photo drifts left underneath. States: active, prev (leaving), idle. */
  .home-hero__slides {
    z-index: 0;
    isolation: isolate;
  }

  .home-hero__slide {
    isolation: isolate;
    overflow: hidden;
    translate: 100% 0;
    transition: translate 1.2s cubic-bezier(0.77, 0, 0.18, 1);
  }

  .home-hero__slide[data-state='idle'] {
    transition: none;
  }

  /* Brand tint for the hero: the photo keeps its own light and detail, the
     moss green layer on top only takes over hue and saturation (blend
     mode "color"), keeping the photo's own light. It fades in from none at
     the top to full strength in the lower quarter. */
  .home-hero__slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--theme-color-primary) 75%, #fff);
    mix-blend-mode: color;
    opacity: 0.9;
    mask-image: linear-gradient(to bottom, transparent, #000 75%);
    pointer-events: none;
  }

  .home-hero__slide[data-state='prev'] {
    z-index: 1;
    translate: 0;
  }

  .home-hero__slide[data-state='active'] {
    z-index: 2;
    translate: 0;
  }

  .home-hero__image {
    width: 120%;
    max-width: none;
    height: 100%;
    object-fit: cover;
    translate: -8.333% 0;
    transition: translate 1.2s cubic-bezier(0.77, 0, 0.18, 1);
  }

  .home-hero__slide[data-state='active'] .home-hero__image {
    translate: 0;
  }

  .home-hero__slide[data-state='prev'] .home-hero__image {
    translate: -8.333% 0;
  }

  .home-hero__slide[data-state='idle'] .home-hero__image {
    transition: none;
  }

  .home-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
      to top,
      rgb(15 38 38 / 75%) 0%,
      rgb(15 38 38 / 20%) 55%,
      rgb(15 38 38 / 35%) 100%
    );
  }

  /* Same column as .container, so the hero text lines up with the rest of the page. */
  .home-hero__content {
    position: relative;
    z-index: 1;
    width: min(100% - 2 * var(--theme-gutter), var(--theme-container));
    margin-inline: auto;
    padding-block: var(--theme-space-xl) calc(var(--theme-space-lg) + 1.5rem);
  }

  /* Entrance: the green shows first, photos fade in, then the text, then
     the link and indicators. home.js flips data-intro from armed to play. */
  .home-hero__slides,
  .home-hero__eyebrow,
  .home-hero__title,
  .home-hero__actions,
  .home-hero__progress {
    transition:
      opacity 1s var(--theme-ease-signature),
      translate 1s var(--theme-ease-signature);
  }

  .home-hero[data-intro='armed'] .home-hero__slides {
    opacity: 0;
  }

  .home-hero[data-intro='armed'] .home-hero__eyebrow,
  .home-hero[data-intro='armed'] .home-hero__title,
  .home-hero[data-intro='armed'] .home-hero__actions {
    opacity: 0;
    translate: 0 1.25rem;
  }

  .home-hero[data-intro='armed'] .home-hero__progress {
    opacity: 0;
  }

  .home-hero[data-intro='play'] .home-hero__slides {
    transition-duration: 1.6s;
  }

  /* The eyebrow comes in just before the title. */
  .home-hero[data-intro='play'] .home-hero__eyebrow {
    transition-delay: 0.75s;
  }

  .home-hero[data-intro='play'] .home-hero__title {
    transition-delay: 0.9s;
  }

  .home-hero[data-intro='play'] .home-hero__actions {
    transition-delay: 1.4s;
  }

  .home-hero[data-intro='play'] .home-hero__progress {
    transition-delay: 1.8s;
  }

  @media (prefers-reduced-motion: reduce) {
    .home-hero__slides,
    .home-hero__eyebrow,
    .home-hero__title,
    .home-hero__actions,
    .home-hero__progress {
      transition: none;
    }
  }

  .home-hero__eyebrow {
    margin-bottom: 22px;
  }

  /* 8.2vw only wins below about 373px: there the longest rotating word
     (institutionele beleggers, about 10.8em) still fits the text column. */
  .home-hero__title {
    font-size: min(var(--theme-font-size-h1), 8.2vw);
    font-weight: 300;
  }

  .home-hero__line {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.3em;
    margin-top: 0.15em;
    font-weight: 300;
  }

  .home-hero__words {
    display: grid;
    width: var(--theme-hero-word-width, auto);
    transition: width 0.6s var(--theme-ease-signature);
  }

  .home-hero__word {
    grid-area: 1 / 1;
    justify-self: start;
    white-space: nowrap;
    opacity: 0;
    translate: 0 0.4em;
    transition:
      opacity 0.6s var(--theme-ease-signature),
      translate 0.6s var(--theme-ease-signature);
  }

  .home-hero__word[data-state='idle'] {
    translate: 0 -0.4em;
    transition-duration: 0.35s;
  }

  .home-hero__word[data-state='active'] {
    opacity: 1;
    translate: 0;
    transition-delay: 0.3s;
  }

  .home-hero__actions {
    margin-top: var(--theme-space-md);
  }

  /* Slide indicators: small dots at the bottom right. The active dot slowly
     grows and turns white while its photo shows; when the next photo takes
     over it shrinks back. */
  .home-hero__progress {
    position: absolute;

    /* Right edge on the .container line too. */
    inset: auto max(var(--theme-gutter), calc(50% - var(--theme-container) / 2))
      var(--theme-space-md) auto;
    z-index: 2;
    display: flex;
    align-items: center;
  }

  .home-hero__dot {
    position: relative;
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
  }

  /* Drawn at full size and scaled, so growing is smooth instead of
     stepping through whole pixels. A real "animation" always jumps to its
     keyframe's start value the moment it is swapped in, even mid-flight;
     a "transition" instead continues from whatever size the dot is
     currently rendered at, so an interrupted click never pops. */
  .home-hero__dot::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgb(255 255 255 / 40%);
    transform: scale(0.43);
    transition: background-color var(--theme-duration);
  }

  .home-hero__dot:hover::before {
    background: rgb(255 255 255 / 75%);
  }

  .home-hero__dot[data-state='active']::before {
    transform: scale(1);
    background: rgb(255 255 255 / 100%);
    transition:
      transform var(--theme-hero-interval, 5.5s) linear,
      background-color var(--theme-hero-interval, 5.5s) linear;
  }

  .home-hero__dot[data-state='prev']::before {
    transform: scale(0.43);
    background: rgb(255 255 255 / 40%);
    transition:
      transform 0.7s var(--theme-ease-signature),
      background-color 0.7s var(--theme-ease-signature);
  }

  @media (prefers-reduced-motion: reduce) {
    .home-hero__dot[data-state='active']::before,
    .home-hero__dot[data-state='prev']::before {
      transition: none;
    }
  }

  .home-intro {
    container-type: inline-size;
    display: grid;
  }

  .home-intro__text {
    display: grid;
    gap: var(--theme-space-md);
    align-content: center;
    justify-items: start;
    padding: var(--theme-space-xl) var(--theme-gutter);
  }

  .home-intro__media {
    position: relative;
    z-index: 3;
    isolation: isolate;
    min-height: 20rem;
    overflow: clip; /* not hidden: that would stop the sticky frame below from sticking */
  }

  /* The frame is one screen high at most and sticks while the (longer) text
     scrolls past, so the photo keeps its crop instead of stretching with the
     text. */
  .home-intro__sticky {
    position: sticky;
    top: 0;
    height: 100svh;
    max-height: 100%;
    overflow: hidden;
  }

  /* Green tint (blend mode "color") that lifts off into the real colours
     when the photo scrolls into view. home.js sets data-state. */
  .home-intro__sticky::after {
    content: '';
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--theme-color-primary) 75%, #fff);
    mix-blend-mode: color;
    opacity: 0;
    pointer-events: none;
  }

  .home-intro__media[data-state='armed'] .home-intro__sticky::after {
    opacity: 0.85;
  }

  .home-intro__media[data-state='in'] .home-intro__sticky::after {
    opacity: 0;
    transition: opacity 1.8s var(--theme-ease-signature) 0.2s;
  }

  /* The photo is taller than its frame; home.js moves it slowly while the
     page scrolls (parallax). It always covers the frame. */
  .home-intro__image {
    position: absolute;
    top: -10%;
    left: 0;
    width: 100%;
    height: 120%;
    object-fit: cover;
    object-position: center 30%;
    will-change: transform;
  }

  @media (width >= 60rem) {
    .home-intro {
      grid-template-columns: 1fr 1fr;
    }

    /* Left edge on the .container line (half the room beside a centred
       container; cqw = width of .home-intro, so no scrollbar offset). */
    .home-intro__text {
      padding-inline: max(var(--theme-gutter), calc(50cqw - var(--theme-container) / 2))
        var(--theme-space-lg);
    }

    /* The photo grows upward over the hero while scrolling (home.js sets
       --theme-intro-overlap), its bottom edge stays put: no gap below it. */
    .home-intro__media {
      min-height: calc(34rem + var(--theme-intro-overlap, 0px));
      margin-top: calc(-1 * var(--theme-intro-overlap, 0px));
    }
  }

  /* Text as in the Prime design's "Over ons": large light statement with the
     company name in bold green, then a calmer paragraph. */
  .home-intro__statement {
    font-size: clamp(1.25rem, 1.7vw, 1.625rem);
    font-weight: 300;
    line-height: 1.32;
    letter-spacing: -0.015em;
    text-wrap: pretty;
    color: var(--theme-color-text);
  }

  .home-intro__body {
    max-width: 52ch;
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--theme-color-text-muted);
  }

  /* Partners: full width, heading left and intro right, logos below. */

  /* Services band, after the Prime design: green band, one row per service
     with its name, a one-line summary and a round arrow that turns on hover.
     The summary drops out on small screens. */

  /* See-through green (88%). */
  .home-services {
    position: relative;
    z-index: 4;
    padding-block: clamp(40px, 4.5vw, 64px);
    background: color-mix(in srgb, var(--theme-color-inverse) 88%, transparent);
    color: var(--theme-color-inverse-text);
  }

  /* Wider side padding than the other sections, so the band feels lighter. */
  .home-services > .container {
    width: min(100% - 2 * clamp(1.5rem, 8vw, 9rem), var(--theme-container));
  }

  .home-services .section-head {
    margin-bottom: 28px;
  }

  .home-services__list {
    border-top: 1px solid rgb(255 255 255 / 18%);
    list-style: none;
  }

  .home-services__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 16px;
    align-items: center;
    padding-block: 16px;
    border-bottom: 1px solid rgb(255 255 255 / 18%);
    color: inherit;
    text-decoration: none;
  }

  .home-services__title {
    font-size: clamp(1.25rem, 1.7vw, 1.625rem);
    font-weight: 500;
    letter-spacing: -0.02em;
  }

  .home-services__text {
    display: none;
    line-height: 1.55;
    color: rgb(255 255 255 / 72%);
  }

  .home-services__arrow {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1.5px solid rgb(255 255 255 / 35%);
    border-radius: 50%;
    transition:
      background-color 0.3s,
      color 0.3s,
      border-color 0.3s,
      rotate 0.3s;
  }

  .home-services__item:hover .home-services__arrow,
  .home-services__item:focus-visible .home-services__arrow {
    border-color: var(--theme-color-contrast);
    background: var(--theme-color-contrast);
    color: var(--theme-color-primary);
    rotate: -45deg;
  }

  .home-services__item:hover .home-services__title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 6px;
  }

  @media (width >= 56.25rem) {
    .home-services__item {
      grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) 48px;
      gap: 32px;
    }

    .home-services__text {
      display: block;
    }
  }

  /* Clients, after the Prime design: white band, title left and text right,
     then the logo box (client-logos.php, 'boxed'). */
  .home-clients {
    padding-block: clamp(88px, 9vw, 120px);
    background: var(--theme-color-background);
  }

  /* News on the light grey band (clients sit on white). */
  .home-news {
    background: var(--theme-color-surface);
  }

  .home-clients__head {
    display: grid;
    gap: 24px 72px;
    align-items: end;
    margin-bottom: 56px;
  }

  .home-clients__text {
    max-width: 52ch;
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--theme-color-text-muted);
  }

  @media (width >= 56.25rem) {
    .home-clients__head {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
  }

  .section-head__text {
    max-width: 52ch;
    margin-top: 0.75rem;
    color: var(--theme-color-text-muted);
  }
}
