/* ----- HOME PAGE ----- */

/* ----- HERO ----- */
.hero {
  padding: clamp(3rem, 8vw, 7rem) var(--gutter);
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
}
.hero__actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.hero__text {
  max-width: 1100px;
  position: relative;
  z-index: 2;
}
/* Larger than the shared h1 */
.hero h1 {
  font-size: clamp(2.5rem, 1.6rem + 3.4vw, 6.4rem);
}

/* Two-paragraph lead: readable line width, independent of the title */
.hero__text .lead {
  max-width: 800px;
}
.hero__text .lead + .lead {
  margin-top: 1em;
}

/* Creature, confined to the hero */
#creature-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
body.admin-bar #creature-wrapper {
  top: 32px;
}

/* ----- SERVICES ----- */
/* Tall section: its height is the scroll distance for the slides */
.section.services {
  background-color: var(--color-primary-dark);
  position: relative;
  z-index: 1;
  padding: 0;
}

/* Yellow buttons on the violet background */
.section.services .btn {
  --btn-bg: var(--color-accent-yellow);
  --btn-border: var(--color-primary-dark);
  --btn-text: var(--color-text);
}

/* Sticky: pins the content to the screen while the section scrolls */
.services-sticky {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow: hidden;
}
body.admin-bar .services-sticky {
  top: calc(72px + 32px);
  height: calc(100vh - 72px - 32px);
}
@media screen and (max-width: 782px) {
  body.admin-bar .services-sticky {
    top: calc(72px + 46px);
    height: calc(100vh - 72px - 46px);
  }
}

/* Progress marker on the left: one outline dot per service plus a 3x3 cursor */
.services-nav {
  /* Sizes derived from --cursor-size */
  --cursor-size: 48px;
  --dot-size: calc(var(--cursor-size) * 0.375);
  --nav-gap: 2.5rem;
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
/* Default cursor position (section title), measured in JS like the dots */
.services-nav__default-anchor {
  position: absolute;
  top: calc(100% - 3rem);
  left: 50%;
  width: 0;
  height: 0;
}
.services-nav__track {
  position: absolute;
  top: 50%;
  left: 2.5rem;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--nav-gap);
}
.services-nav__dot {
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  border: 1px solid var(--color-accent-yellow);
}
/* Positioned instantly in JS, the motion comes from each dot's stagger */
.services-nav__cursor {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--cursor-size) * 0.125);
  width: var(--cursor-size);
  height: var(--cursor-size);
}
.services-nav__cursor span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--color-accent-yellow);
}
.services-nav__cursor span:nth-child(5) {
  background: #fff;
}

/* Slides are stacked, only .is-active is visible (cross-fade) */
.services-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.65s ease;
}
.services-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* Bounce is not applied to the whole slide (the image has its own animation) */
.section-header.services-slide {
  transform: scale(0.87) translateY(42px);
  transition:
    opacity 0.65s ease,
    transform 0.75s cubic-bezier(0.34, 1.65, 0.64, 1);
}
.section-header.services-slide.is-active {
  transform: scale(1) translateY(0);
}

/* Services head */
.section.services .section-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Limited width: never touches the edges or the progress marker */
  max-width: min(1200px, calc(100% - 14rem));
}
.section-header__cta {
  margin-top: 1.5rem;
}

.section.services h2,
.section.services p:not(.eyebrow) {
  color: white;
}
/* Service card */
.service-card {
  display: flex;
  gap: 5%;
  align-items: center;
  justify-content: space-between;
  margin: auto;
  padding-left: 8rem;
}

.service-card__texts {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1em;
  width: 58%;
  max-width: 870px;
  transform: scale(0.87) translateY(42px);
  transition: transform 0.75s cubic-bezier(0.34, 1.65, 0.64, 1);
}
.services-slide.is-active .service-card__texts {
  transform: scale(1) translateY(0);
}
.service-card__texts h3 {
  font-size: clamp(1.7rem, 1.2rem + 1.9vw, 3.3rem);
  color: var(--color-primary-soft);
}
.service-card__texts__title__accent {
  color: white;
}
.service-card__image {
  width: 42%;
}
.service-card__image img {
  height: 80vh;
  width: 100%;
  object-fit: cover;
  border-radius: 0;
  transform: translateX(90px);
  transition:
    transform 0.8s cubic-bezier(0.34, 1.2, 0.64, 1),
    border-radius 0.8s ease;
}
.services-slide.is-active .service-card__image img {
  border-radius: 100% 0 0 100%;
  transform: translateX(0);
}

