@import url("https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap");

/* ============================================================
   RESET & BASE
   ============================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: "Inter", sans-serif;
  font-weight: 400;
}

body {
  background: #fff;
  overflow: hidden;
}

/* ============================================================
   SCENE / CANVAS
   ============================================================ */

#scene {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
}

/* locked state cursor */
#scene.is-locked {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4' fill='%23000'/%3E%3C/svg%3E") 12 12, crosshair;
}

/* ============================================================
   VIZ HEADER — title, subtitle, info icon
   ============================================================ */

#viz-header {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

#viz-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

#viz-title {
  font-family: "Inter", system-ui, sans-serif;
  font-size: clamp(13px, 1.4vw, 17px);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #111;
  margin: 0;
  line-height: 1;
}

#viz-subtitle {
  font-family: "Inter", system-ui, sans-serif;
  font-size: clamp(10px, 1vw, 12px);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.04em;
  color: #888;
  margin: 0;
  pointer-events: none;
}

#btn-info {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.2);
  background: transparent;
  color: #888;
  font-size: 13px;
  line-height: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: border-color 0.15s ease, color 0.15s ease;
}

#btn-info:hover {
  border-color: rgba(0,0,0,0.5);
  color: #111;
}

/* ============================================================
   INFO MODAL — overlay
   ============================================================ */

#info-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.5);
}

#info-overlay.is-open {
  display: flex;
}

/* ── Modal card ── */
#info-modal {
  position: relative;
  width: min(560px, calc(100vw - 48px));
  height: min(480px, calc(100vh - 80px));
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Close button ── */
#info-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.14);
  background: transparent;
  color: #999;
  font-size: 11px;
  line-height: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: border-color 0.15s ease, color 0.15s ease;
}

#info-close:hover {
  border-color: rgba(0,0,0,0.4);
  color: #111;
}

/* ── Modal header ── */
#info-modal-header {
  flex-shrink: 0;
  padding: 24px 24px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}

#info-modal-header h2 {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #111;
  margin: 0 0 3px;
}

#info-modal-header p {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 11px;
  font-style: italic;
  font-weight: 400;
  color: #999;
  margin: 0;
  letter-spacing: 0.03em;
}

/* ── Modal body — nav + content side by side ── */
#info-modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ============================================================
   INFO MODAL — left nav (scroll-spy)
   ============================================================ */

  #info-nav {
  width: 100px;
  flex-shrink: 0;
  padding: 20px 0 20px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

#info-nav::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(0,0,0,0.07);
}

.nav-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
}

.nav-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 8px;
  padding-top: 4px;
}

.nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ddd;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-line {
  width: 1px;
  flex: 1;
  min-height: 50px;
  background: rgba(0,0,0,0.08);
  margin-top: 4px;
}

/* hide the line on the last nav item */
.nav-item:last-child .nav-line {
  display: none;
}

.nav-label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #ccc;
  padding-top: 1px;
  line-height: 1.2;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

/* active state */
.nav-item.active .nav-dot {
  background: #111;
  transform: scale(1.3);
}

.nav-item.active .nav-label {
  color: #111;
  font-weight: 700;
}

/* ============================================================
   INFO MODAL — right scroll content
   ============================================================ */

   #info-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 600px 20px;
    scroll-behavior: smooth;
  }

#info-content::-webkit-scrollbar {
  width: 3px;
}

#info-content::-webkit-scrollbar-thumb {
  background: #e0e0e0;
  border-radius: 2px;
}

.content-section {
  margin-bottom: 28px;
}

.content-section:last-child {
  margin-bottom: 0;
}

.content-label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #bbb;
  margin-bottom: 8px;
}

.content-section p,
.content-section ul {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.7;
  color: #444;
  margin: 0;
}

.content-section ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.content-section ul li::before {
  content: "—  ";
  color: #ccc;
}

.content-section strong {
  font-weight: 600;
  color: #111;
}

.content-section em {
  color: #999;
  font-style: italic;
}

.content-section a {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(0,0,0,0.2);
  transition: text-decoration-color 0.15s ease;
}

.content-section a:hover {
  text-decoration-color: rgba(0,0,0,0.7);
}

