/* Registre RP : mise en page propre au site, par-dessus les composants ILPH. */

/* ---------- Galerie : outils de filtre ---------- */

.rp-outils { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: .8rem; }
.rp-outils .ilph-prompt { flex: 1 1 260px; }
.rp-tri { display: inline-flex; align-items: center; gap: .6rem; font-size: .7rem; color: var(--muted); }
.rp-puces { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.4rem; }

.rp-vide { margin: 0; font-size: .85rem; color: var(--muted); }
.rp-vide::before { content: "> "; color: var(--accent); }
.rp-note { font-size: .75rem; color: var(--muted); }

/* ---------- Portrait tramé (RP.portrait) ---------- */

/* Comme .ilph-icon, en carré plus grand : tramé au repos, vraies couleurs au survol */
.rp-portrait {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 96px;
  aspect-ratio: 1;
  border: 1px solid var(--hairline);
  background:
    repeating-conic-gradient(color-mix(in srgb, var(--accent) 8%, transparent) 0% 25%, transparent 0% 50%) 0 0 / 4px 4px,
    var(--bg);
  overflow: hidden;
}
.rp-portrait > * {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%; /* même recadrage que la trame */
  image-rendering: pixelated;
  transition: opacity .25s;
}
.rp-portrait.dithered .icon-orig { opacity: 0; image-rendering: auto; }
:is(a, .is-interactive, .rp-identite):is(:hover, :focus-visible) .rp-portrait.dithered .icon-orig { opacity: 1; }
:is(a, .is-interactive, .rp-identite):is(:hover, :focus-visible) .rp-portrait.dithered .icon-dither { opacity: 0; }
.rp-portrait.glyph { font-family: var(--font-pixel); font-size: 2.6rem; text-transform: uppercase; color: var(--accent); }

.ilph-card .info { min-width: 0; }
.ilph-card .desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }

/* ---------- Fiche ---------- */

.rp-retour { margin-bottom: 1.6rem; }
.rp-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 0; }

.rp-fiche {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  align-items: start;
  gap: 2rem;
}
.rp-cote { position: sticky; top: 1.5rem; margin-top: 2.5rem; }
.rp-contenu > .ilph-section:first-child { margin-top: 2.5rem; }

.rp-identite { display: flex; flex-direction: column; gap: 1.1rem; }
.rp-identite .rp-portrait { width: 100%; }
.rp-identite .rp-portrait.glyph { font-size: 5rem; }

.rp-dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; font-size: .85rem; }
.rp-dl dt { padding-top: .2rem; font-size: .62rem; color: var(--muted); }
.rp-dl dd { margin: 0; overflow-wrap: anywhere; }
.rp-titre { font-weight: 500; }

/* Ligne « plugin · nom · code · bouton » des codes */
.rp-liste { display: flex; flex-direction: column; gap: .5rem; }
.rp-ligne {
  display: grid;
  grid-template-columns: minmax(0, 13rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem 1rem;
  padding: .6rem .8rem;
  border: 1px solid var(--hairline);
  background: var(--surface);
}
.rp-ligne-tete { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.rp-plugin { font-size: .6rem; color: var(--accent); }
.rp-ligne-nom { font-size: .85rem; overflow-wrap: anywhere; }
.rp-ligne .rp-note { justify-self: end; }

.rp-code {
  display: block;
  padding: .35rem .6rem;
  border: 1px solid var(--hairline);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
  cursor: text;
}

/* Tableau des mods : défile horizontalement sur petit écran plutôt que d'écraser les colonnes */
.rp-defile { overflow-x: auto; border: 1px solid var(--hairline); background: var(--surface); }
.rp-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.rp-table th {
  padding: .55rem .8rem;
  border-bottom: 1px solid var(--hairline-strong);
  font-size: .6rem;
  font-weight: 400;
  text-align: left;
  color: var(--accent);
  white-space: nowrap;
}
.rp-table td { padding: .45rem .8rem; border-bottom: 1px dashed var(--hairline); vertical-align: middle; }
.rp-table tbody tr:hover { background: var(--checker), var(--surface); }
.rp-table tfoot td { border-bottom: 0; border-top: 1px solid var(--hairline-strong); font-weight: 500; color: var(--highlight); }
.rp-table .rp-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rp-mod-nom { min-width: 12rem; }
.rp-manquant { font-size: .72rem; color: var(--danger); }

/* Galerie d'images */
.rp-galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem; }
.rp-galerie > .rp-vide { grid-column: 1 / -1; }
.rp-vignette { display: flex; flex-direction: column; gap: .3rem; text-decoration: none; }
.rp-vignette .rp-portrait { width: 100%; transition: transform .2s, box-shadow .2s; }
.rp-vignette:is(:hover, :focus-visible) .rp-portrait { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--accent); }
.rp-vignette:focus-visible { outline: none; }

@media (max-width: 820px) {
  .rp-fiche { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rp-cote { position: static; }
  .rp-identite .rp-portrait { width: min(100%, 280px); margin-inline: auto; }
}

@media (max-width: 560px) {
  .rp-ligne { grid-template-columns: minmax(0, 1fr) auto; }
  .rp-ligne-tete { grid-column: 1 / -1; }
  /* Catégorie et auteur masqués : la taille et le bouton restent visibles sans défiler */
  .rp-table :is(th, td):is(:nth-child(2), :nth-child(3)) { display: none; }
}

/* ---------- Connexion ---------- */

.rp-connexion { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; max-width: 560px; }
.rp-connexion .ilph-prompt { flex: 1 1 240px; }
.rp-erreur { flex-basis: 100%; margin: 0; font-size: .85rem; color: var(--danger); }
.rp-erreur::before { content: "> "; }
