/* Section 5 — maintenabilité : iPad CSS produit + chapitres éditoriaux */

.sci-section.sci-maintain {
  --sci-maintain-ink: #eef2f7;
  --sci-maintain-muted: #9aa8bb;
  --sci-maintain-line: rgba(148, 163, 184, 0.14);
  --sci-maintain-card: rgba(255, 255, 255, 0.035);
  position: relative;
  z-index: 1;
  background: #111827;
  color: var(--sci-maintain-ink);
  border-color: var(--sci-maintain-line);
  /* padding-block = --sci-section-y via .sci-page :is(.sci-section, ...) */
  overflow: visible;
  overflow-anchor: none;
}

.sci-maintain > .absolute,
.sci-maintain__atmosphere {
  display: none;
}

.sci-maintain__shell {
  position: relative;
  z-index: 1;
  width: 100%;
  overflow: visible;
}

/* Ligne titre (gauche) + lead (bout de ligne à droite) */
.sci-maintain__intro {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(1.75rem, 4vw, 4rem);
  align-items: end;
  margin-bottom: clamp(3rem, 5vw, 4.5rem);
}

.sci-maintain__intro-main {
  min-width: 0;
}

.sci-page .sci-maintain__title {
  margin: 0;
  max-width: 22ch;
  font-family: var(--font-title);
  font-size: var(--fs-title);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: #fff;
  text-wrap: balance;
}

.sci-maintain__title-rule {
  display: block;
  width: 2.4rem;
  height: 2px;
  margin-top: 1.1rem;
  background: var(--sci-orange);
}

.sci-page .sci-maintain__lead {
  margin: 0;
  max-width: none;
  color: var(--sci-maintain-muted);
  font-size: 1.02rem;
  line-height: 1.68;
  align-self: end;
  padding-bottom: 0.15rem;
}

/* Tablette se déplace verticalement face à la card active */
.sci-maintain__layout {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(1.75rem, 4vw, 4rem);
  align-items: stretch;
}

.sci-maintain__aside {
  position: relative;
  min-width: 0;
  align-self: stretch;
  overflow: visible;
}

.sci-maintain__toc {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.sci-maintain__toc a {
  color: var(--sci-maintain-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.sci-maintain__toc a:hover {
  color: #fff;
}

/* —— iPad (cadre produit CSS) —— */
.sci-maintain__bench-slot {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  margin: 0;
  width: 100%;
  max-width: none;
  padding: 0.2rem 0.15rem;
  box-sizing: border-box;
  will-change: transform;
  transition: filter 0.35s ease;
}

/* Pulse court au changement de chapitre — passage tablette ↔ card */
.sci-maintain__bench-slot.is-chapter-change .sci-ipad__stage {
  animation: sci-maintain-tablet-pulse 0.48s ease;
}

.sci-maintain__bench-slot.is-chapter-change .sci-jarvis {
  filter: brightness(1.12) saturate(1.08);
}

@keyframes sci-maintain-tablet-pulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  40% {
    transform: scale(1.015);
    filter: brightness(1.08);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sci-maintain__bench-slot.is-chapter-change .sci-ipad__stage {
    animation: none;
  }
}

.sci-ipad {
  container-type: inline-size;
  width: 100%;
  position: relative;
}

.sci-ipad__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1.39 / 1;
  filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.5));
}