/* ----- REALISATIONS PREVIEW ----- */
.realisations-preview .container {
  display: flex;
  flex-direction: column;
  gap: 2em;
}
.realisations-preview .container > .btn {
  align-self: flex-start;
}
.realisations-preview__intro {
  max-width: 52rem;
}

/* Animated title keeps its own large size */
.realisations-preview__header h2 {
  font-size: clamp(1.9rem, 7vw, 7rem);
}

/* Rotating title ("Mes [réalisations / sites vitrines / ...]") */
.rotating-title {
  --lh: 1.15em;
  --base: var(--color-primary-soft);
  --fill: var(--color-primary);
  --fill-duration: 1s;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25em;
  line-height: var(--lh);
}
.rotating-title__words {
  display: inline-block;
  vertical-align: top;
  height: var(--lh);
  overflow: hidden;
  transition: width 0.7s cubic-bezier(0.76, 0, 0.24, 1);
}
.rotating-title__track {
  display: block;
  will-change: transform;
}
/* Each word: two-color gradient clipped to the letters */
.rotating-title__track > span {
  display: block;
  width: max-content;
  color: transparent;
  background-image: linear-gradient(to top, var(--fill) 50%, var(--base) 50%);
  background-size: 100% 200%;
  background-position: 0 0;
  -webkit-background-clip: text;
  background-clip: text;
}
/* Fill: the background slides to show the filled half */
.rotating-title__track > span.is-filled {
  background-position: 0 100%;
  transition: background-position var(--fill-duration) linear;
}
@media (prefers-reduced-motion: reduce) {
  .rotating-title__track > span.is-filled {
    transition: none;
  }
}

/* Realisation cards */
.realisation-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding: 2rem 0;
  position: relative;
}

.realisation-card:first-child::before {
  content: "";
  height: 1px;
  width: 100vw;
  background-color: var(--color-primary-light);
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.realisation-card::after {
  content: "";
  height: 1px;
  width: 100vw;
  background-color: var(--color-primary-light);
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  transition: height 200ms ease-in-out;
}

.realisation-card:hover::after {
  height: 100%;
}

.realisation-card__texts,
.realisation-card__cats {
  position: relative;
  z-index: 2;
}

.realisation-card__texts {
  flex: 1;
  min-width: 0;
}

.realisation-card__title {
  font-size: clamp(1.6rem, 1.1rem + 2vw, 3.2rem);
  margin: 0;
  transition: color 200ms ease-in-out;
}

.realisation-card__desc {
  color: var(--color-text-muted);
}

.realisation-card:hover .realisation-card__title {
  color: var(--color-primary);
}

.realisation-card:hover .realisation-card__cats .tag {
  background: var(--color-accent-yellow);
  color: var(--color-text);
  border-color: var(--color-accent-yellow);
}

.realisation-card__cats {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  gap: 0.4rem;
}

/* Card image: hidden on desktop (hover thumbnail instead), shown without hover */
.realisation-card__media,
.realisation-card__btn {
  display: none;
}
/* Footer (categories + button): inline from tablet up */
.realisation-card__footer {
  display: contents;
}

/* Tablet (<= 1024px): image left, texts right */
@media (max-width: 1024px) {
  .realisation-card {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    grid-template-rows: 1fr auto auto 1fr;
    grid-template-areas:
      "media ."
      "media texts"
      "media footer"
      "media .";
    column-gap: 2rem;
    row-gap: 1rem;
    padding-block: 2rem;
  }
  /* No rule above the first card */
  .realisation-card:first-child::before {
    display: none;
  }
  .realisation-card__media {
    display: block;
    grid-area: media;
    position: relative;
    z-index: 2;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--color-primary-light);
  }
  .realisation-card__media img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }
  .realisation-card__texts {
    grid-area: texts;
  }
  .realisation-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    grid-area: footer;
    position: relative;
    z-index: 2;
  }
  .realisation-card__cats {
    flex-shrink: 1;
  }
  /* Smaller categories */
  .realisation-card__cats .tag.tag--xl {
    font-size: 0.88rem;
    padding: 0.25em 0.72em;
  }
  .realisation-card__btn {
    /* No margin-left:auto: the button stays right with space-between */
    display: inline-flex;
  }
}

/* Mobile (<= 768px): full-width image on top, rules kept */
@media (max-width: 768px) {
  .realisation-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 2rem 0;
  }
  .realisation-card__media {
    margin-inline: calc(-1 * var(--gutter));
    border-radius: 0;
  }
  .realisation-card__media img {
    aspect-ratio: 16 / 9;
  }
}

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

