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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0f1117;
  font-family: system-ui, sans-serif;
}

#site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  padding: 0.6rem 1rem;
  pointer-events: none;
}

.site-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0e8ff;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

#map {
  width: 100vw;
  height: 100vh;
  display: block;
}

/* ── Focus ring ─────────────────────────────────────── */
.node-group:focus {
  outline: none;
}
.node-group:focus .focus-ring {
  display: block;
}
.focus-ring {
  display: none;
}

/* ── Tool panel ─────────────────────────────────────── */
#tool-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: #13161f;
  border-left: 1px solid #252b3d;
  z-index: 100;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  padding: 2rem 1.5rem 2rem;
  color: #c8d0e8;
  line-height: 1.65;
  font-size: 0.9rem;
}

#tool-panel.open {
  transform: translateX(0);
}

#panel-close {
  position: absolute;
  top: 0.9rem;
  right: 1rem;
  background: none;
  border: none;
  color: #505878;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  line-height: 1;
}

#panel-close:hover,
#panel-close:focus {
  color: #c8d0e8;
  background: #1e2538;
  outline: 2px solid #4a6adc;
  outline-offset: 2px;
}

#panel-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #e0e8ff;
  padding-right: 2rem;
  margin-bottom: 0.4rem;
  word-break: break-word;
}

#panel-meta {
  font-size: 0.8rem;
  color: #505878;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #1e2538;
}

#panel-meta a {
  color: #5a8adc;
  text-decoration: none;
}

#panel-meta a:hover {
  text-decoration: underline;
}

/* Rendered markdown body */
.panel-edit-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  color: #5a8adc;
  border: 1px solid #252b3d;
  border-radius: 3px;
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s;
}

.panel-edit-link:hover,
.panel-edit-link:focus {
  background: #1e2538;
  border-color: #3a4a7a;
  outline: 2px solid #4a6adc;
  outline-offset: 2px;
  text-decoration: none;
}

#panel-body h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #505878;
  margin: 1.4rem 0 0.4rem;
}

#panel-body h2:first-child {
  margin-top: 0;
}

#panel-body p {
  color: #9aa4c4;
  margin-bottom: 0.6rem;
}

#panel-body a {
  color: #5a8adc;
  text-decoration: none;
}

#panel-body a:hover {
  text-decoration: underline;
}

#panel-body ul {
  padding-left: 1.2rem;
  color: #9aa4c4;
}

#panel-body li {
  margin-bottom: 0.25rem;
}

/* ── Tooltip ────────────────────────────────────────── */
.node-tooltip {
  position: fixed;
  background: #1e2130;
  color: #e0e6f0;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid #3a4060;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Screen-reader only ─────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
