.apps-page {
  width: 90%;
  max-width: 56em;
  margin: 0 auto 4.5em;
  text-align: left;
}

.apps-intro {
  margin: 2.2em 0 2.4em;
  padding: 0;
  color: var(--texte-secondaire);
  font-size: 1.05em;
  line-height: 1.55;
  text-align: left;
}

/* La vitrine : liste typographique à gauche, un seul grand aperçu
   à droite qui défile en diaporama. Le survol ou le focus d'une
   ligne reprend la main sur le défilement. */
.apps-vitrine {
  display: grid;
  grid-template-columns: minmax(17em, 21em) minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 2.25em;
  align-items: stretch;
}

/* La liste occupe exactement la hauteur de l'aperçu :
   les lignes se partagent l'espace à parts égales. */
.apps-liste {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  grid-row: 1;
  grid-column: 1;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.apps-liste li {
  display: flex;
  flex: 1;
  margin: 0;
  padding: 0;
}

.apps-liste a {
  display: flex;
  flex: 1;
  gap: 0.8em;
  align-items: center;
  padding: 0.6em 0.9em;
  border-radius: 8px;
  color: inherit;
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  text-decoration: none;
  transition: background-color 0.2s ease-out;
}

.apps-liste a:link,
.apps-liste a:visited {
  color: inherit;
}

.app-icone {
  flex: 0 0 1.2em;
  width: 1.2em;
  color: var(--texte-secondaire);
  font-size: 0.85em;
  text-align: center;
  transition: color 0.2s ease-out;
}

.app-texte {
  min-width: 0;
}

.app-texte strong {
  display: block;
  color: var(--texte-libelle);
  font-size: 0.92em;
  font-weight: 500;
  line-height: 1.3;
  transition: color 0.2s ease-out;
}

.app-texte small {
  display: block;
  margin-top: 0.18em;
  color: var(--texte-secondaire);
  font-size: 0.8em;
  line-height: 1.45;
}

.app-fleche {
  align-self: center;
  margin-left: auto;
  color: var(--texte-secondaire);
  font-size: 0.75em;
  opacity: 0;
  transform: translateX(-0.35em);
  transition: opacity 0.2s ease-out, transform 0.25s ease-out;
}

.apps-liste a.actif {
  background: #f9f6f6;
}

.apps-liste a.actif .app-texte strong,
.apps-liste a.actif .app-icone {
  color: #1a1a1a;
}

.apps-liste a.actif .app-fleche {
  opacity: 1;
  transform: translateX(0);
}

.apps-liste a:focus-visible {
  outline: 2px solid #2582a3;
  outline-offset: 2px;
}

/* L'aperçu : une seule capture, grande et lisible, sans cadre. */
.apps-apercu {
  position: relative;
  overflow: hidden;
  grid-row: 1;
  grid-column: 2;
  /* Safari : sur un élément de grille étiré, aspect-ratio se résout
     depuis la hauteur de rangée. Largeur explicite + align-self: start
     imposent le calcul largeur → hauteur, identique partout. */
  align-self: start;
  width: 100%;
  margin: 0;
  aspect-ratio: 3724 / 2782;
  border-radius: 10px;
}

.apps-apercu::before {
  content: "";
  display: block;
  padding-top: 74.704618%;
}

.apps-apercu-item {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 320ms ease;
}

.apps-apercu-item.actif {
  opacity: 1;
}

.apps-apercu-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
}

.apercu-dark {
  display: none;
}

/* Les points de navigation du diaporama. */
.apps-points {
  display: flex;
  justify-content: center;
  justify-self: stretch;
  gap: 0.6em;
  grid-row: 2;
  grid-column: 2;
  width: 100%;
  margin-top: 1em;
}

.apps-points button {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #d6d2d2;
  cursor: pointer;
  transition: background-color 0.25s ease-out, transform 0.25s ease-out;
}

.apps-points button:hover {
  background: #a8a5a5;
}

.apps-points button.actif {
  background: #5c5b5b;
  transform: scale(1.25);
}

.apps-points button:focus-visible {
  outline: 2px solid #2582a3;
  outline-offset: 3px;
}

