/**
 * VW360 — Carte immersive.
 * Palette : abysses (#03101c) → cyan bioluminescent (#3fe0d0).
 */

/* Le plugin atterrit dans des thèmes inconnus : on garantit le modèle de boîte. */
.vw360-map-wrap,
.vw360-map-wrap *,
.vw360-map-wrap *::before,
.vw360-map-wrap *::after {
	box-sizing: border-box;
}

.vw360-map-wrap {
	--vw360-abyss: #03101c;
	--vw360-deep: #061e30;
	--vw360-cyan: #3fe0d0;
	--vw360-foam: #dff6ff;
	--vw360-depth: 0;

	position: relative;
	width: 100%;
	height: var(--vw360-map-height, 80vh);
	min-height: 420px;
	overflow: hidden;
	border-radius: 14px;
	background: var(--vw360-abyss);
	isolation: isolate;
	color: var(--vw360-foam);
	font-family: inherit;
}

.vw360-map {
	position: absolute;
	inset: 0;
}

/* --- Ambiance ---------------------------------------------------------- */

.vw360-map__caustics,
.vw360-map__vignette,
.vw360-map__snow,
.vw360-sonar {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 3;
}

/* Caustiques : voile lumineux ondulant, très discret. */
.vw360-map__caustics {
	background:
		radial-gradient(120% 60% at 20% -10%, rgba(120, 220, 255, 0.16), transparent 60%),
		radial-gradient(90% 50% at 80% -5%, rgba(63, 224, 208, 0.12), transparent 65%);
	mix-blend-mode: screen;
	animation: vw360-caustics 14s ease-in-out infinite alternate;
	opacity: calc(0.9 - var(--vw360-depth) * 0.5);
}

@keyframes vw360-caustics {
	0%   { transform: translate3d(-2%, 0, 0) scale(1.05); filter: blur(0px); }
	100% { transform: translate3d(3%, 1.5%, 0) scale(1.12); filter: blur(2px); }
}

/* Vignette : la lumière tombe quand on descend. */
.vw360-map__vignette {
	background: radial-gradient(
		120% 100% at 50% 30%,
		transparent 35%,
		rgba(2, 10, 20, calc(0.35 + var(--vw360-depth) * 0.35)) 100%
	);
	z-index: 4;
}

.vw360-map__snow {
	width: 100%;
	height: 100%;
	opacity: 0.55;
	z-index: 5;
}

/* Balayage sonar. */
.vw360-sonar {
	background: conic-gradient(
		from 0deg,
		rgba(63, 224, 208, 0.085) 0deg,
		rgba(63, 224, 208, 0.055) 14deg,
		rgba(63, 224, 208, 0.02) 38deg,
		rgba(63, 224, 208, 0) 72deg,
		rgba(63, 224, 208, 0) 360deg
	);
	mix-blend-mode: screen;
	filter: blur(14px);
	animation: vw360-sweep 12s linear infinite;
	opacity: 0.6;
	z-index: 2;
	/* le balayage part du centre et déborde pour éviter les angles francs */
	inset: -30%;
	border-radius: 50%;
}

@keyframes vw360-sweep {
	to { transform: rotate(360deg); }
}

/* --- Chargement -------------------------------------------------------- */

.vw360-map__loader {
	position: absolute;
	inset: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	background: var(--vw360-abyss);
	font-size: 0.9rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	transition: opacity 0.6s ease, visibility 0.6s;
}

.vw360-map__loader.is-hidden {
	opacity: 0;
	visibility: hidden;
}

.vw360-map__loader span {
	width: 18px;
	height: 18px;
	border: 2px solid rgba(223, 246, 255, 0.25);
	border-top-color: var(--vw360-cyan);
	border-radius: 50%;
	animation: vw360-spin 0.9s linear infinite;
}

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

/* --- Marqueurs sonar --------------------------------------------------- */

