
:root {
  color-scheme: light;
  --gallery-bg: #f7f8f5;
  --gallery-panel: #ffffff;
  --gallery-ink: #17191b;
  --gallery-muted: #687076;
  --gallery-line: #dfe4dc;
  --gallery-accent: #72c900;
  --gallery-accent-soft: #eaffcf;
  --gallery-focus: #1463ff;
  --gallery-shadow: 0 10px 26px rgba(20, 24, 28, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--gallery-bg);
  color: var(--gallery-ink);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.galleryFiltersOpen {
  overflow: hidden;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }

.galleryApp {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  gap: 0;
}
.galleryFilters {
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow: auto;
  border-right: 1px solid var(--gallery-line);
  background: #fbfcf8;
}
.galleryBrand {
  display: grid;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gallery-line);
}
.galleryBrand strong {
  font-size: 20px;
  line-height: 1.12;
}
.galleryActiveFilters,
.filterBlockTitle span,
.filterButton small,
.lightboxMeta span {
  color: var(--gallery-muted);
  font-size: 12px;
}
.peopleSort span,
.galleryControl span,
.gallerySort span,
.imageTagFilters legend {
  color: var(--gallery-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.peopleSort select,
.peopleMobileSelect,
.galleryDayFilter,
.gallerySort select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--gallery-line);
  border-radius: 6px;
  background: var(--gallery-panel);
  color: var(--gallery-ink);
}
.peopleSort select,
.peopleMobileSelect,
.galleryDayFilter,
.gallerySort select {
  padding: 8px 28px 8px 10px;
}
.clearFilters,
.galleryPresetHome,
.galleryFilterToggle,
.galleryFilterClose {
  min-height: 40px;
  border: 1px solid var(--gallery-ink);
  border-radius: 6px;
  background: var(--gallery-panel);
  color: var(--gallery-ink);
  font-weight: 700;
}
.clearFilters:hover,
.galleryPresetHome:hover,
.galleryFilterToggle:hover,
.galleryFilterClose:hover,
.filterButton:hover,
.photoButton:hover,
.lightboxButton:hover,
.lightboxOriginal:hover {
  background: var(--gallery-accent-soft);
}
.filterBlock {
  display: grid;
  gap: 8px;
}
.filterBlockTitle {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.filterBlockTitle h2 {
  font-size: 15px;
}
.peopleSort {
  display: grid;
  gap: 4px;
}
.peopleMobileSelect {
  display: none;
}
.filterList {
  display: grid;
  gap: 6px;
}
.filterButton {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--gallery-line);
  border-radius: 6px;
  background: var(--gallery-panel);
  color: var(--gallery-ink);
  text-align: left;
}
.filterButtonPerson {
  min-height: 58px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
}
.filterButton img {
  width: 42px;
  height: 42px;
  display: block;
  object-fit: cover;
  border-radius: 6px;
  background: #ecefec;
}
.filterButton.isActive {
  border-color: var(--gallery-accent);
  background: var(--gallery-accent-soft);
  box-shadow: inset 3px 0 0 var(--gallery-accent);
}
.filterButtonLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filterButton small {
  justify-self: end;
}
.filterButton.isActive small {
  min-width: 24px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--gallery-accent);
  border-radius: 999px;
  color: var(--gallery-ink);
  font-weight: 800;
  line-height: 1;
}
.filterEmpty {
  padding: 12px;
  border: 1px dashed var(--gallery-line);
  border-radius: 6px;
  color: var(--gallery-muted);
  background: rgba(255, 255, 255, 0.55);
}

