/* Hochzeitsgalerie - warmes, ruhiges Layout, mobil zuerst. */
:root {
  color-scheme: dark;
  --bg: #0a1c1c;            /* tiefes Petrol, wie der Hintergrund des Pfaus */
  --surface: #11302f;       /* Smaragd fuer Karten und Leisten */
  --surface-2: #163c3a;
  --ink: #efe6d2;           /* warmes Elfenbein fuer Text */
  --muted: #9fb8b2;
  --accent: #c9a24a;        /* Gold */
  --accent-hover: #dcb95f;
  --accent-soft: rgba(201, 162, 74, .16);
  --teal: #1f8f8b;          /* Pfauenblau fuer Auswahl und Fokus */
  --line: rgba(239, 230, 210, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 10px;
  --bar-h: 76px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.display {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: .01em;
  color: var(--accent);
}

a { color: inherit; }

/* ---------- Anmeldung ---------- */
.page-login {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 24px;
}
.login { width: 100%; max-width: 380px; text-align: center; }
.login h1 { margin: 0 0 12px; font-size: clamp(2rem, 7vw, 2.8rem); }
.login__lead { margin: 0 0 28px; color: var(--muted); }
.login__form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  text-align: left;
}
.login__label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.login__input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.login__input:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.login__error { margin: 12px 0 0; color: #e8907f; font-size: .9rem; }
.login__submit { width: 100%; margin-top: 16px; }

/* ---------- Schaltflaechen ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font: inherit;
  font-size: .93rem;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn--primary { background: var(--accent); color: #0a1c1c; font-weight: 600; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(10, 28, 28, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__home { text-decoration: none; }
.topbar__title { font-size: 1.35rem; }
.topbar__logout { font-size: .85rem; color: var(--muted); text-decoration: none; }
.topbar__logout:hover { color: var(--accent); }

.view { max-width: 1240px; margin: 0 auto; padding: 28px 20px calc(var(--bar-h) + 40px); }
.loading { color: var(--muted); }
.intro { margin: 0 0 28px; max-width: 46ch; color: var(--muted); }

/* ---------- Albumuebersicht ---------- */
.albums { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .albums { grid-template-columns: 1fr 1fr; gap: 24px; } }

.album-card {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  background: var(--accent-soft);
}
.album-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.album-card:hover img { transform: scale(1.03); }
.album-card__label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 46px 20px 18px;
  color: #fff;
  background: linear-gradient(to top, rgba(4, 14, 14, .85), transparent);
}
.album-card__title { display: block; font-family: var(--serif); font-size: 1.6rem; color: var(--accent); }
.album-card__meta { display: block; font-size: .85rem; opacity: .85; }

/* ---------- Albumansicht ---------- */
.album-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.album-head__back { font-size: .88rem; color: var(--muted); text-decoration: none; }
.album-head__back:hover { color: var(--accent); }
.album-head__title { flex: 1 1 100%; margin: 0; font-size: clamp(1.7rem, 5vw, 2.3rem); }
.album-head__meta { color: var(--muted); font-size: .88rem; margin-right: auto; }
.album-head__tools { display: flex; flex-wrap: wrap; gap: 8px; }

.grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (min-width: 700px) { .grid { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }

.tile {
  position: relative;
  padding: 0;
  border: 0;
  background: var(--accent-soft);
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile__check {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(4, 14, 14, .45);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  display: none;
}
body.selecting .tile__check { display: block; }
body.selecting .tile[aria-pressed="true"] img { transform: scale(.9); transition: transform .15s ease; }
.tile[aria-pressed="true"] .tile__check { background: var(--accent); border-color: var(--accent); }
.tile[aria-pressed="true"] .tile__check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #0a1c1c;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  /* minmax(0, 1fr): die Bildflaeche darf nicht ueber den Bildschirm hinauswachsen */
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100dvh;
  background: rgba(4, 14, 14, .97);
}
/* Muss die display-Angabe oben ueberschreiben, sonst bleibt die Lightbox sichtbar. */
.lightbox[hidden] { display: none; }
.lightbox__stage {
  margin: 0;
  min-height: 0;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
}
.lightbox__stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  color: var(--ink);
}
.lightbox__counter { font-size: .85rem; opacity: .75; }
.lightbox__actions { display: flex; gap: 8px; }
.lightbox__close,
.lightbox__nav {
  position: absolute;
  z-index: 2;
  border: 0;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
}
.lightbox__close { top: 14px; right: 14px; width: 42px; height: 42px; font-size: 1.6rem; line-height: 1; }
.lightbox__nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 2rem; line-height: 1; }
.lightbox__nav--prev { left: 10px; }
.lightbox__nav--next { right: 10px; }
.lightbox__close:hover, .lightbox__nav:hover { background: rgba(255, 255, 255, .22); }
.lightbox__nav[hidden] { display: none; }

/* ---------- Auswahlleiste ---------- */
.selbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .4);
}
.selbar[hidden] { display: none; }
.selbar__count { font-size: .92rem; }
.selbar__variants { display: flex; gap: 6px; margin-right: auto; }
.selbar__buttons { display: flex; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .87rem;
  cursor: pointer;
}
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.chip:focus-within { outline: 2px solid var(--teal); outline-offset: 2px; }
.chip input { margin: 0; accent-color: var(--accent); }
.chip__size { color: var(--muted); font-size: .8rem; }
.hint { color: var(--muted); font-size: .85rem; }
.error { color: #e8907f; }

@media (max-width: 560px) {
  .selbar { gap: 8px; }
  .selbar__count { flex: 1 1 100%; }
  .selbar__variants { flex: 1 1 100%; }
  .selbar__buttons { flex: 1 1 100%; }
  .selbar__buttons .btn { flex: 1; }
}
