:root {
  --bg: #f7f3ee; --card: #fffdf9; --ink: #2f2a26; --muted: #8a7f75; --line: #e7ded3;
  --accent: #8a9a7b; --accent-ink: #fff; --gold: #b8955a; --danger: #b5523b;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
body.noscroll { overflow: hidden; }
a { color: inherit; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: .01em; margin: .2em 0 .4em; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
h2 { font-size: 1.6rem; }
[hidden] { display: none !important; }
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]), select, textarea {
  width: 100%; padding: .7em .8em; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
label { display: block; margin: 0 0 1em; font-size: .9rem; color: var(--muted); }
label input, label select { margin-top: .3em; color: var(--ink); }
label.check { display: flex; gap: .5em; align-items: center; color: var(--ink); }
.btn, .btn-small {
  display: inline-block; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  padding: .75em 1.5em; text-decoration: none; cursor: pointer; font-weight: 500;
}
.btn-small { padding: .4em 1em; font-size: .9rem; background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-small.on, .btn-small:hover { border-color: var(--accent); }
.danger { color: var(--danger) !important; }
.btn-small.danger { border-color: #e9c9c0; }
.linkish { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; text-decoration: underline; }
form.inline { display: inline; }
.fine { font-size: .85rem; color: var(--muted); }
.notice { background: #eef1ea; border: 1px solid #d6dccf; padding: .8em 1em; border-radius: var(--radius); }
.error { color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 3em 1em; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  padding: .6em 1em; padding-top: max(.6em, env(safe-area-inset-top)); background: rgba(247,243,238,.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-size: 1.4rem; text-decoration: none; }
.topbar nav { display: flex; gap: 1em; align-items: center; font-size: .95rem; }
.topbar nav a { text-decoration: none; color: var(--muted); }
.topbar nav a.on { color: var(--ink); }
.topbar nav a.btn-small { color: var(--ink); }

/* Login */
.login-page main { min-height: 100vh; display: grid; place-items: center; padding: 1.5em;
  background: radial-gradient(circle at 50% 0%, #fff 0, var(--bg) 70%); }
.login-card { width: 100%; max-width: 420px; text-align: center; background: var(--card); padding: 2.5em 2em;
  border-radius: 18px; box-shadow: 0 10px 40px rgba(80,60,40,.08); border: 1px solid var(--line); }
.login-card form { text-align: left; margin-top: 1em; }
.login-card .btn { width: 100%; margin-top: .5em; }
.eyebrow { text-transform: uppercase; letter-spacing: .2em; font-size: .75rem; color: var(--gold); margin: 0; }
.date { font-family: var(--serif); font-size: 1.2rem; color: var(--muted); margin: 0; }
.divider { color: var(--gold); margin: 1em 0; }

/* Gallery */
.hero { position: relative; text-align: center; padding: 2.5em 1em 1.5em; overflow: hidden; }
.hero .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.hero-text { position: relative; }
.names { font-family: var(--serif); font-size: 1.3rem; color: var(--muted); margin: 0; }
.hello { margin-top: 1.2em; display: flex; flex-wrap: wrap; gap: .8em; justify-content: center; align-items: center; }
.featured { padding: 0 1em 1em; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.section-head a { color: var(--muted); font-size: .9rem; }
.strip { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.strip-item { flex: 0 0 auto; border: 0; padding: 0; background: none; cursor: pointer; scroll-snap-align: start; }
.strip-item img { height: 180px; border-radius: 8px; display: block; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6em; justify-content: space-between; align-items: center; padding: .6em 1em; }
.toolbar.sticky { position: sticky; top: 52px; z-index: 10; background: var(--bg); }
.chips { display: flex; gap: .4em; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .35em .9em; cursor: pointer; }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tools { display: flex; gap: .5em; align-items: center; flex-wrap: wrap; }
.tools select { width: auto; padding: .35em .6em; }
.grid { columns: 2 160px; column-gap: 6px; padding: 0 6px 2em; }
@media (min-width: 700px) { .grid { columns: 4 220px; column-gap: 8px; padding: 0 1em 2em; } }
.tile { position: relative; margin: 0 0 6px; break-inside: avoid; cursor: pointer; border-radius: 6px; overflow: hidden; background: #ebe4da; }
.tile img, .tile .ph { display: block; width: 100%; height: auto; }
.tile .ph { display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.tile figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.2em .5em .3em; font-size: .75rem; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.45)); opacity: 0; transition: opacity .2s; }
.tile:hover figcaption { opacity: 1; }
.badge { position: absolute; top: 6px; padding: .1em .5em; border-radius: 999px; font-size: .72rem; background: rgba(0,0,0,.55); color: #fff; }
.badge.play { left: 6px; } .badge.off { right: 6px; background: var(--gold); } .badge.hid { left: 6px; top: auto; bottom: 6px; background: var(--danger); }
.tile.is-hidden img { opacity: .45; }
.moderation .tile .check { position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,.25); color: transparent; display: grid; place-items: center; }
.moderation .tile.selected { outline: 3px solid var(--accent); }
.moderation .tile.selected .check { background: var(--accent); color: #fff; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(15,12,10,.96); display: flex; flex-direction: column; }
.lb-stage { flex: 1; display: grid; place-items: center; min-height: 0; padding: 3em .5em .5em; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-stage p { color: #fff; }
.lb-bar { display: flex; justify-content: space-between; color: #ddd; padding: .8em 1em; padding-bottom: max(.8em, env(safe-area-inset-bottom)); font-size: .9rem; }
.lb-actions { display: flex; gap: 1.2em; }
.lb-actions a { color: #fff; }
.lb-btn { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 50%; width: 44px; height: 44px; font-size: 1.4rem; cursor: pointer; }
.lb-close { top: 10px; right: 10px; }
.lb-prev { left: 10px; top: 50%; } .lb-next { right: 10px; top: 50%; }
@media (hover: none) { .lb-prev, .lb-next { display: none; } }

/* Pages */
.page { max-width: 1100px; margin: 0 auto; padding: 1.5em 1em 3em; }
.upload-page { max-width: 640px; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3em; text-align: center;
  border: 2px dashed var(--accent); border-radius: 16px; padding: 2.5em 1em; background: var(--card); cursor: pointer; color: var(--ink); }
.dropzone.over { background: #eef1ea; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dz-big { font-family: var(--serif); font-size: 1.5rem; }
.dz-small { color: var(--muted); font-size: .85rem; }
.inline-label { display: flex; gap: .6em; align-items: center; }
.inline-label select { width: auto; }
.queue { list-style: none; padding: 0; }
.queue li { display: grid; grid-template-columns: 1fr auto; gap: .2em .8em; padding: .7em 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.queue .q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue .q-size, .queue .q-status { color: var(--muted); text-align: right; }
.queue progress { width: 100%; accent-color: var(--accent); }
.queue li.ok .q-status { color: var(--accent); } .queue li.err .q-status { color: var(--danger); }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 1.5em; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8em; text-align: center; }
.stats b { display: block; font-size: 1.3rem; font-family: var(--serif); }
.stats span { color: var(--muted); font-size: .8rem; }
.admin-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1em; margin-bottom: 2em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.2em 1.4em; }
.card h2 { font-size: 1.3rem; }
.uploader-list { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow: auto; }
.uploader-list li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: .3em 0; }
.bulk { font-size: .9rem; }
.print-card { text-align: center; max-width: 420px; margin: 2em auto; padding: 2em; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.print-card .qr svg { width: 240px; height: 240px; }
@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .print-card { border: 0; margin: 0 auto; }
}

/* Slideshow */
body.slideshow { background: #000; color: #fff; overflow: hidden; height: 100vh; }
body.nocursor { cursor: none; }
.ss-stage { position: fixed; inset: 0; }
.ss-item { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 1s ease; }
.ss-item.in { opacity: 1; }
.ss-caption { position: fixed; left: 2vw; bottom: 2vh; font-size: 2.2vh; opacity: .85; text-shadow: 0 1px 4px #000; }
.ss-title { position: fixed; right: 2vw; bottom: 2vh; font-family: var(--serif); font-size: 3vh; opacity: .8; text-shadow: 0 1px 4px #000; }
.ss-help { position: fixed; top: 2vh; left: 50%; transform: translateX(-50%); font-size: .9rem; opacity: 0; transition: opacity .3s; background: rgba(0,0,0,.6); padding: .4em .9em; border-radius: 6px; }
.ss-help.show { opacity: 1; }
.ss-empty { position: fixed; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 4vh; opacity: .7; }
