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

:root {
  --bg: #0a0c10;
  --bg-deep: #06080b;
  --surface: rgba(12, 16, 22, 0.88);
  --surface-strong: rgba(8, 12, 18, 0.95);
  --border: rgba(0, 229, 255, 0.22);
  --border-gold: rgba(201, 162, 39, 0.45);
  --text: #f5f5f5;
  --muted: rgba(245, 245, 245, 0.62);
  --cyan: #00e5ff;
  --cyan-dim: rgba(0, 229, 255, 0.12);
  --gold: #c9a227;
  --gold-bright: #ffd700;
  --glow-cyan: 0 0 12px rgba(0, 229, 255, 0.35);
  --glow-gold: 0 0 14px rgba(201, 162, 39, 0.4);
  --font-ui: "Inter", system-ui, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --contact-h: 3.25rem;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 45%, rgba(0, 229, 255, 0.07), transparent 60%),
    radial-gradient(circle at 50% 50%, #111820 0%, var(--bg-deep) 72%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.18;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, rgba(0, 229, 255, 0.05), transparent 65%);
}

.graph {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.node-labels {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.node-tag {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  will-change: transform, opacity;
}

.node-tag-glyph {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  background: rgba(8, 12, 18, 0.82);
  backdrop-filter: blur(8px);
  box-shadow: var(--glow-cyan);
}

.node-tag--core .node-tag-glyph {
  color: var(--gold-bright);
  border-color: var(--border-gold);
  box-shadow: var(--glow-gold), var(--glow-cyan);
}

.node-tag--standard .node-tag-glyph {
  color: var(--cyan);
}

.node-tag-name {
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 18, 0.78);
  backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.15);
}

.node-tag--core .node-tag-name {
  color: var(--gold-bright);
  border-color: rgba(201, 162, 39, 0.35);
}

.node-tag::after {
  content: "";
  width: 1px;
  height: 18px;
  background: linear-gradient(to bottom, rgba(0, 229, 255, 0.6), transparent);
}

.node-tag--core::after {
  background: linear-gradient(to bottom, rgba(255, 215, 0, 0.55), transparent);
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 0;
  pointer-events: none;
}

.brand-stack {
  pointer-events: auto;
}

.brand-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(10px);
  box-shadow: var(--glow-cyan);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-tagline {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  pointer-events: auto;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(0, 229, 255, 0.15);
  border-radius: 999px;
  background: rgba(8, 12, 18, 0.75);
  backdrop-filter: blur(8px);
  max-width: min(520px, calc(100vw - 2rem));
}

.breadcrumb button {
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 0.15rem 0.25rem;
}

.breadcrumb button:hover {
  color: var(--gold-bright);
}

.breadcrumb-sep {
  color: var(--muted);
  font-size: 10px;
  opacity: 0.5;
}

.expand-panel {
  position: fixed;
  left: 50%;
  bottom: calc(var(--contact-h) + 0.75rem);
  z-index: 15;
  width: min(520px, calc(100vw - 1.5rem));
  transform: translate(-50%, 110%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.expand-panel.is-open {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.expand-panel-inner {
  position: relative;
  padding: 1.25rem 1.2rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-strong);
  backdrop-filter: blur(14px);
  box-shadow: var(--glow-cyan);
}

.expand-panel-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1rem;
  right: 1rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  border-radius: 2px;
}

.expand-close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.expand-close:hover {
  color: var(--cyan);
}

.expand-level,
.modal-level {
  margin: 0 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
}

#expand-title {
  margin: 0 1.5rem 0.6rem 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--gold-bright);
  letter-spacing: 0.05em;
}

#expand-body {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 13px;
}

.expand-profile {
  margin-bottom: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  background: rgba(201, 162, 39, 0.06);
}

.expand-profile-name {
  margin: 0 0 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--gold-bright);
}

.expand-profile-title {
  margin: 0 0 0.5rem;
  font-size: 12px;
  color: var(--muted);
}

