/* Guest Gallery — black & champagne gold */
:root {
  --bg: #0d0c0a; --card: #171412; --ink: #f0e9db; --muted: #a29885;
  --line: #2c2721; --accent: #c9a35c; --accent-ink: #0d0c0a;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-family: Georgia, serif; font-weight: normal; margin: 0.2em 0; }
h2 { font-size: 1.1rem; margin: 1.4em 0 0.6em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, monospace; word-break: break-all; }
.error { color: var(--accent); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; margin: 16px 0;
}
.card.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }

/* Guest email opt-in listing (admin event page) */
.email-list { margin: 10px 0 14px; padding-left: 20px; }
.email-list li { margin: 5px 0; word-break: break-all; }

.topbar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.topbar h1 { margin-bottom: 0; }

label { display: block; margin: 12px 0; font-weight: 600; }
input[type=text], input[type=password], input[type=date], input[type=email] {
  display: block; width: 100%; min-width: 0; margin-top: 6px; padding: 12px;
  font-size: 16px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink);
}
/* Dark theme: tell the browser so native controls (date picker icon) render light */
input[type=date] { color-scheme: dark; }
fieldset { min-width: 0; }
/* iOS renders date inputs at an intrinsic width that ignores width:100% and
   centers the value. Drop the native chrome on touch devices so the input
   honors its CSS box like a text input. The wheel picker still opens on tap;
   desktop keeps its native calendar icon. */
@media (pointer: coarse) {
  input[type=date] {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    max-width: 100%;
  }
  input::-webkit-date-and-time-value {
    text-align: left;
    /* empty value collapses without native chrome; match text inputs' line box */
    min-height: 1.25em;
  }
}
input::placeholder { color: var(--muted); }
select.input {
  display: block; width: 100%; padding: 12px; font-size: 16px; font-family: inherit;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border-radius: 10px; border: none;
  background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 600;
  font-family: inherit; line-height: 1.25; vertical-align: middle;
  text-decoration: none; cursor: pointer; margin: 6px 6px 6px 0;
}
.btn .e { display: inline-block; line-height: 1; font-size: 0.9em; }
/* The `hidden` attribute must always win: utility classes like .btn set
   `display`, which would otherwise override the UA's [hidden] handling. */
[hidden] { display: none !important; }
.gold-stars { color: var(--accent); }
/* Video builder: arrange strip + playlist */
.arrange-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px;
  min-height: 64px;
}
.arrange-thumb {
  flex: 0 0 56px; width: 56px; height: 56px; border-radius: 8px; overflow: hidden;
  border: 2px solid var(--line); cursor: grab; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: #222; color: #fff;
}
.arrange-thumb img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.arrange-thumb:active { cursor: grabbing; }
.track-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.track-row span:nth-child(2) { flex: 1; }
.btn.mini { padding: 4px 10px; font-size: 0.85rem; }
/* Scrollable soundtrack library: first 4-5 songs visible, rest scroll inside */
#vm-playlist, #vm-tracklist {
  overflow-y: auto; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; margin: 0 0 4px; background: rgba(255,255,255,0.02);
}
#vm-playlist { max-height: 150px; border-color: var(--accent); }
#vm-tracklist { max-height: 216px; }
#vm-playlist .track-row { cursor: grab; background: rgba(255,255,255,0.03); border-radius: 8px; padding: 6px 8px; margin-bottom: 4px; border: 1px solid var(--line); }
.track-num { color: var(--accent); font-weight: bold; min-width: 20px; }
button.btn { appearance: none; -webkit-appearance: none; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: #b3261e; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.link { color: var(--accent); text-decoration: none; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; align-items: center; }

#subform .row { gap: 8px; }
#subemail { flex: 1; min-width: 0; }

.table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; }
.vid { font-size: 24px; }
.nowrap { white-space: nowrap; }
@media (max-width: 700px) { .hide-sm { display: none; } }

