/* The plot itself owns the coordinate plane. Separate SVG lanes and HTML
   beacons allow the targets and type to stay readable at mobile sizes. */
.star-map {
  --map-route: #9de6ce;
  --map-lane: #7999a4;
  --map-future: #a0aeb9;
  container-type: inline-size;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  position: relative;
  border: 1px solid #4b6570;
  border-radius: 4px;
  background: #0b1622;
  box-shadow: 0 2px 6px #0b141b66;
}
.star-map-field {
  position: relative;
  width: 100%;
  height: clamp(252px, 38vh, 350px);
  background:
    radial-gradient(ellipse at 23% 92%, #2749555c, transparent 51%),
    radial-gradient(ellipse at 86% 13%, #4c3e534a, transparent 44%),
    radial-gradient(ellipse at 57% 45%, #21384855, transparent 58%);
}
.star-map-field::before,
.star-map-field::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.star-map-field::before {
  background:
    radial-gradient(ellipse 55% 98% at 8% 60%, transparent 54.65%, #7fa6b319 55%, transparent 55.45%, transparent 90.6%, #7fa6b31c 91%, transparent 91.4%),
    linear-gradient(#7e9ead0c 1px, transparent 1px) center / 44px 44px,
    linear-gradient(90deg, #7e9ead0c 1px, transparent 1px) center / 44px 44px;
}
.star-map-field::after {
  inset: 5px;
  background:
    linear-gradient(#73929d95 0 0) left top / 9px 1px,
    linear-gradient(#73929d95 0 0) left top / 1px 9px,
    linear-gradient(#73929d95 0 0) right top / 9px 1px,
    linear-gradient(#73929d95 0 0) right top / 1px 9px,
    linear-gradient(#73929d95 0 0) left bottom / 9px 1px,
    linear-gradient(#73929d95 0 0) left bottom / 1px 9px,
    linear-gradient(#73929d95 0 0) right bottom / 9px 1px,
    linear-gradient(#73929d95 0 0) right bottom / 1px 9px;
  background-repeat: no-repeat;
}
.star-map-sky,.star-map-links {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.star-map-sky { fill: #ceecea; }
.star-map-lane {
  stroke: var(--map-lane);
  stroke-width: 1.45px;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}
.star-map-lane[data-kind="selected"] {
  stroke: var(--map-route);
  stroke-width: 2.5px;
}
.star-map-lane[data-kind="preview"],.star-map-lane[data-kind="onward"] {
  stroke: #718894;
  stroke-width: 1.3px;
  stroke-dasharray: 2.5 5;
}
.star-map-lane[data-kind="onward"] { stroke: #92b4b7; }
.star-map-lane[data-kind="visited"] { stroke: #69909b; stroke-dasharray: 1 4; }
.star-map .star-map-node {
  --node-color: #b2d2d7;
  --node-size: 22px;
  position: absolute;
  z-index: 1;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  background: none;
  box-shadow: none;
  border: 0;
  border-radius: 50%;
  color: var(--node-color);
  text-align: center;
  text-shadow: none;
  transition: none;
}
.star-map button.star-map-node:active { background: none; transform: translate(-50%, -50%); box-shadow: none; }
.star-map button.star-map-node:focus-visible { z-index: 5; outline: 2px solid #e8dba8; outline-offset: -2px; }
.star-map-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--node-size);
  height: var(--node-size);
  border: 1px solid var(--node-color);
  border-radius: 50%;
  background: #152530;
  color: var(--node-color);
  box-shadow: 0 0 0 3px #101d2acc, 0 0 12px #7ca5ae26;
}
.star-map-marker > svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.star-map-node[data-kind="reachable"] .star-map-marker::before,
.star-map-node[data-selected="true"] .star-map-marker::before {
  content: '';
  position: absolute;
  inset: -5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: .38;
}
.star-map-node[data-selected="true"] { --node-color: var(--map-route); z-index: 2; }
.star-map-node[data-selected="true"] .star-map-marker {
  box-shadow: 0 0 0 3px #102422, 0 0 17px #87e8cb73;
  background: #294641;
}
.star-map-node[data-selected="true"] .star-map-marker::before { opacity: .95; }
.star-map-node[data-kind="future"] { --node-size: 12px; --node-color: var(--map-future); }
.star-map-node[data-kind="future"] .star-map-marker { transform: rotate(45deg); border-radius: 1px; }
.star-map-node[data-kind="future"] .star-map-marker > svg { width: 65%; height: 65%; transform: rotate(-45deg); }
.star-map-node[data-kind="future"][data-selected="true"] { --node-color: #e0c888; }
.star-map-node[data-kind="visited"] { --node-size: 19px; --node-color: #8aa4ae; }
.star-map-node[data-kind="ship"] { --node-color: #e4c587; --node-size: 38px; }
.star-map-node[data-kind="ship"] .star-map-marker { background: #152632; border: 1px dashed #9a876b; box-shadow: 0 0 0 2px #12202c, 0 0 17px #daa75b30; }
.star-map .star-map-marker .chart-planet { position: static; width: 100%; height: 100%; transform: none; filter: none; }
.star-map-marker:has(.chart-planet) { min-width: 27px; min-height: 27px; }
.star-map-node[data-kind="ship"] .star-map-marker:has(.chart-planet) { min-width: 29px; min-height: 29px; width: 29px; height: 29px; }
.star-map-marker .star-map-ship-pin { position: absolute; top: -6px; left: -14px; width: 22px; height: 19px; filter: drop-shadow(1px 1px 1px #101a23); }
.star-map-ship-pin svg { width: 100%; height: 100%; }
.star-map-label {
  position: absolute;
  top: calc(50% + var(--node-size) / 2 + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(142px, var(--label-max));
  padding: 0 2px;
  color: #d6e2df;
  font: 700 12px/1.15 var(--display);
  text-wrap: balance;
  overflow-wrap: anywhere;
  white-space: normal;
  text-shadow: 0 1px 2px #06121b, 1px 0 3px #06121b, -1px 0 3px #06121b;
}
.star-map-label small { display: block; font: 11px/1.2 var(--body); color: #b3c3c7; margin-top: 2px; }
.star-map-node[data-selected="true"] .star-map-label { color: var(--node-color); }
.star-map-node[data-kind="ship"] .star-map-label { color: #e3c88e; font-size: 11px; }
.star-map-node[data-kind="future"] .star-map-label { color: #aabdcb; font-size: 11px; }
.star-map-key { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 6px 2px; color: #afc2c6; font: 11px/1.25 var(--body); }
.star-map-key span { display: inline-flex; align-items: center; gap: 5px; }
.star-map-key i { width: 17px; border-top: 2px solid #9ebbbd; }
.star-map-key .key-preview { border-top: 2px dotted #93a7b4; }
@media (hover: hover) {
  .star-map button.star-map-node:hover .star-map-marker { outline: 1px solid #e3e9ca; outline-offset: 3px; }
  .star-map button.star-map-node:hover .star-map-label { color: #f1edd8; }
}
@media (max-height: 690px) {
  .star-map-field { height: 224px; }
}
@container (max-width: 370px) {
  .star-map-label { font-size: 11px; }
  .star-map-node[data-kind="future"] .star-map-label,.star-map-key { font-size: 10px; }
}
