.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.category-card {
  appearance: none;
  text-align: left;
  cursor: pointer;
  border: 1px solid #d3d1b7;
  background: #ffffff;
  color: var(--text);
  border-radius: 18px;
  padding: 18px;
  display: grid;
  gap: 7px;
}
.category-card span { color: var(--muted); font-size: 12px; }
.event-browser-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.event-browser-card { padding: 0; overflow: hidden; }
.event-browser-card > img { width: 100%; height: 190px; object-fit: contain; background: #ffffff; }
.event-browser-body { padding: 20px 22px 22px; }
.event-browser-card .event-action-grid { margin-top: 16px; }
.event-browser-card .event-action-grid .btn { border-radius: 4px; }
.event-browser-card .badge { width: auto; }
.gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.person-card { padding: 12px; overflow: hidden; cursor: pointer; }
.person-card > img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #eeecd0; border-radius: 12px; display: block; }
.person-card .info { padding: 14px 4px 4px; }
.person-card h3 { margin: 8px 0 5px; }
.stars { color: var(--warn); letter-spacing: 0.05em; }
/* Image lightbox intentionally stays dark so photos remain the focus. */
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border: 0; background: rgba(1, 6, 11, 0.96); color: white; padding: 28px; }
.lightbox::backdrop { background: #000; }
.lightbox figure { height: 100%; margin: 0; display: grid; place-items: center; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; }
.lightbox img { max-height: calc(100vh - 120px); max-width: calc(100vw - 120px); object-fit: contain; border-radius: 12px; }
.lightbox figcaption { max-width: 900px; color: #d8d8d8; text-align: center; }
.lightbox-close,
.lightbox-nav { position: fixed; border: 1px solid #8a8a8a; background: #555; color: #fff; border-radius: 999px; cursor: pointer; z-index: 3; }
.lightbox-close { right: 20px; top: 20px; width: 46px; height: 46px; font-size: 28px; }
.lightbox-nav { top: 50%; transform: translateY(-50%); width: 54px; height: 54px; font-size: 34px; }
.lightbox-nav.prev { left: 18px; }
.lightbox-nav.next { right: 18px; }
#galleryEvents, #organizerRoster { margin-top: 24px; }
#attendeeSection { margin: 24px 0; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1000px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: 1fr; }
  .lightbox { padding: 12px; }
  .lightbox img { max-width: 100%; max-height: calc(100vh - 150px); }
  .lightbox-nav { top: auto; bottom: 24px; }
  .lightbox-nav.prev { left: 20px; }
  .lightbox-nav.next { right: 20px; }
}

.gallery-view-tabs { display:flex; gap:10px; margin:18px 0; flex-wrap:wrap; }
.gallery-view-tab { min-width:140px; border-radius:4px; }
.gallery-area { margin:24px 0; }
.public-memory-card .info { border-top:3px solid #d9cf73; }
.event-browser-media img { width:100%; height:190px; object-fit:cover; display:block; }

/* Public audio memories and Shared Text */
.public-memory-audio{aspect-ratio:1/1;background:rgba(243,242,215,.45);display:grid;align-content:center;gap:14px;padding:18px}
.public-memory-audio audio{width:100%}
.audio-memory-card{cursor:default}
.public-share-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:18px}
.public-shared-card{min-width:0;padding:16px}
.public-shared-card h3{margin:8px 0 4px}
.public-shared-text{border:1px solid #d8d6bf;border-radius:12px;padding:12px;background:rgba(243,242,215,.28);margin:12px 0;min-width:0}
.public-shared-text p{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;line-height:1.35;margin:0 0 10px}
.public-shared-links,.public-shared-files{display:grid;gap:8px;margin:12px 0;min-width:0}
.public-shared-link{display:flex;align-items:center;gap:8px;justify-content:space-between;min-width:0;border:1px solid #d8d6bf;border-radius:12px;padding:9px 10px}
.public-shared-link a{min-width:0;overflow-wrap:anywhere;word-break:break-word}
.public-shared-file{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;border:1px solid #d8d6bf;border-radius:12px;padding:10px 12px;background:#fff;text-decoration:none;color:inherit}
.public-shared-file>div{min-width:0;display:grid;gap:3px}
.public-shared-file strong{overflow-wrap:anywhere;word-break:break-word}
.public-shared-file.audio{display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,1.2fr) auto}
.public-shared-file.audio audio{width:100%;max-width:100%}
@media(max-width:800px){.public-share-grid{grid-template-columns:1fr}.public-shared-file.audio{grid-template-columns:1fr}}

/* Shared Audio/Video lives apart from public photo memories. */
.public-clips-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-top:18px}
.public-clip-card{padding:0;overflow:hidden;min-width:0}
.public-clip-card .info{padding:14px 16px 16px}
.public-clip-card h3{font-size:16px;line-height:1.15;margin:8px 0 5px;overflow-wrap:anywhere}
.public-clip-media{background:rgba(243,242,215,.42);padding:14px;min-height:108px;display:grid;place-items:center}
.public-clip-media.audio audio{width:100%}
.public-clip-media.video{padding:0;background:#111;aspect-ratio:16/9}
.public-clip-media.video video{display:block;width:100%;height:100%;aspect-ratio:16/9;object-fit:contain;background:#111}
@media(max-width:1000px){.public-clips-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){.public-clips-grid{grid-template-columns:1fr}.gallery-view-tab{min-width:128px}}

/* v5.18.0: richer Browse Events cards. */
.event-browser-badges{gap:7px;align-items:center;flex-wrap:wrap}
.event-browser-owner{margin:7px 0 12px;overflow-wrap:anywhere}
.event-browser-details{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0}
.event-browser-details>div{padding:9px 10px;border:1px solid #e2dfc5;border-radius:12px;background:rgba(243,242,215,.32);min-width:0}
.event-browser-details span{display:block;color:var(--muted);font-size:9px;font-weight:900;letter-spacing:.08em;text-transform:uppercase;margin-bottom:3px}
.event-browser-details strong{display:block;font-size:12px;line-height:1.3;overflow-wrap:anywhere}
.event-browser-details small{display:block;color:var(--muted);font-size:10px;line-height:1.25;margin-top:2px;overflow-wrap:anywhere}
.event-browser-description{font-size:12px;line-height:1.45;color:var(--text);margin:12px 0;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4;overflow:hidden}
.event-browser-tags{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 2px}
.event-browser-tags span{font-size:10px;font-weight:800;padding:5px 8px;border-radius:999px;background:rgba(243,242,215,.68);border:1px solid #d8d6bf;color:var(--text)}
@media(max-width:520px){.event-browser-details{grid-template-columns:1fr 1fr}}

/* v5.43.0: compact text-only labels on Gallery -> Attendees cards only.
   These are status labels, not clickable controls. */
#galleryGrid .person-card .info > .row:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin: 0 0 4px;
  font-size: 9px;
  line-height: 1.25;
  letter-spacing: .045em;
  text-transform: uppercase;
}

#galleryGrid .person-card .info > .row:first-child .badge {
  display: inline;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font: inherit;
  font-weight: 800;
  letter-spacing: inherit;
  text-transform: uppercase;
  white-space: nowrap;
}

#galleryGrid .person-card .info > .row:first-child .badge:not(:last-child)::after {
  content: " | ";
  display: inline;
  margin: 0 .3em;
  color: var(--muted);
  font-weight: 600;
}

/* v5.44.0: Public Events metadata is informational text, not buttons/badges.
   Display category, country and attendance counts as a compact pipe-separated row. */
#galleryEvents .event-browser-card .event-browser-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin: 10px 0 4px;
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: .035em;
  text-transform: uppercase;
}

#galleryEvents .event-browser-card .event-browser-badges .badge {
  display: inline;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  letter-spacing: inherit;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: default;
}

#galleryEvents .event-browser-card .event-browser-badges .badge:not(:last-child)::after {
  content: " | ";
  display: inline;
  margin: 0 .42em;
  color: var(--muted);
  font-weight: 600;
}

/* v5.45.0: Public Event action buttons are compact controls and stay on one row. */
#galleryEvents .event-browser-card .event-action-grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

#galleryEvents .event-browser-card .event-action-grid .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 6px 9px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
}

