/* ---------- colors: light, then dark (by system setting or ?theme=dark) ---------- */
:root {
  --bg: #f3f5f5; --card: #ffffff; --text: #19201c; --muted: #5f6a64; --line: #dde3de;
  --accent: #0f7c8c; --accent-soft: #e0f1f3; --on-accent: #ffffff;
  --error: #d2463a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --card: #1a201d; --text: #e9efeb; --muted: #9aa69f; --line: #2c3530;
    --accent: #3cc3d4; --accent-soft: #15292c; --on-accent: #0b130f;
    --error: #ff7a6b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513; --card: #1a201d; --text: #e9efeb; --muted: #9aa69f; --line: #2c3530;
  --accent: #3cc3d4; --accent-soft: #15292c; --on-accent: #0b130f;
  --error: #ff7a6b;
  color-scheme: dark;
}

/* ---------- page ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: 40px 16px 32px; }

header { margin-bottom: 20px; }
h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; line-height: 1.1; }
h1 span { color: var(--accent); }
.tagline { margin: 8px 0 0; color: var(--muted); }
h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 8px 24px rgb(0 0 0 / 5%);
}
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
footer { margin-top: 18px; text-align: center; }

/* ---------- buttons and pill choices ---------- */
.btn {
  font: inherit; font-weight: 600;
  border-radius: 10px; padding: 10px 14px;
  border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); } /* the Install app button */
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); margin-top: 16px; width: 100%; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: wait; }

.seg { display: flex; gap: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-block; padding: 4px 10px; font-size: 0.8rem;
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer; user-select: none;
}
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- form ---------- */
.modes { margin-bottom: 14px; }
.modes span { font-size: 0.9rem; padding: 6px 14px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; min-width: 0; }
.field > span:not(.search) { font-size: 0.8rem; color: var(--muted); }
input[type="text"], input[type="number"], select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; width: 100%;
}
input:focus-visible, select:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.three { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0 10px; align-items: end; }
.three .seg span { padding: 10px 12px; font-size: 0.85rem; border-radius: 10px; }
@media (max-width: 520px) {
  .two { grid-template-columns: 1fr; }
  .three { grid-template-columns: 1fr 1fr; }
  .three > :last-child { grid-column: 1 / -1; }
}

/* From/To and Place sit in the same spot, so switching modes keeps the same height. */
.places { display: grid; }
.places > * { grid-area: 1 / 1; }
body[data-mode="route"] .near-only, body[data-mode="near"] .route-only { visibility: hidden; }

.status { margin: 10px 0 0; }
.status:empty { display: none; }
.status.error { color: var(--error); }

/* place suggestions under a field */
.search { position: relative; display: block; min-width: 0; }
.suggest {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 4px; list-style: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 15%);
}
.suggest li { padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--accent-soft); }
.suggest li small { color: var(--muted); }
.suggest li.note { cursor: default; color: var(--muted); background: none; }

/* ---------- map and summary ---------- */
.map { height: 360px; border-radius: 10px; border: 1px solid var(--line); z-index: 0; }
@media (max-width: 520px) { .map { height: 280px; } }
.summary p { margin: 12px 0 0; }
.leaflet-container { font: inherit; }
.leaflet-tooltip.tip, .leaflet-tooltip.tip-best, .leaflet-tooltip.tip-range { font-weight: 600; padding: 2px 6px; }
.leaflet-tooltip.tip-best { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.leaflet-tooltip.tip-range { color: #d2463a; }
/* Dark map tiles: invert the light ones and turn the hues back. */
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.8) invert(1) contrast(.9) hue-rotate(180deg); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(.8) invert(1) contrast(.9) hue-rotate(180deg); }
}

/* ---------- station list ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.list { margin: 0; padding: 0; list-style: none; }
.st {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer;
}
.st:first-child { border-top: 0; }
.st .price { font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.st .price small { display: block; font-size: 0.72rem; font-weight: 400; color: var(--muted); }
.st .info { display: flex; flex-direction: column; min-width: 0; }
.st .info strong { overflow-wrap: anywhere; }
.st .links { display: flex; flex-direction: column; gap: 2px; text-align: right; white-space: nowrap; }
.st.best .price { color: var(--accent); }
.st.best .info strong::after {
  content: "cheapest"; margin-left: 8px; padding: 1px 6px; border-radius: 999px; vertical-align: 2px;
  font-size: 0.7rem; font-weight: 500; background: var(--accent-soft); color: var(--accent);
}
.st.far { opacity: .55; }
@media (max-width: 520px) {
  .st { grid-template-columns: 76px 1fr; }
  .st .links { grid-column: 2; flex-direction: row; gap: 14px; text-align: left; }
}
.disclaimer { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- embedded in the site page (../pumpfiction.html) ---------- */
.embedded body { background: transparent; }
.embedded .wrap { max-width: none; padding: 0; }
.embedded header { display: none; }
.embedded footer { margin-bottom: 4px; }
