/* ══════════════════════════════════════════════════════════════
   QUATRE CASE STUDY DETAIL PAGE — CASE-STUDY.HTML SPECIFIC STYLES
   ═════════════════════════════════════════════════════════════ */

html,
body {
  background: var(--bg); /* page case study — fond aligné sur var(--bg) */
}

.pt-in main {
  opacity: 0;
}

.cs-page {
  background: var(--bg);
}

/* ─── Page recule quand une modale est ouverte ─── */

body.has-modal .cs-page,
body.has-modal .cs-related,
body.has-modal .cta,
body.has-modal footer {
  transform: scale(0.955) translateY(-10px);
  transform-origin: top center;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.85s cubic-bezier(0.4, 0, 0.2, 1),
              border-radius 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

body:not(.has-modal) .cs-page,
body:not(.has-modal) .cs-related,
body:not(.has-modal) .cta,
body:not(.has-modal) footer {
  transform: scale(1) translateY(0);
  border-radius: 0;
  transition: transform 0.85s cubic-bezier(0.4, 0, 0.2, 1),
              border-radius 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── GALLERY MODAL — overlay + bottom sheet ─── */

/* Overlay sombre — laisse voir la page derrière */
.cs-gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.25s;
}

.cs-gallery-modal.is-open {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Panneau blanc — slide depuis le bas */
.cs-gallery-modal-inner {
  position: absolute;
  left: 56px;
  right: 56px;
  bottom: 8px;
  top: 56px;
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  transform: translateY(100vh);
  transition: transform 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Poignée */
.cs-gallery-modal-inner::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.12);
  z-index: 6;
  pointer-events: none;
}

.cs-gallery-modal.is-open .cs-gallery-modal-inner {
  transform: translateY(0);
}

/* ─── Header flottant — les images passent dessous ─── */
.cs-modal-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 64px 32px 64px;
  background: none;
  pointer-events: none;  /* les clics passent au scroll en dessous */
}

/* Le titre et le bouton restent cliquables */
.cs-modal-title,
.cs-gallery-close {
  pointer-events: auto;
}

.cs-modal-title {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 500;
  color: #0f0f0f;
}

/* Bouton fermer */
.cs-gallery-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0a0a0a;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cs-gallery-close:hover {
  transform: scale(1.1);
}

/* Zone de scroll — toute la hauteur du panneau, padding haut = hauteur du header */
.cs-gallery-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 80px 64px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: none;
}

.cs-gallery-scroll::-webkit-scrollbar {
  display: none;
}

/* Full width — 16/9 */
.cs-gal-full {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  flex-shrink: 0;
}


/* Paire de carrés */
.cs-gal-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex-shrink: 0;
}

.cs-gal-sq {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
}


/* ─── Territory modal : image + texte ─── */
.cs-territory-scroll {
  gap: 56px;
}

/* Image pleine largeur · texte en dessous calé col 6/12 */
.cs-terr-block {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-shrink: 0;
}

.cs-terr-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
}

.cs-terr-text {
  margin-left: calc(5 / 12 * 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-terr-label {
  font-family: "GTFlexaMono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(0, 0, 0, 0.35);
}

.cs-terr-title {
  font-size: clamp(22px, 2.5vw, 32px);
  line-height: 1.15;
  font-weight: 400;
  color: #0f0f0f;
}

.cs-terr-body {
  font-size: 15px;
  line-height: 24px;
  color: rgba(0, 0, 0, 0.52);
}

/* ─── Bouton retour ─── */
.cs-back {
  display: flex;            /* flex (pas inline-flex) : fiable dans un container flex-column */
  flex-direction: row;
  align-items: baseline;
  align-self: flex-start;   /* ne pas étirer sur toute la largeur de la sidebar */
  gap: 6px;
  margin-bottom: 32px;
  text-decoration: none;
  color: var(--muted);      /* couleur gris, opacity: 1 — toujours rendu */
  opacity: 1;
  /* Pas de overflow:hidden : les mots animés sont visibles sans clipping */
  transition: color 0.25s ease;
}

.cs-back:hover {
  color: var(--text-dark);
}

.cs-back-main {
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-lh);
  flex-shrink: 0;
}

.cs-back-sub {
  display: inline-flex;
  gap: 0.3em;
  white-space: nowrap;
}

.cs-back-word {
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-lh);
  opacity: 0;
  transform: translateX(10px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Sortie : studies part en premier, puis case, puis aux */
.cs-back-word:nth-child(1) { transition-delay: 0.18s; }
.cs-back-word:nth-child(2) { transition-delay: 0.09s; }
.cs-back-word:nth-child(3) { transition-delay: 0s; }

/* Entrée : aux arrive en premier, puis case, puis studies */
.cs-back:hover .cs-back-word:nth-child(1) { transition-delay: 0s; }
.cs-back:hover .cs-back-word:nth-child(2) { transition-delay: 0.09s; }
.cs-back:hover .cs-back-word:nth-child(3) { transition-delay: 0.18s; }

.cs-back:hover .cs-back-word {
  opacity: 1;
  transform: translateX(0);
}



.cs-detail-wrap {
  max-width: none;
  margin: 0 auto;
  padding: clamp(140px, 11.11vw, 220px) var(--pad-x) 48px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* ─── STICKY SIDEBAR ─── */
.cs-sidebar {
  width: 296px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--nav-h) + 32px);
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-bottom: 24px;
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  scrollbar-width: none;
}

.cs-sidebar::-webkit-scrollbar {
  display: none;
}

.cs-project-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.eyebrow {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 0;
}

.eyebrow a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}
.eyebrow a:hover {
  color: var(--brand);
}
.eyebrow-sep {
  opacity: 0.45;
}