@media (max-width: 360px) {
  #galleryEvents .event-browser-card .event-action-grid {
    gap: 4px;
  }

  #galleryEvents .event-browser-card .event-action-grid .btn {
    padding: 5px 7px;
    font-size: 9px;
  }
}

/* v5.46.0: compact, professional Gallery browsing/filter controls.
   Remove oversized empty space while preserving all filter functionality. */
#categoryBrowser,
#galleryFilters {
  padding: 14px 16px;
  border-radius: 14px;
}

#categoryBrowser > .spread,
#galleryFilters > .spread {
  align-items: center;
  margin-bottom: 9px;
}

#categoryBrowser h2,
#galleryFilters h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

#categoryBrowser .category-grid {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

#categoryBrowser .category-card {
  min-height: 58px;
  padding: 9px 12px;
  border-radius: 12px;
  gap: 3px;
  align-content: center;
}

#categoryBrowser .category-card strong {
  font-size: 13px;
  line-height: 1.2;
}

#categoryBrowser .category-card span {
  font-size: 10px;
  line-height: 1.2;
}

#galleryFilters #count {
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 9px;
  line-height: 1.1;
  white-space: nowrap;
}

#galleryFilters #filterForm.gallery-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 8px 10px;
  align-items: end;
}

#galleryFilters #filterForm .label {
  display: grid;
  gap: 4px;
  margin: 0;
  min-width: 0;
  font-size: 10px;
  line-height: 1.15;
  font-weight: 700;
}

