@view-transition { navigation: auto; }

:root {
  color-scheme: dark;
  --night: #0c1a2b;
  --night-2: #12263d;
  --night-3: #1a3352;
  --line: #2a4566;
  --snow: #f4f1ea;
  --mist: #a9b8cb;
  --gold: #f5c451;
  --gold-2: #ffd97a;
  --red: #e8434b;
  --green: #4cc38a;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 75rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 1rem/1.55 var(--sans);
  color: var(--snow);
  background:
    radial-gradient(60rem 30rem at 85% -10%, #1f3d66 0%, transparent 60%),
    radial-gradient(40rem 20rem at 0% 0%, #2a1830 0%, transparent 60%),
    var(--night);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, video { max-width: 100%; display: block; }
a { color: var(--gold-2); text-underline-offset: 0.2em; }
a:hover { color: #fff; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; text-wrap: balance; margin: 0 0 0.5rem; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); }
p { text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--night); padding: 0.5rem 1rem; z-index: 2000; }
.skip:focus { left: 0.5rem; }
.muted { color: var(--mist); }
.small { font-size: 0.875rem; }
.hp { position: absolute !important; left: -9999px !important; height: 0; width: 0; opacity: 0; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  background: color-mix(in oklab, var(--night) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--snow); text-decoration: none; font-family: var(--serif); line-height: 1.05; font-size: 0.95rem; }
.brand b { font-size: 1.1rem; color: var(--gold); }
.brand-mark { font-size: 1.6rem; color: var(--gold); text-shadow: 0 0 12px rgb(245 196 81 / 0.7); }
.site-header nav { margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.site-header nav ul { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.site-header nav a { display: block; padding: 0.5rem 0.75rem; color: var(--mist); text-decoration: none; border-radius: 999px; white-space: nowrap; font-size: 0.95rem; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--snow); background: var(--night-3); }
@media (max-width: 52rem) {
  .site-header { flex-wrap: wrap; }
  .site-header nav { order: 3; width: 100%; margin: 0 -0.5rem; }
  .site-header > .btn { margin-left: auto; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.1rem; border-radius: 999px; border: 1px solid transparent;
  font: 600 0.95rem/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-gold { background: var(--gold); color: #2a1a00; box-shadow: 0 0 0 0 rgb(245 196 81 / 0.5); }
.btn-gold:hover { background: var(--gold-2); color: #2a1a00; box-shadow: 0 0 24px rgb(245 196 81 / 0.45); }
.btn-ghost { background: transparent; color: var(--snow); border-color: var(--line); }
.btn-ghost:hover { background: var(--night-3); color: #fff; }
.btn:disabled { opacity: 0.7; cursor: default; }
.btn-lg { padding: 0.85rem 1.6rem; font-size: 1.05rem; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.danger { color: #ff9a9f; border-color: #6b2a30; }

/* Hero */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 1.5rem; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 22px; pointer-events: none;
  background: radial-gradient(circle at 10px 6px, var(--red) 4px, transparent 5px) 0 0 / 80px 22px,
              radial-gradient(circle at 30px 10px, var(--gold) 4px, transparent 5px) 0 0 / 80px 22px,
              radial-gradient(circle at 50px 6px, var(--green) 4px, transparent 5px) 0 0 / 80px 22px,
              radial-gradient(circle at 70px 10px, #5aa9ff 4px, transparent 5px) 0 0 / 80px 22px;
  filter: drop-shadow(0 0 6px rgb(255 220 120 / 0.6));
  animation: twinkle 2.4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.65; } to { opacity: 1; } }
.hero-inner { max-width: var(--max); margin: 0 auto; padding-inline: clamp(1rem, 3vw, 2rem); }
.hero h1 em { font-style: italic; color: var(--gold); text-shadow: 0 0 30px rgb(245 196 81 / 0.35); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; color: var(--gold); margin: 0 0 0.5rem; font-weight: 700; }
.lede { font-size: clamp(1.05rem, 1.8vw, 1.2rem); color: var(--mist); max-width: 42rem; }

/* Explorer */
.explorer { max-width: var(--max); margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; }
.search { flex: 1 1 16rem; }
input, select, textarea {
  font: inherit; color: var(--snow); background: var(--night-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.8rem; width: 100%;
}
textarea { field-sizing: content; min-height: 5lh; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgb(245 196 81 / 0.25); }
input:user-invalid, [aria-invalid="true"] { border-color: var(--red); }
input[type=search] { border-radius: 999px; padding-inline: 1.1rem; }
select { width: auto; }
.county select { border-radius: 999px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin: 0; background: var(--night-2); }
.seg legend { padding: 0; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 0.45rem 0.9rem; border-radius: 999px; color: var(--mist); font-size: 0.92rem; white-space: nowrap; }
.seg input:checked + span { background: var(--gold); color: #2a1a00; font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.seg.big { display: flex; flex-wrap: wrap; border-radius: var(--radius); }
.seg.big legend { float: left; width: 100%; padding: 0.4rem 0.6rem; color: var(--mist); font-size: 0.9rem; }
.seg.big label { flex: 1 1 12rem; }
.seg.big span { text-align: center; border-radius: 10px; padding: 0.7rem; }

.explorer-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 56rem) { .explorer-grid { grid-template-columns: minmax(0, 1fr) 22rem; } }
.map { height: clamp(22rem, 62vh, 40rem); border-radius: var(--radius); border: 1px solid var(--line); background: var(--night-2); }
.results { background: var(--night-2); border: 1px solid var(--line); border-radius: var(--radius); max-height: clamp(22rem, 62vh, 40rem); overflow: auto; overscroll-behavior: contain; }
.result-count { margin: 0; padding: 0.75rem 1rem; color: var(--mist); font-size: 0.9rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--night-2); }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list a { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "dot title votes" "dot sub votes"; column-gap: 0.7rem; padding: 0.7rem 1rem; text-decoration: none; color: var(--snow); border-bottom: 1px solid rgb(42 69 102 / 0.5); }
.result-list a:hover { background: var(--night-3); }
.r-title { grid-area: title; font-weight: 600; }
.r-sub { grid-area: sub; color: var(--mist); font-size: 0.85rem; }
.r-sub[data-dist]::after { content: " · " attr(data-dist); color: var(--gold); }
.r-votes { grid-area: votes; color: var(--gold); font-size: 0.85rem; align-self: center; }
.dot { grid-area: dot; width: 12px; height: 12px; border-radius: 50%; align-self: center; }
.dot-neighborhood, .pin-neighborhood span { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.dot-show, .pin-show span { background: var(--red); box-shadow: 0 0 10px var(--red); }
.pin span { display: block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; }
.popup { display: grid; gap: 0.2rem; color: #111 !important; text-decoration: none; min-width: 12rem; }
.popup img { width: 100%; height: 8.5rem; object-fit: cover; border-radius: 8px; margin-bottom: 0.3rem; }
.popup span { color: #444; font-size: 0.85rem; }
.leaflet-container { font: inherit; }

/* Map tiles: dim them so the lights pop */
.leaflet-tile-pane { filter: invert(1) hue-rotate(195deg) brightness(0.85) contrast(0.92) saturate(0.55); }
@media (prefers-contrast: more) { .leaflet-tile-pane { filter: none; } }

/* Sections & cards */
.section { max-width: var(--max); margin: 0 auto; padding: clamp(2rem, 5vw, 3.5rem) clamp(1rem, 3vw, 2rem); }
.section.narrow > * { max-width: 44rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head { max-width: var(--max); margin: 0 auto; padding: clamp(2rem, 5vw, 3.5rem) clamp(1rem, 3vw, 2rem) 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.card { container-type: inline-size; background: var(--night-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform 0.2s, border-color 0.2s; }
.card:hover { transform: translateY(-3px); border-color: var(--gold); }
.card-link { color: inherit; text-decoration: none; display: block; }
.card-media { position: relative; aspect-ratio: 3 / 2; background: var(--night-3); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-ph { display: grid; place-items: center; height: 100%; font-size: 2.5rem; color: var(--gold); opacity: 0.5; }
.card-body { padding: 0.9rem 1rem 1rem; }
.card-body h3 { font-size: 1.2rem; margin: 0 0 0.15rem; }
.card-body p { margin: 0; }
.card-meta { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.4rem !important; font-size: 0.88rem; color: var(--gold); }
.badge { position: absolute; top: 0.6rem; left: 0.6rem; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; }
.badge-neighborhood { background: var(--gold); color: #2a1a00; }
.badge-show { background: var(--red); color: #fff; }
.empty { color: var(--mist); }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1rem; }
.panel { background: var(--night-2); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.25rem, 3vw, 2rem); }
.panel-red { background: linear-gradient(135deg, #4a1520, #2a1022); border-color: #6b2a35; }
.panel-sm { padding: 1rem 1.1rem; }
.panel p:last-child { margin-bottom: 0; }

/* Detail */
.detail { max-width: var(--max); margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem); }
.crumbs { color: var(--mist); font-size: 0.9rem; margin: 0 0 0.5rem; }
.crumbs a { color: var(--mist); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 1rem 0; }
.vote-form { display: flex; align-items: center; gap: 0.6rem; }
.vote-count { background: rgb(0 0 0 / 0.18); padding: 0.1rem 0.5rem; border-radius: 999px; }
.vote-btn.pop { animation: pop 0.5s; }
@keyframes pop { 50% { transform: scale(1.08); box-shadow: 0 0 36px rgb(245 196 81 / 0.8); } }
.flash { background: var(--night-3); border-left: 4px solid var(--gold); padding: 0.75rem 1rem; border-radius: 8px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); grid-auto-rows: 10rem; gap: 0.5rem; margin: 1rem 0 2rem; }
.g-item { padding: 0; border: 0; background: var(--night-3); border-radius: 10px; overflow: hidden; cursor: zoom-in; }
.g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.g-item:hover img { transform: scale(1.04); }
.g-hero { grid-column: span 2; grid-row: span 2; }
.g-video { grid-column: span 2; grid-row: span 2; margin: 0; background: #000; border-radius: 10px; overflow: hidden; }
.g-video video { width: 100%; height: 100%; object-fit: contain; }
.g-video figcaption { padding: 0.4rem; font-size: 0.85rem; color: var(--mist); }
@media (max-width: 30rem) { .g-hero, .g-video { grid-column: 1 / -1; } }
.gallery-empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--mist); margin: 1rem 0 2rem; }

.detail-grid { display: grid; gap: 2rem; }
@media (min-width: 56rem) { .detail-grid { grid-template-columns: minmax(0, 1fr) 20rem; } }
.desc { font-size: 1.1rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.2rem; margin: 1.25rem 0; }
.facts dt { color: var(--mist); }
.facts dd { margin: 0; }
.mini-map { height: 16rem; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 1rem; }
.installer-credit { font-size: 0.9rem; color: var(--mist); margin: 0 0 1rem; }
.foot-h { font-weight: 700; color: var(--gold); margin: 0 0 0.4rem; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78rem; }

.comments { margin-top: 2.5rem; }
.comment-list { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.75rem; }
.comment-list li { background: var(--night-2); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; }
.comment-list p { margin: 0; }
.c-meta { font-size: 0.85rem; color: var(--mist); margin-bottom: 0.25rem !important; }
.comment-form { display: grid; gap: 0.75rem; max-width: 36rem; }

.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; }
.lightbox::backdrop { background: rgb(5 10 20 / 0.92); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox img { max-width: 94vw; max-height: 84dvh; object-fit: contain; border-radius: 8px; }
.lb-cap { position: absolute; bottom: 1rem; left: 0; right: 0; text-align: center; color: var(--mist); margin: 0; }
.lb-close, .lb-prev, .lb-next { position: absolute; background: rgb(0 0 0 / 0.5); color: #fff; border: 0; width: 3rem; height: 3rem; border-radius: 50%; font-size: 2rem; line-height: 1; cursor: pointer; }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: 1rem; top: 50%; }
.lb-next { right: 1rem; top: 50%; }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }

/* Forms */
.stack-form { display: grid; gap: 1rem; }
.stack-form label { display: grid; gap: 0.35rem; font-weight: 600; font-size: 0.95rem; }
.stack-form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: 1rem; }
.hint, .hint-inline { font-weight: 400; color: var(--mist); font-size: 0.85rem; }
.req { color: var(--gold); font-weight: 400; }
.check { display: flex !important; grid-template-columns: none; align-items: flex-start; gap: 0.6rem !important; font-weight: 400 !important; }
.check input { width: 1.2rem; height: 1.2rem; margin-top: 0.15rem; flex: none; accent-color: var(--gold); }
.geo-row { display: flex; gap: 0.5rem; }
.pick-map { height: 20rem; border-radius: var(--radius); border: 1px solid var(--line); }
.form-error { color: #ffb3b7; background: #3a1419; border: 1px solid #6b2a30; padding: 0.7rem 1rem; border-radius: 10px; margin: 0; }
progress { width: 100%; height: 0.6rem; accent-color: var(--gold); }
.file-preview { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.file-preview:empty { display: none; }
.file-preview li { width: 5rem; height: 5rem; border-radius: 8px; overflow: hidden; background: var(--night-3); display: grid; place-items: center; font-size: 0.7rem; text-align: center; padding: 0.2rem; word-break: break-all; }
.file-preview img { width: 100%; height: 100%; object-fit: cover; }
#submit-form:not([data-type="show"]) .show-only { display: none; }
#submit-form[data-type="show"] .neighborhood-only { display: none; }

/* Leaderboard */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
.board-col { background: var(--night-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.board-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.board-list li { display: grid; grid-template-columns: 2rem 1fr auto; align-items: center; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid rgb(42 69 102 / 0.5); }
.board-list li:first-child .rank { background: var(--gold); color: #2a1a00; }
.rank { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; background: var(--night-3); font-weight: 700; }
.board-list a { text-decoration: none; color: var(--snow); font-weight: 600; display: grid; }
.board-list small { color: var(--mist); font-weight: 400; }
.score { color: var(--gold); font-weight: 700; }

/* Installers */
.installers { display: grid; gap: 1rem; }
.installer { background: var(--night-2); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.25rem, 3vw, 2rem); }
.installer.featured { border-color: var(--gold); box-shadow: 0 0 40px rgb(245 196 81 / 0.12); }
.installer-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.disclosure { margin-top: 1.5rem; }
.prose h2 { margin-top: 2rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 2.5rem clamp(1rem, 3vw, 2rem) 1.5rem; background: rgb(0 0 0 / 0.2); }
.footer-grid { max-width: var(--max); margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 2rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.3rem; }
.footer-grid a { color: var(--mist); }
.brand-foot { font-family: var(--serif); font-size: 1.2rem; color: var(--gold); margin: 0 0 0.3rem; }
.fine { max-width: var(--max); margin: 2rem auto 0; color: var(--mist); font-size: 0.82rem; }

/* Admin */
.admin-main { max-width: 90rem; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 4rem; width: 100%; }
.admin-header form { margin: 0; }
.admin-stats { display: flex; flex-wrap: wrap; gap: 1.5rem; color: var(--mist); }
.admin-stats b { color: var(--gold); font-size: 1.4rem; }
.admin-table { width: 100%; border-collapse: collapse; margin: 1rem 0 2rem; font-size: 0.93rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { color: var(--mist); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.actions form { margin: 0; }
.pill { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: var(--night-3); margin-right: 0.3rem; }
.pill-published { background: #164a33; color: #9ff0c6; }
.pill-pending { background: #4a3a10; color: var(--gold-2); }
.pill-rejected, .pill-hidden { background: #4a1520; color: #ffb3b7; }
.admin-cols { display: grid; gap: 2rem; }
@media (min-width: 70rem) { .admin-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.admin-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.admin-media figure { margin: 0; background: var(--night-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.admin-media figure.is-pending { border-color: var(--gold); }
.admin-media img, .admin-media video { width: 100%; height: 10rem; object-fit: cover; background: #000; }
.admin-media figcaption { padding: 0.6rem; display: grid; gap: 0.5rem; font-size: 0.85rem; }
.inline-form { display: flex; gap: 0.3rem; }
.inline-form input { padding: 0.3rem 0.5rem; font-size: 0.85rem; }
.w-num { width: 4.5rem !important; flex: none; }
.admin-filters input { max-width: 20rem; }
.admin-comments { list-style: none; padding: 0; display: grid; gap: 0.75rem; }
.admin-comments li { background: var(--night-2); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; }
.admin-comments p { margin: 0 0 0.4rem; }
.plain { padding-left: 1.2rem; }
.login { display: grid; place-items: center; min-height: 100dvh; padding: 1rem; }
.login form { width: min(100%, 24rem); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  @view-transition { navigation: none; }
}
@media (forced-colors: active) {
  .btn { border: 1px solid ButtonText; }
  .pin span, .dot { forced-color-adjust: none; }
}
