/* ═══════════════════════════════════════════════
   TOKENS
═══════════════════════════════════════════════ */
:root {
  --bg0:   #efeeee;
  --bg1:   #ffffff;
  --bg2:   #e8e6e6;
  --bg3:   #d4d4d4;
  --bdr:   rgba(0,0,0,0.1);
  --bdrg:  rgba(0,0,0,0.2);

  --txt:   #000000;
  --txt2:  rgba(0,0,0,0.7);
  --txt3:  rgba(0,0,0,0.4);

  --cyan:   #000000;
  --orange: #ff9100;
  --green:  #69ff47;
  --pink:   #ff4081;
  --purple: #ffffff;
  --white:  #ffffff;

  --glow-cyan:   none;
  --glow-white:  none;

  --hdr: 0px;
  --nav: 71px;
  --cont: calc(100vh - var(--nav));
}

/* ═══════════════════════════════════════════════
   RESET
═══════════════════════════════════════════════ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html {
  height: 100%;
  background: #efeeee;
  overflow: hidden;
}

body {
  font-family: var(--font-body, 'Silka', sans-serif);
  background: #efeeee;
  color: #000;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════ */
header {
  flex-shrink: 0;
  height: var(--hdr);
  background: var(--bg1);
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  padding: 0 24px;
}
.header-content {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  white-space: nowrap;
}
.logo-icon { font-size: 22px; color: var(--cyan); text-shadow: var(--glow-cyan); }
.accent    { color: var(--cyan); }
.tagline   { font-size: 11px; color: var(--txt3); letter-spacing: 1px; }

/* ═══════════════════════════════════════════════
   TAB NAV
═══════════════════════════════════════════════ */
.module-tabs {
  flex-shrink: 0;
  height: var(--nav);
  background: var(--bg1);
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: stretch;
  padding: 0 12px;
  gap: 2px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--txt2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0 22px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab-btn:hover { color: var(--txt); }
.tab-btn.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  text-shadow: 0 0 10px rgba(0,229,255,.5);
}
.tab-icon { font-size: 14px; }

/* ═══════════════════════════════════════════════
   MAIN / TAB CONTENT
═══════════════════════════════════════════════ */
main {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
#tab-map {
  position: absolute;
  inset: 0;
  width: 100%;
}

.map-container {
  position: relative;
  width: 1440px;
  height: 100%;
  margin: 0 auto;
}

/* Shared close button */
.close-btn {
  position: absolute;
  top: 12px; right: 12px;
  background: none;
  border: 1px solid var(--bdr);
  color: var(--txt2);
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  z-index: 10;
}
.close-btn:hover { color: var(--txt); border-color: var(--txt2); }

/* ═══════════════════════════════════════════════
   MODULE 1 — MAP
═══════════════════════════════════════════════ */
#map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #1a1a1a;
}
.leaflet-container {
  background: #1a1a1a !important;
}

/* Map title overlay */
.map-label-bar {
  position: absolute;
  top: 32px;
  left: 64px;
  z-index: 10;
  pointer-events: none;
}
.map-label-title {
  font-family: var(--font-head, 'Borna', sans-serif);
  font-size: 34px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}
.map-label-sub {
  font-family: var(--font-body, 'Silka', sans-serif);
  font-size: 14px;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
  margin-top: 8px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
}

/* Pulsing marker */
.pmarker { position: relative; width: 36px; height: 36px; }
.pmarker .dot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 10px; height: 10px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: 0 0 14px 4px rgba(255,255,255,.7);
  z-index: 2;
}
.pmarker .ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%) scale(1);
  width: 10px; height: 10px;
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 50%;
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: translate(-50%,-50%) scale(1);   opacity: .8; }
  100% { transform: translate(-50%,-50%) scale(4.5); opacity: 0; }
}

/* Override Leaflet divIcon defaults */
.leaflet-div-icon { background: transparent !important; border: none !important; }

/* ── SITE CARD CONTAINER ── */
.site-card {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 400px;
  max-height: calc(100% - 32px);
  background: var(--bg2);
  border: 1px solid var(--bdrg);
  border-radius: 14px;
  z-index: 900;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0,229,255,.08), 0 24px 70px rgba(0,0,0,.7);
  transition: opacity .3s, transform .3s;
}
.site-card.hidden { opacity: 0; pointer-events: none; transform: translateX(20px); }

/* Slide container — overflow hidden hides off-screen page */
#site-card-inner {
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

