/* Section — Pourquoi Kallystra (onglets + document démarche) */

.sci-why {
  --why-ink: #0f172a;
  --why-paper: #f7f8fb;
  --why-paper-edge: #e8ebf1;
  --why-paper-ink: #14213a;
  --why-paper-muted: #46516a;
  --why-paper-soft: #5c667c;
  --why-indigo: #484f8a;
  --why-orange: #f1894e;
  --why-title: #f3f5fa;
  --why-body: #c5d0de;
  --why-line: rgba(255, 255, 255, 0.14);
  --why-rule: rgba(20, 33, 58, 0.14);
  /* Plus de serif externe : titres document = Genos, sous-titres = Exo 2 */
  --why-serif: var(--font-title);
  position: relative;
  isolation: isolate;
  background: var(--why-ink);
  color: var(--why-title);
  /* padding-block = --sci-section-y via .sci-page :is(.sci-why, ...) */
  overflow-x: clip;
  overflow-y: visible;
}

.sci-why__inner {
  width: 100%;
}

/* Titre : largeur utile complète — ~2 lignes sur grand écran, sans <br> forcé */
.sci-page .sci-why__title,
.sci-why__title {
  margin: 0 0 clamp(1.35rem, 2.4vw, 1.85rem);
  max-width: min(100%, 22em);
  font-family: var(--font-title);
  font-size: var(--fs-title);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--why-title);
}

/* Composition : onglets + texte | document aligné au niveau des onglets */
.sci-why__stage {
  display: grid;
  grid-template-columns: minmax(0, 0.46fr) minmax(0, 0.54fr);
  column-gap: clamp(2.25rem, 3vw, 3.5rem);
  row-gap: 0;
  align-items: start;
}

.sci-why__tabs {
  position: relative;
  z-index: 3;
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.35rem 2rem;
  margin: 0;
  border-bottom: 1px solid var(--why-line);
  padding: 0;
  list-style: none;
}

.sci-why__tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  min-height: 2.75rem;
  padding: 0.7rem 0.1rem 0.95rem;
  border: 0;
  border-radius: 0.25rem 0.25rem 0 0;
  background: transparent;
  color: rgba(197, 208, 222, 0.78);
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 1.15vw, 1.2rem);
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: color 0.2s ease;
}

.sci-why__tab:hover {
  color: var(--why-title);
}

.sci-why__tab:focus {
  outline: none;
}

.sci-why__tab:focus-visible {
  color: var(--why-title);
  box-shadow: 0 0 0 2px var(--why-ink), 0 0 0 4px var(--why-orange);
}

.sci-why__tab[aria-selected="true"] {
  color: var(--why-title);
}

.sci-why__tab-icon {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  opacity: 0.95;
}

.sci-why__tab-indicator {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 3px;
  width: 0;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, var(--why-orange), #ffb07a);
  box-shadow: 0 0 12px rgba(241, 137, 78, 0.35);
  pointer-events: none;
  transform-origin: left center;
}

.sci-why:not(.is-enhanced) .sci-why__tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--why-orange);
}

/* Panels : sans JS = pile ; avec JS = display:contents → grille du stage */
.sci-why__panels {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 5vw, 4rem);
  margin-top: 1.35rem;
}

.sci-why.is-enhanced .sci-why__panels {
  display: contents;
  margin-top: 0;
  gap: 0;
}

.sci-why.is-enhanced .sci-why__panel {
  display: contents;
}

.sci-why.is-enhanced .sci-why__panel[hidden] {
  display: none;
}

.sci-why.is-enhanced .sci-why__panel[hidden] .sci-why__copy,
.sci-why.is-enhanced .sci-why__panel[hidden] .sci-why__visual {
  display: none;
}

.sci-why:not(.is-enhanced) .sci-why__panel {
  display: grid;
  grid-template-columns: minmax(0, 0.46fr) minmax(0, 0.54fr);
  column-gap: clamp(2.25rem, 3vw, 3.5rem);
  align-items: start;
}

