/* Essai « l'ascension » : chargé uniquement par test-histoire-montagne.html */

:root {
  --navy: #051525;
  --blue: #0d2d50;
  --ink: #050608;
  --gold: #ffffff;
  --gold-light: #d6e2ee;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
}

body {
  margin: 0;
  background: var(--navy);
  color: #fff;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
}

/* Interface fixe */
.h-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 50;
  background: #fff;
  transform-origin: 0 50%;
  transform: scaleX(var(--page, 0));
}

.h-top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  pointer-events: none;
}

.h-top > * {
  pointer-events: auto;
}

.h-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
}

.h-logo img {
  width: 44px;
  height: auto;
  filter: brightness(0) invert(1);
}

.h-logo b {
  font-weight: 300;
}

.h-logo span {
  font-weight: 700;
}

.h-top-cta {
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.h-badge {
  position: fixed;
  left: 50%;
  bottom: 0.8rem;
  z-index: 60;
  transform: translateX(-50%);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--gold);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Décor fixe : une seule toile, les images se fondent */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  will-change: opacity;
}

.layer[data-layer="lac"] {
  opacity: 1;
}

.layer video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  filter: saturate(1) contrast(1.02) brightness(1.06);
  transform: scale(calc(1.02 + var(--p, 0) * 0.1));
  will-change: transform;
}

.veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 28, 52, 0.1) 0%, transparent 26%, transparent 62%, rgba(8, 28, 52, 0.34) 100%),
    linear-gradient(90deg, rgba(8, 28, 52, 0.16) 0%, transparent 48%);
}

/* Mouvement permanent : caméra lente, rayons, lueur, particules */
.cam {
  position: absolute;
  inset: 0;
  animation: cam-a 22s ease-in-out infinite alternate;
  will-change: transform;
}

.cam--b {
  animation-name: cam-b;
  animation-duration: 26s;
}

@keyframes cam-a {
  0% { transform: scale(1.02) translate3d(-1.2%, 0.6%, 0); }
  100% { transform: scale(1.09) translate3d(1.2%, -0.8%, 0); }
}

@keyframes cam-b {
  0% { transform: scale(1.08) translate3d(1%, -0.6%, 0) rotate(0.3deg); }
  100% { transform: scale(1.02) translate3d(-1.3%, 0.7%, 0) rotate(-0.3deg); }
}

.rays {
  position: absolute;
  inset: -20% -10% 0 30%;
  mix-blend-mode: screen;
  pointer-events: none;
}

.rays span {
  position: absolute;
  top: 0;
  left: 50%;
  width: 9%;
  height: 130%;
  background: linear-gradient(180deg, rgba(255, 255, 250, 0.42), rgba(210, 232, 255, 0.08) 70%, transparent);
  filter: blur(18px);
  transform-origin: 50% 0;
  transform: rotate(28deg);
  animation: ray 7s ease-in-out infinite alternate;
}

.rays span:nth-child(2) {
  left: 66%;
  width: 6%;
  animation-duration: 9s;
  animation-delay: -3s;
}

.rays span:nth-child(3) {
  left: 36%;
  width: 5%;
  animation-duration: 11s;
  animation-delay: -6s;
}

@keyframes ray {
  0% { opacity: 0.25; transform: rotate(26deg) translateX(0); }
  100% { opacity: 0.85; transform: rotate(31deg) translateX(4%); }
}

.sun-glow {
  position: absolute;
  left: 8%;
  top: -18%;
  width: 78vmax;
  height: 56vmax;
  background: radial-gradient(ellipse at center, rgba(255, 255, 248, 0.28), rgba(176, 214, 255, 0.08) 42%, transparent 70%);
  mix-blend-mode: screen;
  animation: glow 7s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 1;
}

@keyframes glow {
  0% { opacity: 0.2; transform: scale(0.96); }
  100% { opacity: 0.38; transform: scale(1.05); }
}

.fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Récit : seul le texte défile */
main {
  position: relative;
  z-index: 1;
}

