:root {
  --bg: #1a1a1e;
  --surface: #25252c;
  --text: #e8e6e3;
  --muted: #9b98a0;
  --accent: #c9a227;
  --accent-hover: #e0b83d;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 2rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--surface);
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tagline {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  align-content: start;
}

.gallery-item {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

.gallery-item a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.gallery-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  vertical-align: middle;
}

.gallery-item .caption {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.gallery-item .caption:empty {
  display: none;
}

/* Gallery list (index) */
.galleries-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.gallery-card {
  display: block;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

.gallery-card-title {
  display: block;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.gallery-card-desc {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

.back-link {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.back-link a {
  color: var(--accent);
  text-decoration: none;
}

.back-link a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.loading, .error {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.error {
  color: #e07c7c;
}

.error[hidden], .loading[hidden] {
  display: none !important;
}

footer {
  padding: 1.5rem;
  text-align: center;
  border-top: 1px solid var(--surface);
  font-size: 0.875rem;
  color: var(--muted);
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

footer code {
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: var(--surface);
  color: var(--text);
  font-size: 1.75rem;
  line-height: 1;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: #3a3a42;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox-caption {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.lightbox-caption:empty {
  display: none;
}

.lightbox-fullsize {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
}

.lightbox-fullsize:hover {
  background: #3a3a42;
  color: var(--accent-hover);
}
