/* Oeffentliche Galerie-Ansicht: schlicht, viel Weissraum, siehe
   docs/prompts/03-oeffentliche-galerie.md. Kein Framework, reines CSS,
   gleiche Palette wie public/admin/admin.css. */

:root {
  --ink: #1f1f1f;
  --muted: #6b6b6b;
  --line: #e2e2e2;
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --accent: #2f5d50;
  --danger: #a3372a;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--line);
}

.site-brand {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.site-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

.site-footer {
  max-width: 1100px;
  margin: 2rem auto 0;
  padding: 1rem 2rem 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

.site-footer a {
  color: var(--muted);
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 1rem;
}

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.flash {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.error {
  color: var(--danger);
}

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

.button,
button {
  display: inline-block;
  font: inherit;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
}

.site-form {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 320px;
}

.site-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.site-form input[type="password"] {
  font: inherit;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.site-form button {
  margin-top: 1.25rem;
  align-self: flex-start;
}

.filter-form {
  margin-bottom: 1.5rem;
}

.filter-form select {
  font: inherit;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Bewusst ganz normal im Textfluss (kein sticky, kein fixed): steht fest
   ueber dem ersten Bild und scrollt mit der Seite weg wie jeder andere
   Inhalt auch, das war nach ein paar Missverstaendnissen unsererseits
   ueber "fix bleiben" tatsaechlich der Wunsch. */
.selection-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.selection-bar button[type="button"] {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--line);
}

#selection-count {
  margin-right: auto;
}

/* Masonry-artiges Raster ueber CSS-Spalten statt festem Grid: jedes Bild
   behaelt sein natuerliches Seitenverhaeltnis (Hoch-, Quer- oder
   Quadratformat), dadurch ordnen sich die Karten je nach Bildgroesse
   unterschiedlich hoch an statt als gleichfoermige Quadrate. "columns: 4
   220px" heisst hoechstens 4 Spalten, mindestens 220px breit, der Browser
   waehlt dazwischen automatisch, kein JS noetig. */
.thumb-grid {
  columns: 4 220px;
  column-gap: 0.3rem;
}

.thumb-card {
  position: relative;
  break-inside: avoid;
  margin: 0 0 0.3rem;
  overflow: hidden;
  background: var(--bg-soft);
}

.thumb-card img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}

/* Flat, kein Badge-Hintergrund/Rahmen mehr: der drop-shadow-Filter (statt
   box-shadow, der wirkt nur auf Boxen, nicht auf die Checkbox-Form
   selbst) sorgt trotzdem fuer genug Kontrast auf hellen wie dunklen
   Fotos. */
.thumb-select {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  line-height: 0;
}

.select-checkbox {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

/* Nur auf Geraeten mit echtem Hover (Maus/Trackpad) unsichtbar bis man
   drueberfaehrt, angehakte Bilder bleiben sichtbar damit man die Auswahl
   nicht verliert. Auf Touch-Geraeten (kein Hover, das ist hier der
   Hauptteil der Nutzung, siehe Gaeste-Upload) bleibt sie dauerhaft
   sichtbar, sonst gaebe es keine Moeglichkeit sie per Antippen zu
   entdecken. */
@media (hover: hover) {
  .thumb-select {
    opacity: 0;
    transition: opacity 0.15s ease;
  }

  .thumb-card:hover .thumb-select,
  .thumb-card:focus-within .thumb-select,
  .thumb-select:has(:checked) {
    opacity: 1;
  }
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  color: var(--muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 2rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-frame {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  max-height: 75vh;
}

.lightbox-frame img {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
}

/* Name der hochladenden Person nur hier zu sehen, als schmales Overlay
   direkt auf dem Bild statt einer eigenen Zeile darunter, siehe
   Gaeste-Uploads und "clean" gehaltene Galerie-Ansicht. */
.lightbox-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  color: #fff;
  font-size: 0.8rem;
}

.lightbox-caption .button {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.3rem 0.6rem;
  font-size: 0.9rem;
  line-height: 1;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.lightbox-close {
  top: 1rem;
  right: 1.5rem;
}

.lightbox-prev {
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

/* Gaeste-Upload, siehe docs/prompts/04-gaeste-upload.md */

.upload-name-field {
  margin-bottom: 1.5rem;
}

.upload-name-field input[type="text"] {
  font: inherit;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  background: var(--bg-soft);
  margin-bottom: 1.5rem;
}

.dropzone p {
  margin: 0.25rem 0;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #fff;
}

.upload-summary {
  margin-bottom: 1.5rem;
}

.progress-overall {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.progress-bar {
  flex: 1;
  height: 0.6rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar.small {
  height: 0.4rem;
  width: 140px;
  flex: none;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}

.upload-queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.queue-filename {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-status {
  min-width: 90px;
  text-align: right;
}

.queue-status.ok {
  color: var(--accent);
}

.queue-status.error {
  color: var(--danger);
}

.upload-done {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.upload-failed-list {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
}