#galleryFilters #filterForm .input,
#galleryFilters #filterForm .select {
  width: 100%;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  padding: 5px 9px;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.2;
}

#galleryFilters #filterForm .gallery-filter-actions {
  grid-column: 1 / -1 !important;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin: 0;
}

#galleryFilters #filterForm .gallery-filter-actions .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.1;
}

#attendeeSection {
  margin-top: 16px;
}

#attendeeSection > .spread h2 {
  margin-bottom: 0;
}

@media (max-width: 1000px) {
  #galleryFilters #filterForm.gallery-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 680px) {
  #categoryBrowser,
  #galleryFilters {
    padding: 12px;
  }

  #categoryBrowser .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #galleryFilters #filterForm.gallery-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }
}

@media (max-width: 420px) {
  #galleryFilters #filterForm.gallery-filter-grid {
    grid-template-columns: 1fr !important;
  }
}

/* v5.48.0: cleaner, professional Gallery -> Attendees information cards. */
#galleryGrid .attendee-card {
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
}

#galleryGrid .attendee-card > img {
  display: block;
  border-radius: 10px;
  width: auto;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f3f2df;
}

#galleryGrid .attendee-card-info {
  padding: 12px 13px 14px;
}

#galleryGrid .attendee-card-labels {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 7px;
  font-size: 9px;
  line-height: 1.25;
  letter-spacing: .04em;
  text-transform: uppercase;
}

#galleryGrid .attendee-card-labels .badge {
  display: inline;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  letter-spacing: inherit;
  white-space: nowrap;
}

#galleryGrid .attendee-card-labels .badge:not(:last-child)::after {
  content: " | ";
  margin: 0 .38em;
  color: var(--muted);
  font-weight: 500;
}

#galleryGrid .attendee-card-labels .attendee-event-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
}

