:root {
  --paper:   #f7f4ee;
  --card:    #ffffff;
  --ink:     #201d18;
  --muted:   #756f66;
  --line:    #e6e1d6;
  --accent:  #356152;
  --accent2: #b06a3b;
  --danger:  #9c342b;
  --radius:  12px;
  --shadow:  0 1px 2px rgba(30,25,15,.05), 0 6px 20px rgba(30,25,15,.06);
  --shadow2: 0 4px 10px rgba(30,25,15,.10), 0 18px 40px rgba(30,25,15,.14);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.65 "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { image-orientation: from-image; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .9em; background: #efece4; padding: 1px 5px; border-radius: 5px; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 20px; flex-wrap: wrap;
  padding: 10px 22px;
  background: rgba(247, 244, 238, .9);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .mainnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar .mainnav a {
  color: var(--muted); padding: 6px 11px; border-radius: 8px;
  font-size: .95rem; text-decoration: none; transition: background .15s, color .15s;
}
.topbar .mainnav a:hover { color: var(--ink); background: #ece8df; text-decoration: none; }
.topbar .mainnav a.active { color: var(--accent); background: #e7efe9; font-weight: 600; }
.topbar .mainnav { margin-left: auto; }
.topbar .pagelabel { flex: 0 0 auto; }
.topbar .pagelabel {
  font-size: 1.1rem; font-weight: 700; color: var(--ink); letter-spacing: .02em;
}
.topbar .logout { color: var(--muted); font-size: .85rem; text-decoration: none; }
.topbar .logout:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Galerie-Container ---------- */
.gallery { max-width: 1440px; margin: 0 auto; padding: 12px 22px 72px; }
.empty { color: var(--muted); padding: 56px 0; }

/* ---------- Kacheln (Jahre / Alben) ---------- */
.years-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px; margin-top: 22px;
}
.year-tile {
  position: relative; display: block;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden; background: #e9e5db;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.year-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow2); text-decoration: none; }
.year-tile img { width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .4s ease; }
.year-tile:hover img { transform: scale(1.06); }
.year-tile .no-cover {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #e7e2d7, #d9d3c6);
}
.year-tile-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  padding: 34px 15px 13px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.16) 45%, rgba(0,0,0,.74));
}
.year-tile .yt-year  { font-size: 1.4rem; font-weight: 700; letter-spacing: .01em;
  text-shadow: 0 1px 3px rgba(0,0,0,.5); line-height: 1.15; }
.year-tile .yt-count {
  font-size: .78rem; font-weight: 600; background: rgba(255,255,255,.22);
  border-radius: 999px; padding: 2px 9px; backdrop-filter: blur(2px);
}

/* ---------- Jahres-/Album-Navigation ---------- */
.year-nav {
  display: flex; align-items: center; gap: 18px;
  margin: 18px 0 2px; font-size: .95rem;
}
.year-nav .year-nav-arrows { margin-left: auto; display: flex; gap: 18px; }
.year-title {
  display: flex; align-items: baseline; gap: 12px;
  margin: 8px 0 18px; padding-bottom: 8px;
  font-size: 1.9rem; font-weight: 700; letter-spacing: .01em;
  border-bottom: 2px solid var(--line);
}
.year-title .count {
  font-size: .78rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
}

/* Untertitel innerhalb einer Seite (falls genutzt) */
.album-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 26px 0 10px; font-size: 1.15rem; font-weight: 600; color: var(--accent);
}