.vw360-ping {
	--ping-color: #8899a6;
	position: relative;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	display: grid;
	place-items: center;
}

.vw360-ping__core {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--ping-color);
	box-shadow: 0 0 12px var(--ping-color), 0 0 3px #fff inset;
	transition: transform 0.25s ease;
}

.vw360-ping__ring {
	position: absolute;
	inset: 0;
	border: 1.5px solid var(--ping-color);
	border-radius: 50%;
	opacity: 0;
	animation: vw360-ping 3.2s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

.vw360-ping__ring--delay { animation-delay: 1.6s; }

@keyframes vw360-ping {
	0%   { transform: scale(0.4); opacity: 0.9; }
	70%  { opacity: 0.12; }
	100% { transform: scale(3.4); opacity: 0; }
}

.vw360-ping--live .vw360-ping__core {
	background: var(--vw360-cyan);
	box-shadow: 0 0 18px var(--vw360-cyan), 0 0 26px rgba(63, 224, 208, 0.5);
}

.vw360-ping__badge {
	position: absolute;
	top: -14px;
	right: -18px;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.06em;
	padding: 1px 5px;
	border-radius: 8px;
	background: var(--vw360-cyan);
	color: #04202a;
}

.vw360-ping__label {
	position: absolute;
	top: 120%;
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	white-space: nowrap;
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--vw360-foam);
	background: rgba(3, 16, 28, 0.82);
	border: 1px solid rgba(63, 224, 208, 0.28);
	padding: 3px 8px;
	border-radius: 6px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.vw360-ping.is-hover .vw360-ping__label {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.vw360-ping.is-hover .vw360-ping__core { transform: scale(1.5); }

/* --- Colonne latérale -------------------------------------------------- */

.vw360-ui {
	position: absolute;
	top: 1rem;
	left: 1rem;
	z-index: 10;
	width: min(300px, calc(100% - 2rem));
	max-height: calc(100% - 2rem);
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: 0.9rem;
	border-radius: 12px;
	background: rgba(4, 20, 33, 0.72);
	backdrop-filter: blur(14px);
	border: 1px solid rgba(63, 224, 208, 0.18);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

/* Poignée de feuille glissante : masquée sur grand écran. */
.vw360-ui__handle {
	display: none;
	align-items: center;
	gap: 0.6rem;
	width: 100%;
	padding: 0.35rem 0.2rem 0.5rem;
	border: 0;
	background: none;
	color: inherit;
	cursor: pointer;
}

.vw360-ui__grip {
	flex: none;
	width: 38px;
	height: 4px;
	border-radius: 999px;
	background: rgba(223, 246, 255, 0.35);
}

.vw360-ui__handle-count {
	flex: 1;
	text-align: left;
	font-size: 0.72rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	opacity: 0.75;
}

.vw360-ui__chevron {
	flex: none;
	width: 10px;
	height: 10px;
	border-right: 2px solid rgba(223, 246, 255, 0.6);
	border-bottom: 2px solid rgba(223, 246, 255, 0.6);
	transform: rotate(-135deg) translate(-2px, -2px);
	transition: transform 0.3s ease;
}

.vw360-ui.is-open .vw360-ui__chevron {
	transform: rotate(45deg) translate(-1px, -1px);
}

.vw360-ui__input {
	width: 100%;
	padding: 0.5rem 0.7rem;
	border-radius: 8px;
	border: 1px solid rgba(223, 246, 255, 0.16);
	background: rgba(2, 12, 22, 0.7);
	color: var(--vw360-foam);
	font-size: 0.9rem;
}

.vw360-ui__input::placeholder { color: rgba(223, 246, 255, 0.45); }
.vw360-ui__input:focus { outline: 2px solid var(--vw360-cyan); outline-offset: 1px; }

.vw360-ui__count {
	display: block;
	margin-top: 0.4rem;
	font-size: 0.72rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	opacity: 0.7;
}

.vw360-ui__toggle {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.8rem;
	cursor: pointer;
	opacity: 0.9;
}

.vw360-ui__body {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	flex: 1;
	min-height: 0;
}

.vw360-ui__list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	flex: 1;
	min-height: 0;
}

.vw360-ui__list li[hidden] { display: none; }

.vw360-ui__list button {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.45rem 0.35rem;
	background: none;
	border: 0;
	border-bottom: 1px solid rgba(223, 246, 255, 0.07);
	color: inherit;
	text-align: left;
	cursor: pointer;
	font-size: 0.85rem;
}

.vw360-ui__list button:hover { background: rgba(63, 224, 208, 0.09); }

.vw360-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.vw360-ui__name { flex: 1; }
.vw360-ui__depth { font-variant-numeric: tabular-nums; opacity: 0.6; font-size: 0.78rem; }

.vw360-ui__reset {
	border: 1px solid rgba(63, 224, 208, 0.35);
	background: transparent;
	color: var(--vw360-cyan);
	border-radius: 8px;
	padding: 0.4rem;
	font-size: 0.78rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
}

.vw360-ui__reset:hover { background: rgba(63, 224, 208, 0.12); }

/* --- Panneau épave ----------------------------------------------------- */

.vw360-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 12;
	width: min(360px, 100%);
	transform: translateX(105%);
	transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
	background: linear-gradient(180deg, rgba(6, 30, 48, 0.95), rgba(3, 16, 28, 0.97));
	backdrop-filter: blur(16px);
	border-left: 1px solid rgba(63, 224, 208, 0.22);
	overflow-y: auto;
}

.vw360-panel.is-open { transform: none; }

.vw360-panel__close {
	position: absolute;
	top: 0.6rem;
	right: 0.7rem;
	z-index: 2;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 1px solid rgba(223, 246, 255, 0.2);
	background: rgba(3, 16, 28, 0.7);
	color: var(--vw360-foam);
	font-size: 1.2rem;
	line-height: 1;
	cursor: pointer;
}

.vw360-panel__media img {
	width: 100%;
	height: 190px;
	object-fit: cover;
	display: block;
	filter: saturate(0.8) contrast(1.05) brightness(0.85);
}

.vw360-panel__body { padding: 1.1rem 1.2rem 1.6rem; }

.vw360-panel__body h3 {
	margin: 0 0 0.8rem;
	font-size: 1.35rem;
	line-height: 1.2;
	color: #fff;
}

.vw360-panel__facts {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
	display: grid;
	gap: 0.35rem;
}

.vw360-panel__facts li {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	font-size: 0.85rem;
	padding-bottom: 0.35rem;
	border-bottom: 1px dashed rgba(223, 246, 255, 0.12);
}

.vw360-panel__facts span { opacity: 0.6; }
.vw360-panel__facts b { font-weight: 600; text-align: right; }

.vw360-panel__excerpt { font-size: 0.9rem; line-height: 1.55; opacity: 0.85; }

.vw360-panel__notice {
	font-size: 0.78rem;
	color: #f2b544;
	opacity: 0.9;
}

.vw360-panel__cta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-top: 1rem;
	padding: 0.8rem 1rem;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--vw360-cyan), #2a9fd6);
	color: #03202a;
	font-weight: 700;
	text-decoration: none;
	letter-spacing: 0.02em;
	box-shadow: 0 10px 30px rgba(63, 224, 208, 0.25);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.vw360-panel__cta:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(63, 224, 208, 0.35); }
