/**
 * Snycerz AR Viewer – styles.
 *
 * Palette:
 *   --snycerz-dark-wood:  #3E1F00
 *   --snycerz-light-wood: #C4956A
 *   --snycerz-cream:      #FDF6EC
 *   --snycerz-gold:       #D4A843  (overridable via --snycerz-ar-accent)
 */

:root {
	--snycerz-dark-wood:  #3E1F00;
	--snycerz-light-wood: #C4956A;
	--snycerz-cream:      #FDF6EC;
	--snycerz-gold:       #D4A843;
	--snycerz-ar-accent:  #D4A843;
}

/* ----------------------------------------------------------------
 * Desktop (mouse + hover) hide.
 * AR is a phone/tablet feature — on desktops with mouse we hide
 * everything. Users can override by adding body.snycerz-ar-force-show.
 * Tablets register as (pointer: coarse) so they stay visible.
 * ---------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
	body:not(.snycerz-ar-force-show) .snycerz-ar-trigger,
	body:not(.snycerz-ar-force-show) .snycerz-ar-inline,
	body:not(.snycerz-ar-force-show) .snycerz-ar-overlay {
		display: none !important;
	}
}

/* ---------- Overlay ---------- */

.snycerz-ar-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	color: var(--snycerz-cream);
	opacity: 0;
	pointer-events: none;
	transition: opacity 300ms ease-out;
}

.snycerz-ar-overlay.is-open {
	opacity: 1;
	pointer-events: auto;
	animation: snycerz-ar-slideup 300ms ease-out;
}

@keyframes snycerz-ar-slideup {
	from { transform: translateY(24px); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

body.snycerz-ar-open { overflow: hidden; }

.snycerz-ar-overlay__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 8, 0, 0.92);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

.snycerz-ar-overlay__panel {
	position: relative;
	width: 100vw;
	height: 100vh;
	background: linear-gradient( 180deg, rgba(62,31,0,0.55) 0%, rgba(15,8,0,0.95) 100% );
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Desktop windowed mode. */
@media (min-width: 900px) {
	.snycerz-ar-overlay__panel {
		width: 90vw;
		height: 90vh;
		max-width: 1400px;
		border-radius: 12px;
		box-shadow: 0 30px 80px rgba(0,0,0,0.55);
	}
}

/* Header */

.snycerz-ar-overlay__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 24px 12px;
	background: linear-gradient( 180deg, rgba(62,31,0,0.85), rgba(62,31,0,0) );
	color: #fff;
}

.snycerz-ar-overlay__titles { min-width: 0; }

.snycerz-ar-overlay__title {
	margin: 0;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 22px;
	font-weight: 600;
	letter-spacing: 0.2px;
	color: #fff;
}

.snycerz-ar-overlay__desc {
	margin: 6px 0 0;
	font-size: 14px;
	color: rgba(253, 246, 236, 0.82);
	max-width: 60ch;
}

.snycerz-ar-overlay__close {
	background: rgba(0,0,0,0.4);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.2);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: transform 120ms ease, background 120ms ease;
	flex: 0 0 auto;
}
.snycerz-ar-overlay__close:hover {
	background: rgba(0,0,0,0.7);
	transform: scale(1.05);
}

/* Stage (model-viewer area). */

.snycerz-ar-overlay__stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 12px;
}

.snycerz-ar-modelwrap {
	position: relative;
	width: 100%;
	height: 100%;
}

.snycerz-ar-modelwrap model-viewer {
	--poster-color: transparent;
	background: transparent;
	width: 100%;
	height: 100%;
}

/* Spinner — golden ring + label + progress %  */

.snycerz-ar-spinner {
	position: absolute;
	top: 50%; left: 50%;
	transform: translate(-50%, -50%);
	width: 160px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	z-index: 2;
	pointer-events: none;
	text-align: center;
	color: #FDF6EC;
	font-family: inherit;
}

.snycerz-ar-spinner__ring {
	width: 48px;
	height: 48px;
	border: 4px solid rgba(212, 168, 67, 0.2);
	border-top-color: var(--snycerz-ar-accent);
	border-radius: 50%;
	animation: snycerz-ar-spin 900ms linear infinite;
}

.snycerz-ar-spinner__label {
	font-size: 13px;
	opacity: 0.85;
	text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.snycerz-ar-spinner__progress {
	font-size: 16px;
	font-weight: 700;
	color: var(--snycerz-ar-accent);
	text-shadow: 0 1px 2px rgba(0,0,0,0.6);
	min-height: 20px;
}

/* Placeholder spinner used in inline shortcode before JS boots — still needs a visible ring */
.snycerz-ar-placeholder .snycerz-ar-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid rgba(212, 168, 67, 0.2);
	border-top-color: var(--snycerz-ar-accent);
	border-radius: 50%;
	animation: snycerz-ar-spin 900ms linear infinite;
	display: block;
	position: static;
	transform: none;
	margin: 0 auto 16px;
}

@keyframes snycerz-ar-spin { to { transform: rotate(360deg); } }

/* Controls */

.snycerz-ar-overlay__controls {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	padding: 12px 16px;
	justify-content: center;
	background: rgba(0,0,0,0.15);
}

