/* Page Implants */

/* Le défilement horizontal est porté par chaque tableau, pas par la section :
   sinon overflow-y bascule aussi en auto et rogne ombres et survols des cartes. */
.imp-table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--theme-accent-rgb), 0.35) transparent;
}

.imp-table-wrap::-webkit-scrollbar {
  height: 6px;
}

.imp-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(var(--theme-accent-rgb), 0.35);
}

.imp-cat-lead {
  margin: 0 0 1.15rem;
  max-width: 72ch;
  color: var(--text-dim);
  line-height: 1.6;
}





/* Fiche implant */

.imp-card {
  position: relative;
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
  margin: 0 0 1.35rem;
  padding: 1.1rem 1.2rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface-2) 0%, var(--surface-1) 55%);
  box-shadow: var(--shadow-card);
  clip-path: polygon(0 0, calc(100% - var(--bevel)) 0, 100% var(--bevel), 100% 100%, 0 100%);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

/* Liseré d'accent sur la tranche gauche, qui s'allume au survol */
.imp-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(var(--theme-accent-rgb), 0.65), transparent 70%);
  transition: background 0.2s;
}

.imp-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-raised);
  transform: translateY(-2px);
}

.imp-card:hover::before {
  background: linear-gradient(180deg, var(--turquoise), rgba(var(--theme-accent-rgb), 0.15) 80%);
}

.imp-card:last-child {
  margin-bottom: 0;
}

.imp-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.imp-card__title {
  margin: 0;
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.3;
}

/* Bandeau de caractéristiques : lecture type relevé technique */
.imp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0;
}

.imp-meta > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  background: var(--surface-sunken);
}

.imp-meta dt {
  margin: 0;
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.imp-meta dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--turquoise);
}

.imp-card__desc {
  margin: 0 0 0.9rem;
  max-width: 72ch;
  line-height: 1.65;
  color: var(--text);
}

.imp-card__body {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  gap: 1.25rem 1.5rem;
  align-items: center;
}

/* Visuel : caisson encastré avec halo, le rendu ne flotte plus sur du noir */
.imp-card__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.65rem;
  width: 11.5rem;
  height: 11.5rem;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 45%, rgba(var(--theme-accent-rgb), 0.14), transparent 65%),
    var(--surface-sunken);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

/* Crochets d'angle du caisson */
.imp-card__media::before,
.imp-card__media::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: rgba(var(--theme-accent-rgb), 0.5);
  border-style: solid;
  pointer-events: none;
}

.imp-card__media::before {
  top: 5px;
  left: 5px;
  border-width: 1px 0 0 1px;
}

.imp-card__media::after {
  right: 5px;
  bottom: 5px;
  border-width: 0 1px 1px 0;
}

.imp-card__media img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  margin: auto;
}

.imp-card__content {
  min-width: 0;
}

.imp-card__content .imp-card__desc {
  margin-top: 0;
}

@media (max-width: 720px) {
  .imp-card__body {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: left;
  }

  .imp-card__media {
    width: 12rem;
    height: 12rem;
    margin-inline: auto;
  }

  .imp-card__content {
    width: 100%;
  }
}

/* Bloc dépliable natif (<details>) — aucun JS requis pour l'ouverture */
.imp-caps {
  margin: 0.55rem 0 0;
  border: 1px solid var(--line);
  background: var(--surface-sunken);
}

.imp-caps__summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

/* Retire le triangle natif (WebKit et le reste) */
.imp-caps__summary::-webkit-details-marker {
  display: none;
}

/* Chevron maison, pivote à l'ouverture */
.imp-caps__summary::before {
  content: "";
  flex-shrink: 0;
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid var(--turquoise);
  border-bottom: 2px solid var(--turquoise);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

.imp-caps[open] > .imp-caps__summary::before {
  transform: rotate(45deg);
}

.imp-caps__summary:hover {
  background: rgba(var(--theme-accent-rgb), 0.07);
}

.imp-caps__summary:focus-visible {
  outline: 2px solid var(--turquoise);
  outline-offset: -2px;
}

.imp-caps[open] > .imp-caps__summary {
  border-bottom: 1px solid var(--line);
}

.imp-caps__label {
  margin: 0;
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1.3;
}

.imp-caps__summary:hover .imp-caps__label {
  color: var(--text);
}

/* Compteur : on sait ce qu'il y a dedans avant de déplier */
.imp-caps__count {
  margin-left: auto;
  min-width: 1.35rem;
  padding: 0.1rem 0.35rem;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 700;
  text-align: center;
  color: var(--turquoise);
  background: rgba(var(--theme-accent-rgb), 0.12);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.25);
}

.imp-caps__panel {
  padding: 0.75rem;
}

/* Grille à colonnes égales : les chips s'alignent en lignes et en colonnes,
   au lieu d'un retour à la ligne libre qui donne un bord droit en escalier. */
