/* Sodium rain: wet asphalt, streetlight amber, coolant cyan. Fonts are self-hosted (no third-party requests). */
@font-face { font-family: "Chakra Petch"; font-weight: 600; font-display: swap; src: url(fonts/chakra-petch-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 700; font-display: swap; src: url(fonts/chakra-petch-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }

:root {
  --asphalt: #121a2b;
  --panel: #1a2440;
  --line: #2c3a5e;
  --text: #dbe4f3;
  --muted: #8f9cba;
  --sodium: #ffb347;
  --coolant: #3fe0d0;
  --alarm: #ff5c7a;
  --display: "Chakra Petch", "Bahnschrift", "DIN Alternate", "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--asphalt); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column; color: var(--text); font: 400 1rem/1.6 var(--body);
  background:
    radial-gradient(ellipse 60rem 30rem at 85% -10%, rgba(255, 179, 71, .13), transparent 70%),
    linear-gradient(180deg, transparent 60%, rgba(63, 224, 208, .04)),
    var(--asphalt);
}
/* Rain-streak scanlines, very faint */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 10;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.018) 0 1px, transparent 1px 4px);
}

a { color: var(--coolant); text-underline-offset: .2em; }
a:hover { color: var(--sodium); }
:focus-visible { outline: 2px solid var(--sodium); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0 0 .6em; letter-spacing: .01em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; max-width: 68ch; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- frame */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .9rem clamp(1rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line);
  background: rgba(18, 26, 43, .85);
}
.brand { font: 700 1.2rem var(--display); color: var(--text); text-decoration: none; letter-spacing: .12em; }
.brand::after { content: "_"; color: var(--sodium); animation: blink 1.1s steps(1) infinite; }
.nav { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a:hover, .nav a[aria-current] { color: var(--text); }
.nav .who { display: flex; align-items: center; gap: .5rem; color: var(--sodium); font-family: var(--display); }
.nav .who img { width: 26px; height: 26px; }
.nav form { margin: 0; }

main { flex: 1; width: min(68rem, 100%); margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem) 5rem; }
.narrow { max-width: 30rem; }
footer { padding: 2rem clamp(1rem, 4vw, 2.5rem); color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); }

/* ---------- flashes */
.flash { border-left: 3px solid var(--sodium); background: var(--panel); padding: .75rem 1rem; margin: 0 0 1.5rem; }

/* ---------- the handle plate: the one loud thing */
.plate {
  display: inline-block; font: 700 clamp(2.4rem, 9vw, 5.5rem)/1 var(--display); letter-spacing: .04em;
  color: var(--sodium); padding: .25em .4em .2em; border: 2px solid var(--sodium);
  text-shadow: 0 0 18px rgba(255, 179, 71, .55), 0 0 2px rgba(255, 179, 71, .9);
  box-shadow: 0 0 40px rgba(255, 179, 71, .12), inset 0 0 30px rgba(255, 179, 71, .08);
  position: relative; white-space: nowrap;
}
.plate.sm { font-size: clamp(1.6rem, 5vw, 2.4rem); border-width: 1px; }
.hero .plate { animation: flicker 2.4s ease-out 1; }

.hero { padding: clamp(1rem, 6vw, 4rem) 0 2.5rem; }
.hero .lede { font: 600 clamp(1.15rem, 2.4vw, 1.5rem)/1.35 var(--display); margin: 1.6rem 0 1rem; max-width: 34ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.5rem 2.5rem; margin: 2.5rem 0; padding-top: 2rem; border-top: 1px solid var(--line); }
.facts h3 { color: var(--sodium); }
.facts p { color: var(--muted); margin: 0; }

/* ---------- forms */
label { display: block; font-weight: 600; margin: 1.1rem 0 .35rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: .65rem .75rem; font: inherit; color: var(--text);
  background: var(--asphalt); border: 1px solid var(--line); border-radius: 2px;
}
input:focus, select:focus, textarea:focus { border-color: var(--sodium); outline: none; box-shadow: 0 0 0 3px rgba(255,179,71,.18); }
textarea { min-height: 7rem; resize: vertical; }
input[type=file] { color: var(--muted); }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 1rem; }

