/*
  Prototype page styles. Editorial frame around four candidate visualizations.
  Layers on top of tokens.css + base.css + microsite.css.
*/

.proto-header {
  padding: var(--sp-10) 0 var(--sp-6);
  border-bottom: 1px solid var(--rule);
}

.proto-header__eyebrow {
  margin-bottom: var(--sp-4);
}

.proto-header__title {
  font-family: var(--font-display);
  font-size: var(--fs-display-lg);
  line-height: var(--lh-tight);
  letter-spacing: var(--letter-tight);
  font-weight: 400;
  margin-bottom: var(--sp-5);
  max-width: 22ch;
}

.proto-header__dek {
  color: var(--text-muted);
  font-size: var(--fs-body-lg);
  line-height: var(--lh-relaxed);
  max-width: 64ch;
}

.view-toggle {
  display: inline-flex;
  margin-top: var(--sp-6);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.04);
}

.view-toggle button {
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: var(--letter-snug);
  font-family: var(--font-body);
  cursor: pointer;
  transition: background var(--dur-quick) var(--ease-out), color var(--dur-quick) var(--ease-out);
  border-right: 1px solid var(--rule);
}

.view-toggle button:last-child {
  border-right: none;
}

.view-toggle button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}

.view-toggle button:not([aria-pressed="true"]):hover {
  color: var(--text);
  background: var(--bg-sunken);
}

.view-toggle__label {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-caption);
  letter-spacing: var(--letter-caps);
  text-transform: uppercase;
  color: var(--text-subtle);
  border-right: 1px solid var(--rule);
  display: flex;
  align-items: center;
}

.proto {
  padding: var(--sp-9) 0;
  border-bottom: 1px solid var(--rule);
}

.proto__head {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
  align-items: baseline;
}

.proto__num {
  font-family: var(--font-display);
  font-size: var(--fs-display-md);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.proto__title {
  font-family: var(--font-display);
  font-size: var(--fs-display-md);
  line-height: var(--lh-tight);
  letter-spacing: var(--letter-tight);
  font-weight: 400;
  margin-bottom: var(--sp-3);
}

.proto__dek {
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
  font-size: var(--fs-body);
  max-width: 72ch;
}

.proto__viz {
  position: relative;
  margin-top: var(--sp-5);
}

/* ---- Night-map variant (dark surface) ---- */
.proto--dark {
  background: var(--bg, #191924);
  color: var(--text, #F8F9FA);
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: calc(50vw - 50%);
  padding-right: calc(50vw - 50%);
}

.proto--dark .proto__num,
.proto--dark .proto__title { color: var(--text, #F8F9FA); }
.proto--dark .proto__dek { color: var(--text-muted, #A6AEBA); }
.proto--dark .proto__dek strong { color: var(--text, #F8F9FA); }

.night-map {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 640px;
  position: relative;
}

.night-map svg {
  width: 100%;
  height: 100%;
  display: block;
}

.night-map .state {
  fill: #14181f;
  stroke: #2a2f3b;
  stroke-width: 0.5;
}

.night-map .state--has-hq {
  fill: #1a1f2b;
}

.night-map .dot-halo {
  fill: none;
  stroke-opacity: 0.35;
  stroke-width: 1;
}

.night-map .dot {
  stroke: #FAF8F4;
  stroke-width: 0.8;
  opacity: 0.92;
  cursor: pointer;
  transition: opacity var(--dur-quick) var(--ease-out), transform var(--dur-quick) var(--ease-out);
  transform-origin: center;
  transform-box: fill-box;
}

.night-map .dot:hover {
  opacity: 1;
  transform: scale(1.3);
}

.night-map .annotation {
  fill: #F8F9FA;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
}

.night-map .annotation--caps {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  fill: #7b7b83;
}

.night-map .annotation-leader {
  stroke: #4a5060;
  stroke-width: 0.7;
  fill: none;
}

.night-map__tooltip {
  position: absolute;
  pointer-events: none;
  background: #14181f;
  border: 1px solid #2a2f3b;
  color: #F3F1EA;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-snug);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity var(--dur-quick) var(--ease-out);
  min-width: 180px;
  z-index: 2;
}

.night-map__tooltip.is-visible { opacity: 1; }
.night-map__tooltip strong { display: block; margin-bottom: 2px; color: #FFF; font-family: var(--font-display); font-size: var(--fs-body); }
.night-map__tooltip .industry-tag { display: block; color: #9c9ca5; font-size: var(--fs-caption); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
.night-map__tooltip .impact { color: #C8963A; font-variant-numeric: tabular-nums; }

.night-map__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid #2a2f3b;
}

.night-map__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9c9ca5;
}

.night-map__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* ---- Sunburst ---- */
.sunburst {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-7);
  align-items: center;
}

@media (max-width: 900px) {
  .sunburst { grid-template-columns: 1fr; }
}

.sunburst svg {
  width: 100%;
  height: auto;
  max-width: 640px;
  margin: 0 auto;
  display: block;
}

.sunburst__detail {
  font-size: var(--fs-body-sm);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
}

.sunburst__detail-title {
  font-family: var(--font-display);
  font-size: var(--fs-display-sm);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.sunburst__detail-value {
  font-family: var(--font-display);
  font-size: var(--fs-display-md);
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--sp-3);
}

.sunburst__detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
}

.sunburst__detail-stats dt {
  font-size: var(--fs-body-sm);
  letter-spacing: var(--letter-caps);
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 2px;
}

.sunburst__detail-stats dd {
  font-size: var(--fs-body-lg);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.sunburst path.arc {
  cursor: pointer;
  transition: opacity var(--dur-quick) var(--ease-out);
}

.sunburst path.arc:hover {
  opacity: 0.85;
}

.sunburst .sun-center {
  font-family: var(--font-display);
  fill: var(--text);
  text-anchor: middle;
}

.sunburst .sun-center__value {
  font-size: 22px;
}

.sunburst .sun-center__label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--text-subtle);
  font-family: var(--font-body);
}

/* ---- Treemap ---- */
.treemap {
  width: 100%;
  aspect-ratio: 16 / 9;
}

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

.treemap .cell {
  cursor: pointer;
}

.treemap .cell__rect {
  stroke: var(--bg);
  stroke-width: 1;
}

.treemap .cell__label {
  font-family: var(--font-body);
  font-size: 12px;
  fill: var(--bg);
  pointer-events: none;
  font-weight: 500;
}

.treemap .cell__industry .cell__label {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: -0.01em;
}

.treemap .cell__value {
  font-family: var(--font-body);
  font-size: 11px;
  fill: rgba(255,255,255,0.75);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* ---- Beeswarm ---- */
.beeswarm {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 560px;
}

.beeswarm svg {
  width: 100%;
  height: 100%;
  display: block;
}

.beeswarm .axis path,
.beeswarm .axis line {
  fill: none;
  stroke: var(--rule-strong);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.beeswarm .axis text {
  fill: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-body);
}

.beeswarm .axis-label {
  fill: var(--text-subtle);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-body);
}

.beeswarm .dot {
  cursor: pointer;
  stroke: var(--bg);
  stroke-width: 0.8;
}

.beeswarm .label {
  font-family: var(--font-display);
  font-size: 12px;
  fill: var(--text);
  pointer-events: none;
  font-style: italic;
}

.beeswarm__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
}

.beeswarm__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.beeswarm__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