.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 20px; }
@media (min-width: 700px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.qr { width: 220px; height: 220px; display: block; margin: 12px 0; border: 1px solid var(--line); border-radius: 8px; }

/* Public upload page */
.hero { text-align: center; padding: 24px 0 8px; }
.hero h1 { font-size: 2rem; font-style: italic; }
.eyebrow { letter-spacing: 0.3em; text-transform: uppercase; font-size: 0.75rem; color: var(--muted); margin: 0; }
.lede { font-size: 1.05rem; line-height: 1.5; max-width: 26em; margin: 12px auto; }
.filebtn {
  display: block; text-align: center; padding: 16px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font-size: 18px; font-weight: 700; cursor: pointer; margin: 4px 0 12px;
}
#dropcard.dragover { outline: 3px dashed var(--accent); outline-offset: 6px; }
/* Desktop-only drag & drop affordances (hidden on touch devices) */
.hint-desktop { display: none; }
@media (hover: hover) and (pointer: fine) {
  .hint-desktop { display: block; }
  .hint-touch { display: none; }
  #dropcard { border: 2px dashed var(--line); }
}
.up { border-top: 1px solid var(--line); padding: 12px 0; }
.up-name { font-weight: 600; word-break: break-all; margin-bottom: 8px; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.up.done .fill { background: #2e7d32; }
.up.failed .fill { background: #b3261e; }
.up-status { margin-top: 6px; }

/* Gallery */
/* Masonry is built by JS: tiles are dealt round-robin into 2-3 flex columns
   so the top row is always the newest uploads (CSS multicol fills down one
   column first, which put older photos in the top row). */
.masonry { display: flex; gap: 10px; align-items: flex-start; }
.mcol { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tile { break-inside: avoid; margin: 0; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--card); }
.tile img { width: 100%; display: block; }
.tile video { width: 100%; display: block; }
.tile { position: relative; }
.tile.selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.tile.selected::after {
  content: '✓'; position: absolute; top: 8px; right: 8px;
  background: var(--accent); color: var(--accent-ink); width: 28px; height: 28px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: bold;
}
#select-toggle.active { background: var(--accent); color: var(--accent-ink); }
#lb-download { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 51; }
.vidbadge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 2rem; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,0.6);
  pointer-events: none;
}
.vidtile {
  aspect-ratio: 4/3; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--muted); gap: 4px;
}
.vidtile span { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.15em; }
#lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
#lightbox[hidden] { display: none; }
#download-selected[hidden] { display: none; }
/* Admin report */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.stat { flex: 1 1 120px; background: #faf7f0; border-radius: 10px; padding: 14px 10px; text-align: center; }
.stat-num { display: block; font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-label { display: block; font-size: 12px; color: #777; margin-top: 4px; }
.top-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.top-item { flex: 0 0 120px; text-align: center; }
.top-item img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; }
.top-item .vid { display: inline-flex; width: 120px; height: 120px; align-items: center; justify-content: center;
  background: #eee; border-radius: 8px; font-size: 28px; }
#lb-body img, #lb-body video { max-width: 100%; max-height: 88vh; border-radius: 8px; }
#lb-close {
  position: absolute; top: 12px; right: 16px; font-size: 2.2rem; line-height: 1;
  background: none; border: none; color: #fff; cursor: pointer;
}
#lb-rate {
  position: absolute; bottom: 78px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 51;
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px; padding: 8px 16px;
}
#lb-rate button {
  background: none; border: none; cursor: pointer; font-size: 1.6rem; line-height: 1;
  color: #8a8578; padding: 2px;
}
#lb-rate button.on { color: var(--accent); }
#lb-heart.on { filter: none; }
.tile { position: relative; }
.quick-rate {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 8px 4px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  opacity: 0.55; transition: opacity 0.2s;
}
.tile:hover .quick-rate, .quick-rate.rated { opacity: 1; }
.quick-rate button {
  background: none; border: none; cursor: pointer; line-height: 1;
  padding: 6px 3px; color: #b9b2a2; font-size: 1.05rem;
}
.qr-stars button { font-size: 0.95rem; color: #8a8578; }
.qr-stars button.on { color: var(--accent); }
#lb-prev, #lb-next {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 52;
  background: rgba(0,0,0,0.4); border: none; border-radius: 50%;
  color: #fff; font-size: 2rem; line-height: 1; cursor: pointer;
  width: 48px; height: 48px;
}
#lb-prev { left: 12px; }
#lb-next { right: 12px; }
#lb-prev[hidden], #lb-next[hidden] { display: none; }

/* Create-video modal + zip-download modal */
#video-modal, #zip-modal, #mv-modal, #share-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
#video-modal[hidden], #zip-modal[hidden], #mv-modal[hidden], #share-modal[hidden] { display: none; }
.vm-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 28px; max-width: 440px; width: 100%;
  max-height: 90vh; overflow-y: auto; position: relative; color: var(--ink);
}
.vm-box h2 { margin-top: 0; }
#vm-close, #zip-close, #mv-close, #sh-close {
  position: absolute; top: 10px; right: 14px; font-size: 1.8rem; line-height: 1;
  background: none; border: none; cursor: pointer; color: var(--muted);
}
.vm-radio { display: block; margin: 6px 0; cursor: pointer; }
/* Share-popup button row: all three actions side by side, slightly compact. */
.sh-row { display: flex; gap: 8px; }
.sh-row .btn { flex: 1 1 0; margin: 0; padding: 10px 2px; font-size: 13px; white-space: nowrap; }
.vm-bar { background: var(--line); border-radius: 8px; height: 12px; overflow: hidden; margin: 12px 0; }
#vm-bar-fill, #zip-bar-fill {
  height: 100%; width: 8%; border-radius: 8px;
  background: linear-gradient(90deg, #a8823f, var(--accent));
  transition: width 1.2s ease;
}
#vm-done .btn, #vm-form .btn { margin-right: 8px; margin-top: 4px; }

