/* Shellhex services treemap — ported from samples/shellhex_services_treemap.html */

body.treemap-page {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body.treemap-page main.treemap-page__main {
  --shellhex-green: #39ff88;
  --shellhex-green-soft: #8cffbd;
  --shellhex-green-dim: #1f8f53;
  --shellhex-ink: #e8fff0;
  --shellhex-muted: #a6c7b2;
  --shellhex-black: #030806;

  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  text-align: left;
  width: 100%;
  max-width: none;
  padding: 3.5rem 0 0;
  min-height: calc(100vh - 3.5rem);
  height: auto;
  max-height: none;
  overflow: visible;
  background:
    radial-gradient(circle at 20% 10%, rgba(57, 255, 136, 0.08), transparent 28%),
    radial-gradient(circle at 80% 70%, rgba(57, 255, 136, 0.04), transparent 36%),
    linear-gradient(180deg, #010302 0%, #030806 100%);
  color: #e8fff0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.treemap-page__main::before {
  content: "";
  position: absolute;
  inset: 3.5rem 0 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0px,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: overlay;
  opacity: 0.18;
  z-index: 10;
}

.treemap-shell {
  --shellhex-black: #030806;
  --shellhex-panel: #07100c;
  --shellhex-panel-2: #0b1711;
  --shellhex-green: #39ff88;
  --shellhex-green-soft: #8cffbd;
  --shellhex-green-dim: #1f8f53;
  --shellhex-ink: #e8fff0;
  --shellhex-muted: #a6c7b2;
  --systems: #06b6d4;
  --testing: #ef4444;
  --leadership: #a855f7;

  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  flex: 1 1 auto;
  min-height: calc(100vh - 5rem);
  height: auto;
  padding: 18px;
  box-sizing: border-box;
}

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

.treemap-topbar {
  border: 1px solid rgba(57, 255, 136, 0.65);
  background: linear-gradient(180deg, rgba(7, 16, 12, 0.96), rgba(3, 8, 6, 0.96));
  box-shadow: 0 0 24px rgba(57, 255, 136, 0.12), inset 0 0 18px rgba(57, 255, 136, 0.04);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 72px;
}

.treemap-brand {
  line-height: 1;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.treemap-brand .prompt {
  color: var(--shellhex-green);
  text-shadow: 0 0 8px rgba(57, 255, 136, 0.55);
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 800;
}

.treemap-brand .sub {
  color: var(--shellhex-muted);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 7px;
}

.treemap-pathbar {
  min-width: 0;
}

.treemap-path-title {
  color: var(--shellhex-green-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 7px;
}

.treemap-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: clamp(13px, 1.35vw, 18px);
  color: var(--shellhex-ink);
  overflow: hidden;
}

.treemap-crumb {
  border: 1px solid rgba(57, 255, 136, 0.35);
  background: rgba(57, 255, 136, 0.055);
  color: var(--shellhex-ink);
  padding: 5px 8px;
  cursor: pointer;
  user-select: none;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.treemap-crumb:hover,
.treemap-crumb:focus-visible {
  outline: none;
  transform: translateY(-1px);
  color: var(--shellhex-black);
  background: var(--shellhex-green);
  border-color: var(--shellhex-green);
}

.treemap-separator {
  color: var(--shellhex-green-dim);
}

.treemap-controls {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.treemap-shell button {
  font: inherit;
  color: var(--shellhex-green-soft);
  background: #05110b;
  border: 1px solid rgba(57, 255, 136, 0.55);
  padding: 9px 12px;
  cursor: pointer;
  box-shadow: inset 0 0 10px rgba(57, 255, 136, 0.05);
  transition: transform 120ms ease, border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.treemap-shell button:hover:not(:disabled),
.treemap-shell button:focus-visible:not(:disabled) {
  outline: none;
  transform: translateY(-1px);
  color: var(--shellhex-black);
  background: var(--shellhex-green);
  border-color: var(--shellhex-green);
}

.treemap-shell button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.treemap-hintbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--shellhex-muted);
  font-size: 12px;
  line-height: 1.45;
  padding: 0 2px;
}

.treemap-hintbar strong {
  color: var(--shellhex-green-soft);
  font-weight: 700;
}

.treemap-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.treemap-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.treemap-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.08);
}

.treemap-viz-frame {
  position: relative;
  min-height: calc(100vh - 17rem);
  height: calc(100vh - 17rem);
  border: 1px solid rgba(57, 255, 136, 0.45);
  background:
    linear-gradient(rgba(57, 255, 136, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 136, 0.035) 1px, transparent 1px),
    rgba(2, 7, 5, 0.94);
  background-size: 28px 28px;
  box-shadow: 0 0 30px rgba(57, 255, 136, 0.12), inset 0 0 30px rgba(57, 255, 136, 0.035);
  overflow: hidden;
}

.treemap-viz-frame svg {
  display: block;
  width: 100%;
  height: 100%;
}

.treemap-node rect.tile {
  stroke-width: 1px;
  shape-rendering: crispEdges;
  transition: stroke 100ms ease, fill 100ms ease, stroke-width 100ms ease;
}

/* Terminal-style tiles: dark glass fill + branch border (consistent per branch) */
.treemap-node--security rect.tile {
  fill: rgba(0, 0, 0, 0.42);
  stroke: rgba(239, 68, 68, 0.55);
}

.treemap-node--systems rect.tile {
  fill: rgba(0, 0, 0, 0.42);
  stroke: rgba(6, 182, 212, 0.55);
}

.treemap-node--leadership rect.tile {
  fill: rgba(0, 0, 0, 0.42);
  stroke: rgba(168, 85, 247, 0.55);
}

.treemap-node--services rect.tile {
  fill: rgba(0, 0, 0, 0.42);
  stroke: rgba(110, 255, 161, 0.5);
}

.treemap-node.clickable {
  cursor: pointer;
}

.treemap-node--security.clickable:hover rect.tile,
.treemap-node--security.clickable:focus-visible rect.tile {
  fill: rgba(239, 68, 68, 0.1);
  stroke: #ef4444;
  stroke-width: 2px;
}

.treemap-node--systems.clickable:hover rect.tile,
.treemap-node--systems.clickable:focus-visible rect.tile {
  fill: rgba(6, 182, 212, 0.1);
  stroke: #06b6d4;
  stroke-width: 2px;
}

.treemap-node--leadership.clickable:hover rect.tile,
.treemap-node--leadership.clickable:focus-visible rect.tile {
  fill: rgba(168, 85, 247, 0.1);
  stroke: #a855f7;
  stroke-width: 2px;
}

.treemap-node--services.clickable:hover rect.tile,
.treemap-node--services.clickable:focus-visible rect.tile {
  fill: rgba(110, 255, 161, 0.1);
  stroke: #6effa1;
  stroke-width: 2px;
}

.treemap-node text {
  pointer-events: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.treemap-node text.label {
  dominant-baseline: hanging;
}

/* Branch text — matches site terminal-box colour ramps */
.treemap-node--security .terminal {
  fill: #fca5a5;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 0 4px rgba(239, 68, 68, 0.35);
}

.treemap-node--security .kicker,
.treemap-node--security .micro,
.treemap-node--security .tagline {
  fill: #fecaca;
  font-weight: 500;
}

.treemap-node--security .kicker {
  font-weight: 600;
}

.treemap-node--systems .terminal {
  fill: #67e8f9;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 0 4px rgba(6, 182, 212, 0.35);
}

.treemap-node--systems .kicker,
.treemap-node--systems .micro,
.treemap-node--systems .tagline {
  fill: #a5f3fc;
  font-weight: 500;
}

.treemap-node--systems .kicker {
  font-weight: 600;
}

.treemap-node--leadership .terminal {
  fill: #d8b4fe;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 0 4px rgba(168, 85, 247, 0.35);
}

.treemap-node--leadership .kicker,
.treemap-node--leadership .micro,
.treemap-node--leadership .tagline {
  fill: #e9d5ff;
  font-weight: 500;
}

.treemap-node--leadership .kicker {
  font-weight: 600;
}

.treemap-node--services .terminal {
  fill: #6effa1;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 0 4px rgba(110, 255, 161, 0.35);
}

.treemap-node--services .kicker,
.treemap-node--services .micro,
.treemap-node--services .tagline {
  fill: rgba(110, 255, 161, 0.92);
  font-weight: 500;
}

.treemap-node--services .kicker {
  font-weight: 600;
}

.treemap-tooltip__desc {
  color: var(--shellhex-ink);
  margin: 6px 0;
  line-height: 1.5;
}

.treemap-empty-message {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--shellhex-muted);
  padding: 30px;
}

.treemap-empty-message strong {
  color: var(--shellhex-green-soft);
}

.treemap-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: rgba(166, 199, 178, 0.78);
  font-size: 11px;
  padding: 0 2px;
}

.treemap-footer .sig {
  color: var(--shellhex-green-dim);
}

.treemap-tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid rgba(57, 255, 136, 0.65);
  background: rgba(3, 8, 6, 0.96);
  color: var(--shellhex-ink);
  box-shadow: 0 0 18px rgba(57, 255, 136, 0.16);
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 14px));
  transition: opacity 90ms ease;
}

