/* The live map page: a panel with ships and events on the left, the map on the right. */

body.mappage { height: 100vh; overflow: hidden; }
body.mappage main { display: flex; min-height: 0; }
.mapapp { flex: 1; display: grid; grid-template-columns: 390px 1fr; min-height: 0; height: calc(100vh - var(--bar-h)); }

/* ---------- panel ---------- */
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); outline: none; }
.panel-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; background: var(--surface-2); border-radius: 8px; padding: 3px; }
.tabs button { font: inherit; font-weight: 650; font-size: 14px; border: 0; background: none; color: var(--muted); padding: 6px 14px;
  border-radius: 6px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.status { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.status::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 6px; vertical-align: 1px; }
.status.bad { color: var(--bad); } .status.bad::before { background: var(--bad); }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 0 24px; }
.panel-sum { font-size: 14px; color: var(--muted); padding: 10px 16px 4px; margin: 0; }
.empty { color: var(--muted); padding: 24px 16px; text-align: center; }
.more { margin: 12px 16px; }

.shiplist { list-style: none; margin: 0; padding: 0; }
.shiprow, .eventrow { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; font: inherit; color: inherit;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; cursor: pointer; }
.shiprow:hover, .eventrow:hover { background: var(--surface-2); }
.shiprow .risk { min-width: 38px; justify-content: center; margin-top: 2px; }
.shiptext { display: flex; flex-direction: column; min-width: 0; }
.shiptext b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shiptext .sub { font-size: 13.5px; color: var(--muted); }
.shiptext .tags { font-size: 13px; color: var(--muted); }
.sev { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; background: var(--risk-none); }
.sev-high { background: var(--risk-high); } .sev-medium { background: var(--risk-mid); }
.plain .sev { margin: 0 8px 0 0; vertical-align: 0; }

/* ---------- ship details ---------- */
.back { margin: 8px 8px 0; }
.shiphead { padding: 4px 16px 0; }
.shiphead h2 { font-size: 22px; margin: 6px 0 8px; outline: none; }
.shiphead .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.shiphead .sub { color: var(--muted); margin: 8px 0 0; }
.panel-body .actions { padding: 0 16px; margin-top: 12px; gap: 8px; }
.panel-body .actions [aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
#trackmsg { padding: 6px 16px 0; min-height: 1em; }
.panel-body section { padding: 14px 16px 0; }
.panel-body section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.reasons { margin: 0; padding-left: 18px; font-size: 15px; } .reasons li { margin-bottom: 4px; }
.match { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin-bottom: 8px; font-size: 14.5px; }
.match > div { margin-top: 6px; } .match .badge { margin: 2px 2px 0 0; }
.plain { list-style: none; margin: 0; padding: 0; } .plain li { margin-bottom: 6px; }
.facts { font-size: 14.5px; } .facts th { width: 40%; text-transform: none; letter-spacing: 0; font-size: 14px; padding: 6px 8px 6px 0; }
.facts td { padding: 6px 0; } .facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }
.teaser { background: var(--accent-soft); border-radius: var(--radius-s); padding: 10px 12px; font-size: 14.5px; margin: 0; }
.panel-body > .note { margin: 18px 16px 0; }
.teaser.pad-x { margin: 10px 16px 0; }
.panel-body > .alert { margin: 12px 16px 0; }
.panel-body > p.muted { padding: 12px 16px 0; margin: 0; }

