:root {
  color-scheme: dark;
  --bg: #050812;
  --bg-rgb: 5, 8, 18;
  --surface: rgba(15, 23, 42, .72);
  --surface-strong: rgba(15, 23, 42, .92);
  --border: rgba(132, 148, 186, .19);
  --border-strong: rgba(150, 166, 205, .32);
  --text: #edf2ff;
  --muted: #9ba7c4;
  --quiet: #65708f;
  --personal: #8b7cff;
  --personal-2: #4de7c2;
  --organization: #ffb86b;
  --organization-2: #5ec8ff;
  --shared: #d582ff;
  --success: #73e6a4;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f5f7fc;
    --bg-rgb: 245, 247, 252;
    --surface: rgba(255, 255, 255, .74);
    --surface-strong: rgba(255, 255, 255, .94);
    --border: rgba(45, 61, 91, .16);
    --border-strong: rgba(45, 61, 91, .28);
    --text: #11182b;
    --muted: #56617b;
    --quiet: #8993a8;
    --personal: #6657e8;
    --personal-2: #008e79;
    --organization: #c66b16;
    --organization-2: #1d7fbc;
    --shared: #9846c6;
    --success: #13864b;
  }

}

:root[data-profile-variant="organization"] {
  --personal: var(--organization);
  --personal-2: var(--organization-2);
}

* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background:
  radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--personal) 10%, transparent), transparent 34rem),
  radial-gradient(circle at 84% 72%, color-mix(in srgb, var(--organization) 8%, transparent), transparent 38rem),
  var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}

button, a {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.mono {
  font-family: var(--mono);
}

.shell {
  width: 100vw;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto auto auto;
  position: relative;
  isolation: isolate;
}

/* These bars stay in normal document flow;
backdrop filters add a needless compositing layer. */
.topbar, .footer {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 20;
  background: rgba(var(--bg-rgb), .58);
}

.topbar {
  justify-content: space-between;
  padding: 0 clamp(18px, 3vw, 48px);
  border-bottom: 1px solid var(--border);
}

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
}

.identity-mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  position: relative;
  border: 1px solid color-mix(in srgb, var(--personal) 62%, transparent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--personal) 24%, transparent);
}

.identity-mark::before, .identity-mark::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  inset: 6px;
  border: 1px solid var(--personal-2);
}

.identity-mark::after {
  inset: 11px;
  background: var(--personal-2);
  border: 0;
}

.identity b {
  display: block;
  font: 650 12px/1 var(--mono);
  letter-spacing: .2em;
}

.identity small {
  display: block;
  margin-top: 6px;
  color: var(--quiet);
  font: 9px/1 var(--mono);
  letter-spacing: .16em;
}

.view-switch {
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 15px;
}

.segmented {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 8px 13px;
  border-radius: 10px;
  color: var(--quiet);
  font: 10px/1 var(--mono);
  letter-spacing: .08em;
  transition: color .2s ease, background .2s ease, box-shadow .2s ease;
}

.segmented:hover {
  color: var(--text);
}

.segmented.is-active {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  box-shadow: inset 0 0 0 1px var(--border);
}

.actions {
  min-width: 230px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.quiet-button, .icon-button {
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border .2s ease, background .2s ease, transform .2s ease;
}

.quiet-button:hover, .icon-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
}

.quiet-button:active, .icon-button:active {
  transform: scale(.96);
}

.quiet-button {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--muted);
  font: 9px/1 var(--mono);
  letter-spacing: .08em;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.stage.has-hover {
  cursor: pointer;
}

.stage.is-dragging {
  cursor: grabbing;
}

#gl-canvas, #label-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#gl-canvas {
  z-index: 1;
}

#label-canvas {
  z-index: 2;
  pointer-events: none;
}

.stage-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 48%, rgba(var(--bg-rgb), .25) 78%, rgba(var(--bg-rgb), .72) 108%);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
  linear-gradient(to right, color-mix(in srgb, var(--quiet) 8%, transparent) 1px, transparent 1px),
  linear-gradient(to bottom, color-mix(in srgb, var(--quiet) 8%, transparent) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse, black 25%, transparent 78%);
}

.intro {
  position: absolute;
  left: clamp(20px, 4vw, 64px);
  top: clamp(24px, 6vh, 72px);
  z-index: 6;
  width: min(430px, calc(100vw - 40px));
  pointer-events: none;
  transition: opacity .5s ease, transform .5s ease;
}

