/* ============================================================
   sensor2.css  —  Instagram-style immersive v2 layout
   Desktop: exact v1 layout. Mobile: immersive v2.
   Self-contained — mobile section needs no sensor.css classes.
   ============================================================ */

/* ---- Desktop/Mobile view toggle ---- */
.s2-mobile-view {
	display: none;
}

@media (pointer: coarse) and (max-width: 1024px) {
	.s2-desktop-view {
		display: none !important;
	}
	.s2-mobile-view {
		display: block;
	}
}

/* ════════════════════════════════════════
   DESKTOP utility classes (for v2 templates)
   Replaces inline styles in the desktop section.
   ════════════════════════════════════════ */

/* Trust badge */
.s2d-trust-badge {
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(198, 255, 0, 0.08);
	border: 1px solid rgba(198, 255, 0, 0.25);
	border-radius: 8px;
	padding: 12px 16px;
	margin: 0 auto 20px auto;
	max-width: 600px;
}

.s2d-trust-badge svg {
	flex-shrink: 0;
}

.s2d-trust-title {
	color: #C6FF00;
	font-weight: 600;
	font-size: 15px;
}

.s2d-trust-detail {
	color: #999;
	font-size: 12px;
	margin-top: 2px;
}

.s2d-trust-explain {
	color: #aaa;
	font-size: 12px;
	margin-top: 4px;
}

/* Sensor panel blocks */
.s2d-panel {
	background: #1a1a1a;
	border-radius: 8px;
	padding: 15px;
}

.s2d-panel-title {
	color: white;
	font-weight: bold;
	margin-bottom: 10px;
	text-align: center;
	font-size: 14px;
}

.s2d-camera-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 5px;
	margin-bottom: 22px;
}

.s2d-canvas {
	display: block;
	border-radius: 4px;
}

.s2d-canvas-bg {
	display: block;
	border-radius: 4px;
	background: #2a2a2a;
	width: 100%;
}

.s2d-canvas-wrap {
	margin-top: 7px;
}

.s2d-accel-pad {
	padding-bottom: 14px;
}

/* Section gaps & titles */
.s2d-gap {
	margin-top: 20px;
}

.s2d-btn-press-title {
	color: #C6FF00;
	font-weight: bold;
	margin-bottom: 10px;
	text-align: center;
	font-size: 18px;
}

.s2d-section-green {
	color: #C6FF00;
}

.s2d-section-sub {
	color: #C6FF00;
	font-weight: 500;
}

.s2d-shield-icon {
	width: 1.5em;
	height: 1.5em;
	vertical-align: middle;
}

.s2d-toggle {
	cursor: pointer;
}

/* GPS panel */
.s2d-gps-hidden {
	margin-top: 20px;
	display: none;
}

.s2d-map-link-wrap {
	margin-top: 12px;
	text-align: center;
}

.s2d-map {
	width: 100%;
	height: 100%;
}

/* Controls (video only) */
.s2d-time-label {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 10px;
}

.s2d-time-slider {
	flex: 1;
}

.s2d-controls-center {
	margin: 0 auto;
	text-align: center;
}

.s2d-controls-inline {
	display: inline-block;
	padding: 0 10px;
}

.s2d-scale-label {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 180px;
}

.s2d-scale-slider {
	width: 80px;
}

.s2d-auto-btn {
	margin-left: 5px;
	padding: 4px 8px;
	background: #444;
	color: white;
	border: 1px solid #666;
	border-radius: 3px;
	font-size: 12px;
	cursor: pointer;
}

/* Desktop video mute button */
.s2d-mute-btn {
	position: absolute;
	bottom: 16px;
	right: 16px;
	z-index: 20;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(0,0,0,0.6);
	border: 1px solid rgba(255,255,255,0.2);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	cursor: pointer;
	transition: background 0.2s;
}

.s2d-mute-btn:hover {
	background: rgba(0,0,0,0.8);
}

.s2d-mute-btn svg {
	width: 18px;
	height: 18px;
}

.s2d-icon-muted {
	display: none;
}

/* Photo-specific desktop */
.s2d-photo-img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 16px;
}

.s2d-stubs-hidden {
	display: none;
	visibility: hidden;
	height: 0;
	overflow: hidden;
}

/* ════════════════════════════════════════
   MOBILE v2 IMMERSIVE STYLES
   ════════════════════════════════════════ */

