/* The public photo gallery. Shares the header/menu with the other public pages (site-nav.css). */
:root {
  --bg-dark: #0c0e1a;
  --purple-light: #a94dbf;
  --gold: #d9b54a;
  --gold-deep: #b98f2e;
  --ink: #f4f1fa;
  --ink-soft: rgba(244, 241, 250, 0.72);
  --ink-faint: rgba(244, 241, 250, 0.5);
  --border: rgba(255, 255, 255, 0.14);
  --tile: #171a2b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Montserrat", system-ui, -apple-system, sans-serif;
  background: radial-gradient(120% 60% at 50% 0%, #1a1740 0%, var(--bg-dark) 55%);
  color: var(--ink);
  line-height: 1.6;
}
body.noscroll { overflow: hidden; }
a { color: var(--gold); }
button { font: inherit; color: inherit; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
main.gallery { padding-top: 32px; padding-bottom: 56px; }

.kicker { color: var(--gold); font-weight: 800; font-size: 0.8em; letter-spacing: 0.12em; text-transform: uppercase; }
.gallery-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
h1 { margin: 4px 0 6px; font-weight: 800; font-size: clamp(1.8rem, 5vw, 2.5rem); line-height: 1.15; }
.lede { margin: 0 0 20px; color: var(--ink-soft); }

.slide-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: #251a05;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 12px 26px -12px rgba(217, 181, 74, 0.6);
}
.slide-btn[hidden] { display: none; }
.slide-btn svg { width: 16px; height: 16px; }
.slide-btn:focus-visible, .ico:focus-visible, .tile:focus-visible, .chip:focus-visible, .pg:focus-visible, .btn:focus-visible, .speed:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Day filter: a row of chips that scrolls sideways on a phone. */
.filters {
  display: flex;
  gap: 8px;
  margin: 0 -24px 6px;
  padding: 2px 24px 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filters[hidden] { display: none; }
.chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
  cursor: pointer;
}
.chip em { margin-left: 6px; font-style: normal; font-weight: 600; opacity: 0.7; }
.chip:hover { border-color: rgba(217, 181, 74, 0.6); }
.chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1a1200; }

