/* AKDB — styles des entrées : cartes (grille), lignes (liste), groupes, panneau détail. */

/* ---------- vue grille ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface) 0%, #14181f 100%);
  color: inherit;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.card:hover { border-color: #3a4553; background: var(--surface-2); }

.card-top {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.card-icon {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0d1015;
  image-rendering: -webkit-optimize-contrast;
}
.card-icon.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--display);
  font-size: 19px;
}
.card-head { min-width: 0; }
.card-name {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card.has-badge .card-name { padding-right: 4px; }
/* succès : pas d'icône ni de badge -> le nom peut se replier au lieu d'être tronqué */
.card.achi .card-name { white-space: normal; }
.row.achi .row-name span { white-space: normal; }
.card-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  border: 1px solid currentColor;
  background: rgba(0,0,0,.25);
  color: var(--muted);
}
.card-badge.r0 { color: var(--r0); }
.card-badge.r1 { color: var(--r1); }
.card-badge.r2 { color: var(--r2); }
.card-badge.r5 { color: var(--r5); }
.card-badge.r3 { color: var(--r3); }
.card-badge.r4 { color: var(--r4); }
.card-badge.r6 { color: var(--r6); }
.card.has-badge .card-top { padding-top: 8px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #1a2028;
  border: 1px solid #28313d;
  color: #aeb7c3;
  font-size: 11px;
  white-space: nowrap;
}
.tag img { width: 14px; height: 14px; }