.cs-project-title {
  font-size: var(--headline-lg-size);
  line-height: var(--headline-lg-lh);
}

.cs-project-sub {
  font-size: 13px;
  line-height: 20px;
  color: var(--text);
}

/* Crédits / partenariat — affichage discret sous le titre */
.cs-project-credits {
  margin-top: 12px;
  margin-bottom: 16px;
  font-family: "GTFlexaMono", monospace;
  font-size: 11px;
  line-height: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.42);
}

.cs-project-credits:empty {
  display: none;
}

/* Sidebar nav */
.cs-nav-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cs-nav-item {
  display: flex;
  flex-direction: column;
}

.cs-nav-anchor {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  line-height: 24px;
  color: rgba(0, 0, 0, 0.32);
  cursor: pointer;
  transition: color 0.2s;
}

.cs-nav-anchor .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.cs-nav-anchor:hover {
  color: rgba(0, 0, 0, 0.6);
}

.cs-nav-anchor.is-active {
  color: var(--text);
}

.cs-nav-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  padding-left: 14px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  transition: max-height 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.35s ease,
              padding-top 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              padding-bottom 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.cs-nav-item.is-open .cs-nav-desc {
  opacity: 1;
  padding-top: 10px;
  padding-bottom: 12px;
  /* max-height mesuré dynamiquement par JS */
}

/* Lead : slide-up + fade, délai court */
.cs-nav-lead {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: rgba(0, 0, 0, 0.85);
  margin: 0 0 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.cs-nav-item.is-open .cs-nav-lead {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.1s;
}

/* Corps : slide-up + fade, délai légèrement plus long */
.cs-nav-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.cs-nav-item.is-open .cs-nav-body {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.18s;
}

.cs-nav-body .cs-text-h3 {
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: rgba(0, 0, 0, 0.92);
  margin: 6px 0 -4px;
}

.cs-nav-body .cs-text-h2 {
  font-size: 16px;
  line-height: 1.3;
  font-weight: 500;
  margin: 10px 0 -4px;
}

.cs-nav-body .cs-text-h4 {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 8px 0 -4px;
  color: rgba(0, 0, 0, 0.55);
}

.cs-nav-body .cs-text-p {
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.7);
  margin: 0;
}

.cs-nav-body .cs-text-list {
  list-style: none;
  padding: 0;
  margin: 2px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cs-nav-body .cs-text-list li {
  font-size: 13px;
  line-height: 1.55;
  padding-left: 14px;
  position: relative;
  color: rgba(0, 0, 0, 0.66);
}

.cs-nav-body .cs-text-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 0;
  color: rgba(0, 0, 0, 0.4);
  font-size: 11px;
  line-height: 1.85;
}

/* ─── RIGHT COLUMN CONTENT ─── */
.cs-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── BLOCK 1: image + tile panel ─── */
.cs-block-1 {
  height: auto;
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.cs-b1-left {
  flex: 1;
  min-width: 0;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--brand);
}

