/* ── PV pathway frequency view ─────────────────────────────────────────── */
.freq-paper-card { transition: border-color .15s ease, box-shadow .15s ease; }
.freq-paper-card:hover { border-color: #c7cdd8 !important; box-shadow: 0 2px 8px rgba(17,24,39,.06); }
.freq-paper-title:hover { color: #1F3F8C !important; text-decoration: underline !important; }

/* panel nested under the fault buttons (aligned with their 6px inset) */
.freq-panel { margin: 0 6px 6px; border: 1px solid #e5e7eb; border-radius: 12px; background: white;
  position: relative; }
.freq-panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px;
  padding: 14px 16px 12px; border-bottom: 1px solid #f0f1f3; }
.freq-head-text { flex: 1 1 260px; min-width: 0; }
.freq-title { font-size: 17px; font-weight: 800; color: #1f2937; line-height: 1.3; }
.freq-subtitle { color: #6b7280; font-size: 13px; margin-top: 2px; }
.freq-subtitle b { color: #1f2937; }
.freq-head-ctrls { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.freq-controls { display: flex; align-items: center; gap: 8px; }
.freq-ctrl-label { font-size: 13px; color: #6b7280; font-weight: 600; }
.freq-panel-body { padding: 12px 16px 14px; }
.freq-sankey-box { position: relative; padding-top: 48px; }
.freq-bar-box { padding: 0; }

/* segmented controls */
.freq-seg { display: inline-flex; background: #f1f2f5; border-radius: 999px; padding: 3px; gap: 2px; }
.freq-seg .form-check { padding: 0; margin: 0; min-height: 0; }
.freq-seg .form-check-input { display: none; }
.freq-seg-btn { display: inline-block; padding: 6px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: #6b7280; cursor: pointer; user-select: none; transition: all .15s ease; margin: 0; }
.freq-seg-btn:hover { color: #1f2937; }
.freq-seg-btn.active { background: white; color: #1f2937; box-shadow: 0 1px 3px rgba(17,24,39,.12), 0 1px 1px rgba(17,24,39,.05); }
.freq-seg-sm .freq-seg-btn { padding: 4px 11px; font-size: 13px; }

/* ranking rows */
.freq-path-head, .freq-path-row { display: grid; grid-template-columns: 34px minmax(0, 2fr) minmax(160px, 1fr);
  align-items: center; gap: 14px; padding: 9px 10px; }
.freq-path-head { font-size: 11px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase;
  color: #9ca3af; border-bottom: 1px solid #e5e7eb; }
.freq-path-row { border-radius: 10px; cursor: pointer; transition: background .15s ease, box-shadow .15s ease; }
.freq-path-row + .freq-path-row { margin-top: 2px; }
.freq-rows { max-height: 470px; overflow-y: auto; padding-right: 4px; }   /* ~10 rows, scroll for more */
.freq-path-row:hover { background: white; box-shadow: 0 2px 10px rgba(17,24,39,.07); }
.freq-path-row:hover .freq-bar { opacity: 1; }
.freq-rank { font-weight: 800; color: #9ca3af; text-align: center; font-size: 14px; }
.freq-path-row:nth-child(-n+3) .freq-rank { color: #1f2937; }
.freq-path-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.freq-bar-wrap { display: flex; align-items: center; gap: 10px; }
.freq-bar { height: 14px; border-radius: 999px; background: #1F3F8C; opacity: .8; transition: opacity .15s ease, filter .15s ease; }
.freq-bar-n { font-weight: 800; color: #1f2937; font-size: 14px; min-width: 24px; }
@media (max-width: 760px) {
  .freq-path-head { display: none; }
  .freq-path-row { grid-template-columns: 28px 1fr; }
  .freq-bar-wrap { grid-column: 2; }
}

/* clickable mini pathway thumbnail in the map side panel */
.mini-graph-click { cursor: pointer; border-radius: 12px; transition: transform .15s ease, box-shadow .15s ease; }
.mini-graph-click:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(17,24,39,.10); }

/* generated 3D module (map side panel); labels are model-viewer hotspots that follow their layer.
   model-viewer centres each hotspot on its anchor, so translateX(-50%) puts the label's right edge
   (the end of its leader line) exactly on the module's front-left corner. */
.mv-wrap { background: none; border: none; padding: 0; margin: 0 0 8px; }
.mv-caption { font-size: 9.5px; color: #9ca3af; text-align: center; margin: 0 0 2px; }
.hotspot.mv-hs { display: flex; align-items: center; gap: 4px; font: 400 11px Arial, sans-serif; line-height: 1;
  color: #6b7280; white-space: nowrap; transform: translateX(-50%); pointer-events: none;
  background: none; border: none; padding: 0 2px 0 0; }
.hotspot.mv-hs::after { content: ""; width: 12px; height: 1px; background: #b8bec8; }
.hotspot.mv-hs.on { color: #1d4ed8; font-weight: 700; }
.hotspot.mv-hs.on::after { background: #2563eb; height: 2px; width: 16px; }
.mv-extra { font-size: 11px; color: #1d4ed8; font-weight: 700; text-align: right; margin: -4px 6px 4px; }

/* pathway modal: detail panel never taller than the graph box; extra content scrolls.
   (higher specificity than the "height: auto !important" rules in style.css) */
#pathway-modal .modal-graph-detail-row .modal-detail-panel.pv-pathway-detail-panel {
  height: 400px !important; max-height: 400px !important; overflow-y: auto !important; }
#pathway-modal .modal-graph-detail-row .modal-graph-box { align-self: flex-start; }
@media (max-width: 900px) {
  #pathway-modal .modal-graph-detail-row .modal-detail-panel.pv-pathway-detail-panel {
    height: 300px !important; max-height: 300px !important; }
}
@media (max-width: 620px) {
  #pathway-modal .modal-graph-detail-row .modal-detail-panel.pv-pathway-detail-panel {
    height: 240px !important; max-height: 240px !important; }
}

/* Sankey node labels as rounded pills (HTML overlay; clicks pass through to the chart) */
.freq-pills { position: absolute; inset: 0; pointer-events: none; }
.freq-pill { position: absolute; transform: translateY(-50%); pointer-events: auto; cursor: pointer; color: #fff; font: 700 12px/1.25 Arial, sans-serif;
  padding: 4px 10px; border-radius: 7px; white-space: nowrap; box-shadow: 0 1px 3px rgba(17,24,39,.15); }
.freq-pill.multi { border-radius: 7px; padding: 5px 10px; }
.freq-pill-n { font-size: 11px; font-weight: 700; opacity: .85; margin-left: 2px; }

.freq-pill:hover { filter: brightness(1.12); box-shadow: 0 3px 8px rgba(17,24,39,.22); }

/* Sankey label pills: clearer hover */
.freq-pill { transition: transform .12s ease, box-shadow .12s ease, filter .12s ease; }
.freq-pill:hover { transform: translateY(-50%) scale(1.07); filter: brightness(1.15);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(31,63,140,.35), 0 6px 14px rgba(17,24,39,.25); z-index: 5; }

/* node detail modal: clickable "how papers describe it" terms and comes-from / leads-to rows */
.freq-term-chip { display: inline-block; border: 1px solid #e5e7eb; border-radius: 999px; padding: 3px 10px;
  margin: 0 6px 6px 0; font-size: 12.5px; background: #f9fafb; cursor: pointer; transition: all .12s ease; }
.freq-term-chip:hover { background: #fff; border-color: #6D2E6B; color: #6D2E6B; box-shadow: 0 2px 6px rgba(17,24,39,.08); }
.freq-nav-row { cursor: pointer; border-radius: 8px; padding: 2px 4px; transition: background .12s ease; }
.freq-nav-row:hover { background: #fff; box-shadow: 0 1px 5px rgba(17,24,39,.08); }

/* floating original-text panel (inside the modal; fixed height, scrolls) */
.freq-term-pop { position: absolute; top: 84px; right: 18px; width: min(460px, calc(100% - 36px)); height: 380px;
  flex-direction: column; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(17,24,39,.18); z-index: 1065; overflow: hidden; }
.freq-term-pop-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px 14px;
  border-bottom: 1px solid #f0f1f3; font-size: 14px; color: #1f2937; }
.freq-term-pop-title { flex: 1 1 auto; min-width: 0; }
.freq-term-pop-x { border: none; background: #f3f4f6; color: #6b7280; width: 26px; height: 26px; border-radius: 50%;
  font-size: 13px; line-height: 1; cursor: pointer; flex: 0 0 auto; }
.freq-term-pop-x:hover { background: #e5e7eb; color: #1f2937; }
.freq-term-pop-body { flex: 1 1 auto; overflow-y: auto; padding: 0 14px 10px; }

/* "How papers describe it" word cloud (font size = number of papers) */
.freq-cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 4px;
  padding: 10px 8px 6px; line-height: 1.15; }
.freq-cloud-word { transition: background .12s ease, opacity .12s ease, transform .12s ease, box-shadow .12s ease; }
.freq-cloud-word:hover { background: #fff; opacity: 1 !important; transform: scale(1.08);
  box-shadow: 0 0 0 1px currentColor, 0 3px 10px rgba(17,24,39,.12); text-decoration: underline; text-underline-offset: 3px; }

/* connection (band) detail */
.freq-conn-arrow { color: #9ca3af; font-weight: 700; margin: 0 4px; }
.freq-conn-pairs { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 6px 12px; }
.freq-conn-pair-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 28px; align-items: center;
  gap: 10px; padding: 5px 0; }
.freq-conn-pair-row + .freq-conn-pair-row { border-top: 1px solid #f3f4f6; }
.freq-conn-pair { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; }
.freq-conn-bar-wrap { height: 6px; background: #f3f4f6; border-radius: 3px; overflow: hidden; }
.freq-conn-bar { height: 100%; background: #9aa6c2; border-radius: 3px; }
.freq-conn-n { font-weight: 700; color: #374151; font-size: 13px; text-align: right; }
.freq-conn-list { max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.freq-conn-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 14px;
  margin-bottom: 8px; transition: border-color .12s ease, box-shadow .12s ease; }
.freq-conn-card:hover { border-color: #c7cdd8; box-shadow: 0 2px 8px rgba(17,24,39,.06); }
.freq-conn-head { display: flex; align-items: baseline; gap: 10px; }
.freq-conn-title { flex: 1 1 auto; min-width: 0; color: #1f2937 !important; font-weight: 600; font-size: 14px;
  text-decoration: none; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; }
.freq-conn-year { flex: 0 0 auto; font-size: 11.5px; font-weight: 700; color: #6b7280; background: #f3f4f6;
  border-radius: 6px; padding: 1px 7px; }
.freq-conn-terms { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.freq-conn-reason { margin-top: 7px; font-size: 13px; line-height: 1.5; color: #374151; }
.freq-conn-details { margin-top: 6px; }
.freq-conn-details summary { cursor: pointer; font-size: 12px; font-weight: 700; color: #6b7280; list-style: none;
  display: inline-flex; align-items: center; gap: 4px; }
.freq-conn-details summary::before { content: "\25B8"; transition: transform .12s ease; }
.freq-conn-details[open] summary::before { transform: rotate(90deg); }
.freq-conn-details summary::-webkit-details-marker { display: none; }
.freq-conn-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
@media (max-width: 700px) { .freq-conn-cols { grid-template-columns: 1fr; } }
.freq-conn-col-h { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; margin-top: 4px; }
.freq-conn-none { color: #9ca3af; font-size: 12.5px; margin-top: 6px; }
.freq-conn-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .freq-conn-sides { grid-template-columns: 1fr; } }
.freq-conn-side .freq-conn-pair-row { grid-template-columns: minmax(0, 1fr) 70px 22px; }
.freq-conn-side .freq-conn-bar { opacity: .45; }

/* common reasons for a link */
.freq-theme-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 110px 26px; align-items: center;
  gap: 10px; padding: 7px 0; }
.freq-theme-row + .freq-theme-row { border-top: 1px solid #f3f4f6; }
.freq-theme-no { width: 20px; height: 20px; border-radius: 50%; background: #1f2937; color: #fff; font-size: 11px;
  font-weight: 700; display: flex; align-items: center; justify-content: center; }
.freq-theme-label { font-size: 13.5px; line-height: 1.4; color: #1f2937; }
.freq-theme-label.other { color: #9ca3af; font-style: italic; }
.freq-theme-row .freq-conn-bar { opacity: .55; }
.freq-theme-badge { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; background: #1f2937; color: #fff;
  font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  align-self: center; cursor: help; }