/* ---------- Foto-Raster ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
}
.cell {
  position: relative; display: block;
  aspect-ratio: 1 / 1;
  background: #e9e5db; border-radius: 10px; overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.cell:hover { transform: translateY(-2px); box-shadow: var(--shadow2); }
.cell img { width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease; }
.cell:hover img { transform: scale(1.07); }
.cell .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.7);
  background: rgba(0,0,0,.14); pointer-events: none;
}
/* Eigene Lupe (nur auf Bildern), signalisiert "zum Vergroessern klicken" */
.cell .zoom {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.20); color: #fff;
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.cell .zoom svg { width: 34px; height: 34px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.cell:hover .zoom { opacity: 1; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(14,12,9,.94); backdrop-filter: blur(3px);
  padding: 20px;
}
.lightbox[hidden] { display: none; }
.lb-stage {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 96vw; max-height: 94vh;
}
.lb-content { display: flex; max-width: 96vw; max-height: 86vh; }
.lb-content img, .lb-content video {
  max-width: 96vw; max-height: 86vh; border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); background: #000;
}
.lb-caption { color: #eee; font-size: .9rem; text-align: center; min-height: 1em; }
.lb-close, .lb-prev, .lb-next {
  position: absolute; z-index: 3; background: rgba(255,255,255,.10); color: #fff;
  border: 0; cursor: pointer; border-radius: 50%;
  transition: background .15s;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.25); }
.lb-close { top: 16px; right: 18px; width: 42px; height: 42px; font-size: 1.7rem; line-height: 1; }
.lb-prev, .lb-next {
  top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; font-size: 2rem; line-height: 1;
}
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

/* ---------- Login / Formulare ---------- */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.login-card, .form-wrap {
  width: 100%; max-width: 420px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 30px;
  box-shadow: var(--shadow);
}
.form-wrap { max-width: 580px; margin: 40px auto; }
.login-card h1, .form-wrap h1 { margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 18px; }