.cs-b1-right {
  width: 400px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: #ffffff;
  position: relative;
  overflow: hidden;
  perspective: 900px;
}

.cs-tile-zone {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 56px;
  transform-style: preserve-3d;
  will-change: transform;
}

.cs-tile {
  position: absolute;
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.16);
  left: 50%;
  top: 50%;
  transition: transform 0.55s cubic-bezier(0.23, 1, 0.32, 1),
              box-shadow 0.55s cubic-bezier(0.23, 1, 0.32, 1);
}

.t1-purple {
  width: 192px;
  height: 200px;
  background-color: var(--purple);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 2;
  transform: translate(-50%, -50%);
}

.t1-lemon {
  width: 192px;
  height: 200px;
  background-color: var(--lemon);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 3;
  transform: translate(calc(-50% + 32px), calc(-50% - 29px)) rotate(-5.29deg);
}

.t1-red {
  width: 192px;
  height: 200px;
  background-color: var(--brand);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
  transform: translate(calc(-50% - 19px), calc(-50% + 29px)) rotate(4.97deg);
}

/* Hover : écartement + Z séparés + légère perspective individuelle */
.cs-b1-right:hover .t1-purple {
  transform: perspective(900px) translate(-50%, -50%) rotate(-3deg) rotateX(3deg) rotateY(-5deg) scale(1.03) translateZ(0px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.cs-b1-right:hover .t1-lemon {
  transform: perspective(900px) translate(calc(-50% + 54px), calc(-50% - 52px)) rotate(-11deg) rotateX(-2deg) rotateY(4deg) translateZ(40px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.cs-b1-right:hover .t1-red {
  transform: perspective(900px) translate(calc(-50% - 38px), calc(-50% + 52px)) rotate(10deg) rotateX(2deg) rotateY(3deg) translateZ(-40px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.cs-gallery-bar,
.cs-ext-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.cs-gallery-bar-text {
  font-size: 16px;
  line-height: 24px;
  white-space: nowrap;
}

.cs-gallery-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cs-gallery-circle:hover {
  transform: scale(1.1);
}

/* ─── BLOCK 2: full-width tile panel ─── */
.cs-block-2 {
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: var(--radius);
  background: #ffffff;
  position: relative;
  overflow: hidden;
  perspective: 900px;
}

.cs-tile-zone-2 {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

.t2-blue {
  width: 296px;
  height: 216px;
  background-color: var(--blue);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 2;
  transform: translate(calc(-50% + 4px), calc(-50% - 35px)) rotate(-5.2deg);
}

.t2-yellow {
  width: 296px;
  height: 216px;
  background-color: var(--yellow);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 3;
  transform: translate(calc(-50% + 5px), calc(-50% + 4px)) rotate(4.54deg);
}

.t2-lemon {
  width: 296px;
  height: 216px;
  background-color: var(--lemon);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
  transform: translate(calc(-50% - 40px), calc(-50% - 60px)) rotate(-0.58deg);
}

/* Hover : écartement + Z séparés + légère perspective individuelle */
.cs-block-2:hover .t2-yellow {
  transform: perspective(900px) translate(calc(-50% + 60px), calc(-50% + 50px)) rotate(9deg) rotateX(3deg) rotateY(-4deg) translateZ(40px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.cs-block-2:hover .t2-blue {
  transform: perspective(900px) translate(calc(-50% - 90px), calc(-50% - 75px)) rotate(-10deg) rotateX(-2deg) rotateY(4deg) translateZ(0px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.cs-block-2:hover .t2-lemon {
  transform: perspective(900px) translate(calc(-50% + 30px), calc(-50% - 130px)) rotate(-2deg) rotateX(2deg) rotateY(-3deg) translateZ(-40px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

/* ─── BLOCK 3: duo images ─── */
.cs-block-3 {
  height: auto;
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.cs-block-3-a {
  flex: 1;
  min-width: 0;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--purple);
}

.cs-block-3-b {
  flex: 1;
  min-width: 0;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--lemon);
}

/* ─── BLOCK 4: outcome cards (horizontal scroll) ─── */
.cs-block-4 {
  position: relative;
}

/* Fade gauche — apparaît quand on a scrollé */
.cs-block-4::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: linear-gradient(to right, var(--bg), transparent);
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}

.cs-block-4.has-scrolled::before {
  opacity: 1;
}

/* Fade droite — disparaît quand on est en bout de scroll */
.cs-block-4::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: linear-gradient(to left, var(--bg), transparent);
  z-index: 4;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.25s;
}

.cs-block-4.is-at-end::after {
  opacity: 0;
}

.cs-outcomes-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-behavior: smooth;
  padding-right: 32px;
  cursor: grab;
  user-select: none;
}

.cs-outcomes-track.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.cs-outcomes-track::-webkit-scrollbar {
  display: none;
}

.cs-outcome-card {
  flex-shrink: 0;
  width: 400px;
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 96px;
}

.cs-stat-row {
  position: relative;
  height: 64px;
  overflow: hidden;
  flex-shrink: 0;
}

.cs-stat-num {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 64px;
  line-height: 64px;
  font-weight: 400;
  white-space: nowrap;
  font-family: "Inter", sans-serif;
}

.cs-stat-arrow {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  opacity: 0.7;
}

.cs-stat-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 16px;
  line-height: 24px;
}

.cs-stat-label {
  font-weight: 700;
  color: #000000;
}

.cs-stat-desc {
  font-weight: 400;
  color: #595959;
}

.cs-scroll-arrow-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 5;
}

.cs-scroll-arrow-btn--left {
  right: auto;
  left: 16px;
}

.cs-scroll-arrow-btn--left svg {
  transform: scaleX(-1);
}

.cs-scroll-arrow-btn:hover {
  transform: translateY(-50%) scale(1.1);
}

/* ─── RELATED CASES — 3D DRAG CAROUSEL ─── */
.cs-related {
  background: var(--bg-dark);
  padding: 64px 0;
  overflow: hidden;
}

.cs-related-inner {
  max-width: none;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.cs-related-head {
  text-align: center;
  width: 100%;
}

.cs-related-head .eyebrow {
  color: #595959;
  margin-bottom: 8px;
}

.cs-related-head h2 {
  font-size: 32px;
  line-height: 40px;
  color: #ffffff;
}

.cs-cases-stage {
  width: 608px;
  height: 496px;
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.cs-cases-stage:active {
  cursor: grabbing;
}

.cs-case-card-3d {
  position: absolute;
  width: 400px;
  height: 496px;
  border-radius: 12px;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  transition: transform 0.55s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.55s ease;
  overflow: hidden;
}

.cs-case-card-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  padding: 24px;
}

.cs-case-card-label {
  font-family: "Spectral", Georgia, serif;
  font-size: 20px;
  color: #ffffff;
}

/* Responsive */
@media (max-width: 1100px) {
  .cs-sidebar {
    width: 220px;
  }

  .cs-b1-right {
    width: 320px;
  }
}

@media (max-width: 860px) {
  .cs-detail-wrap {
    flex-direction: column;
    /* align-items: flex-start (desktop) donnerait aux enfants leur largeur
       max-content en colonne → débordement horizontal massif (cartes résultat) */
    align-items: stretch;
    padding-top: 100px;
    gap: 24px;
  }

  .cs-sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }

  .cs-content {
    width: 100%;
  }

  /* Accordéon sidebar : tout ouvert sur mobile — le tracking scroll n'a pas
     de sens quand la sidebar est empilée au-dessus du contenu */
  .cs-nav-desc {
    max-height: none !important;
    opacity: 1;
    padding-top: 10px;
    padding-bottom: 12px;
  }

  .cs-nav-lead,
  .cs-nav-body {
    opacity: 1;
    transform: none;
  }

  .cs-nav-anchor {
    color: var(--text);
  }

  /* Cartes résultat : largeur fluide, la suivante dépasse pour inviter au swipe */
  .cs-outcome-card {
    width: min(400px, calc(100vw - 100px));
    gap: 56px;
    padding: 20px;
  }

  .cs-stat-row {
    height: 52px;
  }

  .cs-stat-num {
    font-size: 44px;
    line-height: 52px;
  }

  .cs-stat-arrow {
    width: 44px;
    height: 44px;
  }

  .cs-block-4::before,
  .cs-block-4::after {
    width: 40px;
  }

  /* Modales : plein écran ou presque */
  .cs-gallery-modal-inner {
    left: 8px;
    right: 8px;
    top: 32px;
    bottom: 8px;
  }

  .cs-modal-header {
    padding: 20px 20px 24px;
  }

  .cs-gallery-scroll {
    padding: 60px 16px 24px;
  }

  .cs-territory-scroll {
    gap: 40px;
  }

  .cs-gal-pair {
    grid-template-columns: 1fr;
  }

  .cs-block-1 {
    height: auto;
    flex-direction: column;
  }

  .cs-b1-left {
    height: 260px;
  }

  .cs-b1-right {
    width: 100%;
    height: 340px;
  }

  .cs-block-2 {
    /* aspect-ratio 16/9 + height fixe = largeur dérivée (675px) → débordement.
       On neutralise le ratio et on fixe la hauteur. */
    aspect-ratio: auto;
    width: 100%;
    height: 380px;
  }

  .cs-block-3 {
    height: auto;
  }

  .cs-block-3-a,
  .cs-block-3-b {
    height: 260px;
  }

  .cs-cases-stage {
    width: 100%;
  }

  .cs-case-card-3d {
    width: 60%;
    height: auto;
    aspect-ratio: 4/5;
  }

  .menu-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 76px; /* = min-height nav-inner mobile (clamp 76px) — var(--nav-h)=64px laissait un trou */
    left: 0;
    width: 100%;
    background: rgba(248, 248, 248, 0.97);
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 24px;
    gap: 18px;
    display: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(14px);
  }

  .nav-links.open {
    display: flex;
  }

  /* Le menu mobile de cette page est clair — nav.css prévoit des liens blancs
     (fond sombre) pour le dropdown inliné : on repasse en sombre ici */
  .nav-links .nav-dropdown-menu a {
    color: rgba(0, 0, 0, 0.55) !important;
  }

  .nav-links .nav-dropdown-menu a:hover {
    color: #0f0f0f !important;
  }
}

/* ─── Petits écrans ─── */
@media (max-width: 480px) {
  .cs-detail-wrap {
    padding-inline: 20px;
  }

  /* Tiles extension de territoire : réduites pour tenir dans ~335px */
  .t2-blue,
  .t2-yellow,
  .t2-lemon {
    width: 232px;
    height: 169px;
  }

  .cs-block-2 {
    height: 320px;
  }

  .cs-b2-btn {
    padding: 12px 20px;
    font-size: 14px;
    line-height: 20px;
    max-width: calc(100% - 24px);
    white-space: normal;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.92); /* lisible par-dessus les tiles */
    backdrop-filter: blur(6px);
  }

  .cs-stack-outer {
    padding-inline: 20px;
  }
}

/* ══════════════════════════════════════════════════════════════
   STACK DRAG COMPONENT — version alternative de cs-related
   ═════════════════════════════════════════════════════════════ */

/* Autorise l'overflow pour les cartes en rotation */
.cs-related--stack {
  overflow: visible;
}

/* Wrapper avec espace pour l'overhang des cartes rotées */
.cs-stack-outer {
  padding: 48px 80px 20px;
  display: flex;
  justify-content: center;
}

/* Conteneur = même taille que les cartes (comme dans la démo React) */
.cs-stack-stage {
  width: 400px;
  height: 496px;
  position: relative;
  /* perspective gérée via JS (cfg.perspective) */
  user-select: none;
  -webkit-user-select: none;
}

/* Chaque carte remplit exactement le conteneur */
.cs-stack-card {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  transform-origin: 90% 90%; /* pivot bas-droit → effet « deck de cartes » */
  cursor: grab;
  overflow: hidden;
  will-change: transform;
  touch-action: pan-y; /* scroll vertical natif conservé, drag horizontal géré en JS */
  /* pas de transition CSS : géré entièrement par JS */
}

.cs-stack-card:active {
  cursor: grabbing;
}

/* Label + gradient de fond identiques à la section existante */
.cs-stack-card .cs-case-card-inner {
  pointer-events: none;
}

/* Séparateur visuel entre les deux sections */
.cs-related--stack .cs-related-head h2::after {
  content: '';
  display: inline-block;
  margin-left: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #595959;
  vertical-align: middle;
  position: relative;
  top: -2px;
}

@media (max-width: 1100px) {
  .cs-stack-outer {
    padding: 32px 24px 20px;
  }
  .cs-stack-stage {
    width: 100%;
    max-width: 400px;
    height: auto;
    aspect-ratio: 400/496;
  }
  .cs-stack-card {
    border-radius: 8px;
  }
}

/* ── Settings panel ── */
.cs-stack-settings {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.cs-stack-settings-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.cs-stack-settings-toggle:hover,
.cs-stack-settings-toggle.is-active {
  border-color: rgba(255,255,255,0.35);
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.cs-stack-settings-panel {
  margin-top: 12px;
  background: #111;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 280px;
}

.cs-stack-setting-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cs-stack-setting-row label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cs-stack-setting-row label b {
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.cs-stack-setting-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.12);
  outline: none;
  cursor: pointer;
}

.cs-stack-setting-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
  transition: box-shadow 0.15s;
}

.cs-stack-setting-row input[type="range"]:hover::-webkit-slider-thumb {
  box-shadow: 0 0 0 5px rgba(255,255,255,0.2);
}

.cs-stack-setting-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

/* Toggle row */
.cs-stack-setting-row--toggle {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.cs-stack-setting-row--toggle label {
  justify-content: flex-start;
  color: rgba(255,255,255,0.45);
}

/* iOS-style toggle button */
.cs-stack-toggle {
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  position: relative;
  cursor: pointer;
  transition: background 0.22s, border-color 0.22s;
  padding: 0;
}

.cs-stack-toggle[aria-checked="true"] {
  background: #ffffff;
  border-color: #ffffff;
}

.cs-stack-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.45);
  transition: transform 0.22s cubic-bezier(0.34,1.3,0.64,1), background 0.22s;
}

.cs-stack-toggle[aria-checked="true"] .cs-stack-toggle-thumb {
  transform: translateX(16px);
  background: #0a0a0a;
}

/* Row désactivé (randomRange quand randomize=off) */
.cs-stack-setting-row--disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ─── Rows supplémentaires : full-width ou 2-col (aligné Figma) ─── */
.cs-row-full {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
}

.cs-row-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cs-row-duo-cell {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
}


@media (max-width: 860px) {
  .cs-row-full {
    height: auto;
    aspect-ratio: 16 / 9;
  }
  .cs-row-duo {
    grid-template-columns: 1fr;
    height: auto;
  }
  .cs-row-duo-cell {
    aspect-ratio: 16 / 9;
  }
}

/* Note : les styles .cs-text-h2/h3/h4/p/list sont définis ci-dessus
   sous .cs-nav-body, scopés à la sidebar uniquement (le main reste un wall).
*/

/* ══════════════════════════════════════════════════════════════
   STRUCTURE 5 SECTIONS — DÉFIS / STRATÉGIE / CRÉATION / DÉPLOIEMENT / RÉSULTAT
   ═════════════════════════════════════════════════════════════ */

/* ─── BLOC DÉFIS : rangée 1 = cover + galerie | rangée 2 = extension full-width ─── */
.cs-block-defis {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 12px;
}

.cs-defis-cover {
  aspect-ratio: 3 / 2;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  background-color: var(--brand);
}

/* Tile galerie : colonne droite, rangée 1 — cs-b1-right direct child */
.cs-block-defis > .cs-b1-right:not(.cs-ext-tile) {
  width: 100%;
  min-height: 0;
}

/* Tile extension : pleine largeur sur la rangée 2 */
.cs-block-defis .cs-ext-tile {
  grid-column: 1 / -1;
}

/* ─── BLOC SINGLE — Création (1 visuel full-width) ─── */
.cs-block-single {
  /* wrapper transparent */
}

.cs-img-full {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  background-color: #e8e5e0;
}

/* ─── BLOC DUO — Stratégie, Déploiement (2 visuels côte à côte) ─── */
.cs-block-duo {
  display: flex;
  gap: 12px;
}

.cs-img-duo-a,
.cs-img-duo-b {
  flex: 1;
  min-width: 0;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  background-color: #e8e5e0;
}

/* ─── BLOC RÉSULTAT ─── */
.cs-block-resultat {
  /* hérite de cs-block-4 */
}

/* ─── Responsive nouveaux blocs ─── */
@media (max-width: 1100px) {
  .cs-block-defis {
    grid-template-columns: 1fr 300px;
  }
}

@media (max-width: 860px) {
  .cs-block-defis {
    grid-template-columns: 1fr;
  }

  .cs-defis-cover {
    aspect-ratio: 16 / 9;
  }

  .cs-block-duo {
    flex-direction: column;
  }

  .cs-img-duo-a,
  .cs-img-duo-b {
    height: 260px;
  }

  /* Territory modal — texte pleine largeur sur mobile */
  .cs-terr-text {
    margin-left: 0;
  }
}
