/* Shared styles for the gallery and admin pages. Same palette as the landing page. */
:root {
  --sky-top: #070b1a;
  --sky: #0c1328;
  --sky-low: #1a2444;
  --bone: #ece4cc;
  --bone-dim: #a9adbf;
  --muted: #6f7590;
  --lamp: #ffb347;
  --pumpkin: #e8762c;
  --blood: #e0605a;
  --moss: #8fc28a;
  --lawn: #05070f;
  --panel: #0d1428;
  --field: #0a1022;
  --line: rgba(236, 228, 204, 0.16);
  --line-strong: rgba(236, 228, 204, 0.3);
  --display: "Grenze Gotisch", "Times New Roman", serif;
  --body: "Work Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--lawn); }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(var(--sky-top), var(--sky) 380px, var(--lawn) 900px) no-repeat, var(--lawn);
  color: var(--bone);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--lamp); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }
h1, h2 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0 0 0.4em; }
h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 4vw, 2.2rem); }
p { margin: 0 0 1em; }
.muted { color: var(--bone-dim); }
.small { font-size: 0.88rem; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--bone);
  text-decoration: none;
  line-height: 1;
}
.brand-sub { font-family: var(--body); font-size: 0.8rem; font-weight: 500; color: var(--lamp); margin-left: 6px; vertical-align: middle; }
.topnav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; }
.topnav a, .topnav .linklike { color: var(--bone-dim); text-decoration: none; font-size: 0.95rem; }
.topnav a:hover, .topnav .linklike:hover { color: var(--bone); }
.topnav a[aria-current="page"] { color: var(--lamp); }
form.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* ---------- Page ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 32px 16px 80px; }
.area-admin .page { max-width: 980px; }
.page.narrow { max-width: 440px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
section + section { margin-top: 48px; }

.flash { padding: 12px 16px; border: 1px solid var(--line); border-left: 3px solid var(--moss); background: var(--panel); margin-bottom: 20px; border-radius: 4px; }
.flash-error { border-left-color: var(--blood); }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.9rem; color: var(--bone-dim); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], textarea, select {
  width: 100%;
  background: var(--field);
  color: var(--bone);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  color-scheme: dark;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--lamp); box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.25); }
.field { margin-bottom: 16px; }
.hint { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.check { display: flex; gap: 8px; align-items: center; color: var(--bone); font-size: 1rem; }
.check input { width: 18px; height: 18px; accent-color: var(--lamp); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid var(--lamp);
  background: var(--lamp);
  color: #1b1206;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #ffc46e; }
.btn.secondary { background: transparent; color: var(--bone); border-color: var(--line-strong); }
.btn.secondary:hover { border-color: var(--bone-dim); }
.btn.danger { background: transparent; color: var(--blood); border-color: rgba(224, 96, 90, 0.5); }
.btn.danger:hover { background: rgba(224, 96, 90, 0.1); }
.btn.small { padding: 5px 10px; font-size: 0.85rem; font-weight: 500; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }

/* ---------- Tables (admin) ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-weight: 500; color: var(--bone-dim); font-size: 0.85rem; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
table.list td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr.past td { color: var(--muted); }
table.list .actions { text-align: right; white-space: nowrap; }
table.list .actions > * { margin-left: 6px; }
.pill { display: inline-block; font-size: 0.78rem; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--bone-dim); }
.pill.live { border-color: var(--moss); color: var(--moss); }
.pill.draft { border-color: var(--lamp); color: var(--lamp); }

@media (max-width: 640px) {
  table.list.stack thead { display: none; }
  table.list.stack tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.list.stack td { display: block; border: 0; padding: 3px 0; }
  table.list.stack .actions { text-align: left; padding-top: 8px; }
  table.list.stack .actions > * { margin: 0 6px 0 0; }
}

/* ---------- Public gallery: years ---------- */
.years { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.year-card { display: block; text-decoration: none; color: var(--bone); }
.year-card .cover {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel) center / cover no-repeat;
  border: 1px solid var(--line);
}
.year-card .cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 45%, rgba(5, 7, 15, 0.9));
}
.year-card .year {
  position: absolute;
  left: 18px;
  bottom: 8px;
  z-index: 1;
  font-family: var(--display);
  font-weight: 700;
  font-size: 4rem;
  line-height: 1;
}
.year-card .meta { padding: 10px 2px 0; }
.year-card .meta strong { display: block; font-weight: 500; }
.year-card:hover .cover { border-color: var(--lamp); }
.year-card:hover .year { color: var(--lamp); }