.expand-children-label {
  margin: 0 0 0.45rem;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.expand-children {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.expand-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: rgba(0, 229, 255, 0.06);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.expand-chip:hover {
  border-color: rgba(0, 229, 255, 0.55);
  color: var(--cyan);
  background: var(--cyan-dim);
}

.expand-chip--leaf {
  border-color: rgba(201, 162, 39, 0.35);
}

.contact-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-height: var(--contact-h);
  padding: 0.45rem 1rem;
  border-top: 1px solid rgba(0, 229, 255, 0.15);
  background: rgba(6, 8, 11, 0.88);
  backdrop-filter: blur(12px);
}

.contact-bar a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.contact-bar a:hover {
  border-color: rgba(0, 229, 255, 0.5);
  color: var(--cyan);
  box-shadow: var(--glow-cyan);
}

.contact-bar a.contact-primary {
  border-color: var(--border-gold);
  color: var(--gold-bright);
}

.hint-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--contact-h) + 1rem);
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.55rem 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  transform: translateX(-50%);
  box-shadow: var(--glow-cyan);
  animation: hint-in 0.4s ease;
}

.hint-toast button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.hint-toast button:hover {
  color: var(--cyan);
}

@keyframes hint-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.modal--leaf::backdrop {
  background: rgba(4, 6, 10, 0.78);
  backdrop-filter: blur(4px);
}

.modal-parent {
  margin: 0.85rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(0, 229, 255, 0.12);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.modal-parent button {
  border: 0;
  background: transparent;
  color: var(--cyan);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.modal-parent button:hover {
  color: var(--gold-bright);
}

body.modal-open .overlay,
body.modal-open .contact-bar {
  filter: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-gold);
  box-shadow: var(--glow-gold);
}

.brand-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--gold-bright);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.45);
}

.search-wrap {
  position: relative;
  width: min(440px, calc(100vw - 2rem));
  pointer-events: auto;
}

#node-search {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2300e5ff' stroke-width='1.5' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.85rem center;
}

#node-search:focus {
  border-color: rgba(0, 229, 255, 0.55);
  box-shadow: var(--glow-cyan), inset 0 0 0 1px rgba(0, 229, 255, 0.12);
}

#node-search::placeholder {
  color: var(--muted);
}

.search-results {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.3rem 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  backdrop-filter: blur(12px);
  box-shadow: var(--glow-cyan);
  max-height: 220px;
  overflow-y: auto;
}

.search-results li {
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  transition: background 0.15s ease, color 0.15s ease;
}

.search-results li:hover,
.search-results li[aria-selected="true"] {
  background: var(--cyan-dim);
  color: var(--cyan);
}

.tooltip {
  position: fixed;
  z-index: 20;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--glow-cyan);
  transform: translate(-50%, calc(-100% - 12px));
}

.modal {
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  padding: 0;
  max-width: min(540px, calc(100vw - 2rem));
  background: var(--surface-strong);
  color: var(--text);
  backdrop-filter: blur(14px);
  box-shadow: var(--glow-gold), var(--glow-cyan);
  animation: modal-in 0.25s ease;
}

.modal::backdrop {
  background: rgba(4, 6, 10, 0.78);
  backdrop-filter: blur(4px);
}

.modal-inner {
  position: relative;
  padding: 1.6rem 1.35rem 1.3rem;
  border-top: 2px solid rgba(0, 229, 255, 0.35);
}

.modal-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.35rem;
  right: 1.35rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.6;
}

.modal-close {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.modal-close:hover {
  color: var(--cyan);
  border-color: var(--border);
}

#modal-title {
  margin: 0 2rem 0.85rem 0;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  text-shadow: var(--glow-gold);
}

#modal-body {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  white-space: pre-wrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 480px) {
  .brand-title {
    font-size: 10px;
    letter-spacing: 0.16em;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .expand-panel {
    width: calc(100vw - 1rem);
  }

  .contact-bar a {
    font-size: 10px;
    padding: 0.35rem 0.55rem;
  }
}