.imp-caps__list {
  display: grid;
  /* min() : sur écran étroit la colonne ne dépasse jamais le conteneur */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Chip à coin biseauté, en écho au biseau des fiches.
   Le biseau est en haut à droite uniquement : bords gauche et bas restent
   d'équerre, donc tout s'aligne au cordeau sur le libellé et sur la carte. */
.imp-caps__list li {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.imp-caps__list li:hover {
  color: var(--turquoise-bright);
  border-color: rgba(var(--theme-accent-rgb), 0.5);
  background: var(--surface-2);
}

.imp-caps__note {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.imp-caps__note a,
.imp-caps a {
  color: var(--turquoise);
  text-decoration: none;
}

.imp-caps__note a:hover,
.imp-caps a:hover {
  text-decoration: underline;
}

/* Tables */

.imp-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.imp-table thead th {
  padding: 0.5rem 0.75rem 0.55rem 0.6rem;
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-faint);
  /* pointait sur --theme-border, jamais défini : le filet ne s'affichait pas */
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-sunken);
  vertical-align: bottom;
}

.imp-table thead th:last-child {
  padding-right: 0.6rem;
}

.imp-table thead th.imp-table__th--price {
  text-align: right;
  padding-left: 1rem;
  white-space: nowrap;
  width: 1%;
}

.imp-table tbody td.imp-price {
  text-align: right;
  padding-left: 1rem;
  white-space: nowrap;
  width: 1%;
}

.imp-table thead th.imp-table__th--acteur {
  padding-left: 2rem;
}

.imp-table tbody td {
  padding: 0.55rem 0.75rem 0.55rem 0.6rem;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.imp-table tbody td:last-child {
  padding-right: 0.6rem;
}

/* Zébrage + survol : on suit une ligne du regard sans se perdre */
.imp-table tbody tr:nth-child(even of :not([hidden])) {
  background: rgba(255, 255, 255, 0.018);
}

.imp-table tbody tr:hover {
  background: rgba(var(--theme-accent-rgb), 0.07);
}

.imp-table tbody tr:last-child td {
  border-bottom: none;
}

.imp-table tbody td.imp-acteur {
  padding-left: 2rem;
}

/* Colonne Niveau : pastille chiffrée plutôt qu'un simple chiffre coloré */
.imp-table--levels tbody td:first-child {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--turquoise);
  white-space: nowrap;
  width: 1%;
  border-left: 2px solid rgba(var(--theme-accent-rgb), 0.4);
}

.imp-table--levels tbody tr:hover td:first-child {
  border-left-color: var(--turquoise);
}

/* Valeurs chiffrées en mono : les colonnes s'alignent à l'œil */
.imp-table--levels tbody td:not(:first-child) {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text);
}

.imp-name {
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
  padding-right: 1rem;
}

.imp-price {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--turquoise);
}

.imp-price--lore {
  font-family: var(--font-body);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: normal;
}

.imp-acteur {
  color: var(--text-dim);
  font-size: var(--fs-sm);
  line-height: 1.4;
}

/* En-tête de groupe tarifaire : barre HUD pleine largeur */
.imp-table__group th {
  padding: 0.6rem 0.6rem 0.55rem;
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  color: var(--turquoise);
  border-top: 1px solid rgba(var(--theme-accent-rgb), 0.3);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(var(--theme-accent-rgb), 0.14), transparent 70%);
}

.imp-table tbody tr.imp-table__group:hover {
  background: none;
}

.imp-table tbody tr.imp-table__group:first-child th {
  border-top: none;
}

.imp-table tbody tr.imp-table__group + tr td {
  padding-top: 0.7rem;
}

.imp-table tbody tr:has(+ .imp-table__group) td {
  border-bottom: none;
  padding-bottom: 0.9rem;
}

@media (max-width: 720px) {
  .imp-card {
    padding: 0.9rem;
  }

  .imp-card__head {
    flex-direction: column;
  }

  .imp-table thead {
    display: none;
  }

  .imp-table,
  .imp-table tbody,
  .imp-table tr,
  .imp-table td {
    display: block;
    width: 100%;
  }

  .imp-table tbody tr {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--theme-border-faint);
  }

  .imp-table tbody tr:last-child {
    border-bottom: none;
  }

  .imp-table tbody td {
    padding: 0.2rem 0;
    border: none;
    text-align: left;
  }

  .imp-table tbody td.imp-name {
    padding-right: 0;
  }

  .imp-table tbody td.imp-price,
  .imp-table tbody td.imp-acteur {
    padding-left: 0;
  }

  .imp-table tbody td.imp-name::before {
    content: "Implant · ";
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
  }

  .imp-table tbody td.imp-price::before {
    content: "Prix · ";
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
  }

  .imp-table tbody td.imp-acteur::before {
    content: "Acteurs · ";
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
  }

  /* Niveaux : chaque cellule reprend l’intitulé de sa colonne (thead masqué) */
  .imp-table--levels tbody td {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
  }

  .imp-table--levels tbody td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 8.5rem;
    /* la cellule est en mono : on repasse le libellé en police de texte,
       sinon les intitulés longs débordent de la gouttière */
    font-family: var(--font-body);
    font-size: var(--fs-micro);
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.5;
    text-transform: uppercase;
    color: var(--text-faint);
  }

  .imp-table--levels tbody td:first-child {
    margin-bottom: 0.35rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--theme-border-faint);
  }
}
