/* OpenWorldEngineer: earthquake relocation (artifacts-earthquakes.html, assets/art/earthquakes.js). Builds on
   styles.css (tokens, .card, .seg, .note, .tip) and adds only eq- classes.

   Marks, the same in the map and the depth section, told apart by shape first:
   - the selected attempt's relocation: a filled dot in the accent, with a 1.5 px surface ring, and a line to the truth;
   - the true position: a plus in ink (over a surface halo, so it reads on top of the lines);
   - the starter's location: a hollow grey ring (when the starter itself is selected, its rings carry the lines);
   - the tolerance: a faint circle of 0.3 km round each true epicentre on the map, a faint ±0.6 km bar in the section;
   - stations: hollow triangles; the public quarry blasts: a grey six-ray burst. */

.eq {
  container-type: inline-size;
  --eq-run: var(--accent);
  --eq-line: color-mix(in srgb, var(--accent) 78%, transparent);
  --eq-truth: var(--ink);
  --eq-starter: var(--muted);
  --eq-tol-fill: color-mix(in srgb, var(--ink) 5%, transparent);
  --eq-tol-line: color-mix(in srgb, var(--ink) 22%, transparent);
  display: grid; gap: 16px; min-width: 0; color: var(--ink); font-size: var(--fs-ui);
}
.eq-head p { max-width: 80ch; }
.eq-quiet { margin: 0; padding: 18px 0; color: var(--muted); }

/* map + section on the left, the catalog list on the right; stacked when narrow */
.eq-main {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  grid-template-areas: "map side" "sec side"; gap: 16px; align-items: start; min-width: 0;
  grid-template-rows: auto 1fr;                 /* a catalog list taller than map + section: the spare height goes below */
}
.eq-map-card { grid-area: map; }
.eq-sec-card { grid-area: sec; }
.eq-side { grid-area: side; }
.eq-card { padding: 14px; min-width: 0; }
.eq-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; min-height: 36px; }
.eq-title { font-size: 0.9375rem; font-weight: 650; letter-spacing: -0.02em; min-width: 0; }
.eq-sub { font-weight: 500; color: var(--muted); letter-spacing: 0; }
.eq-seg button { padding: 5px 12px; font-size: 0.8125rem; }

.eq-zoom { display: inline-flex; gap: 6px; }
.eq-tbtn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; padding: 0; cursor: pointer;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--sheet); color: var(--ink-2);
}
.eq-tbtn:hover { border-color: var(--accent); color: var(--ink); }
.eq-tbtn svg { width: 15px; height: 15px; }