.vw360-panel__cta span { font-size: 0.75rem; opacity: 0.75; }

/* Épave sans visite 360 : le bouton reste cliquable — la fiche a de la valeur
   en elle-même — mais il ne promet pas ce qu'il ne peut pas tenir. */
.vw360-panel__cta.is-muted {
	background: rgba(223, 246, 255, 0.1);
	border: 1px solid rgba(223, 246, 255, 0.28);
	color: var(--vw360-foam);
	box-shadow: none;
}

.vw360-panel__cta.is-muted:hover {
	background: rgba(223, 246, 255, 0.16);
	box-shadow: none;
}

/* Disponibilité de la visite, annoncée avant le clic. */
.vw360-panel__facts b.is-ready { color: var(--vw360-cyan); }
.vw360-panel__facts b.is-soon { color: #f2b544; font-weight: 500; }

/* --- Transition de plongée --------------------------------------------- */

.vw360-dive {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: linear-gradient(180deg, #0b3a52 0%, #03101c 70%, #010810 100%);
	opacity: 0;
	transition: opacity 0.45s ease;
	display: grid;
	place-items: center;
	overflow: hidden;
}

.vw360-dive.is-active { opacity: 1; }

.vw360-dive__depth {
	font-size: clamp(2rem, 8vw, 4.5rem);
	font-weight: 200;
	letter-spacing: 0.1em;
	color: rgba(223, 246, 255, 0.85);
	font-variant-numeric: tabular-nums;
	text-shadow: 0 0 40px rgba(63, 224, 208, 0.5);
}

.vw360-dive__bubbles { position: absolute; inset: 0; }

.vw360-dive__bubbles i {
	position: absolute;
	bottom: -40px;
	width: var(--size, 8px);
	height: var(--size, 8px);
	border-radius: 50%;
	border: 1px solid rgba(223, 246, 255, 0.5);
	background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.05));
	animation: vw360-bubble 1.6s ease-in forwards;
}