form label { display: block; margin: 15px 0; font-size: .88rem; color: var(--muted); }
form label.inline { display: flex; align-items: center; gap: 8px; color: var(--ink); }
input[type=text], input[type=password], input[type=number], input[type=file] {
  display: block; width: 100%; margin-top: 6px; padding: 11px 13px;
  font-size: 1rem; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 9px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[type=file] { padding: 9px; }
button[type=submit] {
  margin-top: 10px; padding: 12px 22px; font-size: 1rem; font-weight: 600;
  color: #fff; background: var(--accent); border: 0; border-radius: 9px; cursor: pointer;
  transition: filter .15s;
}
button[type=submit]:hover { filter: brightness(1.08); }

.error { color: var(--danger); background: #fbeae7; border: 1px solid #f0cec8;
  padding: 9px 13px; border-radius: 9px; font-size: .9rem; }
.ok { color: #2c6b4f; background: #e8f3ec; border: 1px solid #cfe6d8;
  padding: 9px 13px; border-radius: 9px; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 16px; }

/* ---------- Inhaltsseiten ---------- */
.content { max-width: 760px; margin: 26px auto; padding: 0 22px 72px; }
.content h1 { margin-top: 6px; font-size: 1.9rem; }
.content h2 { margin-top: 30px; font-size: 1.25rem; color: var(--accent); }
.content img { max-width: 100%; height: auto; border-radius: var(--radius); }
.content blockquote {
  margin: 22px 0; padding: 6px 0 6px 20px;
  border-left: 3px solid var(--accent2); font-size: 1.08rem;
}
.content blockquote .autor {
  display: block; margin-top: 6px; font-size: .9rem; color: var(--muted); font-style: normal;
}
.content .lead { font-size: 1.12rem; }

.rubrik-liste { list-style: none; padding: 0; margin: 22px 0; }
.rubrik-liste li { border-bottom: 1px solid var(--line); }
.rubrik-liste a { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 6px; font-size: 1.05rem; color: var(--ink); }
.rubrik-liste a::after { content: "›"; color: var(--muted); font-size: 1.3rem; }
.rubrik-liste a:hover { background: #efece4; text-decoration: none; padding-left: 12px;
  transition: padding .15s; }
.platzhalter { color: var(--muted); font-style: italic; }

.track-liste { list-style: none; padding: 0; margin: 22px 0; }
.track-liste li {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.track-liste .track-name { font-weight: 600; }
.track-liste audio { height: 36px; }

.sitefoot {
  text-align: center; color: var(--muted); font-size: .8rem;
  padding: 22px; border-top: 1px solid var(--line); margin-top: 8px;
}

@media (max-width: 560px) {
  .gallery { padding: 8px 14px 56px; }
  .years-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 7px; }
  .year-title { font-size: 1.5rem; }
  .lb-prev, .lb-next { width: 44px; height: 44px; font-size: 1.6rem; }
}

/* ---------- Verwaltung (nur Admin) ---------- */
.verw { max-width: 1440px; margin: 0 auto; padding: 12px 22px 72px; }
.verw h1 { font-size: 1.7rem; margin-bottom: 4px; }
.verw h2 { font-size: 1.15rem; color: var(--accent); margin: 26px 0 10px;
  display: flex; align-items: baseline; gap: 10px; }
.verw h2 .count { font-size: .75rem; font-weight: 500; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }

.verw-alben { list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 6px; }
.verw-alben a { display: block; padding: 6px 12px; border-radius: 8px;
  background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: .9rem; }
.verw-alben a:hover { background: #efece4; text-decoration: none; }
.verw-alben li.aktiv a { background: #e7efe9; border-color: var(--accent); font-weight: 600; }
.verw-alben .n { color: var(--muted); font-size: .8rem; }

.verw-tools {
  position: sticky; top: 56px; z-index: 15;
  display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow);
}
.verw-tools .alle { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.verw-tools .gewaehlt { color: var(--muted); font-size: .9rem; }
.verw-tools .werkzeug { display: flex; align-items: center; gap: 6px; }
.verw-tools input[type=text], .verw-tools input[type=number] {
  margin: 0; padding: 7px 9px; width: auto; font-size: .9rem;
}
.verw-tools button {
  padding: 7px 13px; font-size: .9rem; font-weight: 600; cursor: pointer;
  color: #fff; background: var(--accent); border: 0; border-radius: 7px;
}
.verw-tools button:hover { filter: brightness(1.08); }
.verw-tools .gefahr { margin-left: auto; gap: 10px; }
.verw-tools .gefahr label { font-size: .85rem; color: var(--danger);
  display: flex; align-items: center; gap: 5px; }
.verw-tools button.del { background: var(--danger); }

.verw-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.vcell {
  position: relative; display: block; cursor: pointer;
  border-radius: 10px; overflow: hidden; background: #e9e5db;
  border: 3px solid transparent; box-shadow: var(--shadow);
}
.vcell img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.vcell .kein-thumb {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1/1; color: var(--muted); font-size: 2rem; background: #e2e0d8;
}
.vcell .pick { position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 20px; height: 20px; cursor: pointer; }
.vcell:has(.pick:checked) { border-color: var(--accent); }
.vcell:has(.pick:checked) img { opacity: .75; }
.vcell .vinfo {
  display: block; padding: 5px 7px; font-size: .72rem; color: var(--muted);
  background: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vcell .lupe {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; text-decoration: none;
}

/* ---------- Musik: Alben mit Cover ---------- */
.musik { max-width: 900px; }
.mus-album {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 20px; margin-bottom: 18px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow);
}
.mus-cover {
  flex: 0 0 150px; width: 150px; aspect-ratio: 1/1;
  border-radius: 8px; overflow: hidden; background: #e9e5db;
}
.mus-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mus-kein-cover {
  display: flex; align-items: center; justify-content: center; height: 100%;
  font-size: 3rem; color: var(--muted);
  background: linear-gradient(135deg, #e7e2d7, #d9d3c6);
}
.mus-inhalt { flex: 1 1 auto; min-width: 0; }
.mus-inhalt h2 { margin: 0 0 2px; display: flex; align-items: baseline; gap: 10px; }
.mus-inhalt h2 .count {
  font-size: .72rem; font-weight: 500; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
}
.mus-interpret { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.mus-liste { list-style: none; padding: 0; margin: 0; counter-reset: t; }
.mus-liste li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.mus-liste li::before {
  counter-increment: t; content: counter(t) ".";
  color: var(--muted); font-size: .8rem; min-width: 1.6em;
}
.mus-titel { flex: 1 1 40%; min-width: 0; font-weight: 500; }
.mus-sub { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.mus-liste audio { height: 34px; max-width: 100%; }

@media (max-width: 560px) {
  .mus-album { flex-direction: column; }
  .mus-cover { width: 100%; flex-basis: auto; max-width: 220px; }
}
