/* === Theme Variables === */
:root {
  --bg: #ffffff;
  --text: #111111;
  --thumb-shadow: rgba(0, 0, 0, 0.2);
  --thumb-hover-shadow: rgba(0, 0, 0, 0.35);
  --highlight: #007bff;
  --border-color: #e0e0e0;
}

[data-theme="dark"] {
  --bg: #111111;
  --text: #f1f1f1;
  --thumb-shadow: rgba(0, 0, 0, 0.4);
  --thumb-hover-shadow: rgba(0, 0, 0, 0.6);
  --highlight: #66b2ff;
  --border-color: #444444;
}

/* === Base Styles === */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  margin: 0;
  transition: background 0.3s, color 0.3s;
  display: grid;
  place-items: center;
  min-height: 100vh;
}

/* === Page Wrapper === */
.page-wrapper {
  width: 100%;
  padding: 2rem 4%;
  box-sizing: border-box;
}

/* === Headings and Text === */
.gallery-heading {
  text-align: center;
  margin-bottom: 1rem;
}

.gallery-quote {
  text-align: center;
  margin-bottom: 2rem;
  font-style: italic;
  color: #666;
}

.days-since {
  text-align: center;
  font-size: 1rem;
  margin-bottom: 2rem;
  color: #666;
  opacity: 0.9;
}

/* === Rainbow Text Animation === */
.rainbow-text {
  background: linear-gradient(45deg, red, orange, yellow, green, blue, indigo, violet, red);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbow 6s ease-in-out infinite;
  font-weight: bold;
}

@keyframes rainbow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* === Masonry Grid === */
.masonry-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 1rem 0;
}

.masonry-grid-item {
  flex: 0 1 calc(20% - 12px);
  max-width: calc(20% - 12px);
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.masonry-grid-item.loaded {
  opacity: 1;
  transform: translateY(0);
}

.masonry-grid-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--thumb-shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.masonry-grid-item:hover img {
  transform: scale(1.015);
  box-shadow: 0 6px 16px var(--thumb-hover-shadow);
}

/* === Responsive Design === */
@media (max-width: 1600px) {
  .masonry-grid-item {
    flex: 0 1 calc(25% - 12px);
    max-width: calc(25% - 12px);
  }
}

@media (max-width: 1200px) {
  .masonry-grid-item {
    flex: 0 1 calc(33.33% - 12px);
    max-width: calc(33.33% - 12px);
  }
}

@media (max-width: 900px) {
  .masonry-grid-item {
    flex: 0 1 calc(50% - 12px);
    max-width: calc(50% - 12px);
  }
}

@media (max-width: 600px) {
  .masonry-grid-item {
    flex: 0 1 100%;
    max-width: 100%;
  }
}

/* === Theme Toggle === */
#theme-toggle-wrapper {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
}

#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text);
  transition: color 0.3s;
}

#theme-toggle:hover {
  color: var(--highlight);
}