@keyframes vw360-bubble {
	from { transform: translateY(0) scale(0.6); opacity: 0; }
	20%  { opacity: 0.9; }
	to   { transform: translateY(-110vh) scale(1.1); opacity: 0; }
}

/* --- Relief 3D & sonde -------------------------------------------------- */

.vw360-relief-btn {
	font-size: 15px;
	line-height: 1;
	color: #dff6ff;
	background: transparent;
	cursor: pointer;
}

.vw360-relief-btn.is-active {
	background: rgba(63, 224, 208, 0.22);
	color: #3fe0d0;
}

.vw360-sounding {
	position: absolute;
	left: 50%;
	bottom: 1.1rem;
	transform: translateX(-50%);
	z-index: 11;
	pointer-events: none;
	font-variant-numeric: tabular-nums;
	font-size: 0.85rem;
	letter-spacing: 0.1em;
	color: #9ff0e4;
}

.vw360-sounding span:not(:empty) {
	display: inline-block;
	padding: 0.25rem 0.7rem;
	border-radius: 999px;
	background: rgba(3, 16, 28, 0.72);
	border: 1px solid rgba(63, 224, 208, 0.3);
	backdrop-filter: blur(8px);
}

/* En relief 3D, on allège l'ambiance pour ne pas voiler le fond marin. */
.vw360-map-wrap.has-relief .vw360-map__caustics { opacity: 0.25; }
.vw360-map-wrap.has-relief .vw360-sonar { opacity: 0.25; }
.vw360-map-wrap.has-relief .vw360-map__snow { opacity: 0.3; }

/* --- Contrôles MapLibre au diapason ------------------------------------ */

.vw360-map-wrap .maplibregl-ctrl-group {
	background: rgba(4, 20, 33, 0.75);
	border: 1px solid rgba(63, 224, 208, 0.2);
	backdrop-filter: blur(10px);
}

