:root {
  --bg: #f6f1e4;
  --bg-elevated: #ece3cc;
  --bg-card: #ffffff;
  --text: #201a0f;
  --text-muted: #4a4130;
  --accent: #a91d2c;
  --accent-dim: rgba(169, 29, 44, 0.12);
  --border: rgba(32, 26, 15, 0.12);
  --radius: 3px;
  --header-bg: #0d1b45;
  --header-bg-mid: #24398a;
  --header-text: #f4efe0;
  --header-text-muted: #c9c2ac;
  --gold: #d9ad3f;
  --gold-bright: #f2c94c;
  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Source Sans 3", -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

/* ---------- Header ---------- */

.site-header {
  background: linear-gradient(180deg, var(--header-bg) 0%, var(--header-bg-mid) 100%);
  padding: 3.5rem 1.5rem 2.5rem;
}

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

.home-link {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--header-text-muted);
  text-decoration: none;
  margin-bottom: 1.4rem;
  transition: color 0.2s ease;
}

.home-link:hover {
  color: var(--gold-bright);
}

.frame-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--gold-bright);
  text-transform: uppercase;
}

.site-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  margin: 0.4rem 0 0.5rem;
  letter-spacing: -0.01em;
  color: var(--header-text);
}

.site-sub {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--header-text-muted);
  margin: 0;
}

/* ---------- Layout ---------- */

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

.view[hidden] { display: none; }

/* ---------- Kategorie-Karten (Kontaktbogen-Optik) ---------- */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.6rem;
}

.category-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding-left: 14px;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.category-card:hover,
.category-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(217, 173, 63, 0.5);
  outline: none;
}

/* Sprocket-Loch-Streifen entlang der linken Kante, referenziert Filmrolle */
.category-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  background-color: #000;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 6px,
    var(--bg) 6px,
    var(--bg) 12px
  );
}

.category-thumb-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-elevated);
}

.category-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.55) brightness(0.85);
  transition: filter 0.3s ease, transform 0.4s ease;
}

.category-card:hover .category-thumb-wrap img,
.category-card:focus-visible .category-thumb-wrap img {
  filter: saturate(1) brightness(1);
  transform: scale(1.03);
}

.category-meta {
  padding: 0.9rem 1rem 1.1rem;
}

.category-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.3rem;
}

.category-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.empty-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 40em;
}

/* ---------- Kategorie-Detailansicht ---------- */

.back-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.6rem;
}

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

.category-header {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}

.category-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  margin: 0;
}

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

.thumb-item {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-elevated);
  border-radius: 2px;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.thumb-item:hover img { transform: scale(1.06); }

.grid-sentinel { height: 1px; }

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

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(9, 14, 33, 0.97);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.lightbox[hidden] { display: none; }

.lightbox-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.2rem;
}

.lightbox-counter {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--header-text-muted);
  letter-spacing: 0.06em;
}

.lightbox-actions {
  display: flex;
  gap: 0.6rem;
}

.icon-btn {
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(244, 239, 224, 0.25);
  border-radius: 50%;
  color: var(--header-text);
  font-size: 0.9rem;
}

.icon-btn:hover { border-color: var(--gold-bright); color: var(--gold-bright); }

.icon-btn.active { color: var(--gold-bright); border-color: var(--gold-bright); }

.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3.5rem 2rem;
  min-height: 0;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.4rem;
  color: var(--header-text-muted);
  width: 3rem;
  height: 3rem;
  line-height: 1;
}

.lightbox-nav:hover { color: var(--gold-bright); }

.lightbox-prev { left: 0.5rem; }
.lightbox-next { right: 0.5rem; }

@media (max-width: 640px) {
  .lightbox-stage { padding: 0 2.6rem 1.2rem; }
  .lightbox-nav { font-size: 1.8rem; width: 2.2rem; }
  .site-header { padding: 2.4rem 1.2rem 1.8rem; }
}

/* ---------- Barrierefreiheit ---------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
