/* Foto-Delivery – ruhige, dunkle Bühne. Die Bilder sind der Star. */

:root {
  --bg:        #131315;
  --bg-sunk:   #0f0f11;
  --surface:   #1b1b1e;
  --line:      #2b2b30;
  --line-soft: #232327;
  --fg:        #ecebe8;
  --fg-dim:    #a3a2a0;
  --fg-mute:   #74747a;
  --focus:     #6d7c8a;
  --radius:    3px;
  --pad:       20px;
  --gap:       8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

a { color: inherit; }

::selection { background: #3a3a42; }

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

/* ---------- Cover ---------- */

.cover {
  position: relative;
  min-height: 78svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  overflow: hidden;
  background: var(--bg-sunk);
}
.cover-plain { min-height: 46svh; }

.cover-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  animation: coverIn 1.4s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes coverIn { from { opacity: 0; transform: scale(1.04) } to { opacity: 1; transform: none } }

.cover-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12,12,14,.55) 0%, rgba(12,12,14,.28) 38%, rgba(19,19,21,.92) 100%),
    radial-gradient(120% 80% at 50% 55%, rgba(12,12,14,.15), rgba(12,12,14,.72));
}

.cover-text { position: relative; z-index: 1; }

.cover h1 {
  margin: 0;
  font-size: clamp(2.1rem, 8.5vw, 4.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.04;
  text-shadow: 0 1px 30px rgba(0,0,0,.45);
}

.byline {
  margin: 18px 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(236,235,232,.82);
}

.shootdate {
  margin: 6px 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: rgba(236,235,232,.55);
}

.cover-hint {
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: 1px;
  height: 42px;
  margin-left: -0.5px;
  background: linear-gradient(180deg, transparent, rgba(236,235,232,.45));
  z-index: 1;
}

/* ---------- Leiste beim Scrollen ---------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px;
  background: rgba(19,19,21,.86);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
  transform: translateY(-102%);
  transition: transform .4s cubic-bezier(.22,.61,.36,1);
}
.topbar.show { transform: none; }
.tb-title {
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tb-dl {
  font-size: 0.78rem;
  color: var(--fg-dim);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 12px;
  white-space: nowrap;
  transition: border-color .3s ease, color .3s ease;
}
.tb-dl:hover { color: var(--fg); border-color: #45454c; }

.note {
  margin: 40px auto 0;
  max-width: 56ch;
  color: var(--fg-dim);
  font-size: 0.96rem;
  text-align: center;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 40px 0 4px;
}

.tally {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
}

.action {
  display: inline-block;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  transition: border-color .35s ease, background-color .35s ease;
}
.action:hover { border-color: #45454c; background: #1a1a1d; }
.action:active { background: #202024; }

/* ---------- Sektionen ---------- */

main {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 var(--pad) 80px;
}

.empty {
  padding: 80px 0;
  color: var(--fg-mute);
  text-align: center;
}

.block { padding-top: 26px; }
.block + .block { padding-top: 64px; }

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.block-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg);
}

.block-meta {
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--fg-mute);
}

.block-meta a {
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  letter-spacing: 0.08em;
  transition: color .3s ease, border-color .3s ease;
}
.block-meta a:hover { color: var(--fg); border-color: var(--fg-mute); }

/* ---------- Justiertes Raster ----------
   Zeilenweise wie bei einer klassischen Bildstrecke: die Seitenverhältnisse
   bleiben erhalten, jede Zeile füllt die Breite. Reines CSS, kein Layout-JS. */

.jgrid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  --row: 200px;
}
/* Letzte Zeile linksbündig lassen statt unnatürlich aufzublasen */
.jgrid::after {
  content: "";
  flex-grow: 999999;
  min-width: 0;
}

/* Sobald das JS die Zeilen exakt gerechnet hat, gelten dessen Maße */
.jgrid.jsl .tile { flex: 0 0 auto; }
.jgrid.jsl::after { display: none; }

