/* enclosure3d.css — the 3D enclosure viewer (enclosure.html). Uses the sr.css tokens only,
   so it follows whichever theme sr.css defines. */

.v3d-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.v3d-tabs { margin-bottom: 10px; }

.v3d-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 18px;
  margin-bottom: 12px;
  min-width: 0;
}
.v3d-part { flex: 1 1 260px; max-width: 420px; }
.v3d-toggles { display: flex; flex-wrap: wrap; gap: 8px 14px; min-width: 0; }

/* segmented radio groups */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.seg-title { color: var(--muted); font-size: 0.85rem; margin-right: 4px; }
.seg label { position: relative; cursor: pointer; }
.seg input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.seg span:not(.seg-title) {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.86rem;
  line-height: 1.3;
  white-space: nowrap;
}
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #10141a); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg label:hover input:not(:checked) + span { color: var(--text); }

/* stage */
.v3d-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 72vh;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
}
.v3d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}
.v3d-stage canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

.v3d-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 32px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
}
.v3d-overlay.err { color: var(--err); border-color: var(--err); }

.v3d-tools {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: calc(100% - 20px);
}
.v3d-tools .btn { background: var(--panel); }
#btnZoomIn, #btnZoomOut { min-width: 36px; justify-content: center; font-weight: 700; }

.v3d-info {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px 18px;
  margin-top: 10px;
}
.v3d-size { margin: 0; font-variant-numeric: tabular-nums; }
.v3d-size b { color: var(--accent-ink, var(--accent)); font-weight: 600; }
.v3d-info .v3d-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.86rem;
  color: var(--muted);
  min-width: 0;
}
.v3d-legend li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.v3d-legend .swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
  box-shadow: 0 0 0 1px var(--muted);
}
.v3d-legend .state { color: var(--warn); }
.v3d-legend .state.err { color: var(--err); }
.v3d-legend li.off { opacity: 0.5; }

@media (max-width: 620px) {
  .v3d-stage { aspect-ratio: 1 / 1; }
  .v3d-part { max-width: none; }
  .v3d-toggles { display: grid; gap: 6px; width: 100%; }
  .seg { flex-wrap: nowrap; }
  #variantToggle { flex-wrap: wrap; }   /* any number of variants from scene.json */
  .seg-title { flex: none; width: 64px; margin: 0; }
  .seg span:not(.seg-title) { padding: 5px 9px; }
}
