:root {
  color-scheme: light dark;
  --bg: #0b0b0d;
  --fg: #f2f2f4;
  --muted: #9a9aa2;
  --accent: #e8e8ec;
  --gap: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.album-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap);
  padding: 32px var(--gap) 16px;
}

.album-heading h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.album-expiry {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.album-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap);
}

#search {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: var(--fg);
  padding: 8px 16px;
  font-size: 0.95rem;
  min-width: 220px;
}

#search:focus { outline: 2px solid var(--accent); }

.album-download {
  display: inline-block;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: var(--fg);
  padding: 8px 16px;
  font-size: 0.85rem;
  text-decoration: none;
}

.album-download:hover { background: rgba(255, 255, 255, 0.16); }

.album-intro {
  padding: 0 var(--gap) var(--gap);
  max-width: 720px;
  line-height: 1.6;
  color: var(--fg);
}

.album-intro > :first-child { margin-top: 0; }
.album-intro > :last-child { margin-bottom: 0; }
.album-intro a { color: var(--fg); }

.filter-banner {
  margin: 0;
  padding: 0 var(--gap) var(--gap);
  color: var(--muted);
  font-size: 0.9rem;
}

.filter-banner strong { color: var(--fg); }
.filter-banner a { color: var(--fg); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: 4px;
  gap: var(--gap);
  padding: 0 var(--gap) var(--gap);
}

.tile {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  cursor: zoom-in;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.tile img.loaded { opacity: 1; }

.tile.hidden { display: none; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 64px 16px;
}

.album-footer {
  text-align: center;
  padding: 32px 16px 48px;
  color: var(--muted);
  font-size: 0.8rem;
}

.pswp-info-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 40%;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 16px 20px;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(6px);
  color: var(--fg);
  font-size: 0.9rem;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  z-index: 10;
}

.pswp--info-open .pswp-info-panel {
  transform: translateY(0);
}

.pswp-info-panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0;
}

.pswp-info-panel dt {
  color: var(--muted);
  font-weight: 500;
}

.pswp-info-panel dd {
  margin: 0;
}

.pswp-info-panel p {
  margin: 0;
  color: var(--muted);
}

.pswp-info-panel__ai-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
}

.pswp-info-panel__ai-description {
  margin: 0 0 12px;
  color: var(--fg);
  line-height: 1.4;
}

.pswp-info-panel__ai-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(120, 170, 255, 0.25);
  color: var(--fg);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.pswp-info-panel__tags {
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  font-size: 0.8rem;
  text-decoration: none;
}

.tag-chip:hover { background: rgba(255, 255, 255, 0.2); }

.pswp-faces-layer {
  position: fixed;
  pointer-events: none;
  z-index: 5;
}

.pswp-face-box {
  position: absolute;
  display: block;
  box-sizing: border-box;
  border: 2px solid transparent;
  border-radius: 4px;
  pointer-events: auto;
  text-decoration: none;
}

.pswp-face-box:hover,
.pswp-face-box:focus-visible {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.pswp-face-box__label {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(10, 10, 12, 0.85);
  color: #fff;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.pswp-face-box:hover .pswp-face-box__label,
.pswp-face-box:focus-visible .pswp-face-box__label {
  opacity: 1;
}

/* The info/download toolbar buttons' icon SVGs are plain injected HTML, not
   PhotoSwipe's own built-in icon format -- they never get its ".pswp__icn"
   class (position/size) or its icon-color variable. Without this, the icon
   sits unstyled in each button's normal box flow and its `stroke="currentColor"`
   inherits whatever ambient text color the surrounding element/browser
   happens to use -- invisible-ish button text color in some browsers for the
   <button> info button, and the default link blue for the <a> download
   button (also shifted, since it isn't centered like PhotoSwipe's own
   icons). Fixed with an explicit, always-white color and the same
   position/size PhotoSwipe's built-in icons use. */
.pswp__button--info-button svg,
.pswp__button--download-button svg {
  position: absolute;
  top: 14px;
  left: 9px;
  width: 32px;
  height: 32px;
  color: #fff;
  pointer-events: none;
}

.pswp__button--download-button {
  color: inherit;
  text-decoration: none;
}