.btn {
  display: inline-block; margin-top: 1.3rem; padding: .65rem 1.3rem; cursor: pointer;
  font: 700 1rem var(--display); letter-spacing: .04em; text-decoration: none;
  color: var(--asphalt); background: var(--sodium); border: 0; border-radius: 2px;
  clip-path: polygon(0 0, 100% 0, 100% 70%, calc(100% - 10px) 100%, 0 100%);
}
.btn:hover { background: #ffc773; color: var(--asphalt); }
.btn.ghost { background: transparent; color: var(--sodium); box-shadow: inset 0 0 0 1px var(--sodium); clip-path: none; }
.btn.ok { background: var(--coolant); }
.btn.danger { background: transparent; color: var(--alarm); box-shadow: inset 0 0 0 1px var(--alarm); clip-path: none; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; font-weight: 600; }
.linkbtn:hover { color: var(--text); }

/* ---------- panels & sections */
.section { margin: 0 0 3rem; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 1.25rem 1.4rem; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr); gap: 2.5rem; align-items: start; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }

/* ---------- tasks */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.75rem; }
.filters a { padding: .3rem .8rem; border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-size: .9rem; }
.filters a[aria-current] { color: var(--asphalt); background: var(--text); border-color: var(--text); }
.tasklist { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.tasklist li { border-bottom: 1px solid var(--line); }
.tasklist a { display: grid; grid-template-columns: 4px 1fr auto; gap: 1.1rem; align-items: center; padding: 1.1rem .25rem; text-decoration: none; color: var(--text); }
.tasklist a:hover { background: rgba(255,255,255,.03); }
.tasklist .stripe { align-self: stretch; }
.tasklist h3 { margin: 0 0 .15rem; }
.tasklist .meta { color: var(--muted); font-size: .875rem; }
.pts { font: 700 1.5rem var(--display); color: var(--sodium); text-align: right; }
.pts small { display: block; font: 400 .75rem var(--body); color: var(--muted); }
.diff { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: .3rem; }
.diff i { width: 6px; height: 10px; background: var(--line); }
.diff i.on { background: var(--sodium); }

.clue { font-size: 1.1rem; white-space: pre-line; }
.clue-img { display: block; max-width: 100%; border: 1px solid var(--line); margin: 1rem 0; }
.word { display: block; font: 700 1.35rem var(--display); color: var(--coolant); letter-spacing: .05em; margin: .4rem 0 .8rem; white-space: nowrap; overflow-x: auto; }
.status { display: inline-block; padding: .15rem .6rem; font-size: .85rem; font-weight: 600; border: 1px solid currentColor; }
.status.pending { color: var(--sodium); } .status.done { color: var(--coolant); } .status.rejected { color: var(--alarm); }
.checklist { padding-left: 1.2rem; color: var(--muted); }
.checklist li { margin: .3rem 0; }

/* ---------- people */
.idcard { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 2rem; }
.idcard img { width: 112px; height: 112px; border: 1px solid var(--line); }
.stats { display: flex; gap: 2.5rem; flex-wrap: wrap; margin: 1.5rem 0 2rem; }
.stats div { font: 700 1.8rem var(--display); }
.stats span { display: block; font: 400 .85rem var(--body); color: var(--muted); }
.badges { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .75rem; }
.badges li { padding: .55rem .9rem; border: 1px solid var(--line); background: var(--panel); }
.badges strong { display: block; font-family: var(--display); color: var(--coolant); }
.badges span { color: var(--muted); font-size: .8rem; }
.badges label { margin: 0; font-weight: 400; display: flex; gap: .6rem; align-items: start; cursor: pointer; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .85rem; padding: .5rem; border-bottom: 1px solid var(--line); }
td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.num { font: 700 1.1rem var(--display); color: var(--sodium); }
.who-cell { display: flex; align-items: center; gap: .6rem; }
.who-cell img { width: 28px; height: 28px; }
.scroll { overflow-x: auto; }

.codes { columns: 2; font: 600 1.15rem var(--display); letter-spacing: .06em; padding: 1rem 1.25rem; background: var(--asphalt); border: 1px dashed var(--sodium); list-style: none; margin: 1rem 0; }
.codes li { margin: .3rem 0; }

/* ---------- admin */
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .review { grid-template-columns: 1fr; } }
.review img { width: 100%; border: 1px solid var(--line); }
.flag { color: var(--alarm); font-weight: 600; }
.inline { display: inline; }
.actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; }
.actions select { width: auto; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin: 1.5rem 0 2rem; }
.statgrid a { text-decoration: none; color: var(--text); }

