/* ActivityPlaces - mobile first. No inline styles anywhere (strict CSP). */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f2f0ea;
  --text: #1b1a21;
  --muted: #64616f;
  --line: #e3e0d8;
  --brand: #f0491f;
  --brand-ink: #ffffff;
  --link: #b8350f;
  --focus: #2563eb;
  --c1: #169c93; --t1: #0c6b65;
  --c2: #57a530; --t2: #37731a;
  --c3: #d49a00; --t3: #7d5a00;
  --c4: #ef6b1c; --t4: #a8430a;
  --c5: #de2d4c; --t5: #ad1a36;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 6px 20px rgb(0 0 0 / 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --top: 56px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121117;
    --surface: #1b1a22;
    --surface-2: #24232d;
    --text: #f1eff6;
    --muted: #a5a2b3;
    --line: #302e3b;
    --brand: #ff6a3d;
    --brand-ink: #1a0b05;
    --link: #ff9a78;
    --focus: #7aa7ff;
    --t1: #5fd9cf; --t2: #9bdc74; --t3: #f1c440; --t4: #ff9d5c; --t5: #ff7d93;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 6px 20px rgb(0 0 0 / 0.3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 12px); }
body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 16px 48px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 1rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }
a { color: var(--link); }
img, video { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.fine { font-size: 0.82rem; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.eyebrow { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); margin: 0 0 6px; }
.lede { font-size: 1.05rem; color: var(--muted); max-width: 62ch; }

/* Adrenaline levels: set --c (solid) and --t (readable text) */
.r1 { --c: var(--c1); --t: var(--t1); }
.r2 { --c: var(--c2); --t: var(--t2); }
.r3 { --c: var(--c3); --t: var(--t3); }
.r4 { --c: var(--c4); --t: var(--t4); }
.r5 { --c: var(--c5); --t: var(--t5); }

/* Header + footer */
.top {
  position: sticky; top: 0; z-index: 40; height: var(--top);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -0.02em; font-size: 1.1rem; }
.logo-mark { color: var(--brand); flex: none; }
.top-nav { display: flex; align-items: center; gap: 12px; }
.nav-link { color: var(--text); font-weight: 600; font-size: 0.92rem; }
.foot { border-top: 1px solid var(--line); padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 0.85rem; text-align: center; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 10px; }
.foot a { color: var(--muted); }
.foot p { max-width: 70ch; margin: 0 auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn-brand { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-brand:hover { filter: brightness(1.06); border-color: var(--brand); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.9rem; border-radius: 10px; }
.btn-wide { width: 100%; }
.btn[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); }
.link { background: none; border: 0; padding: 4px; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
.link-danger { color: var(--t5); }

/* Hero */
.hero { padding: 22px 0 6px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin: 0 6px 0 2px; }
.crumbs a { color: var(--muted); }

/* Filters */
.filters { display: grid; gap: 14px; padding: 12px 0 4px; }
.filters fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.filters legend { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0; margin-bottom: 6px; }
.search-row { display: flex; gap: 8px; }
.search { flex: 1; }
.search input, .form input, .share input {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit;
}
.seg, .pills, .chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; -webkit-overflow-scrolling: touch; }
.seg::-webkit-scrollbar, .pills::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.seg-item input, .pill input, .chip input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item span, .pill span, .chip span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 0.92rem; white-space: nowrap; cursor: pointer; user-select: none;
}
.chip i { font-style: normal; }
.seg-item input:checked + span, .chip input:checked + span { background: var(--text); color: var(--bg); border-color: var(--text); }
.seg-item input:focus-visible + span, .pill input:focus-visible + span, .chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.pill span { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); color: var(--t); }
.pill b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--c); color: #fff; font-size: 0.75rem; }
.pill input:checked + span { background: var(--c); border-color: var(--c); color: #fff; }
.pill input:checked + span b { background: #fff; color: var(--t); }
.chips-sub { margin-top: 8px; }
.chips-sub .chip span { min-height: 34px; font-size: 0.86rem; background: var(--surface-2); }

/* Results */
.results { display: grid; gap: 16px; margin-top: 12px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.count { margin: 0; font-weight: 700; }
.cards { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); border-left: 4px solid var(--c, var(--line)); overflow: hidden; }
.card-main { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; color: inherit; text-decoration: none; }
.card-main:hover .card-name { text-decoration: underline; }
.card-ico { font-size: 1.5rem; line-height: 1.2; flex: none; width: 34px; text-align: center; }
.card-txt { display: grid; gap: 3px; min-width: 0; flex: 1; }
.card-name { font-size: 1.02rem; line-height: 1.25; overflow-wrap: anywhere; }
.card-sub { color: var(--muted); font-size: 0.88rem; }
.card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.card-dist { flex: none; font-size: 0.85rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tag { font-size: 0.74rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag-rush { background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: var(--t); }
.tag-video { background: var(--text); color: var(--bg); }
.tag-lead { background: var(--brand); color: var(--brand-ink); }
.meter { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.meter i { width: 4px; border-radius: 2px; background: var(--line); }
.meter i:nth-child(1) { height: 6px; } .meter i:nth-child(2) { height: 8px; } .meter i:nth-child(3) { height: 10px; } .meter i:nth-child(4) { height: 12px; } .meter i:nth-child(5) { height: 14px; }
.r1 .meter i:nth-child(-n+1), .r2 .meter i:nth-child(-n+2), .r3 .meter i:nth-child(-n+3), .r4 .meter i:nth-child(-n+4), .r5 .meter i:nth-child(-n+5) { background: var(--c); }
.card-add, .card-actions { display: flex; align-items: center; gap: 10px; padding: 0 14px 12px 60px; flex-wrap: wrap; }
.card-add .btn { min-height: 36px; font-size: 0.88rem; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.plan-bar { position: sticky; top: calc(var(--top) + 6px); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; margin-bottom: 10px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 0.92rem; }
.plan-bar a { color: var(--bg); }

/* Map */
.map { width: 100%; height: 100%; min-height: 320px; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }
.map-mini { height: 280px; }
.map-pane { display: none; }
body.map-open { overflow: hidden; }
body.map-open .map-pane { display: block; position: fixed; inset: var(--top) 0 0 0; z-index: 20; background: var(--bg); }
body.map-open .map-pane .map { border-radius: 0; }
.fab {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 30;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--text); color: var(--bg); font: inherit; font-weight: 750; box-shadow: var(--shadow);
}
.fab-list, body.map-open .fab-map { display: none; }
body.map-open .fab-list { display: inline; }
.pop { display: grid; gap: 4px; font: 14px/1.35 var(--font); color: #1b1a21; min-width: 170px; }
.pop a { color: #b8350f; font-weight: 700; }
.pop span { color: #64616f; font-size: 0.85em; }

/* Sections */
.section { margin-top: 34px; }
.browse-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.browse-group ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.browse-group a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.browse-group a:hover { color: var(--link); }
.n { color: var(--muted); font-variant-numeric: tabular-nums; }
.scale-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.scale-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.scale-list b { color: var(--t); }

/* Place page */
.place { max-width: 860px; margin: 0 auto; padding-top: 18px; }
.place-head { display: flex; gap: 14px; align-items: flex-start; }
.place-ico { font-size: 2.4rem; line-height: 1; }
.place-sub { color: var(--muted); margin: 0; }
.rating { display: flex; align-items: center; gap: 14px; margin: 16px 0 10px; padding: 14px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--c) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 40%, var(--line)); }
.rating .meter { height: 28px; gap: 4px; }
.rating .meter i { width: 7px; }
.rating .meter i:nth-child(1) { height: 10px; } .rating .meter i:nth-child(2) { height: 14px; } .rating .meter i:nth-child(3) { height: 19px; } .rating .meter i:nth-child(4) { height: 24px; } .rating .meter i:nth-child(5) { height: 28px; }
.rating p { margin: 0; display: grid; }
.rating b { color: var(--t); }
.rating span { color: var(--muted); font-size: 0.92rem; }
.place-tags .tag { font-size: 0.8rem; padding: 4px 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions .btn { flex: 1 1 auto; }
.media { display: grid; gap: 14px; }
.media-item { margin: 0; }
.media-item figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.media-item video, .media-item > img { width: 100%; border-radius: var(--radius); background: #000; }
.player { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; cursor: pointer; background: #111; }
.player img { width: 100%; height: 100%; object-fit: cover; }
.player-plain { background: linear-gradient(135deg, var(--c4), var(--c5)); }
.play { position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%; background: rgb(0 0 0 / 0.65); }
.play::after { content: ""; position: absolute; left: 27px; top: 20px; border-style: solid; border-width: 14px 0 14px 22px; border-color: transparent transparent transparent #fff; }
.embed { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); display: block; background: #000; }
.facts dl { display: grid; grid-template-columns: minmax(84px, auto) 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 0.9rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.desc { font-size: 1.02rem; }
.cards-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.source { font-size: 0.9rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 22px; }
.source ul { padding-left: 18px; margin: 0 0 12px; display: grid; gap: 6px; }
.cite { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); overflow-wrap: anywhere; }

/* Narrow pages: plans, about, developers */
.narrow { max-width: 640px; margin: 0 auto; padding-top: 26px; }
.narrow h2 { margin-top: 30px; }
.form { display: grid; gap: 14px; margin-top: 18px; }
.form label { display: grid; gap: 6px; font-weight: 650; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert, .note { padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.alert { background: color-mix(in srgb, var(--c5) 14%, var(--surface)); color: var(--t5); }
.note { background: color-mix(in srgb, var(--c1) 14%, var(--surface)); color: var(--t1); }
.share { margin-top: 18px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.share label { font-weight: 650; font-size: 0.9rem; }
.share-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.share-row input { flex: 1 1 200px; min-width: 0; }
.plan-cards { margin-top: 6px; }
.vote { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.vote.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.members { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.members li { display: flex; align-items: center; gap: 8px; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); font-weight: 800; }
.danger-zone { margin: 24px 0 8px; }
.prose ul, .prose ol { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose .scale-list { padding-left: 0; }
.prose pre { overflow-x: auto; padding: 14px; border-radius: 12px; background: var(--surface-2); font-size: 0.86rem; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; overflow-wrap: anywhere; }

/* Desktop: list and map side by side */
@media (min-width: 960px) {
  main { padding-left: 28px; padding-right: 28px; }
  .filters { grid-template-columns: 1fr 1fr; align-items: end; }
  .search-row, .filters .row-type { grid-column: 1 / -1; }
  .filters.folded .row-extra { display: block; }
  .btn-more { display: none; }
  .results { grid-template-columns: minmax(360px, 460px) 1fr; align-items: start; }
  .map-pane { display: block; position: sticky; top: calc(var(--top) + 12px); height: calc(100dvh - var(--top) - 24px); }
  body.map-open { overflow: auto; }
  body.map-open .map-pane { position: sticky; inset: auto; top: calc(var(--top) + 12px); z-index: 1; }
  body.map-open .map-pane .map { border-radius: var(--radius); }
  .fab { display: none; }
  .actions .btn { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .seg-item span, .pill span, .chip span, .vote { transition: background-color 0.12s, border-color 0.12s, color 0.12s; }
}

/* Keep the open-source map credits readable in dark mode */
.maplibregl-ctrl-attrib { font-size: 11px; }

/* Age guidance */
.hint { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); }
.tag-age { border: 1px solid var(--line, currentColor); }

/* Phones: secondary filters fold away behind "More filters" (see explore.js). */
@media (max-width: 959.98px) { .filters.folded .row-extra { display: none; } }
.btn-more { justify-self: start; min-height: 40px; font-size: 0.9rem; }

/* Area switcher above the filters */
.regions { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 10px 0 2px; }
.regions::-webkit-scrollbar { display: none; }
.region-link { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.86rem; font-weight: 650; text-decoration: none; color: inherit; white-space: nowrap; }
.region-link[aria-current] { background: var(--surface-2); border-color: transparent; color: var(--muted); }
