:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #26292e;
  --muted: #5c6470;
  --accent: #2f6690;
  --accent-strong: #1d4e73;
  --border: #e0ddd6;
  --tip-bg: #eef4f8;
  --stats-bg: #f0efe9;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1e23;
    --surface: #23272e;
    --text: #e8e6e1;
    --muted: #a2a9b4;
    --accent: #7db3d8;
    --accent-strong: #a3cbe6;
    --border: #363c45;
    --tip-bg: #26303a;
    --stats-bg: #2a2e35;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-bottom: 3px solid var(--accent);
  background: var(--surface);
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand-sub { color: var(--muted); font-size: 0.9rem; }

main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.25rem;
}

.hero h1 { margin: 0.5rem 0 0.25rem; font-size: 1.9rem; }
h2 {
  margin-top: 2.25rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--border);
  font-size: 1.45rem;
}
h3 { margin-top: 1.5rem; font-size: 1.1rem; }

a { color: var(--accent); overflow-wrap: anywhere; }
a:hover { color: var(--accent-strong); }

.table-wrap { overflow-x: auto; margin: 0.75rem 0; }
table {
  border-collapse: collapse;
  width: 100%;
  background: var(--surface);
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  white-space: nowrap;
}
td:last-child, th:last-child { white-space: normal; min-width: 12rem; }
thead th { background: var(--stats-bg); }
tbody tr:hover { background: var(--tip-bg); }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

.tip {
  background: var(--tip-bg);
  border-left: 4px solid var(--accent);
  padding: 0.6rem 0.9rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.92rem;
}

.crumbs { margin: 0.25rem 0 1rem; font-size: 0.9rem; color: var(--muted); }
.crumbs a { text-decoration: none; font-weight: 600; }

.route h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.gpx { font-size: 0.92rem; }
.gpx a { font-weight: 600; text-decoration: none; }
.weather { font-size: 0.92rem; color: var(--muted); }
.weather a { text-decoration: none; font-weight: 600; }
.weather a:hover { text-decoration: underline; }
.weather-general { margin-top: 0.5rem; }

.route .gps { margin: 0.25rem 0 0.75rem; font-size: 0.95rem; }
.route .gps a { font-weight: 600; text-decoration: none; }
.route .gps-coords { color: var(--muted); font-size: 0.85rem; }
.route .stats {
  background: var(--stats-bg);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
}
.route ul { padding-left: 1.2rem; }
.route li { margin: 0.45rem 0; }
.route blockquote {
  margin: 1rem 0;
  padding: 0.5rem 0.9rem;
  border-left: 4px solid var(--accent);
  background: var(--tip-bg);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
}
.route blockquote p { margin: 0.25rem 0; }

/* Pitch-by-pitch list on route pages */
li.has-pitches { list-style: none; margin-left: -1.2rem; }
.pitch-src { color: var(--muted); font-size: 0.88rem; }
ol.pitches {
  list-style: none;
  margin: 0.5rem 0 0.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
ol.pitches li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
ol.pitches li:last-child { border-bottom: none; }
ol.pitches li:nth-child(even) { background: var(--stats-bg); }
.p-label {
  flex: 0 0 3.4rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.p-grade {
  flex: 0 0 4.2rem;
  font-weight: 700;
  color: var(--accent);
  font-size: 1.02rem;
}
.p-remark { flex: 1 1 auto; min-width: 0; }
.pitch-note {
  margin: 0.5rem 0 0.25rem;
  padding: 0.4rem 0.7rem;
  background: var(--tip-bg);
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 0.92rem;
}

/* Topo image */
figure.topo { margin: 1.5rem 0 0.5rem; }
figure.topo img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}
figure.topo figcaption {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.site-footer {
  max-width: 62rem;
  margin: 2rem auto 0;
  padding: 1rem 1.25rem 2rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* Phones: overview tables become cards — no horizontal scrolling needed */
@media (max-width: 640px) {
  main { padding: 1rem 0.9rem; }
  .hero h1 { font-size: 1.5rem; }

  .table-wrap { overflow-x: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  table { background: none; border: none; font-size: 0.95rem; }
  tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 0.7rem;
    padding: 0.35rem 0;
  }
  tbody tr:hover { background: var(--surface); }
  td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: none;
    padding: 0.3rem 0.85rem;
    white-space: normal;
  }
  td:last-child { min-width: 0; }
  td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    flex: 0 0 auto;
  }
  td[data-label] { text-align: right; }
  td.cell-name {
    text-align: left;
    font-size: 1.05rem;
    padding-top: 0.55rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.2rem;
  }
  td.cell-name a { display: block; padding: 0.15rem 0; }

  ol.pitches li { padding: 0.5rem 0.6rem; flex-wrap: wrap; }
  .p-label { flex-basis: 3rem; }
  .p-remark { flex-basis: 100%; margin-left: 0; font-size: 0.92rem; }
  .p-remark:empty { display: none; }
}
