:root {
  --paper: #f4f1ea; --card: #fbfaf6; --ink: #1c1b19; --muted: #716b62; --line: #e0dacd;
  --accent: #7d4f32; --accent-ink: #fff; --ok: #3e6b4a; --warn: #9a6a12; --bad: #9b3a2e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
main { width: 100%; max-width: 980px; margin: 0 auto; padding: 32px 24px 64px; flex: 1; }
main.wide { max-width: 1240px; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.eyebrow { display: inline-block; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .5em; }

/* header / footer */
header.site { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 1.35rem; text-decoration: none; letter-spacing: .02em; }
header.site nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: .95rem; }
header.site nav a { text-decoration: none; }
header.site nav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.lang { font-size: .75rem; letter-spacing: .1em; border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }
footer.site { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 28px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: 99px; padding: 10px 22px; font: 500 .95rem var(--sans); text-decoration: none; cursor: pointer; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.small { padding: 6px 14px; font-size: .85rem; }
.btn[disabled], .btn.disabled { opacity: .4; pointer-events: none; }
button.link, .link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); cursor: pointer; }
.link:hover { text-decoration-color: currentColor; }
.danger, .link.danger, button.link.danger { color: var(--bad); }
form.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); }
label small { color: var(--muted); }
input, textarea, select { font: 1rem var(--sans); color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; border-color: var(--accent); }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--ink); }
label.check input { width: auto; margin-top: 4px; accent-color: var(--accent); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; background: var(--card); }
legend { font-family: var(--serif); font-size: 1.1rem; padding: 0 6px; color: var(--ink); }
.checks { display: flex; gap: 18px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; }
.narrow { max-width: 460px; margin: 24px auto; }
.block { margin: 48px 0; }
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; background: #eef2ea; border: 1px solid #cfdac7; }
.flash.error { background: #f6e9e6; border-color: #e5c4bd; }
.flash.warn { background: #f6efdf; border-color: #e6d4ab; }
.danger-zone { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }

/* badges */
.badge { display: inline-block; font-size: .72rem; letter-spacing: .04em; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--muted); white-space: nowrap; }
.badge.approved, .badge.pass, .badge.published { color: var(--ok); border-color: #c6d8ca; background: #f0f6f1; }
.badge.pending, .badge.warn, .badge.draft { color: var(--warn); border-color: #e7d6ad; background: #fbf5e7; }
.badge.rejected, .badge.fail { color: var(--bad); border-color: #e8c7c1; background: #fbf0ee; }
ul.preflight { list-style: none; padding: 0; margin: 8px 0; font-size: .85rem; }
ul.preflight li { padding: 3px 0 3px 18px; position: relative; }
ul.preflight li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
ul.preflight li.warn::before { background: #d39b2a; }
ul.preflight li.fail::before { background: var(--bad); }
details summary { cursor: pointer; font-size: .85rem; color: var(--muted); }

/* protected images */
.protect { position: relative; margin: 0; line-height: 0; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.protect img { display: block; width: 100%; height: auto; pointer-events: none; -webkit-user-drag: none; }
.protect .shield { position: absolute; inset: 0; }
@media print { .protect img { visibility: hidden; } }

/* home */
.hero { padding: 40px 0 36px; max-width: 640px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.lead { font-size: 1.15rem; color: var(--muted); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px; }
.pcard { text-decoration: none; display: block; }
.pcover { aspect-ratio: 4/3; background: #e8e3d8; border-radius: var(--r); overflow: hidden; display: grid; place-items: center; }
.pcover .protect, .pcover .protect img { width: 100%; height: 100%; }
.pcover .protect img { object-fit: cover; }
.pcover .ph { font-family: var(--serif); font-size: 4rem; color: #c9c1b1; }
.pbody { padding: 14px 2px 0; }
.pbody h2 { margin-bottom: .25em; }
.pcard:hover h2 { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* project page */
.phead { max-width: 720px; margin-bottom: 24px; }
.prose p { font-size: 1.05rem; }
.timeline { display: flex; gap: 32px; flex-wrap: wrap; margin: 24px 0 0; }
.timeline div { border-left: 2px solid var(--line); padding-left: 12px; }
.timeline div.active { border-color: var(--accent); }
.timeline dt { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.timeline dd { margin: 0; }
.reqs { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin-bottom: 18px; }
.reqs h3 { font-size: 1rem; margin-bottom: .3em; }
.reqs ul { margin: 0; padding-left: 18px; font-size: .9rem; }
.upload { max-width: 640px; }
.drop { border: 1.5px dashed #cfc7b6; border-radius: var(--r); padding: 28px; text-align: center; cursor: pointer; background: #fff; color: var(--ink); }
.drop.over { border-color: var(--accent); background: #fbf6f1; }
.drop input { border: 0; padding: 0; background: none; }
.drop .preview { max-height: 220px; width: auto; margin: 12px auto 0; border-radius: 6px; }
.mine { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.minecard { display: grid; grid-template-columns: 120px 1fr; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.minecard h3 { margin: 0 0 .3em; }
.minecard .actions { display: flex; gap: 14px; font-size: .85rem; margin: 0; }
.minecard .protect img, .rcard .protect img { border-radius: 6px; }

/* feature (discussion) */
.feature { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 36px; align-items: end; background: #171614; color: #ece8df; border-radius: 14px; padding: 36px; margin: 36px 0; }
.feature .stage .protect img { max-height: 72vh; width: auto; max-width: 100%; margin: 0 auto; }
.feature .muted, .feature .eyebrow { color: #a49d90; }
.feature .btn { background: #ece8df; color: #171614; border-color: #ece8df; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.thumbs a { text-decoration: none; font-size: .85rem; color: var(--muted); }
.thumbs .protect { margin-bottom: 6px; aspect-ratio: 1; overflow: hidden; border-radius: 6px; }
.thumbs .protect img { height: 100%; object-fit: cover; }

/* vote gallery */
.vote-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.votes-left { font-size: .9rem; color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 26px; }
.tile .protect { aspect-ratio: 4/5; background: #e8e3d8; border-radius: 6px; overflow: hidden; display: flex; align-items: center; }
.tile .protect img { max-height: 100%; object-fit: contain; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; min-height: 40px; }
.cap { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.tile { text-decoration: none; }
a.tile .cap { display: block; padding-top: 8px; }
button.vote { font: 500 .8rem var(--sans); border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 99px; padding: 6px 14px; cursor: pointer; white-space: nowrap; }
button.vote:hover { border-color: var(--ink); }
button.vote.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.vote[disabled] { opacity: .35; cursor: default; }
ol.results { list-style: none; padding: 0; margin: 0; counter-reset: r; }
ol.results li { display: grid; grid-template-columns: 28px 64px 1fr auto auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); counter-increment: r; }
ol.results li::before { content: counter(r); font-family: var(--serif); color: var(--muted); }
ol.results .protect { width: 64px; height: 64px; overflow: hidden; border-radius: 4px; }
ol.results .protect img { height: 100%; object-fit: cover; }
.card ol.results li { grid-template-columns: 28px 1fr auto auto; }
.rv { font-variant-numeric: tabular-nums; }

/* dark viewer */
body.dark { --paper: #121211; --card: #1a1918; --ink: #ebe7de; --muted: #9a948a; --line: #2e2c29; background: var(--paper); }
body.dark input, body.dark textarea { background: #1c1b19; color: var(--ink); }
body.dark .btn { background: var(--ink); color: var(--paper); }
body.dark button.vote { background: transparent; color: var(--ink); border-color: #3a3733; }
body.dark button.vote.on { background: #b9825d; border-color: #b9825d; color: #121211; }
.viewer { max-width: 1240px; margin: 0 auto; }
.viewer-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; font-size: .9rem; color: var(--muted); }
.viewer-top .nav { text-decoration: none; font-size: 1.6rem; padding: 0 10px; color: var(--ink); }
.viewer-stage { display: flex; justify-content: center; }
.viewer-stage .protect img { max-height: 82vh; width: auto; max-width: 100%; }
.viewer-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 40px; margin: 36px auto 0; max-width: 980px; }
.viewer-info h1 { font-size: 1.8rem; }
.vote-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.statement { font-family: var(--serif); font-size: 1.08rem; line-height: 1.7; }
.langs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; font-family: var(--sans); }
.langs button { font: .72rem var(--sans); letter-spacing: .08em; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 3px 9px; cursor: pointer; }
.langs button.on { color: var(--ink); border-color: var(--ink); }
.ai-note { font: .75rem var(--sans); color: var(--muted); }
.comments { max-width: 680px; margin: 56px auto 0; }
.comment { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.comment header { font-size: .85rem; display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.comment time { color: var(--muted); }
.comment.hidden-c { opacity: .4; }
.comment-form { margin-top: 18px; }

/* presentation */
body.bare main { max-width: none; padding: 0; }
.present { position: fixed; inset: 0; background: #0b0b0a; cursor: none; }
.present:hover { cursor: default; }
.slide { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4vh 4vw 9vh; opacity: 0; transition: opacity .8s ease; pointer-events: none; }
.slide.on { opacity: 1; }
.slide .protect { display: flex; justify-content: center; max-height: 100%; }
.slide .protect img { max-height: 84vh; max-width: 92vw; width: auto; }
.slide-cap { position: absolute; left: 4vw; bottom: 3.2vh; margin: 0; display: flex; gap: 14px; font-size: .9rem; color: #d8d3c8; letter-spacing: .02em; }
.present-ui { position: absolute; top: 18px; right: 22px; display: flex; gap: 18px; color: #77726a; font-size: .85rem; opacity: 0; transition: opacity .3s; }
.present:hover .present-ui { opacity: 1; }
.present-ui a { text-decoration: none; }

/* admin */
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.table th { text-align: left; font-weight: 500; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr.live td { background: #f3eadf; }
.table tr.blocked td { opacity: .5; }
.tabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tabs a { text-decoration: none; padding: 6px 12px; border-radius: 99px; font-size: .88rem; border: 1px solid transparent; }
.tabs a.on { border-color: var(--line); background: var(--card); }
.review { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 18px; }
.rcard { display: grid; grid-template-columns: 150px 1fr; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.rcard.rejected { opacity: .65; }
.rbody h3 { margin: 0 0 .2em; }
.ractions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.ractions .reject { display: inline-flex; gap: 6px; }
.ractions .reject input { padding: 5px 9px; font-size: .82rem; width: 190px; }
.form-grid { max-width: 820px; }

@media (max-width: 760px) {
  main { padding: 22px 16px 48px; }
  header.site { padding: 14px 16px; }
  .feature { grid-template-columns: 1fr; padding: 20px; }
  .viewer-info { grid-template-columns: 1fr; gap: 20px; }
  .review, .mine { grid-template-columns: 1fr; }
  .rcard { grid-template-columns: 96px 1fr; }
  .minecard { grid-template-columns: 90px 1fr; }
}
