/* ----- REALISATIONS PAGE ----- */

.no-results {
  color: var(--color-text-muted);
  padding: 2rem 0;
}

/* Creature as a fixed page background */
#creature-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  z-index: -1;
  top: 0;
  left: 0;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}
body.admin-bar #creature-wrapper {
  top: 32px;
}

.realisations-intro {
  max-width: 62ch;
  margin-top: 1rem;
}

/* ----- HERO (sticky, animated into a side banner on scroll) ----- */
.realisations-hero {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  /* Bottom-aligned once the section becomes a full-height banner */
  justify-content: flex-end;
  overflow: hidden;
  /* Rule separating the hero from the list (hidden once the hero slides away) */
  border-bottom: 1px solid var(--color-border);
  /* Right border: transparent at rest, shown once the hero is reduced */
  border-right: 1px solid transparent;
  /* Space below the hero at rest */
  margin-bottom: 3rem;
}
/* Allow breaking the title once the hero is reduced */
.realisations-hero h1 {
  overflow-wrap: break-word;
}
/* Rest state after the animation (same as the keyframes' end values) */
.realisations-hero.is-scrolled .realisations-intro {
  display: none;
}
.realisations-hero.is-scrolled {
  padding-right: 2rem;
  border-bottom-color: transparent;
  border-right-color: var(--color-border);
  margin-bottom: 0;
}
.realisation-list {
  margin-left: auto;
}
/* Space between the reduced hero and the list */
.realisation-list.is-scrolled {
  padding-left: 2rem;
}

@media (min-width: 1025px) {
  :root {
    --rh-hero-duration: 2s;
    --rh-ease: cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* ----- HERO ENTER ANIMATION ----- */
  @keyframes realisations-hero-enter {
    0% {
      transform: translateX(0);
      width: 100%;
      height: var(--hero-start-height);
      padding-right: 0;
      border-bottom-color: var(--color-border);
      border-right-color: transparent;
      margin-bottom: 3rem;
    }
    49% {
      transform: translateX(-110vw);
      width: 100%;
      height: var(--hero-start-height);
      padding-right: 0;
      border-bottom-color: var(--color-border);
      border-right-color: transparent;
      margin-bottom: 3rem;
    }
    50% {
      transform: translateX(-110vw);
      width: 25%;
      height: 100vh;
      padding-right: 2rem;
      border-bottom-color: transparent;
      border-right-color: var(--color-border);
      margin-bottom: 0;
    }
    100% {
      transform: translateX(0);
      width: 25%;
      height: 100vh;
      padding-right: 2rem;
      border-bottom-color: transparent;
      border-right-color: var(--color-border);
      margin-bottom: 0;
    }
  }
  /* Exit animation (mirror of the enter, hero stays hidden longer) */
  @keyframes realisations-hero-exit {
    0% {
      transform: translateX(0);
      width: 25%;
      height: 100vh;
      padding-right: 2rem;
      border-bottom-color: transparent;
      border-right-color: var(--color-border);
      margin-bottom: 0;
    }
    79% {
      transform: translateX(-110vw);
      width: 25%;
      height: 100vh;
      padding-right: 2rem;
      border-bottom-color: transparent;
      border-right-color: var(--color-border);
      margin-bottom: 0;
    }
    80% {
      transform: translateX(-110vw);
      width: 100%;
      height: var(--hero-start-height);
      padding-right: 0;
      border-bottom-color: transparent;
      border-right-color: transparent;
      margin-bottom: 3rem;
    }
    99% {
      transform: translateX(0);
      width: 100%;
      height: var(--hero-start-height);
      padding-right: 0;
      border-bottom-color: transparent;
      border-right-color: transparent;
      margin-bottom: 3rem;
    }
    100% {
      transform: translateX(0);
      width: 100%;
      height: var(--hero-start-height);
      padding-right: 0;
      border-bottom-color: var(--color-border);
      border-right-color: transparent;
      margin-bottom: 3rem;
    }
  }
  .realisations-hero.is-animating-in {
    animation: realisations-hero-enter var(--rh-hero-duration) var(--rh-ease) forwards;
  }
  .realisations-hero.is-animating-out {
    animation: realisations-hero-exit var(--rh-hero-duration) var(--rh-ease) forwards;
  }

  /* Lead hides as soon as the hero is off screen */
  @keyframes realisations-intro-hide {
    0% {
      display: block;
    }
    49% {
      display: block;
    }
    50% {
      display: none;
    }
    100% {
      display: none;
    }
  }
  @keyframes realisations-intro-show {
    0% {
      display: none;
    }
    79% {
      display: none;
    }
    80% {
      display: block;
    }
    100% {
      display: block;
    }
  }
  .realisations-hero.is-animating-in .realisations-intro {
    animation: realisations-intro-hide var(--rh-hero-duration) var(--rh-ease) forwards;
  }
  .realisations-hero.is-animating-out .realisations-intro {
    animation: realisations-intro-show var(--rh-hero-duration) var(--rh-ease) forwards;
  }

  /* List push: margin jumps once at 50%, then only the width animates */
  @keyframes realisation-list-push {
    0% {
      width: 100%;
      margin-top: 0px;
      padding-left: 0;
    }
    49% {
      width: 100%;
      margin-top: 0px;
      padding-left: 0;
    }
    50% {
      width: 100%;
      margin-top: calc(var(--hero-start-height) - 100vh + 3rem);
      padding-left: 0;
    }
    100% {
      width: 75%;
      margin-top: calc(var(--hero-start-height) - 100vh + 3rem);
      padding-left: 2rem;
    }
  }
  /* List pull (mirror of the push) */
  @keyframes realisation-list-pull {
    0% {
      width: 75%;
      margin-top: calc(var(--hero-start-height) - 100vh + 3rem);
      padding-left: 2rem;
    }
    79% {
      width: 100%;
      margin-top: calc(var(--hero-start-height) - 100vh + 3rem);
      padding-left: 0;
    }
    80% {
      width: 100%;
      margin-top: 0px;
      padding-left: 0;
    }
    100% {
      width: 100%;
      margin-top: 0px;
      padding-left: 0;
    }
  }
  .realisation-list.is-animating-in {
    animation: realisation-list-push var(--rh-hero-duration) var(--rh-ease) forwards;
  }
  .realisation-list.is-animating-out {
    animation: realisation-list-pull var(--rh-hero-duration) var(--rh-ease) forwards;
  }

  /* Rest state once the enter animation has ended */
  .realisations-hero.is-scrolled {
    width: 25%;
    height: 100vh;
  }
  .realisation-list.is-scrolled {
    width: 75%;
    margin-top: calc(var(--hero-start-height) - 100vh + 3rem);
  }
}

/* Up to 1024px: no sticky, no animation (see realisations-hero-scroll.js) */
@media (max-width: 1024px) {
  .realisations-hero {
    position: static;
  }
}

/* ----- FILTERS ----- */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 3rem;
}
.filters-group {
  display: contents;
}