.sci-why.is-enhanced .sci-why__copy {
  grid-column: 1;
  grid-row: 2;
  padding-top: 1.35rem;
}

.sci-why.is-enhanced .sci-why__visual {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  padding-top: 0.15rem;
}

.sci-why__copy {
  min-width: 0;
}

.sci-page .sci-why__eyebrow,
.sci-why__eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.8125rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--why-orange);
}

.sci-page .sci-why__panel-title,
.sci-why__panel-title {
  margin: 0;
  max-width: none;
  font-family: var(--font-subtitle);
  font-size: var(--fs-subtitle);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--why-title);
}

.sci-page .sci-why__panel-text,
.sci-why__panel-text {
  margin: 1.15rem 0 0;
  max-width: none;
  font-size: clamp(1.05rem, 1.15vw, 1.15rem);
  font-weight: 500;
  line-height: 1.65;
  color: var(--why-body);
}

.sci-why__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: clamp(1.6rem, 2.8vw, 2.25rem);
  min-height: 3.25rem;
  padding: 0.9rem 1.55rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.02);
  color: var(--why-title);
  font-size: 1rem;
  font-weight: 650;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition:
    border-color 0.25s ease,
    color 0.25s ease,
    background 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.sci-why__cta:hover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 10px 24px rgba(0, 0, 0, 0.22);
}

.sci-why__cta:focus-visible {
  outline: 2px solid var(--why-orange);
  outline-offset: 3px;
}

.sci-why__cta-arrow {
  color: var(--why-orange);
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 0.25s ease;
}

.sci-why__cta:hover .sci-why__cta-arrow {
  transform: translateX(4px);
}

/* —— Document —— */
.sci-why__visual {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.sci-why__visual::before {
  content: "";
  position: absolute;
  inset: 8% 4% 4% 8%;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at 55% 45%,
    rgba(72, 79, 138, 0.28) 0%,
    rgba(241, 137, 78, 0.08) 42%,
    transparent 70%
  );
  filter: blur(28px);
  pointer-events: none;
  z-index: 0;
}

.sci-why__stack {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.45rem 1.4rem 1.45rem 0.2rem;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) and (pointer: fine) {
  .sci-why__stack:hover {
    transform: translateY(-5px);
  }

  .sci-why__stack:hover .sci-why__sheet {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.95) inset,
      0 22px 48px rgba(0, 0, 0, 0.38),
      0 2px 0 rgba(20, 33, 58, 0.04);
  }

  .sci-why__stack:hover .sci-why__sheet-back--1 {
    transform: translate3d(8px, 10px, 0) rotate(0.85deg);
  }

  .sci-why__stack:hover .sci-why__sheet-back--2 {
    transform: translate3d(16px, 18px, 0) rotate(1.7deg);
  }
}