/* 1 ── HERO */
.sc-hero {
  position: relative;
  width: 100%;
  height: 150px;
  overflow: hidden;
  flex-shrink: 0;
}
.sc-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.sc-hero-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #0d0d2a 0%, #1a1a40 50%, #0a1628 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: rgba(0,229,255,.15);
}
.sc-hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(to top, var(--bg2), transparent);
}
.sc-type-badge {
  position: absolute;
  top: 12px; left: 12px;
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--cyan);
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(6,6,15,.8);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0,229,255,.3);
}

/* 2 ── HEADER block (name + location) */
.sc-header {
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--bdr);
}
.sc-name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 5px;
}
.sc-location {
  font-size: 11px;
  color: var(--txt2);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* 3 ── TAXONOMY */
.sc-taxonomy {
  padding: 10px 20px;
  border-bottom: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sc-tax-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.sc-tax-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--txt3);
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  padding-top: 2px;
  width: 54px;
}
.pill {
  font-size: 10px;
  padding: 2px 9px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: .3px;
}
.pill-period   { background: rgba(124,77,255,.15); color: var(--purple); border: 1px solid rgba(124,77,255,.3); }
.pill-type     { background: rgba(255,64,129,.12); color: var(--pink);   border: 1px solid rgba(255,64,129,.3); }
.pill-topic    { background: rgba(0,229,255,.08);  color: var(--txt2);   border: 1px solid var(--bdr); }
.pill-tag      { background: rgba(255,255,255,.04); color: var(--txt3);  border: 1px solid var(--bdr); }

