/* Global Trade Monitor: Torus Solutions editorial, dark only. One accent, 1px rules, typographic. */

:root {
  color-scheme: dark;
  --paper: #0f0f0e;
  --paper-2: #151513;
  --ink: #ece7dd;      /* 15.6:1 on paper */
  --ink-2: #b4ada1;    /* 8.6:1 */
  --ink-3: #948d82;    /* 5.8:1, the faintest text colour used */
  --rule: #2f2d29;
  --rule-2: #45423c;
  --accent: #d4ad6a;   /* 9.2:1 */
  --down: #b4ada1;
  --display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --label: 'Syne', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Source Serif 4', 'Iowan Old Style', Georgia, serif;
  --gutter: 16px;
  --panel-w: 460px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--rule-2); }
a:hover, a:focus-visible { text-decoration-color: var(--accent); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--display); font-weight: 500; margin: 0; letter-spacing: 0.005em; }

.label {
  font-family: var(--label);
  font-weight: 500;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.num { font-variant-numeric: lining-nums tabular-nums; }
.small { font-size: 13px; color: var(--ink-2); }
.hint { color: var(--ink-3); font-style: italic; margin: 0.5em 0; }
[hidden] { display: none !important; }

/* Sea | Air: one page, two modes. Sea is the default (no class); Air sets body.mode-air. */
body.mode-air .sea-only { display: none !important; }
body:not(.mode-air) .air-only { display: none !important; }

/* ---------- demonstration label + masthead ---------- */

/* Shown whenever the feed is simulated. Calm but always in view: it sticks to the top on narrow screens. */
.demo-label {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0;
  padding: 8px var(--gutter);
  text-align: center;
  font: 500 11px/1.4 var(--label);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule-2);
}

.masthead {
  padding: 18px var(--gutter) 14px;
  border-bottom: 1px solid var(--rule);
}

.mast-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font: 600 12px/1 var(--label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}
.wordmark:hover, .wordmark:focus-visible { color: var(--accent); }

.dateline {
  margin: 0;
  font: 400 italic 15px/1.3 var(--display);
  color: var(--ink-2);
}
.dateline .sep { color: var(--ink-3); padding: 0 0.2em; }

.masthead h1 {
  font-size: clamp(34px, 5.2vw, 58px);
  font-weight: 600;
  line-height: 1.02;
  margin-top: 16px;
}

.dek {
  max-width: 62ch;
  margin: 8px 0 14px;
  font: 400 italic clamp(16px, 1.6vw, 19px)/1.4 var(--display);
  color: var(--ink-2);
}

.lead {
  max-width: 68ch;
  margin: 0 0 14px;
  color: var(--ink-2);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--rule);
}
.kpis > div { padding: 10px 14px 2px 0; }
.kpis > div + div { padding-left: 14px; border-left: 1px solid var(--rule); }
.kpis dd { margin: 2px 0 0; font: 600 26px/1.1 var(--display); }
.stale { margin: 8px 0 0; color: var(--accent); }

/* ---------- layout ---------- */

.layout { display: block; }

.mapcol {
  position: relative;
  height: 62vh;
  min-height: 340px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.map { position: absolute; inset: 0; }
body.is-offline:not(.mode-air) .map, body.mode-air.air-is-offline .map { opacity: 0.35; }

.legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 10px 12px;
  background: rgba(15, 15, 14, 0.9);
  border: 1px solid var(--rule);
  max-width: calc(100% - 24px);
}
.legend .label { margin: 0 0 6px; }
.legend ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: auto 1fr auto; gap: 3px 8px; align-items: center; }
.legend li { display: contents; }
.legend .sw { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.legend .lg-name { font-size: 13px; color: var(--ink-2); }
.legend .lg-n { font-size: 13px; text-align: right; color: var(--ink); }

.regions {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  max-width: calc(100% - 64px);
  background: rgba(15, 15, 14, 0.9);
}
.regions button {
  font: 500 10px/1.3 var(--label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--rule-2);
  margin: 0 -1px -1px 0;
  padding: 6px 9px;
  cursor: pointer;
}
.regions button:hover { color: var(--ink); border-color: var(--accent); position: relative; }
.regions button[aria-pressed="true"] { color: var(--paper); background: var(--accent); border-color: var(--accent); position: relative; }

.map-note {
  position: absolute;
  top: 52px;
  left: 12px;
  z-index: 2;
  margin: 0;
  padding: 8px 10px;
  background: rgba(15, 15, 14, 0.92);
  border: 1px solid var(--rule);
  max-width: min(360px, calc(100% - 70px));
}

.offline {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100% - 2 * var(--gutter)));
  padding: 22px 24px;
  background: var(--paper);
  border: 1px solid var(--rule-2);
  text-align: left;
}
.offline .label { margin: 0 0 6px; }
.offline h2 { font-size: 28px; line-height: 1.15; }
.offline p:last-child { margin: 10px 0 0; color: var(--ink-2); }

.panels { padding: 0 var(--gutter) 24px; }