/* ============================================================
   BOTTOM TOOLBAR — filters + controls unified
   ============================================================ */

   #toolbar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 70;
  
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.14);
    border-radius: 999px;
    padding: 8px 12px;
  
    max-width: calc(100vw - 32px);
    pointer-events: auto;
  }
  
  /* filters row — no background, inherits toolbar */
  #filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    position: static;
    transform: none;
    backdrop-filter: none;
  }
  
  #filters .f {
    --filter-accent: #888888;
  
    border: 1.5px solid var(--filter-accent);
    background: transparent;
    color: var(--filter-accent);
    border-radius: 999px;
    padding: 5px 10px;
  
    font-family: "Inter", system-ui, sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
  
    cursor: pointer;
    user-select: none;
  
    transition:
      background 0.15s ease,
      color 0.15s ease,
      border-color 0.15s ease;
  }
  
  #filters .f:hover:not(.is-on) {
    background: color-mix(in srgb, var(--filter-accent) 14%, transparent);
  }
  
  #filters .f.is-on {
    background: var(--filter-accent);
    color: #ffffff;
    border-color: var(--filter-accent);
  }
  
  #filters .f.is-on:hover {
    filter: brightness(1.06);
  }
  
  /* divider between filters and controls */
  .toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(0,0,0,0.12);
    flex-shrink: 0;
  }
  
  /* controls — no border/background, inherits toolbar */
  #controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    position: static;
    transform: none;
  }
  
  #controls button {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.18);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 0;
    padding: 0;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s ease;
  }
  
  #controls button:hover {
    border-color: rgba(0,0,0,0.4);
  }
  
  #controls button:active {
    transform: translateY(1px);
  }
  
/* ============================================================
   PROJECT TITLE CHIP — anchored to hub dot on hover
   ============================================================ */

   #project-title {
    position: fixed;
    z-index: 60;
    pointer-events: none;
    display: none;
  
    font-family: "Inter", system-ui, sans-serif;
    font-size: clamp(11px, 1.2vw, 14px);
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.2;
  
    color: #000000;
    background: hsl(0, 0%, 75%);
    border: 1px solid #000000;
    border-radius: 10px;
  
    padding: 8px 14px;
    max-width: min(360px, calc(100vw - 32px));
    text-align: center;
  
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  }

/* ============================================================
   HOVER TOOLTIP — follows hovered dot
   ============================================================ */

   #tooltip.tooltip {
    position: fixed;
    z-index: 50;
    display: none;
    text-align: left;
    pointer-events: none;
    max-width: min(300px, calc(100vw - 24px));
    white-space: normal;
    word-wrap: break-word;
    --cat-accent: #6b7280;
    filter: drop-shadow(0 10px 28px rgba(0,0,0,0.14));
  }
  
  #tooltip.tooltip[style*="flex"] {
    animation: tooltipFadeIn 0.05s ease-out forwards;
  }
  
  @keyframes tooltipFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

/* ============================================================
   LABEL BUBBLES — shown on hover or when filter active
   ============================================================ */

#labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

#labels .tooltip {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  pointer-events: none;
  max-width: min(300px, calc(100vw - 24px));
  white-space: normal;
  word-wrap: break-word;
  --cat-accent: #6b7280;
  filter: drop-shadow(0 10px 28px rgba(0,0,0,0.14));
  opacity: 1;
}

/* ============================================================
   TOOLTIP ANATOMY — rail + inner
   ============================================================ */

.tooltip__rail {
  width: 5px;
  min-height: 100%;
  border-radius: 11px 0 0 11px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--cat-accent) 92%, #fff) 0%,
    var(--cat-accent) 100%
  );
  flex-shrink: 0;
}

.tooltip__inner {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 9px 12px 11px 11px;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  border: 1px solid color-mix(in srgb, var(--cat-accent) 42%, #d1d5db);
  border-left: none;
  border-radius: 0 11px 11px 0;
}

.tooltip__value {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 450;
  line-height: 1.4;
  color: #141414;
}

/* ============================================================
   TOOLTIP VARIANTS — unified anatomy, color does the work
   ============================================================ */

/* all types share the same shape — rail + inner */
/* rail color and border come from --cat-accent per type */

/* — Title — */
.tooltip--title .tooltip__rail {
  display: none;
}

.tooltip--title .tooltip__inner {
  border-radius: 10px;
  background: hsl(0, 0%, 75%);
  border: 1px solid #000000;
  padding: 6px 10px ;
  text-align: center;
}

.tooltip--title .tooltip__value {
  color: #000000;
  font-weight: 600;
  font-size: clamp(9px, 1.5vw, 13px);
  letter-spacing: 0.04em;
  line-height: 1.2;
}

#tooltip.tooltip.tooltip--title,
#labels .tooltip.tooltip--title {
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.12));
}

/* — Subtitle — */
#tooltip.tooltip.tooltip--subtitle,
#labels .tooltip.tooltip--subtitle {
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.12));
}

.tooltip--subtitle .tooltip__rail {
  display: none;
}

