/* ---------------------------------------------------------------------------
   Hochzeitsgalerie - elegantes, helles Design
   Farben und Schriften hier zentral aendern.
--------------------------------------------------------------------------- */
:root {
  --bg: #faf7f2;
  --bg-card: #ffffff;
  --ink: #2e2a26;
  --ink-soft: #7a6f64;
  --line: #e6ded2;
  --accent: #a68a64;
  --accent-dark: #8a7050;
  --danger: #a4453c;
  --radius: 4px;
  --shadow: 0 1px 3px rgba(46, 42, 38, 0.07), 0 8px 24px rgba(46, 42, 38, 0.06);
  /* Bewusst nur System-Schriften: keine externen Requests (schnell im
     Saal-WLAN, und kein Google-Fonts-Problem mit der DSGVO). */
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua',
           Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: 0.01em; margin: 0; }

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

/* --- Login ---------------------------------------------------------------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.monogram {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.auth-card h1 { font-size: 40px; line-height: 1.15; margin-bottom: 6px; }

.date {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 18px;
  margin-bottom: 26px;
}

.rule {
  width: 56px;
  height: 1px;
  background: var(--line);
  margin: 0 auto 26px;
  position: relative;
}
.rule::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 5px; height: 5px;
  background: var(--accent);
  transform: rotate(45deg);
  top: -2px;
}

.intro { color: var(--ink-soft); font-size: 15px; margin-bottom: 28px; }

label { display: block; text-align: left; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }

input[type='text'], input[type='password'] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fdfcfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.btn {
  display: inline-block;
  width: 100%;
  padding: 13px 20px;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  width: auto;
  padding: 9px 16px;
}
.btn-ghost:hover { background: #f2ece3; color: var(--ink); }

.btn-danger { background: var(--danger); }

.error {
  background: #fbeceb;
  border: 1px solid #e8cdc9;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 18px;
  text-align: left;
}

.foot-link { margin-top: 22px; font-size: 12px; color: var(--ink-soft); }
.foot-link a { color: var(--ink-soft); }

/* --- Header --------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 247, 242, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand { flex: 1; min-width: 0; }
.brand .names { font-family: var(--serif); font-size: 24px; line-height: 1.1; }
.brand .sub { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.06em; }

.header-actions { display: flex; align-items: center; gap: 10px; }

select {
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* --- Layout --------------------------------------------------------------- */
.container { max-width: 1400px; margin: 0 auto; padding: 28px 24px 80px; }

.hero { text-align: center; padding: 32px 0 36px; }
.hero p { color: var(--ink-soft); max-width: 560px; margin: 0 auto; }

/* --- Upload --------------------------------------------------------------- */
.dropzone {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 34px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  margin-bottom: 32px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #fffdf9; }
.dropzone h3 { font-size: 22px; margin-bottom: 4px; }
.dropzone p { color: var(--ink-soft); font-size: 14px; margin: 0; }

.progress-list { margin-top: 18px; text-align: left; font-size: 13px; }
.progress-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; color: var(--ink-soft); }
.progress-row .ok { color: #4a7c59; }
.progress-row .dup { color: var(--ink-soft); }
.progress-row .err { color: var(--danger); }

.bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 14px; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease; }

/* --- Galerie-Grid --------------------------------------------------------- */
/* Masonry: feine Zeilenraster-Einheit, jede Kachel spannt so viele Zeilen,
   wie ihr Seitenverhaeltnis braucht. So wird nichts beschnitten -
   Hochformat vom iPhone bleibt Hochformat. Die Spannweite setzt gallery.js. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  grid-auto-rows: 8px;
  gap: 10px;
  align-items: start;
}

.tile {
  position: relative;
  display: block;
  border: none;
  padding: 0;
  background: #efe9e0;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
  grid-row-end: span 30;   /* Startwert, wird per JS praezisiert */
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.04); }

.tile .who {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 20px 10px 8px;
  font-size: 12px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  opacity: 0;
  transition: opacity 0.2s ease;
  text-align: left;
}
.tile:hover .who { opacity: 1; }

.empty { text-align: center; color: var(--ink-soft); padding: 60px 20px; }
.count { text-align: center; color: var(--ink-soft); font-size: 13px; margin: 24px 0 16px; letter-spacing: 0.04em; }

