/* Keine externen Fonts/Ressourcen – nichts wird an Dritte übertragen. */
:root {
  --bg: #eceee9;
  --surface: #f7f8f5;
  --ink: #1d2a31;
  --muted: #5f6d73;
  --line: #d3d8d2;
  --brass: #8a6d3b;
  --btn-bg: #1d2a31;
  --btn-ink: #f2efe9;
  --danger: #a34535;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141d24;
    --surface: #1c2730;
    --ink: #eee9e1;
    --muted: #93a0a8;
    --line: #2c3a44;
    --brass: #d6bf94;
    --btn-bg: #d6bf94;
    --btn-ink: #141d24;
    --danger: #e0806f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Kopf: die Namen tragen die Seite ---------- */
.hero {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(40px + env(safe-area-inset-top)) 20px 8px;
}
.hero h1 {
  margin: 0;
  font: 400 clamp(46px, 14vw, 88px)/0.95 var(--serif);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.date {
  margin: 14px 0 0;
  font: 400 19px/1.3 var(--serif);
  color: var(--brass);
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* ---------- Formularelemente ---------- */
.field { display: block; margin: 28px 0 14px; }
.field span, .gate label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
input[type="text"]:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: transparent; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font: 600 16px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-big { display: flex; width: 100%; padding: 19px 20px; font-size: 18px; }
.btn-big:has(+ #fileInput:focus-visible) { outline: 2px solid var(--brass); }

.hint { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.err { margin: 10px 0 0; font-size: 14px; color: var(--danger); }

.gate { margin-top: 36px; }
.gate-row { display: flex; gap: 8px; }
.gate-row input { flex: 1; min-width: 0; }

/* ---------- Galerie ---------- */
.gallery { margin-top: 44px; }
.tabs { display: flex; gap: 22px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab {
  position: relative;
  padding: 10px 0 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 16px/1 var(--sans);
  cursor: pointer;
}
.tab span { font-weight: 400; }
.tab.active { color: var(--ink); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }

.pill {
  display: block;
  margin: 0 auto 14px;
  padding: 9px 16px;
  border: 1px solid var(--brass);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 600 14px/1 var(--sans);
  cursor: pointer;
}
.pill[hidden] { display: none; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 0 -20px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0; } }

.tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--line);
  overflow: hidden;
  cursor: pointer;
}
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.tile img.loaded { opacity: 1; }
.tile .ico { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.tile .play {
  position: absolute; right: 6px; bottom: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(20, 29, 36, .6);
}
.tile .play svg { width: 11px; height: 11px; margin-left: 2px; fill: #fff; }
.tile.fresh { animation: arrive .45s ease-out; }
@keyframes arrive { from { opacity: 0; transform: scale(.9); } }

.empty { margin: 36px 0; font: 400 20px/1.4 var(--serif); color: var(--muted); }
#sentinel { height: 1px; }
.note { margin: 40px 0 0; font-size: 13px; color: var(--muted); max-width: 52ch; }

/* ---------- Upload-Fortschritt als Bottom Sheet ---------- */
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 30px -12px rgba(20, 29, 36, .35);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet[hidden] { display: none; }
.sheet-head {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%;
  padding: 16px 20px 14px;
  border: 0; background: none; color: var(--ink);
  font: 600 15px/1.2 var(--sans); text-align: left;
  cursor: pointer;
}
.bar { display: block; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; width: 0; height: 100%; background: var(--brass); transition: width .2s; }
.sheet-body { display: none; padding: 0 20px 14px; }
.sheet.open .sheet-body { display: block; }
.sheet-body .hint { margin: 0 0 8px; }
.sheet-body ul { list-style: none; margin: 0; padding: 0; max-height: 45vh; overflow: auto; }
.q-item {
  display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.q-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.q-item .bar { grid-column: 1 / -1; height: 3px; }
.q-status { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.q-item.done .q-status { color: var(--brass); }
.q-item.error .q-status { color: var(--danger); }
.q-retry {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: none; color: var(--ink); font: 600 13px/1 var(--sans); cursor: pointer;
}
.q-retry[hidden] { display: none; }

/* ---------- Lightbox ---------- */
body.lb-open { overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #000; color: #f2efe9; }
.lb[hidden] { display: none; }
.lb-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
}
.lb-meta {
  margin: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 14px; color: #c9c3b9; text-align: center;
}
.lb-close { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; }
.lb-close svg { width: 20px; height: 20px; }
.lb-actions { display: flex; gap: 6px; flex: none; }
.lb-btn {
  padding: 9px 13px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #f2efe9;
  font: 600 14px/1 var(--sans); text-decoration: none; cursor: pointer;
}
.lb-btn.danger { background: #a34535; }
.lb-btn[hidden] { display: none; }
.lb-stage { position: relative; flex: 1; min-height: 0; touch-action: pan-y pinch-zoom; }
.lb-stage img, .lb-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.lb-msg { position: absolute; inset: 0; display: grid; place-content: center; padding: 32px; text-align: center; color: #c9c3b9; }
.lb-nav {
  position: absolute; top: 50%; z-index: 2;
  width: 44px; height: 72px; transform: translateY(-50%);
  border: 0; background: rgba(255, 255, 255, .08); color: #fff;
  font-size: 32px; line-height: 1; cursor: pointer;
}
.lb-nav:disabled { opacity: 0; pointer-events: none; }
.lb-nav.prev { left: 0; border-radius: 0 10px 10px 0; }
.lb-nav.next { right: 0; border-radius: 10px 0 0 10px; }

/* ---------- Admin ---------- */
.admin .hero h1 { font-size: clamp(34px, 8vw, 52px); }
.stats { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 24px 0; padding: 0; list-style: none; }
.stats li { font-size: 14px; color: var(--muted); }
.stats b { display: block; font: 400 28px/1.1 var(--serif); color: var(--ink); }
.guest-link { margin: 0 0 28px; font-size: 14px; color: var(--muted); }
.guest-link code { display: block; margin-top: 4px; padding: 10px 12px; border-radius: 8px; background: var(--surface); color: var(--ink); word-break: break-all; font-size: 14px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.admin-item { margin: 0; font-size: 13px; }
.admin-item a { position: relative; display: block; aspect-ratio: 1; background: var(--line); overflow: hidden; border-radius: 6px; }
.admin-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-item .ico { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.admin-item figcaption { padding-top: 6px; }
.admin-item b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.admin-item small { display: block; color: var(--muted); }
.admin-item form { margin-top: 6px; }
.link-danger { padding: 0; border: 0; background: none; color: var(--danger); font: 600 13px var(--sans); cursor: pointer; }
.pager { display: flex; gap: 14px; margin: 28px 0; }
.pager a { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .tile.fresh { animation: none; }
  .tile img, .bar i { transition: none; }
}