.scene {
  position: relative;
  height: calc(var(--len, 300) * 1vh);
}

.sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  opacity: var(--fg, 1);
}

.steps {
  position: absolute;
  left: clamp(1.25rem, 7vw, 6rem);
  top: 50%;
  width: min(36rem, calc(100% - 2.5rem));
  min-height: 14rem;
  transform: translateY(-50%);
}

.steps--center {
  left: 50%;
  width: min(44rem, calc(100% - 2.5rem));
  text-align: center;
  transform: translate(-50%, -50%);
}

.steps--right {
  left: auto;
  right: clamp(1.25rem, 7vw, 6rem);
  top: 32%;
}

.steps--guides {
  left: 50%;
  right: auto;
  top: 50%;
  width: min(62rem, calc(100% - 3rem));
  transform: translate(-50%, -50%);
}

.step {
  position: absolute;
  top: 50%;
  left: 0;
  right: auto;
  width: max-content;
  max-width: 100%;
  isolation: isolate;
  margin: 0;
  padding: 1.15rem 1.6rem;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4.2vw, 3rem);
  line-height: 1.2;
  font-weight: 600;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.65),
    0 2px 14px rgba(0, 0, 0, 0.5),
    0 8px 32px rgba(0, 0, 0, 0.4);
  opacity: var(--s, 0);
  transform: translate3d(0, calc(-50% + var(--sy, 0) * 1px), 0);
}

.step::before {
  content: "";
  position: absolute;
  inset: -18% -12%;
  z-index: -1;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.48) 0%, rgba(0, 0, 0, 0.18) 48%, transparent 74%);
  filter: blur(14px);
  pointer-events: none;
}

.step:has(.team),
.step:has(.paths) {
  width: 100%;
  padding: 0;
}

.step:has(.team)::before,
.step:has(.paths)::before,
.step:has(.intro-logo)::before {
  display: none;
}

.steps--center .step {
  left: 50%;
  transform: translate3d(-50%, calc(-50% + var(--sy, 0) * 1px), 0);
}

.steps .step:first-child {
  opacity: var(--s, 1);
}

.finale [data-in] {
  opacity: var(--in, 1);
}

[data-in] {
  opacity: var(--in, 0);
  transform: translate3d(0, calc((1 - var(--in, 0)) * 26px), 0);
}

.kicker {
  margin: 0 0 1rem;
  color: var(--gold-light);
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.steps--center .kicker {
  color: #fff;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.4rem, 11vw, 8rem);
  line-height: 1;
  font-weight: 700;
}

.lead {
  max-width: 32rem;
  margin: 1.3rem auto 0;
  font-family: var(--sans);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 400;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 3.4rem;
  width: 26px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  transform: translateX(-50%);
  opacity: calc(1 - var(--p, 0) * 5);
}

.scroll-cue span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: #fff;
  animation: cue 2.4s ease-in-out infinite;
}

@keyframes cue {
  0% { transform: translateY(0); opacity: 0; }
  30% { opacity: 1; }
  80% { transform: translateY(14px); opacity: 0; }
  100% { opacity: 0; }
}

.letter {
  width: min(100%, 22rem);
  padding: 1.6rem 1.6rem 1.4rem;
  border-radius: 6px;
  background: #fbf8f1;
  color: var(--navy);
  font-family: var(--sans);
  text-shadow: none;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.45);
  transform: rotate(-3deg);
}

.letter-head {
  margin: 0 0 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid rgba(5, 21, 37, 0.15);
  font-size: 0.85rem;
  font-weight: 600;
}

.letter-big {
  margin: 0;
  color: #b3261e;
  font-family: var(--serif);
  font-size: 3.6rem;
  font-weight: 700;
  line-height: 1;
}

.letter-sub {
  margin: 0.3rem 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.letter-note {
  margin: 0;
  color: #4a5568;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.45;
}

.paths {
  width: min(100%, 24rem);
  padding: 1.6rem 1.8rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(8, 18, 32, 0.28);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: none;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.55),
    0 4px 18px rgba(0, 0, 0, 0.35);
}