.filter-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
  padding: 0.4em 0.9em;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-text);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}
.filter-tab input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.filter-tab sup {
  font-size: 0.75em;
  opacity: 0.7;
  margin-top: 0.1em;
}
.filter-tab:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-light);
}
.filter-tab.is-active {
  background: var(--color-accent-yellow);
  border-color: var(--color-accent-dark);
}

.realisation-list.is-loading {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* ----- LIST ----- */
.realisation-list {
  display: flex;
  flex-direction: column;
}

.realisation-row {
  display: grid;
  grid-template-columns: 0.95fr 1.15fr;
  gap: 2.2rem;
  align-items: center;
  padding-block: 3.2rem;
  border-bottom: 1px solid var(--color-border);
  /* Scroll target offset below the sticky header */
  scroll-margin-top: 90px;
}
.realisation-row:first-child {
  padding-top: 0;
}
.realisation-row:last-child {
  border-bottom: none;
}

/* Image on the left at its natural size, no cropping */
.realisation-row__media {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-primary-light);
  display: block;
}
.realisation-row__media img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s ease;
}
.realisation-row:hover .realisation-row__media img {
  transform: scale(1.04);
}

.realisation-row__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}
.realisation-row__title {
  font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.6rem);
  margin-bottom: 0.6rem;
}
.realisation-row__title a:hover {
  color: var(--color-primary-dark);
}
.realisation-row__excerpt {
  color: var(--color-text-muted);
  max-width: 46ch;
  margin-bottom: 1.4rem;
}
.realisation-row__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.6rem;
}


@media (max-width: 1280px) {
  .realisation-row {
    /* Image comes first in the HTML, so it stacks above the content */
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-block: 2.2rem;
  }
}

/* Up to 1024px: full-width image (bleeds out of the gutter) */
@media (max-width: 1024px) {
  .realisation-row {
    border-bottom: none;
  }
  .realisation-row__media {
    margin-inline: calc(-1 * var(--edge));
    border-radius: 0;
  }
}
