:root {
  color-scheme: light;
  --font-head: 'Fira Sans Condensed', 'Roboto Condensed', system-ui, sans-serif;
  --surface: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6e68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.14);
  --node: #898781;
  --link-opacity: 0.36;
  --p_saudi: #c2480f;
  --p_iraq: #f0803c;
  --p_uae: #a83c0c;
  --p_kuwait: #eb6834;
  --p_iran: #f2a15f;
  --p_othergulf: #d4561d;
  --p_russia: #6250d6;
  --p_usa: #1baf7a;
  --p_canada: #128a60;
  --p_brazil: #52c69b;
  --p_row: #898781;
  --p_stock: #2a78d6;
  --p_gulfstore: #174a8c;
  --p_atsea: #6fa8e6;
}

.flows {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px 40px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
}
.flows h1 { margin: 0; font-family: var(--font-head); font-size: 24px; line-height: 1.2; font-weight: 600; text-wrap: balance; }
.flows .sub { margin: 4px 0 0; color: var(--ink-2); }

.date-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 24px; margin: 14px 0 6px; }
.date { font-family: var(--font-head); font-size: 28px; line-height: 1.2; font-weight: 600; }

.controls { display: flex; gap: 8px; align-items: center; }
.controls button {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 32px;
  padding: 4px 12px;
  cursor: pointer;
}
.controls button:hover { background: var(--grid); }
#play { min-width: 76px; }
.speed { display: flex; }
.speed button { border-radius: 0; margin-left: -1px; }
.speed button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.speed button:last-child { border-radius: 0 6px 6px 0; }
.speed button[aria-pressed='true'] { background: var(--grid); font-weight: 600; }
.flows :focus-visible { outline: 2px solid var(--p_stock); outline-offset: 2px; }

.chart-wrap { position: relative; }
.event-card {
  position: absolute;
  top: 18px;
  z-index: 5;
  width: 290px;
  max-width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  line-height: 1.35;
}
.card-date { color: var(--ink-2); font-size: 12px; }
.card-title { font-family: var(--font-head); font-size: 14px; font-weight: 600; }
.event-card p { margin: 2px 0 2px; color: var(--ink-2); }
.event-card a { color: var(--ink-2); font-size: 12px; }
#price-chart svg { display: block; width: 100%; cursor: pointer; touch-action: pan-y; }
/* Inset by the chart margins less half the thumb, so the thumb tracks the playhead. */
#scrubber { display: block; width: calc(100% - 32px); margin: 2px 6px 0 26px; height: 24px; accent-color: var(--ink); }

.flows a { color: inherit; text-underline-offset: 2px; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); margin: 8px 0 4px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend i.outline { background: none; border: 1px solid var(--ink-2); }
.legend i.band { width: 18px; min-height: 1px; border-radius: 0; background: var(--node); opacity: 0.6; margin-left: 4px; }
.legend .hint { margin-left: auto; color: var(--muted); }
.legend.side-labels .beside { display: none; }

.sankey-wrap { position: relative; width: 100%; }
.sankey-wrap svg { display: block; width: 100%; height: 100%; overflow: visible; }
#particles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.links path { fill: none; stroke-opacity: var(--link-opacity); transition: stroke-opacity 0.15s; }
.links path.dim { stroke-opacity: 0.05; }
.links path.hot { stroke-opacity: 0.9; }
.node rect.bar { rx: 2px; }
.node.producer { cursor: pointer; }
.node rect.ghost { fill: none; stroke: var(--ink-2); stroke-width: 1; rx: 2px; pointer-events: none; }
.node rect.hit { fill: transparent; }
.node, .node:focus, .node:focus-visible { outline: none; }
.node:focus-visible rect.hit { stroke: var(--p_stock); stroke-width: 2; }
.node.dim rect.bar { opacity: 0.25; }
.node.dim text { opacity: 0.4; }
.node text { font-size: 13px; fill: var(--ink); pointer-events: none; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.node text .val { fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.node.hormuz text { font-weight: 700; }
.node.hormuz rect.bar { fill: var(--ink); }
.col-head { font-family: var(--font-head); font-size: 13px; font-weight: 600; fill: var(--ink-2); }
.group-labels text { font-family: var(--font-head); font-size: 14px; font-weight: 600; fill: var(--group-color); pointer-events: none; }
.group-labels line { stroke: var(--group-color); stroke-width: 2; stroke-linecap: round; }
.size-key rect { fill: var(--node); fill-opacity: 0.6; }
.size-key g text { font-size: 13px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }

.axis { font-family: inherit; }
.axis text { font-size: 12px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.axis line, .axis path { stroke: var(--axis); }
.gridlines line { stroke: var(--grid); }
.panel-frame { fill: none; stroke: var(--axis); stroke-width: 1; }
.panel-title { font-family: var(--font-head); font-size: 13px; font-weight: 600; fill: var(--ink-2); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.series-dim { fill: none; stroke: var(--axis); stroke-width: 1.5; }
.series { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.series.tankers { stroke: var(--p_saudi); }
.event-line { stroke: var(--axis); }
.event-line.war { stroke: var(--ink-2); stroke-dasharray: 3 3; }
.event-line.stock { stroke: var(--p_stock); stroke-opacity: 0.6; }
.event-line.active { stroke-width: 2; stroke-opacity: 1; }
.event-label { font-size: 12px; fill: var(--ink-2); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.playhead { stroke: var(--ink); stroke-width: 1.5; }
.play-tag { font-size: 13px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; font-variant-numeric: tabular-nums; }

.note { margin: 10px 0; color: var(--ink-2); font-size: 14px; }

.flows details { border-top: 1px solid var(--grid); padding-top: 8px; }
.flows summary { cursor: pointer; font-weight: 600; min-height: 24px; }
.table-scroll { overflow-x: auto; margin-top: 6px; }
.flows table { border-collapse: collapse; width: 100%; font-size: 14px; }
.flows caption { caption-side: top; text-align: left; padding: 0 0 4px; color: var(--ink-2); }
.flows th, .flows td { text-align: right; padding: 3px 10px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; white-space: nowrap; }
.flows th:first-child, .flows td:first-child, .flows th:nth-child(2), .flows td:nth-child(2) { text-align: left; }
.flows th { font-weight: 600; color: var(--ink-2); }

.flow-tip {
  position: fixed;
  z-index: 1100;
  pointer-events: none;
  max-width: 300px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}
.flow-tip .tt-title { font-family: var(--font-head); font-weight: 600; font-size: 14px; }
.flow-tip .tt-sub { color: var(--ink-2); }
.flow-tip .tt-row { display: flex; justify-content: space-between; gap: 18px; font-variant-numeric: tabular-nums; }
.flow-tip .tt-row span:first-child { color: var(--ink-2); }
.flow-tip svg { display: block; margin-top: 6px; }

@media (max-width: 760px) {
  .flows { padding: 12px 16px 32px; }
  .flows h1 { font-size: 21px; }
  .date { font-size: 24px; }
  .legend .hint { display: none; }
  .node text { font-size: 12px; }
}
@media (forced-colors: active) {
  .links path { stroke-opacity: 1; }
}