.paths-head {
  margin: 0 0 0.6rem;
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.paths ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.paths li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 4.4vw, 1.9rem);
  font-weight: 600;
  line-height: 1.1;
  --r: clamp(0, calc(var(--s, 1) * 2.2 - var(--i) * 0.28), 1);
  opacity: var(--r);
  transform: translate3d(calc((1 - var(--r)) * 1.5rem), 0, 0);
}

.paths li:last-child {
  border-bottom: 0;
}

.paths li span {
  min-width: 1.6rem;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.team {
  width: min(100%, 26rem);
  padding: 1.5rem 1.5rem 1.3rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(8, 18, 32, 0.28);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: none;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.55),
    0 4px 18px rgba(0, 0, 0, 0.35);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin: 0.4rem 0 1rem;
  padding: 0;
  list-style: none;
}

.team-grid li {
  --r: clamp(0, calc(var(--s, 1) * 2.4 - var(--i) * 0.1), 1);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  opacity: var(--r);
  transform: scale(calc(0.7 + var(--r) * 0.3));
}

.team-grid li:first-child {
  grid-column: span 2;
  grid-row: span 2;
  border: 2px solid #fff;
}

.team-grid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
}

.team-text {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
}

.steps--guides .team {
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.steps--guides .paths-head {
  margin: 0 0 1.15rem;
  color: #fff;
  font-size: 0.82rem;
  letter-spacing: 0.28em;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.65),
    0 6px 24px rgba(0, 0, 0, 0.45);
}

.steps--guides .team-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.95rem 0.8rem;
  margin: 0.55rem 0 1.05rem;
}

.steps--guides .team-grid li {
  display: flex;
  flex-direction: column;
  align-items: center;
  aspect-ratio: auto;
  overflow: visible;
  border: none;
  border-radius: 0;
  opacity: var(--s, 1);
  transform: none;
}

.steps--guides .team-grid li:first-child {
  grid-column: auto;
  grid-row: auto;
  border: none;
}

.steps--guides .team-grid img {
  width: 100%;
  max-width: 7.6rem;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  object-fit: cover;
  object-position: 50% 16%;
}

.steps--guides .team-name {
  display: block;
  margin: 0.45rem 0 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 10px rgba(5, 21, 37, 0.7);
}

.ceo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.2rem;
  text-align: left;
  text-shadow: none;
}

.ceo img {
  width: 64px;
  height: 64px;
  border: 2px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 18%;
}

.ceo p {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
}

.ceo b {
  display: block;
  color: #fff;
  font-family: var(--serif);
  font-size: 1.15rem;
}

.intro-logo {
  margin: 0 auto 1.6rem;
  text-shadow: none;
}

.intro-logo img {
  display: block;
  width: clamp(84px, 16vw, 130px);
  height: auto;
  margin: 0 auto 0.7rem;
  background: none;
  filter: none;
}

.intro-logo-name {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(1.5rem, 4.6vw, 2.4rem);
  letter-spacing: 0.16em;
  line-height: 1;
}

.intro-logo-name span {
  font-weight: 300;
}

.intro-logo-name b {
  font-weight: 700;
}

