:root {
  color-scheme: dark;
  --bg: #0f0f10;
  --panel: #1b1b1d;
  --line: #2a2a2d;
  --text: #f3f3f3;
  --dim: #a3a3a8;
  --accent: #f5c518;
  --accent-ink: #141414;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body.viewing { overflow: hidden; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- title ---------- */
.top { padding: max(14px, env(safe-area-inset-top)) 16px 6px; }
h1 { margin: 0; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.sub { margin: 2px 0 0; min-height: 20px; color: var(--dim); font-size: 14px; }

/* ---------- the save bar, which stays at the top while scrolling ---------- */
.bar {
  position: sticky; top: 0; z-index: 3;
  padding: 10px 16px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.big {
  width: 100%; min-height: 52px;
  padding: 12px 16px;
  border: 0; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 17px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
}
.big:disabled { opacity: .55; cursor: default; }
.status { min-height: 20px; margin-top: 6px; color: var(--dim); font-size: 14px; }
.link {
  min-height: 44px; padding: 8px 12px;
  border: 0; background: none; color: var(--dim);
  font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer;
}

/* ---------- the grid of small pictures ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(6, 1fr); } }

.cell {
  position: relative; display: block;
  aspect-ratio: 1; overflow: hidden;
  padding: 0; border: 0; background: #1d1d1f; cursor: pointer;
}
.cell img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cell.fresh img { animation: appear .6s ease; }
@keyframes appear { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }

/* a small tick on photos this phone has already saved */
.cell.saved::after {
  content: "✓";
  position: absolute; right: 6px; bottom: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, .7); color: #fff;
  font: 700 13px/22px system-ui, sans-serif; text-align: center;
}

.empty { margin: 0; padding: 56px 24px; color: var(--dim); text-align: center; }

/* "3 new photos" while the guest is looking further down */
.newpill {
  position: fixed; left: 50%; top: 96px; z-index: 4;
  transform: translateX(-50%);
  min-height: 44px; padding: 10px 18px;
  border: 0; border-radius: 22px;
  background: #fff; color: #111;
  font: 600 15px/1.2 system-ui, sans-serif;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
  cursor: pointer;
}

/* ---------- the larger preview ---------- */
.view {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  background: #000;
}
.view .head {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(6px, env(safe-area-inset-top)) 6px 0 16px;
}
.view .info { color: var(--dim); font-size: 14px; }
.icon {
  min-width: 48px; min-height: 48px;
  border: 0; background: none; color: #fff;
  font-size: 30px; line-height: 1; cursor: pointer;
}
.view .stage {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
.view .stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 64px;
  border: 0; border-radius: 10px;
  background: rgba(0, 0, 0, .45); color: #fff;
  font-size: 34px; line-height: 1; cursor: pointer;
}
.nav.prev { left: 6px; }
.nav.next { right: 6px; }
.nav:disabled { visibility: hidden; }
/* on phones you swipe; the arrows are for mouse and keyboard */
@media (hover: none) { .nav { display: none; } }
.view .foot { padding: 10px 16px max(14px, env(safe-area-inset-bottom)); text-align: center; }

/* ---------- the event's own top: its picture and a few lines ---------- */
.cover { display: block; width: min(58%, 240px); margin: 4px auto 12px; }
.cover img {
  display: block; width: 100%; height: auto;
  border-radius: 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.lines { margin: 6px 0 4px; font-size: 14px; line-height: 1.5; }

/* ---------- videos of a finished album ---------- */
.videos { padding: 14px 16px 18px; border-bottom: 1px solid var(--line); }
.videos h2 { margin: 0 0 10px; font-size: 17px; }
.video + .video { margin-top: 18px; }
.video video {
  display: block; width: 100%; aspect-ratio: 16 / 9; margin-bottom: 10px;
  border-radius: 12px; background: #000;
}
.big.second { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
html:not(.blush) .big.second { color: var(--text); border-color: var(--line); }
.video .status { text-align: center; }

/* ---------- "blush": a light pink look for the whole page ---------- */
html.blush {
  color-scheme: light;
  --bg: #fff6f9;
  --panel: #ffffff;
  --line: #f2cfdc;
  --text: #4a1c40;
  --dim: #8b5c7a;
  --accent: #d6336c;
  --accent-ink: #ffffff;
}
html.blush body { background: var(--bg) linear-gradient(180deg, #ffdfeb 0, #fff6f9 420px) no-repeat; }
html.blush .top { padding-top: max(18px, env(safe-area-inset-top)); text-align: center; }
html.blush h1 {
  color: #c2185b;
  font: 700 38px/1.15 "Snell Roundhand", "Dancing Script", "Segoe Script", cursive;
}
html.blush .lines { color: #6a2c5a; }
html.blush .cell { background: #f7dfe9; }
html.blush .newpill { background: var(--accent); color: #fff; }
html.blush .gone button { background: #f7dfe9; }
html.blush .toast { border: 1px solid var(--line); }
/* the larger preview stays dark, so its small print stays light */
html.blush .view .info, html.blush .view .status { color: #c9c9ce; }

/* ---------- only the photographer sees these ---------- */
.mine {
  margin: 8px 0 2px; padding: 8px 12px;
  border: 1px solid var(--accent); border-radius: 10px;
  font-size: 14px;
}
.danger { color: #ff8a80; }
.view .foot .danger {
  display: block; width: 100%; min-height: 48px; margin-top: 4px;
  border: 1px solid #ff8a80; border-radius: 14px;
  font-size: 16px; font-weight: 600; text-decoration: none;
}
.view .foot .danger:disabled { opacity: .55; }

.removed {
  margin-top: 28px; padding: 16px 0 max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.removed h2 { margin: 0 16px; font-size: 17px; }
.removed .sub { margin: 2px 16px 12px; }
.gone img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; opacity: .45; }
.gone button {
  width: 100%; min-height: 44px;
  border: 0; background: var(--panel); color: var(--text);
  font: 600 14px system-ui, sans-serif; cursor: pointer;
}
.gone button:disabled { opacity: .55; }

.toast {
  position: fixed; left: 12px; right: 12px; z-index: 20;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  max-width: 520px; min-height: 52px; margin: 0 auto;
  padding: 4px 6px 4px 16px; border-radius: 14px;
  background: #fff; color: #111; font-size: 15px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
}
.toast .link { color: #111; font-weight: 600; }
/* while a photo is open the buttons are at the bottom: keep the note off them */
.viewing .toast { bottom: auto; top: calc(max(6px, env(safe-area-inset-top)) + 54px); }

@media (prefers-reduced-motion: reduce) {
  .cell.fresh img { animation: none; }
}
