/* PathProfile — topographic-instrument look: cool survey paper, earth-brown terrain,
   signal-red line of sight, Fresnel cyan. Chart colours are mirrored in js/export.js. */

@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap;
  src: url(/fonts/barlow-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap;
  src: url(/fonts/barlow-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap;
  src: url(/fonts/barlow-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap;
  src: url(/fonts/barlow-latin-ext-600-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap;
  src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap;
  src: url(/fonts/barlow-condensed-latin-ext-600-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap;
  src: url(/fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap;
  src: url(/fonts/ibm-plex-mono-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap;
  src: url(/fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap;
  src: url(/fonts/ibm-plex-mono-latin-ext-500-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --paper: #e9efed;
  --panel: #f7f9f8;
  --chart-bg: #f7f9f8;
  --ink: #16242a;
  --ink-muted: #5b6b70;
  --line: #cbd6d3;
  --grid: #dde5e3;
  --terrain: #a7845c;
  --terrain-edge: #6e5236;
  --clutter: #6f8f4e;
  --los: #d23f2a;
  --fresnel: #1f7fa8;
  --clear: #2d7d4f;
  --marginal: #b7791f;
  --obstructed: #c0392b;
  --focus: #1f7fa8;
  --field: #ffffff;

  --f-body: 'Barlow', system-ui, sans-serif;
  --f-label: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius: 5px;
  --gap: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1518;
    --panel: #142024;
    --chart-bg: #142024;
    --ink: #dce6e4;
    --ink-muted: #8fa1a5;
    --line: #2a3a3f;
    --grid: #22323a;
    --terrain: #84653f;
    --terrain-edge: #c9a57a;
    --clutter: #5f7d43;
    --los: #ff6a4d;
    --fresnel: #4fb3d9;
    --clear: #47a873;
    --marginal: #e0a63a;
    --obstructed: #ef5a48;
    --focus: #4fb3d9;
    --field: #0f1a1d;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.45 var(--f-body);
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Labels read like engraved instrument legends */
.label {
  display: block;
  margin: 0 0 6px;
  font: 600 13px/1.2 var(--f-label);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.hint { margin: 4px 0 0; font-size: 13px; color: var(--ink-muted); }
.unit { font: 400 13px var(--f-mono); color: var(--ink-muted); }

/* ---------------------------------------------------------------- header */
.bar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { width: 34px; height: 34px; color: var(--los); flex: none; }
.brand h1 { margin: 0; font: 600 24px/1 var(--f-label); letter-spacing: .02em; }
.tagline { margin: 2px 0 0; font-size: 13px; color: var(--ink-muted); }
.route {
  margin: 0 0 0 auto;
  font: 600 22px/1 var(--f-label);
  letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.route .arrow { color: var(--los); padding: 0 .35em; }
.route .dist { color: var(--ink-muted); font-weight: 600; }
button.ghost {
  flex: none;
  border: 1px solid var(--line); background: transparent; border-radius: var(--radius);
  padding: 6px 12px; cursor: pointer; font: 600 14px var(--f-label); letter-spacing: .06em;
}
button.ghost:hover, a.ghost:hover { border-color: var(--ink-muted); }
a.ghost {
  flex: none; color: inherit; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 12px; font: 600 14px var(--f-label); letter-spacing: .06em;
}
#help-link { margin-left: 0; }
.route + #help-link { margin-left: 0; }

/* ---------------------------------------------------------------- help page */
.brand.home { color: inherit; text-decoration: none; margin-right: auto; }
.help {
  max-width: 780px; margin: 24px auto 32px; padding: 8px 32px 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.help h2 { font: 600 32px/1.1 var(--f-label); letter-spacing: .02em; margin: 20px 0 8px; }
.help h3 {
  font: 600 15px/1.2 var(--f-label); letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-muted); margin: 28px 0 8px; padding-top: 14px; border-top: 1px solid var(--line);
}
.help .lead { font-size: 18px; color: var(--ink); }
.help ul { padding-left: 20px; }
.help li { margin: 4px 0; }
.help code {
  font: 500 13px var(--f-mono); background: var(--paper); border: 1px solid var(--line);
  border-radius: 3px; padding: 0 4px; white-space: nowrap;
}
.terms { display: grid; grid-template-columns: 190px 1fr; gap: 6px 16px; margin: 0; }
.terms dt { font-weight: 600; }
.terms dd { margin: 0; }
.terms .ok { color: var(--clear); }
.terms .mid { color: var(--marginal); }
.terms .bad { color: var(--obstructed); }
.legend-list { list-style: none; padding-left: 0 !important; }
.sw { display: inline-block; width: 22px; height: 12px; margin-right: 10px; vertical-align: -1px; border-radius: 2px; }
.sw-terrain { background: var(--terrain); }
.sw-clutter { background: var(--clutter); }
.sw-los { height: 3px; vertical-align: 3px; background: var(--los); }
.sw-fresnel { background: color-mix(in srgb, var(--fresnel) 18%, transparent); border: 1px solid var(--fresnel); }
.sw-dim { width: 3px; height: 14px; margin: 0 19px 0 9px; background: var(--marginal); }
@media (max-width: 720px) {
  .help { margin: 12px 16px 24px; padding: 4px 18px 18px; }
  .terms { grid-template-columns: 1fr; }
  .terms dd { margin-bottom: 8px; }
}

/* ---------------------------------------------------------------- layout */
.layout {
  /* Map and chart fit one desktop screen; the side column scrolls on its own. */
  --map-h: clamp(420px, calc(100vh - 480px), 820px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  grid-template-areas:
    "map side"
    "chart chart";
  gap: var(--gap);
  padding: var(--gap) 24px 32px;
  max-width: 1680px;
  margin: 0 auto;
}
.side {
  grid-area: side;
  display: flex; flex-direction: column; gap: var(--gap);
  height: var(--map-h);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.side > .panel { flex: none; }
.map-wrap { grid-area: map; height: var(--map-h); position: relative; }
.chart-wrap { grid-area: chart; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
#map {
  position: absolute; inset: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--grid);
}

/* ---------------------------------------------------------------- inputs */
.station { position: relative; }
.station-head { display: flex; justify-content: space-between; align-items: baseline; }
.station-head .aside { font-size: 11px; }
.station-row { display: flex; gap: 8px; }
input, select {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 9px;
  min-width: 0;
}
input:hover, select:hover { border-color: var(--ink-muted); }
input[aria-invalid="true"] { border-color: var(--obstructed); }
/* Locators are the protagonist: set large, monospaced, uppercase */
input.point {
  flex: 1;
  font: 500 20px/1.2 var(--f-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 8px 10px;
}
input.point::placeholder { text-transform: none; letter-spacing: 0; font: 400 15px var(--f-body); }
.height { display: flex; align-items: center; gap: 4px; flex: none; }
.height input { width: 64px; font-family: var(--f-mono); text-align: right; }
.point-info {
  min-height: 1.4em;
  margin: 5px 0 0;
  font: 400 12.5px/1.4 var(--f-mono);
  color: var(--ink-muted);
}
.point-info .loc { color: var(--ink); font-weight: 500; }
.point-info .warn { display: block; color: var(--marginal); font-family: var(--f-body); font-size: 13px; }
.point-info .err { color: var(--obstructed); font-family: var(--f-body); font-size: 13px; }
.locate {
  flex: none; width: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--field); color: var(--ink-muted); cursor: pointer;
}
.locate svg { width: 20px; height: 20px; }
.locate:hover { color: var(--ink); border-color: var(--ink-muted); }
.locate.busy svg { animation: pulse 1s ease-in-out infinite; color: var(--fresnel); }
@keyframes pulse { 50% { opacity: .3; } }
.input-hint { margin: 10px 0 0; line-height: 1.6; }
.input-hint code {
  font: 500 12px var(--f-mono);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
  white-space: nowrap;
}
.swap {
  display: block; margin: 2px 0 2px auto;
  border: 1px solid var(--line); background: transparent; border-radius: 50%;
  width: 30px; height: 30px; cursor: pointer; font-size: 15px; line-height: 1;
  margin-right: 82px;
}
.swap:hover { border-color: var(--ink-muted); }

fieldset { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
fieldset > legend { padding: 0; }
.radio { border-top: 1px solid var(--line); padding-top: 14px; }
.field { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 4px 10px; margin-top: 8px; }
.field > label { font-size: 15px; }
.field .hint { grid-column: 2; margin: 0; }
.combo { display: flex; align-items: center; gap: 6px; }
.combo select { flex: 1; min-width: 0; font-family: var(--f-mono); font-size: 14px; }
.combo input { flex: 1; width: 0; font-family: var(--f-mono); text-align: right; }
.combo select + input:not([hidden]) { flex: 0 0 96px; }

.styles { border-top: 1px solid var(--line); padding-top: 14px; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.segmented label { flex: 1; text-align: center; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; padding: 6px 4px;
  font: 600 14px var(--f-label); letter-spacing: .05em;
  border-left: 1px solid var(--line);
}
.segmented label:first-child span { border-left: 0; }
.segmented input:checked + span { background: var(--ink); color: var(--panel); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }

.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }
.presets, .stations { border-top: 1px solid var(--line); padding-top: 14px; }
.presets .combo + .combo, .stations .combo + .combo { margin-top: 8px; }
.presets .combo input, .stations .combo input { text-align: left; font-family: var(--f-body); }
.stations .combo button.small { padding: 6px 8px; }
.point-info .station-name { color: var(--los); font: 600 14px var(--f-label); letter-spacing: .04em; }
button.small {
  flex: none;
  border: 1px solid var(--ink); background: transparent; border-radius: var(--radius);
  padding: 6px 10px; cursor: pointer;
  font: 600 13px var(--f-label); letter-spacing: .06em; text-transform: uppercase;
}
button.small:hover:not(:disabled) { background: var(--ink); color: var(--panel); }
button.small:disabled { opacity: .4; cursor: default; }
.message {
  margin: 16px 0 0; padding: 10px 12px;
  border-left: 3px solid var(--obstructed);
  background: color-mix(in srgb, var(--obstructed) 9%, transparent);
  font-size: 14px;
}

/* ---------------------------------------------------------------- chart */
.chart-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--chart-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 300px;
}
#chart { display: block; }
.chart-empty {
  position: absolute; inset: 0; margin: 0;
  display: grid; place-items: center; padding: 24px; text-align: center;
  color: var(--ink-muted); font-size: 15px;
}
.chart-empty.loading { background: color-mix(in srgb, var(--chart-bg) 70%, transparent); }
.tip {
  position: absolute; top: 34px;
  pointer-events: none;
  background: var(--ink); color: var(--panel);
  border-radius: var(--radius);
  padding: 7px 10px;
  font: 400 12px/1.5 var(--f-mono);
  white-space: nowrap;
  z-index: 2;
}
.tip b { font-weight: 500; }
.tip .tl { font-family: var(--f-label); letter-spacing: .06em; text-transform: uppercase; opacity: .7; font-size: 11px; }

/* ---------------------------------------------------------------- results */
.status {
  border-left: 5px solid var(--status, var(--ink-muted));
  padding: 6px 0 6px 12px;
  margin-bottom: 14px;
}
.status strong { display: block; font: 600 26px/1.1 var(--f-label); letter-spacing: .03em; color: var(--status); }
.status span { font-size: 14px; color: var(--ink-muted); }
.status[data-status="clear"] { --status: var(--clear); }
.status[data-status="marginal"] { --status: var(--marginal); }
.status[data-status="obstructed"] { --status: var(--obstructed); }
.figures { display: grid; grid-template-columns: 1fr auto; margin: 0; }
.figures dt, .figures dd { padding: 6px 0; border-top: 1px solid var(--line); margin: 0; }
.figures dt { font-size: 14px; color: var(--ink-muted); }
.figures dd { font: 400 14px var(--f-mono); text-align: right; }
.figures dd small { display: block; font-size: 11.5px; color: var(--ink-muted); }
.figures .strong { font-weight: 500; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions button {
  flex: 1 1 auto;
  border: 1px solid var(--ink); background: transparent; border-radius: var(--radius);
  padding: 8px 10px; cursor: pointer;
  font: 600 14px var(--f-label); letter-spacing: .06em; text-transform: uppercase;
}
.actions button:hover { background: var(--ink); color: var(--panel); }
.actions button:first-child { background: var(--ink); color: var(--panel); }

/* ---------------------------------------------------------------- footer */
.foot {
  max-width: 1680px; margin: 0 auto; padding: 4px 24px 28px;
  text-align: center; font-size: 13px; color: var(--ink-muted);
}
.foot p { margin: 4px 0; }
.foot a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
.foot a:hover { color: var(--ink); text-decoration-color: currentColor; }
.foot b { color: var(--ink); font-weight: 600; }
#build { font-family: var(--f-mono); font-size: 12px; }
.foot .coffee { white-space: nowrap; }
.credit { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; }
.credit-logo { line-height: 0; }
.credit-logo img { display: block; }

/* ---------------------------------------------------------------- map overlays */
.pin {
  display: grid; place-items: center;
  background: var(--ink); color: var(--panel);
  border: 2px solid var(--panel); border-radius: 50%;
  box-shadow: 0 1px 4px rgb(0 0 0 / .35);
  cursor: grab;
}
.pin-label { font: 600 15px/1 var(--f-label); }
.gc-path { stroke: var(--los); }
.map-cursor { fill: var(--panel); stroke: var(--ink); stroke-width: 2; fill-opacity: 1; }
.map-worst { fill: none; stroke-width: 3; stroke: var(--marginal); }
.map-worst[data-status="clear"] { stroke: var(--clear); }
.map-worst[data-status="obstructed"] { stroke: var(--obstructed); }
.mapy-logo { display: block; line-height: 0; }
.mapy-logo img { display: block; }
.leaflet-container { font-family: var(--f-body); }
/* Tile seams: map.js draws tiles 1 px larger so they overlap. Leaflet 1.9's own fix
   (plus-lighter) leaves gaps at fractional zoom and would add up in the overlap. */
.leaflet-container img.leaflet-tile { mix-blend-mode: normal; }
.grid-line { stroke: #16242a; stroke-opacity: .35; }
.grid-major { stroke-opacity: .7; stroke-width: 1.6; }
.grid-label {
  font: 500 12px/1 var(--f-mono);
  color: #16242a;
  white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff;
}

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 960px) {
  .layout {
    display: flex; flex-direction: column;
    padding: 12px 16px 24px;
    gap: 12px;
  }
  /* Stack as inputs, map, chart, results (spec §7.1) */
  .side { display: contents; }
  .inputs { order: 1; }
  .map-wrap { order: 2; height: 56vh; }
  .chart-wrap { order: 3; }
  .results { order: 4; }
  .bar { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .route { order: 3; flex-basis: 100%; margin: 0; font-size: 19px; }
  #lang { margin-left: auto; }
  .tagline { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .locate.busy svg { animation: none; }
  .leaflet-fade-anim .leaflet-tile, .leaflet-zoom-anim .leaflet-zoom-animated { transition: none !important; }
}