#galleryGrid .attendee-name {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 800;
  overflow-wrap: anywhere;
}

#galleryGrid .attendee-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 7px 10px;
  margin: 0;
}

#galleryGrid .attendee-detail {
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid rgba(125, 121, 93, .20);
}

#galleryGrid .attendee-detail-wide {
  grid-column: 1 / -1;
}

#galleryGrid .attendee-detail dt {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}

#galleryGrid .attendee-detail dd {
  margin: 0;
  color: var(--text);
  font-size: 10px;
  line-height: 1.35;
  font-weight: 650;
  overflow-wrap: anywhere;
}

#galleryGrid .attendee-detail-wide dd {
  font-size: 10.5px;
}

#galleryGrid .attendee-rating {
  margin-top: 9px;
  font-size: 12px;
}

#galleryGrid .attendee-bio,
#galleryGrid .attendee-comment {
  margin: 9px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(125, 121, 93, .16);
  line-height: 1.4;
}

@media (max-width: 520px) {
  #galleryGrid .attendee-details {
    grid-template-columns: 1fr;
  }
  #galleryGrid .attendee-detail-wide {
    grid-column: auto;
  }
}


/* v5.50.0: professional compact Public Event cards.
   Event facts are informational text, not a second grid of large mini-cards. */
#galleryEvents .event-browser-body {
  padding: 12px 14px 14px;
}

#galleryEvents .event-browser-card .event-browser-badges {
  margin: 0 0 5px;
  font-size: 9px;
  line-height: 1.25;
}

#galleryEvents .event-browser-card h3 {
  margin: 3px 0 5px;
  font-size: 15px;
  line-height: 1.16;
  letter-spacing: -.012em;
  overflow-wrap: anywhere;
}

#galleryEvents .event-browser-owner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

#galleryEvents .event-browser-owner .code {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: 2px 6px;
  border: 1px solid #d8d6bf;
  border-radius: 999px;
  background: rgba(243,242,215,.55);
  color: var(--text);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .025em;
}

#galleryEvents .event-browser-owner-name::before {
  content: "·";
  margin-right: 5px;
  color: #aaa78f;
}

#galleryEvents .event-browser-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 0;
  margin: 0;
  padding: 7px 0 0;
  border-top: 1px solid #e2dfc5;
  color: var(--text);
  font-size: 10px;
  line-height: 1.3;
}

#galleryEvents .event-browser-fact {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

#galleryEvents .event-browser-fact:not(:last-child)::after {
  content: "•";
  margin: 0 7px;
  color: #aaa78f;
  font-size: 8px;
}

#galleryEvents .event-browser-fact-label {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

#galleryEvents .event-browser-fact strong {
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

#galleryEvents .event-browser-fact-muted {
  color: var(--muted);
  font-size: 9px;
}

#galleryEvents .event-browser-description {
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.35;
  -webkit-line-clamp: 2;
}

#galleryEvents .event-browser-tags {
  margin: 7px 0 0;
}

#galleryEvents .event-browser-card .event-action-grid {
  margin-top: 9px;
}

@media (max-width: 520px) {
  #galleryEvents .event-browser-body { padding: 11px 12px 13px; }
  #galleryEvents .event-browser-card h3 { font-size: 14px; }
  #galleryEvents .event-browser-fact:not(:last-child)::after { margin: 0 5px; }
}

/* v5.112.0 Gallery scale/performance containment */
.gallery-area,
#galleryEvents,
#categoryBrowser {
  scroll-margin-top: 96px;
}

.gallery-render-card,
.organizer-event-photo-group {
  content-visibility: auto;
  contain-intrinsic-size: 320px;
}

.gallery-render-card {
  contain: layout paint style;
}

.gallery-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 14px 0 6px;
  clear: both;
}

.gallery-load-more-wrap.hidden {
  display: none !important;
}

.gallery-load-more-wrap .btn {
  min-width: 150px;
}