.sci-why__sheet-back {
  position: absolute;
  inset: 0.45rem 1.4rem 1.45rem 0.2rem;
  border-radius: 0.35rem;
  background: linear-gradient(165deg, #ffffff 0%, var(--why-paper-edge) 100%);
  border: 1px solid rgba(20, 33, 58, 0.09);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.sci-why__sheet-back--2 {
  transform: translate3d(13px, 15px, 0) rotate(1.45deg);
  z-index: 0;
}

.sci-why__sheet-back--1 {
  transform: translate3d(6.5px, 7.5px, 0) rotate(0.7deg);
  z-index: 1;
}

.sci-why__sheet {
  --why-paper-ink: #14213a;
  --why-paper-muted: #46516a;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: clamp(1.65rem, 2.9vw, 2.25rem) clamp(1.65rem, 3.1vw, 2.45rem) 1.3rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(20, 33, 58, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, transparent 28%),
    linear-gradient(180deg, #fcfdff 0%, var(--why-paper) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 18px 40px rgba(0, 0, 0, 0.32),
    0 1px 0 rgba(20, 33, 58, 0.04);
  color: var(--why-paper-ink);
  opacity: 1;
  transform: rotate(-0.85deg);
  transform-origin: 50% 100%;
  transition: transform 0.4s ease, opacity 0.32s ease, box-shadow 0.45s ease;
}

/* Palette papier : bat .sci-page p / héritage du thème sombre */
.sci-page .sci-why__sheet,
.sci-why__sheet {
  color: #14213a;
}

.sci-page .sci-why__sheet p,
.sci-why__sheet p {
  color: #46516a;
  font-size: inherit;
  line-height: inherit;
  opacity: 1;
}

.sci-why.is-enhanced .sci-why__sheet.is-leaving {
  opacity: 0;
  transform: rotate(-0.9deg) translateX(-10px);
}

.sci-why.is-enhanced .sci-why__sheet.is-entering {
  opacity: 0;
  transform: rotate(-0.9deg) translateX(10px);
}

.sci-why__sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--why-rule);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5c667c;
}

.sci-page .sci-why__sheet-title,
.sci-why__sheet-title {
  margin: 0.15rem 0 0;
  font-family: var(--why-serif);
  font-size: clamp(1.55rem, 1.95vw, 1.95rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: #14213a;
}

.sci-page .sci-why__sheet-sub,
.sci-why__sheet-sub {
  margin: 0.6rem 0 0;
  font-family: var(--font-subtitle);
  font-size: clamp(0.95rem, 1.05vw, 1.05rem);
  font-weight: 500;
  line-height: 1.45;
  color: #46516a;
}

.sci-why__steps {
  margin: 1.35rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sci-why__step {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  column-gap: 1rem;
  padding: 0.95rem 0;
  border-top: 1px solid var(--why-rule);
}

.sci-why__step:first-child {
  border-top: 1px solid var(--why-rule);
  padding-top: 1rem;
}

.sci-why__step-num {
  display: block;
  padding-top: 0.12rem;
  font-family: var(--why-serif);
  font-size: clamp(1.55rem, 1.9vw, 1.95rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--why-orange);
  line-height: 1;
}

.sci-why__step-body {
  min-width: 0;
}

.sci-page .sci-why__step-title,
.sci-why__step-title {
  margin: 0;
  font-family: var(--font-subtitle);
  font-size: clamp(1.05rem, 1.15vw, 1.15rem);
  font-weight: 700;
  line-height: 1.3;
  color: #14213a;
}

.sci-page .sci-why__step-text,
.sci-why__step-text {
  margin: 0.35rem 0 0;
  font-family: var(--font-body);
  font-size: clamp(0.92rem, 1vw, 0.98rem);
  font-weight: 500;
  line-height: 1.55;
  color: #46516a;
}

.sci-page .sci-why__sheet-note,
.sci-why__sheet-note {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 1.2rem 0 0;
  padding: 0.8rem 0.95rem;
  border-radius: 0.3rem;
  background: linear-gradient(90deg, rgba(72, 79, 138, 0.12), rgba(72, 79, 138, 0.06));
  color: #2f3658;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 550;
  line-height: 1.45;
}

.sci-why__sheet-note::before {
  content: "";
  flex: 0 0 auto;
  width: 2.5px;
  align-self: stretch;
  min-height: 1em;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--why-orange), var(--why-indigo));
}

.sci-why__sheet-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.2rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--why-rule);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #5c667c;
}

/* —— Entry animation —— */
.sci-why.is-enhanced [data-sci-why-reveal] {
  opacity: 0;
  transform: translateY(12px);
  will-change: opacity, transform;
}

.sci-why.is-enhanced [data-sci-why-reveal].is-revealed {
  opacity: 1;
  transform: none;
  will-change: auto;
}

.sci-why.is-enhanced [data-sci-why-stack] {
  opacity: 0;
  transform: translateY(14px);
  will-change: opacity, transform;
}