.card-desc {
  margin-top: 9px;
  color: #a3abb6;
  font-size: 12.5px;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-id {
  margin-top: auto;
  padding-top: 10px;
  align-self: flex-end;
  color: #6c7684;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* couleurs de rareté (nom, grille et liste) */
.card-name .r0, .row-name .r0, .detail-title.r0 { color: var(--r0); }
.card-name .r1, .row-name .r1, .detail-title.r1 { color: var(--r1); }
.card-name .r2, .row-name .r2, .detail-title.r2 { color: var(--r2); }
.card-name .r5, .row-name .r5, .detail-title.r5 { color: var(--r5); }
.card-name .r3, .row-name .r3, .detail-title.r3 { color: var(--r3); }
.card-name .r4, .row-name .r4, .detail-title.r4 { color: var(--r4); }
.card-name .r6, .row-name .r6, .detail-title.r6 { color: var(--r6); }

/* ---------- vue liste ---------- */

.list { display: flex; flex-direction: column; gap: 6px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
  transition: border-color .12s ease, background .12s ease;
}
.row:hover { background: var(--surface-2); border-color: #3a4553; }
.row.r0 { border-left-color: var(--r0); }
.row.r1 { border-left-color: var(--r1); }
.row.r2 { border-left-color: var(--r2); }
.row.r5 { border-left-color: var(--r5); }
.row.r3 { border-left-color: var(--r3); }
.row.r4 { border-left-color: var(--r4); }
.row.r6 { border-left-color: var(--r6); }

.row-icon {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0d1015;
  image-rendering: -webkit-optimize-contrast;
}
.row-icon.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--display);
  font-size: 15px;
}
.row-main { flex: 1; min-width: 0; }
.row-name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.row-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.element-badge {
  width: 17px;
  height: 17px;
  flex: none;
  filter: drop-shadow(0 1px 1px #0006);
}
.row-sub {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-id {
  flex: none;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 1px 7px;
  background: var(--surface-deep);
}

/* groupes (donjons) */
.group-head {
  font-family: var(--display);
  color: var(--gold);
  letter-spacing: .09em;
  font-size: 15px;
  font-weight: 500;
  margin: 14px 2px 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.group-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(201,155,71,.45), transparent);
}
.cards .group-head { grid-column: 1 / -1; }

/* ---------- pagination / vide ---------- */

.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 20px;
}
.page {
  min-width: 35px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-deep);
  color: #aab2bd;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: border-color .12s ease, color .12s ease;
}
.page:hover:not(:disabled):not(.active) { color: var(--text); border-color: #3a4553; }
.page:disabled { color: #5a6472; cursor: default; }
.page.active {
  color: #19130b;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 700;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 52px 20px;
  border: 1px dashed #313a46;
  border-radius: var(--radius);
  margin-top: 14px;
}

/* ---------- skeleton (chargement initial) ---------- */

.skeleton { pointer-events: none; }
.sk-block {
  border-radius: 5px;
  background: linear-gradient(90deg, var(--surface-2) 25%, #262d38 40%, var(--surface-2) 60%);
  background-size: 300% 100%;
  animation: sk-shimmer 1.3s linear infinite;
}
@keyframes sk-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.sk-line { height: 12px; }
.sk-line + .sk-line { margin-top: 8px; }
.card .sk-icon { width: 64px; height: 64px; }
.row .sk-icon { width: 40px; height: 40px; flex: none; }
.card.skeleton .sk-desc { margin-top: 14px; }

.cards.fade-in, .list.fade-in { animation: list-fade .3s ease; }
@keyframes list-fade { from { opacity: 0; transform: translateY(4px); } }

@media (prefers-reduced-motion: reduce) {
  .sk-block { animation: none; }
  .cards.fade-in, .list.fade-in { animation: none; }
}

/* ---------- page entité (arrivée directe sur /categorie/{id}-{slug}) ---------- */

.layout[hidden] { display: none; }   /* display:grid de .layout écrase le [hidden] natif */

.entry {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
  padding: 26px 20px 44px;
  /* comme .layout : le footer reste calé sous la fenêtre */
  min-height: calc(100vh - var(--topbar-h) - var(--nav-h));
}

.crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.crumbs a:hover { color: var(--gold-soft); }
.crumbs .sep { color: #4a5462; }
.crumbs .current { color: var(--text); font-weight: 600; }

.entry-card {
  background: linear-gradient(180deg, var(--surface) 0%, #14181f 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px 30px;
}
.entry-card .detail-icon { width: 88px; height: 88px; font-size: 27px; }
.entry-card .detail-title { font-size: 1.55rem; }
.entry-card .kv { font-size: .95rem; }
.entry-card .sk-icon { width: 88px; height: 88px; }
.entry-card .sk-desc { margin-top: 12px; }

/* ---------- panneau détail ---------- */

.detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: min(430px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 60px rgba(0,0,0,.5);
  padding: 2.4rem 1.5rem 1.5rem;
  overflow-y: auto;
  animation: slide .2s ease;
}
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }

.detail-close {
  position: absolute;
  top: .8rem;
  right: .9rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: .95rem;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
}
.detail-close:hover { color: var(--text); border-color: var(--gold-soft); }

.detail-head { display: flex; gap: .9rem; align-items: center; margin-bottom: 1.1rem; }
.detail-icon {
  width: 56px;
  height: 56px;
  border-radius: 7px;
  border: 1px solid rgba(201,155,71,.5);
  background: #0d1015;
}
.detail-icon.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--display);
  font-size: 18px;
}
.detail-title { font-family: var(--display); font-size: 1.15rem; line-height: 1.25; }

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .3rem .9rem;
  font-size: .92rem;
}
.kv dt { color: var(--muted); }
.kv dd { font-variant-numeric: tabular-nums; }
.kv-icon { width: 18px; height: 18px; vertical-align: -4px; margin-right: .4rem; }

.detail-desc-label {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
  font-family: var(--display);
  font-size: .82rem;
  letter-spacing: .1em;
  color: var(--gold);
  text-transform: uppercase;
  font-weight: 600;
}
.detail-desc-label + .detail-desc { margin-top: .5rem; padding-top: 0; border-top: none; }
.detail-desc {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
  color: var(--text);
  font-size: .95rem;
  white-space: pre-line;
}

.skill-line {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: .92rem;
}
.skill-line:last-child { border-bottom: none; }
.skill-icon {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.skill-icon.placeholder { background: rgba(255,255,255,.04); color: var(--muted); }
.skill-name { flex: 1; min-width: 0; font-weight: 500; }
.skill-meta { color: var(--muted); font-size: .78rem; white-space: nowrap; }

.infusion-star {
  flex-shrink: 0;
  width: 2.1em;
  color: var(--gold, #c9a227);
  font-size: .82rem;
  letter-spacing: .02em;
}
.infusion-desc { font-weight: 400; }
