:root {
  /* The site is dark-only. Telling the UA stops Android WebView's
     algorithmic darkening from "helpfully" inverting our already-dark
     palette (which is what was crushing the hamburger bars and other
     var(--text)-coloured glyphs into near-invisible grey on the panel). */
  color-scheme: dark;
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232d;
  --border: #2a323d;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #ff5630;
  --accent-dim: #b23b1e;
  --good: #7ee787;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

body > .site-footer {
  margin-top: auto;
}

.site-header {
  padding: 28px 32px 0;
  border-bottom: 1px solid var(--border);
}

.site-header-left {
  flex: 1;
}

.site-brand {
  margin: 0;
  font-size: 28px;
  font-weight: bold;
  letter-spacing: 0.02em;
  user-select: none;
}

.site-brand a {
  color: inherit;
  text-decoration: none;
}

.site-brand::before {
  content: "▮ ";
  color: var(--accent);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 20px;
}

.page-header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.tagline {
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

main {
  padding: 24px 32px 64px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  /* body is a flex column with min-height: 100vh and the footer
     pinned via margin-top: auto. Let main grow so it always reaches
     the footer — keeps full-bleed page backgrounds (e.g. the garage
     empty-state illustration) from collapsing to content height. */
  flex-grow: 1;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.stat-wide {
  grid-column: 1 / -1;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-value {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.stat-value .unit {
  color: var(--muted);
  font-size: 11px;
  margin-left: 2px;
}

.page-more {
  display: block;
  margin: 24px auto 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.page-more[hidden] {
  display: none;
}

.page-more:hover {
  border-color: var(--accent);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 28px 0 0;
}

.pagination[hidden] {
  display: none;
}

.page-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.page-btn:hover:not(:disabled),
.page-btn:focus-visible:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-indicator {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 120px;
  text-align: center;
}

.cta-btn {
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms;
}

.cta-btn:hover {
  background: var(--accent-dim);
}

.cta-btn:disabled,
.cta-btn[disabled],
.cta-btn.is-disabled,
.cta-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.cta-btn.is-disabled:hover,
.cta-btn[aria-disabled="true"]:hover {
  background: var(--accent);
}

.cta-btn-done {
  background: var(--good);
  color: var(--bg);
}

.signed-out-gate {
  max-width: 560px;
  margin: 40px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.signed-out-gate[hidden] {
  display: none;
}

.signed-out-gate button {
  align-self: center;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}

.page-error {
  max-width: 560px;
  margin: 40px auto;
  text-align: center;
  color: var(--bad, #c44);
}

.drives-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px 32px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}

.modal-close:hover,
.modal-close:focus-visible {
  color: var(--text);
  background: var(--panel-2);
  outline: none;
}

.modal-title-block {
  padding-right: 32px;
}

.modal-title-block .make {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.modal-title-block h2 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.modal-title-block .meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.modal-section {
  margin-top: 24px;
}

.modal-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 600;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-row a,
.link-row span {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  text-decoration: none;
}

.link-row a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.link-row span {
  color: var(--muted);
}

/* Inline link to a user's /u/?id=… page. Inherits surrounding text
   color so it sits cleanly inside .muted subtitles, drive headers,
   table cells, etc. — only the hover state pulls accent + underline. */
.user-link {
  color: inherit;
  text-decoration: none;
}
.user-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* --- Site header nav --- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 24px;
}

.site-header nav {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 120ms ease;
}

.site-header nav a.nav-featured {
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 4px 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background 120ms ease, color 120ms ease;
}

.site-header nav a.nav-featured:hover,
.site-header nav a.nav-featured[aria-current="page"] {
  background: var(--accent);
  color: #fff;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: var(--accent);
}

/* Contact + Privacy are repeated from the footer into the nav so
   they survive the mobile drawer collapse. Desktop hides them; the
   mobile breakpoint below un-hides them. The footer is hidden on
   mobile in the same breakpoint so the two surfaces stay disjoint. */
.site-header nav a.nav-mobile-only {
  display: none;
}

/* --- Mobile hamburger toggle ---
   The checkbox lives in the DOM (visually hidden) so its `:checked`
   state is the source of truth — no JS needed. The label is the
   visible button. Desktop hides both. */

/* Visually hidden but still keyboard-focusable so screen-reader and
   keyboard users can open/close the drawer. The visible label handles
   pointer clicks via `for=`. */
.site-nav-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.site-nav-toggle-btn {
  display: none;
}

/* --- Site footer --- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 8px 32px 16px;
  margin-top: 48px;
}

.site-footer nav {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.site-footer nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 120ms ease;
}

.site-footer nav a:hover,
.site-footer nav a[aria-current="page"] {
  color: var(--accent);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  text-decoration: none;
}

.share-btn[hidden] {
  display: none;
}

/* Icon-only variant: square pill so compare/capture/etc. all match. */
.share-btn-icon {
  padding: 6px;
  width: 28px;
  height: 28px;
  justify-content: center;
}

.share-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

.share-btn.is-copied {
  color: var(--good);
  border-color: var(--good);
}

.share-icon {
  display: inline-flex;
  line-height: 1;
}
@media (max-width: 700px) {
  .site-header {
    padding: 20px 16px 0;
    /* `position: relative` anchors the absolutely-positioned toggle
       button below to the header instead of the page. */
    position: relative;
  }

  .site-header-left {
    /* Leave room on the right edge for the hamburger button. */
    flex: 0 0 100%;
    padding-right: 56px;
  }

  /* Hamburger button: always-tappable square in the header's top-right.
     Vertically centred against the brand + tagline block (the always-
     visible portion of the header — top:50% would drift when the nav
     drawer opens). */
  .site-nav-toggle-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    position: absolute;
    top: 22px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    cursor: pointer;
  }

  .site-nav-toggle-btn:hover,
  .site-nav-toggle:focus-visible + .site-nav-toggle-btn {
    border-color: var(--accent);
  }

  .site-nav-toggle-bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 160ms ease, opacity 120ms ease;
  }

  /* Animate the three bars into an X when the menu is open. */
  .site-nav-toggle:checked + .site-nav-toggle-btn .site-nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .site-nav-toggle:checked + .site-nav-toggle-btn .site-nav-toggle-bar:nth-child(2) {
    opacity: 0;
  }
  .site-nav-toggle:checked + .site-nav-toggle-btn .site-nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Drawer-style nav: hidden by default, slides into a column when the
     checkbox flips. Absolutely positioned so opening it overlays the
     page content instead of pushing it down; left: 0 / right: 0 span
     the full header width past its 16px side padding. The header is
     position: relative above, which anchors this. */
  .site-header nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    gap: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    z-index: 10;
  }

  .site-nav-toggle:checked ~ nav {
    display: flex;
  }

  .site-header nav a {
    padding: 18px 20px;
    font-size: 18px;
    border-bottom: 1px solid var(--border);
  }

  .site-header nav a:nth-child(even) {
    background: var(--panel);
  }

  .site-header nav a:last-child {
    border-bottom: none;
  }

  /* Featured nav buttons (e.g. "Submit a route") — keep the pill look but
     give them their own row inside the drawer. */
  .site-header nav a.nav-featured {
    margin: 12px 16px;
    padding: 14px 20px;
    font-size: 17px;
    border-bottom: none;
    text-align: center;
  }

  .site-brand {
    font-size: 24px;
  }

  /* Mobile drawer reveals Contact + Privacy at the bottom of the
     hamburger menu (their `nav-mobile-only` class is hidden on
     desktop). The footer is removed entirely so the two surfaces
     don't duplicate the same links. */
  .site-header nav a.nav-mobile-only {
    display: block;
  }

  .site-footer {
    display: none;
  }

  main {
    padding: 16px 16px 48px;
  }

  .modal {
    padding: 4px;
  }

  .modal-panel {
    padding: 16px 10px;
    width: 100%;
  }

  .modal-title-block {
    padding-right: 24px;
  }

  .modal-title-block h2 {
    font-size: 20px;
  }

  /* Stats grids show up inside browse cards, route-cards, event-cards,
     drives, etc. On phones the rows stack 2-up or 1-up so the previous
     10/12px gap added a lot of vertical real estate to a card that's
     mostly metadata. Tighten the gap + divider padding so a card fits
     on screen without scrolling. */
  .stats {
    gap: 4px 8px;
    padding-top: 8px;
  }

  .stat {
    gap: 0;
  }

  .stat-label {
    font-size: 9px;
  }

  .stat-value {
    font-size: 13px;
  }
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-field label {
  font-size: 12px;
  color: var(--muted);
}

.modal-field select {
  padding: 8px 10px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.modal-error {
  color: var(--bad, #c44);
  margin: 0;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.modal-btn:hover {
  border-color: var(--accent);
}

.modal-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.modal-btn-primary:hover {
  filter: brightness(1.05);
  border-color: var(--accent);
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.muted {
  color: var(--muted);
}

/* Auth gate: shown by auth-gate.js when a tool requires sign-in.
 * The page renders behind a blurred backdrop as a preview; <main> is
 * marked inert by JS so keyboard focus and pointer events are blocked. */
body.auth-gated > main {
  filter: blur(2px) saturate(0.7);
  opacity: 0.55;
  user-select: none;
}

.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(14, 17, 22, 0.55);
  backdrop-filter: blur(2px);
}

.auth-gate-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
}

.auth-gate-title {
  margin: 0 0 4px;
}

.auth-gate-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-gate-btn {
  align-self: center;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  border-radius: 999px;
  padding: 10px 22px 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, box-shadow 120ms;
}

.auth-gate-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.auth-gate-google {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-gate-error {
  margin: 0;
  font-size: 13px;
  color: var(--accent);
  text-align: center;
  max-width: 280px;
}

.auth-gate-error[hidden] {
  display: none;
}

.auth-gate-home {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.auth-gate-home:hover {
  color: var(--text);
  text-decoration: underline;
}

