/* Console library grid — pairs with ract-console-library.php.
   Tokens (--ra-*) come from retroarcade-polish.css; fallbacks keep this
   readable if the pro-rescue plugin is ever deactivated. */

.ract-cl {
  margin: 2rem 0 3rem;
}

/* --- tools bar ---------------------------------------------------------- */

.ract-cl-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-bottom: 2rem;
}

.ract-cl-search {
  flex: 1 1 22rem;
  min-width: 0;
  padding: 0.7rem 0.95rem;
  font-size: 1rem;
  color: var(--ra-ink, #111827);
  background: var(--ra-panel, #fff);
  border: 1px solid var(--ra-line, #dce2ea);
  border-radius: 8px;
}

.ract-cl-search:focus-visible {
  outline: 2px solid var(--ra-cyan, #10b8c7);
  outline-offset: 1px;
  border-color: transparent;
}

.ract-cl-count {
  font-size: 0.875rem;
  color: var(--ra-muted, #5b6678);
  font-variant-numeric: tabular-nums;
}

/* --- group headings ----------------------------------------------------- */

.ract-cl-group[hidden] {
  display: none;
}

.ract-cl-group + .ract-cl-group {
  margin-top: 2.5rem;
}

.ract-cl-heading {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--ra-ink, #111827);
  border-bottom: 2px solid var(--ra-line, #dce2ea);
}

/* Count is derived from the query, so it can never drift from the list. */
.ract-cl-n {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ra-muted, #5b6678);
  font-variant-numeric: tabular-nums;
}

.ract-cl-n::before { content: "("; }
.ract-cl-n::after  { content: ")"; }

/* --- grid --------------------------------------------------------------- */

.ract-cl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.ract-cl-card[hidden] {
  display: none;
}

.ract-cl-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: var(--ra-panel, #fff);
  border: 1px solid var(--ra-line, #dce2ea);
  border-radius: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.ract-cl-link:hover,
.ract-cl-link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--ra-cyan, #10b8c7);
  box-shadow: 0 6px 18px rgb(13 17 26 / 12%);
}

.ract-cl-link:focus-visible {
  outline: 2px solid var(--ra-cyan, #10b8c7);
  outline-offset: 2px;
}

/* Fixed-ratio thumb keeps rows aligned across wildly different source images
   (box art, consoles on white, screenshots). */
.ract-cl-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: #f2f4f7;
  overflow: hidden;
}

.ract-cl-thumb .ract-cl-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ract-cl-noimg {
  font-size: 2rem;
  color: #c3cad4;
}

.ract-cl-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 0.9rem 1rem;
}

.ract-cl-name {
  font-weight: 650;
  font-size: 1rem;
  line-height: 1.25;
  color: var(--ra-ink, #111827);
}

.ract-cl-link:hover .ract-cl-name {
  color: var(--ra-red, #d33f49);
}

.ract-cl-year {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ra-muted, #5b6678);
  font-variant-numeric: tabular-nums;
}

.ract-cl-desc {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ra-muted, #5b6678);
}

.ract-cl-empty {
  padding: 2rem 0;
  text-align: center;
  color: var(--ra-muted, #5b6678);
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 640px) {
  .ract-cl-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
  }

  .ract-cl-heading {
    font-size: 1.15rem;
  }

  .ract-cl-desc {
    display: none; /* names and years carry the scan on small screens */
  }
}

@media (prefers-reduced-motion: reduce) {
  .ract-cl-link {
    transition: none;
  }

  .ract-cl-link:hover,
  .ract-cl-link:focus-visible {
    transform: none;
  }
}

/* ── Spec card ─────────────────────────────────────────────────────────
   Renders console spec meta extracted from post-body tables. Shares this
   stylesheet because it is always shown alongside the library grid. */

.ract-spec {
  border: var(--stroke, 1px) solid var(--ra-line, #dce2ea);
  border-radius: 10px;
  background: var(--ra-panel, #fff);
  overflow: hidden;
  margin: 1.5rem 0;
}

.ract-spec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--ra-line, #dce2ea);
  background: rgba(0, 0, 0, 0.02);
}

.ract-spec-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
  color: var(--ra-ink, #111827);
}

.ract-spec-link {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ra-cyan, #10b8c7);
  text-decoration: none;
}

.ract-spec-link:hover { text-decoration: underline; }

.ract-spec-body {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 1.2rem;
  padding: 1.1rem;
  align-items: start;
}

.ract-spec-img img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

.ract-spec-list { margin: 0; }

/* Two columns of label/value on wide screens, one on narrow. Rows are
   zebra-striped rather than bordered so 12 fields do not read as a cage. */
.ract-spec-row {
  display: grid;
  grid-template-columns: minmax(0, 34%) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.42rem 0.5rem;
  font-size: 0.86rem;
}

.ract-spec-row:nth-child(odd) { background: rgba(0, 0, 0, 0.025); }

.ract-spec-row dt {
  font-weight: 650;
  color: var(--ra-muted, #5b6678);
}

.ract-spec-row dd {
  margin: 0;
  color: var(--ra-ink, #111827);
  overflow-wrap: anywhere;
}

@media (max-width: 620px) {
  .ract-spec-body { grid-template-columns: 1fr; }
  .ract-spec-row { grid-template-columns: 1fr; gap: 0.1rem; padding: 0.5rem; }
  .ract-spec-row dt { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; }
}