.galleryResults {
  min-width: 0;
  padding: 18px;
}
.galleryToolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  gap: 14px;
  margin: -18px -18px 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gallery-line);
  background: rgba(247, 248, 245, 0.94);
  backdrop-filter: blur(10px);
}
.galleryToolbarTop {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.galleryToolbarSummary {
  min-width: 0;
  display: grid;
  gap: 2px;
}
#galleryResultCount,
#galleryActiveFilters {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.galleryControl,
.gallerySort {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.galleryDayFilterControl {
  width: min(190px, 30vw);
}
.gallerySort {
  width: min(180px, 30vw);
}
.gallerySort select {
  min-width: 0;
}
.galleryFilterToggle {
  display: none;
}
.galleryPresetHome {
  padding: 8px 12px;
}
.imageTagFilters {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  margin: 0;
}
.imageTagFilters legend {
  float: left;
  margin-right: 4px;
  padding: 0;
}
.imageTagFilters label {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 0;
  border-radius: 2px;
  background: var(--gallery-panel);
  color: var(--gallery-ink);
  white-space: nowrap;
}
.imageTagFilters input {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin: 0;
  accent-color: var(--gallery-accent);
}
.imageTagFilters label:has(input:checked) {
  background: var(--gallery-accent-soft);
}
.gallerySizeFilters {
  flex: 0 0 auto;
}
.galleryTagFilters {
  justify-content: flex-end;
}
.galleryFilterModal {
  display: none;
}
.galleryFilterBackdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(16, 18, 20, 0.42);
}
.galleryFilterPanel {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  max-height: min(72vh, 520px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 8px;
  background: var(--gallery-panel);
  box-shadow: 0 20px 70px rgba(16, 18, 20, 0.34);
}
.galleryFilterModalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--gallery-line);
}
.galleryFilterModalHeader h2 {
  font-size: 16px;
}
.galleryFilterClose {
  min-height: 34px;
  padding: 6px 10px;
}
.galleryTagFiltersModal {
  align-content: flex-start;
  justify-content: flex-start;
  padding: 12px;
  overflow: auto;
}
.selectedPersonSummary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  padding: 9px 10px;
  border: 1px solid var(--gallery-line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}
.selectedPersonSummary strong {
  font-weight: 800;
}
.selectedPersonSummary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.selectedPersonSummary button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--gallery-ink);
  border-radius: 6px;
  background: var(--gallery-panel);
  color: var(--gallery-ink);
  font-weight: 700;
}
.selectedPersonSummary button:hover {
  background: var(--gallery-accent-soft);
}
.galleryPresetLanding {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
}
.galleryPresetGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}
.galleryPresetCard {
  min-width: 0;
}
.galleryPresetCard button {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
  display: grid;
  align-items: end;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--gallery-line);
  border-radius: 8px;
  background: #101214;
  color: #ffffff;
  text-align: left;
  box-shadow: var(--gallery-shadow);
}
.galleryPresetCard img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}
.galleryPresetCard button:hover img {
  transform: scale(1.025);
}
.galleryPresetCardBody {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 56px 16px 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
}
.galleryPresetCardBody strong {
  font-size: 24px;
  line-height: 1.08;
}
.galleryPresetCardBody small,
.galleryPresetCardBody em {
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-style: normal;
}
.galleryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 12px;
  align-items: start;
}
.galleryGrid.isLarge {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 344px), 1fr));
}
.photoTile {
  position: relative;
  min-width: 0;
  border: 1px solid var(--gallery-line);
  border-radius: 8px;
  background: var(--gallery-panel);
  overflow: hidden;
  box-shadow: var(--gallery-shadow);
}
.photoButton {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  padding: 0;
  border: 0;
  background: #ecefec;
  overflow: hidden;
}
.photoButton img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 160ms ease;
}
.photoButton:hover img {
  transform: scale(1.025);
}
.photoDownload {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 9px;
  border: 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--gallery-ink);
  box-shadow: 0 2px 10px rgba(16, 18, 20, 0.18);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
.photoDownload:hover {
  background: var(--gallery-accent-soft);
}
.photoChipOverlay {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: block;
  pointer-events: none;
}
.photoChips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.photoChip {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid var(--gallery-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--gallery-muted);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 1px 5px rgba(16, 18, 20, 0.12);
}
.photoChip.person {
  border-color: #bed6ff;
  background: rgba(237, 244, 255, 0.94);
  color: #184a90;
}
.photoChip.tag {
  border-color: #caeaa2;
  background: rgba(242, 255, 225, 0.94);
  color: #3f6b00;
}
.photoChip.more {
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(16, 18, 20, 0.72);
  color: #ffffff;
}
.galleryEmpty,
.galleryError {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--gallery-line);
  border-radius: 8px;
  color: var(--gallery-muted);
  background: rgba(255, 255, 255, 0.65);
  text-align: center;
}

.lightboxOverlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 18, 20, 0.78);
}
.lightboxPanel {
  width: min(1240px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
  overflow: hidden;
  border-radius: 8px;
  background: var(--gallery-panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}
.lightboxStage {
  min-width: 0;
  min-height: min(72vh, 720px);
  display: grid;
  place-items: center;
  background: #101214;
}
.lightboxStage img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 36px);
  width: auto;
  height: auto;
  object-fit: contain;
}
.lightboxSide {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-left: 1px solid var(--gallery-line);
}
.lightboxTop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--gallery-line);
}
.lightboxTop h2 {
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.25;
}
.lightboxClose {
  width: 38px;
  height: 38px;
  border: 1px solid var(--gallery-line);
  border-radius: 6px;
  background: var(--gallery-panel);
  color: var(--gallery-ink);
  font-size: 24px;
  line-height: 1;
}
.lightboxMeta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  overflow: auto;
}
.lightboxMeta h3 {
  margin: 0 0 6px;
  font-size: 13px;
}
.lightboxMeta p {
  overflow-wrap: anywhere;
}
.lightboxActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--gallery-line);
}
.lightboxButton,
.lightboxOriginal {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid var(--gallery-line);
  border-radius: 6px;
  background: var(--gallery-panel);
  color: var(--gallery-ink);
  text-decoration: none;
  font-weight: 700;
}
.lightboxOriginal {
  grid-column: 1 / -1;
}
.lightboxButton:disabled {
  cursor: default;
  opacity: 0.45;
  background: var(--gallery-panel);
}
.lightboxProgress {
  grid-column: 1 / -1;
  color: var(--gallery-muted);
  font-size: 12px;
  text-align: center;
}

:focus-visible {
  outline: 3px solid var(--gallery-focus);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .galleryApp {
    grid-template-columns: 1fr;
  }
  .galleryPresetLanding {
    gap: 10px;
  }
  .galleryPresetGrid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .galleryPresetCardBody strong {
    font-size: 22px;
  }
  .galleryFilters {
    height: auto;
    position: static;
    gap: 8px;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--gallery-line);
  }
  .galleryBrand {
    padding-bottom: 6px;
  }
  .galleryBrand strong {
    font-size: 18px;
  }
  #galleryClearFilters {
    display: none;
  }
  .filterBlock {
    gap: 6px;
  }
  .filterBlockTitle h2 {
    font-size: 14px;
  }
  .peopleMobileSelect {
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .peopleSort,
  #peopleFilters {
    display: none;
  }
  .peopleMobileSelect {
    display: block;
  }
  .filterList {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .galleryToolbar {
    position: static;
    gap: 8px;
    margin-bottom: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .galleryToolbarTop {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: 8px;
  }
  .galleryToolbarSummary {
    grid-column: 1 / -1;
  }
  .gallerySizeFilters,
  .galleryDayFilterControl,
  .gallerySort,
  .galleryFilterToggle {
    width: 100%;
  }
  .galleryDayFilter,
  .gallerySort select {
    min-height: 34px;
    padding-top: 5px;
    padding-bottom: 5px;
  }
  .gallerySizeFilters {
    gap: 4px;
  }
  .gallerySizeFilters legend {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .gallerySizeFilters label {
    flex: 1 1 0;
    justify-content: center;
  }
  .galleryToolbar > .galleryTagFilters {
    display: none;
  }
  .galleryFilterToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 10px;
  }
  .galleryFilterModal:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 18;
    display: block;
  }
  .galleryTagFiltersModal label {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }
  .selectedPersonSummary {
    margin-bottom: 8px;
  }
  .lightboxPanel {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 20px);
  }
  .lightboxOverlay {
    padding: 10px;
  }
  .lightboxStage {
    min-height: 260px;
  }
  .lightboxStage img {
    max-height: 56vh;
  }
  .lightboxSide {
    border-left: 0;
    border-top: 1px solid var(--gallery-line);
  }
}

@media (max-width: 520px) {
  .galleryResults {
    padding: 12px;
  }
  .galleryToolbar {
    margin: -12px -12px 8px;
    padding: 8px 12px;
  }
  .imageTagFilters label {
    flex: 1 1 auto;
    justify-content: center;
  }
  .selectedPersonSummary {
    align-items: stretch;
    flex-direction: column;
  }
  .selectedPersonSummary span {
    white-space: normal;
  }
  .galleryGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .galleryGrid.isLarge {
    grid-template-columns: 1fr;
  }
  .photoChipOverlay {
    left: 6px;
    right: 6px;
    bottom: 6px;
  }
}