.tooltip--subtitle .tooltip__inner {
  border-radius: 10px;
  background: color-mix(in srgb, var(--cat-accent) 12%, #fff);
  border: 1px solid hsl(0, 0%, 50%);
  padding: 6px 10px ;
  text-align: center;
}

.tooltip--subtitle .tooltip__value {
  color: color-mix(in srgb, var(--cat-accent) 90%, #000);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

/* — Category — */
.tooltip--category .tooltip__rail {
  display: none;
}

.tooltip--category .tooltip__inner {
  border-radius: 10px;
  background: color-mix(in srgb, var(--cat-accent) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--cat-accent) 40%, #fff);
  padding: 8px 14px;
  text-align: center;
}

.tooltip--category .tooltip__value {
  color: color-mix(in srgb, var(--cat-accent) 90%, #000);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: -0.01em;
}

/* — Concept — */
.tooltip--concept .tooltip__rail {
  display: none;
}

.tooltip--concept .tooltip__inner {
  border-radius: 10px;
  background: color-mix(in srgb, var(--cat-accent) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--cat-accent) 40%, #fff);
  padding: 6px 10px;
  text-align: center;
}

.tooltip--concept .tooltip__value {
  color: color-mix(in srgb, var(--cat-accent) 90%, #000);
  font-weight: 400;
  font-style: italic;
  font-size: 11px;
  line-height: 1.45;
}

/* — Methods — */
.tooltip--methods .tooltip__rail {
  display: none;
}

.tooltip--methods .tooltip__inner {
  border-radius: 10px;
  background: color-mix(in srgb, var(--cat-accent) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--cat-accent) 40%, #fff);
  padding: 8px 14px;
  text-align: center;
}

.tooltip--methods .tooltip__value {
  color: color-mix(in srgb, var(--cat-accent) 90%, #000);
  font-weight: 400;
  font-style: italic;
  font-size: 11px;
  line-height: 1.45;
}

/* — Concept Text — */
.tooltip--concept-text .tooltip__rail {
  display: none;
}

.tooltip--concept-text .tooltip__inner {
  border-radius: 10px;
  background: color-mix(in srgb, var(--cat-accent) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--cat-accent) 40%, #fff);
  padding: 10px 14px;
  text-align: center;
  max-width: 260px;
}

.tooltip--concept-text .tooltip__value {
  color: color-mix(in srgb, var(--cat-accent) 90%, #000);
  font-weight: 300;
  font-style: italic;
  font-size: 11px;
  line-height: 1.55;
}

/* — Methods Text — */
.tooltip--methods-text .tooltip__rail {
  display: none;
}

.tooltip--methods-text .tooltip__inner {
  border-radius: 10px;
  background: color-mix(in srgb, var(--cat-accent) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--cat-accent) 40%, #fff);
  padding: 10px 14px;
  text-align: center;
  max-width: 260px;
}

.tooltip--methods-text .tooltip__value {
  color: color-mix(in srgb, var(--cat-accent) 90%, #000);
  font-weight: 300;
  font-style: italic;
  font-size: 11px;
  line-height: 1.55;
}

/* — Location & Scale — */
.tooltip--location .tooltip__rail,
.tooltip--scale .tooltip__rail {
  display: none;
}

.tooltip--location .tooltip__inner,
.tooltip--scale .tooltip__inner {
  border-radius: 10px;
  background: color-mix(in srgb, var(--cat-accent) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--cat-accent) 40%, #fff);
  padding: 8px 14px;
  text-align: center;
}

.tooltip--location .tooltip__value,
.tooltip--scale .tooltip__value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: color-mix(in srgb, var(--cat-accent) 90%, #000);
  font-size: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ============================================================
   CONNECTOR LINES — label to dot
   ============================================================ */

   #connectors line {
    stroke: rgba(0,0,0,0.15);
    stroke-width: 1;
  }

/* ============================================================
  CONNECTOR SVG LINES — fade in
  ============================================================ */

#connectors line {
  stroke: rgba(0,0,0,0.15);
  stroke-width: 1;
  animation: lineFadeIn 0.05s ease-out forwards;
}

@keyframes lineFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
 Mobile 
  ============================================================ */
  @media (max-width: 600px) {

    #viz-header {
      width: calc(100% - 32px);
      text-align: center;
    }
  
    #viz-title {
      font-size: 11px;
      letter-spacing: 0.05em;
      white-space: nowrap;
    }
  
    #viz-subtitle {
      font-size: 9px;
    }
  
    #btn-info {
      width: 16px;
      height: 16px;
      font-size: 11px;
    }
  
    #toolbar {
      bottom: 8px;
      left: 50%;
      transform: translateX(-50%);
      width: calc(100vw - 16px);
      max-width: calc(100vw - 16px);
      padding: 8px 10px;
      gap: 6px;
      flex-wrap: wrap;
      justify-content: center;
      border-radius: 16px;
      overflow: visible;
    }
  
    #filters {
      flex-wrap: wrap;
      justify-content: center;
      gap: 5px;
    }
  
    #filters .f {
      font-size: 10px;
      padding: 4px 8px;
    }
  
    .toolbar-divider {
      width: 100%;
      height: 1px;
      margin: 2px 0;
    }
  
    #controls {
      width: 100%;
      justify-content: center;
    }
  }