/* Ultra-compact, zero-chrome, high-density 2D + 3D interactive visuals for
   "Predicting every NBA game before Vegas closes" (APEX-NBA).
   Open-paper hairline rules on main.css tokens, zero HTML form sprawl. */

.ax {
  --a-blue: var(--brand-cobalt, #0155bf);
  --a-teal: var(--brand-emerald, #0e9972);
  --a-amber: var(--yellow, #b57614);
  --a-gold: #c6840b;
  --a-red: var(--red, #ad2111);
  --a-slate: #647080;
  --a-purple: #6d52b3;

  position: relative;
  font-variant-numeric: tabular-nums;
}

.ax-body { display: block; min-height: var(--reserve, 400px); }
.ax.ready .ax-body { min-height: 0; }
.ax [hidden] { display: none !important; }

/* ----------------------------------------------------- single hairline header */
.ax-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px 12px;
  padding-bottom: 7px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.ax-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 11px;
  margin: 0;
  font: 11px/1.35 var(--font-sans, var(--sans));
  color: var(--fg-3);
}
.ax-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4.5px;
  white-space: nowrap;
}
.ax-legend i {
  display: inline-block;
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: var(--fg-3);
  flex: none;
}
.ax-legend .blue i { background: var(--a-blue); }
.ax-legend .teal i { background: var(--a-teal); }
.ax-legend .amber i { background: var(--a-amber); }
.ax-legend .gold i { background: var(--a-gold); transform: rotate(45deg); border-radius: 1.5px; }
.ax-legend .red i { background: var(--a-red); }
.ax-legend .purple i { background: var(--a-purple); }
.ax-legend .slate i { background: var(--a-slate); }
.ax-legend .dash i {
  width: 10px;
  height: 0;
  border-radius: 0;
  background: none;
  border-top: 1.6px dashed var(--a-red);
}

.ax-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3.5px;
  margin-left: auto;
}
.ax-actions button {
  padding: 1.5px 8.5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg-2);
  font: 500 10.6px/1.48 var(--font-sans, var(--sans));
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.13s, border-color 0.13s, background 0.13s;
}
.ax-actions button:hover {
  color: var(--fg);
  border-color: var(--line-2);
  background: var(--subtle);
}
.ax-actions button[aria-pressed="true"] {
  color: var(--fg);
  border-color: var(--fg);
  background: color-mix(in srgb, var(--fg) 7%, var(--bg));
}
.ax-actions button.accent {
  color: var(--a-blue);
  border-color: color-mix(in srgb, var(--a-blue) 36%, var(--line));
}
.ax-actions button.accent[aria-pressed="true"] {
  color: #fff;
  background: var(--a-blue);
  border-color: var(--a-blue);
}
.ax-actions button.gold-btn {
  color: var(--a-gold);
  border-color: color-mix(in srgb, var(--a-gold) 42%, var(--line));
}
.ax-actions button.gold-btn[aria-pressed="true"] {
  color: var(--a-gold);
  border-color: var(--a-gold);
  background: color-mix(in srgb, var(--a-gold) 11%, var(--bg));
}
.ax-actions button:focus-visible,
.ax-micro button:focus-visible,
.ax-micro select:focus-visible {
  outline: 2px solid var(--a-blue);
  outline-offset: 2px;
}

/* Whisper-quiet single micro-strip (only rendered when needed, zero heavy chrome) */
.ax-micro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 6px;
  margin: -1px 0 5px;
  font: 10.5px/1.35 var(--font-mono, var(--mono));
  color: var(--fg-3);
}
.ax-micro button {
  padding: 1px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--fg-3);
  font: 500 10.5px/1.4 var(--font-sans, var(--sans));
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.ax-micro button:hover { color: var(--fg); }
.ax-micro button[aria-pressed="true"] {
  color: var(--fg);
  border-color: var(--line-2);
  background: var(--subtle);
}
.ax-micro button.gold { color: var(--a-gold); }
.ax-micro button.red { color: var(--a-red); }
.ax-micro select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font: 600 10.5px/1.35 var(--font-mono, var(--mono));
  padding: 1px 16px 1px 7px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%),
                    linear-gradient(135deg, var(--fg-3) 50%, transparent 50%);
  background-position: calc(100% - 8px) 52%, calc(100% - 4.5px) 52%;
  background-size: 3.5px 3.5px, 3.5px 3.5px;
  background-repeat: no-repeat;
}

/* ----------------------------------------------------- unified HiDPI canvas stages */
.ax-stage {
  position: relative;
  width: 100%;
  height: 354px;
  user-select: none;
  -webkit-user-select: none;
}
.ax-stage.lab { height: 378px; }
.ax-stage.orbit { height: 358px; cursor: grab; touch-action: none; }
.ax-stage.orbit:active { cursor: grabbing; }
.ax-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ----------------------------------------------------- single-line hairline readout */
.ax-readout {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
  align-items: baseline;
  min-height: 1.45em;
  margin: 6px 0 0 !important;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font: 11.4px/1.45 var(--font-sans, var(--sans));
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.ax-readout strong { color: var(--fg); font-weight: 600; }
.ax-readout .mono { font-family: var(--font-mono, var(--mono)); font-size: 10.6px; }
.ax-readout .blue { color: var(--a-blue); font-weight: 600; }
.ax-readout .teal { color: var(--a-teal); font-weight: 600; }
.ax-readout .amber { color: var(--a-amber); font-weight: 600; }
.ax-readout .gold { color: var(--a-gold); font-weight: 600; }
.ax-readout .red { color: var(--a-red); font-weight: 600; }
.ax-readout .ink { color: var(--fg-2); }

/* ----------------------------------------------------- inline story trigger links */
a.act {
  color: var(--a-blue, #0155bf);
  text-decoration: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--a-blue, #0155bf) 52%, transparent);
  padding-bottom: 1px;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
a.act:hover {
  background: color-mix(in srgb, var(--a-blue, #0155bf) 9%, transparent);
  border-bottom-style: solid;
}

/* ----------------------------------------------------- collapsible methods footer */
.ax-methods {
  margin: 2.1rem 0 0;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
  font-size: 0.9rem;
  color: var(--fg-2);
}
.ax-methods summary {
  cursor: pointer;
  font: 500 0.86rem/1.4 var(--font-sans, var(--sans));
  color: var(--fg);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
}
.ax-methods summary::-webkit-details-marker { display: none; }
.ax-methods summary::before {
  content: "+";
  font: 600 13px/1 var(--font-mono, var(--mono));
  color: var(--fg-3);
  width: 14px;
}
.ax-methods[open] summary::before { content: "−"; }
.ax-methods p { margin: 0.65rem 0; line-height: 1.58; }

.ax-error {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--fg-2);
  font: 13px/1.55 var(--font-sans, var(--sans));
}

@media (max-width: 640px) {
  .ax-stage { height: 325px; }
  .ax-stage.lab { height: 420px; }
  .ax-stage.orbit { height: 318px; }
  .ax-legend { font-size: 10.2px; gap: 2px 8px; }
  .ax-actions button { font-size: 10px; padding: 1.5px 7px; }
  .ax-readout { font-size: 10.8px; }
}
@media (pointer: coarse) {
  .ax-actions button,
  .ax-micro button { min-height: 28px; }
}
