/* Interactives embedded inside an exploration. */

.interactive { margin: 2.4rem 0 1rem; }

.tool {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  padding: 1.4rem 1.5rem 1.5rem;
}

/* ── controls ────────────────────────────────────────── */

.tool-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
  margin-bottom: 1.6rem;
}

.tool-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.86rem;
  color: var(--dim);
}

.tool-controls select {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  color: var(--text);
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.tool-controls select:focus-visible {
  outline: none;
  border-color: var(--accent);
}

.tool-controls button {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 0.4rem 1.1rem;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent-dk);
  border-radius: 3px;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}

.tool-controls button:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent);
  color: #eaf7ff;
}

.tool-note {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--dimmer);
  margin: 1.2rem 0 0;
  min-height: 1em;
}

/* ── storage lanes ───────────────────────────────────── */

.tool-lanes { display: grid; gap: 1.4rem; }

.lane-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.lane-name { font-size: 0.92rem; font-weight: 600; color: #e8edf6; }

.lane-clock {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0.85;
}

.lane-track {
  height: 0.55rem;
  background: #0c1017;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.lane-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-dk), var(--accent));
}

.lane-spec {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--dimmer);
  margin-top: 0.35rem;
}

/* ── chart ───────────────────────────────────────────── */

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-bottom: 1rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--dim);
  cursor: pointer;
  transition: color var(--ease), opacity var(--ease);
}

.legend-item:hover { color: var(--text); }
.legend-item[aria-pressed="false"] { opacity: 0.35; }

.legend-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  display: inline-block;
}

.chart-wrap { overflow-x: auto; }

.chart-box {
  position: relative;
  width: 100%;
  min-width: 34rem;
}

.chart { width: 100%; display: block; overflow: visible; }

.chart .grid line { stroke: var(--line-soft); stroke-width: 1; }

.chart .grid text {
  fill: var(--dimmer);
  font-family: var(--mono);
  font-size: 11px;
}

/* ── chart points ────────────────────────────────────── */

.pt-hit {
  fill: transparent;
  /* `all` rather than the default, so a transparent circle still takes
     pointer and keyboard events */
  pointer-events: all;
  cursor: pointer;
  outline: none;
}

.pt-halo {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.5);
  transition: opacity var(--ease), transform var(--ease);
  pointer-events: none;
}

.pt-dot {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform var(--ease);
  pointer-events: none;
}

.pt.is-active .pt-halo { opacity: 0.32; transform: scale(1.6); }
.pt.is-active .pt-dot { transform: scale(1.5); }

.pt:focus-within .pt-dot,
.pt.is-active .pt-dot {
  filter: drop-shadow(0 0 4px var(--pt-color))
          drop-shadow(0 0 10px var(--pt-color));
}

.pt:focus-within .pt-halo { opacity: 0.32; transform: scale(1.6); }

/* ── point readout ───────────────────────────────────── */

.chart-tip {
  position: absolute;
  z-index: 4;
  display: grid;
  gap: 0.12rem;
  padding: 0.5rem 0.7rem;
  min-width: 8rem;
  background: #0b1017;
  border: 1px solid var(--line);
  border-left: 2px solid var(--tip-accent, var(--accent));
  border-radius: 3px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  white-space: nowrap;
}

.chart-tip[hidden] { display: none; }

.tip-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #eef2f8;
}

.tip-value {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--tip-accent, var(--accent));
}

.tip-meta {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--dimmer);
}

@media (prefers-reduced-motion: reduce) {
  .pt-halo, .pt-dot { transition: none; }
}

/* ── die view ────────────────────────────────────────── */

.die-stage {
  display: grid;
  place-items: center;
  min-height: 20rem;
  margin-bottom: 1.2rem;
}

.die-svg { width: 100%; max-width: 38rem; display: block; }

.die-rect {
  fill: rgba(56, 189, 248, 0.18);
  stroke: var(--accent);
  stroke-width: 2;
  cursor: pointer;
  transition: fill var(--ease);
}

.die-rect:hover { fill: rgba(56, 189, 248, 0.3); }

.die-ghost {
  fill: none;
  stroke: var(--dimmer);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.die-coin {
  fill: rgba(148, 163, 184, 0.07);
  stroke: var(--line);
  stroke-width: 2;
}

.die-coin-label {
  fill: var(--dimmer);
  font-family: var(--mono);
  font-size: 12px;
}

.die-canvas {
  width: 20rem;
  height: 20rem;
  max-width: 100%;
  border: 1px solid var(--line);
  background: #0b0f16;
}

.die-readout {
  display: grid;
  gap: 0.25rem;
  margin: 0 0 1rem;
  min-height: 2.9rem;
}

.die-name { font-size: 1rem; font-weight: 600; color: #e8edf6; }

.die-figures {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--accent);
  opacity: 0.85;
}

.die-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1.6rem;
  background: none;
  cursor: pointer;
}

.die-slider::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
}

.die-slider::-moz-range-track {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
}

.die-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  margin-top: -0.4rem;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0b1017;
  box-shadow: 0 0 0 1px var(--accent-dk);
}

.die-slider::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0b1017;
}

.die-slider:focus-visible { outline: none; }
.die-slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.4); }
.die-slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.4); }

.die-ends {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--dimmer);
  margin-top: -0.2rem;
}

/* ── floorplan ───────────────────────────────────────── */

.fp-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.fp-switch button {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.9rem;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}

.fp-switch button:hover { color: var(--text); border-color: var(--dimmer); }

.fp-switch button[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent-dk);
  background: rgba(56, 189, 248, 0.1);
}

.fp-stage {
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
}

.fp-svg { width: 100%; display: block; }

.fp-block rect {
  fill: rgba(148, 163, 184, 0.1);
  stroke: var(--line);
  stroke-width: 0.4;
  cursor: pointer;
  transition: fill var(--ease), stroke var(--ease);
}

.fp-block[data-kind="core"]  rect { fill: rgba(56, 189, 248, 0.14); stroke: #2c7ea8; }
.fp-block[data-kind="cache"] rect { fill: rgba(167, 139, 250, 0.18); stroke: #7c5fd0; }
.fp-block[data-kind="logic"] rect { fill: rgba(245, 158, 11, 0.13); stroke: #a1700c; }
.fp-block[data-kind="io"]    rect { fill: rgba(148, 163, 184, 0.09); stroke: #454d5b; }

.fp-block:hover rect,
.fp-block.is-active rect { fill: rgba(56, 189, 248, 0.34); stroke: var(--accent); }

.fp-tip { max-width: 17rem; white-space: normal; }
.fp-tip .tip-value { font-size: 0.7rem; }
.fp-tip .tip-meta { font-family: var(--sans); font-size: 0.76rem; line-height: 1.45; color: #a9b3c4; }