.intro.is-muted {
  opacity: .13;
  transform: translateY(-8px);
}

.eyebrow {
  display: block;
  color: var(--personal-2);
  font: 9px/1.4 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 17px 0 15px;
  font-size: clamp(34px, 4vw, 61px);
  line-height: .96;
  letter-spacing: -.055em;
  font-weight: 590;
}

.intro h1 em {
  color: transparent;
  font-style: normal;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--text) 72%, transparent);
}

.intro p {
  max-width: 400px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.field-meta {
  position: absolute;
  z-index: 6;
  top: 24px;
  right: 26px;
  display: flex;
  gap: 24px;
  color: var(--quiet);
  font-size: 8px;
  letter-spacing: .15em;
  pointer-events: none;
}

.gesture-hint {
  position: absolute;
  z-index: 6;
  bottom: 21px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--quiet);
  font-size: 8px;
  letter-spacing: .14em;
  white-space: nowrap;
  opacity: .75;
  pointer-events: none;
  transition: opacity .5s ease;
}

.gesture-hint.is-hidden {
  opacity: 0;
}

.detail-panel {
  position: absolute;
  /* The fixed inspector must clear header/footer chrome at narrow viewport edges. */
  z-index: 30;
  right: 24px;
  top: 24px;
  bottom: 24px;
  width: min(385px, calc(100vw - 48px));
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 30px;
  background: var(--surface-strong);
  backdrop-filter: blur(30px) saturate(1.15);
  box-shadow: 0 28px 100px rgba(0,0,0,.28);
  overflow: auto;
  transform: translateX(calc(100% + 50px));
  opacity: 0;
  pointer-events: none;
  transition: transform .42s cubic-bezier(.2,.78,.2,1), opacity .3s ease;
}

.detail-panel.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.panel-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.detail-kind {
  color: var(--personal-2);
  font-size: 9px;
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-top: 14px;
}

.detail-panel h2 {
  margin: 17px 42px 12px 0;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}

.detail-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0;
}

.detail-tags span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--quiet);
  font: 8px/1 var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
}

.detail-panel ul {
  list-style: none;
  padding: 0;
  margin: 22px 0;
  border-top: 1px solid var(--border);
}

.detail-panel li {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.detail-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 7px;
  color: var(--text);
  font: 10px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.detail-link[hidden] {
  display: none;
}

.detail-link span {
  color: var(--personal-2);
}

.footer {
  justify-content: space-between;
  padding: 0 clamp(18px, 3vw, 48px);
  border-top: 1px solid var(--border);
  color: var(--quiet);
  font-size: 8px;
  letter-spacing: .12em;
}

.metrics, .footer-links {
  display: flex;
  gap: clamp(12px, 2.2vw, 30px);
  align-items: center;
}

.metrics b {
  color: var(--text);
  font-weight: 500;
}

.footer-links a {
  transition: color .2s ease;
}

.footer-links a:hover {
  color: var(--text);
}

noscript {
  position: fixed;
  inset: auto 1rem 1rem;
  z-index: 100;
  padding: 1rem;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

@media (max-width: 820px) {
  .shell {
    grid-template-rows: 62px minmax(0, 1fr) 46px;
  }

  .identity {
    min-width: 0;
  }

  .identity small, .quiet-button span:not(.status-dot) {
    display: none;
  }

  .actions {
    min-width: 0;
  }

  .view-switch {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .segmented {
    padding: 8px 9px;
    font-size: 8px;
  }

  .intro {
    top: 24px;
    width: min(340px, calc(100vw - 40px));
  }

  .intro p {
    display: none;
  }

  .field-meta {
    display: none;
  }

  .footer-links {
    gap: 14px;
  }

  .metrics span:nth-child(n+3) {
    display: none;
  }

}

@media (max-width: 520px) {
  .topbar {
    padding: 0 12px;
  }

  .identity b {
    font-size: 10px;
  }

  .identity-mark {
    width: 21px;
    height: 21px;
  }

  .actions .icon-button:first-of-type {
    display: none;
  }

  .footer {
    padding: 0 14px;
  }

  .footer-links a:not(:last-child) {
    display: none;
  }

  .gesture-hint {
    font-size: 7px;
  }

}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }

}

/* The overview follows the approved composition;
narrow screens use semantic reflow
because shrinking long package labels makes a graph unreadable. */
.topbar {
  min-height: 72px;
  flex-wrap: wrap;
  gap: 12px;
  padding-block: 12px;
}

.stage {
  height: min(80dvh, 1100px);
  min-height: 380px;
}

.stage.profile-mode {
  height: auto;
  min-height: 0;
  touch-action: auto;
  cursor: auto;
  overflow: visible;
}

#profile-view {
  max-width: 1800px;
  margin: 0 auto;
}