/* 4 ── NARRATIVE */
.sc-narrative {
  padding: 14px 20px;
  border-bottom: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sc-section-label {
  font-size: 9px;
  letter-spacing: 2.5px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.sc-description {
  font-size: 12.5px;
  color: var(--txt2);
  line-height: 1.65;
}
.sc-narrative-block {
  background: var(--bg3);
  border-radius: 7px;
  padding: 11px 13px;
  border-left: 3px solid transparent;
}
.sc-narrative-block.before { border-left-color: #e63946; }
.sc-narrative-block.after  { border-left-color: var(--cyan); }
.sc-narrative-block .sc-section-label.before { color: #e63946; }
.sc-narrative-block .sc-section-label.after  { color: var(--cyan); }
.sc-narrative-block p {
  font-size: 12px;
  color: var(--txt2);
  line-height: 1.6;
  margin: 0;
}

/* 5 ── BOOM METRIC */
.boom-metric {
  margin: 0 20px 0;
  padding: 13px;
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: 8px;
}
.boom-title {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--cyan);
  font-weight: 700;
  margin-bottom: 11px;
}
.boom-bars { display: flex; flex-direction: column; gap: 9px; }
.boom-bar-row { display: flex; align-items: center; gap: 9px; }
.boom-label {
  font-size: 10px;
  color: var(--txt2);
  width: 74px;
  text-align: right;
  flex-shrink: 0;
}
.boom-bar-track {
  flex: 1;
  height: 7px;
  background: rgba(255,255,255,.04);
  border-radius: 4px;
  overflow: hidden;
}
.boom-bar {
  height: 100%;
  border-radius: 4px;
  width: 0;
  transition: width 1.4s cubic-bezier(.4,0,.2,1);
}
.boom-traditional {
  background: linear-gradient(90deg, #ff6b6b, #e63946);
  box-shadow: 0 0 8px rgba(230,57,70,.5);
}
.boom-ai {
  background: linear-gradient(90deg, var(--cyan), #0096c7);
  box-shadow: 0 0 8px rgba(0,229,255,.5);
}
.boom-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--txt);
  width: 82px;
}
.boom-speedup {
  margin-top: 9px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 1px;
}

/* 6 ── CONNECTORS */
.sc-connectors {
  padding: 12px 20px;
  border-top: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sc-conn-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.sc-conn-label {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--txt3);
  font-weight: 700;
  text-transform: uppercase;
  width: 68px;
  flex-shrink: 0;
  padding-top: 3px;
}
.sc-conn-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tag { font-size: 10px; padding: 3px 9px; border-radius: 20px; font-weight: 600; letter-spacing: .3px; }
.tag-m { background: rgba(0,229,255,.1);  color: var(--cyan);   border: 1px solid rgba(0,229,255,.25); }
.tag-p { background: rgba(255,145,0,.1);  color: var(--orange); border: 1px solid rgba(255,145,0,.25); }
.tag-i { background: rgba(105,255,71,.1); color: var(--green);  border: 1px solid rgba(105,255,71,.25); }
.tag-d { background: rgba(255,64,129,.1); color: var(--pink);   border: 1px solid rgba(255,64,129,.25); }

/* 7 ── FOOTER / SOURCE */
.sc-footer {
  padding: 12px 20px 18px;
  border-top: 1px solid var(--bdr);
}
.sc-source-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 16px;
  background: rgba(0,229,255,.07);
  border: 1px solid rgba(0,229,255,.25);
  border-radius: 7px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.sc-source-btn:hover {
  background: rgba(0,229,255,.14);
  border-color: rgba(0,229,255,.5);
}

/* ── CONNECTOR TAGS — clickable ── */
.tag[data-type] {
  cursor: pointer;
  transition: filter .18s, transform .15s;
}
.tag[data-type]:hover {
  filter: brightness(1.4);
  transform: translateY(-1px);
}

/* ── DETAIL CARD ── */
.detail-card {
  position: absolute;
  top: 16px;
  right: 432px;
  width: 360px;
  max-height: calc(100% - 32px);
  background: var(--bg2);
  border: 1px solid var(--bdrg);
  border-radius: 14px;
  z-index: 950;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(124,77,255,.08), 0 24px 70px rgba(0,0,0,.7);
  transition: opacity .3s, transform .3s;
}
.detail-card.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(12px);
}

#detail-card-inner {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--bdrg) transparent;
}

/* Detail card — colour strip at top per entity type */
.dc-strip {
  height: 6px;
  width: 100%;
  flex-shrink: 0;
}
.dc-strip.ai_method   { background: linear-gradient(90deg, #00e5ff, #0096c7); }
.dc-strip.person       { background: linear-gradient(90deg, #ff9100, #cc6a00); }
.dc-strip.institution  { background: linear-gradient(90deg, #69ff47, #39cc20); }
.dc-strip.discovery    { background: linear-gradient(90deg, #ff4081, #cc1f55); }

/* Detail card — person avatar */
.dc-avatar-row {
  display: flex;
  justify-content: center;
  padding: 20px 20px 0;
  background: var(--bg3);
}
.dc-avatar {
  width: 90px; height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--orange);
  box-shadow: 0 0 20px rgba(255,145,0,.3);
}

/* Detail card — optional hero image (same pattern as site card) */
.dc-hero {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
  flex-shrink: 0;
}
.dc-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.dc-hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55%;
  background: linear-gradient(to top, var(--bg2), transparent);
}

/* Detail card header */
.dc-header {
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--bdr);
}
.dc-type-badge {
  font-size: 9px;
  letter-spacing: 3px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 7px;
}
.dc-type-badge.ai_method   { background: rgba(0,229,255,.12);  color: var(--cyan);   border: 1px solid rgba(0,229,255,.3); }
.dc-type-badge.person       { background: rgba(255,145,0,.12);  color: var(--orange); border: 1px solid rgba(255,145,0,.3); }
.dc-type-badge.institution  { background: rgba(105,255,71,.12); color: var(--green);  border: 1px solid rgba(105,255,71,.3); }
.dc-type-badge.discovery    { background: rgba(255,64,129,.12); color: var(--pink);   border: 1px solid rgba(255,64,129,.3); }

.dc-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 4px;
}
.dc-subtitle {
  font-size: 11px;
  color: var(--txt2);
}

/* Detail card body */
.dc-body {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dc-description {
  font-size: 12.5px;
  color: var(--txt2);
  line-height: 1.65;
}

/* Highlighted block (key contribution / tools / role) */
.dc-highlight-block {
  border-radius: 7px;
  padding: 11px 13px;
  border-left: 3px solid transparent;
}
.dc-highlight-block.ai_method   { background: rgba(0,229,255,.05);  border-left-color: var(--cyan); }
.dc-highlight-block.person       { background: rgba(255,145,0,.05);  border-left-color: var(--orange); }
.dc-highlight-block.institution  { background: rgba(105,255,71,.05); border-left-color: var(--green); }
.dc-highlight-block.discovery    { background: rgba(255,64,129,.05); border-left-color: var(--pink); }

.dc-highlight-label {
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.dc-highlight-label.ai_method   { color: var(--cyan); }
.dc-highlight-label.person       { color: var(--orange); }
.dc-highlight-label.institution  { color: var(--green); }
.dc-highlight-label.discovery    { color: var(--pink); }

.dc-highlight-block p {
  font-size: 12px;
  color: var(--txt2);
  line-height: 1.6;
  margin: 0;
}

/* Meta row (year / org type / evidence etc.) */
.dc-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.dc-meta-item {
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: 6px;
  padding: 8px 10px;
}
.dc-meta-label {
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--txt3);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.dc-meta-value {
  font-size: 11px;
  color: var(--txt);
  font-weight: 600;
}

/* Tags row */
.dc-pills { display: flex; flex-wrap: wrap; gap: 5px; }

/* Footer */
.dc-footer {
  padding: 10px 20px 16px;
  border-top: 1px solid var(--bdr);
}
.dc-source-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  border: 1px solid;
}
.dc-source-btn.ai_method   { background: rgba(0,229,255,.07);  color: var(--cyan);   border-color: rgba(0,229,255,.25); }
.dc-source-btn.person       { background: rgba(255,145,0,.07);  color: var(--orange); border-color: rgba(255,145,0,.25); }
.dc-source-btn.institution  { background: rgba(105,255,71,.07); color: var(--green);  border-color: rgba(105,255,71,.25); }
.dc-source-btn.discovery    { background: rgba(255,64,129,.07); color: var(--pink);   border-color: rgba(255,64,129,.25); }
.dc-source-btn:hover { filter: brightness(1.25); }

/* ── CARD STACK (2-page slide) ── */
.card-stack {
  display: flex;
  width: 200%;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.card-stack.show-sub { transform: translateX(-50%); }
.card-page {
  width: 50%;
  overflow-y: auto;
  max-height: calc(var(--cont) - 32px);
  scrollbar-width: thin;
  scrollbar-color: var(--bdrg) transparent;
}

/* ── ALWAYS-VISIBLE DESCRIPTION ── */
.sc-always-visible {
  padding: 14px 20px;
  border-bottom: 1px solid var(--bdr);
}
.sc-always-visible .sc-description { font-size: 12.5px; color: var(--txt2); line-height: 1.65; }

/* ── BOOM WRAP ── */
.sc-boom-wrap { padding: 0 20px 14px; }

/* ── ACCORDIONS ── */
.accord-section { border-top: 1px solid var(--bdr); }
.accord-item { border-bottom: 1px solid var(--bdr); }
.accord-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  background: none;
  border: none;
  cursor: pointer;
  transition: background .18s;
}
.accord-trigger:hover { background: rgba(255,255,255,.02); }
.accord-icon {
  font-size: 16px;
  font-weight: 300;
  color: var(--cyan);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  font-style: normal;
}
.accord-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--txt2);
  text-align: left;
  letter-spacing: .3px;
}
.accord-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s cubic-bezier(0.4,0,0.2,1);
}
.accord-body > p {
  padding: 0 20px 15px 46px;
  font-size: 12px;
  color: var(--txt2);
  line-height: 1.65;
  margin: 0;
}

/* ── DRILL-DOWN BUTTONS ── */
.drill-section {
  padding: 14px 20px;
  border-top: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drill-section-label {
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--txt3);
  margin-bottom: 2px;
}
.drill-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drill-btn:hover { border-color: var(--bdrg); background: rgba(255,255,255,.02); }
.drill-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.drill-label {
  flex: 1;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--txt);
  text-align: left;
  letter-spacing: .2px;
}
.drill-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}
.drill-arrow { font-size: 20px; color: var(--txt3); flex-shrink: 0; line-height: 1; }

.drill-btn[data-type="ai_method"]   .drill-dot   { background: #00e5ff; box-shadow: 0 0 6px rgba(0,229,255,.6); }
.drill-btn[data-type="ai_method"]   .drill-count  { background: rgba(0,229,255,.12);  color: #00e5ff; }
.drill-btn[data-type="person"]      .drill-dot   { background: #ff9100; box-shadow: 0 0 6px rgba(255,145,0,.6); }
.drill-btn[data-type="person"]      .drill-count  { background: rgba(255,145,0,.12);  color: #ff9100; }
.drill-btn[data-type="institution"] .drill-dot   { background: #69ff47; box-shadow: 0 0 6px rgba(105,255,71,.6); }
.drill-btn[data-type="institution"] .drill-count  { background: rgba(105,255,71,.12); color: #69ff47; }
.drill-btn[data-type="discovery"]   .drill-dot   { background: #ff4081; box-shadow: 0 0 6px rgba(255,64,129,.6); }
.drill-btn[data-type="discovery"]   .drill-count  { background: rgba(255,64,129,.12); color: #ff4081; }

/* ── SUB-CARD HEADER ── */
.sub-header {
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--bdr);
  background: var(--bg1);
  position: sticky;
  top: 0;
  z-index: 10;
}
.sub-back-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 7px;
  transition: opacity .2s;
}
.sub-back-btn:hover { opacity: .7; }
.sub-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--txt);
  letter-spacing: 1px;
}

/* ── ENTITY LIST ── */
.sub-entity-list {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.entity-card {
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: 10px;
  overflow: hidden;
}
.entity-hero {
  position: relative; width: 100%; height: 90px; overflow: hidden;
}
.entity-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entity-hero-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; height: 55%;
  background: linear-gradient(to top, var(--bg3), transparent);
}
.entity-avatar-row {
  display: flex; justify-content: center;
  padding: 16px 16px 0;
  background: rgba(0,0,0,.2);
}
.entity-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ff9100;
  box-shadow: 0 0 16px rgba(255,145,0,.3);
}
.entity-color-strip { height: 5px; width: 100%; }
.entity-body {
  padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 5px;
}
.entity-badge {
  font-size: 9px; letter-spacing: 2.5px; font-weight: 700;
  text-transform: uppercase; padding: 2px 8px; border-radius: 4px;
  display: inline-block; align-self: flex-start;
}
.entity-name { font-size: 15px; font-weight: 700; color: var(--txt); line-height: 1.3; }
.entity-sub  { font-size: 10.5px; color: var(--txt3); }
.entity-desc { font-size: 11.5px; color: var(--txt2); line-height: 1.6; margin: 2px 0 0; }
.entity-highlight {
  border-left: 3px solid transparent; border-radius: 0 6px 6px 0;
  padding: 9px 11px; margin-top: 4px;
}
.entity-hl-label {
  font-size: 9px; letter-spacing: 1.5px; font-weight: 700;
  text-transform: uppercase; margin-bottom: 4px;
}
.entity-highlight p { font-size: 11px; color: var(--txt2); line-height: 1.55; margin: 0; }
.entity-source {
  display: inline-block; margin-top: 6px; font-size: 10.5px;
  text-decoration: none; border-bottom: 1px solid; transition: opacity .2s;
  align-self: flex-start;
}
.entity-source:hover { opacity: .7; }

/* ── L3 THEORY ACCORDION (inside discovery entity card) ── */
.l3-theories { margin-top: 8px; border-top: 1px solid var(--bdr); padding-top: 4px; }
.l3-accord .accord-trigger { padding: 10px 14px; }
.l3-accord .accord-label   { font-size: 11px; }
.l3-theory-content {
  padding: 0 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.theory-block { border-radius: 6px; padding: 9px 11px; border-left: 3px solid transparent; }
.theory-block p { font-size: 11px; color: var(--txt2); line-height: 1.55; margin: 0; padding: 0; }
.theory-label { font-size: 8px; letter-spacing: 2px; font-weight: 700; text-transform: uppercase; margin-bottom: 4px; }
.theory-label.before { color: #e63946; }
.theory-label.after  { color: #69ff47; }
.theory-block.before-block { border-left-color: #e63946; background: rgba(230,57,70,.05); }
.theory-block.after-block  { border-left-color: #69ff47; background: rgba(105,255,71,.05); }

/* Leaflet overrides */
.leaflet-popup-content-wrapper {
  background: var(--bg2) !important;
  border: 1px solid var(--bdrg) !important;
  color: var(--txt) !important;
  border-radius: 8px !important;
  box-shadow: 0 0 20px rgba(0,229,255,.15) !important;
}
.leaflet-popup-tip { background: var(--bg2) !important; }

/* ═══════════════════════════════════════════════
   MODULE 2 — TIMELINE (rebuilt)
═══════════════════════════════════════════════ */
#tab-timeline {
  padding: 0;
  overflow: hidden;
  position: relative;
}

/* Floating header overlay */
.tl-header-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 16px 28px 40px;
  z-index: 20;
  background: linear-gradient(to bottom, var(--bg0) 55%, transparent);
  pointer-events: none;
}
.tl-header-bar h2 { font-size: 16px; letter-spacing: 2px; color: var(--txt); }
.tl-header-bar p  { font-size: 11px; color: var(--txt3); margin-top: 3px; }

/* Scrollable canvas */
#timeline-container {
  position: absolute;
  inset: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
#timeline-svg {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
}

/* ── NODE CARDS ── */
.tl-node-card {
  position: absolute;
  width: 210px;
  background: var(--bg2);
  border: 1px solid var(--bdrg);
  border-radius: 11px;
  padding: 13px 13px 10px;
  cursor: pointer;
  /* center on its x anchor */
  transform: translateX(-50%);
  transition: border-color .2s, box-shadow .2s, transform .2s;
  z-index: 10;
}
.tl-node-card:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(0,229,255,.22), 0 8px 30px rgba(0,0,0,.5);
  transform: translateX(-50%) translateY(-3px);
}
/* stem connector line drawn via CSS border-left on a pseudo element */
.tl-node-card::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 1px;
  background: #2e2e60;
}
.tl-node-card.above::after { top: 100%; height: 30px; }
.tl-node-card.below::after { bottom: 100%; height: 30px; }

/* Year badge */
.tl-year {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--cyan);
  margin-bottom: 5px;
  text-shadow: 0 0 8px rgba(0,229,255,.5);
}

/* Discovery title */
.tl-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--txt);
  line-height: 1.35;
  margin-bottom: 4px;
}

/* AI method tags */
.tl-methods {
  font-size: 9.5px;
  color: var(--txt3);
  line-height: 1.4;
  margin-bottom: 10px;
}

/* ── BOOM BARS inside card ── */
.tl-boom {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}
.tl-boom-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tl-boom-lbl {
  font-size: 9px;
  color: var(--txt3);
  width: 40px;
  flex-shrink: 0;
  text-align: right;
}
.tl-boom-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,.04);
  border-radius: 3px;
  overflow: hidden;
}

