/* 3D Lab page (builds on site.css and lab.css) */

.viewer-panel { padding: 0; overflow: hidden; }
.viewer {
  position: relative; height: 560px; min-height: 360px;
  background:
    radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--surface) 70%, var(--accent-soft)) 0%, var(--bg) 75%);
}
.viewer canvas#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.viewer canvas#gl:active { cursor: grabbing; }
.viewer.over { outline: 2px dashed var(--accent); outline-offset: -8px; }

.drop {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 24px; cursor: pointer; color: var(--muted); z-index: 2;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.drop[hidden] { display: none; }
.drop svg { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 6px; }
.drop b { color: var(--text); font: 600 20px var(--font-head); }
.drop:hover b { color: var(--accent); }
.drop.busy { cursor: progress; opacity: .55; pointer-events: none; }
.viewer-hint {
  position: absolute; left: 12px; right: 12px; bottom: 10px; text-align: center; z-index: 1; pointer-events: none;
  font-size: 12.5px; color: var(--muted);
}

.thumb { width: 100%; height: auto; max-height: 320px; object-fit: contain; border-radius: 10px; background: var(--bg); display: block; }
.exports { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.exports .btn { min-width: 60px; justify-content: center; }
.controls fieldset:disabled { opacity: .5; }
.controls fieldset:disabled .btn, .controls fieldset:disabled .chip { cursor: not-allowed; }
#reset-view { margin-top: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 1100px) { .viewer { height: 480px; } }
@media (max-width: 680px) { .viewer { height: 360px; } }

/* Distance measurement */
.photo-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.photo-wrap canvas.thumb { width: auto; height: auto; max-width: 100%; max-height: 480px; }
.photo-wrap.measuring { cursor: crosshair; }
.photo-wrap .overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.overlay line { stroke: var(--s2); stroke-width: 2; vector-effect: non-scaling-stroke; }
.pt {
  position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; background: var(--s2); color: #fff;
  font: 600 12px/20px var(--font); text-align: center; font-style: normal; border: 2px solid #fff; pointer-events: none; box-shadow: 0 1px 5px rgba(0, 0, 0, .45);
}
.pt[hidden] { display: none; }
.viewer.measuring canvas#gl { cursor: crosshair; }
.dist-label {
  position: absolute; z-index: 3; transform: translate(-50%, -140%); pointer-events: none; white-space: nowrap;
  background: var(--s2); color: #fff; font: 600 14px var(--font); padding: 3px 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.dist-label[hidden] { display: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.btn-row .btn[hidden] { display: none; }
.controls input[type=number] {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 14px var(--font);
}
#measure-toggle { margin-bottom: 12px; }
#measure-toggle[aria-pressed=true] { background: var(--s2); border-color: var(--s2); color: #fff; }
#measure-out .big { font: 600 44px var(--font-head); letter-spacing: -1px; line-height: 1.1; }
#measure-out .sub { margin: 4px 0 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 20px; margin: 0 0 12px; }
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { margin: 0; font: 600 18px var(--font-head); font-variant-numeric: tabular-nums; }

.ctl[hidden] { display: none; }