#profile-view svg {
  display: block;
  width: 100%;
  height: auto;
}

#profile-view text {
  font-family: var(--sans);
}

#profile-view .mono {
  font-family: var(--mono);
}

#profile-view .rotate {
  animation: orbit 58s linear infinite;
  transform-origin: 0 0;
}

#profile-view .reverse {
  animation-direction: reverse;
}

#profile-view .fast {
  animation-duration: 12s;
}

#profile-view .flow {
  stroke-dasharray: 3 21;
  animation: flow 22s linear infinite;
}

#profile-view .pulse {
  animation: pulse 6s ease-in-out infinite;
}

#profile-view .scan {
  animation-duration: 24s;
}

#profile-view .signal {
  animation: signal 3.6s ease-in-out infinite;
}

@keyframes signal {
  0%, 100% {
    opacity: .18;
  }

  45% {
    opacity: 1;
  }

}

#profile-view .icon-signal {
  animation: icon-signal 5.4s ease-in-out infinite;
}

#profile-view .icon-signal-phase-1 {
  animation-delay: -1.8s;
}

#profile-view .icon-signal-phase-2 {
  animation-delay: -3.6s;
}

@keyframes icon-signal {
  0%, 100% {
    opacity: .35;
  }

  45% {
    opacity: 1;
  }

}

#profile-view [data-node-id][role="button"] {
  cursor: pointer;
}

#profile-view .is-filtered {
  opacity: .12;
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }

}

@keyframes flow {
  to {
    stroke-dashoffset: -240;
  }

}

@keyframes pulse {
  0%,100% {
    opacity: .25;
  }

  50% {
    opacity: .85;
  }

}

.motion-paused *, .motion-paused *::before, .motion-paused *::after {
  animation-play-state: paused !important;
  transition: none !important;
}

.detail-panel {
  position: fixed;
  top: 90px;
  bottom: 24px;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--personal-2);
  outline-offset: 4px;
}

.semantic-profile {
  margin: 20px clamp(18px, 3vw, 48px);
}

.semantic-profile summary {
  cursor: pointer;
  font-family: var(--mono);
}

#node-list {
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(260px,1fr));
  gap: 16px;
}

#node-list li {
  border-bottom: 1px solid var(--border);
  padding-block: 12px;
  min-width: 0;
}

#node-list button {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  overflow-wrap: anywhere;
}

#node-list p, #profile-context p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

#node-list small {
  color: var(--personal-2);
}

#profile-context {
  line-height: 1.6;
}

.footer {
  min-height: 60px;
  flex-wrap: wrap;
  gap: 16px;
  padding-block: 18px;
}

.history-label {
  color: var(--muted);
  font: 10px var(--mono);
}

#history-select {
  display: block;
  max-width: 170px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
}

@media (max-width: 1000px) {
  .topbar {
    justify-content: center;
  }

  .actions {
    min-width: 0;
    flex-wrap: wrap;
  }

  .view-switch {
    position: static;
    transform: none;
  }

  .shell {
    grid-template-rows: auto auto auto auto;
  }

}

@media (max-width: 700px) {
  #profile-view {
    display: none;
  }

  .stage.profile-mode {
    min-height: 0;
  }

  .semantic-profile {
    margin-block: 24px;
  }

  #node-list {
    grid-template-columns: 1fr;
  }

  .field-meta {
    display: none;
  }

  .detail-panel {
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: calc(100vw - 32px);
  }

  .footer-links a, .identity small {
    display: block !important;
  }

  .metrics {
    flex-wrap: wrap;
  }

  .metrics span {
    display: block !important;
  }

}

@media (prefers-reduced-motion: reduce) {
  #profile-view .rotate, #profile-view .flow, #profile-view .pulse, #profile-view .signal,
  #profile-view .icon-signal {
    animation: none !important;
  }

}

#mobile-identity {
  display: none;
}

@media (max-width: 700px) {
  #mobile-identity {
    display: block;
    line-height: 1.6;
  }

}

#data-status {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

#profile-context a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