/* --- Lightbox ------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(24, 21, 18, 0.95);
  display: none;
  z-index: 100;
}
.lightbox.open { display: flex; flex-direction: column; }

.lb-stage { flex: 1; display: grid; place-items: center; padding: 64px 72px 8px; min-height: 0; }

/* Harte Deckelung statt nur max-height:100% - sonst schiebt sich das Bild
   auf grossen Bildschirmen unter die Infozeile und wirkt riesig. */
.lb-stage img {
  max-width: min(100%, 1500px);
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.lb-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 18px;
  color: #e8e2d9;
  font-size: 13px;
  justify-content: center;
}
.lb-bar a { color: #e8e2d9; text-decoration: none; border-bottom: 1px solid rgba(232,226,217,.4); }

.lb-close, .lb-nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.lb-close { top: 14px; right: 16px; }
.lb-nav.prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-nav.next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-nav:hover, .lb-close:hover { background: rgba(255, 255, 255, 0.18); }

/* --- Admin ---------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .v { font-family: var(--serif); font-size: 30px; line-height: 1.1; }
.stat .k { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.08em; text-transform: uppercase; }

.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.tile .del {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.55); color: #fff;
  cursor: pointer; font-size: 15px; line-height: 1; opacity: 0;
}
.tile:hover .del { opacity: 1; }

/* --- Handy ---------------------------------------------------------------- */
@media (max-width: 700px) {
  /* Nichts darf breiter sein als der Bildschirm */
  html, body { max-width: 100%; overflow-x: hidden; }

  /* Auf dem Handy ist der Header eine ruhige, zentrierte Spalte und klebt
     nicht oben fest - so bleibt der Bildschirm den Fotos vorbehalten. */
  .site-header {
    position: static;
    background: transparent;
    backdrop-filter: none;
    border-bottom: none;
  }

  /* Zierlinie als Abschluss statt harter Trennlinie */
  .site-header::after {
    content: '';
    display: block;
    width: 56px;
    height: 1px;
    background: var(--line);
    margin: 2px auto 0;
  }

  .header-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 26px 16px 16px;
  }

  .brand { width: 100%; }
  .brand .names {
    font-family: var(--serif);
    font-size: 30px;
    line-height: 1.15;
    letter-spacing: 0.01em;
  }
  .brand .sub {
    margin-top: 4px;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
  }

  .header-actions {
    width: 100%;
    justify-content: center;
    gap: 8px;
  }
  .header-actions select,
  .header-actions .btn-ghost {
    font-size: 12px;
    padding: 8px 12px;
    letter-spacing: 0.06em;
  }

  .container { padding: 16px 10px 56px; }

  /* Der Header bringt die Zierlinie schon mit - im Hero bleibt nur der Text */
  .hero { padding: 4px 0 18px; }
  .hero .rule { display: none; }
  .hero p { font-size: 14px; padding: 0 4px; text-wrap: balance; }

  .dropzone { padding: 22px 14px; margin-bottom: 22px; }
  .dropzone h3 { font-size: 19px; }
  .dropzone p { font-size: 13px; }

  .count { margin: 16px 0 10px; }

  /* Zwei feste Spalten - drei sind auf 390px zu klein zum Erkennen */
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 6px;
    gap: 6px;
  }

  /* Auf dem Handy den Namen dauerhaft zeigen, es gibt kein Hover */
  .tile .who { opacity: 1; font-size: 11px; padding: 16px 7px 5px; }

  .auth-card { padding: 32px 22px; }
  .auth-card h1 { font-size: 30px; }
  .date { font-size: 16px; margin-bottom: 20px; }
  .intro { font-size: 14px; }

  .lb-stage { padding: 52px 8px 4px; }
  .lb-stage img { max-height: calc(100vh - 112px); }
  .lb-nav { width: 38px; height: 38px; background: rgba(255, 255, 255, 0.12); }
  .lb-nav.prev { left: 6px; }
  .lb-nav.next { right: 6px; }
  .lb-close { top: 8px; right: 8px; }
  .lb-bar { padding: 8px 12px 14px; font-size: 12px; flex-wrap: wrap; gap: 6px; }
}

/* Sehr schmale Geraete (iPhone SE) */
@media (max-width: 380px) {
  .brand .names { font-size: 16px; }
  .header-actions select { max-width: 108px; }
}