.public-clip-media video,
.public-clip-media audio,
.public-shared-file audio {
  max-width: 100%;
}


/* v5.114.0: Gallery page isolation.
   Each Gallery menu destination is now a real page and loads only its own feed. */
.gallery-route-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 18px;
}
.gallery-route-tab {
  width: auto;
  min-width: 0;
  min-height: 31px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
  text-decoration: none;
}
.gallery-route-tab.is-current { font-weight: 850; }
.gallery-page-intro { max-width: 900px; margin-top: -4px; }
#categoryBrowser .category-card { text-decoration: none; }
.gallery-events-filter { padding: 12px 14px; margin-bottom: 16px; }
.gallery-events-filter form { align-items: end; gap: 8px; }
.gallery-events-filter .label { min-width: min(280px, 100%); margin: 0; }
.gallery-events-filter .select { min-height: 34px; }
.gallery-filter-router { padding: 14px 16px; }
.gallery-filter-router .gallery-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
  align-items: end;
}
.gallery-filter-router .label { margin: 0; min-width: 0; }
.gallery-filter-router .gallery-filter-actions { grid-column: 1/-1; }
.gallery-load-more-wrap { display:flex; justify-content:center; padding:14px 0 4px; }
@media (max-width: 900px) {
  .gallery-filter-router .gallery-filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 520px) {
  .gallery-route-tabs { gap: 5px; margin: 10px 0 14px; }
  .gallery-route-tab { padding: 5px 8px; font-size: 9px; }
  .gallery-filter-router .gallery-filter-grid { grid-template-columns: 1fr; }
  .gallery-events-filter form { align-items: stretch; }
}

/* v5.115.0: Public photo cards only — compact natural-height cards and two-line engagement.
   No rating/comment/reaction behavior is changed; this is presentation-only. */
#publicGalleryGrid {
  align-items: start;
}

#publicGalleryGrid .public-memory-card {
  align-self: start;
  height: auto;
  min-height: 0;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
}

#publicGalleryGrid .public-memory-card > img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0;
  display: block;
}

#publicGalleryGrid .public-memory-card .info {
  padding: 8px 10px 9px;
}

#publicGalleryGrid .public-memory-card .info > .row:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 4px;
}

#publicGalleryGrid .public-memory-card .info > .row:first-child .badge {
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 8.5px;
  line-height: 1.1;
  white-space: nowrap;
}

#publicGalleryGrid .public-memory-card h3 {
  margin: 4px 0 2px;
  font-size: 14px;
  line-height: 1.15;
}

#publicGalleryGrid .public-memory-card .small {
  font-size: 10px;
  line-height: 1.18;
}

#publicGalleryGrid .public-memory-card .info > p.small.muted {
  margin: 3px 0 0;
}

#publicGalleryGrid .public-owner-actions {
  gap: 5px;
  margin: 5px 0 0;
}

#publicGalleryGrid .public-owner-actions .btn {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 10px;
}

/* Line 1 = score/rating count/comments. Line 2 = stars + emoji reactions. */
#publicGalleryGrid .media-engagement {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "summary summary"
    "stars reactions"
    "restriction restriction";
  align-items: center;
  gap: 5px 6px;
  margin: 6px 0 0;
  padding: 6px 0 0;
  border-top: 1px solid rgba(125, 121, 93, .22);
}

#publicGalleryGrid .media-engagement-summary {
  grid-area: summary;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
  margin: 0;
  font-size: 9px;
  line-height: 1.1;
}

#publicGalleryGrid .media-engagement-average,
#publicGalleryGrid .media-engagement-rating-count {
  white-space: nowrap;
}

#publicGalleryGrid .media-comments-link {
  margin-left: auto;
  min-width: 0;
  min-height: 0;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 9px;
  line-height: 1.05;
  white-space: nowrap;
}

#publicGalleryGrid .media-engagement-actions {
  grid-area: stars;
  width: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin: 0;
}

