/* The picture gallery.
   Sized for the same readers as the puzzle: big targets, big type, and
   photographs given as much of the page as they can have. */

.gallery-page .Master > section.gallery {
  padding: 10px 16px 24px;
}

.gallery-page footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  padding: 2px 10px;
  margin: 0;
}

.gallery-page .build-tag,
.gallery-page .page-hits {
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: var(--footer-size);
  letter-spacing: 0.04em;
  opacity: 0.45;
  margin: 0;
}

.gallery-page .page-hits::before { content: '· '; }

.gallery-intro { max-width: 46rem; }

.gallery-intro h2 {
  margin: 8px 0 6px;
  color: var(--accent);
  font-size: calc(1.5rem * var(--font-scale, 1));
}

.gallery-intro p {
  margin: 0 0 16px;
  color: var(--ink-muted);
  font-size: calc(1.02rem * var(--font-scale, 1));
  line-height: 1.55;
}

/* --------------------------------------------------------- artist filter */

.gallery-artists {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.gallery-artist {
  font: inherit;
  font-size: calc(1rem * var(--font-scale, 1));
  min-height: 2.7rem;
  padding: 6px 18px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--button-bg);
  color: var(--button-ink);
  cursor: pointer;
}

.gallery-artist:hover { background: var(--button-hover-bg); }

.gallery-artist.is-on {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: var(--on-accent);
  font-weight: bold;
}

.gallery-status {
  color: var(--ink-muted);
  font-size: calc(1.02rem * var(--font-scale, 1));
  padding: 24px 0;
}

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

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 16px;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease-out, transform 120ms ease-out;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-card { transition: none; }
  .gallery-card:hover, .gallery-card:focus-visible { transform: none; }
}

.gallery-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-alt);
}

.gallery-card__label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px 12px;
  font-size: calc(1rem * var(--font-scale, 1));
  color: var(--ink);
}

.gallery-card__label i { font-style: normal; color: var(--ink-muted); }

/* --------------------------------------------------------------- viewer */

.viewer {
  width: min(96vw, 78rem);
  max-width: 96vw;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
}

.viewer::backdrop { background: rgb(0 0 0 / 0.72); }

.viewer__frame {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Dark behind the picture whatever the site theme is doing: a photograph
     floating on white has a different colour balance than the same photograph
     on grey, and this is the page whose whole job is showing them properly. */
  background: #171214;
  max-height: 72vh;
}

.viewer__frame img {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.viewer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--rule);
}

.viewer__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.viewer__text b { font-size: calc(1.15rem * var(--font-scale, 1)); }
.viewer__text i {
  font-style: normal;
  color: var(--ink-muted);
  font-size: calc(0.98rem * var(--font-scale, 1));
}
.viewer__text span {
  color: var(--ink-faint);
  font-size: calc(0.9rem * var(--font-scale, 1));
}

.viewer__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.viewer__actions button,
.viewer__actions a {
  font: inherit;
  font-size: calc(1rem * var(--font-scale, 1));
  min-height: 2.7rem;
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 7px;
  border: 1px solid var(--rule-strong);
  background: var(--button-bg);
  color: var(--button-ink);
  cursor: pointer;
  text-decoration: none;
}

.viewer__actions button:hover,
.viewer__actions a:hover { background: var(--button-hover-bg); }

/* Turning a picture into a puzzle is what this page is FOR, so it is the one
   control on the row wearing the company colour. */
.viewer__play {
  background: var(--accent) !important;
  border-color: var(--accent-strong) !important;
  color: var(--on-accent) !important;
  font-weight: bold;
}

@media (max-width: 560px) {
  .gallery-page .Master > section.gallery { padding: 8px 10px 20px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }
  .viewer__bar { justify-content: flex-start; }
}
