:root {
  --bg: #fff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e5e7eb;
  --card-bg: #fff;
  --accent: #b91c1c;
  --radius: 8px;
  --gap: 1rem;
  --lightbox-bg: rgba(0, 0, 0, 0.92);
}

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

html,
body {
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
}

/* ---------- Übersicht ---------- */

.year + .year {
  margin-top: 2.5rem;
}

.year h2 {
  font-size: 1.5rem;
  margin: 0 0 1rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--gap);
}

.card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: cover;
  background: var(--border);
}

.card-body {
  padding: 0.75rem 0.9rem 0.9rem;
}

.card h3 {
  font-size: 1.05rem;
  margin: 0;
  hyphens: auto;
}

.card-count {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Album ---------- */

.back {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
  text-decoration: none;
}

.back:hover {
  color: var(--text);
}

.album-header {
  margin-bottom: 1.25rem;
}

.album-header h1 {
  font-size: 1.6rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.album-year,
.album-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}

.photo-grid a {
  display: block;
  border-radius: calc(var(--radius) / 2);
  overflow: hidden;
  background: var(--border);
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: cover;
  transition: opacity 0.15s ease;
}

.photo-grid a:hover img {
  opacity: 0.85;
}

@media (max-width: 480px) {
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
  }
}

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  overflow: hidden;
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Innerhalb eines iframes: auf den sichtbaren Bereich der Elternseite begrenzt (per JS gesetzt) */
.lightbox.in-frame {
  position: absolute;
  inset: auto 0 auto 0;
}

.lightbox::backdrop {
  background: var(--lightbox-bg);
}

.lightbox-image {
  max-width: calc(100% - 1rem);
  max-height: calc(100% - 5rem);
  object-fit: contain;
  user-select: none;
}

.lightbox-btn {
  position: absolute;
  border: 0;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  cursor: pointer;
}

.lightbox-btn:hover,
.lightbox-btn:focus-visible {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-close {
  top: 0.75rem;
  right: 0.75rem;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev {
  left: 0.75rem;
}

.lightbox-next {
  right: 0.75rem;
}

.lightbox-counter {
  position: absolute;
  bottom: 0.75rem;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}