/* Apparition douce au chargement ; les contenus restent visibles
   si le script ne se lance pas. */
.apps-vitrine .apps-liste li {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 420ms ease-out, transform 520ms cubic-bezier(0.19, 1, 0.22, 1);
  transition-delay: var(--ligne-delay, 0ms);
}

.apps-liste li:nth-child(1) { --ligne-delay: 120ms; }
.apps-liste li:nth-child(2) { --ligne-delay: 180ms; }
.apps-liste li:nth-child(3) { --ligne-delay: 240ms; }
.apps-liste li:nth-child(4) { --ligne-delay: 300ms; }
.apps-liste li:nth-child(5) { --ligne-delay: 360ms; }
.apps-liste li:nth-child(6) { --ligne-delay: 420ms; }

.apps-vitrine .apps-apercu {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 520ms ease-out 240ms, transform 620ms cubic-bezier(0.19, 1, 0.22, 1) 240ms;
}

.apps-vitrine.is-visible .apps-liste li,
.apps-vitrine.is-visible .apps-apercu {
  opacity: 1;
  transform: translateY(0);
}

html[data-theme="dark"] .apps-intro {
  color: #c6cbd2;
}

html[data-theme="dark"] .apps-liste a.actif {
  background: #1f1e1e;
}

html[data-theme="dark"] .app-texte strong {
  color: #cdcdcd;
}

html[data-theme="dark"] .apps-liste a.actif .app-texte strong,
html[data-theme="dark"] .apps-liste a.actif .app-icone {
  color: #fff;
}

html[data-theme="dark"] .app-texte small {
  color: #a8a8a8;
}

html[data-theme="dark"] .app-fleche {
  color: #cdcdcd;
}

html[data-theme="dark"] .apercu-light {
  display: none;
}

html[data-theme="dark"] .apercu-dark {
  display: block;
}

html[data-theme="dark"] .apps-points button {
  background: #4a4a4a;
}

html[data-theme="dark"] .apps-points button:hover {
  background: #7a7a7a;
}

html[data-theme="dark"] .apps-points button.actif {
  background: #fff;
}

/* Sur petit écran : l'aperçu devient un carrousel à balayage,
   les points dessous, la liste ensuite. */
@media screen and (max-width: 56em) {
  .apps-page {
    width: min(85%, 30em);
    max-width: 30em;
  }

  .apps-vitrine {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9em;
  }

  .apps-apercu {
    display: flex;
    grid-row: 1;
    grid-column: 1;
    overflow-x: auto;
    aspect-ratio: auto;
    border-radius: 8px;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .apps-apercu::-webkit-scrollbar {
    display: none;
  }

  .apps-apercu::before {
    display: none;
  }

  .apps-apercu-item {
    position: relative;
    display: block;
    flex: 0 0 100%;
    min-width: 100%;
    opacity: 1;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .apps-apercu-item img {
    position: static;
    width: 100%;
    max-width: none;
    height: auto;
  }

  .apps-apercu-item .apercu-light {
    display: block;
  }

  .apps-apercu-item .apercu-dark {
    display: none;
  }

  html[data-theme="dark"] .apps-apercu-item .apercu-light {
    display: none;
  }

  html[data-theme="dark"] .apps-apercu-item .apercu-dark {
    display: block;
  }

  .apps-points {
    display: flex;
    grid-row: 2;
    grid-column: 1;
    justify-self: stretch;
    width: 100%;
    margin: 0.15em auto 0.35em;
  }

  .apps-liste {
    grid-row: 3;
    grid-column: 1;
    height: auto;
  }

  .apps-liste li {
    flex: 0 0 auto;
  }

  .apps-liste a {
    padding: 0.75em 0.6em;
  }
}

@media screen and (max-width: 44em) {
  .apps-page {
    max-width: 24em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .apps-vitrine .apps-liste li,
  .apps-vitrine .apps-apercu,
  .apps-apercu-item,
  .app-fleche {
    transition: none;
  }

  .apps-vitrine .apps-liste li,
  .apps-vitrine .apps-apercu {
    opacity: 1;
    transform: none;
  }
}
