/* ChargerMap.org  one stylesheet, matches the existing site's look */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:        #F2F2F7;
  --bg-card:   #FFFFFF;
  --ink:       #1C1C1E;
  --ink-mid:   #3A3A3C;
  --ink-light: #6C6C70;   /* 5:1 contrast on white, meets WCAG AA for small text */
  --rule:      #E5E5EA;
  --blue:      #2551C0;
  --blue-lt:   #E8EEF8;
  --gold:      #F5C842;
  --grey-pin:  #8E8E93;
  --red:       #993C1D;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 2px 12px rgba(0,0,0,0.12);
  --menu-max:  600px;
}
html { background: var(--bg); }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh;
  -webkit-font-smoothing: antialiased; line-height: 1.5;
}
a { color: var(--blue); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 9999; background: #fff; padding: 6px 10px; border-radius: 6px; }

/* ── Home: hero strip ── */
.hero-strip, .map-strip {
  width: 100%; height: 24vh; min-height: 136px; max-height: 273px;
  background-size: cover; position: relative;
  display: flex; align-items: center; justify-content: center;
  background-color: #2b3440;
}
.hero-strip { background-image: url('/home-hero.jpg'); background-position: center 60%; }
.map-strip  { background-image: url('/home-map.jpg'); background-position: center; margin: 20px 0; max-height: none; }
.hero-strip::before, .map-strip::before { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.48); }
.strip-text { position: relative; z-index: 2; text-align: center; padding: 0 24px; }
.hero-strip h1 { font-size: clamp(28px, 6vw, 52px); font-weight: 800; color: #fff; letter-spacing: -1px; line-height: 1.1; margin-bottom: 10px; }
.hero-strip h1 span, .map-strip a span { color: var(--gold); }
.hero-strip p { font-size: clamp(13px, 2vw, 18px); color: rgba(255,255,255,0.88); font-weight: 500; }
.map-strip a {
  display: inline-block; font-size: clamp(18px, 4vw, 28px); font-weight: 700; color: #fff; text-decoration: none;
  border-bottom: 2px solid rgba(255,255,255,0.5); padding-bottom: 4px; transition: border-color .2s;
}
.map-strip a:hover, .map-strip a:focus-visible { border-color: #fff; outline-color: #fff; outline-offset: 4px; }
.map-strip p { font-size: 13px; color: rgba(255,255,255,0.75); margin-top: 8px; }
@media (min-width: 700px) { .hero-strip h1 { letter-spacing: -2px; } }

/* ── Home: menu ── */
.content { max-width: var(--menu-max); margin: 0 auto; }
.section-label { font-size: 13px; font-weight: 600; color: var(--ink-light); text-transform: uppercase; letter-spacing: .06em; padding: 20px 20px 8px; }
.card { background: var(--bg-card); border-radius: var(--radius); margin: 0 16px 12px; box-shadow: var(--shadow); overflow: hidden; }
.menu-grid { display: grid; grid-template-columns: 1fr; }
.menu-row {
  display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--rule);
  text-decoration: none; color: var(--ink); gap: 14px; transition: background .1s; -webkit-tap-highlight-color: transparent;
}
.menu-row:last-child { border-bottom: none; }
.menu-row:hover { background: #FAFAFC; }
.menu-row:active { background: var(--bg); }
.menu-row:focus-visible { outline-offset: -2px; }
@media (min-width: 540px) {
  .menu-grid { grid-template-columns: 1fr 1fr; }
  .menu-row { border-right: 1px solid var(--rule); }
  .menu-row:nth-child(even) { border-right: none; }
  .menu-row:last-child { border-bottom: none; }
  .menu-row:nth-last-child(2):nth-child(odd) { border-bottom: none; }   /* left cell of a full last row */
  .menu-row:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: none; }
}
.menu-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; background: var(--blue-lt); }
.menu-label { flex: 1; font-size: 17px; font-weight: 500; letter-spacing: -0.2px; }
.menu-chevron { color: var(--ink-light); font-size: 14px; }
.home-blurb { font-size: 14px; color: var(--ink-light); text-align: center; padding: 2px 24px 8px; line-height: 1.6; }
.site-footer { text-align: center; padding: 20px 20px 28px; font-size: 13px; color: var(--ink-light); line-height: 1.8; max-width: var(--menu-max); margin: 0 auto; }
.site-footer nav a { color: var(--blue); text-decoration: none; padding: 4px 6px; }
.site-footer nav a:hover { text-decoration: underline; }
.site-footer p a { color: var(--blue); text-decoration: none; font-weight: 600; }
.site-footer p a:hover { text-decoration: underline; }
.privacy-note { font-size: 13px; color: var(--ink-light); }