@media (pointer: coarse) and (max-width: 1024px) {

	/* ---- Page ---- */
	.s2-page {
		position: relative;
		background: #000;
		color: #e1e1e1;
		min-height: 100dvh;
		min-height: 100vh;
		overflow-x: hidden;
		-webkit-tap-highlight-color: transparent;
		-webkit-text-size-adjust: 100%;
		text-size-adjust: 100%;
	}

	/* Hide site chrome */
	body.s2-active .header,
	body.s2-active .mobile-menu,
	body.s2-active .footer,
	body.s2-active .cookie-banner {
		display: none !important;
	}

	body.s2-active {
		padding-top: 0 !important;
	}

	body.s2-active .main-content {
		padding-top: 0 !important;
		margin-top: 0 !important;
	}

	/* ---- Media viewport ---- */
	.s2-media-viewport {
		position: relative;
		width: 100%;
		height: 100dvh;
		height: 100vh;
		background: #000;
		display: flex;
		align-items: center;
		justify-content: center;
		overflow: hidden;
		contain: layout style;
	}

	.s2-media-viewport video,
	.s2-media-viewport img {
		display: block;
		width: 100%;
		height: 100%;
	}

	.s2-media--vertical video,
	.s2-media--vertical img {
		object-fit: cover;
	}

	.s2-media--landscape video,
	.s2-media--landscape > img:not(.s2-bg-blur) {
		object-fit: contain;
		position: relative;
		z-index: 1;
	}

	/* Blurred background for landscape content */
	.s2-media-viewport .s2-bg-blur {
		position: absolute;
		inset: -20px;
		width: calc(100% + 40px);
		height: calc(100% + 40px);
		object-fit: cover;
		filter: blur(30px) brightness(0.5);
		z-index: 0;
		pointer-events: none;
	}

	/* ---- Tap overlay (play/pause) ---- */
	.s2-tap-overlay {
		position: absolute;
		inset: 0;
		z-index: 5;
	}

	.s2-pause-flash,
	.s2-play-flash {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%) scale(0.8);
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.15s ease, transform 0.15s ease;
	}

	.s2-pause-flash.s2-flash-visible,
	.s2-play-flash.s2-flash-visible {
		opacity: 0.8;
		transform: translate(-50%, -50%) scale(1);
	}

	/* ---- Action stack (right side) ---- */
	.s2-action-stack {
		position: absolute;
		right: 14px;
		bottom: 180px;
		z-index: 10;
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 16px;
	}

	.s2-action-btn {
		width: 44px;
		height: 44px;
		border-radius: 50%;
		background: rgba(0,0,0,0.5);
		border: 1px solid rgba(255,255,255,0.2);
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 0;
		cursor: pointer;
		backdrop-filter: blur(8px);
		-webkit-backdrop-filter: blur(8px);
		transition: background 0.2s, transform 0.15s;
		touch-action: manipulation;
		-webkit-tap-highlight-color: transparent;
	}

	.s2-action-btn:active {
		transform: scale(0.9);
	}

	.s2-action-btn svg {
		width: 22px;
		height: 22px;
	}

	.s2-icon-unmuted {
		display: none;
	}

	/* ---- CTA (top-left) ---- */
	.s2-cta-overlay {
		position: absolute;
		top: 14px;
		left: 14px;
		z-index: 10;
		display: flex;
		align-items: center;
		gap: 6px;
		background: rgba(0,0,0,0.45);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
		border-radius: 20px;
		padding: 7px 14px 7px 10px;
		color: #fff;
		font-size: 13px;
		font-weight: 600;
		text-decoration: none;
		white-space: nowrap;
		touch-action: manipulation;
		-webkit-tap-highlight-color: transparent;
	}

	.s2-cta-overlay svg {
		flex-shrink: 0;
	}

	/* ---- Verified badge (top-right) ---- */
	.s2-badge-overlay {
		position: absolute;
		top: 14px;
		right: 14px;
		z-index: 10;
		display: flex;
		align-items: center;
		gap: 6px;
		background: rgba(0,0,0,0.45);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
		border-radius: 20px;
		padding: 6px 12px 6px 8px;
	}

	.s2-badge-overlay svg {
		flex-shrink: 0;
	}

	.s2-badge-overlay span {
		color: #C6FF00;
		font-size: 13px;
		font-weight: 600;
		white-space: nowrap;
	}

	.s2-badge-tappable {
		cursor: pointer;
		touch-action: manipulation;
		-webkit-tap-highlight-color: transparent;
		transition: background 0.2s;
	}

	.s2-badge-tappable:active {
		background: rgba(0,0,0,0.6);
	}

	.s2-badge-chevron {
		opacity: 0.7;
		flex-shrink: 0;
	}

	/* ---- First-visit tooltip ---- */
	.s2-badge-tooltip {
		position: absolute;
		top: 50px;
		right: 14px;
		z-index: 11;
		background: rgba(0,0,0,0.85);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
		border: 1px solid rgba(198, 255, 0, 0.3);
		border-radius: 10px;
		padding: 10px 14px;
		color: #fff;
		font-size: 13px;
		font-weight: 500;
		max-width: 220px;
		opacity: 0;
		transform: translateY(-8px);
		transition: opacity 0.3s, transform 0.3s;
		pointer-events: none;
	}

	.s2-badge-tooltip--visible {
		opacity: 1;
		transform: translateY(0);
	}

	.s2-badge-tooltip::before {
		content: '';
		position: absolute;
		top: -6px;
		right: 20px;
		width: 12px;
		height: 12px;
		background: rgba(0,0,0,0.85);
		border-top: 1px solid rgba(198, 255, 0, 0.3);
		border-left: 1px solid rgba(198, 255, 0, 0.3);
		transform: rotate(45deg);
	}

	/* ---- Progress bar (video) ---- */
	.s2-progress-bar {
		position: absolute;
		bottom: 68px;
		left: 0;
		right: 0;
		height: 2px;
		background: rgba(255,255,255,0.15);
		z-index: 9;
	}

	.s2-progress-fill {
		height: 100%;
		background: #C6FF00;
		width: 0%;
	}

	/* ---- Title overlay (bottom gradient) ---- */
	.s2-title-overlay {
		position: absolute;
		bottom: 0;
		left: 0;
		right: 0;
		z-index: 8;
		padding: 60px 16px 94px;
		background: linear-gradient(transparent, rgba(0,0,0,0.85));
		pointer-events: none;
	}

	.s2-title-overlay h1 {
		color: #fff;
		font-size: 18px;
		font-weight: 700;
		margin: 0 0 4px;
		text-shadow: 0 1px 4px rgba(0,0,0,0.6);
	}

	.s2-timecode {
		color: rgba(255,255,255,0.5);
		font-size: 12px;
		font-family: 'SF Mono', 'Menlo', monospace;
		margin-top: 4px;
		text-shadow: 0 1px 3px rgba(0,0,0,0.5);
	}

	.s2-title-overlay .s2-subtitle {
		color: rgba(255,255,255,0.7);
		font-size: 13px;
		text-shadow: 0 1px 3px rgba(0,0,0,0.5);
	}

	/* ---- Bottom sheet ---- */
	.s2-bottom-sheet {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		z-index: 100;
		background: #111;
		border-radius: 16px 16px 0 0;
		transform: translateY(calc(100% - 56px));
		transition: transform 450ms cubic-bezier(0.2, 0.9, 0.4, 1);
		will-change: transform;
		animation: s2-sheet-hint 3.5s ease-out 2s 1;
		max-height: 85dvh;
		max-height: 85vh;
		display: flex;
		flex-direction: column;
	}

	.s2-sheet--open {
		transform: translateY(0);
		animation: none;
	}

	@keyframes s2-sheet-hint {
		0% { transform: translateY(calc(100% - 56px)); }
		14% { transform: translateY(calc(100% - 120px)); }
		86% { transform: translateY(calc(100% - 120px)); }
		100% { transform: translateY(calc(100% - 56px)); }
	}

	.s2-sheet-handle {
		padding: 18px 16px 22px;
		cursor: pointer;
		user-select: none;
		text-align: center;
		flex-shrink: 0;
		touch-action: none;
		-webkit-tap-highlight-color: transparent;
	}

	.s2-sheet-handle::before {
		content: '';
		display: block;
		width: 36px;
		height: 4px;
		background: #444;
		border-radius: 2px;
		margin: 0 auto 8px;
	}

	.s2-sheet-handle-title {
		color: #C6FF00;
		font-size: 14px;
		font-weight: 600;
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 6px;
	}

	.s2-sheet-handle-title svg {
		width: 1.2em;
		height: 1.2em;
	}

	.s2-sheet-content {
		flex: 1;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
		padding: 0 16px 24px;
	}

	/* ---- Sheet intro & panel subtitles ---- */
	.s2-sheet-intro {
		color: #999;
		font-size: 13px;
		line-height: 1.5;
		margin: 0 0 16px;
		padding: 0 4px;
	}

	.s2-panel-subtitle {
		color: #888;
		font-size: 11px;
		font-weight: 400;
		text-align: center;
		margin: -6px 0 10px;
		line-height: 1.4;
	}

	/* ---- Backdrop ---- */
	.s2-backdrop {
		display: none;
		position: fixed;
		inset: 0;
		z-index: 99;
		background: rgba(0,0,0,0.4);
	}

	.s2-backdrop--visible {
		display: block;
	}

	/* ---- Toast ---- */
	.s2-toast {
		position: fixed;
		bottom: 100px;
		left: 50%;
		transform: translateX(-50%) translateY(20px);
		background: rgba(0,0,0,0.8);
		color: #fff;
		padding: 10px 20px;
		border-radius: 8px;
		font-size: 14px;
		font-weight: 500;
		z-index: 200;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.25s, transform 0.25s;
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
	}

	.s2-toast--visible {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}

	/* ════════════════════════════════════════
	   SHEET CONTENT — sensor panels & metadata
	   ════════════════════════════════════════ */

	.s2-panels {
		display: flex;
		flex-direction: column;
		gap: 12px;
	}

	.s2-panel {
		background: #1a1a1a;
		border-radius: 8px;
		padding: 14px;
		overflow: hidden;
	}

	.s2-panel-title {
		color: #fff;
		font-weight: 700;
		font-size: 14px;
		text-align: center;
		margin: 0 0 10px;
	}

	.s2-camera-grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 5px;
		margin-bottom: 16px;
	}

	.s2-cam-btn {
		background: #333;
		color: #ccc;
		border: 1px solid #444;
		border-radius: 4px;
		padding: 7px 4px;
		font-size: 12px;
		font-weight: 500;
		text-align: center;
		cursor: pointer;
		touch-action: manipulation;
		-webkit-tap-highlight-color: transparent;
	}

	.s2-cam-btn:active,
	.s2-cam-btn.active {
		background: #C6FF00;
		color: #000;
		border-color: #C6FF00;
	}

	.s2-canvas {
		display: block;
		border-radius: 4px;
		background: #2a2a2a;
		width: 100% !important;
		max-width: 100%;
		height: auto !important;
		margin-top: 7px;
	}

	.s2-sensor-readout {
		font-family: 'SF Mono', 'Menlo', monospace;
		font-size: 11px;
		color: #777;
		line-height: 1.6;
		padding: 4px 0;
	}

	.s2-section-gap {
		margin-top: 16px;
	}

	.s2-section-title {
		color: #C6FF00;
		font-weight: 700;
		font-size: 15px;
		text-align: center;
		margin: 0 0 10px;
	}

	.s2-event-log {
		font-size: 12px;
		color: #ccc;
		min-height: 24px;
	}

	.s2-meta-grid {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 12px;
		margin-top: 16px;
	}

	.s2-meta-card {
		background: #1a1a1a;
		border-radius: 8px;
		padding: 12px;
	}

	.s2-meta-card-title {
		color: #C6FF00;
		font-weight: 600;
		font-size: 13px;
		margin: 0 0 8px;
	}

	.s2-meta-list {
		margin: 0;
		padding: 0;
	}

	.s2-meta-row {
		display: flex;
		justify-content: space-between;
		gap: 8px;
		padding: 3px 0;
		font-size: 12px;
		line-height: 1.4;
	}

	.s2-meta-row dt {
		color: #888;
		white-space: nowrap;
		font-weight: 400;
	}

	.s2-meta-row dd {
		color: #e1e1e1;
		margin: 0;
		text-align: right;
		word-break: break-word;
	}

	.s2-map-wrap {
		margin-top: 8px;
		border-radius: 4px;
		overflow: hidden;
		height: 150px;
	}

	.s2-map {
		width: 100%;
		height: 100%;
	}
}