.intro-logo-tag {
  margin: 0.6rem 0 0;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

.h-play {
  position: fixed;
  right: 1rem;
  bottom: 0.8rem;
  z-index: 61;
  padding: 0.45rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: rgba(5, 21, 37, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font: 600 0.75rem var(--sans);
  cursor: pointer;
}

.pillar {
  margin: 0;
  font-size: clamp(2.6rem, 8vw, 4.8rem);
  font-weight: 700;
  line-height: 1;
}

.pillar-text {
  max-width: 30rem;
  margin: 0.9rem 0 0;
  font-family: var(--sans);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.88);
}

.count {
  margin: 0;
}

.count b {
  display: block;
  font-size: clamp(3.4rem, 10vw, 6.5rem);
  line-height: 1;
}

.count span {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
}

.offices {
  display: grid;
  gap: 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.offices li {
  padding-left: 1rem;
  border-left: 2px solid var(--gold);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
}

.offices b {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  color: #fff;
}

.finale {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1.5rem 2rem;
  text-align: center;
  text-shadow: 0 4px 30px rgba(5, 21, 37, 0.5);
}

.finale .lead,
.finale .finma {
  position: relative;
  isolation: isolate;
  padding: 1.1rem 1.5rem;
  background: none;
  box-shadow: none;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.65),
    0 2px 14px rgba(0, 0, 0, 0.5),
    0 8px 32px rgba(0, 0, 0, 0.4);
}

.finale .lead::before,
.finale .finma::before {
  content: "";
  position: absolute;
  inset: -22% -10%;
  z-index: -1;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.48) 0%, rgba(0, 0, 0, 0.16) 50%, transparent 74%);
  filter: blur(14px);
  pointer-events: none;
}

.finale .lead {
  max-width: 38rem;
  margin: 0;
}

.finale h2 {
  max-width: 46rem;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 5.5vw, 4.2rem);
  line-height: 1.1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  text-shadow: none;
}

.btn--gold {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}

.btn--ghost {
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  background: rgba(5, 21, 37, 0.25);
  color: #fff;
}

.finma {
  max-width: 30rem;
  margin: 1.6rem auto 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .h-top {
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }

  .h-top-cta {
    padding: 0.5rem 0.85rem;
    font-size: 0.78rem;
  }

  .h-logo span {
    display: none;
  }

  .h-play {
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(0.8rem, env(safe-area-inset-bottom));
  }

  .layer video {
    object-position: var(--pos, 50%) 42%;
  }

  .veil {
    background:
      linear-gradient(180deg, rgba(8, 28, 52, 0.14) 0%, transparent 22%, transparent 50%, rgba(8, 28, 52, 0.42) 100%);
  }

  .steps,
  .steps--right,
  .steps--center,
  .steps--guides {
    left: 1.1rem;
    right: 1.1rem;
    top: 4.4rem;
    bottom: 4.8rem;
    width: auto;
    min-height: 0;
    transform: none;
  }

  .step,
  .steps--center .step,
  .steps--guides .step {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    font-size: 1.55rem;
    transform: translate3d(0, calc(var(--sy, 0) * 1px), 0);
  }

  .steps--center .step,
  .step:has(.team),
  .step:has(.paths),
  .step:has(.offices) {
    top: 50%;
    bottom: auto;
    transform: translate3d(0, calc(-50% + var(--sy, 0) * 1px), 0);
  }

  .intro-logo {
    margin-bottom: 1rem;
  }

  .intro-logo-tag {
    letter-spacing: 0.12em;
    font-size: 0.62rem;
  }

  h1 {
    font-size: 3.1rem;
  }

  .paths {
    width: 100%;
    padding: 1.15rem 1.15rem 0.7rem;
  }

  .paths li {
    padding: 0.55rem 0;
    font-size: 1.28rem;
  }

  .steps--guides .team {
    padding: 0;
  }

  .steps--guides .paths-head {
    margin-bottom: 0.7rem;
  }

  .steps--guides .team-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.95rem 0.3rem;
    margin-bottom: 0;
  }

  .steps--guides .team-grid img {
    max-width: 4.15rem;
  }

  .steps--guides .team-name {
    max-width: 4.6rem;
    margin-top: 0.3rem;
    font-size: 0.58rem;
    line-height: 1.15;
  }

  .steps--guides .team-text {
    font-size: 0.82rem;
  }

  .offices {
    gap: 0.8rem;
  }

  .letter {
    padding: 1.3rem;
  }

  .letter-big {
    font-size: 3rem;
  }

  .finale {
    padding: 4.6rem 1.15rem 4.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue span,
  .cam,
  .rays span,
  .sun-glow {
    animation: none;
  }

  .fx {
    display: none;
  }
}