.tile {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  height: var(--row);
  flex: var(--ar, 1) 1 calc(var(--ar, 1) * var(--row));
  min-width: 0;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .5s ease, transform .6s cubic-bezier(.22,.61,.36,1);
}
.tile img[data-loaded] { opacity: 1; }

@media (hover: hover) {
  .tile:hover img { transform: scale(1.02); }
}

.pending {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--fg-mute);
  background: linear-gradient(180deg, #1d1d21, #171719);
}

.play {
  position: absolute;
  left: 50%; top: 50%;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: rgba(14,14,16,.5);
  border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(3px);
  pointer-events: none;
}
.play::after {
  content: "";
  position: absolute;
  left: 17px; top: 14px;
  border-left: 12px solid rgba(255,255,255,.92);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.dur, .raw {
  position: absolute;
  right: 7px; bottom: 6px;
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,.9);
  background: rgba(12,12,14,.62);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.raw { left: 7px; right: auto; letter-spacing: 0.1em; }

/* ---------- Rohdaten & Dokumente: schlichte Liste, kein Bilderraster ------ */

.filelist {
  display: grid;
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.fileitem {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  background: var(--bg);
  text-decoration: none;
  font-size: 0.86rem;
  transition: background-color .3s ease;
}
.fileitem:hover { background: #1a1a1d; }
.fi-ext {
  flex: none;
  min-width: 52px;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  color: var(--fg-mute);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 4px 0;
  text-align: center;
}
.fi-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-dim);
}
.fi-size { flex: none; color: var(--fg-mute); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

/* ---------- Fußbereich ---------- */

.colophon {
  max-width: 1560px;
  margin: 0 auto;
  padding: 40px var(--pad) 64px;
  border-top: 1px solid var(--line-soft);
  color: var(--fg-mute);
  font-size: 0.82rem;
}
.colophon p { margin: 0 0 6px; max-width: 62ch; }
.colophon a { color: var(--fg-dim); text-decoration: none; border-bottom: 1px solid var(--line); }
.colophon a:hover { color: var(--fg); }

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10,10,12,.975);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade .22s ease;
}
.lightbox[hidden] { display: none; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.lb-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(180deg, rgba(10,10,12,.88), transparent);
  z-index: 2;
  font-size: 0.82rem;
}
.lb-count { color: var(--fg-mute); font-variant-numeric: tabular-nums; }
.lb-name {
  color: var(--fg-dim);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-btn {
  border: 1px solid var(--line);
  background: rgba(20,20,23,.6);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 7px 13px;
  font: inherit;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .3s ease;
}
.lb-btn:hover { border-color: #4a4a52; }

.lb-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 58px 12px max(20px, env(safe-area-inset-bottom));
}
.lb-stage img, .lb-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}
.lb-stage .lb-msg { color: var(--fg-mute); font-size: 0.9rem; text-align: center; }

.lb-nav {
  position: absolute;
  top: 50%;
  width: 52px; height: 52px;
  margin-top: -26px;
  border: 0;
  border-radius: 50%;
  background: rgba(24,24,28,.5);
  cursor: pointer;
  z-index: 2;
  transition: background-color .3s ease;
}
.lb-nav:hover { background: rgba(38,38,44,.72); }
.lb-nav::after {
  content: "";
  position: absolute;
  top: 18px; left: 20px;
  width: 12px; height: 12px;
  border-top: 1.5px solid rgba(255,255,255,.82);
  border-right: 1.5px solid rgba(255,255,255,.82);
}
.lb-prev { left: 10px; }
.lb-prev::after { transform: rotate(-135deg); left: 22px; }
.lb-next { right: 10px; }
.lb-next::after { transform: rotate(45deg); left: 16px; }

@media (max-width: 640px) {
  .lb-nav { display: none; }
  .lb-name { display: none; }
}

/* ---------- Größere Schirme ---------- */

@media (min-width: 620px) {
  :root { --pad: 40px; --gap: 10px; }
  .jgrid { --row: 260px; }
}

@media (min-width: 980px) {
  :root { --pad: 56px; --gap: 14px; }
  .jgrid { --row: 330px; }
  .block + .block { padding-top: 88px; }
  .topline { padding-top: 56px; }
}

