/* Gallery — uses the global /style.css for card visuals; this file styles
   the gallery shell (filters, grid, head). */

body.no-game { padding: 0; }
/* Override: /style.css hides .head-score when no game; we use the slot
   for the gallery title. */
body.no-game .head-score.head-gallery { visibility: visible; }

.head-gallery .head-mid {
  font-variant: small-caps;
  letter-spacing: .06em;
  font-size: 1.05rem;
}

.gallery-tools {
  max-width: 78rem;
  margin: 0 auto;
  padding: .8rem 1.2rem 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.gallery-tools-row {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.gallery-tools-row--filter {
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
.g-spacer { flex: 1; min-width: 0; }
.g-search {
  flex: 1 1 14rem; max-width: 22rem;
  padding: .5rem .7rem;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: var(--paper); color: var(--ink);
  font: inherit; font-size: .95rem;
}
.g-select {
  padding: .45rem .65rem;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: var(--paper); color: var(--ink);
  font: inherit; font-size: .9rem;
}
.g-dir-btn {
  width: 2.2rem; height: 2.2rem;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: var(--paper); color: var(--ink);
  font: inherit; font-size: 1.1rem;
  cursor: pointer;
}
.g-dir-btn:hover { background: var(--paper-soft); }

/* View toggle: pill-segmented control matching the class chips' look. */
.g-view-toggle {
  display: inline-flex;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
}
.g-view-toggle button {
  padding: .35rem .85rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit; font-size: .85rem;
  cursor: pointer;
}
.g-view-toggle button + button { border-left: 1.5px solid var(--rule); }
.g-view-toggle button.active { background: var(--accent); color: var(--paper); }
[data-theme="dark"] .g-view-toggle button.active { color: #1a1612; }

/* Class filter chips — same look as on the intro screen */
.class-filter {
  display: flex; flex-wrap: wrap; gap: .35rem;
}
.class-filter button {
  padding: .35rem .7rem;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit; font-size: .85rem;
  cursor: pointer;
}
.class-filter button.active {
  border-color: var(--accent);
  background: var(--paper-soft);
}
.class-filter button[data-class="all"].active {
  background: var(--accent); color: var(--paper);
}
[data-theme="dark"] .class-filter button[data-class="all"].active { color: #1a1612; }
.class-filter .class-count {
  margin-left: .3em;
  font-size: .78em;
  opacity: .6;
}

/* Card grid */
.gallery-grid {
  max-width: 78rem;
  margin: 1rem auto 0;
  padding: 0 1.2rem 2.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1.2rem;
}
/* Card visuals come entirely from /style.css. Each grid cell holds one
   .card-slot which already has aspect-ratio: 8/5 + max-width: 28rem,
   and the .card inside fills it via `position: absolute; inset: 0`. */

.gallery-foot {
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 1.2rem 2rem;
  font-size: .85rem;
  color: var(--ink-faint);
  text-align: right;
}

@media (max-width: 600px) {
  .gallery-tools { padding: .6rem .65rem 0; gap: .45rem; }
  .gallery-grid {
    padding: 0 .65rem 2rem;
    grid-template-columns: 1fr;
    gap: .9rem;
  }
  .gallery-tools-row { gap: .4rem; }
  .gallery-tools-row--filter { flex-wrap: wrap; }
  .g-search { font-size: .9rem; }
  .g-view-toggle { margin-left: auto; }
}

/* Variant cycle button — overlays bottom-right corner of .card-slot */
.variant-cycle {
  position: absolute;
  bottom: .4rem;
  right: .4rem;
  z-index: 10;
  padding: .18rem .48rem;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  background: rgba(0,0,0,.52);
  color: #fff;
  font: inherit; font-size: .72rem;
  line-height: 1.3;
  cursor: pointer;
  backdrop-filter: blur(3px);
  user-select: none;
}
.variant-cycle:hover { background: rgba(0,0,0,.72); }

/* Settings popover styles — minimal version of the play.js popover */
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; padding: .55rem 0;
  border-bottom: 1px dashed var(--rule);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .settings-label {
  font-size: .9rem; color: var(--ink); font-variant: normal;
  text-transform: none; letter-spacing: 0;
}

/* Vintage: bright wood texture on gallery toolbar elements */
html[data-vintage="true"] .g-search,
html[data-vintage="true"] .g-select,
html[data-vintage="true"] .g-dir-btn,
html[data-vintage="true"] .g-view-toggle,
html[data-vintage="true"] .class-filter button {
  background-color: #c8a060;
  background-image:
    linear-gradient(rgba(238,210,148,.72), rgba(238,210,148,.72)),
    url('/images/wood-table.jpg');
  background-size: auto, 512px 512px;
}
html[data-vintage="true"] .g-dir-btn:hover {
  background-image:
    linear-gradient(rgba(220,188,120,.72), rgba(220,188,120,.72)),
    url('/images/wood-table.jpg');
}
html[data-vintage="true"] .g-view-toggle button.active,
html[data-vintage="true"] .class-filter button.active {
  background-color: #2e1a08;
  background-image:
    linear-gradient(rgba(0,0,0,.42), rgba(0,0,0,.42)),
    url('/images/wood-table.jpg');
  background-size: auto, 512px 512px;
  color: #f2e4a8;
}