.treemap-tooltip .name {
  color: var(--shellhex-green-soft);
  font-weight: 800;
  margin-bottom: 4px;
}

.treemap-tooltip .path {
  color: var(--shellhex-muted);
}

@media (max-width: 820px) {
  .treemap-shell {
    padding: 6px;
    gap: 6px;
    min-height: calc(100dvh - 4rem);
  }

  .treemap-topbar {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: start;
    padding: 8px 10px;
    min-height: 0;
  }

  .treemap-brand .sub {
    margin-top: 3px;
  }

  .treemap-path-title {
    margin-bottom: 4px;
  }

  .treemap-breadcrumbs {
    gap: 4px;
  }

  .treemap-crumb {
    padding: 3px 6px;
  }

  .treemap-controls {
    justify-content: flex-start;
    gap: 6px;
  }

  .treemap-shell button {
    padding: 6px 8px;
  }

  .treemap-hintbar {
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    line-height: 1.35;
    padding: 0;
  }

  .treemap-legend {
    justify-content: flex-start;
    gap: 8px;
  }

  .treemap-footer {
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    padding: 0;
  }

  /* Floor height; JS may grow this so tile descriptions fit */
  .treemap-viz-frame {
    min-height: calc(100dvh - 14rem);
    height: calc(100dvh - 14rem);
  }

  /* Hover tooltips are disabled in JS on small screens; hide as a hard fallback */
  .treemap-tooltip {
    display: none !important;
  }
}