/* Traditional bar — starts FULL, shrinks on card hover to AI width */
.tl-bar-trad {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #e63946, #ff6b6b);
  width: 100%;
  transition: width 1s cubic-bezier(.4, 0, .2, 1);
}
.tl-node-card:hover .tl-bar-trad {
  width: var(--ai-pct);   /* collapses to the AI fraction */
}

/* AI bar — always at actual width */
.tl-bar-ai {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--cyan), #0096c7);
  width: var(--ai-pct);
  box-shadow: 0 0 5px rgba(0,229,255,.5);
}

.tl-boom-time {
  font-size: 9px;
  color: var(--txt2);
  width: 50px;
  flex-shrink: 0;
  font-weight: 600;
}

/* Speedup badge */
.tl-speedup {
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: .5px;
  padding-top: 4px;
  border-top: 1px solid var(--bdr);
}

/* Click hint */
.tl-click-hint {
  text-align: center;
  font-size: 9px;
  color: var(--txt3);
  margin-top: 4px;
  opacity: 0;
  transition: opacity .2s;
}
.tl-node-card:hover .tl-click-hint { opacity: 1; }

/* ═══════════════════════════════════════════════
   MODULE 3 — NETWORK
═══════════════════════════════════════════════ */
#tab-network { padding: 14px; gap: 10px; overflow: hidden; }