/* Slideshow player */
#slideshow {
  position: fixed; inset: 0; background: #000; z-index: 60;
  display: flex; align-items: center; justify-content: center;
}
#slideshow[hidden] { display: none; }
#ss-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#ss-stage img, #ss-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
#ss-stage img.ss-zoom { animation: ssKenBurns 6s ease-out forwards; }
@keyframes ssKenBurns { from { transform: scale(1); } to { transform: scale(1.12); } }
#ss-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 62;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; color: #fff;
  background: linear-gradient(rgba(0,0,0,0.55), transparent);
}
#ss-count { font-size: 0.95rem; opacity: 0.9; }
#ss-close { background: none; border: none; color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; }
.ss-top-btns { display: flex; align-items: center; gap: 18px; }
#ss-fullscreen { background: none; border: none; color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; opacity: .9; }
#ss-controls {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 62;
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 18px; background: linear-gradient(transparent, rgba(0,0,0,0.55));
}
#ss-controls button {  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.25);
  color: #fff; font-size: 1.2rem; width: 52px; height: 52px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#ss-controls button:hover { background: rgba(255,255,255,0.28); }
/* Fullscreen slideshow: hide all chrome (arrows, controls, counter) — just the media.
   Esc exits fullscreen and brings everything back. */
#ss-top, #ss-controls { transition: opacity .4s ease; }
#slideshow:fullscreen #ss-top,
#slideshow:fullscreen #ss-controls { opacity: 0; pointer-events: none; }

/* Brand header */
.brand { text-align: center; padding: 20px 16px 0; }
.brand-logo { max-width: 220px; height: auto; filter: brightness(0) invert(1); }

/* My videos list */
.mv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.mv-row:first-child { border-top: none; }
.mv-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.mv-actions .btn { padding: 8px 14px; font-size: 14px; }

/* My videos inline preview */
.mv-item { border-top: 1px solid var(--line); }
.mv-item:first-child { border-top: none; }
.mv-row { border-top: none; }
.mv-player { padding: 4px 0 14px; }
.mv-player video { display: block; width: 100%; border-radius: 8px; background: #000; max-height: 70vh; }

/* Delete-confirmation modal */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; max-width: 420px; width: 100%;
}
.modal-box h2 { margin-top: 0; }
.modal-box input[type=text] { margin: 8px 0 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Gallery footer — brand + social links on every event gallery */
.gallery-footer { text-align: center; padding: 36px 16px 28px; color: var(--muted); }
.gallery-footer .gf-icons { display: flex; gap: 20px; justify-content: center; margin-bottom: 12px; }
.gallery-footer .gf-icons a { color: var(--muted); display: inline-flex; }
.gallery-footer .gf-icons a:hover { color: var(--accent); }
.gallery-footer .gf-icons svg { width: 22px; height: 22px; }
.gallery-footer p { margin: 4px 0; font-size: 0.85rem; }

/* Audio guestbook */
.big-timer { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
#audiocard input[type="text"] { width: 100%; box-sizing: border-box; }
