/* GPL route globe: flat diagram, live WebGL stage, pins and the routes side panel extras.
   Pages with the routes section load this file (the snippet links it); globe.js also injects it if missing.
   Section layout (.routes__grid, .routes__map, .routes__side) and tokens come from site.css. */

/* Zero-specificity defaults: any .globe rule in site.css wins. */
:where(.globe) {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
:where(.globe__stage) { display: none; }
@media (max-width: 899px) {
  :where(.globe) { aspect-ratio: 1; }
}

/* ---------- Flat diagram (no WebGL, or before the globe loads) ---------- */
.globe__diagram { width: 100%; height: auto; overflow: visible; }
.globe__diagram--tall { display: none; }
@media (max-width: 899px) {
  .globe__diagram--wide { display: none; }
  .globe__diagram--tall { display: block; }
}
.globe__lane { fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.globe__lane--red { stroke: var(--ink); }
.globe__bus { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.globe__canal { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 5 5; }
.globe__rule { stroke: var(--rule); stroke-width: 1; }
.globe__node { fill: var(--paper-hi); stroke: var(--ink); stroke-width: 3; }
.globe__node--origin { fill: var(--green); }
.globe__lbl { font-family: var(--f-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; fill: var(--ink-2); }
.globe__lbl--sea { fill: var(--green-ink); font-size: 12px; }
.globe__lbl--big { font-family: var(--f-sans); font-size: 21px; font-weight: 800; font-stretch: 80%; letter-spacing: -0.01em; fill: var(--ink); }
.globe__diagram:lang(ar) .globe__lbl { letter-spacing: 0; }
.globe__diagram:lang(ar) .globe__lbl--big { font-weight: 700; font-stretch: 100%; }
.globe__diagram--tall .globe__lbl--big { font-size: 17px; }

.routes.is-armed .globe__lane { stroke-dasharray: 1; stroke-dashoffset: 1; }
.routes.is-in .globe__lane { stroke-dashoffset: 0; transition: stroke-dashoffset 1.6s var(--ease-out); }
.routes.is-in .globe__lane--red { transition-delay: 0.35s; }

/* ---------- Live globe ---------- */
.globe.is-live.is-gl {
  padding: 0;
  background-color: var(--paper);
  background-image: radial-gradient(var(--rule) 1px, transparent 1.2px);
  background-size: 20px 20px;
  border-color: var(--ink);
}
.globe.is-live.is-gl .globe__diagram { display: none; }
.globe.is-live.is-gl .globe__stage {
  display: block;
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.globe.is-gl.is-dragging .globe__stage { cursor: grabbing; }
.globe.is-gl .globe__canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

/* Pins are positioned in physical screen space by globe.js, so they use left/top on purpose (also in RTL). */
.globe.is-gl .globe__pin {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.globe.is-gl .globe__pin::before {
  content: "";
  position: absolute;
  left: 0;
  top: -0.5px;
  width: var(--lead, 0px);
  height: 1px;
  background: var(--ink);
  transform: rotate(var(--ang, 0deg));
  transform-origin: 0 50%;
}
.globe.is-gl .globe__pin.is-hidden { opacity: 0; visibility: hidden; }
.globe.is-gl .globe__tag {
  position: absolute;
  inset: 0 auto auto 0;
  padding: 5px 8px 6px;
  border: 1px solid var(--ink);
  background: var(--paper-hi);
  color: var(--ink);
  white-space: nowrap;
  text-align: start;
  line-height: 1.25;
  transform: translate(var(--tx, 0px), var(--ty, 0px));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.globe.is-gl .globe__tag b {
  display: block;
  color: inherit;
  font: 650 12.5px/1.2 var(--f-sans);
  letter-spacing: 0.005em;
}
.globe.is-gl .globe__sub {
  display: block;
  margin-top: 2px;
  color: var(--ink-2);
  font: 500 9.5px/1.3 var(--f-mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.globe.is-gl .globe__tag .globe__abbr { display: none; }
/* Destination regions: light annotation labels, so Egypt's ink tags lead. */
.globe.is-gl .globe__pin:not(.globe__pin--origin) .globe__tag {
  padding: 2px 4px 3px;
  border: 0;
  background: color-mix(in srgb, var(--paper-hi) 82%, transparent);
}
.globe.is-gl .globe__pin:not(.globe__pin--origin) .globe__tag b { font-size: 11px; font-weight: 700; }
.globe.is-gl .globe__pin:not(.globe__pin--origin) .globe__sub { margin-top: 1px; font-size: 8.5px; }
/* Egypt's ports: one-line ink tags (name + LOCODE), so the four callouts fit around the tight cluster. */
.globe.is-gl .globe__pin--origin .globe__tag { display: flex; align-items: baseline; gap: 7px; padding: 4px 8px 5px; background: var(--ink); color: var(--paper); }
.globe.is-gl .globe__pin--origin .globe__sub { margin-top: 0; color: var(--lime); }
.globe.is-gl .globe__pin .globe__tag:lang(ar) b { letter-spacing: 0; font-weight: 600; font-size: 13px; }
.globe.is-gl .globe__pin .globe__sub:lang(ar) { letter-spacing: 0; font-size: 10.5px; }
.globe.is-gl .globe__sub bdi { font-family: var(--f-mono); letter-spacing: 0.07em; }

@media (prefers-reduced-motion: no-preference) {
  .globe.is-gl .globe__pin { transition: opacity 0.3s, visibility 0s linear 0s; }
  .globe.is-gl .globe__pin.is-hidden { transition: opacity 0.3s, visibility 0s linear 0.3s; }
}

@media (max-width: 899px) {
  .globe.is-gl .globe__tag b:not(.globe__abbr),
  .globe.is-gl .globe__sub { display: none; }
  .globe.is-gl .globe__tag .globe__abbr { display: block; font-size: 11px; }
}

/* ---------- Routes side panel: port list and actions ---------- */
.routes__ports { border-top: 1px solid var(--ink); }
.routes__ports > div { padding: 12px 0 14px; border-bottom: 1px solid var(--rule); }
.routes__ports dt {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 18px;
  font-weight: 700;
  font-stretch: 90%;
  line-height: 1.2;
}
.routes__ports dt .mono { color: var(--green-ink); font-size: 11px; font-stretch: 100%; }
.routes__ports dd { margin-top: 4px; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.routes__ports:lang(ar) dt { font-stretch: 100%; }
.routes__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.routes__side > p.routes__fine { color: var(--ink-2); font-size: 11px; line-height: 1.5; }
