/*
 * PAREIDOTYPE — styles propres à la collection.
 * Aucun changement aux styles ou aux transitions des projets existants.
 */

/* Grande surface grise : même espace qu'une galerie de case study. */
.pareidotype-surface {
  position: relative;
  display: grid;
  grid-template-columns: 42% minmax(0, 1fr);
  flex-shrink: 0;
  width: 100%;
  height: min(calc(100svh - 96px), max(800px, calc((100vw - 50px) * .75)));
  min-height: 370px;
  background: #eee;
  overflow: hidden;
}

.pareidotype-intro {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(70px, 13vh, 125px);
  padding: 50px 26px 24px;
  text-align: center;
}

.pareidotype-counter {
  margin: 0;
  font-size: clamp(22px, 2.1vw, 36px);
  font-weight: 400;
  line-height: 1.2;
}

.pareidotype-instruction {
  box-sizing: border-box;
  width: 100%;
  max-width: 40ch;
  margin: 0 auto;
  font-size: clamp(12px, 1.07vw, 19px);
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
  white-space: normal;
}

/*
 * Grille des LETTRES : 6 colonnes x 5 rangées = 30 cases, dont 26
 * positions alphabétiques. Les quatre dernières restent simplement libres.
 * Les repères + sont superposés AUX INTERSECTIONS, pas dans les cases.
 */
.pareidotype-grid {
  --pareidotype-cols: 6;
  --pareidotype-rows: 5;
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  min-width: 0;
  min-height: 0;
  margin: 50px 48px 48px 22px;
}

.pareidotype-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.pareidotype-cell-label {
  position: absolute;
  top: 7px;
  left: 12px;
  z-index: 2;
  font-size: 8px;
  font-weight: 300;
  line-height: 1;
  opacity: .85;
}

/* Les + sont des repères graphiques permanents et non des placeholders. */
.pareidotype-cross {
  position: absolute;
  z-index: 4;
  left: calc(var(--cross-x) * 100% / var(--pareidotype-cols));
  top: calc(var(--cross-y) * 100% / var(--pareidotype-rows));
  transform: translate(-50%, -50%);
  display: block;
  font: 300 21px/1 "IBM Plex Mono", monospace;
  color: #161a16;
  pointer-events: none;
  user-select: none;
}
.pareidotype-cross-mobile { display: none; }

.pareidotype-letter-link {
  position: absolute;
  inset: 0;
  display: block;
  color: #172019;
  text-decoration: none;
  outline-offset: -3px;
  cursor: pointer;
}

/* Conserve les dimensions exactes des illustrations précédentes, tout en
   rendant les petites lettres (A), (B), etc. cliquables si elles existent. */
.pareidotype-letter-art {
  position: absolute;
  inset: 18px 8px 14px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pareidotype-letter-link:hover .pareidotype-cell-label,
.pareidotype-letter-link:focus-visible .pareidotype-cell-label {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pareidotype-glyph-image {
  display: block;
  width: 78%;
  height: 80%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 280ms ease;
}

.pareidotype-glyph-fallback {
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(32px, 4.5vw, 92px);
  font-weight: 400;
  line-height: 1;
  transition: transform 280ms ease;
}

.pareidotype-letter-link:hover .pareidotype-glyph-image,
.pareidotype-letter-link:focus-visible .pareidotype-glyph-image,
.pareidotype-letter-link:hover .pareidotype-glyph-fallback,
.pareidotype-letter-link:focus-visible .pareidotype-glyph-fallback {
  transform: scale(1.055);
}

/* Séparation entre le relevé de forme et l'alphabet.
   C'est une vraie diapositive, pas une image à exporter deux fois. */
.pareidotype-arrow-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: clamp(145px, 15vw, 260px);
  height: 100%;
  padding: 15px;
}

.pareidotype-story-arrow-desktop {
  display: block;
  width: min(100%, 210px);
  height: auto;
  object-fit: contain;
  filter: brightness(0); /* noir véritable, dessin SVG inchangé */
}

/* La flèche mobile conserve le caractère typographique déjà validé. */
.pareidotype-story-arrow-mobile {
  display: none;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 300;
  font-size: clamp(64px, 16vw, 90px);
  line-height: 1;
  color: #000;
}

/* Page d'une lettre : reprendre le carrousel et le panneau existants. */
.pareidotype-empty-gallery {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  min-width: 440px;
  font-size: 16px;
  color: #777;
  background: #eee;
  text-align: center;
}

.pareidotype-details-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 48px;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
}

.pareidotype-breadcrumb {
  flex: 1 1 auto;
  min-width: 0;
  font-size: clamp(17px, 4.6vw, 22px);
  line-height: 1.15;
  gap: .35em;
  letter-spacing: -.03em;
}