.empty { padding: 60px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--bone-dim); }

/* ---------- Public gallery: grid + lightbox ---------- */
.gallery-head { margin-bottom: 28px; max-width: 70ch; }
.gallery-head .year-big { font-family: var(--display); font-weight: 700; font-size: clamp(4rem, 14vw, 7rem); line-height: 0.9; margin: 0; }
.gallery-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-top: 6px; }

.no-save, .no-save * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}
.grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 3px; } }
.tile {
  position: relative;
  display: block;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--panel) center / cover no-repeat;
}
.tile:hover { filter: brightness(1.12); }
.tile .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.tile .play::before {
  content: "";
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(5, 7, 15, 0.65) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6l10 6-10 6z' fill='%23ece4cc'/%3E%3C/svg%3E") center / 22px no-repeat;
  border: 1px solid rgba(236, 228, 204, 0.4);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #03050c;
  display: none;
  grid-template-rows: auto 1fr auto;
}
.lightbox.open { display: grid; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; color: var(--bone-dim); font-size: 0.9rem; }
.lb-close, .lb-nav {
  background: rgba(12, 19, 40, 0.7);
  border: 1px solid var(--line);
  color: var(--bone);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.lb-close:hover, .lb-nav:hover { border-color: var(--lamp); color: var(--lamp); }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 8px; }
.lb-media { position: relative; max-width: 100%; max-height: 100%; display: grid; place-items: center; }
.lb-img {
  width: min(92vw, var(--w, 2400px));
  height: min(78vh, var(--h, 2400px));
  background: center / contain no-repeat;
}
.lb-shield { position: absolute; inset: 0; }
.lb-media video { max-width: 92vw; max-height: 78vh; background: #000; border-radius: 4px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-caption { text-align: center; padding: 12px 16px 20px; min-height: 3em; color: var(--bone); max-width: 70ch; margin: 0 auto; }
@media (max-width: 600px) {
  .lb-nav { top: auto; bottom: 8px; transform: none; }
  .lb-caption { padding-bottom: 64px; }
}

.other-years { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; gap: 10px 22px; flex-wrap: wrap; align-items: baseline; }
.other-years a { font-family: var(--display); font-size: 1.6rem; text-decoration: none; color: var(--bone-dim); }
.other-years a:hover { color: var(--lamp); }

/* ---------- Admin: gallery editor ---------- */
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  color: var(--bone-dim);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.over { border-color: var(--lamp); background: rgba(255, 179, 71, 0.06); }
.dropzone strong { color: var(--bone); }
.queue { list-style: none; margin: 14px 0 0; padding: 0; }
.queue li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.queue .bar { grid-column: 1 / -1; height: 4px; background: var(--field); border-radius: 2px; overflow: hidden; }
.queue .bar span { display: block; height: 100%; width: 0; background: var(--lamp); transition: width 0.2s; }
.queue li.done .bar span { background: var(--moss); }
.queue li.failed .bar span { background: var(--blood); width: 100% !important; }
.queue .status { color: var(--bone-dim); }
.queue li.failed .status { color: var(--blood); }

.admin-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 16px; }
.admin-item { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.admin-item.dragging { opacity: 0.4; }
.admin-item.drop-before { box-shadow: -3px 0 0 var(--lamp); }
.admin-item .thumb { position: relative; aspect-ratio: 4 / 3; background: var(--field) center / cover no-repeat; cursor: grab; }
.admin-item .badges { position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; }
.admin-item .badges span { font-size: 0.72rem; padding: 1px 7px; border-radius: 99px; background: rgba(5, 7, 15, 0.8); border: 1px solid var(--line-strong); }
.admin-item .badges .cover-badge { border-color: var(--lamp); color: var(--lamp); }
.admin-item .body { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.admin-item input[type=text] { padding: 6px 8px; font-size: 0.88rem; }
.admin-item .tools { display: flex; gap: 6px; flex-wrap: wrap; }
.saved-tick { font-size: 0.8rem; color: var(--moss); min-height: 1.2em; }
