/* ChargerStatus. Plain CSS, no framework. Light and dark themes from the same tokens. */
:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eff1ed;
  --text: #0b0c0b;
  --text-2: #4d524e;
  --muted: #666b67;
  --border: #e0e3df;
  --accent: #0d7a4f;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3ea;
  --blue: #1c5cab;
  --blue-ink: #ffffff;
  --free: #11893f;
  --busy: #b86e00;
  --broken: #c22a1f;
  --unknown: #8b908c;
  --radius: 10px;
  --wrap: 72rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111312; --surface: #191b1a; --surface-2: #222523; --text: #eef0ee; --text-2: #c0c5c1; --muted: #9da39f;
    --border: #313532; --accent: #5fd39b; --accent-ink: #0b0c0b; --accent-soft: #17301f; --blue: #86b6ef; --blue-ink: #0b0c0b;
    --free: #4fd17f; --busy: #f0a43a; --broken: #ff7b70; --unknown: #8e938f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111312; --surface: #191b1a; --surface-2: #222523; --text: #eef0ee; --text-2: #c0c5c1; --muted: #9da39f;
  --border: #313532; --accent: #5fd39b; --accent-ink: #0b0c0b; --accent-soft: #17301f; --blue: #86b6ef; --blue-ink: #0b0c0b;
  --free: #4fd17f; --busy: #f0a43a; --broken: #ff7b70; --unknown: #8e938f;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.55 var(--font); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); margin: 0.6em 0 0.4em; }
