/* Shared styles for the poke-analysis route site.
   Tokens follow the PokeScrapper analysis design system (wasatch map). */
:root {
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --route: #2a78d6;
  --route-strong: #1c5cab;
  --ctxgym: #c8423b;
  --start: #eb6834;
  --row-hover: rgba(42, 120, 214, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --plane: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --route: #3987e5;
    --route-strong: #6da7ec;
    --ctxgym: #e2635b;
    --start: #d95926;
    --row-hover: rgba(57, 135, 229, 0.14);
  }
}
:root[data-theme="dark"] {
  --plane: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --route: #3987e5;
  --route-strong: #6da7ec;
  --ctxgym: #e2635b;
  --start: #d95926;
  --row-hover: rgba(57, 135, 229, 0.14);
}
:root[data-theme="light"] {
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --route: #2a78d6;
  --route-strong: #1c5cab;
  --ctxgym: #c8423b;
  --start: #eb6834;
  --row-hover: rgba(42, 120, 214, 0.08);
}

* { box-sizing: border-box; }
body {
  background: var(--plane);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  padding: 24px;
  line-height: 1.45;
}
.wrap { max-width: 1160px; margin: 0 auto; }

.crumb {
  font-size: 13px;
  margin: 0 0 10px;
}
.crumb a { color: var(--route); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

header h1 { font-size: 22px; font-weight: 650; margin: 0 0 4px; text-wrap: balance; }
header p.sub { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 68ch; }

.tiles { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 20px; }
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 18px 10px;
  min-width: 128px;
  flex: 0 1 auto;
}
.tile .label { font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
.tile .value { font-size: 26px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .note { font-size: 12px; color: var(--ink-2); }

.main { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.map-card, .side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.map-card { flex: 1 1 560px; min-width: 300px; position: relative; }
.side-card { flex: 1 1 300px; min-width: 280px; max-width: 420px; }
.map-card svg { display: block; margin: 0 auto; }

.toggle { display: flex; gap: 6px; margin-bottom: 12px; }
.toggle button {
  flex: 1;
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.toggle button[aria-pressed="true"] {
  background: var(--route);
  border-color: var(--route);
  color: #fff;
  font-weight: 600;
}
.toggle button:focus-visible { outline: 2px solid var(--route-strong); outline-offset: 2px; }

ol.stops { list-style: none; margin: 0; padding: 0; font-size: 13px; }
ol.stops li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 5px 6px;
  border-radius: 6px;
}
ol.stops li:hover { background: var(--row-hover); }
ol.stops .n {
  flex: 0 0 20px;
  height: 20px;
  line-height: 20px;
  border-radius: 50%;
  background: var(--route);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  text-align: center;
  align-self: center;
  font-variant-numeric: tabular-nums;
}
ol.stops li.end .n { background: var(--start); }
ol.stops li.optional .n {
  background: transparent;
  border: 2px dashed var(--ctxgym);
  color: var(--ctxgym);
  line-height: 16px;
}
ol.stops li.optional { color: var(--ink-2); }
ol.stops .leg {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.side-total {
  border-top: 1px solid var(--border);
  margin-top: 10px;
  padding-top: 10px;
  font-size: 13px;
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}
.downloads { margin-top: 10px; font-size: 13px; }
.downloads a { color: var(--route); text-decoration: none; margin-right: 14px; }
.downloads a:hover { text-decoration: underline; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--plane);
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  transform: translate(-50%, -130%);
  opacity: 0;
  transition: opacity 80ms linear;
  font-variant-numeric: tabular-nums;
  max-width: 90vw;
}
@media (prefers-reduced-motion: reduce) { .tooltip { transition: none; } }

.notes { margin-top: 20px; font-size: 13px; color: var(--ink-2); max-width: 82ch; }
.notes p { margin: 6px 0; }
.notes .k { color: var(--ink); font-weight: 600; }
.legend-swatch {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
}

/* ── index page ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
a.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: var(--ink);
}
a.card:hover { border-color: var(--route); }
.card h2 { font-size: 16px; font-weight: 650; margin: 0 0 2px; }
.card .place { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.card .thumb { color: var(--route); display: block; margin: 4px 0 10px; }
.card .thumb .ctxdot { fill: var(--ctxgym); }
.card .stats { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.card .stats b { color: var(--ink); font-weight: 600; }

footer {
  margin-top: 28px;
  font-size: 12px;
  color: var(--muted);
}

/* ── small screens ── */
@media (max-width: 720px) {
  body { padding: 12px; }
  header h1 { font-size: 19px; }
  .tile { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); padding: 10px 12px 8px; }
  .tile .value { font-size: 21px; }
  .map-card, .side-card { flex: 1 1 100%; max-width: none; }
  .map-card { padding: 8px; }
}
