/* Navigation Atlas site styles. MOBILE FIRST (Bryan 2026-10-08, PLAN-2026-10-08b s.7): the base
   rules are the 360 px portrait phone; wider layouts are added only with min-width queries.
   Two themes on <html data-theme>: day = editorial chart (mockup B), night = console (mockup C). */

:root {
  --bar-h: 56px;
  --tap: 48px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --peek: calc(132px + var(--safe-b));
  /* day */
  --bg: #ede6d6;
  --paper: #ffffff;
  --ink: #111111;
  --dim: #545454;
  --line: #e6e1d8;
  --accent: #7d5f27;
  --navy: #1e3550;
  --live: #1f7a4a;
  --bar-bg: rgba(255, 255, 255, 0.94);
  --shadow: 0 -8px 28px rgba(40, 30, 10, 0.14);
  --display: "Fraunces", Georgia, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --num: var(--display);
  --num-w: 300;
  --label-case: none;
}
[data-theme="night"] {
  --bg: #0b1218;
  --paper: #101a22;
  --ink: #e2eef2;
  --dim: #9fb6bf;
  --line: #22323e;
  --accent: #f2b33d;
  --navy: #4fe3f0;
  --live: #43d18b;
  --bar-bg: rgba(14, 23, 30, 0.96);
  --shadow: 0 -4px 24px rgba(79, 227, 240, 0.14);
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --sans: "Barlow Condensed", "Arial Narrow", sans-serif;
  --num: "JetBrains Mono", Consolas, monospace;
  --num-w: 300;
  --label-case: uppercase;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px / 1.45 var(--sans);
  -webkit-text-size-adjust: 100%;
}
button,
input {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}

/* top bar: brand + units + theme only; search lives in the sheet, where the thumb is */
.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: calc(var(--bar-h) + var(--safe-t));
  padding: var(--safe-t) max(8px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--line);
}
.mark {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font: 400 21px / 1 var(--display);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
[data-theme="night"] .mark {
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 18px;
}
.tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.units {
  margin: 0;
  padding: 0;
  min-inline-size: 0;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.units button,
.theme {
  min-width: var(--tap);
  min-height: var(--tap);
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--dim);
}
.units button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.theme {
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.theme svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
}
.theme .moon {
  fill: var(--ink);
  stroke: none;
}
[data-theme="day"] .theme .sun,
[data-theme="night"] .theme .moon {
  display: none;
}

/* map fills everything under the bar; the sheet floats over its lower part */
#map {
  position: fixed;
  top: calc(var(--bar-h) + var(--safe-t));
  left: 0;
  right: 0;
  bottom: 0;
}

