/* ===================================================================
   EOS — Catalogue du matériel
   ===================================================================
   Partagé par Vehicules.html et Armes.html : les onglets en haut, la
   liste à gauche, la fiche à droite. Sous 900 px, liste et fiche se
   partagent la place à tour de rôle (.vue-fiche).

   Requiert eos.css et socle.css, à charger avant.
   =================================================================== */

/* Liste et fiche défilent chacune de leur côté : la zone de contenu, elle,
   ne défile pas. Même sélecteur que socle.css, l'ordre de chargement fait
   le reste. */
.terminal-frame > .page-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── ONGLETS ────────────────────────────────── */
.cat-onglets {
  flex-shrink: 0;
  display: flex;
  gap: 2px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-hairline);
  /* Sur écran étroit, la rangée défile plutôt que de passer à la ligne : elle
     garde sa hauteur, et la liste aussi. */
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-onglets::-webkit-scrollbar { display: none; }

.cat-onglet {
  flex-shrink: 0;
  height: 38px;
  padding: 0 11px;
  background: none;
  border: none;
  /* Déclaré transparent dès le repos : posé seulement à l'état actif, il
     décalerait le libellé de 2 px. */
  border-bottom: 2px solid transparent;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.cat-onglet:hover { color: var(--text-primary); background: rgba(76, 143, 209, 0.07); }
.cat-onglet:focus-visible { outline: none; color: var(--accent-ice); background: rgba(76, 143, 209, 0.12); }
.cat-onglet.est-actif {
  color: var(--text-primary);
  background: rgba(76, 143, 209, 0.1);
  border-bottom-color: var(--accent-un-blue);
}

/* ─── CORPS ──────────────────────────────────── */
/* min-height: 0 sur la grille et ses deux colonnes : sans lui, un enfant en
   overflow refuse de se comprimer et pousse la grille hors du cadre. */
.cat-corps {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

/* ─── LISTE ──────────────────────────────────── */
.cat-liste {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-hairline);
}

.cat-recherche {
  flex-shrink: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-hairline);
}
.cat-recherche input {
  width: 100%;
  padding: 7px 10px;
  background: var(--input-bg);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}
.cat-recherche input::placeholder { color: var(--text-faint); }
.cat-recherche input:focus { outline: none; border-color: var(--accent-un-blue); }

.cat-lignes {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Les lignes d'un groupe et leur en-tête partagent la même grille : vignette,
   nom, puis une colonne par valeur. --colonnes vient du script, qui retire les
   colonnes vides pour tout le groupe, et --col, de la page.

   ⚠ --colonnes est absente, et non `repeat(0, …)`, pour un groupe sans
   colonne : ce repeat-là est invalide et annulerait toute la grille. */
.cat-groupe-tete,
.cat-ligne {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) var(--colonnes, );
  align-items: center;
  column-gap: 10px;
  padding: 0 14px;
}