/* Boutons latéraux */
.sci-ipad__btn {
  position: absolute;
  z-index: 2;
  background: linear-gradient(90deg, #4a5058, #2a2e34);
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.sci-ipad__btn--vol {
  left: -0.28%;
  top: 22%;
  width: 0.55%;
  height: 7%;
}

.sci-ipad__btn--vol2 {
  left: -0.28%;
  top: 32%;
  width: 0.55%;
  height: 7%;
}

.sci-ipad__btn--pwr {
  right: -0.28%;
  top: 26%;
  width: 0.55%;
  height: 9%;
}

/* Châssis aluminium space gray */
.sci-ipad__chassis {
  position: absolute;
  inset: 0;
  border-radius: 5.2cqw;
  padding: 0.85cqw;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22) 0%, transparent 18%),
    linear-gradient(180deg, #5a6068 0%, #3a3f46 8%, #23272c 28%, #1a1d21 55%, #252930 82%, #4a5058 100%);
  box-shadow:
    inset 0.2cqw 0 0 rgba(255, 255, 255, 0.18),
    inset -0.25cqw 0 0.3cqw rgba(0, 0, 0, 0.45),
    inset 0 0.15cqw 0 rgba(255, 255, 255, 0.1),
    0 0 0 0.15cqw rgba(0, 0, 0, 0.55);
}

.sci-ipad__bezel {
  position: relative;
  height: 100%;
  border-radius: 4.4cqw;
  padding: 1.55cqw;
  background: #050506;
  box-shadow: inset 0 0 0 0.12cqw #000;
}

.sci-ipad__cam {
  position: absolute;
  top: 0.55cqw;
  left: 50%;
  z-index: 3;
  width: 0.85cqw;
  height: 0.85cqw;
  margin-left: -0.425cqw;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a3340, #0a0b0d 70%);
  box-shadow: 0 0 0 0.12cqw #111;
}

.sci-ipad__screen {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  border-radius: 3.2cqw;
  background:
    radial-gradient(ellipse 70% 60% at 50% 50%, rgba(12, 48, 68, 0.55), transparent 62%),
    radial-gradient(ellipse 45% 40% at 20% 15%, rgba(20, 70, 90, 0.25), transparent 55%),
    linear-gradient(165deg, #07141c 0%, #0a1a24 40%, #050d14 100%);
  color: #fff;
}

/* Status bar iPadOS — bien lisible */
.sci-ipad__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.35cqw 2.4cqw 0.7cqw;
  font-family: var(--font-body);
  font-size: 1.85cqw;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.sci-ipad__time {
  min-width: 6cqw;
}

.sci-ipad__status-right {
  display: flex;
  align-items: center;
  gap: 1.35cqw;
  color: #fff;
}

.sci-ipad__signal {
  width: 2.3cqw;
  height: 1.55cqw;
  display: block;
  flex-shrink: 0;
}

.sci-ipad__wifi {
  width: 2.35cqw;
  height: 1.75cqw;
  display: block;
  flex-shrink: 0;
}

.sci-ipad__batt {
  display: flex;
  align-items: center;
  gap: 0.55cqw;
}

.sci-ipad__batt-shell {
  position: relative;
  width: 3.4cqw;
  height: 1.65cqw;
  border: 0.2cqw solid rgba(255, 255, 255, 0.95);
  border-radius: 0.4cqw;
  box-sizing: border-box;
}

.sci-ipad__batt-shell::after {
  content: "";
  position: absolute;
  right: -0.42cqw;
  top: 0.35cqw;
  width: 0.28cqw;
  height: 0.7cqw;
  border-radius: 0 1px 1px 0;
  background: rgba(255, 255, 255, 0.95);
}

.sci-ipad__batt-fill {
  position: absolute;
  inset: 0.22cqw;
  border-radius: 0.18cqw;
  background: #34c759;
}

/* Contenu écran — HUD JARVIS (blob holographique) */
.sci-ipad__content {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 0;
  padding: 1cqw 2cqw 2.5cqw;
}

.sci-jarvis {
  position: relative;
  width: min(94%, 64cqw);
  aspect-ratio: 1;
  margin: auto;
}

.sci-jarvis--2d .sci-jarvis__canvas-2d {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sci-jarvis__viewport {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.sci-jarvis--hero {
  overflow: visible;
}

.sci-jarvis__canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

.sci-jarvis__title {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  margin: 0;
  transform: translate(-50%, -50%);
  font-family: var(--font-body);
  font-size: var(--fs-title);
  font-weight: 700;
  letter-spacing: 0.28em;
  color: rgba(245, 252, 255, 0.96);
  text-shadow:
    0 0 12px rgba(80, 210, 255, 0.85),
    0 0 28px rgba(0, 160, 230, 0.45);
  pointer-events: none;
  white-space: nowrap;
}

.sci-jarvis__hit {
  position: absolute;
  inset: 18%;
  z-index: 3;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.sci-jarvis__nodes {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sci-ipad__home {
  position: absolute;
  left: 50%;
  bottom: 1cqw;
  width: 12cqw;
  height: 0.45cqw;
  margin-left: -6cqw;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.35);
}

/* —— Chapitres : 3 grands containers égaux (pilotent la hauteur) —— */
.sci-maintain__chapters {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  min-width: 0;
  width: 100%;
}

.sci-section.sci-maintain article.sci-maintain__chapter,
.sci-maintain__chapter {
  position: relative;
  flex: 1 1 0;
  display: block;
  align-content: center;
  align-items: start;
  margin: 0;
  width: 100%;
  min-height: clamp(15.5rem, 24vh, 19rem);
  padding: 1.85rem 2.1rem 1.85rem 1.7rem;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 1.35rem;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  cursor: pointer;
  scroll-margin-top: calc(var(--sci-header, 80px) + 1.5rem);
  transition:
    background 0.35s ease,
    border-color 0.35s ease,
    transform 0.35s ease,
    box-shadow 0.35s ease;
}

.sci-maintain__chapter::after {
  content: attr(data-sci-maintain-chapter);
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-52%);
  font-family: var(--font-title);
  font-size: clamp(3.5rem, 5vw, 4.75rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: rgba(255, 255, 255, 0.035);
  pointer-events: none;
  user-select: none;
}

.sci-maintain__chapter-index {
  display: none;
}

.sci-maintain__chapter-body {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding-right: 2.5rem;
}

.sci-page .sci-maintain__chapter-title {
  margin: 0 0 1rem;
  max-width: none;
  font-family: var(--font-title);
  font-size: clamp(1.55rem, 2.15vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.022em;
  color: rgba(255, 255, 255, 0.62);
  transition: color 0.3s ease;
}

.sci-page .sci-maintain__chapter-text {
  margin: 0;
  max-width: none;
  color: rgba(154, 168, 187, 0.9);
  font-size: 1.05rem;
  line-height: 1.72;
  transition: color 0.3s ease;
}

.sci-maintain.is-enhanced .sci-maintain__chapter.is-active {
  background:
    linear-gradient(135deg, rgba(241, 137, 78, 0.16), rgba(167, 139, 250, 0.08) 48%, rgba(255, 255, 255, 0.04));
  border-color: rgba(241, 137, 78, 0.5);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(241, 137, 78, 0.14),
    inset 3px 0 0 var(--sci-orange);
  transform: translateX(6px);
}

/* Cards non actives un peu plus discrètes pour clarifier le focus */
.sci-maintain.is-enhanced .sci-maintain__chapter:not(.is-active) {
  opacity: 0.72;
}

.sci-jarvis__nodes button {
  transition:
    background 0.35s ease,
    transform 0.35s ease,
    box-shadow 0.35s ease;
}

.sci-jarvis__nodes button.is-active {
  transform: scale(1.25);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.55);
}

.sci-maintain.is-enhanced .sci-maintain__chapter.is-active::after {
  color: rgba(241, 137, 78, 0.08);
}

.sci-maintain.is-enhanced .sci-maintain__chapter.is-active .sci-maintain__chapter-title {
  color: #fff;
}

.sci-maintain.is-enhanced .sci-maintain__chapter.is-active .sci-maintain__chapter-text {
  color: #c5d0de;
}

.sci-maintain.is-enhanced .sci-maintain__chapter:not(.is-active):hover {
  opacity: 0.92;
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.sci-maintain__motion {
  display: none;
}

@media (max-width: 1023px) {
  .sci-maintain__intro {
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
  }

  .sci-maintain__layout {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .sci-maintain__bench-slot {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    max-width: 32rem;
    margin-inline: auto;
    padding-bottom: 0.5rem;
    transform: none !important;
  }

  .sci-section.sci-maintain article.sci-maintain__chapter,
  .sci-maintain__chapter {
    flex: none;
    min-height: 0;
    padding: 1.5rem 1.4rem;
  }

  .sci-page .sci-maintain__title {
    max-width: 20ch;
  }

  .sci-maintain.is-enhanced .sci-maintain__chapter.is-active {
    transform: none;
  }

  .sci-page .sci-maintain__chapter-title {
    color: #fff;
  }

  .sci-page .sci-maintain__chapter-text {
    color: var(--sci-maintain-muted);
  }

  .sci-maintain__chapter::after {
    display: none;
  }
}