/* bottom sheet: peek (search + grip), half, full */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  height: var(--peek);
  max-height: calc(100dvh - var(--bar-h) - var(--safe-t));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow);
  transition: height 0.22s ease;
  padding-bottom: var(--safe-b);
}
.sheet[data-state="half"] {
  height: 52dvh;
}
.sheet[data-state="full"] {
  height: calc(100dvh - var(--bar-h) - var(--safe-t));
}
.sheet.dragging {
  transition: none;
}
.grip {
  flex: none;
  width: 100%;
  height: 36px;
  min-height: var(--tap);
  margin-bottom: -12px; /* 48 px tap target, 36 px of visual space */
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  display: grid;
  place-items: center;
}
/* the visible handle is small; the button is the full sheet width and 48 px tall */
.grip span {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.search {
  flex: none;
  position: relative;
  padding: 0 12px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.search [role="listbox"] {
  grid-column: 1 / -1;
}
.search input {
  width: 100%;
  height: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 17px;
}
.search [role="listbox"] {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  max-height: 40dvh;
  overflow: auto;
}
.search [role="option"] {
  width: 100%;
  min-height: var(--tap);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 8px 6px;
  cursor: pointer;
}
.search [role="option"] small {
  display: block;
  color: var(--dim);
  font-size: 14px;
}
.body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 18px 12px;
}
.sheet[data-state="peek"] .body {
  overflow: hidden;
}
.kicker {
  margin: 4px 0 0;
  font: 600 13px var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
h1,
h2 {
  margin: 6px 0 8px;
  font: 300 30px / 1.05 var(--display);
  letter-spacing: -0.01em;
}
[data-theme="night"] h1,
[data-theme="night"] h2 {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 26px;
}
.lede {
  margin: 0 0 12px;
  color: var(--dim);
}
.figs {
  margin: 0;
  border-top: 1px solid var(--ink);
}
.fig {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.fig dt {
  font: 600 14px var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.fig dd {
  margin: 4px 0 0;
}
.fig .num {
  display: block;
  font: var(--num-w) 30px / 1.1 var(--num);
  font-variant-numeric: lining-nums tabular-nums;
}
[data-theme="night"] .fig .num {
  color: var(--navy);
  font-size: 26px;
}
/* Map key (J1): Magestican Artist's icons, the day or night colourway per theme. */
.mapkey {
  margin: 18px 0 4px;
}
.mapkey h2 {
  font-size: 22px;
}
.mapkey ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mapkey li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  font: 400 15px / 1.2 var(--sans);
}
.mapkey img {
  flex: none;
}
[data-theme="day"] .k-night,
[data-theme="night"] .k-day {
  display: none;
}
/* Resupply chips (J2): which boat resupply kinds the map draws; all on by default, remembered. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
  padding: 0;
  min-inline-size: 0;
  border: 0;
}
.chips legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0;
}
.chips button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 12px 0 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  color: var(--dim);
  font: 600 14px / 1 var(--sans);
  text-transform: var(--label-case);
  cursor: pointer;
  opacity: 0.6;
}
.chips button[aria-pressed="true"] {
  border-color: var(--navy);
  color: var(--ink);
  opacity: 1;
}
.fig .note {
  display: block;
  color: var(--dim);
  font-size: 15px;
}
.fig .src {
  display: block;
  margin-top: 4px;
  font: italic 400 15px / 1.35 var(--display);
  color: var(--accent);
}
[data-theme="night"] .fig .src {
  font: 400 13px / 1.35 var(--num);
  font-style: normal;
}
.fig.live dt::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--live);
  vertical-align: 1px;
}
.back {
  min-height: var(--tap);
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  font-weight: 600;
}
.also {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
.also li button {
  width: 100%;
  min-height: var(--tap);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  padding: 8px 0;
}
.foot {
  flex: none;
  margin: 0;
  padding: 8px 18px;
  font-size: 14px;
  color: var(--dim);
  border-top: 1px solid var(--line);
}
.foot p {
  margin: 0;
}
.legal,
.langs {
  display: flex;
  flex-wrap: wrap;
  column-gap: 14px;
}
/* J6 language switcher: native names, the current one marked */
.langs a[aria-current] {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.legal a,
.langs a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  min-width: var(--tap);
  color: var(--dim);
  text-underline-offset: 3px;
}
.sheet[data-state="peek"] .foot {
  display: none;
}
.nojs {
  position: fixed;
  top: 70px;
  left: 12px;
  right: 12px;
  background: var(--paper);
  padding: 12px;
}

/* map controls sized for fingers */
/* doubled class beats maplibre-gl.css without !important */
.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-button.maplibregl-ctrl-attrib-button {
  width: var(--tap);
  height: var(--tap);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 24px 24px;
}
.maplibregl-ctrl-bottom-right {
  bottom: var(--peek);
}
[data-theme="night"] .maplibregl-ctrl-attrib {
  background: rgba(11, 18, 24, 0.85);
  color: var(--dim);
}
[data-theme="night"] .maplibregl-ctrl-attrib a {
  color: var(--ink);
}
[data-theme="night"] .maplibregl-ctrl-attrib-button {
  filter: invert(1);
}
.na-flow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* >= 900 px: side panel instead of the sheet; the map gets the rest */
/* lat/long grid toggle, a map control (top right), off by default */
.grid-ctrl button {
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--bar-bg);
  color: var(--ink);
  font: 600 14px / 1 var(--sans);
  text-transform: var(--label-case);
  letter-spacing: 0.02em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}
.grid-ctrl button[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--paper);
}

/* ---------- J4 journey planner (phone first; every control 48 px) ---------- */
.plan-btn,
.cta,
.seg button,
.ends button,
.act,
.savebox button,
.saved button,
.boatbox button,
.armed + button {
  min-height: var(--tap);
  min-width: var(--tap);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  font: 600 15px / 1.2 var(--sans);
  text-transform: var(--label-case);
  padding: 0 14px;
  cursor: pointer;
}
.plan-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 10px;
  border-color: var(--navy);
}
.cta,
.savebox .primary {
  display: block;
  width: 100%;
  margin: 4px 0 8px;
  background: var(--navy);
  border-color: var(--navy);
  color: var(--paper);
}
.seg {
  display: flex;
  gap: 0;
  margin: 8px 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}
