/* 3D Unit Selector -- see includes/launch-3d-selector.php and
   assets/launch-3d-selector.js. Only enqueued on a page carrying
   [samtastic_3d_selector] (see samtastic_public_assets()'s $needs_s3d
   check), same conditional-load pattern as the Floor Plan 3D Visualizer. */

.s3d { max-width: 1100px; margin: 0 auto; }

.s3d__layout { display: grid; grid-template-columns: 1fr; gap: 18px; }

.s3d__canvas-wrap { position: relative; border: 1px solid var(--sam-line, #d8d2c4); border-radius: 10px; overflow: hidden; background: linear-gradient(180deg,#dbe9f5 0%,#eef4f7 55%,#f6f3ec 100%); }
.s3d__canvas { width: 100%; height: 520px; position: relative; z-index: 1; }
.s3d__canvas canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; }
.s3d__canvas canvas:active { cursor: grabbing; }

/* 1.21.298: the real OneMap backdrop -- see initMapBackdrop() in
   launch-3d-selector.js. Sits directly behind the (transparent-background)
   three.js canvas above it; all its own Leaflet interaction is disabled so
   drag/scroll on this element always reaches the 3D view instead -- it's
   context for where the project really sits, not something to pan/zoom on
   its own. */
.s3d__map { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.s3d__map .leaflet-control-attribution { font-size: 9px; pointer-events: auto; }

.s3d__hint { position: absolute; left: 12px; bottom: 10px; font-size: .76rem; padding: 4px 9px; border-radius: 20px; background: rgba(255,255,255,.85); color: var(--sam-ink-soft, #6b6357); pointer-events: none; }

/* 1.21.301: "I want the map to be in sync with the models." -- snaps the
   free-orbit camera to directly overhead, framed to match the map beneath
   it (see the top-view button handler in launch-3d-selector.js for why this
   is the one moment a perspective 3D view and a flat map can truly agree). */
.s3d__top-view { position: absolute; left: 12px; top: 12px; z-index: 2; font-size: .78rem; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--sam-line, #d8d2c4); background: rgba(255,255,255,.92); color: var(--sam-ink, #1a1712); cursor: pointer; }
.s3d__top-view:hover { background: #fff; }

.s3d__legend { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; background: rgba(255,255,255,.9); border-radius: 8px; padding: 8px 10px; font-size: .74rem; color: var(--sam-ink, #1a1712); max-width: 190px; }
.s3d__legend-title { font-weight: 700; margin: 0 0 2px; }
.s3d__legend-row { display: flex; align-items: center; gap: 6px; }
.s3d__legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }

.s3d__panel {
	border: 1px solid var(--sam-line, #d8d2c4); border-radius: 10px; background: #fff;
	padding: 18px 20px; position: relative;
}
.s3d__panel-close { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--sam-ink-soft, #6b6357); }
.s3d__panel-close:hover { color: var(--sam-ink, #1a1712); }

.s3d__unit-title { margin: 0 0 4px; font-size: 1.15rem; font-weight: 700; color: var(--sam-ink, #1a1712); }
.s3d__unit-sub { margin: 0 0 14px; font-size: .88rem; color: var(--sam-ink-soft, #6b6357); }

.s3d__unit-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media ( min-width: 640px ) {
	.s3d__unit-grid { grid-template-columns: 140px 1fr; }
}

.s3d__compass { width: 120px; height: 120px; margin: 0 auto; }
.s3d__compass-label { text-align: center; font-size: .8rem; font-weight: 600; color: var(--sam-ink, #1a1712); margin-top: 6px; }

.s3d__floorplan { border: 1px solid var(--sam-line, #d8d2c4); border-radius: 8px; overflow: hidden; background: #fbfaf7; }
.s3d__floorplan img { display: block; width: 100%; height: auto; }
.s3d__floorplan-missing { padding: 30px 14px; text-align: center; font-size: .84rem; color: var(--sam-ink-soft, #6b6357); }

.s3d__facts { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2,1fr); gap: 8px 16px; font-size: .88rem; }
.s3d__facts li strong { display: block; color: var(--sam-ink-soft, #6b6357); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; }

.s3d__no-price { margin-top: 14px; font-size: .82rem; color: var(--sam-ink-soft, #6b6357); font-style: italic; }

.s3d__empty-state { padding: 60px 20px; text-align: center; color: var(--sam-ink-soft, #6b6357); font-size: .92rem; }

.s3d__disclaimer { margin-top: 16px; font-size: .78rem; color: var(--sam-ink-soft, #6b6357); }

@media ( min-width: 900px ) {
	.s3d__layout { grid-template-columns: 1fr 340px; align-items: start; }
	.s3d__panel { position: sticky; top: 20px; }
}

@media ( max-width: 760px ) {
	.s3d__canvas { height: 380px; }
	.s3d__legend { max-width: 150px; font-size: .7rem; }
}
