/* ---------- gallery ---------- */
.browserbar { display: flex; align-items: flex-start; gap: 16px; padding: 18px 26px 4px; }
/* Tag browser: a collapsed "Browse tags" toggle that expands the chip list.
   Collapsed by default so the wrapping chip strip doesn't eat vertical space
   (esp. on mobile); .tagbar-wrap keeps the toggle + list in one flex column. */
.tagbar-wrap { display: flex; flex-direction: column; align-items: flex-start;
  gap: 8px; flex: 1; min-width: 0; }
.tags-toggle { display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; outline: none; }
.tags-toggle:hover { border-color: var(--coral); }
.tags-toggle:focus-visible { border-color: var(--coral);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--coral) 18%, transparent); }
.tags-toggle-caret { color: var(--muted); font-size: 10px; transition: transform 0.18s ease; }
.tags-toggle[aria-expanded="true"] .tags-toggle-caret { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .tags-toggle-caret { transition: none; } }
.tagbar { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; min-width: 0; }
.sort-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.sort-row { display: flex; align-items: center; gap: 8px; }
.result-count { font-size: 11.5px; color: var(--muted); font-weight: 600;
  letter-spacing: 0.4px; white-space: nowrap; }
.sort-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted); font-weight: 600; }
.sort-select { font-family: inherit; font-size: 12.5px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; cursor: pointer; outline: none; }
.sort-select:hover { border-color: var(--coral); }
.sort-select:focus { border-color: var(--coral); box-shadow: 0 0 0 3px color-mix(in srgb, var(--coral) 18%, transparent); }

/* Shared "Set type…" media-type dropdown -- used by BOTH the gallery select-mode
   bulk bar and the review toolbar so the two stay visually identical. Same pill
   look as .sort-select, sized to sit inline with the small pill buttons (btn-sm)
   in those bars. */
.type-select { font-family: inherit; font-size: 12.5px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px; cursor: pointer; outline: none; flex: 0 0 auto; }
.type-select:hover { border-color: var(--coral); }
.type-select:focus { border-color: var(--coral); box-shadow: 0 0 0 3px color-mix(in srgb, var(--coral) 18%, transparent); }
.tag-chip {
  font-family: inherit; font-size: 12.5px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.tag-chip:hover { border-color: var(--coral); }
.tag-chip .count { color: var(--muted); font-size: 11px; }

.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px; padding: 16px 26px 60px;
}
.photo-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.16s ease, border-color 0.16s;
}
/* Hover feedback WITHOUT moving the card's box. A translateY on hover physically
   shifts the card toward the cursor between mousedown and mouseup, so a click (or
   a select-mode toggle) can miss its own target. Instead: a stationary
   border+shadow cue, with the "alive" feel coming from a subtle inner IMAGE zoom
   (which never shifts the outer click target). Started as the review-card hover;
   promoted here so the whole gallery selects/clicks smoothly. */
.photo-card:hover { transform: none; border-color: var(--coral); box-shadow: 0 6px 18px rgba(0,0,0,0.3); }
/* object-position defaults to top so a portrait's head (near the top) is kept
   rather than sliced by an equal top/bottom crop. photoCard() overrides the
   vertical % per image from focus_y (the detected face center) when available.
   overflow:hidden on .photo-card clips the zoom so it never spills the frame. */
.photo-card img { width: 100%; display: block; aspect-ratio: 1/1; object-fit: cover;
  object-position: 50% 20%; background: var(--surface-2); transition: transform 0.16s ease; }
.photo-card:hover img { transform: scale(1.05); }

/* Contain cards (wide/tall utility media: screenshots, match cards, posters).
   The image is shown WHOLE (object-fit:contain) so nothing is sliced, and the
   letterbox gutters are filled by a blurred, over-scaled copy of the same thumb
   (--card-bg, set inline in photoCard). Keeps the grid square + uniform while a
   9:16 poster or 16:9 screenshot reads correctly instead of being center-cropped.
   The ::before backdrop sits behind the image (z-index) and doesn't zoom on hover,
   so only the crisp foreground image gets the subtle hover scale. */
.photo-card.contain-card { position: relative; }
/* Backdrop is confined to the SQUARE IMAGE AREA only (top: 0, aspect-ratio 1/1),
   NOT the whole card -- otherwise it bleeds over the .card-people row and the
   badges below the image. overflow:hidden on it clips the over-scaled blur. */
.photo-card.contain-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; z-index: 0;
  aspect-ratio: 1/1; overflow: hidden;
  background-image: var(--card-bg); background-size: cover; background-position: center;
  filter: blur(18px) brightness(0.85); transform: scale(1.15); /* scale hides blur edge bleed */
}
.photo-card.contain-card img { position: relative; z-index: 1;
  object-fit: contain; object-position: center; background: transparent; }
/* Badges (gif/art/seq/likely) and the people row must sit ABOVE the backdrop. */
.photo-card.contain-card .media-badge { z-index: 2; }
.photo-card.contain-card .card-people { position: relative; z-index: 2; }
/* Interactive overlays (select check + enlarge button) must sit above the
   contain-card's z-index:1 image, or the image intercepts their clicks. */
.photo-card.contain-card .review-check,
.photo-card.contain-card .review-view { z-index: 3; }
.card-people { padding: 8px 10px 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.card-tags { padding: 6px 10px 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.people-chip { background: var(--surface-2); border: 1px solid color-mix(in srgb, var(--coral) 45%, transparent); color: var(--coral);
  font-size: 10.5px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
/* "+N more people" counter chip: muted so it reads as a count, not a name. */
.people-chip.people-more { border-color: var(--border); color: var(--muted); cursor: default; }
/* Pending (guest) person, tagged on prod but not yet admin-confirmed: greyed +
   dashed so it reads as provisional, and a trailing "· pending" note. */
.people-chip.pending { border-style: dashed; border-color: var(--border);
  color: var(--muted); opacity: 0.75; }
.people-chip.pending::after { content: ' · pending'; font-weight: 500; opacity: 0.8; }
.mini-tag { background: var(--surface-2); color: var(--muted); font-size: 10.5px; padding: 2px 8px; border-radius: 999px; }

/* people-chip-wrap: the photo-modal chip + its admin-only "pin as profile
   pic" button, grouped so they sit flush together as one flex item. */
.people-chip-wrap { display: inline-flex; align-items: center; gap: 2px; }
.chip-pin-btn { background: none; border: none; cursor: pointer; font-size: 11px;
  line-height: 1; padding: 2px; opacity: 0.55; border-radius: 999px; }
.chip-pin-btn:hover { opacity: 1; background: var(--surface-2); }
.chip-pin-btn:disabled { opacity: 0.3; cursor: default; }

.media-badge { position: absolute; top: 9px; left: 9px; font-size: 10px; font-weight: 700;
  letter-spacing: 0.5px; padding: 3px 8px; border-radius: 999px; pointer-events: none; }
.media-badge.gif    { background: var(--butter); color: var(--ink); }
.media-badge.art    { background: var(--lavender); color: var(--ink); }
.media-badge.seq { left: auto; right: 9px; background: rgba(23,18,42,0.82); color: var(--text);
  border: 1px solid var(--border); }

/* ---------- empty ---------- */
.empty-state { text-align: center; padding: 12vh 20px; color: var(--muted); }
.empty-star { width: 70px; height: 70px; color: var(--surface-2); margin-bottom: 12px; }
.empty-title { font-family: 'Fredoka', sans-serif; font-size: 22px; color: var(--text); margin: 0 0 6px; }
.empty-sub { font-size: 14px; margin: 0; }