.seg button {
  flex: 1;
  border-radius: 0;
}
.seg button:first-of-type {
  border-radius: 24px 0 0 24px;
}
.seg button:last-of-type {
  border-radius: 0 24px 24px 0;
}
.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
/* while planning on a phone the half sheet keeps the dock in view: no search row, footer = the one line */
@media (max-width: 899.98px) {
  .sheet.planning .search,
  .sheet.planning .foot .legal,
  .sheet.planning .foot .langs {
    display: none;
  }
  .sheet.planning[data-state="peek"] {
    height: calc(200px + var(--safe-b));
  }
  .sheet.planning .foot {
    padding: 4px 18px;
    font-size: 13px;
  }
}
.jtop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.jtop .kicker {
  margin: 0;
}
.dock {
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0;
}
.dock p {
  margin: 0;
  color: var(--dim);
  font-size: 15px;
}
.dock-btn {
  flex: none;
  width: 64px;
  height: 64px;
  border: 2px dashed var(--accent);
  border-radius: 50%;
  background: var(--bg);
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}
.armed {
  margin: 4px 0;
  font-weight: 600;
  color: var(--accent);
}
.ends {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.ends li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.end-ico {
  flex: none;
  display: grid;
}
.end-tx {
  flex: 1;
  min-width: 0;
}
.far {
  color: var(--accent);
}
.msg:empty {
  display: none;
}
.msg {
  margin: 6px 0;
  color: var(--dim);
}
.boatbox {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
}
.boatbox summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 15px;
}
.boatbox .form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--dim);
  min-width: 0;
}
.field input,
.field select {
  min-height: var(--tap);
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px var(--sans);
}
.boatbox > button {
  margin-bottom: 12px;
}
.jr .ways {
  margin: 8px 0 4px;
  font-weight: 600;
}
.jsum {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 4px;
  padding: 10px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.jsum dt {
  font: 600 12px var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.jsum dd {
  margin: 2px 0 0;
  font: var(--num-w) 21px / 1.15 var(--num);
}
.jr .note,
.alt .note,
.savebox + .note {
  margin: 4px 0;
  font-size: 13px;
  color: var(--dim);
}
.rs-counts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
}
.rs-counts li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 14px;
}
.rs-counts li.hl {
  border-color: var(--navy);
  border-width: 2px;
  font-weight: 600;
}
.chal {
  list-style: none;
  margin: 4px 0 8px;
  padding: 0;
}
.chal li > button,
.chal li > div {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 8px 0 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--line);
  background: transparent;
  text-align: left;
  font-size: 15px;
  cursor: pointer;
}
.chal li > div {
  cursor: default;
}
.chal .ex > * {
  border-left-color: #c92a2a;
}
.chal .cl > * {
  border-left-color: #e8a317;
}
.chal .wi > * {
  border-left-color: var(--live);
}
.chal .km {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.chal .tx,
.chal .note,
.chal .src {
  display: block;
}
.chal .note {
  color: var(--dim);
  font-size: 13px;
}
.chal .src,
.nn .src {
  display: block;
  font: italic 400 14px / 1.35 var(--display);
  color: var(--accent);
}
.nn {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #e8a317;
  background: color-mix(in srgb, #e8a317 10%, var(--paper));
}
.nn h3 {
  margin: 0 0 6px;
  font: 600 18px / 1.25 var(--sans);
}
.nn p {
  margin: 0 0 6px;
}
.acts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.act {
  width: 100%;
  text-align: left;
}
.alt {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 4px dashed var(--accent);
}
.savebox {
  margin: 12px 0;
  padding-top: 8px;
  border-top: 1px solid var(--ink);
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
  align-items: center;
}
.row a.tap {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 6px;
  color: var(--accent);
  font-weight: 600;
}
.saved {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}
.saved li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.saved .nm {
  display: block;
  font-weight: 600;
}
.saved small {
  color: var(--dim);
}
/* map markers: 48 px touch area around the Artist icon */
.jm {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.jm-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  pointer-events: none;
}

@media (min-width: 900px) {
  .sheet,
  .sheet[data-state] {
    top: calc(var(--bar-h) + var(--safe-t));
    left: auto;
    width: 400px;
    height: auto;
    max-height: none;
    border-radius: 0;
    border-left: 1px solid var(--line);
    box-shadow: none;
  }
  .grip {
    display: none;
  }
  .search {
    padding-top: 12px;
  }
  .sheet[data-state="peek"] .body {
    overflow-y: auto;
  }
  .sheet[data-state="peek"] .foot {
    display: block;
  }
  #map {
    right: 400px;
  }
  .maplibregl-ctrl-bottom-right {
    bottom: 0;
  }
  h1,
  h2 {
    font-size: 40px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sheet {
    transition: none;
  }
}