h2 { font-size: 1.35rem; margin: 2em 0 0.6em; }
p, ul { max-width: 68ch; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.lead { font-size: 1.12rem; color: var(--text-2); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 1000; }
.skip:focus { left: 8px; }
.notice { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; }
.badge { display: inline-block; font-size: 0.74rem; font-weight: 600; padding: 1px 7px; border-radius: 99px; line-height: 1.5; background: var(--surface-2); color: var(--text-2); }

/* Header and footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.25rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.brand-name span { color: var(--accent); }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: url("favicon.svg") center/cover; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-nav a { color: var(--text-2); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
/* Search in the header of every page but the home page: between the logo and the menu on a
   wide screen, a full-width row under the menu on a phone. */
.header-search { display: flex; flex-wrap: wrap; gap: 6px; flex: 0 1 27rem; min-width: 0; }
.header-search input { flex: 1; min-width: 0; font: inherit; font-size: 0.95rem; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.header-search .btn { padding: 6px 14px; font-size: 0.95rem; white-space: nowrap; }
/* Why the location could not be used: a line of its own under the box. */
.header-search-msg { flex: 1 1 100%; margin: 0; color: var(--text-2); }
@media (max-width: 760px) {
  .header-search { order: 3; flex: 1 1 100%; }
}
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 14px 0 0; margin: 0; font-size: 0.9rem; color: var(--muted); max-width: none; }
.crumbs li + li::before { content: "›"; margin-right: 4px; }
.crumbs a { color: var(--text-2); }
main { padding-bottom: 48px; }
.site-footer { background: var(--surface); border-top: 1px solid var(--border); color: var(--text-2); font-size: 0.95rem; }
.footer-inner { padding-top: 24px; padding-bottom: 32px; }
.footer-lead { color: var(--text); }
.footer-links a { color: var(--text-2); }

/* Search */
.search-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 18px 0; max-width: 46rem; }
.search-form > label { display: block; font-weight: 600; margin-bottom: 6px; }
.search-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search-row input { flex: 1 1 14rem; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
button { font: inherit; }
.btn { padding: 10px 16px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-blue { background: var(--blue); color: var(--blue-ink); }
.btn:disabled { opacity: 0.7; cursor: progress; }
/* "or [Use my location]": shown by site.js only where the browser can give a location. */
.search-locate { display: inline-flex; align-items: center; gap: 8px; }
.search-locate[hidden] { display: none; }
.search-or { color: var(--text-2); }
/* On a phone the two buttons stack, each the full width. */
@media (max-width: 560px) {
  .search-row > .btn, .search-locate { flex: 1 1 100%; }
  .search-locate .btn { flex: 1; }
}
/* "Add to home screen": shown by site.js only on a phone that can do it. */
.btn-outline { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.link-btn { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.install p { margin: 0; }
.install-home { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 18px; max-width: 46rem; }
.install-footer { margin: 0 0 1em; font-size: 0.88rem; }
.install-footer .link-btn { padding: 8px 0; }
.install[hidden] { display: none; }
.search-opts { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-top: 10px; font-size: 0.95rem; }
.check { display: inline-flex; gap: 6px; align-items: center; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.search-big { box-shadow: 0 1px 0 var(--border); }

/* Email alert on a site page */
.alert-form { background: var(--accent-soft); border-radius: var(--radius); padding: 2px 16px 6px; margin: 0 0 16px; max-width: 46rem; }
.alert-form h2 { font-size: 1.1rem; margin: 0.9em 0 0.3em; }
.alert-form p { margin: 0.4em 0; }
.alert-form input[type=email] { background: var(--surface); }
/* "or [Notify me on this device]" under the email row; shown by site.js where it can work. */
.alert-push { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 4px 0 10px; }
.alert-push[hidden] { display: none; }
.alert-push p { flex: 1 1 100%; margin: 0; }
@media (max-width: 560px) { .alert-push .btn { flex: 1 1 auto; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Home */
.hero { padding: 8px 0 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 18px 0 8px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat-n { display: block; font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; }
.stat-l { display: block; font-size: 0.88rem; color: var(--text-2); }
/* A "see all" link on its own line, straight under the section heading. */
.more-line { margin: -0.2em 0 0.9em; }
.more-link { font-weight: 600; }
.town-grid, .town-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 16px; max-width: none; }
/* Towns page: a box per nation that opens to an A–Z key, then one letter's towns. */
.nation { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 12px 0; }
.nation > summary { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none; border-radius: var(--radius); }
.nation > summary::-webkit-details-marker { display: none; }
.nation > summary::after { content: ""; flex: none; margin-left: auto; align-self: center; width: 10px; height: 10px; border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: translateY(-3px) rotate(45deg); }
.nation[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.nation > summary h2 { margin: 0; font-size: 1.3rem; }
.nation-body { padding: 0 16px 16px; }
.az { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.az a { display: flex; align-items: center; justify-content: center; height: 42px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-weight: 600; text-decoration: none; }
.az a:hover { border-color: var(--accent); }
.az a[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.az-hint { margin: 10px 0 0; }
.letter-group h3 { font-size: 1.1rem; margin: 1.1em 0 0.5em; }
.letter-group .town-list { margin: 0; }
.inline-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; max-width: none; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 32px; }

/* Status */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; background: var(--unknown); flex: none; }
.dot-free { background: var(--free); }
.dot-busy { background: var(--busy); }
.dot-broken { background: var(--broken); }
.state { font-weight: 600; }
.state-free { color: var(--free); }
.state-busy { color: var(--busy); }
.state-broken { color: var(--broken); }
.state-unknown { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--text-2); }
.legend .dot { margin-left: 8px; }
.legend .dot:first-child { margin-left: 0; }

/* Site lists */
.sites { list-style: none; padding: 0; margin: 0; max-width: none; display: grid; gap: 8px; }
.site-card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.site-card > .dot { margin-top: 6px; }
.site-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.site-name { font-weight: 600; text-decoration: none; }
.site-name:hover { text-decoration: underline; }
.site-meta, .site-spec { font-size: 0.9rem; color: var(--text-2); }
.site-state { text-align: right; display: flex; flex-direction: column; gap: 2px; min-width: 9rem; }
@media (max-width: 560px) {
  .site-card { flex-wrap: wrap; }
  .site-state { text-align: left; min-width: 0; width: 100%; padding-left: 24px; }
}
.filters { margin: 8px 0 16px; }

/* Site page */
.site-summary { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0 16px; }
.state-big { font-size: 1.3rem; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.state-big .dot { width: 16px; height: 16px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 6px; } }

/* Map */
.map { height: 380px; border: 1px solid var(--border); border-radius: var(--radius); margin: 12px 0 18px; background: var(--surface-2); }
@media (max-width: 560px) { .map { height: 300px; } }
.map-pin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data { background: var(--surface); }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: 0.82rem; font-weight: 600; color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 500; }
tr.muted a { color: var(--text-2); }
/* Sortable tables: site.js puts a button in each heading; the arrow shows the order. */
.sort-btn { display: inline-flex; align-items: center; gap: 5px; margin: -4px -6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.sort-btn::after { content: "↕"; font-size: 0.9em; opacity: 0.45; }
.sort-btn:hover { color: var(--text); background: var(--border); }
th[aria-sort] .sort-btn { color: var(--text); }
th[aria-sort] .sort-btn::after { opacity: 1; color: var(--accent); }
th[aria-sort="ascending"] .sort-btn::after { content: "▲"; font-size: 0.7em; }
th[aria-sort="descending"] .sort-btn::after { content: "▼"; font-size: 0.7em; }
.sort-hint { margin: 0 0 8px; }
.data td { white-space: nowrap; }
.data td:nth-child(4) { white-space: normal; min-width: 7em; }
.data th[scope="row"] { word-break: break-word; min-width: 8em; }
