/* gps tools — styles owned by the gps work; keep area-specific rules here, shared tokens stay in style.css */
/* activity file repair kit (site/gps/app.js). Route colours reuse the validated chart series tokens. */
:root { --gps-start: #1B7347; --gps-end: #C0362C; }
:root[data-theme="dark"] { --gps-start: #62CE95; --gps-end: #F07A6E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --gps-start: #62CE95; --gps-end: #F07A6E; } }

.gps { gap: 16px; }
.gps-work { display: grid; gap: 16px; }
.gps-work[hidden] { display: none; }

/* open files */
.gps-files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.gps-files:empty { display: none; }
.gps-files li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.gps-files li b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gps-files li .note { grid-column: 1; font-variant-numeric: tabular-nums; }
.gps-files li.err { display: block; border-color: color-mix(in srgb, #C0362C 45%, var(--line)); }
.gps-x { grid-row: 1 / span 2; grid-column: 2; width: 32px; height: 32px; border: 0; border-radius: 8px; background: var(--soft); color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; }
.gps-x:hover { background: var(--line); }

/* what to do: a segmented control */
.gps-modes { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--soft); justify-self: start; max-width: 100%; }
.gps-modes button { border: 0; background: none; color: var(--ink); border-radius: 9px; padding: 8px 14px; font-weight: 600; font-size: 15px; cursor: pointer; }
.gps-modes button:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.gps-modes button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.gps-modes button:focus-visible { outline: 3px solid var(--blue); outline-offset: 1px; }

.gps-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; align-items: end; }
.gps-opts:empty { display: none; }
.gps-opts > .note { grid-column: 1 / -1; }
.gps .gps-opts input[type=datetime-local] { border: 2px solid var(--line); background: var(--paper); border-radius: 10px; padding: 8px 10px; width: 100%; color: var(--ink); font: inherit; }
.gps-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.gps .gps-pair select { width: auto; }

.gps-notes { margin: 0; padding: 0 0 0 18px; display: grid; gap: 4px; font-size: 14px; }
.gps-notes:empty { display: none; }
.gps-notes li.err { list-style: none; margin-left: -18px; }

/* track drawing + numbers */
.gps-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.gps-track { width: 100%; height: auto; display: block; background: var(--soft); border-radius: 12px; }
.gps-line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.gps-line.keep, .gps-line.a { stroke: var(--series-0); }
.gps-line.b { stroke: var(--series-1); }
.gps-line.drop { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 4 4; opacity: .7; }
.gps-start { fill: var(--gps-start); stroke: var(--panel); stroke-width: 2.5; }
.gps-end { fill: var(--gps-end); stroke: var(--panel); stroke-width: 2.5; }
.gps-empty { fill: var(--muted); font: 14px var(--body); }
.gps-stats { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gps-stats > div { padding: 8px 12px; border-radius: 10px; background: var(--soft); min-width: 0; }
.gps-stats dt { font-size: 13px; color: var(--muted); }
.gps-stats dd { margin: 0; font: 600 17px/1.3 var(--body); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gps-stats h4 { grid-column: 1 / -1; margin: 6px 0 0; font-size: 14px; }
.gps-stats h4::before { content: ""; display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.gps-part.s0::before { background: var(--series-0); } .gps-part.s1::before { background: var(--series-1); }
.gps-stats.two h4:first-child { margin-top: 0; }

/* profile charts with range handles */
.gps-profile { display: grid; gap: 12px; }
.gps-chart h4 { margin: 0 0 4px; font-size: 14px; color: var(--muted); font-weight: 600; }
.gps-range { position: absolute; pointer-events: none; }
.gps-shade { position: absolute; top: 0; bottom: 0; left: 0; background: color-mix(in srgb, var(--paper) 72%, transparent); }
.gps-handle {
  position: absolute; top: -6px; bottom: -6px; width: 28px; margin-left: -14px; pointer-events: auto; cursor: ew-resize; touch-action: none;
  display: grid; place-items: center; outline: none;
}
.gps-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 13px; width: 2px; background: var(--ink); }
.gps-handle::after { content: ""; position: relative; width: 14px; height: 30px; border-radius: 7px; background: var(--yellow); border: 2px solid var(--ink); }
.gps-handle:focus-visible::after, .gps-handle.drag::after { box-shadow: 0 0 0 3px var(--blue); }
.gps-range.mirror .gps-handle::after { height: 22px; }

.gps-export { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; }

/* simplify: tolerance slider and the live "N → M points" readout */
.gps-slide input[type=range] { width: 100%; accent-color: var(--ink); }
.gps-readout { font: 600 17px/1.3 var(--body); font-variant-numeric: tabular-nums; align-self: center; }

@media (max-width: 700px) {
  .gps-view { grid-template-columns: 1fr; }
  .gps-modes { justify-self: stretch; gap: 2px; }
  .gps-modes button { flex: 1 1 auto; padding: 8px 6px; font-size: 14px; white-space: nowrap; }
  .gps-export .btn { flex: 1 1 auto; }
}

/* ── geo file converter (site/geo/app.js) ─────────────────────────────── */
.geo .geo-paste { width: 100%; margin-top: 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); padding: 8px 10px; font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.geo .geo-paste:focus { border-color: var(--ink); outline: none; }
.geo-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.geo-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; min-width: 0; }
.geo-card.err { border-color: color-mix(in srgb, #C0362C 45%, var(--line)); }
.geo-card.err p { margin: 0; }
.geo-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.geo-top .gps-x { grid-row: auto; grid-column: 2; }
.geo-head { display: grid; min-width: 0; }
.geo-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-body { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 14px; align-items: start; }
.geo-side { display: grid; gap: 10px; min-width: 0; }
.geo-side .note, .geo-side p { margin: 0; }
.geo-area { fill: color-mix(in srgb, var(--series-1) 22%, transparent); stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; }
.geo-dot { fill: var(--series-0); stroke: var(--panel); stroke-width: 1.5; }
.geo-text summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.geo-text pre { margin: 8px 0 0; max-height: 320px; overflow: auto; padding: 10px; border-radius: 10px; background: var(--soft); font-size: 12px; line-height: 1.45; white-space: pre; }

/* ── coordinates (site/geo/coords-app.js) ─────────────────────────────── */
.geo .geo-coord-in { width: 100%; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); padding: 12px 14px; font: 600 18px/1.3 var(--body); }
.geo .geo-coord-in:focus { border-color: var(--ink); outline: none; }
.geo-read { margin: 8px 0 0; }
.geo-read:empty { display: none; }
.geo-read.err { color: var(--ink); font-weight: 600; }
.geo-coords { margin: 0; display: grid; gap: 6px; }
.geo-coords:empty { display: none; }
.geo-coords > div { display: grid; grid-template-columns: minmax(0, 15em) minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--soft); }
.geo-coords > div.main { background: color-mix(in srgb, var(--yellow) 30%, var(--soft)); }
.geo-coords dt { font-size: 14px; color: var(--muted); }
.geo-coords dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.geo-coords code { font: 600 16px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.geo-coords small { color: var(--muted); font-size: 13px; }
.geo-coords .copy { margin-left: auto; }

/* ── activity analyzer (site/gps/analyzer.js) ─────────────────────────── */
:root { --z1: #7C8B94; --z2: #2F6DB5; --z3: #1B7347; --z4: #B7791F; --z5: #C0362C; }
:root[data-theme="dark"] { --z1: #9AA7AD; --z2: #7EA6F0; --z3: #62CE95; --z4: #E8B24F; --z5: #F07A6E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --z1: #9AA7AD; --z2: #7EA6F0; --z3: #62CE95; --z4: #E8B24F; --z5: #F07A6E; } }
.act-stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
/* the route drawing: five steps from low to high, in the zone colours */
.gps-line.c0 { stroke: var(--z1); } .gps-line.c1 { stroke: var(--z2); } .gps-line.c2 { stroke: var(--z3); } .gps-line.c3 { stroke: var(--z4); } .gps-line.c4 { stroke: var(--z5); }
.act-route-key { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; margin-top: 8px; }
.act-ramp { display: flex; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.act-ramp i { width: 22px; height: 8px; } .act-ramp i:first-of-type { border-radius: 4px 0 0 4px; } .act-ramp i:last-of-type { border-radius: 0 4px 4px 0; }
.act-ramp span:first-child { margin-right: 6px; } .act-ramp span:last-child { margin-left: 6px; }
.act-ramp .c0 { background: var(--z1); } .act-ramp .c1 { background: var(--z2); } .act-ramp .c2 { background: var(--z3); } .act-ramp .c3 { background: var(--z4); } .act-ramp .c4 { background: var(--z5); }
.act-splits h4, .act-zones h4 { margin: 0 0 8px; font-size: 15px; }
.act-scroll { overflow-x: auto; }
.act-splits table { width: 100%; max-width: 760px; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.act-splits th, .act-splits td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.act-splits th:first-child, .act-splits td:first-child { text-align: left; }
.act-splits th { font-weight: 600; color: var(--muted); font-size: 13px; }
.act-splits tr.best td { font-weight: 700; }
.act-splits tr.best td:first-child::after { content: " ★"; color: var(--z4); }
.act-zones ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.act-zones li { display: grid; grid-template-columns: 8.5em minmax(0, 1fr) 7.5em; gap: 10px; align-items: center; font-variant-numeric: tabular-nums; }
.act-zl, .act-zt { display: grid; font-weight: 600; font-size: 14px; }
.act-zt { text-align: right; }
.act-zl small, .act-zt small { font-weight: 400; color: var(--muted); font-size: 12px; }
.act-bar { height: 14px; border-radius: 7px; background: var(--soft); overflow: hidden; }
.act-bar i { display: block; height: 100%; border-radius: 7px; }
.act-zones .z1 i { background: var(--z1); } .act-zones .z2 i { background: var(--z2); } .act-zones .z3 i { background: var(--z3); }
.act-zones .z4 i { background: var(--z4); } .act-zones .z5 i { background: var(--z5); }

@media (max-width: 700px) {
  .geo-body { grid-template-columns: 1fr; }
  .geo-coords > div { grid-template-columns: 1fr; }
  .act-zones li { grid-template-columns: 6.5em minmax(0, 1fr) 6em; gap: 8px; }
}