/* Floating thumbnail following the mouse on row hover */
.realisation-hover-preview {
  position: fixed;
  top: 0;
  left: 0;
  width: 30vw;
  height: auto;
  pointer-events: none;
  z-index: 999;
}
.realisation-hover-preview__inner {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-primary-light);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: scale(0.55);
  transition:
    opacity 0.3s ease,
    transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.realisation-hover-preview__inner.is-visible {
  opacity: 1;
  transform: scale(1);
}
.realisation-hover-preview img {
  width: 100%;
  height: auto;
  display: block;
}
.realisation-hover-preview__btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--color-accent-yellow);
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

@media (max-width: 1024px) {
  .realisation-hover-preview {
    display: none;
  }
}

/* ----- EXPERIENCE ----- */
.section.experience {
  padding-bottom: 0;
}
.experience__grid {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 3rem;
  align-items: center;
  margin-left: 0;
}

/* Cut-out photo overflowing the violet shape (sizes in cqw) */
.experience__image {
  --shape-h: 104cqw;
  --r: calc(var(--shape-h) / 2);
  container-type: inline-size;
  position: relative;
  width: 100%;
  max-width: 700px;
}
.experience__image::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--shape-h);
  background-color: var(--color-primary);
  border-radius: 0 var(--r) var(--r) 0;
}
.experience__image picture {
  display: block;
}
.experience__image img {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(1);
  border-radius: 0 0 var(--r) 0;
}
.experience__content {
  max-width: 900px;
}
.experience__text p + p {
  margin-top: 1em;
}
.experience__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}
.experience__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  border-top: 1px solid var(--color-primary);
  margin-top: 3rem;
  padding-top: 3rem;
}
.stat-card {
  max-width: 180px;
  text-align: left;
}
.stat-card__number {
  display: block;
  font-size: clamp(2.4rem, 4vw, 3.2rem);
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.6rem;
}
.stat-card__label {
  display: block;
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.4;
}

/* ----- TABLET AND MOBILE (<= 1024px) ----- */
@media (max-width: 1024px) {
  /* Pinned slides: text takes the gutter */
  .section.services .section-header.services-slide {
    max-width: 100%;
    padding-inline: var(--gutter);
  }

  /* Progress marker: dots aligned at the bottom of the screen */
  .services-nav {
    --cursor-size: clamp(24px, 7vw, 36px);
    --nav-gap: calc(var(--cursor-size) * 0.9);
  }
  .services-nav__track {
    top: auto;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
  }
  .services-nav__default-anchor {
    top: auto;
    bottom: calc(1.5rem + var(--dot-size) / 2);
    left: calc(50% - (1.5 * var(--dot-size) + var(--nav-gap)) - var(--cursor-size));
  }

  /* Pinned area fills the screen, under the transparent header */
  .services-sticky,
  body.admin-bar .services-sticky {
    top: 0;
    height: 100vh;
  }

  /* Image on top, text below (column-reverse) */
  .service-card {
    flex-direction: column-reverse;
    justify-content: flex-end;
    align-items: stretch;
    gap: 0;
    height: 100%;
    margin: 0;
    padding: 0;
  }
  .service-card__image {
    width: 100%;
  }
  .service-card__image img {
    height: 60vh;
    border-radius: 0;
    transform: translateY(-40px);
  }
  .services-slide.is-active .service-card__image img {
    border-radius: 0 0 2.5rem 2.5rem;
    transform: translateY(0);
  }
  .service-card__texts {
    width: 100%;
    max-width: none;
    /* Page gutter on the sides, room for the progress marker below */
    padding: 1.5rem var(--gutter) 4rem;
    gap: 0.75em;
  }
  .service-card__texts h3 {
    font-size: clamp(1.5rem, 1.1rem + 2vw, 2.2rem);
  }
  .service-card__texts p {
    max-width: 42rem;
    font-size: 0.95rem;
  }
}
/* ----- MOBILE (<= 768px) ----- */
@media (max-width: 768px) {
  .realisations-preview__header {
    text-align: center;
  }
  .rotating-title {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
  }
  .realisations-preview__intro {
    margin-inline: auto;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .experience__grid {
    grid-template-columns: 1fr;
    /* Text takes the gutter, the image keeps its bleed */
    width: 100%;
  }
  .experience__content {
    padding-inline: var(--gutter);
    /* Text above the image */
    order: -1;
  }
  .experience__image {
    max-width: 460px;
  }
}
/* Short screens: more room for the text */
@media (max-width: 1024px) and (max-height: 720px) {
  .service-card__image img {
    height: 48vh;
  }
}
@media (max-width: 480px) {
  .experience__stats {
    grid-template-columns: 1fr;
  }
}
