/* ---- Theme tokens ---- */
:root {
  --bg: #fafaf9;
  --fg: #1a1a1a;
  --muted: #767672;
  --gap: 1.25rem;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121212;
  --fg: #ededec;
  --muted: #9a9a96;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: inherit;
}

/* ---- Header ---- */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
}

.site-header .title h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0 0 0.35rem;
}

.site-header .title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.5rem;
}

.site-name {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-row .divider {
  color: var(--muted);
  font-size: 0.8rem;
}

.back-link {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--muted);
  color: var(--fg);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle:hover {
  opacity: 0.7;
}

/* ---- Gallery grid (CSS columns masonry) ---- */
.gallery {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
  column-count: 1;
  column-gap: var(--gap);
}

@media (min-width: 640px) {
  .gallery {
    column-count: 2;
  }
}

@media (min-width: 1024px) {
  .gallery {
    column-count: 3;
  }
}

.photo {
  display: block;
  break-inside: avoid;
  margin-bottom: var(--gap);
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  transition: opacity 0.2s ease;
}

.photo:hover img {
  opacity: 0.85;
}

/* ---- Category cards (homepage) ---- */
.categories {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

@media (min-width: 640px) {
  .categories {
    grid-template-columns: 1fr 1fr;
  }
}

.category-card {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  overflow: hidden;
}

.category-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  transition: transform 0.3s ease;
}

.category-card:hover img {
  transform: scale(1.03);
}

.category-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 45%);
}

.category-label {
  position: absolute;
  left: 1.5rem;
  bottom: 1.25rem;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

/* ---- Footer ---- */
.site-footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

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

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  user-select: none;
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.5rem;
}

.lightbox-close:hover {
  opacity: 0.7;
}
