/* Where Is Pat Pooping: mobile-first styles */
:root {
  --ink: #14213d;
  --ink-2: #3d4a66;
  --muted: #6b7690;
  --bg: #f7f8fb;
  --card: #ffffff;
  --line: #e3e7ef;
  --sun: #ffc93c;
  --sun-ink: #4a3500;
  --blue: #2d6cdf;
  --green: #1f9d63;
  --amber: #d98a00;
  --red: #d64545;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 6px 20px rgba(20, 33, 61, .07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
img { max-width: 100%; }
code { background: rgba(0,0,0,.06); padding: 0 .3em; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--sun); padding: .5rem 1rem; z-index: 2000; }
.skip:focus { left: .5rem; }
.fine { color: var(--muted); font-size: .875rem; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 999px;
  padding: .7rem 1.15rem; font: inherit; font-weight: 650; cursor: pointer;
  background: var(--card); color: var(--ink); white-space: nowrap;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(45,108,223,.45); outline-offset: 2px;
}
.btn-primary { background: var(--sun); color: var(--sun-ink); box-shadow: 0 2px 0 #d9a514; }
.btn-primary:hover { background: #ffd35f; }
.btn-ghost { background: rgba(255,255,255,.9); border-color: var(--line); }
.btn-small { padding: .45rem .9rem; font-size: .9rem; }
.btn-danger { color: var(--red); }
.btn[disabled] { opacity: .6; cursor: progress; }
.link-btn { background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; padding: 0; }
.link-btn:hover, .topnav a:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .6rem 1rem; background: rgba(255,255,255,.94);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .45rem; color: var(--ink); text-decoration: none; font-weight: 750; }
.brand-mark { font-size: 1.4rem; }
.brand-name b { color: var(--blue); }
.topnav { display: flex; align-items: center; gap: .9rem; font-size: .95rem; }
.topnav a, .topnav .link-btn { display: none; color: var(--ink); text-decoration: none; }
@media (min-width: 760px) { .topnav a, .topnav .link-btn { display: inline; } }

.config-banner { background: #fff4d6; color: var(--sun-ink); padding: .6rem 1rem; font-size: .9rem; text-align: center; border-bottom: 1px solid #f1dc9c; }

/* ---------- hero ---------- */
.hero {
  position: relative; color: #fff;
  background: linear-gradient(180deg, rgba(20,33,61,.82), rgba(20,33,61,.70)), url("assets/hero.jpg") center/cover no-repeat;
  padding: 2.25rem 1rem 2rem;
}
.hero-inner { max-width: 980px; margin: 0 auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--sun); margin: 0 0 .4rem; }
.hero h1 { font-size: clamp(1.9rem, 6vw, 3.1rem); line-height: 1.08; margin: 0 0 .7rem; letter-spacing: -.02em; }
.hero h1 span { color: var(--sun); }
.lede { font-size: 1.05rem; max-width: 40rem; margin: 0 0 1.25rem; color: #e7ecf7; }

.search {
  display: grid; gap: .5rem;
  grid-template-columns: 1fr auto;
  background: rgba(255,255,255,.12); padding: .5rem; border-radius: 18px;
}
.search input, .search select {
  font: inherit; font-size: 1.05rem; border: 0; border-radius: 12px; padding: .75rem .9rem;
  background: #fff; color: var(--ink); min-width: 0;
}
.search .btn-primary { grid-column: 1 / -1; }
.search .btn-ghost { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .search { grid-template-columns: 1fr auto auto auto; align-items: center; border-radius: 999px; }
  .search input { border-radius: 999px; }
  .search select { border-radius: 999px; }
  .search .btn-primary, .search .btn-ghost { grid-column: auto; }
}
.search-help { font-size: .82rem; color: #c9d3ea; margin: .5rem .25rem 1rem; }

.chips { display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; flex-wrap: nowrap; }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 760px) { .chips { flex-wrap: wrap; } }
.chip {
  flex: 0 0 auto; font: inherit; font-size: .9rem; cursor: pointer;
  border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.08); color: #fff;
  padding: .42rem .8rem; border-radius: 999px;
}
.chip[aria-pressed="true"] { background: var(--sun); border-color: var(--sun); color: var(--sun-ink); font-weight: 650; }

/* ---------- results ---------- */
.results-wrap { scroll-margin-top: 4rem; max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 1rem; }
.results-head h2 { margin: 0; font-size: 1.3rem; }
.results-sub { margin: .2rem 0 1rem; color: var(--muted); }
.results-grid { display: grid; gap: 1rem; }
.map { height: 300px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #dfe6f2; z-index: 0; }
@media (min-width: 960px) {
  .results-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
  .map { position: sticky; top: 4.5rem; height: calc(100vh - 6rem); max-height: 720px; order: 2; }
  .result-list { order: 1; }
}

.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; border: 2px solid transparent; transition: border-color .15s ease;
}
.card.active { border-color: var(--blue); }
.card-top { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.card h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.card h3 button { all: unset; cursor: pointer; }
.card h3 button:hover { text-decoration: underline; }
.addr { color: var(--ink-2); font-size: .9rem; margin: .15rem 0 0; }
.dist { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.score {
  flex: 0 0 auto; text-align: center; min-width: 4.2rem; padding: .35rem .5rem; border-radius: 12px;
  background: #eef2fa; font-weight: 800; font-size: 1.35rem; line-height: 1.1;
}
.score small { display: block; font-size: .65rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.score.none { font-size: .8rem; font-weight: 650; color: var(--muted); }
.score.s-approved { background: #e3f6ec; color: #0f6a41; }
.score.s-solid { background: #e6efff; color: #1c4fae; }
.score.s-emerg { background: #fff3dc; color: #8a5800; }
.score.s-hold { background: #fde8e8; color: #9c2424; }

.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; }
.b-approved { background: var(--green); color: #fff; }
.b-solid { background: var(--blue); color: #fff; }
.b-emerg { background: var(--amber); color: #fff; }
.b-hold { background: var(--red); color: #fff; }
.badge-legend { display: flex; flex-wrap: wrap; gap: .4rem; margin: .75rem 0; }

.meta { display: flex; flex-wrap: wrap; gap: .35rem; margin: .6rem 0 0; }
.tag { font-size: .78rem; background: #f1f3f8; color: var(--ink-2); padding: .18rem .5rem; border-radius: 999px; }
.tag.verified { background: #e3f6ec; color: #0f6a41; font-weight: 650; }
.tag.unverified { background: #fff4d6; color: var(--sun-ink); }

.subs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem 1rem; margin: .7rem 0 0; font-size: .8rem; color: var(--ink-2); }
.sub { display: grid; grid-template-columns: 4.2rem 1fr 1.8rem; align-items: center; gap: .4rem; }
.bar { height: 6px; background: #edf0f6; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.sub b { text-align: right; font-weight: 650; }
.notes { font-size: .85rem; color: var(--ink-2); margin: .55rem 0 0; }
.review-count { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }

.actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.actions .btn { padding: .5rem .9rem; font-size: .9rem; }
.actions a.btn { text-decoration: none; }

.empty { background: var(--card); border-radius: var(--radius); padding: 1.5rem; text-align: center; box-shadow: var(--shadow); }
.empty .big { font-size: 2.2rem; }
.skeleton { height: 140px; border-radius: var(--radius); background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 50%, #eef1f6 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* map pins */
.pin {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); background: var(--ink); color: #fff; border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3); font: 700 11px/1 var(--font);
}
.pin span { transform: rotate(45deg); }
.pin.s-approved { background: var(--green); }
.pin.s-solid { background: var(--blue); }
.pin.s-emerg { background: var(--amber); }
.pin.s-hold { background: var(--red); }
.pin.me { background: var(--sun); color: var(--sun-ink); border-radius: 50%; transform: none; width: 18px; height: 18px; }
.popup b { display: block; margin-bottom: .2rem; }

/* ---------- CTA + info ---------- */
.cta-add {
  max-width: 1180px; margin: 1.5rem auto; padding: 1.25rem; display: grid; gap: .75rem;
  background: var(--ink); color: #fff; border-radius: var(--radius);
}
.cta-add h2 { margin: 0; }
.cta-add p { margin: .25rem 0 0; color: #c9d3ea; }
@media (min-width: 760px) { .cta-add { grid-template-columns: 1fr auto; align-items: center; margin: 2rem auto; } }
@media (max-width: 1212px) { .cta-add { margin-left: 1rem; margin-right: 1rem; } }

.info { max-width: 820px; margin: 0 auto; padding: 1.5rem 1rem; }
.info h2 { font-size: 1.5rem; margin: 0 0 .5rem; }
.weights { list-style: none; padding: 0; margin: .75rem 0; display: grid; gap: .4rem; }
.weights li { background: var(--card); padding: .6rem .8rem; border-radius: 12px; box-shadow: var(--shadow); }
.weights .w { display: inline-block; min-width: 3.2rem; font-weight: 800; color: var(--blue); }
.tips { padding-left: 1.2rem; display: grid; gap: .45rem; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 2rem; padding: 1.5rem 1rem 2.5rem; text-align: center; font-size: .88rem; color: var(--ink-2); }
.footer p { margin: .35rem auto; max-width: 52rem; }
.foot-brand { font-weight: 700; color: var(--ink); }

/* ---------- modals ---------- */
.modal {
  width: min(520px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); overflow: auto;
  border: 0; border-radius: 18px; padding: 1.25rem 1.25rem 1.5rem; color: var(--ink);
  box-shadow: 0 20px 60px rgba(20,33,61,.35);
}
.modal-wide { width: min(640px, calc(100vw - 1.5rem)); }
.modal::backdrop { background: rgba(20,33,61,.55); }
.modal h2 { margin: 0 0 .25rem; font-size: 1.3rem; }
.modal-sub { margin: 0 0 1rem; color: var(--muted); }
.modal-close-row { display: flex; justify-content: flex-end; margin: -.5rem -.5rem 0 0; }
.x { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); padding: .25rem .5rem; }
.stack { display: grid; gap: .85rem; }
.stack label { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; }
.stack input, .stack select, .stack textarea {
  font: inherit; font-weight: 400; border: 1px solid var(--line); border-radius: 10px; padding: .65rem .75rem; background: #fff; color: var(--ink);
}
.stack small { font-weight: 400; color: var(--muted); }
.counter { justify-self: end; }
.row3 { display: grid; grid-template-columns: minmax(0,1fr) 4.5rem 6rem; gap: .5rem; }
.row3 input { min-width: 0; width: 100%; }
.checks { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .35rem .75rem; }
.checks legend { font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.checks label { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
.form-msg { margin: 0; font-size: .9rem; min-height: 1.2em; }
.form-msg.err { color: var(--red); }
.form-msg.ok { color: var(--green); }

.scale { border: 0; margin: 0; padding: 0; }
.scale legend { font-weight: 650; margin-bottom: .35rem; }
.scale legend small { display: block; font-weight: 400; color: var(--muted); }
.scale-opts { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; }
.scale-opts input { position: absolute; opacity: 0; pointer-events: none; }
.scale-opts label {
  display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; padding: .55rem 0;
  cursor: pointer; font-weight: 700; background: #fff;
}
.scale-opts input:checked + label { background: var(--sun); border-color: #e3ad1f; color: var(--sun-ink); }
.scale-opts input:focus-visible + label { outline: 3px solid rgba(45,108,223,.45); }
.scale-hint { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: .2rem; }

.add-map { height: 260px; border-radius: 12px; overflow: hidden; background: #dfe6f2; }
.pin-readout { font-size: .85rem; color: var(--muted); margin: .4rem 0 .8rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 999px; z-index: 3000;
  box-shadow: var(--shadow); font-weight: 600; max-width: calc(100vw - 2rem); text-align: center;
}

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