:root {
  color-scheme: dark;
  --bg-0: #070605;
  --bg-1: #100d09;
  --text: #f6f0e2;
  --muted: #cbb896;
  --line: rgba(255, 223, 164, 0.24);
  --accent: #e9bf62;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, sans-serif;
  color: var(--text);
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(233, 191, 98, 0.2), transparent 36%),
    radial-gradient(circle at 85% 12%, rgba(122, 87, 34, 0.26), transparent 30%),
    linear-gradient(165deg, var(--bg-0), var(--bg-1));
}

#particleCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  pointer-events: none;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(84px);
  opacity: 0.42;
  pointer-events: none;
  z-index: -2;
  animation: float 11s ease-in-out infinite;
}

.orb-a {
  width: 260px;
  height: 260px;
  left: -80px;
  top: 8vh;
  background: rgba(255, 217, 109, 0.55);
}

.orb-b {
  width: 340px;
  height: 340px;
  right: -120px;
  top: 25vh;
  background: rgba(200, 147, 56, 0.42);
  animation-delay: 2s;
}

.orb-c {
  width: 220px;
  height: 220px;
  right: 22%;
  bottom: -80px;
  background: rgba(123, 89, 39, 0.25);
  animation-delay: 1s;
}

.shell {
  height: 100vh;
  width: 100vw;
  padding: 14px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.top-bar {
  display: grid;
  grid-template-rows: auto auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  background: rgba(17, 14, 10, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.top-bar-head {
  position: relative;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-block {
  text-align: center;
}

.album-title {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.album-date {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.download-all-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  padding: 7px 13px;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  transition: 180ms ease;
}

.download-all-btn:hover {
  background: var(--accent);
  color: #140e03;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 244, 220, 0.05);
  color: var(--text);
  padding: 7px 13px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: 180ms ease;
}

.filter-btn.active,
.filter-btn:hover,
.filter-btn:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #1e1501;
  outline: none;
}

.gallery-stage {
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-nav {
  flex-shrink: 0;
  width: 30px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 14, 10, 0.75);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.gallery {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 8px;
}

.card {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 244, 220, 0.04);
  min-height: 0;
  transform-style: preserve-3d;
  transition: transform 220ms ease, border-color 220ms ease;
}

.card:hover {
  border-color: rgba(255, 217, 109, 0.58);
}

.card::after {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at var(--glow-x, 50%) var(--glow-y, 50%), rgba(255, 218, 130, 0.3), transparent 48%);
  transition: opacity 220ms ease;
}

.card:hover::after {
  opacity: 1;
}

.media {
  position: absolute;
  inset: 0;
}

.media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(110deg, transparent 16%, rgba(255, 255, 255, 0.2) 50%, transparent 84%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  background-size: 240% 100%, 100% 100%;
  animation: shimmer 1.2s linear infinite;
}

.card.ready .media::before {
  opacity: 0;
  transition: opacity 260ms ease;
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  filter: blur(24px) saturate(0.9);
  transform: scale(1.12);
  opacity: 0.46;
  transition: transform 420ms ease, filter 420ms ease, opacity 420ms ease;
}

.card.ready .media img {
  filter: blur(0) saturate(1);
  transform: scale(1);
  opacity: 1;
}

.card.error .media {
  background: linear-gradient(130deg, rgba(137, 77, 29, 0.34), rgba(233, 191, 98, 0.2));
}

.card.error .media::after {
  content: "Image unavailable";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 8px;
  font-size: 0.76rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.42);
  z-index: 5;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.lightbox.open {
  display: flex;
}

.lightbox-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(1100px, 100%);
  max-height: 90vh;
  position: relative;
}

.lightbox img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  display: block;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.lb-btn {
  position: absolute;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.5);
  color: var(--text);
  width: 40px;
  height: 40px;
  cursor: pointer;
  z-index: 2;
}

.lb-close {
  top: 12px;
  right: 12px;
}

.lb-prev {
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-download-btn {
  position: absolute;
  top: 12px;
  right: 58px;
  z-index: 3;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #140e03;
  font-weight: 700;
  padding: 9px 14px;
  cursor: pointer;
}

@media (max-width: 920px) {
  .page-nav {
    width: 26px;
    height: 40px;
    font-size: 0.8rem;
  }
}

@media (max-width: 700px) {
  .top-bar-head {
    min-height: 0;
    flex-direction: column;
    gap: 8px;
  }

  .download-all-btn {
    position: static;
    transform: none;
  }

  .page-nav {
    width: 24px;
    height: 36px;
    font-size: 0.75rem;
  }
}

@keyframes shimmer {
  from {
    background-position: 200% 0, 0 0;
  }
  to {
    background-position: -100% 0, 0 0;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}
