.linkage-page { padding-block: 52px 56px; }
.map-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.map-heading h1 { margin: 6px 0 18px; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.04em; line-height: 1.13; }
.snapshot-badge { white-space: nowrap; border: 1px solid var(--line-strong); color: var(--role); border-radius: 30px; padding: 7px 13px; font-size: 12px; font-weight: 650; }
.map-intro .lede { max-width: 850px; margin: 0 0 14px; }
.map-note { color: var(--muted); max-width: 930px; font-size: 14px; margin: 0; }

.direct-summary { margin-top: 28px; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--wash); }
.direct-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; gap: 24px; margin: 0; }
.direct-stats > div + div { border-left: 1px solid var(--line); padding-left: 24px; }
.direct-stats dt { color: var(--muted); font-size: 13px; }
.direct-stats dd { margin: 3px 0 0; font-size: 36px; font-weight: 650; line-height: 1.2; letter-spacing: -.035em; }
.direct-total dt { color: var(--ink); font-weight: 650; }
.direct-total dd { font-size: 48px; }
.direct-excluded { margin: 18px 0 6px; font-size: 13px; }
.direct-definition { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; max-width: 1000px; }

.map-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 32px 0 24px; border-block: 1px solid var(--line); }
.map-stats div { padding: 18px 0; }
.map-stats dt { color: var(--muted); font-size: 12px; }
.map-stats dd { margin: 3px 0 0; font-size: 31px; font-weight: 650; letter-spacing: -.035em; }

.map-figure { margin: 0; }
.graph-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: 16px; align-items: stretch; }
.graph-stage {
  position: relative; border: 1px solid #dce3dc; border-radius: 5px;
  overflow: hidden; background: #fafbf8; height: clamp(480px, 66vh, 820px);
}
#relgraph { width: 100%; height: 100%; }
.graph-detail {
  border: 1px solid var(--line); border-radius: 5px; background: var(--paper);
  padding: 16px 18px; font-size: 13px; overflow: auto; max-height: clamp(480px, 66vh, 820px);
}
.graph-detail h3 { margin: 0 0 10px; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.graph-detail-hint { color: var(--muted); margin: 0; line-height: 1.6; }
.graph-kv { margin: 0; }
.graph-kv dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; margin-top: 11px; }
.graph-kv dt:first-of-type { margin-top: 0; }
.graph-kv dd { margin: 3px 0 0; line-height: 1.5; overflow-wrap: anywhere; }
.graph-kv dd .tag { display: inline-block; margin: 0 4px 4px 0; padding: 2px 7px; border: 1px solid var(--line-strong); background: var(--wash); font-size: 11px; }
.graph-detail-open { margin: 14px 0 0; font-weight: 600; }
.map-fallback { padding: 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.map-loading, .map-empty, .map-error {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 14px; pointer-events: none; text-align: center; padding: 20px;
}
.map-error { color: var(--asterisk); }

.map-figure figcaption { padding-top: 13px; font-size: 12px; color: var(--muted); }
.map-caption-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.map-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.map-controls button {
  padding: 7px 13px; border: 1px solid var(--line-strong); border-radius: 0;
  background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer;
}
.map-controls button:hover { border-color: var(--ink); }
.map-controls button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.map-updated { color: var(--subtle); }

.map-key-section { margin-top: 22px; padding-block: 18px; border-block: 1px solid var(--line); }
.map-key-section strong { color: var(--ink); font-size: 13px; }
.map-key { display: flex; flex-wrap: wrap; gap: 14px 28px; list-style: none; margin: 13px 0; padding: 0; font-size: 13px; }
.map-key li { display: flex; align-items: center; gap: 7px; }
.key-dot { width: 12px; height: 12px; flex: none; border-radius: 50%; }
.key-dot.upstream { background: #d55e00; }
.key-dot.downstream { background: #0072b2; }
.key-dot.standalone { background: #873fb0; }
.key-dot.both { background: #008568; }
.key-dot.related { background: #525b63; }
.key-line { width: 25px; flex: none; border-top: 2px solid #a9b5bb; }
.map-key-note { margin: 0; line-height: 1.6; }

.map-notes { margin-top: 38px; display: grid; grid-template-columns: 1fr 1fr; gap: 52px; }
.map-notes h2 { margin: 0 0 9px; font-size: 15px; }
.map-notes p, .map-source { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0; }
.map-source { margin-top: 22px; }

@media (max-width: 760px) {
  .graph-wrap { grid-template-columns: 1fr; }
  .graph-detail { max-height: none; }
}

@media (max-width: 650px) {
  .linkage-page { padding-block: 30px 36px; }
  .map-heading { align-items: flex-start; flex-direction: column; gap: 0; margin-bottom: 16px; }
  .map-heading h1 { margin-bottom: 13px; }
  .direct-summary { padding: 18px; }
  .direct-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .direct-total { grid-column: 1 / -1; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
  .direct-stats > div:nth-child(2) { border-left: 0; padding-left: 0; }
  .direct-stats > div:nth-child(3) { padding-left: 16px; }
  .direct-stats dd { font-size: 30px; }
  .direct-total dd { font-size: 42px; }
  .map-stats { grid-template-columns: 1fr 1fr; }
  .map-stats div { padding-block: 12px; }
  .map-stats dd { font-size: 27px; }
  .map-notes { grid-template-columns: 1fr; gap: 24px; margin-top: 30px; }
  .map-caption-meta { align-items: flex-start; flex-direction: column; }
}