.sci-why.is-enhanced [data-sci-why-stack].is-revealed {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .sci-why__stage,
  .sci-why:not(.is-enhanced) .sci-why__panel {
    column-gap: 1.75rem;
  }

  .sci-why__sheet {
    transform: rotate(-0.7deg);
  }
}

@media (max-width: 900px) {
  .sci-page .sci-why__title,
  .sci-why__title {
    max-width: none;
  }

  .sci-why__stage {
    grid-template-columns: 1fr;
  }

  .sci-why__tabs {
    grid-column: 1;
    grid-row: auto;
  }

  .sci-why.is-enhanced .sci-why__panels {
    display: block;
  }

  .sci-why.is-enhanced .sci-why__panel {
    display: block;
  }

  .sci-why.is-enhanced .sci-why__panel[hidden] {
    display: none;
  }

  .sci-why.is-enhanced .sci-why__copy,
  .sci-why.is-enhanced .sci-why__visual {
    grid-column: auto;
    grid-row: auto;
    padding-top: 0;
  }

  .sci-why:not(.is-enhanced) .sci-why__panel {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .sci-why__panels {
    margin-top: 1.25rem;
  }

  .sci-why.is-enhanced .sci-why__copy {
    margin-top: 1.25rem;
  }

  .sci-why.is-enhanced .sci-why__visual {
    margin-top: 1.5rem;
  }

  .sci-why__stack {
    max-width: 32rem;
    margin-inline: auto;
    padding-right: 0.55rem;
    padding-bottom: 0.75rem;
  }

  .sci-why__sheet {
    transform: none;
  }

  .sci-why__sheet-back {
    inset: 0 0.55rem 0.75rem 0;
  }

  .sci-why__sheet-back--2 {
    transform: translate3d(8px, 9px, 0) rotate(0.9deg);
  }

  .sci-why__sheet-back--1 {
    transform: translate3d(4px, 4px, 0) rotate(0.45deg);
  }

  .sci-why__stack:hover {
    transform: none;
  }
}

@media (max-width: 520px) {
  .sci-why__tabs {
    gap: 0.2rem 1.15rem;
  }

  .sci-why__tab {
    font-size: 0.98rem;
    min-height: 2.75rem;
  }

  .sci-why__tab-icon {
    width: 1.2rem;
    height: 1.2rem;
  }

  .sci-why__step {
    grid-template-columns: 2.6rem minmax(0, 1fr);
    column-gap: 0.75rem;
  }

  .sci-why__sheet-back--2 {
    transform: translate3d(5px, 6px, 0);
  }

  .sci-why__sheet-back--1 {
    transform: translate3d(2.5px, 3px, 0);
  }
}

@media (min-width: 1440px) {
  .sci-page .sci-why__title,
  .sci-why__title {
    font-size: var(--fs-title);
    max-width: min(100%, 21em);
  }

  .sci-page .sci-why__panel-title,
  .sci-why__panel-title {
    font-size: clamp(1.9rem, 2vw, 2.25rem);
  }
}

@media (min-width: 1600px) {
  .sci-why__stage,
  .sci-why:not(.is-enhanced) .sci-why__panel {
    column-gap: 4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sci-why__tab,
  .sci-why__cta,
  .sci-why__cta-arrow,
  .sci-why__sheet,
  .sci-why__stack,
  .sci-why__sheet-back {
    transition: none;
  }

  .sci-why__stack:hover {
    transform: none;
  }

  .sci-why.is-enhanced [data-sci-why-reveal],
  .sci-why.is-enhanced [data-sci-why-stack],
  .sci-why.is-enhanced .sci-why__sheet.is-leaving,
  .sci-why.is-enhanced .sci-why__sheet.is-entering {
    opacity: 1;
    transform: none;
  }

  .sci-why.is-enhanced .sci-why__sheet.is-leaving,
  .sci-why.is-enhanced .sci-why__sheet.is-entering {
    transform: rotate(-0.85deg);
  }
}
