/* ============================================================
   Pengqi — Global Reach (world map)
   ------------------------------------------------------------
   Layout idea adapted from the `pengqi-global-map-why` prototype,
   rebuilt on this site's own design tokens so the band reads as a
   native section rather than a pasted-in widget.

   Deliberately inherits from pq-global.css:
     .pq-container   - same 1280px grid as every other section
     .pq-kicker      - same eyebrow, incl. the orange rule
     --pq-navy / --pq-blue / --pq-accent - same palette

   Class prefix is .pq-wm- (world map) so nothing can collide with
   the existing .pq-* site classes or the prototype's .pqg-*.
   No external fonts, no map tiles, no libraries.

   Contrast note: the first pass tinted the land with
   rgba(255,255,255,.055) over a dark card, which measures about 1.15:1
   against the ocean - indistinguishable, and the reason the map read as
   an eye-straining smear. The land fill below is a solid slate tone at
   roughly 2.5:1, with a bright coastline stroke, which is what actually
   makes the shapes readable.
   ============================================================ */

.pq-wm {
  --wm-ocean: #041322;
  --wm-land: #33587a;
  --wm-land-line: rgba(178, 212, 240, .55);
  --wm-market: #2b8cf0;
  --wm-market-hover: #56a8ff;
  --wm-market-line: #b6e3ff;
  --wm-origin: var(--pq-accent);
  --wm-hair: rgba(255, 255, 255, .13);

  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 96px 0;
  color: #fff;
  background: var(--pq-navy);
}

/* A single soft light pool at the top. Kept well away from the bottom
   edge on purpose: this section is followed by another navy section, and
   any tint that survives to the bottom shows up as a step between them. */
.pq-wm::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(72% 58% at 78% 4%, rgba(11, 120, 208, .17), transparent 72%),
    radial-gradient(52% 44% at 6% 26%, rgba(11, 120, 208, .10), transparent 70%);
}

.pq-wm .pq-container { position: relative; z-index: 1; }

/* ---------- heading ---------- */
.pq-wm-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 64px;
  align-items: end;
  margin-bottom: 34px;
}