.net-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.network-header h2 { font-size: 17px; letter-spacing: 2px; }
.network-header p  { font-size: 11px; color: var(--txt3); margin-top: 4px; }

.network-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.leg { font-size: 12px; letter-spacing: .5px; }

#cy {
  flex: 1;
  border: 1px solid var(--bdr);
  border-radius: 8px;
  background: var(--bg3);
  min-height: 0;
}

/* Node info panel */
.node-panel {
  position: absolute;
  bottom: 14px; right: 14px;
  width: 320px;
  max-height: 78vh;
  overflow-y: auto;
  background: var(--bg2);
  border: 1px solid var(--bdrg);
  border-radius: 12px;
  z-index: 100;
  box-shadow: 0 0 40px rgba(0,229,255,.1);
  transition: opacity .3s, transform .3s;
}
.node-panel.hidden { opacity: 0; pointer-events: none; transform: translateY(10px); }

/* hero image inside node panel */
.np-hero {
  position: relative;
  width: 100%;
  height: 130px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}
.np-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.np-hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(to top, var(--bg2), transparent);
}

/* avatar for person nodes */
.np-avatar-row {
  display: flex;
  justify-content: center;
  padding: 18px 18px 0;
  background: var(--bg3);
  border-radius: 12px 12px 0 0;
}
.np-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--orange);
  box-shadow: 0 0 18px rgba(255,145,0,.3);
}