/* ---------- map ---------- */
.mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #aad3df; }
.ship-canvas { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 450; }
.leaflet-container.over-ship { cursor: pointer; }
.mapbar { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 900; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.mapbar > * { pointer-events: auto; box-shadow: var(--shadow); }
.mapbar input[type=search] { width: min(360px, 100%); min-height: 38px; }
.mapbar select { width: auto; min-height: 38px; }
.mapbar .btn { min-height: 38px; }
.mappop { position: absolute; top: 60px; right: 12px; z-index: 950; width: 280px; max-height: calc(100% - 80px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; font-size: 15px; }
.mappop h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 6px; }
.mappop h3:first-child { margin-top: 0; }
.mappop .check { margin-top: 6px; }
.tip { position: absolute; z-index: 960; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 7px 10px; font-size: 14px; max-width: 260px; }
.dot-high { background: var(--risk-high); } .dot-mid { background: var(--risk-mid); } .dot-low { background: var(--risk-low); }
.dot-none { background: var(--risk-none); } .dot-naval { background: var(--naval); border-radius: 2px; transform: rotate(45deg); }
.dot-gov { background: var(--gov); border-radius: 2px; transform: rotate(45deg); }
.line { display: inline-block; width: 22px; height: 3px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.line-telecom { background: #7b4fd0; } .line-power { background: #d6336c; } .line-pipeline { background: #a0662a; }
.line-dash { background: repeating-linear-gradient(90deg, var(--muted) 0 5px, transparent 5px 9px); }
.sym { display: inline-block; width: 22px; margin-right: 8px; text-align: center; color: var(--muted); }
.sym-arrow { transform: rotate(-35deg); }
.ring, .place { display: inline-block; width: 16px; height: 16px; border-radius: 50%; margin: 0 11px 0 3px; vertical-align: -3px; }
.ring { border: 2.5px solid var(--risk-high); }
.place { width: 12px; height: 12px; border: 3px solid var(--risk-high); background: #fff; margin: 0 13px 0 5px; }
.mappop .check .help { display: block; margin: 0; }
/* accessibility mode: bigger map controls and lists */
html.a11y .mapapp { grid-template-columns: 430px 1fr; }
html.a11y .shiprow, html.a11y .eventrow { padding-top: 13px; padding-bottom: 13px; }
html.a11y .tip, html.a11y .leaflet-tooltip { font-size: 16px; }
html.a11y .leaflet-control-zoom a { width: 44px; height: 44px; line-height: 44px; font-size: 24px; }
html.a11y .mapbar input[type=search], html.a11y .mapbar select, html.a11y .mapbar .btn { min-height: 46px; }
.leaflet-control-attribution { font-size: 11px; }
.leaflet-tooltip { font: 13.5px/1.4 var(--font); }

/* ---------- small screens: the map on top, the panel as a sheet below ---------- */
@media (max-width: 860px) {
  .mapapp { grid-template-columns: 1fr; grid-template-rows: 55% 45%; }
  .panel { order: 2; border-right: 0; border-top: 1px solid var(--line); }
  .mapwrap { order: 1; }
  .mapbar input[type=search] { width: 100%; }
  .mappop { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; max-height: 70%; }
}

/* ---------- Global Fishing Watch events and satellite images ---------- */
.gfw-encounter { --gfw: #f57c00; } .gfw-loitering { --gfw: #e0b000; } .gfw-port_visit { --gfw: #1f6fd1; }
.gfw-gap { --gfw: #d32f2f; } .gfw-fishing { --gfw: #2e7d32; }
.gfwicon > span { display: block; width: 100%; height: 100%; background: var(--gfw, #888); border: 2px solid #fff; border-radius: 3px;
  transform: rotate(45deg); box-shadow: 0 0 0 1px rgba(0,0,0,.45); box-sizing: border-box; }
.gfwdot { display: inline-block; flex: none; width: 11px; height: 11px; border-radius: 2px; transform: rotate(45deg);
  background: var(--gfw, #888); margin: 0 9px 0 3px; vertical-align: 0; }
.panel-body section h4 { font-size: 14px; margin: 14px 0 6px; }
.gfwlist { list-style: none; margin: 0; padding: 0; }
.gfwlist li { display: flex; gap: 4px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.gfwlist li:last-child { border-bottom: 0; }
.gfwlist .gfwdot { margin-top: 6px; }
.gfwbtns { display: flex; gap: 2px; margin-top: 2px; } .gfwbtns .btn { margin-left: -8px; }
.facts td.warn { color: var(--bad); font-weight: 600; }
.line-gap { background: repeating-linear-gradient(90deg, #d32f2f 0 6px, transparent 6px 10px); }
.nwpop .leaflet-popup-content-wrapper { background: var(--surface); color: var(--text); border-radius: var(--radius); }
.nwpop .leaflet-popup-tip { background: var(--surface); }
.nwpop .leaflet-popup-content { margin: 12px 14px; font: 14.5px/1.45 var(--font); }
.satpop > div { margin-top: 3px; }
.pophead { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.sathead { font-weight: 700; margin-top: 10px; font-size: 13.5px; }
.satlist { margin: 4px 0 0; padding-left: 18px; } .satlist li { margin-bottom: 2px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
html.a11y .nwpop .leaflet-popup-content { font-size: 16px; }

/* ---------- replay, area search, coverage ---------- */
.tabs button { padding: 6px 11px; }
.toolform { padding: 10px 16px 4px; }
.toolform .row2 { margin-top: 10px; }
.toolform select, .toolform input[type=time] { min-height: 38px; }
.toolform .btn { margin-top: 12px; }
.player { margin: 14px 16px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.rpwhen { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.player input[type=range] { width: 100%; margin: 10px 0 2px; accent-color: var(--accent); }
.player .actions { margin-top: 6px; } .player select { width: auto; min-height: 32px; padding: 2px 8px; font-size: 14px; }
.replaybar { position: absolute; left: 50%; transform: translateX(-50%); bottom: 26px; z-index: 950; display: flex; gap: 12px; align-items: center;
  background: var(--accent); color: var(--accent-ink); padding: 8px 10px 8px 16px; border-radius: 999px; box-shadow: var(--shadow); font-weight: 700; }
.replaybar .btn { background: #fff; color: var(--accent); }
.replaybar[hidden], .mappop[hidden], .tip[hidden] { display: none; }   /* [hidden] beats display: flex */
.help.pad { padding: 0 16px; margin: 0; }
.cov { display: inline-block; width: 18px; height: 12px; background: rgba(22,163,74,.35); margin-right: 10px; vertical-align: -1px; border-radius: 2px; }
.ring-search { border: 2.5px dashed var(--risk-mid); }
@media (max-width: 860px) { .tabs button { padding: 6px 8px; font-size: 13px; } .replaybar { bottom: 12px; } }

/* ---------- the case file: the side panel's look, on a page of its own ---------- */
.casewrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 56px; }
.casefile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 0 24px; overflow: visible; }
.casefile .kicker { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; color: var(--muted); font-weight: 700; margin: 14px 0 0; }
.casefile .shiphead h2 { font-size: 28px; }
.casefile > .actions { margin-top: 14px; }
.casefile > .note { margin: 16px 16px 0; }
.casemap { height: 340px; border-radius: var(--radius-s); border: 1px solid var(--line); margin-bottom: 6px; }
@media print {
  :root { --surface: #fff; --bg: #fff; --text: #000; --muted: #444; --line: #ccc; --surface-2: #f2f2f2; }
  .topbar, .footer, .skip, .noprint, .leaflet-control-zoom { display: none !important; }
  body { background: #fff; color: #000; }
  .casewrap { padding: 0; max-width: none; }
  .casefile { border: 0; }
  .panel-body section { break-inside: avoid-page; }
  a { color: inherit; }
}