.pq-wm .pq-kicker { color: #fff; }

.pq-wm-title {
  margin: 0;
  max-width: 15em;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.06;
  letter-spacing: -.035em;
  font-weight: 700;
}

.pq-wm-title span { display: block; color: #a8d2ef; }

.pq-wm-lead {
  max-width: 34em;
  margin: 20px 0 0;
  color: rgba(255, 255, 255, .8);
  font-size: 17px;
  line-height: 1.7;
}

/* Two stacked bordered cells - the same hairline grid motif the
   process section already uses, rather than floating glass cards. */
.pq-wm-metrics {
  display: grid;
  border-top: 1px solid var(--wm-hair);
  border-left: 1px solid var(--wm-hair);
}

.pq-wm-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-right: 1px solid var(--wm-hair);
  border-bottom: 1px solid var(--wm-hair);
}

.pq-wm-metric b {
  color: #fff;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

.pq-wm-metric span {
  color: rgba(255, 255, 255, .74);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: right;
}

.pq-wm-metric--origin b { color: var(--pq-accent); }

/* ---------- map card ---------- */
.pq-wm-card {
  position: relative;
  border: 1px solid var(--wm-hair);
  background: linear-gradient(180deg, #051828 0%, #041322 100%);
}

/* Terminal accent on the card's own bottom edge. Same device as the
   hero's orange rule, but aligned to the card instead of the viewport -
   a full-bleed bar there just floated between two navy sections. */
.pq-wm-card::after {
  position: absolute;
  right: -1px;
  bottom: -4px;
  width: 34%;
  height: 4px;
  background: var(--pq-accent);
  content: "";
}

/* Corner ticks - a small, cheap "instrument panel" cue. */
.pq-wm-tick {
  position: absolute;
  z-index: 4;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(255, 255, 255, .45);
  pointer-events: none;
}
.pq-wm-tick:nth-of-type(1) { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.pq-wm-tick:nth-of-type(2) { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }

/* The market list is read by the renderer; it must never show. */
[data-pq-wm-markets] { display: none; }

.pq-wm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--wm-hair);
  color: rgba(255, 255, 255, .74);
  font-size: 11px;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.pq-wm-bar__group { display: flex; align-items: center; gap: 22px; }

.pq-wm-live {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-weight: 700;
}

.pq-wm-live::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4aabf5;
  box-shadow: 0 0 0 4px rgba(74, 171, 245, .22), 0 0 12px rgba(74, 171, 245, .9);
  content: "";
}

/* Legend - the prototype had none; without it the two dot colours
   are guesswork for a first-time visitor. */
.pq-wm-legend { display: flex; align-items: center; gap: 20px; }

.pq-wm-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.pq-wm-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  font-style: normal;
  background: var(--pq-accent);
  box-shadow: 0 0 8px rgba(243, 167, 18, .9);
}

.pq-wm-legend span:last-child i {
  background: #5ec2ff;
  box-shadow: 0 0 8px rgba(94, 194, 255, .9);
}

/* ---------- map stage ---------- */
/* The stage is given the geometry's own aspect ratio (1000 x 397) so the
   artwork fills it exactly. A min-height here used to stretch the box on
   narrow screens and leave two dead bands above and below the map. */
.pq-wm-stage {
  position: relative;
  aspect-ratio: 1000 / 397;
  overflow: hidden;
  background: var(--wm-ocean);
}

/* Graticule, confined to the map itself. It used to also be painted
   across the whole section, which added texture behind the body copy
   and was a large part of why the band felt tiring to look at. */
.pq-wm-stage::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(120, 178, 226, .085) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 178, 226, .085) 1px, transparent 1px);
  background-size: 50px 50px;
  -webkit-mask-image: radial-gradient(80% 92% at 50% 46%, #000 34%, transparent 100%);
  mask-image: radial-gradient(80% 92% at 50% 46%, #000 34%, transparent 100%);
}

.pq-wm-map {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.pq-wm-country {
  fill: var(--wm-land);
  stroke: var(--wm-land-line);
  stroke-width: .5;
  vector-effect: non-scaling-stroke;
  transition: fill .4s ease, stroke .4s ease;
}

.pq-wm-country--on {
  fill: var(--wm-market);
  stroke: var(--wm-market-line);
  stroke-width: .7;
  cursor: default;
}

.pq-wm-country--on:hover,
.pq-wm-country--on.is-hot {
  fill: var(--wm-market-hover);
  stroke: #e2f4ff;
}

/* Routes: amber at the Xuzhou end, cooling to blue at the market.
   Slower than the first pass - ten routes all flowing at once on a dark
   field was needlessly busy. */
.pq-wm-route {
  fill: none;
  stroke: url(#pq-wm-route);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 5 7;
  opacity: 0;
  vector-effect: non-scaling-stroke;
}

.pq-wm-card.is-live .pq-wm-route {
  animation: pq-wm-reveal 1.1s ease forwards, pq-wm-flow 3.4s linear infinite;
}

@keyframes pq-wm-reveal { to { opacity: .8; } }
@keyframes pq-wm-flow { to { stroke-dashoffset: -24; } }

/* Hovering a market (or its chip) makes that single route stand out. */
.pq-wm-route.is-hot {
  stroke-width: 2.2;
  filter: drop-shadow(0 0 3px rgba(140, 214, 255, .9));
}

.pq-wm-particle {
  fill: #e6f7ff;
  opacity: .95;
  filter: drop-shadow(0 0 3px rgba(150, 225, 255, .95));
}

.pq-wm-dot__halo {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
}

.pq-wm-card.is-live .pq-wm-dot__halo { animation: pq-wm-pulse 2.6s ease-out infinite; }

.pq-wm-dot--market .pq-wm-dot__core {
  fill: #8fd8ff;
  filter: drop-shadow(0 0 4px rgba(110, 200, 255, .95));
}
.pq-wm-dot--market .pq-wm-dot__halo { fill: rgba(143, 216, 255, .24); }

.pq-wm-dot--origin .pq-wm-dot__core {
  fill: var(--pq-accent);
  filter: drop-shadow(0 0 6px rgba(243, 167, 18, .98));
}
.pq-wm-dot--origin .pq-wm-dot__halo { fill: rgba(243, 167, 18, .3); }

@keyframes pq-wm-pulse {
  0% { opacity: .85; transform: scale(.35); }
  72%, 100% { opacity: 0; transform: scale(3); }
}

.pq-wm-origin-pill rect {
  fill: rgba(3, 12, 22, .93);
  stroke: rgba(243, 167, 18, .6);
  stroke-width: 1;
}
.pq-wm-origin-pill text {
  fill: #ffc75c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
}

.pq-wm-tip {
  position: absolute;
  z-index: 20;
  min-width: 116px;
  padding: 9px 12px;
  border: 1px solid rgba(120, 200, 255, .38);
  color: #fff;
  background: rgba(3, 12, 22, .95);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  transition: opacity .16s ease;
}
.pq-wm-tip b { display: block; font-size: 13px; }
.pq-wm-tip span {
  color: rgba(255, 255, 255, .66);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.pq-wm-tip.is-on { opacity: 1; }

/* ---------- market chips ---------- */
.pq-wm-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 22px 16px;
  border-top: 1px solid var(--wm-hair);
}

.pq-wm-strip__label {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, .7);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.pq-wm-chips {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-width: 0;
}

.pq-wm-chip {
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, .24);
  color: rgba(255, 255, 255, .88);
  background: transparent;
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.pq-wm-chip:hover,
.pq-wm-chip.is-hot {
  border-color: rgba(120, 200, 255, .75);
  color: #fff;
  background: rgba(43, 140, 240, .28);
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .pq-wm-head { grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; }
}

@media (max-width: 900px) {
  .pq-wm { padding: 72px 0; }
  .pq-wm-head { grid-template-columns: 1fr; gap: 28px; align-items: start; }
  .pq-wm-metrics { max-width: 420px; }
  /* Slightly taller than the artwork for breathing room; the difference is
     filled by the stage's own graticule so it does not read as padding. */
  .pq-wm-stage { aspect-ratio: 2.3 / 1; }
}

@media (max-width: 640px) {
  .pq-wm { padding: 60px 0; }
  .pq-wm-title { font-size: 32px; }
  .pq-wm-lead { font-size: 15px; }
  .pq-wm-metric { padding: 15px 16px; }
  .pq-wm-metric b { font-size: 27px; }
  .pq-wm-metric span { font-size: 10px; }
  .pq-wm-bar { flex-wrap: wrap; gap: 10px 16px; padding: 13px 16px; }
  .pq-wm-bar__group { gap: 16px; }
  .pq-wm-bar__group--origin { width: 100%; justify-content: space-between; }
  .pq-wm-stage { aspect-ratio: 2.1 / 1; }
  .pq-wm-strip { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; }
  /* At phone width the map is only ~340px across, where a pill for
     "Xuzhou, China" would cover a quarter of it. The toolbar legend
     already pairs the name with the amber dot, so hide the pill. */
  .pq-wm-origin-pill { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pq-wm *,
  .pq-wm *::before,
  .pq-wm *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .pq-wm-route { opacity: .6 !important; }
  .pq-wm-particle { display: none; }
}