/* inner padding wrapper */
.np-inner { padding: 16px; }

.node-type-badge {
  font-size: 9px;
  letter-spacing: 2px;
  padding: 2px 9px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 700;
}
#node-panel-content h3 { font-size: 15px; margin-bottom: 10px; }

/* description text */
.np-desc { font-size: 12px; color: var(--txt2); line-height: 1.65; margin-bottom: 10px; }

/* topic / tag pills */
.np-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.np-pill  { font-size: 10px; padding: 2px 8px; border-radius: 12px; font-weight: 600; }

/* key-value meta grid */
.np-meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin-bottom: 12px; }
.np-row  { display: contents; }
.np-key  { font-size: 10px; color: var(--txt3); text-transform: uppercase; letter-spacing: .8px; white-space: nowrap; }
.np-val  { font-size: 11px; color: var(--txt1); }

/* section labels */
.np-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 10px 0 4px;
  opacity: .85;
}

/* source link */
.np-source {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,229,255,.3);
  transition: opacity .2s;
}
.np-source:hover { opacity: .7; }

/* connections count */
.np-connections { font-size: 10px; color: var(--txt3); margin-top: 12px; }

/* ═══════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg0); }
::-webkit-scrollbar-thumb { background: var(--bdrg); border-radius: 2px; }

/* ═══════════════════════════════════════════════
   MODULE 4 — RELATIONS / ONTOLOGY
═══════════════════════════════════════════════ */
.tab-content { display: none; }
.tab-content.active { display: block; }
#tab-relation.active { display: flex; flex-direction: column; }

