/* view3d.css — chrome for the Windfield 3-D volume viewer (view3d.js).
   Themed entirely through the shared tokens defined in style.css:
   --bg/--panel/--card/--line/--text/--muted/--accent/--accent-ink/--ok/
   --warn/--err/--shadow. Fallback hexes mirror style.css's dark values
   (DESIGN-LANGUAGE.md: base #0F1419, surfaces #1F2430, accent teal #3AD4C6,
   amber #E8A33D / --warn) so the panel still reads correctly if tokens are
   momentarily unavailable. Font stack matches the app: Nunito for UI text,
   JetBrains Mono for mono labels/readouts. */

.v3-root {
  position: absolute;
  inset: 0;
  background: var(--bg, #0f1419);
  overflow: hidden;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--text, #eef1f6);
}
.v3-root canvas:focus-visible { outline: 2px solid var(--accent, #3ad4c6); outline-offset: -2px; }

.v3-chrome { position: absolute; inset: 0; pointer-events: none; }
.v3-chrome > * { pointer-events: auto; }

/* ── exit button ── */
.v3-exit {
  position: absolute; top: 12px; right: 12px;
  min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line, #2a3140);
  background: var(--panel, #1f2430); color: var(--text, #eef1f6);
  font: 600 13px "Nunito", sans-serif; cursor: pointer;
  box-shadow: var(--shadow, 0 10px 32px rgba(0,0,0,.55));
}
.v3-exit:hover { border-color: var(--accent, #3ad4c6); }
.v3-exit:focus-visible { outline: 2px solid var(--accent, #3ad4c6); outline-offset: 2px; }

/* ── preset strip (top-center) ── */
.v3-presets {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  max-width: min(640px, calc(100vw - 180px));
  background: var(--panel, #1f2430); border: 1px solid var(--line, #2a3140);
  border-radius: 14px; padding: 6px; box-shadow: var(--shadow);
}
.v3-btn {
  min-height: 28px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid transparent; background: transparent;
  color: var(--muted, #9aa6b4); font: 600 12px "Nunito", sans-serif;
  cursor: pointer; white-space: nowrap;
}
.v3-btn:hover { color: var(--text, #eef1f6); background: var(--card, #262c3a); }
.v3-btn:focus-visible { outline: 2px solid var(--accent, #3ad4c6); outline-offset: 1px; }
.v3-preset[aria-pressed="true"] { background: var(--accent, #3ad4c6); color: var(--accent-ink, #0b1117); }

/* ── side panels ── */
.v3-panel {
  position: absolute; top: 60px; bottom: 12px;
  width: clamp(200px, 22vw, 260px);
  background: var(--panel, #1f2430); border: 1px solid var(--line, #2a3140);
  border-radius: 16px; padding: 12px; overflow-y: auto;
  box-shadow: var(--shadow); min-width: 0;
}
.v3-panel-left { left: 12px; }
.v3-panel-right { right: 12px; display: flex; flex-direction: column; gap: 10px; }

.v3-field {
  display: block; margin-bottom: 14px; font-size: 12px;
  color: var(--muted, #9aa6b4); min-width: 0;
}
.v3-field span { float: right; color: var(--text, #eef1f6); font-family: "JetBrains Mono", monospace; font-size: 11px; }
.v3-field input[type="range"] { display: block; width: 100%; margin-top: 6px; accent-color: var(--accent, #3ad4c6); }
.v3-field select {
  display: block; width: 100%; margin-top: 6px; min-height: 32px;
  background: var(--card, #262c3a); color: var(--text, #eef1f6);
  border: 1px solid var(--line, #2a3140); border-radius: 8px; padding: 4px 8px;
}
.v3-radiogroup label { display: flex; align-items: center; gap: 6px; min-height: 28px; color: var(--text, #eef1f6); overflow-wrap: anywhere; }
.v3-overlays { display: flex; flex-direction: column; gap: 4px; }
.v3-overlays label { display: flex; align-items: center; gap: 8px; min-height: 28px; color: var(--text, #eef1f6); }
.v3-overlays input, .v3-radiogroup input { width: 18px; height: 18px; accent-color: var(--accent, #3ad4c6); flex: none; }

.v3-note {
  font-size: 11px; line-height: 1.5; color: var(--muted, #9aa6b4);
  background: var(--card, #262c3a); border-radius: 10px; padding: 8px 10px;
  border: 1px solid var(--line, #2a3140);
  overflow-wrap: anywhere; min-width: 0;
}

/* ── legend (reused ramp) ── */
.v3-legend { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.v3-legend-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: "JetBrains Mono", monospace; font-size: 10px;
  color: var(--text, #eef1f6); background: var(--card, #262c3a);
  border: 1px solid var(--line, #2a3140); border-radius: 999px; padding: 2px 8px 2px 4px;
}
.v3-legend-chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* ── probe readout ── */
.v3-readout {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(360px, calc(100vw - 32px));
  background: var(--panel, #1f2430); border: 1px solid var(--line, #2a3140);
  border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow);
  min-width: 0;
}
.v3-readout-row.v3-readout-head {
  display: flex; align-items: center; justify-content: space-between;
  font: 700 13px "Nunito", sans-serif; margin-bottom: 8px; color: var(--text, #eef1f6);
}
.v3-readout-close {
  min-width: 28px; min-height: 28px; border-radius: 999px; border: none;
  background: var(--card, #262c3a); color: var(--muted, #9aa6b4); cursor: pointer; font-size: 16px;
}
.v3-readout-close:hover { color: var(--err, #ef6166); }
.v3-readout-close:focus-visible { outline: 2px solid var(--accent, #3ad4c6); }
.v3-readout-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 10px;
  font-size: 12px; margin-bottom: 8px; min-width: 0;
}
.v3-readout-grid dt { color: var(--muted, #9aa6b4); }
.v3-readout-grid dd { color: var(--text, #eef1f6); font-family: "JetBrains Mono", monospace; overflow-wrap: anywhere; min-width: 0; }
.v3-profile { display: block; width: 100%; height: 90px; background: var(--card, #262c3a); border-radius: 10px; }

/* ── HUD: compass + scale bar (bottom-left) ── */
.v3-hud {
  position: absolute; left: 12px; bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.v3-compass {
  background: var(--panel, #1f2430); border: 1px solid var(--line, #2a3140);
  border-radius: 50%; box-shadow: var(--shadow);
}
.v3-scalebar {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-family: "JetBrains Mono", monospace; font-size: 10px; color: var(--muted, #9aa6b4);
}
.v3-scale-line { width: 80px; height: 3px; background: var(--text, #eef1f6); border-radius: 2px; }

/* ── reflow / shrink safety (AESTHETICS.md §2.7) ── */
@media (max-width: 820px) {
  .v3-panel { width: clamp(170px, 42vw, 220px); }
  .v3-presets { max-width: calc(100vw - 100px); }
}
@media (max-width: 560px) {
  .v3-panel-left, .v3-panel-right { top: auto; bottom: 76px; max-height: 40vh; }
  .v3-panel-left { left: 8px; right: 8px; width: auto; }
  .v3-panel-right { display: none; } /* shed secondary chrome; overlays stay togglable via keyboard/left panel on very small screens */
  .v3-hud { bottom: 8px; }
  .v3-readout { bottom: 8px; width: calc(100vw - 16px); }
  .v3-presets { top: 8px; }
  .v3-exit { top: 8px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .v3-root * { transition: none !important; }
}