.sec { padding: 22px 0 24px; border-bottom: 1px solid var(--rule); }
.sec-head { display: flex; align-items: baseline; gap: 12px; }
.sec-head h2 { font-size: 30px; line-height: 1.1; }
.sec-no { color: var(--accent); min-width: 1.6em; }
.sec-dek { margin: 6px 0 14px; color: var(--ink-2); max-width: 60ch; }
h3.sub { font-size: 21px; margin: 20px 0 6px; }

/* ---------- chips ---------- */

.chip {
  display: inline-block;
  font: 500 10.5px/1.3 var(--label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border: 1px solid var(--rule-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip-normal { color: var(--ink); }
.chip-up { color: var(--paper); background: var(--accent); border-color: var(--accent); }
.chip-down { color: var(--accent); border-color: var(--accent); }
.chip-muted { color: var(--ink-3); border-style: dashed; }

/* ---------- chokepoints ---------- */

.cp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.cp {
  display: grid;
  gap: 6px;
  align-content: start;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 12px 12px 14px;
  cursor: pointer;
}
.cp:hover { background: var(--paper-2); }
.cp.is-sel { background: var(--paper-2); box-shadow: inset 0 1px 0 var(--accent); }
.cp-name { font: 500 19px/1.15 var(--display); }
.cp-live { display: flex; align-items: baseline; gap: 6px; }
.cp-live b { font: 600 30px/1 var(--display); }
.cp-tr { display: flex; align-items: baseline; gap: 6px; font-size: 14px; }
.cp-tr b { font-weight: 600; margin-right: 8px; }
.cp .chip { justify-self: start; }

.cp-detail-wrap { margin-top: 14px; }
.cp-detail { border: 1px solid var(--rule); padding: 14px 14px 10px; }
.cpd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cpd-head h3 { font-size: 26px; line-height: 1.1; margin-top: 2px; }
.cpd-note { margin: 10px 0; color: var(--ink-2); }
.cpd-chip { margin: 8px 0 12px; }
.linkbtn, .rowbtn {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.linkbtn { font: 500 11px/1.4 var(--label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); border-bottom: 1px solid var(--rule-2); }
.linkbtn:hover { color: var(--accent); }
.rowbtn { font: 500 17px/1.2 var(--display); color: var(--ink); display: block; }
.rowbtn:hover { color: var(--accent); }

.chart { margin: 14px 0 0; }
.chart-box { position: relative; height: 150px; }
.chart figcaption { margin-top: 6px; }

/* ---------- tables ---------- */

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: baseline; }
.tbl thead th { font: 500 11px/1.3 var(--label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); border-bottom-color: var(--rule-2); }
.tbl tbody th { font-weight: 400; }
.tbl .num { text-align: right; padding-right: 0; padding-left: 8px; }
.tbl.ports tbody th .label { display: block; margin-top: 2px; font-size: 10.5px; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl.grid { min-width: 420px; }
.tbl.grid td.cell { background-color: rgb(212 173 106 / var(--a, 0)); }
.tbl.grid tbody th { font: 500 16px/1.2 var(--display); white-space: nowrap; }

/* ---------- LNG ---------- */

.figs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--rule); }
.figs > div { padding: 8px 8px 4px 0; }
.figs > div + div { padding-left: 10px; border-left: 1px solid var(--rule); }
.figs dd { margin: 2px 0 0; }
.fig { font: 600 28px/1.1 var(--display); }

.bar { display: flex; height: 8px; margin: 14px 0 6px; background: var(--rule); }
.bar-seg { display: block; height: 100%; }
.is-laden { background: var(--accent); }
.is-ballast { background: var(--ink-3); }
.is-unknown { background: var(--rule-2); }
.bar-key { margin: 0 0 4px; }
.bar-key .key { display: inline-block; width: 9px; height: 9px; margin: 0 5px 0 0; vertical-align: -1px; }
.bar-key .key + .key, .bar-key .key:not(:first-child) { margin-left: 10px; }

.toggle, .seg button {
  font: 500 11px/1.3 var(--label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule-2);
  padding: 8px 12px;
  cursor: pointer;
}
.toggle { margin-top: 12px; }
.toggle[aria-pressed="true"], .seg button[aria-pressed="true"] { color: var(--paper); background: var(--accent); border-color: var(--accent); }
.toggle:hover, .seg button:hover { border-color: var(--accent); }

.seg { display: inline-flex; margin: 0 0 12px; }
.seg button + button { border-left: 0; }

/* ---------- Sea | Air switch ---------- */

.modesw { display: inline-flex; margin-left: auto; margin-right: 4px; }
.modesw button {
  font: 600 11px/1 var(--label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--rule-2);
  padding: 7px 14px 7px 16px;
  min-height: 30px;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.modesw button + button { border-left: 0; }
.modesw button:hover { color: var(--ink); border-color: var(--accent); }
.modesw button + button:hover { border-left: 0; box-shadow: inset 1px 0 0 var(--accent); }
.modesw button[aria-pressed="true"] { color: var(--paper); background: var(--accent); border-color: var(--accent); }

/* ---------- Air panels ---------- */

.tbl.hubs { min-width: 440px; }
.tbl.hubs tbody th .label { display: block; margin-top: 2px; font-size: 10.5px; }
.tbl.hubs tr.is-sel th .rowbtn { color: var(--accent); }
.tbl .pulse-col { width: 112px; padding-left: 10px; vertical-align: middle; }
.pulse { display: flex; align-items: flex-end; gap: 1px; height: 22px; width: 104px; border-bottom: 1px solid var(--rule-2); }
.pulse i { flex: 1 1 0; min-width: 1px; background: var(--ink-3); display: block; }
.pulse i.is-now { background: var(--accent); }
.label.inline { font-size: 10.5px; }

.figs.figs-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
.figs.figs-3 > div:nth-child(4) { padding-left: 0; border-left: 0; }
.figs.figs-3 > div:nth-child(-n+3) { border-bottom: 1px solid var(--rule); }
.figs-3 .fig { font-size: 22px; }

.lanes-total { margin: 0 0 8px; }
.tbl.lanes tbody th { position: relative; padding-bottom: 10px; }
.lane-name { display: block; font: 500 16px/1.2 var(--display); }
.tbl.lanes tbody th .label { display: block; margin-top: 2px; font-size: 10.5px; }
.lane-bar { position: absolute; left: 0; bottom: 3px; height: 2px; background: var(--accent); opacity: 0.7; }
#air-flows-days { margin-top: 4px; }

.legend .sw-plane { border-radius: 0; width: 8px; height: 8px; clip-path: polygon(50% 0, 100% 100%, 50% 75%, 0 100%); }
.legend .sw-ground { background: var(--ink-3); width: 4px; height: 4px; justify-self: center; }
.legend .sw-ring { width: 9px; height: 9px; border: 1px solid var(--accent); background: transparent; }

/* ---------- method + foot ---------- */

.method p { max-width: 64ch; color: var(--ink-2); }
.method p:first-of-type { color: var(--ink); }
.method strong { font-weight: 600; }
.foot { padding-top: 16px; }
.built { margin: 0 0 6px; font: 400 italic 17px/1.4 var(--display); color: var(--ink-2); }

/* ---------- map popups (MapLibre) ---------- */

.maplibregl-popup.tip .maplibregl-popup-content {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule-2);
  border-radius: 0;
  padding: 6px 9px;
  box-shadow: none;
  font: 13px/1.4 var(--body);
}
.maplibregl-popup.tip .maplibregl-popup-tip { display: none; }
.tip-k { font: 500 10.5px/1 var(--label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-right: 8px; }
.maplibregl-ctrl-group { background: var(--paper) !important; border: 1px solid var(--rule-2); border-radius: 0 !important; box-shadow: none !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--rule-2) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.9); }
.maplibregl-ctrl-attrib { background: rgba(15, 15, 14, 0.85) !important; color: var(--ink-3); }
.maplibregl-ctrl-attrib a { color: var(--ink-2); }
.maplibregl-ctrl-attrib-button { filter: invert(0.85); }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div { padding: 10px 0 4px; border-bottom: 1px solid var(--rule); }
  .kpis > div + div { padding-left: 0; border-left: 0; }
  .kpis > div:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--rule); }
  .kpis dd { font-size: 22px; }
  .figs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .figs > div:nth-child(4) { padding-left: 0; border-left: 0; }
  .figs > div { border-bottom: 1px solid var(--rule); }
  .hide-xs { display: none; }
  .cp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-live b { font-size: 26px; }
  .legend { padding: 8px 10px; }
  .legend .lg-name, .legend .lg-n { font-size: 12px; }
  .mapcol { height: 56vh; }
  .modesw button { padding: 7px 12px 7px 13px; }
  .tbl .pulse-col { width: 76px; }
  .pulse { width: 72px; gap: 0; }   /* 48 bars at 1 px minimum fit only without gaps */
}

@media (min-width: 1100px) {
  :root { --gutter: 28px; }
  body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
  .demo-label, .masthead { flex: none; }
  .masthead { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 32px; align-items: end; padding-bottom: 12px; }
  .mast-top { grid-column: 1 / -1; }
  .masthead h1 { grid-column: 1; }
  .dek { grid-column: 1; margin-bottom: 0; }
  .lead { grid-column: 1; margin: 6px 0 0; }
  .kpis { grid-column: 2; grid-row: 2 / span 3; border-top: 0; align-self: end; grid-template-columns: repeat(5, auto); }
  .kpis > div { padding: 0 18px 0 0; }
  .kpis > div + div { padding-left: 18px; }
  .stale { grid-column: 1 / -1; }
  .layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); }
  .mapcol { height: auto; min-height: 0; border-bottom: 0; border-right: 1px solid var(--rule); }
  .panels { overflow-y: auto; padding: 0 24px 24px; }
  .cp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1500px) {
  :root { --panel-w: 540px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .modesw button { transition: none; }
}
