/* Sober AF -- Galleries directory (S-15): the public photo-gallery
 * card grid for the /galleries/ page body. Ported from the OLD theme
 * page-galleries.php inline <style> (lines 115-208).
 *
 * The Tier-D hybrid front end does NOT enqueue the dormant `sober-af`
 * theme CSS, so this file carries every affordance the OLD inline
 * style defined. Enqueued on is_page('galleries') by
 * SAF_Galleries_Directory. Tokens (var(--saf-*)) resolve from
 * tokens.css (enqueued globally by the child theme). See memory:
 * tier-d-old-theme-css-not-enqueued.
 *
 * Markup note: the card is a single <a> with <span> children (set to
 * block/flex below) so the whole card is one click target with valid
 * inline-content nesting. No bare `.saf-btn` here -- the page hero +
 * CTA buttons are Elementor widgets on the seeded page (memory:
 * per-cpt-css-saf-btn-footer-leak).
 */

.saf-galleries-grid {
  display: grid;
  /* auto-FILL (not auto-fit): auto-fill keeps phantom empty tracks so a
   * lone public gallery left-aligns at ~one track instead of ballooning
   * to full width and stretching its 4/3 cover (S-14 lesson).
   *
   * The track MAX must be flexible (1fr), NOT a fixed length. With a
   * fixed `minmax(280px, 360px)` max, the browser counts how many
   * *360px* tracks fit -- at a ~688px tablet container only one does
   * (2x360+gap > 688), collapsing the grid to a single track and
   * leaving ~330px of dead whitespace. `1fr` lets auto-fill count by
   * the 280px min (2 fit at 688 -> two ~332px columns) while still
   * never ballooning a lone card. Verified at 1440/768/375 (S-15). */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--saf-gap-5, 32px);
}

.saf-gallery-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.saf-gallery-card:hover,
.saf-gallery-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* Keyboard a11y: visible focus ring (improvement over OLD, which
 * relied on the UA default and had no offset). */
.saf-gallery-card:focus-visible {
  outline: 2px solid var(--saf-brick-red, #be2727);
  outline-offset: 2px;
}

.saf-gallery-card__cover {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.saf-gallery-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.saf-gallery-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* rgba on ink, decorative -- the inline SVG inherits via currentColor. */
  color: rgba(28, 23, 16, 0.28);
}

.saf-gallery-card__placeholder svg {
  width: 48px;
  height: 48px;
}

.saf-gallery-card__badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(13, 17, 29, 0.82);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.saf-gallery-card__body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.saf-gallery-card__title {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--saf-ink, #1c1710);
}

.saf-gallery-card__meta {
  margin: 0;
  font-size: 0.8125rem;
  /* rgba on ink, not opacity -- AA-safe (memory:
   * a11y-contrast-opacity-gotcha). */
  color: rgba(28, 23, 16, 0.6);
  letter-spacing: 0.02em;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.saf-gallery-card__event {
  font-style: italic;
}

.saf-galleries-empty {
  padding: 48px 24px;
  text-align: center;
  color: rgba(28, 23, 16, 0.6);
  background: rgba(0, 0, 0, 0.03);
  border-radius: 12px;
}

@media (max-width: 480px) {
  .saf-galleries-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}