#publicGalleryGrid .media-star-button {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
}

#publicGalleryGrid .media-reaction-row {
  grid-area: reactions;
  width: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
  margin: 0;
}

#publicGalleryGrid .media-reaction-button {
  min-width: 0;
  min-height: 22px;
  margin: 0;
  padding: 2px 5px;
  gap: 2px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

#publicGalleryGrid .media-reaction-count {
  font-size: 8px;
  line-height: 1;
}

#publicGalleryGrid .media-engagement-restriction {
  grid-area: restriction;
  margin: 0;
  padding: 0;
  font-size: 8.5px;
  line-height: 1.15;
  text-align: center;
}

/* Very narrow phones need one card per row so all touch controls remain usable. */
@media (max-width: 520px) {
  #publicGalleryGrid.gallery-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  #publicGalleryGrid .public-memory-card > img {
    aspect-ratio: 16 / 10;
  }
}

/* v5.116.0: shared Gallery shell controls and compact Audio/Video cards. */
.gallery-secondary-menu-toggle-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: 6px 0 2px;
}
.gallery-secondary-menu-toggle {
  width: auto;
  min-width: 92px;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 4px;
  font-size: 9px;
  line-height: 1.1;
  white-space: nowrap;
}
body.gallery-secondary-menus-hidden .nav-utility-row,
body.gallery-secondary-menus-hidden .gallery-route-tabs {
  display: none !important;
}
body.gallery-secondary-menus-hidden .gallery-secondary-menu-toggle-row {
  margin-bottom: 8px;
}

/* Shared Audio/Video uses compact natural-height cards, mirroring Public Photos. */
#sharedClipsGrid.public-clips-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
#sharedClipsGrid .public-clip-card {
  align-self: start;
  height: auto;
  min-height: 0;
  border-radius: 14px;
}
#sharedClipsGrid .public-clip-media.video {
  width: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
  background: #111;
}
#sharedClipsGrid .public-clip-media.video video {
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #111;
}
#sharedClipsGrid .public-clip-media.audio {
  min-height: 0;
  padding: 8px 10px;
  background: rgba(243,242,215,.34);
}
#sharedClipsGrid .public-clip-media.audio audio {
  width: 100%;
  min-height: 32px;
}
#sharedClipsGrid .public-clip-card .info {
  padding: 8px 10px 9px;
}
#sharedClipsGrid .public-clip-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 4px;
}
#sharedClipsGrid .public-clip-labels .badge {
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 8px;
  line-height: 1.05;
  white-space: nowrap;
}
#sharedClipsGrid .public-clip-card h3 {
  margin: 4px 0 2px;
  font-size: 13px;
  line-height: 1.14;
}
#sharedClipsGrid .public-clip-card .small {
  font-size: 9px;
  line-height: 1.16;
}
#sharedClipsGrid .public-clip-byline,
#sharedClipsGrid .public-clip-event {
  margin-top: 2px;
}
#sharedClipsGrid .public-owner-actions {
  gap: 4px;
  margin: 5px 0 0;
}
#sharedClipsGrid .public-owner-actions .btn {
  min-height: 26px;
  padding: 4px 7px;
  font-size: 9px;
}