.eq-map, .eq-sec { position: relative; margin-top: 10px; border: 1px solid var(--rule); border-radius: var(--radius-sm); overflow: hidden; background: var(--sheet); }
.eq-map { cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.eq-map.is-panning { cursor: grabbing; }
.eq-map:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.eq-map svg, .eq-sec svg { display: block; width: 100%; }
.eq-sec { cursor: default; }

/* chart chrome */
.eq-grid line { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.eq-grid line.is-surface { stroke: var(--rule-strong); }
.eq-glab text, .eq-ax text, .eq-scale text, .eq-sta-n {
  font-family: var(--font-mono); font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums;
  paint-order: stroke; stroke: var(--sheet); stroke-width: 3px; stroke-linejoin: round;
}
.eq-ax text { stroke: none; }
.eq-ax .eq-ax-k { fill: var(--ink-2); font-weight: 600; }
.eq-base { stroke: var(--rule-strong); stroke-width: 1; shape-rendering: crispEdges; }
.eq-scale path { fill: none; stroke: var(--ink-2); stroke-width: 1.4; }
.eq-scale path.eq-scale-halo { stroke: var(--sheet); stroke-width: 4; }
.eq-empty { font-size: 13px; fill: var(--muted); }

/* network */
.eq-sta { fill: var(--sheet); stroke: var(--ink-2); stroke-width: 1.3; stroke-linejoin: round; }
.eq-sta-n { font-size: 10px; }
.eq-shot { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linecap: round; }

/* events */
.eq-tol { fill: var(--eq-tol-fill); stroke: var(--eq-tol-line); stroke-width: 1; }
.eq-ztol { stroke: var(--eq-tol-fill); stroke-width: 6; stroke-linecap: round; }
.eq-ln { stroke: var(--eq-line); stroke-width: 1.4; stroke-linecap: round; }
.eq-ln.is-starter { stroke: color-mix(in srgb, var(--eq-starter) 70%, transparent); }
.eq-ln.is-hot { stroke-width: 2.2; }
.eq-st { fill: none; stroke: var(--eq-starter); stroke-width: 1.25; opacity: 0.85; }
.eq-tr { fill: none; stroke: var(--eq-truth); stroke-width: 1.7; stroke-linecap: round; }
.eq-tr-halo { fill: none; stroke: var(--sheet); stroke-width: 4; stroke-linecap: round; }
.eq-rn { fill: var(--eq-run); stroke: var(--sheet); stroke-width: 1.5; }
.eq-rn.is-starter { fill: var(--sheet); stroke: var(--eq-starter); stroke-width: 1.6; }
.eq-focus { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.is-dim { opacity: 0.22; }
.eq-st.is-dim { opacity: 0.18; }

/* legend and hint */
.eq-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 10px; font-size: 0.75rem; color: var(--muted); }
.eq-key { display: inline-flex; align-items: center; gap: 6px; }
.eq-key svg { flex: none; overflow: visible; }
.eq-hint { margin: 6px 0 0; font-size: 0.75rem; }

/* readout of the hovered or picked event */
.eq-now { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: var(--fs-small); color: var(--muted); min-height: 32px; }
.eq-now b { font-family: var(--font-mono); font-weight: 640; color: var(--ink); font-variant-numeric: tabular-nums; }
.eq-now-id { font-family: var(--font-mono); font-weight: 700; color: var(--ink); }
.eq-clear {
  margin-left: auto; padding: 3px 10px; cursor: pointer; font: inherit; font-size: 0.75rem; color: var(--ink-2);
  border: 1px solid var(--rule-strong); border-radius: 0; background: var(--sheet);
}
.eq-clear:hover { border-color: var(--accent); color: var(--ink); }

/* catalog list: the picker, with each catalog's graded reward */
.eq-rlist { display: grid; gap: 6px; margin-top: 12px; }
.eq-r {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 10px 11px;
  text-align: left; cursor: pointer; overflow: hidden; font: inherit;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--sheet); color: var(--ink-2);
  transition: border-color 140ms;
}
.eq-r:hover { border-color: var(--accent); color: var(--ink); }
.eq-r[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--ink); }
.eq-r-n { font-size: 0.875rem; font-weight: 600; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.eq-r-a { font-weight: 500; color: var(--muted); }
.eq-r-v { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 640; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eq-r-s { grid-column: 1 / -1; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.eq-r-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--s, 0) * 100%); background: var(--line-on); }
.eq-r[aria-checked="true"] .eq-r-bar { background: var(--accent); }
.eq-side-foot { margin-top: 12px; }
.eq-side-foot p { margin: 0 0 8px; }
.eq-side-foot p:last-child { margin-bottom: 0; }
.eq-side-foot b { font-family: var(--font-mono); font-weight: 640; color: var(--ink-2); }
.eq-side-foot a { color: var(--link); }

/* per-event table */
.eq-details { padding: 0; min-width: 0; }
.eq-details summary { padding: 12px 14px; cursor: pointer; font-size: 0.9375rem; font-weight: 650; letter-spacing: -0.02em; border-radius: var(--radius); }
.eq-details[open] summary { border-bottom: 1px solid var(--rule); border-radius: var(--radius) var(--radius) 0 0; }
.eq-twrap { overflow-x: auto; max-height: 460px; overflow-y: auto; }
.eq-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.eq-table th, .eq-table td { padding: 5px 14px; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.eq-table th { position: sticky; top: 0; background: var(--sheet); font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.eq-table .num { text-align: right; font-family: var(--font-mono); color: var(--muted); }
.eq-table td.is-in { color: var(--ink); font-weight: 640; }
.eq-table tr.is-sel td { background: var(--hover); }
.eq-ev { padding: 2px 6px; margin: -2px -6px; cursor: pointer; font: inherit; font-family: var(--font-mono); font-weight: 600; color: var(--ink); border: 0; border-radius: 0; background: none; }
.eq-ev:hover { color: var(--link-hover); }
.eq-tfoot { margin: 0; padding: 10px 14px 12px; }

@container (max-width: 860px) {
  .eq-main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "map" "sec" "side"; grid-template-rows: none; }
}
@container (max-width: 560px) {
  .eq-card { padding: 12px; }
  .eq-table th, .eq-table td { padding: 5px 8px; }
  .eq-hint { display: none; }
}

/* the strike arrow on the map: the direction the depth section runs */
.eq-strike path { fill: none; stroke: var(--ink-2); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.eq-strike path.eq-strike-halo { stroke: var(--sheet); stroke-width: 4; }
.eq-strike text { font-family: var(--font-mono); font-size: 10px; fill: var(--muted); paint-order: stroke; stroke: var(--sheet); stroke-width: 3px; }

/* in a task page's frame: one catalog, so the map and the section take the full width, the totals line below */
.embed .eq-main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "map" "sec"; grid-template-rows: none; }
.eq-totals { margin: 0; max-width: 100ch; }
.eq-totals b { font-family: var(--font-mono); font-weight: 640; color: var(--ink-2); }
