/* ============================================================
   PAGE « NOTRE HISTOIRE » — /histoire/
   S'appuie sur orbya-theme.css (variables, topbar, boutons,
   eyebrow, stamp, scrim, footer). Aucun WebGL : ciel en CSS.
   ============================================================ */

/* Ciel crépusculaire plus lumineux que le noir spatial de l'accueil :
   indigo et violet éclairés de lueurs cyan et magenta. */
.histoire-page {
  background: #262a66;
}

.histoire-skip {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 100;

  padding: 10px 16px;

  color: #03040c;
  background: var(--cyan);
  border-radius: 30px;

  font-weight: 600;
  text-decoration: none;
}

.histoire-skip:focus {
  top: 12px;
}

/* ---------------- Ciel ---------------- */

.histoire-sky {
  position: fixed;
  inset: 0;
  z-index: 0;

  overflow: hidden;
  pointer-events: none;

  background:
    radial-gradient(ellipse 70% 55% at 8% 0%, rgba(40, 216, 255, .34), transparent 70%),
    radial-gradient(ellipse 60% 60% at 100% 30%, rgba(214, 41, 118, .32), transparent 70%),
    radial-gradient(ellipse 80% 60% at 30% 100%, rgba(91, 61, 245, .55), transparent 70%),
    linear-gradient(170deg, #2c3a7e 0%, #33307a 45%, #2a2466 100%);
}

.histoire-stars {
  position: absolute;
  inset: -50%;

  background-repeat: repeat;
}

.histoire-stars--a {
  opacity: .75;
  background-image:
    radial-gradient(circle at 7% 13%, #fff 0 .9px, transparent 1.5px),
    radial-gradient(circle at 23% 71%, #cfe6ff 0 .8px, transparent 1.4px),
    radial-gradient(circle at 41% 37%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 58% 88%, #fff 0 .7px, transparent 1.3px),
    radial-gradient(circle at 66% 19%, #b5e8ff 0 .9px, transparent 1.5px),
    radial-gradient(circle at 83% 54%, #fff 0 .8px, transparent 1.4px),
    radial-gradient(circle at 94% 8%, #ffe3bd 0 .9px, transparent 1.5px),
    radial-gradient(circle at 12% 46%, #fff 0 .6px, transparent 1.2px);
  background-size: 613px 557px;
  animation: histoire-drift 180s linear infinite;
}

.histoire-stars--b {
  opacity: .5;
  background-image:
    radial-gradient(circle at 18% 28%, #fff 0 1.2px, transparent 2px),
    radial-gradient(circle at 52% 63%, #ffd9a6 0 1px, transparent 1.8px),
    radial-gradient(circle at 79% 33%, #cfe6ff 0 1.1px, transparent 1.9px),
    radial-gradient(circle at 36% 91%, #fff 0 .9px, transparent 1.6px),
    radial-gradient(circle at 88% 79%, #fff 0 .8px, transparent 1.5px);
  background-size: 887px 743px;
  animation: histoire-drift 260s linear infinite reverse;
}

.histoire-nebula {
  position: absolute;
  top: 8%;
  right: -12%;

  width: 60vw;
  height: 60vw;

  background: radial-gradient(circle, rgba(140, 110, 255, .35), transparent 62%);
  filter: blur(10px);
}

@keyframes histoire-drift {
  to {
    transform: translate3d(-120px, 60px, 0);
  }
}

/* ---------------- Mise en page ---------------- */

.histoire {
  position: relative;
  z-index: 2;

  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 120px 0 80px;
}

.histoire-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;

  margin: 0 0 28px;
  padding: 0;

  color: var(--faint);
  list-style: none;

  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.histoire-crumbs li + li::before {
  content: "/";
  margin-right: 8px;
  opacity: .6;
}

.histoire-crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.histoire-crumbs a:hover,
.histoire-crumbs a:focus-visible {
  color: var(--accent);
}

.histoire-crumbs [aria-current] {
  color: var(--accent);
}

/* ---------------- Ouverture ---------------- */

.histoire-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  align-items: center;
  gap: clamp(24px, 5vw, 64px);

  min-height: calc(100vh - 200px);
  padding-bottom: 40px;
}

.histoire-hero h1 {
  margin: 22px 0 0;

  font-size: clamp(44px, 8vw, 96px);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: .98;
}

.histoire-hero h1 .g,
.histoire-today h2 .g {
  color: transparent;

  background: var(--grad);
  background-clip: text;
  -webkit-background-clip: text;
}

.histoire-lead {
  max-width: 540px;
  margin: 26px 0 0;

  color: var(--muted);

  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.55;
}

.histoire-scroll {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  margin-top: 36px;
  padding: 12px 0;

  color: var(--accent);

  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 3px;
  text-decoration: none;
  text-transform: uppercase;
}

.histoire-scroll:hover,
.histoire-scroll:focus-visible {
  color: var(--ink);
}

/* Illustration orbitale (CSS uniquement). */
.histoire-orbit {
  position: relative;

  width: min(420px, 80vw);
  aspect-ratio: 1;
  margin: 0 auto;
}

.histoire-orbit__planet {
  position: absolute;
  top: 50%;
  left: 50%;

  width: 30%;
  aspect-ratio: 1;

  background:
    radial-gradient(circle at 32% 30%, rgba(255, 255, 255, .55), transparent 28%),
    conic-gradient(from 200deg, var(--cyan), var(--violet), var(--magenta), var(--gold), var(--cyan));
  border-radius: 50%;
  box-shadow:
    0 0 60px rgba(91, 61, 245, .55),
    inset -14px -16px 30px rgba(3, 4, 12, .55);

  transform: translate(-50%, -50%);
}

.histoire-orbit__ring {
  position: absolute;
  top: 50%;
  left: 50%;

  border: 1px solid rgba(150, 175, 255, .22);
  border-radius: 50%;

  transform: translate(-50%, -50%);
  animation: histoire-spin linear infinite;
}

.histoire-orbit__ring--1 {
  width: 52%;
  height: 52%;
  animation-duration: 16s;
}

.histoire-orbit__ring--2 {
  width: 76%;
  height: 76%;
  border-style: dashed;
  animation-duration: 28s;
  animation-direction: reverse;
}

.histoire-orbit__ring--3 {
  width: 100%;
  height: 100%;
  animation-duration: 44s;
}

.histoire-orbit__moon {
  position: absolute;
  top: -5px;
  left: 50%;

  width: 10px;
  height: 10px;
  margin-left: -5px;

  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--cyan);
}

.histoire-orbit__ring--2 .histoire-orbit__moon {
  top: auto;
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}

.histoire-orbit__ring--3 .histoire-orbit__moon {
  top: 50%;
  left: -6px;
  width: 12px;
  height: 12px;
  margin: -6px 0 0;
  background: var(--magenta);
  box-shadow: 0 0 14px var(--magenta);
}

@keyframes histoire-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* ---------------- Chapitres ---------------- */

.histoire-chapter {
  position: relative;

  max-width: 820px;
  margin: 0 0 clamp(36px, 6vw, 72px);
  scroll-margin-top: 110px;
}

.histoire-chapter--alt {
  margin-left: auto;
}

.histoire-chapter .scrim {
  position: relative;
  overflow: hidden;
}

.histoire-chapter__num {
  position: absolute;
  top: 10px;
  right: 24px;

  color: transparent;
  -webkit-text-stroke: 1px rgba(150, 175, 255, .22);

  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(70px, 12vw, 130px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.histoire-chapter .histoire-chapter__kicker {
  margin: 0 0 10px;

  color: var(--accent);

  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.histoire-chapter h2 {
  position: relative;

  max-width: 620px;
  margin: 0 0 20px;

  font-size: clamp(28px, 4.4vw, 46px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.08;
}

.histoire-chapter p {
  position: relative;

  max-width: 640px;
  margin: 0 0 16px;

  color: var(--muted);

  font-size: clamp(16px, 1.7vw, 18px);
  line-height: 1.7;
}

.histoire-chapter p:last-child {
  margin-bottom: 0;
}

.histoire-quote {
  margin: 26px 0;
  padding: 4px 0 4px 22px;

  border-left: 2px solid;
  border-image: var(--grad) 1;
}

.histoire-quote p {
  color: var(--ink);

  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 500;
  line-height: 1.35;
}

/* ---------------- Trajectoire du nom ---------------- */

.histoire-names {
  max-width: none;
}

.histoire-steps {
  position: relative;

  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;

  margin: 34px 0 0;
  padding: 0;

  list-style: none;
}

/* Ligne d'orbite reliant les étapes. */
.histoire-steps::before {
  content: "";

  position: absolute;
  top: 7px;
  right: 12%;
  left: 7px;

  height: 1px;

  background: linear-gradient(90deg, rgba(150, 175, 255, .35), var(--cyan), var(--magenta));
}

.histoire-step {
  position: relative;
  padding-top: 34px;
}

.histoire-step__dot {
  position: absolute;
  top: 0;
  left: 0;

  width: 15px;
  height: 15px;

  background: var(--space);
  border: 2px solid var(--cyan);
  border-radius: 50%;
}

.histoire-step--final .histoire-step__dot {
  background: var(--grad);
  border-color: transparent;
  box-shadow: 0 0 18px rgba(214, 41, 118, .6);
}

.histoire-chapter .histoire-step__word {
  margin: 0 0 10px;

  color: var(--ink);

  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: -.5px;
  line-height: 1.1;
}

.histoire-step__word mark {
  color: transparent;

  background: var(--grad);
  background-clip: text;
  -webkit-background-clip: text;
}

.histoire-step--final .histoire-step__word {
  color: transparent;

  background: var(--grad);
  background-clip: text;
  -webkit-background-clip: text;
}

.histoire-chapter .histoire-step__text {
  font-size: 15px;
  line-height: 1.6;
}

/* ---------------- Aujourd'hui ---------------- */

.histoire-today {
  max-width: none;
  text-align: center;
}

.histoire-today h2 {
  max-width: 760px;
  margin: 20px auto 18px;
}

.histoire-today p {
  margin-right: auto;
  margin-left: auto;
}

.histoire-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;

  margin-top: 32px;
}

.histoire-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  margin-top: 26px;
  padding: 8px 4px;

  color: var(--muted);

  font-size: 14px;
  text-decoration: none;
}

.histoire-back:hover,
.histoire-back:focus-visible {
  color: var(--accent);
}

/* ---------------- Apparition douce ---------------- */

.js .hv {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity .8s var(--ease),
    transform .8s var(--ease);
}

.js .hv.in {
  opacity: 1;
  transform: none;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .histoire-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: 10px;
  }

  .histoire-orbit {
    width: min(300px, 70vw);
    order: -1;
  }

  .histoire-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 34px;
  }

  .histoire-steps::before {
    display: none;
  }
}

@media (max-width: 640px) {
  .histoire {
    width: calc(100% - 32px);
    padding-top: 96px;
  }

  .histoire-orbit {
    width: min(220px, 60vw);
  }

  .histoire-steps {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  /* Trajectoire verticale sur mobile. */
  .histoire-steps::before {
    display: block;
    top: 8px;
    bottom: 8px;
    left: 7px;
    right: auto;
    width: 1px;
    height: auto;
    background: linear-gradient(180deg, rgba(150, 175, 255, .35), var(--cyan), var(--magenta));
  }

  .histoire-step {
    padding: 0 0 0 34px;
  }

  .histoire-chapter__num {
    top: 6px;
    right: 14px;
  }

  .histoire-cta .btn {
    width: 100%;
  }
}

/* ---------------- Mouvement réduit ---------------- */

@media (prefers-reduced-motion: reduce) {
  .histoire-stars,
  .histoire-orbit__ring {
    animation: none;
  }

  .js .hv {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