/* Two neat engagement lines on Audio/Video cards. */
#sharedClipsGrid .media-engagement {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "summary summary"
    "stars reactions"
    "restriction restriction";
  align-items: center;
  gap: 4px 5px;
  margin: 6px 0 0;
  padding: 6px 0 0;
  border-top: 1px solid rgba(125,121,93,.22);
}
#sharedClipsGrid .media-engagement-summary {
  grid-area: summary;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
  margin: 0;
  font-size: 8.5px;
  line-height: 1.05;
}
#sharedClipsGrid .media-comments-link {
  margin-left: auto;
  min-width: 0;
  min-height: 0;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 8.5px;
  line-height: 1.05;
  white-space: nowrap;
}
#sharedClipsGrid .media-engagement-actions {
  grid-area: stars;
  width: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  min-width: 0;
}
#sharedClipsGrid .media-star-button {
  width: 21px;
  height: 21px;
  min-width: 21px;
  min-height: 21px;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  line-height: 1;
}
#sharedClipsGrid .media-reaction-row {
  grid-area: reactions;
  width: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin: 0;
  min-width: 0;
}
#sharedClipsGrid .media-reaction-button {
  min-width: 0;
  min-height: 21px;
  margin: 0;
  padding: 2px 5px;
  gap: 2px;
  font-size: 9px;
  line-height: 1;
}
#sharedClipsGrid .media-reaction-count {
  font-size: 8px;
  line-height: 1;
}
#sharedClipsGrid .media-engagement-restriction {
  grid-area: restriction;
  margin: 0;
  padding: 0;
  font-size: 8px;
  line-height: 1.1;
  text-align: center;
}

@media (max-width: 1180px) {
  #sharedClipsGrid.public-clips-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  #sharedClipsGrid.public-clips-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  #sharedClipsGrid.public-clips-grid { grid-template-columns: 1fr; gap: 10px; }
  .gallery-secondary-menu-toggle-row { justify-content: flex-start; }
}


/* V5.120.0 — three-region desktop Gallery shell.
   Left/right advert rails remain fixed. Only the centre Gallery column scrolls.
   This isolates wheel/touch work from sponsored surfaces and prevents the whole
   document from repainting while users browse media. */
@media (min-width: 1480px) {
  html[data-gallery-page],
  html[data-gallery-page] body {
    width: 100%;
    height: 100%;
    min-height: 100%;
  }

  html[data-gallery-page] body {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  html[data-gallery-page] .site-header,
  html[data-gallery-page] header.site-header {
    flex: 0 0 auto;
  }

  html[data-gallery-page] main.page {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto;
    contain: layout style;
  }

  /* 170px advert rail + breathing room on each side. */
  html[data-gallery-page] main.page > .container {
    width: min(1120px, calc(100vw - 390px));
    max-width: none;
    margin-inline: auto;
    box-sizing: border-box;
  }

  /* Keep the centre scroll surface independent from the fixed rails. */
  html[data-gallery-page] .gallery-grid,
  html[data-gallery-page] .organizer-event-photo-grid {
    isolation: isolate;
  }
}

@media (min-width: 1800px) {
  html[data-gallery-page] main.page > .container {
    width: min(1240px, calc(100vw - 500px));
  }
}

/* Decoding/rasterisation should never promote every photo to a permanent GPU
   layer. Browser defaults are sharper and cheaper for gallery card images. */
html[data-gallery-page] .gallery-render-card > img,
html[data-gallery-page] .organizer-event-photo-card > img,
html[data-gallery-page] .public-memory-card > img {
  image-rendering: auto;
  transform: none;
  will-change: auto;
}


/* V5.121.0 — Gallery header/menu and paging refinements. */
.gallery-header-menu-toggle-row {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1px 0 4px;
  line-height: 1;
}
.gallery-header-menu-toggle {
  min-width: 88px;
  min-height: 24px;
  padding: 4px 10px;
  font-size: 9px;
  line-height: 1.05;
}
body.gallery-header-menu-hidden .global-stats-bar,
body.gallery-header-menu-hidden .nav-utility-row {
  display: none !important;
}
.gallery-events-pager {
  align-items: center;
  gap: 10px;
}
.gallery-events-pager .btn {
  min-width: 94px;
}
.gallery-page-indicator {
  min-width: 72px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
@media (max-width: 600px) {
  .gallery-header-menu-toggle-row { justify-content: center; padding-bottom: 3px; }
  .gallery-header-menu-toggle { min-width: 80px; padding: 4px 8px; font-size: 8.5px; }
  .gallery-events-pager { gap: 6px; }
  .gallery-events-pager .btn { min-width: 78px; padding-inline: 8px; }
}

/* V5.128.0 - Gallery attendee image frames.
   Do not force images to fill card width. Preserve natural width up to the card
   boundary and keep the requested 10px rounded frame. */
html[data-gallery-view="attendees"] #galleryGrid .attendee-card > img {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 !important;
  aspect-ratio: 4 / 3 !important;
  object-fit: cover !important;
  object-position: center center !important;
  border-radius: 10px !important;
  box-sizing: border-box !important;
}


/* V5.134.0 — Restore compact Gallery attendee/public cards.
   Give media a real inset from the card wall and make Attendees use the same
   one-card mobile behavior already used by Public Photos. */
html[data-gallery-view="attendees"] #galleryGrid .attendee-card,
html[data-gallery-view="public"] #publicGalleryGrid .public-memory-card {
  padding: 6px !important;
  box-sizing: border-box !important;
}

