/* ==========================================================================
   Trade dashboard showpiece and page hero: "shipping lanes"
   (src/features/trade/lanes.js, public/assets/js/trade-lanes.js). A full-width
   deep-purple band in purple and white: US imports in near-white, US exports
   in lilac, ports in white. The page title and lede sit over the top of the map.
   ========================================================================== */

.tr-lanes {
  --ln-imports: #F1EAFB;
  --ln-exports: #B48CF0;
  --ln-port: #FFFFFF;
  --ln-text: #E6E0EE;
  --ln-muted: #A79BB5;
  position: relative;
  overflow: hidden;
  color: var(--ln-text);
  background:
    radial-gradient(120% 80% at 70% 40%, rgba(110, 66, 166, 0.28), transparent 60%),
    radial-gradient(90% 70% at 15% 70%, rgba(110, 66, 166, 0.14), transparent 65%),
    linear-gradient(180deg, #120A22 0%, #1A1030 45%, #140B26 100%);
  border-bottom: 1px solid #3A2A5C;
}
.tr-lanes-wrap { max-width: 1320px; margin: 0 auto; padding: clamp(1.75rem, 4vw, 3.25rem) clamp(16px, 3vw, 2rem) clamp(1.25rem, 3vw, 2.5rem); }

.tr-lanes-head { max-width: 40rem; margin-bottom: clamp(0.75rem, 2vw, 1.25rem); }
.tr-lanes-head .dateline { color: #C9B2EA; }
.tr-lanes-title { margin: 0.5rem 0 0; font-family: var(--font-serif); font-weight: 500; font-size: clamp(2.2rem, 4.4vw, 3.6rem); line-height: 1.04; letter-spacing: -0.02em; color: #fff; }
.tr-lanes-dek { margin: 0.75rem 0 0; font-family: var(--font-serif); font-style: italic; font-size: clamp(1.08rem, 1.5vw, 1.3rem); line-height: 1.45; color: #DCD3EA; max-width: 34rem; }
.tr-lanes-head .tr-checked { color: #B9ADC9; }

.tr-lanes-fig { position: relative; margin: 0; }
.tr-lanes-stage { position: relative; width: 100%; }
.tr-lanes-land, .tr-lanes-routes, .tr-lanes-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tr-lanes-land {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%), linear-gradient(180deg, transparent 0, #000 8%, #000 90%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%), linear-gradient(180deg, transparent 0, #000 8%, #000 90%, transparent 100%);
  mask-composite: intersect;
}
.tr-lane { fill: none; stroke: var(--ln-port); stroke-opacity: 0.32; stroke-width: 1.2; stroke-dasharray: 2 5; stroke-linecap: round; }

/* Ports and waypoints: HTML labels placed in % of the map, so text keeps its size. */
.tr-lanes-port, .tr-lanes-via { position: absolute; transform: translate(0, -50%); pointer-events: none; white-space: nowrap; }
.tr-lanes-port i { position: absolute; left: 0; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--ln-port); box-shadow: 0 0 0 3px rgba(201, 178, 234, 0.18), 0 0 14px 3px rgba(201, 178, 234, 0.55); }
.tr-lanes-port.is-home i { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; animation: tr-lanes-pulse 2.8s ease-out infinite; }
.tr-lanes-port b { position: absolute; top: 50%; transform: translateY(-50%); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; color: #FFFFFF; text-shadow: 0 1px 6px rgba(10, 6, 20, 0.95), 0 0 2px rgba(10, 6, 20, 0.9); }
.tr-lanes-port.tr-a-start b { left: 12px; }
.tr-lanes-port.tr-a-end b { right: 12px; }
.tr-lanes-port.is-home b { font-family: var(--font-serif); font-size: 1.05rem; font-weight: 500; line-height: 1.1; color: #FFFFFF; top: 8px; left: 10px; transform: none; }
.tr-lanes-port.is-home small { display: block; font-family: var(--font); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(230, 220, 245, 0.8); }
.tr-lanes-via { transform: translate(-50%, -50%); font-family: var(--font-serif); font-style: italic; font-size: 0.82rem; color: rgba(230, 224, 238, 0.55); text-shadow: 0 1px 4px rgba(10, 6, 20, 0.9); }
@keyframes tr-lanes-pulse {
  0% { box-shadow: 0 0 0 0 rgba(201, 178, 234, 0.55), 0 0 14px 3px rgba(201, 178, 234, 0.6); }
  100% { box-shadow: 0 0 0 16px rgba(201, 178, 234, 0), 0 0 14px 3px rgba(201, 178, 234, 0.6); }
}

/* Caption and legend: under the map on small screens, floating over the South Pacific on wide ones. */
.tr-lanes-cap { margin-top: 0.9rem; font-size: 0.86rem; line-height: 1.5; color: var(--ln-muted); }
.tr-lanes-legend { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; gap: 0.6rem; }
.tr-lanes-legend li { display: flex; gap: 0.7rem; align-items: flex-start; }
.tr-lanes-legend strong { color: #fff; font-weight: 600; }
.tr-lanes-num { font-size: 1.15rem; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; margin-left: 0.25rem; }
.tr-lanes-muted { font-size: 0.8rem; color: var(--ln-muted); }
.tr-lanes-key { position: relative; flex: 0 0 26px; height: 3px; margin-top: 0.62rem; border-radius: 2px; }
.tr-lanes-key::after { content: ''; position: absolute; right: -2px; top: -2.5px; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.tr-lanes-key.is-imports { background: linear-gradient(90deg, transparent, var(--ln-imports)); box-shadow: 0 0 10px var(--ln-imports); }
.tr-lanes-key.is-imports::after { box-shadow: 0 0 8px 2px var(--ln-imports); }
.tr-lanes-key.is-exports { background: linear-gradient(90deg, transparent, var(--ln-exports)); box-shadow: 0 0 10px var(--ln-exports); }
.tr-lanes-key.is-exports::after { box-shadow: 0 0 8px 2px var(--ln-exports); }
.tr-lanes-scale { margin: 0 0 0.4rem; color: var(--ln-text); }
.tr-lanes-scale strong { color: #FFFFFF; font-weight: 600; }
.tr-lanes-note { margin: 0; font-size: 0.76rem; color: rgba(167, 155, 181, 0.85); }

@media (min-width: 960px) {
  .tr-lanes-cap {
    position: absolute; left: 1.5%; bottom: 3%; width: min(330px, 30%); margin: 0;
    padding: 1rem 1.1rem; border: 1px solid rgba(185, 166, 218, 0.18); border-radius: 6px;
    background: rgba(18, 10, 34, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  }
  .tr-lanes-head {
    position: relative; z-index: 1; max-width: none; margin-bottom: -1.5rem;
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1rem 4rem; align-items: end;
    text-shadow: 0 1px 12px rgba(10, 6, 20, 0.85);
  }
  .tr-lanes-intro { padding-bottom: 0.35rem; }
  .tr-lanes-intro .tr-lanes-dek { margin-top: 0; }
  .tr-lanes-wrap { padding-top: clamp(2rem, 3.5vw, 3rem); }
}
@media (max-width: 640px) {
  .tr-lanes-stage { width: auto; margin: 0 calc(-1 * clamp(16px, 3vw, 2rem)); }
  .tr-lanes-via { display: none; }
  .tr-lanes-port.tr-port-la b { right: auto; left: -4px; top: auto; bottom: 7px; transform: none; }
  .tr-lanes-port.tr-port-hou b { right: auto; left: -4px; top: 8px; transform: none; }
  .tr-lanes-port b { font-size: 0.66rem; }
  .tr-lanes-port.is-home b { font-size: 0.8rem; top: auto; left: auto; right: 6px; bottom: 7px; }
  .tr-lanes-port.is-home small { display: none; }
  .tr-lanes-port i { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-lanes-port.is-home i { animation: none; }
}