.snycerz-ar-btn {
	appearance: none;
	border: 1px solid var(--snycerz-gold);
	background: linear-gradient( 180deg, #5a2f0b 0%, #3E1F00 100% );
	color: var(--snycerz-cream);
	font: inherit;
	font-weight: 600;
	font-size: 14px;
	line-height: 1;
	padding: 12px 18px;
	border-radius: 8px;
	cursor: pointer;
	box-shadow: 0 2px 0 rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
	transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, color 120ms ease;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.snycerz-ar-btn:hover {
	background: linear-gradient( 180deg, #7a4216 0%, #4b2602 100% );
	transform: translateY(-1px);
	box-shadow: 0 4px 10px rgba(0,0,0,0.35);
}

.snycerz-ar-btn:active { transform: translateY(1px); box-shadow: none; }

.snycerz-ar-btn--primary {
	background: linear-gradient( 180deg, var(--snycerz-ar-accent) 0%, #b58a2e 100% );
	color: #2b1700;
	border-color: #2b1700;
}

.snycerz-ar-btn--primary:hover {
	background: linear-gradient( 180deg, #e5bd5a 0%, #c9982f 100% );
	color: #000;
}

.snycerz-ar-btn--ghost {
	background: transparent;
	color: var(--snycerz-cream);
	box-shadow: none;
}

/* Selector bar (thumbnails) */

.snycerz-ar-selector {
	background: rgba(15,8,0,0.75);
	border-top: 1px solid rgba(196,149,106,0.2);
	padding: 10px 12px;
}

.snycerz-ar-selector__inner {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: var(--snycerz-gold) transparent;
}

@media (min-width: 900px) {
	.snycerz-ar-selector--inline .snycerz-ar-selector__inner {
		display: grid;
		grid-template-columns: repeat( auto-fill, minmax(96px, 1fr) );
		overflow: visible;
	}
}

.snycerz-ar-thumb {
	appearance: none;
	background: rgba(62, 31, 0, 0.5);
	border: 2px solid transparent;
	padding: 4px;
	border-radius: 10px;
	cursor: pointer;
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 88px;
	transition: border-color 150ms ease, transform 120ms ease, background 120ms ease;
}

.snycerz-ar-thumb img {
	width: 80px;
	height: 80px;
	object-fit: cover;
	border-radius: 8px;
	display: block;
	background: #1a0d00;
}

.snycerz-ar-thumb__label {
	font-size: 11px;
	color: var(--snycerz-cream);
	margin-top: 4px;
	text-align: center;
	max-width: 100%;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	display: block;
	width: 100%;
}

.snycerz-ar-thumb:hover {
	background: rgba(90, 50, 10, 0.7);
	transform: translateY(-1px);
}

.snycerz-ar-thumb.is-active {
	border-color: #8B4513; /* saddle brown per spec */
	background: rgba(139, 69, 19, 0.3);
}

.snycerz-ar-thumb.is-active::after {
	content: "";
	display: block;
	width: 10px;
	height: 10px;
	background: var(--snycerz-ar-accent);
	border-radius: 50%;
	margin-top: 4px;
}

/* Camera consent modal */

.snycerz-ar-consent {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0,0,0,0.65);
	z-index: 10;
	padding: 16px;
}

.snycerz-ar-consent__box {
	background: var(--snycerz-cream);
	color: var(--snycerz-dark-wood);
	padding: 24px;
	border-radius: 12px;
	max-width: 440px;
	box-shadow: 0 20px 50px rgba(0,0,0,0.4);
	font-size: 15px;
	line-height: 1.5;
}

.snycerz-ar-consent__box h3 {
	margin: 0 0 10px;
	font-family: Georgia, serif;
	color: var(--snycerz-dark-wood);
}

.snycerz-ar-consent__actions {
	display: flex;
	gap: 8px;
	margin-top: 16px;
	justify-content: flex-end;
}

/* Empty / error message */

.snycerz-ar-empty {
	color: var(--snycerz-cream);
	text-align: center;
	font-size: 15px;
	padding: 40px 16px;
}

/* Inline [ar_viewer] embed */

.snycerz-ar-inline {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #1a0d00;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.snycerz-ar-inline__stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 240px;
}

.snycerz-ar-inline .snycerz-ar-modelwrap {
	position: absolute;
	inset: 0;
}

.snycerz-ar-inline__controls {
	display: flex;
	gap: 8px;
	padding: 8px;
	justify-content: center;
	background: rgba(0,0,0,0.35);
}

.snycerz-ar-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	color: var(--snycerz-cream);
	font-size: 14px;
}

/* Trigger button styling (for [ar_button]) */

.snycerz-ar-trigger {
	appearance: none;
	border: 2px solid var(--snycerz-gold);
	background: linear-gradient( 180deg, #6a3910 0%, #3E1F00 100% );
	color: var(--snycerz-cream);
	padding: 12px 20px;
	border-radius: 10px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	transition: transform 120ms ease, box-shadow 120ms ease;
}

.snycerz-ar-trigger:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(62,31,0,0.4);
}

.snycerz-ar-trigger-icon { font-size: 18px; }

/* Mobile adjustments */

@media (max-width: 640px) {
	.snycerz-ar-overlay__header { padding: 14px 14px 8px; }
	.snycerz-ar-overlay__title  { font-size: 18px; }
	.snycerz-ar-overlay__desc   { font-size: 13px; }
	.snycerz-ar-btn             { padding: 10px 14px; font-size: 13px; }
	.snycerz-ar-thumb           { width: 76px; }
	.snycerz-ar-thumb img       { width: 68px; height: 68px; }
}