/* ── Content pages: slim top bar ── */
.page-bar {
  background: var(--bg-card); border-bottom: 1px solid var(--rule); height: 48px; padding: 0 12px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; position: sticky; top: 0; z-index: 600;
}
.nav-back { font-size: 15px; color: var(--blue); text-decoration: none; font-weight: 500; white-space: nowrap; }
.nav-title { font-size: 17px; font-weight: 600; color: var(--ink); }
.wordmark { font-size: 18px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.wordmark span { color: var(--blue); }
.page-bar .wordmark { justify-self: end; font-size: 15px; }

.page { max-width: 720px; margin: 0 auto; padding: 16px 0 40px; }
.page > h1 { font-size: 28px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; padding: 8px 20px 4px; }
.page > .lede { color: var(--ink-mid); padding: 0 20px 12px; font-size: 15px; }
.prose { padding: 16px 18px; font-size: 15px; line-height: 1.65; }
.prose h2 { font-size: 17px; margin: 18px 0 6px; }
.prose h2:first-child { margin-top: 0; }
.prose p + p, .prose ul { margin-top: 8px; }
.prose ul + p { margin-top: 10px; }
.prose li + li { margin-top: 4px; }
.prose ul { padding-left: 20px; }

/* ── Stats ── */
.seg { display: inline-flex; background: #E3E3E8; border-radius: 9px; padding: 2px; margin: 4px 16px 12px; }
.seg button { font: inherit; font-size: 14px; font-weight: 600; border: 0; background: none; padding: 6px 14px; border-radius: 7px; color: var(--ink-mid); cursor: pointer; }
.seg button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 16px 12px; }
.tile { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.tile .n { font-size: 26px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--ink-light); font-size: 13px; }
.stat-note { color: var(--ink-mid); font-size: 14px; padding: 0 20px 4px; }
.card h2 { font-size: 13px; font-weight: 600; color: var(--ink-light); text-transform: uppercase; letter-spacing: .06em; padding: 12px 16px 4px; }
.bars { width: 100%; border-collapse: collapse; font-size: 14px; }
.bars th, .bars td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.bars tr > :first-child { padding-left: 16px; }
.bars tr > :last-child { padding-right: 16px; }
.bars tbody tr:last-child td { border-bottom: none; }
.bars th { font-size: 11px; color: var(--ink-light); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.bars .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; width: 1%; }
.bars .barcell { width: 38%; }
.bar { height: 8px; background: var(--blue); border-radius: 4px; min-width: 3px; }
.grid-2 { display: grid; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 .card:first-child { margin-right: 6px; } .grid-2 .card:last-child { margin-left: 6px; } }
.asof { color: var(--ink-light); font-size: 12px; text-align: center; padding: 12px 20px; }

/* ── Forms ── */
.form { display: grid; gap: 14px; padding: 16px; }
.form label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 4px; }
.form input, .form select, .form textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); }
.form textarea { min-height: 150px; resize: vertical; }
.form .err { color: var(--red); font-size: 13px; margin-top: 3px; }
.form .hp { position: absolute; left: -10000px; }
.btn { font: inherit; font-weight: 600; font-size: 16px; background: var(--blue); color: #fff; border: 0; border-radius: var(--radius-sm); padding: 11px 20px; cursor: pointer; justify-self: start; }
.btn[disabled] { opacity: .6; cursor: wait; }
.notice { margin: 0 16px 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--blue-lt); color: var(--ink); font-size: 15px; }
.notice.bad { background: #FBECE7; }

/* ── Map page ── */
/* dvh = the visible height, so nothing sits behind a phone browser's address bar */
.map-body { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
html:has(.map-body) { height: 100%; }
#top-bar .wordmark { flex-shrink: 0; }
#top-bar {
  background: var(--bg-card); border-bottom: 1px solid var(--rule); flex-shrink: 0;
  height: calc(48px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 600; gap: 8px;
}
.bar-group { display: flex; align-items: center; gap: 8px; }
.icon-btn { font-size: 18px; background: none; border: none; color: var(--blue); cursor: pointer; padding: 4px; line-height: 1; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.icon-btn.locating { opacity: .5; }
.icon-btn.error { color: var(--red); }
.pill {
  font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--rule);
  background: var(--bg); color: var(--ink-mid); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px;
}
.pill { text-decoration: none; min-height: 36px; }
.pill[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill[aria-expanded="true"] { background: var(--blue-lt); color: var(--blue); border-color: var(--blue); }
.pill .badge-n { background: var(--blue); color: #fff; border-radius: 9px; font-size: 12px; padding: 0 7px; line-height: 18px; font-variant-numeric: tabular-nums; }
@media (max-width: 380px) { #top-bar .wordmark { font-size: 16px; } .pill { padding: 6px 9px; } }

#filter-panel {
  position: absolute; top: 52px; right: 12px; width: 230px; max-height: calc(100% - 64px); overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 700;
}
#filter-panel[hidden] { display: none; }
.fp-summary { white-space: nowrap; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--rule); font-size: 14px; font-weight: 600; color: var(--ink); }
.fp-reset { white-space: nowrap; font: inherit; font-size: 13px; font-weight: 600; color: var(--blue); background: none; border: 1px solid var(--blue); border-radius: 16px; padding: 5px 12px; cursor: pointer; }
.fp-reset:disabled { color: var(--ink-light); border-color: var(--rule); cursor: default; }
.fp-search { padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.fp-search input { width: 100%; font: inherit; font-size: 15px; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); }
.fp-section { padding: 8px 14px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-light); background: var(--bg); border-bottom: 1px solid var(--rule); }
.fp-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--rule); cursor: pointer; font-size: 14px; color: var(--ink-mid); user-select: none; }
.fp-row:last-child { border-bottom: none; }
.fp-row:hover { background: #FAFAFC; }
.fp-row.all { font-weight: 600; color: var(--ink); }
.fp-row input { position: absolute; opacity: 0; pointer-events: none; }
.fp-check { width: 18px; height: 18px; border-radius: 4px; border: 2px solid var(--rule); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.fp-row input:checked + .fp-check { background: var(--blue); border-color: var(--blue); }
.fp-row input:checked + .fp-check::after { content: '✓'; font-size: 11px; color: #fff; font-weight: 700; }
.fp-row input:indeterminate + .fp-check { background: var(--blue); border-color: var(--blue); }
.fp-row input:indeterminate + .fp-check::after { content: '–'; font-size: 12px; color: #fff; font-weight: 700; line-height: 1; }
.fp-row input:focus-visible + .fp-check { outline: 2px solid var(--blue); outline-offset: 2px; }
.fp-label { flex: 1; }
.fp-count { font-size: 12px; color: var(--ink-light); }

#map-wrap { position: relative; flex: 1; overflow: hidden; }
#map { height: 100%; width: 100%; background: #E9EDF0; }
.float {
  position: absolute; z-index: 400; background: rgba(255,255,255,.96); border: 1px solid var(--rule); border-radius: 10px;
}
.float h5 { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-light); margin-bottom: 6px; }
#map-loading { top: 50%; left: 50%; transform: translate(-50%,-50%); padding: 18px 24px; font-size: 14px; color: var(--ink-mid); text-align: center; z-index: 500; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--rule); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
#map-legend { bottom: calc(28px + env(safe-area-inset-bottom)); left: 12px; padding: 10px 13px; font-size: 11px; line-height: 1.4; }
.leg-row { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; color: var(--ink-mid); }
.dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); flex-shrink: 0; display: inline-block; }
.dot.small { width: 8px; height: 8px; }
.leg-date { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); color: var(--ink-light); font-size: 10px; }
.stat-row { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-mid); margin-bottom: 2px; }
.stat-num { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── Site card ── */
#detail {
  bottom: 20px; right: 12px; width: 340px; max-height: calc(100% - 40px); overflow-y: auto; background: #fff;
  box-shadow: var(--shadow-lg); padding: 0; border-radius: 14px; border: 0;
}
#detail[hidden] { display: none; }
#detail-close {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.94); border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  color: var(--ink-mid); font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.d-photo { display: block; width: 100%; height: 180px; padding: 0; border: 0; background: var(--bg); position: relative; cursor: zoom-in; }
.d-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.d-enlarge { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 10px; }
.d-inner { padding: 14px 16px 16px; }
.d-inner.no-photo { padding-top: 16px; }
.d-inner.no-photo h3 { padding-right: 36px; }
#detail h3 { font-size: 18px; font-weight: 650; line-height: 1.3; margin-bottom: 8px; }
.d-name { cursor: pointer; }
.d-name:hover { color: var(--blue); }
.d-verified { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-lt); color: var(--blue); font-size: 13px; font-weight: 650; padding: 4px 11px 4px 8px; border-radius: 14px; }
.d-verified svg { width: 16px; height: 16px; }
.d-unverified { display: inline-block; background: var(--bg); color: var(--ink-light); font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 14px; border: 1px dashed #AEAEB2; }
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.d-tag { font-size: 12px; font-weight: 600; color: var(--ink-mid); background: var(--bg); border: 1px solid var(--rule); padding: 3px 9px; border-radius: 12px; }
.d-meta { font-size: 14px; color: var(--ink-light); line-height: 1.5; margin: 10px 0 12px; }
.d-meta strong { color: var(--ink); }
.d-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; margin-bottom: 12px; }
.d-fact { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.d-fact .n { font-size: 20px; font-weight: 750; letter-spacing: -.3px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.d-fact .l { font-size: 12px; color: var(--ink-light); }
.d-chips { margin: -4px 0 12px; display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; border: 1px solid var(--rule); border-radius: 6px; padding: 1px 7px; color: var(--ink-mid); }
.d-src-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-light); margin-bottom: 6px; }
.d-srcs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.d-src { font-size: 13px; font-weight: 600; color: var(--blue); text-decoration: none; border: 1px solid #C9D5F0; border-radius: 8px; padding: 5px 10px; }
.d-src:hover { background: var(--blue-lt); }
.d-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--rule); padding-top: 10px; font-size: 13px; }
.d-foot a { color: var(--blue); text-decoration: none; font-weight: 600; }
.d-foot a:hover { text-decoration: underline; }
.d-foot span { color: var(--ink-light); font-size: 12px; text-align: right; }