.day-select { display: none; }
/* Every dropdown on the gallery shares one look: 42px tall, 8px corners, a chevron on the right. */
.day-select, .pager-compact {
  height: 42px;
  padding: 0 34px 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
  background: #0e0f18 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23b9b9c6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 12px center;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
}
.day-select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.day-select option { color: #111; }

.count { margin: 4px 2px 10px; min-height: 1.5em; color: var(--ink-faint); font-size: 0.85rem; }

/* The grid: every tile the same shape, whatever the photo. */
.grid { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 8px; }
.tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: none;
  border-radius: 10px;
  background: var(--tile);
  cursor: zoom-in;
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.tile img.loaded { opacity: 1; transform: none; }
@media (hover: hover) { .tile:hover img.loaded { transform: scale(1.05); } }
.tile .tag {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(12, 14, 26, 0.72);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}
/* While the list loads: quiet placeholders in the same shape. */
.tile.ghost { cursor: default; background: linear-gradient(100deg, var(--tile) 30%, #1f2338 50%, var(--tile) 70%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Pager: numbered on a wide screen, "Page 2 of 5" on a phone. */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 22px 0 6px; }
.pager[hidden] { display: none; }
.pager-top { justify-content: flex-end; margin: 0 0 10px; }
.pg {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.pg:hover:not(:disabled) { border-color: var(--gold); }
.pg:disabled { opacity: 0.35; cursor: default; }
.pg[aria-current="page"] { background: var(--gold); border-color: var(--gold); color: #1a1200; }
.gap { color: var(--ink-faint); padding: 0 2px; }
.pager-num { display: contents; }
.pager-compact {
  display: none;
  min-width: 10.5em;
  font-weight: 700;
  text-align: center;
  text-align-last: center;
}
.pager-compact option { color: #111; }
.pager-compact:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.pager-top .pager-num { display: none; }
.pager-top .pager-compact { display: inline-block; }

.state { padding: 56px 12px; text-align: center; color: var(--ink-soft); }
.state[hidden] { display: none; }
.state h2 { margin: 0 0 6px; color: var(--ink); font-size: 1.3rem; }
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: #251a05;
  font-weight: 800;
  cursor: pointer;
}
.note { margin: 30px 0 0; text-align: center; color: var(--ink-faint); font-size: 0.8rem; }

/* ---- Shared by the viewer and the slideshow ---- */
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(12, 14, 26, 0.55);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.ico:hover { background: rgba(12, 14, 26, 0.85); }
.ico svg { width: 22px; height: 22px; }
.ico[hidden] { display: none; }
.lb-actions { display: flex; gap: 8px; }

/* ---- Single-photo viewer ---- */
.lb, .show {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #05060c;
  color: #fff;
  touch-action: pan-y;
}
.lb[hidden], .show[hidden] { display: none; }
.lb-top, .show-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
}
.lb-info, .show-info { margin: 0; font-size: 0.85rem; font-weight: 600; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
.lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 64px 0 24px; }
#lbImg { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; transition: filter 0.3s ease, opacity 0.2s ease; user-select: none; -webkit-user-drag: none; }
#lbImg.low { filter: blur(6px); }
.spinner {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.spinner.on { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 64px;
  margin-top: -32px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: rgba(12, 14, 26, 0.5);
  color: #fff;
  cursor: pointer;
}
.arrow:hover { background: rgba(12, 14, 26, 0.85); }
.arrow svg { width: 26px; height: 26px; }
.arrow.prev { left: max(10px, env(safe-area-inset-left)); }
.arrow.next { right: max(10px, env(safe-area-inset-right)); }

/* ---- Slideshow ---- */
.show { background: #000; cursor: default; }
.show-bg { position: absolute; inset: -6%; background-size: cover; background-position: center; filter: blur(40px) brightness(0.42) saturate(1.2); transform: translateZ(0); }
.show-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.9s ease;
  user-select: none;
  -webkit-user-drag: none;
}
.show-img.on { opacity: 1; }
.show-progress { position: absolute; top: 0; left: 0; right: 0; z-index: 4; height: 3px; background: rgba(255, 255, 255, 0.12); }
.show-progress i { display: block; width: 0; height: 100%; background: var(--gold); }
.show-progress i.run { animation: progress linear forwards; }
.show.paused .show-progress i.run { animation-play-state: paused; }
@keyframes progress { to { width: 100%; } }
.show-bar {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(12, 14, 26, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
}
.show-bar .ico { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.show-bar .ico:hover { background: rgba(255, 255, 255, 0.14); }
.show-bar .ico.big { width: 52px; height: 52px; background: var(--gold); color: #1a1200; }
.show-bar .ico.big:hover { background: #e6c45a; }
.show-bar .ico.big svg { width: 24px; height: 24px; }
.i-play, .paused .i-pause { display: none; }
.paused .i-play { display: block; }
.speed { min-width: 46px; height: 36px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; background: transparent; color: #fff; font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.speed:hover { background: rgba(255, 255, 255, 0.14); }
.i-exit { display: none; }
.is-full .i-enter { display: none; }
.is-full .i-exit { display: block; }
/* Controls fade away while a slideshow plays, and the pointer with them; moving or touching brings them back. */
.show .show-top, .show .show-bar { transition: opacity 0.4s ease; }
.show.idle { cursor: none; }
.show.idle .show-top, .show.idle .show-bar { opacity: 0; pointer-events: none; }

/* ---- Phones ---- */
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  main.gallery { padding-top: 22px; }
  .filters { display: block; margin: 0 0 12px; padding: 0; overflow: visible; }
  .filters .chip { display: none; }
  .filters .day-select { display: block; width: 100%; }
  .grid { gap: 6px; }
  .tile { border-radius: 8px; }
  .tile .tag { display: none; }
  .pager-num { display: none; }
  .pager-compact { display: inline-block; }
  /* Both pagers look the same here (prev, picker, next), so both sit in the middle. */
  .pager-top { justify-content: center; }
  .slide-btn span { display: none; }
  .slide-btn { padding: 12px 14px; }
  .arrow { width: 40px; height: 56px; margin-top: -28px; background: rgba(12, 14, 26, 0.35); }
  .show-bar { gap: 4px; padding: 6px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .show-img, .tile img, .spinner { transition: none; }
  .tile.ghost { animation: none; }
  .spinner { animation-duration: 2s; }
}