html[data-gallery-view="attendees"] #galleryGrid .attendee-card > img,
html[data-gallery-view="public"] #publicGalleryGrid .public-memory-card > img {
  display: block !important;
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  border-radius: 10px !important;
  box-sizing: border-box !important;
}

/* Keep the existing natural-width attendee image fix. Public photo cards may
   still fill the padded content box, but no image touches the card border. */
html[data-gallery-view="attendees"] #galleryGrid .attendee-card > img {
  width: auto !important;
}

html[data-gallery-view="public"] #publicGalleryGrid .public-memory-card > img {
  width: 100% !important;
}

/* Compact attendee information without losing any fields. */
html[data-gallery-view="attendees"] #galleryGrid .attendee-card-info {
  padding: 8px 4px 4px !important;
}
html[data-gallery-view="attendees"] #galleryGrid .attendee-card-labels {
  margin-bottom: 5px !important;
}
html[data-gallery-view="attendees"] #galleryGrid .attendee-name {
  margin: 0 0 6px !important;
  font-size: 14px !important;
  line-height: 1.15 !important;
}
html[data-gallery-view="attendees"] #galleryGrid .attendee-details {
  gap: 5px 8px !important;
}
html[data-gallery-view="attendees"] #galleryGrid .attendee-detail {
  padding-top: 5px !important;
}
html[data-gallery-view="attendees"] #galleryGrid .attendee-detail dt {
  margin-bottom: 1px !important;
}
html[data-gallery-view="attendees"] #galleryGrid .attendee-detail dd {
  font-size: 9.5px !important;
  line-height: 1.28 !important;
}
html[data-gallery-view="attendees"] #galleryGrid .attendee-bio,
html[data-gallery-view="attendees"] #galleryGrid .attendee-comment {
  margin-top: 6px !important;
  padding-top: 6px !important;
  font-size: 10px !important;
  line-height: 1.32 !important;
}

/* Public cards get the same neat media inset while retaining their compact
   two-line engagement controls. */
html[data-gallery-view="public"] #publicGalleryGrid .public-memory-card .info {
  padding: 8px 4px 4px !important;
}

/* Public Photos already collapse to one column at phone width. Attendees must
   behave the same instead of leaving two long, narrow columns. Since the card
   is now full-width, keep a two-column facts grid to reduce vertical height. */
@media (max-width: 520px) {
  html[data-gallery-view="attendees"] #galleryGrid.gallery-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  html[data-gallery-view="attendees"] #galleryGrid .attendee-details {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) !important;
  }
  html[data-gallery-view="attendees"] #galleryGrid .attendee-detail-wide {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 360px) {
  html[data-gallery-view="attendees"] #galleryGrid .attendee-details {
    grid-template-columns: 1fr !important;
  }
  html[data-gallery-view="attendees"] #galleryGrid .attendee-detail-wide {
    grid-column: auto !important;
  }
}