/* Full-screen photo */
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 12px 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: calc(100% - 40px); object-fit: contain; border-radius: 6px; }
.lightbox p { color: #fff; font-size: 14px; margin-top: 10px; text-align: center; }
.lb-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 18px; cursor: pointer; }

@media (max-width: 600px) {
  #detail { bottom: 0; right: 0; left: 0; width: 100%; border-radius: 16px 16px 0 0; max-height: 72dvh; z-index: 1000;
            padding-bottom: env(safe-area-inset-bottom); }
  .d-photo { height: 160px; }
  #map-legend { bottom: calc(26px + env(safe-area-inset-bottom)); left: 8px; padding: 7px 10px; font-size: 10px; }
    #filter-panel { right: 8px; left: 8px; width: auto; }
}

/* Leaflet */
.leaflet-container { font: inherit; }
/* Labeled map controls under the zoom buttons */
.map-tools { display: flex; flex-direction: column; background: #fff; }
.map-tools button {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); background: #fff; border: 0;
  border-bottom: 1px solid #ccc; padding: 0 12px; min-height: 36px; text-align: left; cursor: pointer; white-space: nowrap;
}
.map-tools button:last-child { border-bottom: 0; }
.map-tools button:hover { background: #f4f4f4; }
.map-tools button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.map-tools button.locating { color: var(--ink-light); }
.map-tools button.error { color: var(--red); }
/* Bigger tap targets on touch screens (44px minimum) */
@media (pointer: coarse) {
  .leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 22px; }
  .map-tools button, .pill, .fp-reset { min-height: 44px; }
  #detail-close { width: 40px; height: 40px; }
  .d-src, .d-foot a { display: inline-block; padding-top: 8px; padding-bottom: 8px; }
}
.md-outline { pointer-events: none; }