@keyframes blink { 50% { opacity: 0; } }
@keyframes flicker {
  0% { opacity: 0; } 8% { opacity: .9; } 10% { opacity: .2; } 14% { opacity: 1; transform: translateX(-3px); }
  16% { transform: translateX(2px); } 18% { transform: none; } 30% { opacity: .75; } 33%, 100% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }
.mt { margin-top: 2rem; }
.narrow.wide { max-width: 38rem; }
.mt0 { margin: .5rem 0 0; }
.mt-s { margin-top: .75rem; }
progress { width: 100%; height: 6px; appearance: none; border: 0; background: var(--line); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--sodium); }
progress::-moz-progress-bar { background: var(--sodium); }
input[type=file]::file-selector-button { font: 600 .9rem var(--body); color: var(--text); background: var(--line); border: 0; padding: .45rem .9rem; margin-right: .8rem; cursor: pointer; }
details.panel > summary { cursor: pointer; font: 700 1.1rem var(--display); list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: " +"; color: var(--sodium); }
details.panel[open] > summary::after { content: " \2212"; }
details.panel { margin-bottom: 1rem; }
.coords { font-size: 1.05rem; }
.coords a { margin-left: .6rem; }
table.cats td { padding: .4rem .35rem; }
table.cats input[type=text] { min-width: 8.5rem; padding: .45rem .55rem; }
input[type=color] { width: 2.6rem; height: 2.2rem; padding: 2px; background: var(--asphalt); border: 1px solid var(--line); cursor: pointer; }
tr.retired input { opacity: .5; }
.rowactions { white-space: nowrap; }
.rowactions form { display: flex; gap: .9rem; }
.danger-text { color: var(--alarm); }

/* ---------- map */
main.full { width: 100%; max-width: none; padding: 0; }
main.full > .flash { margin: 1rem; }
.mapwrap { display: grid; grid-template-columns: 17rem minmax(0, 1fr); height: calc(100vh - 3.6rem); min-height: 28rem; }
.mapside { padding: 1.25rem; border-right: 1px solid var(--line); overflow-y: auto; background: rgba(18, 26, 43, .92); }
.mapcanvas { position: relative; }
#map { position: absolute; inset: 0; background: #141d31; }
.mapfilters > summary { cursor: pointer; font: 700 1.15rem var(--display); list-style: none; margin-bottom: .5rem; }
.mapfilters > summary::-webkit-details-marker { display: none; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin: .5rem 0 .35rem; padding: 0; }
.catcheck { display: flex; align-items: center; gap: .55rem; font-weight: 400; margin: .3rem 0; cursor: pointer; }
.swatch { width: .85rem; height: .85rem; border-radius: 50%; flex: none; }
.mapside select { padding: .45rem .6rem; }
.jumps { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.25rem 0; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.jumps button { font: 600 .85rem var(--body); color: var(--text); background: var(--panel); border: 1px solid var(--line); padding: .35rem .65rem; cursor: pointer; }
.jumps button:hover { border-color: var(--sodium); color: var(--sodium); }
.mapnote { position: absolute; left: 1rem; bottom: 1rem; right: 4rem; max-width: 34rem; margin: 0; z-index: 2;
  background: var(--panel); border-left: 3px solid var(--sodium); padding: .7rem 1rem; font-size: .9rem; }
.mapnote code { color: var(--sodium); }
.nearform { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 0 0 1rem; }
.nearform label { margin: 0; }
.nearform select { width: auto; }
.nearform .btn { margin-top: 0; padding: .45rem 1rem; }
.zoomfield { width: 5rem; }

/* MapLibre controls in the site palette */
.maplibregl-popup-content { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 2px; padding: .8rem 1rem; box-shadow: 0 6px 24px rgba(0,0,0,.4); font-family: var(--body); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--panel); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--panel); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--panel); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--panel); }
.maplibregl-popup-close-button { color: var(--muted); font-size: 1.1rem; padding: 0 .4rem; }
.pop { display: grid; gap: .3rem; }
.pop strong { font: 700 1.05rem var(--display); }
.pop span { color: var(--muted); font-size: .85rem; }
.maplibregl-ctrl-group { background: var(--panel); border: 1px solid var(--line); border-radius: 2px; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(.85); }
.maplibregl-ctrl-attrib { background: rgba(26, 36, 64, .85) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted); }