@media (min-width: 1500px) {
  .jgrid { --row: 380px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =========================================================================
   Admin
   ========================================================================= */

body.admin {
  background: var(--bg-sunk);
}

.adm-wrap { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; }

.adm-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.adm-top h1 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.adm-top .sub { color: var(--fg-mute); font-size: 0.82rem; margin: 2px 0 0; }
.adm-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.adm-link {
  color: var(--fg-dim);
  font-size: 0.84rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.adm-link:hover { color: var(--fg); }

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  border-radius: var(--radius);
  padding: 8px 14px;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .3s ease, background-color .3s ease;
}
.btn:hover { border-color: #45454c; background: #17171a; }
.btn-quiet { color: var(--fg-mute); }
.btn-danger:hover { border-color: #6d3b3b; color: #e8b4b4; }

.card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 18px;
  margin-top: 18px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
  font-weight: 500;
}

table.list { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.list th {
  text-align: left;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-mute);
  padding: 0 10px 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
table.list td {
  padding: 12px 10px 12px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.list tr:last-child td { border-bottom: 0; }
table.list a.name { text-decoration: none; font-weight: 500; }
table.list a.name:hover { border-bottom: 1px solid var(--fg-mute); }
.num { font-variant-numeric: tabular-nums; color: var(--fg-dim); white-space: nowrap; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  border: 1px solid var(--line);
  color: var(--fg-mute);
}
.pill-live { border-color: #35543f; color: #9fd0ac; }
.pill-off { border-color: #4a3a3a; color: #d3a5a5; }

form.rows { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; }
.field label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
input[type=text], input[type=date], input[type=password], textarea, select {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
  padding: 9px 11px;
  width: 100%;
}
input:focus, textarea:focus { border-color: var(--focus); outline: none; }
textarea { min-height: 70px; resize: vertical; }
.row2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .row2 { grid-template-columns: 1fr 1fr; } }

.sharebox {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: var(--bg-sunk);
}
.sharebox.dead { opacity: .55; }
.shareurl {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
  flex-wrap: wrap;
}
.shareurl code {
  flex: 1;
  min-width: 220px;
  font-size: 0.78rem;
  background: #0c0c0e;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 8px 10px;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--fg-dim);
}
.stat-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--fg-mute);
  margin-top: 8px;
}
.stat-row b { color: var(--fg-dim); font-weight: 500; }
.events { margin: 10px 0 0; padding: 0; list-style: none; font-size: 0.76rem; color: var(--fg-mute); }
.events li { padding: 2px 0; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.dropzone {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  color: var(--fg-mute);
  font-size: 0.86rem;
  transition: border-color .3s ease, background-color .3s ease;
  cursor: pointer;
}
.dropzone.over { border-color: var(--focus); background: #17171b; color: var(--fg-dim); }
.uplog { margin-top: 10px; font-size: 0.78rem; color: var(--fg-mute); }
.uplog .bad { color: #d3a5a5; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.thumbs .th {
  aspect-ratio: 1/1;
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface);
  position: relative;
}
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .lbl {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 0.6rem; letter-spacing: .1em; color: var(--fg-mute);
}

.warn {
  border: 1px solid #5a4433;
  background: #1e1813;
  color: #e2c39f;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 0.84rem;
  margin-top: 14px;
}

.login-wrap {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 340px; }
.login-card h1 { font-size: 1.05rem; font-weight: 600; margin: 0 0 4px; }
.login-card .sub { color: var(--fg-mute); font-size: 0.82rem; margin: 0 0 22px; }
.login-card .err { color: #d3a5a5; font-size: 0.82rem; margin: 0 0 12px; }

/* ---------- Fehlerseiten ---------- */

.middle {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px 24px;
}
.middle h1 {
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.middle p { color: var(--fg-dim); margin: 0 0 8px; max-width: 44ch; }
.middle .sig { margin-top: 26px; color: var(--fg-mute); font-size: 0.82rem; }
.middle a { color: var(--fg-dim); }