#tab-relation {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(124,77,255,0.06) 0%, rgba(0,0,0,0) 60%),
    radial-gradient(ellipse at 80% 20%, rgba(0,229,255,0.05) 0%, rgba(0,0,0,0) 50%),
    var(--bg0);
  height: var(--cont);
  overflow: hidden;
}
.rel-topbar {
  flex-shrink: 0;
  padding: 14px 22px 10px;
  border-bottom: 1px solid var(--bdr);
  background: rgba(13,13,26,0.6);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  z-index: 5;
}
/* Legend on the left, header pinned on the right */
.rel-legend { order: 1; }
.rel-header {
  order: 2;
  text-align: right;
  margin-left: auto;
}
.rel-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--txt);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 0;
}
.rel-header p {
  font-size: 11px;
  color: var(--txt2);
  margin-top: 4px;
  letter-spacing: 0.4px;
}
.rel-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.rel-leg {
  font-size: 10.5px;
  color: var(--txt2);
  letter-spacing: 0.6px;
  white-space: nowrap;
}
.rel-leg::first-letter { color: var(--c); text-shadow: 0 0 8px var(--c); font-size: 13px; }
.rel-leg { color: var(--c, var(--txt2)); }

#rel-canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#rel-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.node-clickable circle {
  transition: fill 0.2s ease, stroke 0.2s ease;
}

.node-clickable text {
  transition: fill 0.2s ease;
}

.node-clickable:hover circle {
  fill: #000000 !important;
}

.node-clickable:hover text {
  fill: #ffffff !important;
}

/* Orbital rings (faint guide circles) */
.orbit-ring {
  fill: none;
  stroke: rgba(0, 229, 255, 0.08);
  stroke-width: 1;
  stroke-dasharray: 2 6;
}
.orbit-ring-outer { stroke: rgba(124, 77, 255, 0.08); }

/* Direct edges (cyan, solid) */
/* Direct edges: RC → entity type */
.edge-direct {
  fill: none;
  stroke: rgba(0, 229, 255, 0.6);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.4));
}

/* Cross edges: entity → entity connections */
.edge-cross {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1;
  stroke-dasharray: 4 5;
}

/* Edge labels */
.edge-label {
  fill: var(--cyan);
  font-size: 10px;
  font-weight: 500;
  text-anchor: middle;
  letter-spacing: 0.6px;
  text-shadow: 0 0 4px rgba(0,0,0,0.95);
  paint-order: stroke;
  stroke: #06060f;
  stroke-width: 3;
}
.edge-label-i {
  fill: #c0a0ff;
  font-size: 10px;
  font-weight: 500;
  text-anchor: middle;
  letter-spacing: 0.6px;
  paint-order: stroke;
  stroke: #06060f;
  stroke-width: 3;
}

/* Nodes */
.node text, .node-center text {
  text-anchor: middle;
  pointer-events: none;
}
.node-title {
  fill: var(--txt);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.node-title-center {
  fill: #0a0a20;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
}
.node-sub {
  fill: var(--txt2);
  font-size: 9.5px;
  letter-spacing: 0.6px;
}

/* Centre node pulsing ring */
.pulse-ring {
  transform-origin: center;
  animation: relPulse 2.6s ease-out infinite;
}
@keyframes relPulse {
  0%   { transform: scale(1);    opacity: 0.45; }
  100% { transform: scale(1.5);  opacity: 0;    }
}

/* Canvas titles — left-anchored, top-left corner */
.rel-canvas-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 14px 22px;
  pointer-events: none;
  z-index: 10;
}
.rel-canvas-title {
  color: var(--txt);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  line-height: 1;
  margin: 0;
}
.rel-canvas-sub {
  color: var(--txt2);
  font-size: 10px;
  letter-spacing: 1px;
  margin-top: 5px;
}

