/* Guest photo galleries */
:root {
  --bg: #f4f7f7;
  --surface: #ffffff;
  --ink: #1f2b33;
  --muted: #5d6b73;
  --line: #d6e0e2;
  --accent: #2e5e4e;      /* spruce */
  --accent-ink: #ffffff;
  --danger: #a63a2b;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12191e;
    --surface: #1b252c;
    --ink: #e6ecee;
    --muted: #9aa9b0;
    --line: #2c3a42;
    --accent: #7fb8a4;
    --accent-ink: #10201a;
    --danger: #e0806f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
body.no-scroll { overflow: hidden; }

header.site {
  padding: 18px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: -0.01em; }

main { max-width: 1200px; margin: 0 auto; padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 40px) 64px; }
body.narrow main { max-width: 460px; }

h1 { font-size: clamp(30px, 5.5vw, 52px); line-height: 1.05; letter-spacing: -0.025em; font-weight: 700; margin: 0 0 10px; }
h2 { font-size: 21px; letter-spacing: -0.01em; margin: 0 0 14px; }
.admin h1 { font-size: clamp(26px, 4vw, 38px); }
p { margin: 0 0 14px; }
.meta { color: var(--muted); font-size: 15px; }
.empty { color: var(--muted); padding: 32px 0; }
.note { color: var(--accent); font-weight: 600; }
.error { color: var(--danger); font-weight: 600; }

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

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
  margin-bottom: 24px;
}
.panel.center { text-align: center; }

/* Forms */
label { display: block; font-weight: 600; font-size: 15px; }
label small { font-weight: 400; color: var(--muted); }
input, textarea {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px;
}
textarea { resize: vertical; font-size: 15px; }
.stack { display: grid; gap: 16px; }
.create { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.create .grow { flex: 1 1 280px; }
.create label:not(.grow) { flex: 0 0 150px; }

.pin-form { display: grid; gap: 14px; margin-top: 20px; }
.pin-input {
  font-size: 34px; letter-spacing: 0.4em; text-align: center; font-weight: 700;
  padding: 14px 0 14px 0.4em; font-variant-numeric: tabular-nums;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
  padding: 0 18px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { background: rgba(0,0,0,.45); color: #fff; border-color: rgba(255,255,255,.25); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn-row form { margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }

/* Guest gallery */
.gallery-head { margin-bottom: 28px; }
.gallery-head .btn { margin-top: 6px; }

.grid {
  list-style: none; margin: 0; padding: 0;
  columns: 4 160px; column-gap: 8px;
}
.grid li { break-inside: avoid; margin-bottom: 8px; position: relative; }
.grid a, .grid img { display: block; width: 100%; height: auto; border-radius: 6px; }
.grid a { background: var(--line); overflow: hidden; }
.grid a:hover img { opacity: .9; }

/* RAW badge and viewer button pair */
.badge { position: absolute; left: 6px; top: 6px; font-size: 12px; font-weight: 700; padding: 5px 7px; border-radius: 5px; background: rgba(0,0,0,.6); color: #fff; }
.btn-pair { display: flex; gap: 8px; }
.hint { margin-top: 10px; }

/* Video play badge on thumbnails */
.grid a { position: relative; }
.play {
  position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px 5px 7px; border-radius: 6px; background: rgba(0,0,0,.62); color: #fff;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1;
}
.play .tri { width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 9px; border-color: transparent transparent transparent #fff; }

/* Viewer */
.viewer {
  position: fixed; inset: 0; z-index: 50; background: #0a0d0f;
  display: flex; align-items: center; justify-content: center;
}
.viewer[hidden] { display: none; }
.viewer img, .viewer video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer video { width: 100%; height: calc(100% - 140px); background: #000; }
.viewer-top, .viewer-bar {
  position: absolute; left: 0; right: 0; display: flex; gap: 10px; align-items: center;
  padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left));
}
.viewer-top { top: env(safe-area-inset-top, 0); justify-content: space-between; }
.viewer-bar { bottom: env(safe-area-inset-bottom, 0); justify-content: space-between; color: #fff; font-variant-numeric: tabular-nums; }

/* Admin */
.crumbs { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; font-size: 15px; }
.share-row { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 14px; }
.share-row > div:first-child { flex: 1 1 320px; min-width: 0; }
.lbl { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
code { display: block; font: 600 15px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
code.pin { font-size: 28px; letter-spacing: 0.15em; color: var(--accent); }

.drop {
  position: relative; display: grid; place-items: center; text-align: center; gap: 4px;
  padding: 36px 16px; border: 2px dashed var(--line); border-radius: var(--radius);
  cursor: pointer; font-weight: 600;
}
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop.busy { opacity: .6; pointer-events: none; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.drop small { font-weight: 400; color: var(--muted); }
.folder-btn { position: relative; overflow: hidden; }
.folder-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.folder-btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.errors { color: var(--danger); font-size: 15px; padding-left: 18px; }

.admin-grid { columns: 5 170px; margin-bottom: 24px; }
.admin-grid form { position: absolute; top: 6px; right: 6px; margin: 0; }
.chip { font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1; padding: 7px 10px; border-radius: 6px; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.chip:hover { background: var(--danger); }
.danger-zone { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 22px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list a {
  display: flex; gap: 14px; align-items: center; padding: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.list a:hover { border-color: var(--accent); }
.list .cover { flex: 0 0 64px; height: 64px; border-radius: 6px; background: var(--line); overflow: hidden; }
.list .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.list .info { flex: 1; min-width: 0; display: grid; }
.list .info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-input { text-transform: uppercase; letter-spacing: 0.25em; padding-left: 0.25em; }
.pin-tag { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; white-space: nowrap; }
.list .is-expired a { opacity: .55; }
.purge { margin-top: 18px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