@media (max-width: 760px) {
  .mapwrap { grid-template-columns: 1fr; grid-template-rows: auto auto; height: auto; }
  .mapcanvas { order: -1; height: 68vh; min-height: 22rem; }
  .mapside { border-right: 0; border-top: 1px solid var(--line); }
  .mapfilters:not([open]) { margin-bottom: 0; }
}
.thumb { display: block; max-width: 14rem; max-height: 10rem; border: 1px solid var(--line); margin: .4rem 0 .5rem; }
.taskactions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.taskactions form { margin: 0; }
.closedtask { opacity: .7; }

/* ---------- counts, notices, invites */
.count { display: inline-block; min-width: 1.3em; padding: 0 .35em; margin-left: .15rem; font: 700 .75rem/1.35 var(--body); text-align: center; color: var(--asphalt); background: var(--muted); border-radius: 2px; }
.count.hot { background: var(--sodium); }
.notices { list-style: none; padding: 0; margin: 0 0 1.5rem; border-top: 1px solid var(--line); }
.notice { display: grid; grid-template-columns: .6rem 1fr auto; gap: .9rem; align-items: baseline; padding: .85rem .25rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.notice.unread { color: var(--text); }
.notice .dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--line); align-self: center; }
.notice.good .dot { background: var(--coolant); } .notice.bad .dot { background: var(--alarm); }
.notice.security .dot { background: var(--sodium); } .notice.info .dot { background: #9d7bff; }
.notice:not(.unread) .dot { opacity: .45; }
.codehint { font: 600 1rem var(--display); letter-spacing: .06em; color: var(--sodium); }
.invitelist { list-style: none; padding: 0; margin: 1rem 0 .5rem; }
.invitelist li { display: flex; gap: .8rem; align-items: center; padding: .35rem 0; border-top: 1px solid var(--line); }
.invitelist form { margin: 0 0 0 auto; }
.codes.single { columns: 1; }
.nearform input.w-auto { width: 13rem; }
button[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------- pledges */
.potpanel { margin-top: 1.5rem; border-left: 3px solid var(--coolant); }
.potpanel h2 { color: var(--coolant); }
.pts .pot { color: var(--coolant); font-weight: 600; }
.w-amount { max-width: 12rem; }
.address, .mono { font-family: ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", monospace; overflow-wrap: anywhere; }
code.address { display: block; padding: .7rem .9rem; margin: .3rem 0 1rem; background: var(--asphalt); border: 1px dashed var(--coolant); color: var(--text); font-size: .9rem; }
.owed { color: var(--sodium); font-weight: 600; }
.pledge.defaulted, .pledge.disputed { border-left: 3px solid var(--alarm); }
.pop .potline { color: var(--coolant); font-weight: 600; }