/* ── Focus mode — triggered on node click ── */
.node-dimmed {
  transition: opacity 0.3s ease;
  opacity: 0.12;
  pointer-events: none;
}
.node-focused circle {
  filter: brightness(1.6) drop-shadow(0 0 18px rgba(255,255,255,0.6)) !important;
  stroke-width: 3.5 !important;
}
.node-focused text {
  opacity: 1;
}
.node-active circle {
  filter: brightness(2) drop-shadow(0 0 28px rgba(255,255,255,0.9)) !important;
  stroke-width: 4 !important;
}
.node-active text {
  opacity: 1;
  font-weight: 800;
}
.edge-dimmed {
  opacity: 0.04 !important;
  transition: opacity 0.3s ease;
}
.edge-focused {
  stroke-width: 2.5 !important;
  opacity: 1 !important;
  filter: drop-shadow(0 0 6px currentColor);
  transition: opacity 0.3s ease;
}

/* Hide topics and tags connections by default */
path[data-to="topics"],
path[data-from="topics"],
path[data-to="tags"],
path[data-from="tags"] {
  opacity: 0;
  transition: opacity 0.3s ease;
}

path.edge-focused[data-to="topics"],
path.edge-focused[data-from="topics"],
path.edge-focused[data-to="tags"],
path.edge-focused[data-from="tags"] {
  opacity: 1 !important;
}

/* Hover: nodes brighten and glow */
.node, .node-outer, .node-center {
  cursor: pointer;
}
.node circle, .node-outer circle, .node-center circle {
  transition: filter 0.25s ease, stroke-width 0.25s ease, opacity 0.3s ease;
  pointer-events: all;
  cursor: grab;
}
.node circle:active, .node-outer circle:active, .node-center circle:active {
  cursor: grabbing;
}
.node:hover circle,
.node-outer:hover circle,
.node-center:hover circle {
  filter: brightness(1.5) drop-shadow(0 0 14px rgba(255, 255, 255, 0.55));
  stroke-width: 4;
}
/* Outer/inner nodes have dark fill - white text on hover is fine */
.node:hover .node-title,
.node-outer:hover .node-title {
  fill: #ffffff;
}
.node:hover, .node-outer:hover {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.25));
}

/* Centre node has WHITE bg - DON'T turn text white on hover.
   Use a subtle size + kerning shift instead. */
.node-center .node-title,
.node-center .node-sub {
  transition: font-size 0.25s ease, letter-spacing 0.25s ease;
}
.node-center:hover .node-title-center {
  font-size: 16px;
  letter-spacing: 1.2px;
}
.node-center:hover .node-sub-center {
  font-size: 11px;
  letter-spacing: 0.8px;
}

/* Smaller, tighter node titles for two-line property+type layout */
.node .node-title {
  font-size: 10.5px;
  letter-spacing: 0.6px;
  text-transform: none;
  font-weight: 700;
}
.node .node-sub {
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: 0.4px;
}
.node-outer .node-title { font-size: 10px; }
.node-outer .node-sub { font-size: 8px; }

/* Centre node: bounty name big + type small */
.node-title-center {
  font-size: 14px;
  letter-spacing: 1.5px;
  font-weight: 800;
}
.node-sub-center {
  fill: #2a2a4a !important;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* Selected node */
.node.selected circle, .node-outer.selected circle, .node-center.selected circle {
  filter: brightness(1.7) drop-shadow(0 0 22px rgba(255, 255, 255, 0.75));
  stroke-width: 4;
}

/* Side panel */
.rel-side-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 380px;
  background: var(--bg1);
  border-right: 1px solid var(--bdr);
  z-index: 20;
  padding: 24px 22px;
  overflow-y: auto;
  transform: translateX(0);
  transition: transform 0.3s ease;
  box-shadow: 4px 0 24px rgba(0, 229, 255, 0.05);
}
.rel-side-panel.hidden {
  transform: translateX(-100%);
  pointer-events: none;
}
.rel-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--txt2);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  transition: background 0.2s;
}
.rel-close-btn:hover { background: rgba(255,255,255,0.05); color: var(--txt); }

.rel-panel-prop {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.rel-panel-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--txt);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.rel-panel-type {
  font-size: 12px;
  color: var(--txt2);
  letter-spacing: 0.6px;
  margin-bottom: 18px;
}
.rel-panel-desc {
  font-size: 13px;
  color: var(--txt);
  line-height: 1.55;
  margin-bottom: 18px;
}
.rel-panel-list-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--txt3);
  margin: 16px 0 8px;
  border-top: 1px solid var(--bdr);
  padding-top: 14px;
}
.rel-panel-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.rel-panel-list li {
  font-size: 12px;
  color: var(--txt);
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 2px;
  line-height: 1.4;
}
.rel-panel-list li:hover { background: rgba(0, 229, 255, 0.06); }
.rel-panel-list li::before {
  content: "•";
  color: var(--cyan);
  margin-right: 8px;
  font-weight: bold;
}
.rel-panel-cover {
  width: 100%;
  border-radius: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--bdr);
}
