/* Depth -- hosted browser build.
   Deliberately close to the desktop tool's layout so the two are learnable as
   one thing: map on the left, everything you can change on the right. */

:root {
  --ink: #0f1417;
  --dim: #5b6b74;
  --line: #d8e0e4;
  --bg: #f6f8f9;
  --card: #fff;
  --sea: #12506e;
  --sea-ink: #fff;
  --warn-bg: #fff4e5;
  --warn-line: #f0c48a;
  --warn-ink: #6b4310;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* The map fills whatever is left after the chrome, measured rather than
   guessed. This was calc(100vh - 108px) and 108 was the header's height on the
   day it was written -- editing one line of copy silently pushed the map off
   the bottom of the screen. The hosted build also gets a site bar injected
   above everything (see copy_web_apps), whose height this file cannot know. */
body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 1 auto; min-height: 0; }

h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 1.15rem; letter-spacing: -0.01em; }
h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); }
a { color: var(--sea); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.65rem; }
.brand p { margin: 0.15rem 0 0; color: var(--dim); font-size: 0.85rem; max-width: 52ch; }
.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.08rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--dim);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  vertical-align: 0.22em;
}

/* Not a toast, not dismissible, not below the fold. Someone acting on a number
   from this page has to have seen this first. */
.notice {
  margin: 0;
  padding: 0.55rem 1rem;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-line);
  color: var(--warn-ink);
  font-size: 0.85rem;
}

.help {
  padding: 0.9rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.help p { margin: 0 0 0.6rem; max-width: 74ch; font-size: 0.9rem; }
.help p:last-child { margin-bottom: 0; }
.help-links { display: flex; gap: 1rem; }

/* Opening this used to push the map 89 px off the bottom of the screen and put
   the whole page into scroll. On a layout whose point is a map, the transient
   explainer is the thing that should give way, so it scrolls inside itself.
   Only above the mobile breakpoint -- down there the page scrolls anyway and a
   capped, inner-scrolling box is just harder to read. */
@media (min-width: 861px) {
  .help { max-height: 30vh; overflow-y: auto; }
}

main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  min-height: 420px;
}
#map { height: 100%; background: #dfe7ea; }

.panel {
  overflow-y: auto;
  padding: 1rem;
  background: var(--card);
  border-left: 1px solid var(--line);
}
.panel > * + * { margin-top: 0.9rem; }

.row { display: flex; gap: 0.5rem; }
.row.wrap { flex-wrap: wrap; }

button {
  font: inherit;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--sea); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { flex: 1; background: var(--sea); border-color: var(--sea); color: var(--sea-ink); }
button.primary:hover:not(:disabled) { filter: brightness(1.12); }
button.ghost { white-space: nowrap; }
button.armed { background: #0d3c53; border-color: #0d3c53; color: #fff; }

.dim { color: var(--dim); font-size: 0.85rem; }
.hint { margin: 0.1rem 0 0.7rem 0; color: var(--dim); font-size: 0.78rem; line-height: 1.45; }

.opts { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.7rem; }
.opts summary { cursor: pointer; font-size: 0.85rem; color: var(--dim); }
.opts[open] summary { margin-bottom: 0.7rem; }

.opt { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; font-size: 0.9rem; }
.opt.check { justify-content: flex-start; gap: 0.5rem; }
.opt + .hint { margin-top: 0.15rem; }
.inline { display: flex; align-items: center; gap: 0.3rem; }
.unit { color: var(--dim); font-size: 0.8rem; }
input[type="number"], select {
  font: inherit;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
}
input[type="number"] { width: 4.5rem; }
select { max-width: 11rem; }

.status { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.7rem; }
.status p { margin: 0; font-size: 0.85rem; white-space: pre-line; }
.status.err { background: #fdeeee; border-color: #e9b4b4; color: #7a1f1f; }
.bar { height: 4px; margin-top: 0.5rem; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--sea); transition: width 0.2s; }

.legend .band { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; padding: 0.1rem 0; }
.legend .sw { width: 26px; height: 12px; border-radius: 2px; flex: none; border: 1px solid rgba(0,0,0,0.15); }
.legend .band.under { font-weight: 600; }
.legend .band.under .lbl::after { content: " — you would not clear this"; font-weight: 400; color: #a2311f; }
.readout { margin: 0.55rem 0 0; font-variant-numeric: tabular-nums; }
.readout strong { color: var(--ink); font-size: 1.05rem; }

.credit { font-size: 0.72rem; color: var(--dim); line-height: 1.5; }

.leaflet-container { font: inherit; }
.aoi-hint {
  background: rgba(15,20,23,0.85); color: #fff;
  padding: 0.3rem 0.6rem; border-radius: 6px; font-size: 0.8rem;
}

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; flex: 0 0 auto; }
  #map { height: 58vh; min-height: 300px; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .brand p { display: none; }
}
