:root {
  --bg: #f3ece1;
  --surface: #fbf8f3;
  --hole: #e3d8c7;
  --ink: #2b2118;
  --muted: #6d5d4c;
  --line: #dccfbd;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --badge-bg: #dcefe3;
  --badge-ink: #1f6b3d;
  --danger: #b42318;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1712;
    --surface: #251f19;
    --hole: #2a231c;
    --ink: #f1e8db;
    --muted: #b3a390;
    --line: #3a3128;
    --accent: #f97316;
    --accent-ink: #1c1712;
    --badge-bg: #1d3a28;
    --badge-ink: #8fe0ad;
    --danger: #f87171;
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--hole) 2.5px, transparent 3px);
  background-size: 28px 28px;
  color: var(--ink);
  font: 16px/1.55 Inter, system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
h1, h2 { font-family: Fraunces, Georgia, serif; line-height: 1.1; letter-spacing: -.01em; margin: 0 0 .4em; }
h1 { font-size: clamp(30px, 5vw, 44px); }
h2 { font-size: 22px; margin-top: 1.4em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-family: Fraunces, Georgia, serif; font-weight: 800; font-size: 22px; color: var(--ink); text-decoration: none; }
.site-header nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.site-header nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 500; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 16px 48px; flex: 1; }
.site-footer { text-align: center; color: var(--muted); font-size: 14px; padding: 20px 16px; background: var(--surface); border-top: 1px solid var(--line); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.narrow { max-width: 620px; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: 18px; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
label.check input { margin-top: 4px; }
input[type="email"], input[type="text"], input[type="date"], input:not([type]), textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; }
.code-input { font-size: 28px !important; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.optional { font-weight: 400; color: var(--muted); font-size: 13px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
details > summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 16px/1 Inter, system-ui, sans-serif; color: var(--accent-ink); background: var(--accent);
  border: 1px solid var(--accent); border-radius: 8px; padding: 12px 18px; cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-small { padding: 8px 12px; font-size: 14px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.file-btn { align-self: flex-start; }

.flash { padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; }
.flash-error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.flash-notice { background: var(--badge-bg); color: var(--badge-ink); }
.danger { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.danger summary { color: var(--danger); }
.danger form { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.badge {
  display: inline-block; font-size: 12px; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px;
  background: var(--badge-bg); color: var(--badge-ink); vertical-align: middle;
}

.hero { text-align: center; margin: 8px auto 32px; max-width: 640px; }
.hero h1 { font-size: clamp(38px, 7vw, 60px); }
.empty { text-align: center; max-width: 480px; margin: 0 auto; }

.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none; transition: transform .15s; }
.tile:hover { transform: translateY(-2px); }
.tile img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--hole); }
.tile-body { padding: 12px 14px 14px; }
.tile-title { margin: 0 0 6px; font-weight: 600; }
.tile-meta { margin: 0; font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.count { margin-left: auto; }

.photo-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.photo-row { display: grid; grid-template-columns: 88px 1fr auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.photo-row img { width: 88px; height: 66px; object-fit: cover; border-radius: 6px; }
.photo-fields { display: flex; flex-direction: column; gap: 6px; }
.photo-fields input { padding: 6px 8px; font-size: 14px; }
.photo-actions { display: flex; flex-direction: column; gap: 4px; }
.photo-actions button { font: inherit; background: transparent; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); width: 32px; height: 26px; cursor: pointer; }
.photo-actions button:disabled { opacity: .3; cursor: default; }
@media (max-width: 520px) {
  .photo-row { grid-template-columns: 64px 1fr; }
  .photo-row img { width: 64px; height: 48px; }
  .photo-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
}

.bench { max-width: 980px; margin: 0 auto; }
.bench-head { margin-bottom: 16px; }
.album { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; border-radius: var(--radius); scrollbar-width: thin; }
.album-item { flex: 0 0 100%; scroll-snap-align: center; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.album-item img { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; background: #111; }
.album-item figcaption { display: flex; gap: 12px; flex-wrap: wrap; padding: 10px 14px; font-size: 14px; color: var(--muted); }
.album-item time { font-weight: 600; color: var(--ink); }
.step { font-variant-numeric: tabular-nums; }
.album-nav { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.bench-body { margin-top: 24px; }
.prose p { white-space: pre-line; margin: 0; }
.gear { padding-left: 20px; margin: 0; }
.gear li { padding: 2px 0; }
.owner-actions { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Phase 2: filters, tags, votes, reports, admin ---------- */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tags-row { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: thin; }
.chip {
  display: inline-block; white-space: nowrap; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 500;
  text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-homelab.on { background: var(--badge-ink); border-color: var(--badge-ink); color: var(--surface); }
.sorts { margin-left: auto; display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.sorts a { padding: 4px 10px; border-radius: 999px; font-size: 14px; text-decoration: none; color: var(--muted); }
.sorts a.on { background: var(--bg); color: var(--ink); font-weight: 600; }
@media (max-width: 560px) { .sorts { margin-left: 0; } }

.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--hole); color: var(--ink); text-decoration: none; }
a.tag:hover { background: var(--line); }
.tile-stats { margin-left: auto; display: flex; gap: 10px; }
.tile-tags { margin: 8px 0 0; display: flex; gap: 6px; flex-wrap: wrap; }
.pager { display: flex; justify-content: center; gap: 10px; margin-top: 28px; }

.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag-option { flex-direction: row; font-weight: 400; gap: 0; }
.tag-option input { position: absolute; opacity: 0; pointer-events: none; }
.tag-option span { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; cursor: pointer; background: var(--bg); }
.tag-option input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tag-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-actions { display: flex; align-items: center; gap: 16px; }
select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }

.bench-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.bench-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 16px; }
.vote {
  font: 600 16px/1 Inter, system-ui, sans-serif; display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap;
}
.vote.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.vote:disabled { cursor: default; opacity: .7; }
.bench-foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.owner-actions { margin: 0; padding: 0; border: 0; display: flex; gap: 8px; }
.report summary { font-size: 14px; color: var(--muted); font-weight: 500; }
.report form { max-width: 360px; }

.badge-warn { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); margin-left: 8px; }
.admin-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.admin-row { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 16px; }
.admin-row img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; }
.admin-row p { margin: 0 0 4px; }
.report-list { margin: 4px 0 10px; padding-left: 18px; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 520px) { .admin-row { grid-template-columns: 1fr; } }