.pareidotype-breadcrumb a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.pareidotype-breadcrumb a:hover,
.pareidotype-breadcrumb a:focus-visible {
  text-decoration-thickness: 2px;
}

/* Le bouton Détails reste distinct du lien de retour : pas de lien dans un bouton. */
.pareidotype-details-bar .pareidotype-details-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: auto;
  height: 48px;
  padding: 0;
  text-align: right;
}

@media (max-width: 900px) {
  .pareidotype-surface {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
  }

  /* Compteur et phrase regroupés au centre, comme sur desktop. */
  .pareidotype-intro {
    min-height: 245px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding: 40px 25px 18px;
    text-align: center;
  }

  .pareidotype-counter {
    align-self: center;
    margin: 0;
    font-size: clamp(23px, 6vw, 30px);
    line-height: 1.1;
  }

  .pareidotype-instruction {
    align-self: center;
    margin: 0 auto;
    font-size: clamp(12px, 3.15vw, 16px);
    line-height: 1.15;
    text-align: center;
    max-width: min(100%, 30ch);
  }

  /* 26 lettres, 3 colonnes × 9 lignes : les + restent aux croisements
     des lignes de construction, indépendamment des lettres. */
  .pareidotype-grid {
    --pareidotype-cols: 3;
    --pareidotype-rows: 9;
    flex: 0 0 auto;
    width: calc(100% - 56px);
    aspect-ratio: 1 / 2.85;
    min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(9, minmax(0, 1fr));
    margin: 35px 28px 54px;
  }

  .pareidotype-cross-desktop { display: none; }
  .pareidotype-cross-mobile { display: block; }
  .pareidotype-cross { font-size: 19px; font-weight: 300; }
  .pareidotype-cell-label { top: 7px; left: 10px; font-size: 8px; font-weight: 300; opacity: .85; }
  .pareidotype-letter-art { inset: 15px 9px 12px; }
  .pareidotype-glyph-fallback { font-size: clamp(33px, 10vw, 55px); }

  .pareidotype-details-bar { min-height: 72px; gap: 8px; }

.pareidotype-breadcrumb {
  flex: 1 1 auto;
  min-width: 0;

  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 0.35em;
  row-gap: 0;

  font-size: clamp(20px, 5.5vw, 24px);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.pareidotype-breadcrumb > a {
  grid-column: 1 / -1;
}

  .pareidotype-details-bar .pareidotype-details-button {
    height: 72px;
    font-size: clamp(13px, 3.8vw, 20px);
    letter-spacing: -.03em;
  }

  /* Mobile : flèche typographique validée, pas de SVG ni de rotation. */
  .pareidotype-arrow-slide {
    width: 100%;
    height: clamp(110px, 16vh, 150px);
    min-height: 110px;
    padding: 0 20px;
  }
  .pareidotype-story-arrow-desktop { display: none; }
  .pareidotype-story-arrow-mobile { display: block; }

  .pareidotype-empty-gallery { min-width: 0; min-height: 200px; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pareidotype-glyph-image,
  .pareidotype-glyph-fallback { transition: none; }
}

/*
 * 1.2.1 — Flèche desktop : isolation vis-à-vis des règles générales
 * .case-slide img de la case study (width/height/display forcés).
 * Une spécificité supérieure est indispensable sur desktop ET mobile.
 */
.pareidotype-arrow-slide > img.pareidotype-story-arrow-desktop {
  display: block;
  flex: 0 1 auto;
  width: min(100%, 210px);
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: brightness(0);
}

/* Une seule flèche par format, mobile en caractère typographique. */
.pareidotype-arrow-slide > .pareidotype-story-arrow-mobile {
  display: none;
}

@media (max-width: 900px) {
  .pareidotype-arrow-slide > img.pareidotype-story-arrow-desktop {
    display: none;
  }
  .pareidotype-arrow-slide > .pareidotype-story-arrow-mobile {
    display: block;
  }
}

/* GRANDS ÉCRANS — l'en-tête des lettres suit la même évolution
   que la barre des autres case studies, sans changer la version mobile. */
@media (min-width: 901px) {
  /* Lettres légèrement plus petites dans leurs cases ; la grille et les + ne bougent pas. */
  .pareidotype-glyph-image {
    width: 73%;
    height: 75%;
  }

  .pareidotype-glyph-fallback {
    font-size: clamp(32px, 4.2vw, 86px);
  }
}

@media (min-width: 1441px) {
  .pareidotype-details-bar {
    min-height: var(--case-bar-height, 48px);
  }

  .pareidotype-details-bar .pareidotype-details-button {
    height: var(--case-bar-height, 48px);
  }

  .pareidotype-breadcrumb {
    font-size: clamp(20px, calc(0.7143vw + 9.714px), 28px);
  }
}