.vw360-map-wrap .maplibregl-ctrl-group button + button { border-top-color: rgba(63, 224, 208, 0.18); }
.vw360-map-wrap .maplibregl-ctrl-group button span { filter: invert(1) hue-rotate(180deg); }
.vw360-map-wrap .maplibregl-ctrl-attrib { background: rgba(3, 16, 28, 0.7); color: #9fc7d8; }
.vw360-map-wrap .maplibregl-ctrl-attrib a { color: #9fc7d8; }
.vw360-map-wrap .maplibregl-ctrl-scale { background: rgba(3, 16, 28, 0.6); border-color: rgba(223, 246, 255, 0.4); color: #dff6ff; }

/* --- Responsive & accessibilité ---------------------------------------- */

/* --- Mobile : la recherche devient une feuille glissante ---------------- */

@media (max-width: 782px) {

	.vw360-map-wrap {
		border-radius: 0;
		min-height: 78vh;
	}

	.vw360-ui {
		top: auto;
		bottom: 0;
		left: 0;
		width: 100%;
		max-height: 82%;
		gap: 0.5rem;
		padding: 0.3rem 0.9rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
		border-radius: 16px 16px 0 0;
		border-left: 0;
		border-right: 0;
		border-bottom: 0;
		box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.5);
	}

	.vw360-ui__handle { display: flex; }

	/* Le compteur vit dans la poignée : on évite le doublon. */
	.vw360-ui__count { display: none; }

	.vw360-ui__input {
		/* 16px : empêche iOS de zoomer au focus. */
		font-size: 16px;
		padding: 0.65rem 0.8rem;
	}

	/* Repli / dépli sans casser le scroll interne de la liste. */
	.vw360-ui__body {
		max-height: 0;
		opacity: 0;
		overflow: hidden;
		transition: max-height 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
	}

	/* On garde volontairement ~40 % de carte visible sous la liste. */
	.vw360-ui.is-open .vw360-ui__body {
		max-height: 50vh;
		opacity: 1;
	}

	.vw360-ui__list { max-height: 38vh; }

	/* Cibles tactiles confortables. */
	.vw360-ui__list button {
		padding: 0.7rem 0.35rem;
		font-size: 0.95rem;
	}

	.vw360-ui__toggle { padding: 0.3rem 0; font-size: 0.88rem; }
	.vw360-ui__reset { padding: 0.65rem; }

	/* Les contrôles MapLibre remontent au-dessus de la feuille. */
	.vw360-map-wrap .maplibregl-ctrl-bottom-left,
	.vw360-map-wrap .maplibregl-ctrl-bottom-right {
		bottom: calc(108px + env(safe-area-inset-bottom, 0px));
	}

	.vw360-sounding { bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }

	/* Fiche épave : feuille glissante elle aussi, par-dessus la recherche. */
	.vw360-panel {
		width: 100%;
		top: auto;
		height: 78%;
		transform: translateY(105%);
		border-left: 0;
		border-top: 1px solid rgba(63, 224, 208, 0.22);
		border-radius: 16px 16px 0 0;
		z-index: 14;
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}

	.vw360-panel.is-open { transform: none; }
	.vw360-panel__media img { height: 150px; }
	.vw360-panel__close { width: 40px; height: 40px; }

	/* Étiquette du marqueur : le survol n'existe pas, on l'affiche au tap. */
	.vw360-ping__label { font-size: 10px; }
}

/* Téléphone en paysage : très peu de hauteur disponible. */
@media (max-width: 900px) and (max-height: 480px) {
	.vw360-ui { max-height: 92%; }
	.vw360-ui.is-open .vw360-ui__body { max-height: 46vh; }
	.vw360-ui__list { max-height: 34vh; }
	.vw360-panel { height: 92%; }
}

@media (prefers-reduced-motion: reduce) {
	.vw360-map__caustics,
	.vw360-sonar,
	.vw360-ping__ring { animation: none; }
	.vw360-map__caustics { opacity: 0.4; }
	.vw360-sonar { display: none; }
}

/* Épave mise en avant par le bloc « Position ». */
.vw360-ping.is-focus .vw360-ping__core { transform: scale(1.6); }
.vw360-ping.is-focus .vw360-ping__label { opacity: 1; transform: translateX(-50%) translateY(0); }