.cat-groupe-tete {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 28px;
  background: var(--panel-steel);
  border-bottom: 1px solid var(--border-hairline);
}
.cat-groupe-nom {
  grid-column: 1 / 3;
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-un-blue);
}
.cat-groupe-nb {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 400; letter-spacing: 0.06em;
  color: var(--text-faint);
}
.cat-groupe-col {
  font-family: var(--font-mono);
  font-size: 8px; letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cat-groupe-desc {
  padding: 9px 14px;
  font-size: 12px; line-height: 1.5;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(34, 48, 61, 0.6);
}

.cat-ligne {
  position: relative;
  /* Une ligne amenée dans la vue ne doit pas finir sous l'en-tête collant. */
  scroll-margin-top: 30px;
  width: 100%;
  min-height: 50px;
  padding-top: 5px;
  padding-bottom: 5px;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(34, 48, 61, 0.6);
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.cat-ligne:hover { background: rgba(76, 143, 209, 0.07); }
.cat-ligne:focus-visible { outline: 1px solid var(--accent-ice); outline-offset: -1px; }
/* Liseré gauche, comme les tuiles des accueils. */
.cat-ligne::before {
  content: '';
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 2px;
  background: var(--accent-un-blue);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.cat-ligne.est-choisie { background: rgba(76, 143, 209, 0.13); }
.cat-ligne.est-choisie::before { opacity: 1; }
.cat-ligne.est-choisie .cat-ligne-nom { color: var(--accent-ice); }

.cat-vignette {
  width: 58px; height: 38px;
  display: block;
  object-fit: contain;
  /* Même raison que le fond de .fiche-visuel : les images noires détourées. */
  background: radial-gradient(ellipse at center, var(--border-hairline-bright) 0%, transparent 75%);
}
.cat-vignette--vide {
  background: none;
  border: 1px dashed var(--border-hairline);
}

.cat-ligne-texte { min-width: 0; }
.cat-ligne-nom {
  display: block;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600; letter-spacing: 0.05em;
  line-height: 1.2;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cat-ligne-sous {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cat-ligne-val {
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
  color: var(--text-secondary);
}

.cat-message {
  padding: 28px 16px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cat-message--erreur { color: var(--accent-alert); }

/* ─── FICHE ──────────────────────────────────── */
.fiche {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 22px 24px;
}

/* Réservé à la vue étroite, où la fiche prend la place de la liste. */
.fiche-retour {
  display: none;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  padding: 5px 9px 5px 0;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ice);
  cursor: pointer;
}

/* Le fond clair au centre n'est pas décoratif : plusieurs armes sont noires
   et détourées, elles disparaîtraient sur le fond du cadre. */
.fiche-visuel {
  position: relative;
  height: clamp(140px, 30dvh, 270px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: radial-gradient(ellipse at center, var(--border-hairline-bright) 0%, var(--panel-steel-light) 72%);
  border: 1px solid rgba(76, 143, 209, 0.22);
}
.fiche-visuel img {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
}
.fiche-visuel-vide {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.fiche-coin { position: absolute; width: 14px; height: 14px; opacity: 0.55; }
.fiche-coin.tl { top: 6px;    left: 6px;  border-top: 1px solid var(--accent-un-blue);    border-left: 1px solid var(--accent-un-blue); }
.fiche-coin.tr { top: 6px;    right: 6px; border-top: 1px solid var(--accent-un-blue);    border-right: 1px solid var(--accent-un-blue); }
.fiche-coin.bl { bottom: 6px; left: 6px;  border-bottom: 1px solid var(--accent-un-blue); border-left: 1px solid var(--accent-un-blue); }
.fiche-coin.br { bottom: 6px; right: 6px; border-bottom: 1px solid var(--accent-un-blue); border-right: 1px solid var(--accent-un-blue); }

.fiche-nom {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-size: 25px; font-weight: 700; letter-spacing: 0.1em;
  line-height: 1.15;
  text-transform: uppercase;
  color: var(--text-primary);
}
.fiche-sous {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fiche-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
/* La valeur reste en bas : les chiffres d'une rangée s'alignent même si un
   libellé passe sur deux lignes. */
.fiche-stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 11px 7px;
  background: rgba(13, 22, 32, 0.7);
  border: 1px solid var(--border-hairline);
}
.fiche-stat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 8px; letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.fiche-stat-val {
  display: block;
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--accent-ice);
}
/* Un mot plutôt qu'un chiffre (« Selon munition ») n'a pas la place de la
   grande taille. */
.fiche-stat-val--mot { font-size: 14px; line-height: 23px; }

.fiche-section { margin-top: 18px; }
.fiche-section-titre {
  margin: 0 0 2px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-hairline);
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-un-blue);
}

.fiche-texte {
  font-size: 13.5px; line-height: 1.7;
  color: var(--text-secondary);
}
.fiche-texte p { margin: 8px 0 0; }
.fiche-section > .fiche-texte { margin-top: 2px; }

/* ─── RÈGLES REPLIABLES ──────────────────────── */
.regle { border-bottom: 1px solid rgba(34, 48, 61, 0.6); }
.regle-tete {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 2px;
  list-style: none;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 500; letter-spacing: 0.05em;
  color: var(--text-primary);
}
.regle-tete::-webkit-details-marker { display: none; }
summary.regle-tete { cursor: pointer; transition: color var(--transition-fast); }
summary.regle-tete:hover { color: var(--accent-ice); }
summary.regle-tete:focus-visible { outline: 1px solid var(--accent-ice); outline-offset: -1px; }
summary.regle-tete::before {
  content: '▸';
  flex-shrink: 0;
  font-size: 10px;
  color: var(--accent-un-blue);
  transition: transform var(--transition-fast);
}
.regle[open] > summary.regle-tete::before { transform: rotate(90deg); }

/* À droite, ce qui s'applique au jet : la compétence d'un mode d'attaque. */
.regle-etiquette {
  margin-left: auto;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.regle-corps {
  padding: 0 2px 10px 18px;
  font-size: 13px; line-height: 1.65;
  color: var(--text-secondary);
}
.regle-corps p { margin: 0 0 6px; }
.regle-corps p:last-child { margin-bottom: 0; }
.regle-cas {
  margin: 8px 0 2px;
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 400; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.regle-cas:first-child { margin-top: 0; }

/* ─── PETITS ÉLÉMENTS ────────────────────────── */
.puces { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.puce {
  padding: 3px 8px;
  border: 1px solid var(--border-hairline-bright);
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Même convention que les entrées inactives de l'accueil racine. */
.fiche-avenir {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px dashed var(--border-hairline);
  font-size: 12px;
  color: var(--text-muted);
}
.fiche-avenir-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  border: 1px solid var(--border-hairline-bright);
  font-family: var(--font-mono);
  font-size: 8px; letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Barre de défilement discrète, alignée sur celle du gabarit. */
.cat-lignes::-webkit-scrollbar,
.fiche::-webkit-scrollbar { width: 8px; }
.cat-lignes::-webkit-scrollbar-track,
.fiche::-webkit-scrollbar-track { background: transparent; }
.cat-lignes::-webkit-scrollbar-thumb,
.fiche::-webkit-scrollbar-thumb { background: var(--border-hairline-bright); border-radius: 4px; }

/* ─── RESPONSIVE ─────────────────────────────── */
/* Le palier suit la largeur du CADRE : à 900 px de fenêtre, il reste environ
   870 px, soit 450 pour la fiche à côté de la liste. En dessous, elle
   manquerait de place pour ses caractéristiques. */
@media (max-width: 900px) {
  .cat-corps { grid-template-columns: minmax(0, 1fr); }
  .cat-liste { border-right: none; }
  .fiche { display: none; }
  .fiche-retour { display: inline-flex; }

  .vue-fiche .cat-onglets,
  .vue-fiche .cat-liste { display: none; }
  .vue-fiche .fiche { display: block; }
}

@media (max-width: 640px) {
  .top-nav { padding: 0 12px; }
  .nav-title { font-size: 9px; letter-spacing: 0.2em; }
  .nav-status { display: none; }
  .cat-onglets { padding: 0 6px; }
  .cat-recherche { padding: 8px 10px; }
  .cat-groupe-tete, .cat-ligne { padding-left: 10px; padding-right: 10px; column-gap: 8px; }
  .fiche { padding: 12px 14px 20px; }
  .fiche-nom { font-size: 21px; }
}

/* Écran bas : l'image cède la place au texte. */
@media (max-height: 620px) {
  .fiche-visuel { height: 130px; }
}
