/* Nova Références — carte du monde */

.novaref {
	--nr-radius: 10px;
	--nr-line: color-mix(in srgb, var(--nr-text) 14%, transparent);
	--nr-card: color-mix(in srgb, var(--nr-bg) 88%, #fff 4%);
	--nr-shadow: 0 24px 48px -12px rgba(0, 0, 0, .55);
	--nr-on-accent: #fff;
	--nr-tank-shadow: rgba(0, 0, 0, .35);
	--nr-halo: 42%;
	position: relative;
	font-family: var(--nr-font);
	color: var(--nr-text);
	background: var(--nr-bg);
	border-radius: var(--nr-radius);
	padding: clamp(20px, 3vw, 36px);
	overflow: hidden;
	isolation: isolate;
}
.novaref *, .novaref *::before, .novaref *::after { box-sizing: border-box; }

/* ── Counters ─────────────────────────────────────── */
.novaref-counters {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 0;
	margin: 0 0 22px;
}
.novaref-counter {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 0 clamp(18px, 3vw, 40px);
	border-left: 1px solid var(--nr-line);
}
.novaref-counter:first-child { padding-left: 0; border-left: 0; }
.novaref-counter__n {
	font-size: clamp(30px, 4vw, 48px);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -.01em;
	font-variant-numeric: tabular-nums;
}
.novaref-counter__l {
	font-size: 13px;
	font-weight: 500;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--nr-muted);
}

/* ── Filters ──────────────────────────────────────── */
.novaref-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 18px;
}
.novaref .nr-pill {
	--c: var(--nr-accent);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 38px;
	padding: 0 16px;
	border: 1.5px solid var(--nr-line);
	border-radius: 8px;
	background: transparent;
	color: var(--nr-text) !important; /* beat theme (Divi) button colors */
	-webkit-text-fill-color: currentColor;
	text-shadow: none;
	font: 500 14px/1 var(--nr-font);
	letter-spacing: .02em;
	cursor: pointer;
	transition: border-color .2s, background .2s, transform .2s;
}
.novaref .nr-pill:hover { border-color: color-mix(in srgb, var(--nr-text) 60%, transparent); }
.novaref .nr-pill:focus-visible { outline: 2px solid var(--nr-accent); outline-offset: 2px; }
.novaref .nr-pill i {
	width: 10px;
	height: 10px;
	border-radius: 2px;
	border: 2.5px solid var(--c);
}
.novaref .nr-pill small {
	font-size: 12px;
	color: var(--nr-muted);
	font-variant-numeric: tabular-nums;
}
.novaref .nr-pill.is-active,
.novaref .nr-pill.is-active:hover,
.novaref .nr-pill.is-active:focus {
	color: var(--nr-on-accent) !important;
	-webkit-text-fill-color: var(--nr-on-accent);
	background: var(--nr-accent);
	border-color: var(--nr-accent);
}
.novaref .nr-pill.is-active small { color: color-mix(in srgb, var(--nr-on-accent) 80%, transparent); }
.novaref .nr-pill.is-active i { border-color: var(--nr-on-accent); }

/* ── Map stage ────────────────────────────────────── */
.novaref-stage {
	position: relative;
	height: var(--nr-h);
	margin: 0 calc(-1 * clamp(20px, 3vw, 36px)) calc(-1 * clamp(20px, 3vw, 36px));
}
.novaref-map {
	position: absolute;
	inset: 0;
	background: transparent !important;
	font-family: var(--nr-font);
	opacity: 0;
	transition: opacity .6s ease;
	outline: none;
}
.novaref.is-ready .novaref-map { opacity: 1; }
/* Soft vignette so the map melts into the block */
.novaref-stage::after {
	content: '';
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 500;
	background:
		linear-gradient(to bottom, var(--nr-bg) 0, transparent 44px, transparent calc(100% - 44px), var(--nr-bg) 100%),
		linear-gradient(to right, var(--nr-bg) 0, transparent 40px, transparent calc(100% - 40px), var(--nr-bg) 100%);
}

.novaref .leaflet-container { background: transparent; font-family: var(--nr-font); }
.novaref .leaflet-container a { color: inherit; }

.novaref .nr-land { stroke: var(--nr-border); stroke-opacity: .9; transition: fill .4s; }
.novaref .nr-land.no-dots { fill: var(--nr-land); }
.novaref .nr-land.no-dots.is-active { fill: var(--nr-active); }
.novaref .nr-graticule { stroke: var(--nr-border); stroke-opacity: .35; fill: none; }

/* ── Picto marker ─────────────────────────────────── */
.novaref .nr-marker { background: none; border: 0; }
.novaref .nr-picto {
	display: block;
	width: 24px;
	height: 32px;
	overflow: visible;
	transition: transform .25s cubic-bezier(.2,.8,.2,1), filter .25s;
	transform-origin: 50% 94%;
}
.nr-picto__shadow { fill: var(--nr-tank-shadow); }
.nr-picto__body { fill: color-mix(in srgb, var(--nr-tank) 18%, var(--nr-bg)); }
.nr-picto__line { stroke: var(--nr-tank); stroke-opacity: .45; stroke-width: .8; fill: none; }
.nr-picto__shell { fill: none; stroke: var(--nr-tank); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.nr-picto__ring { fill: var(--c); transition: filter .25s; }
.nr-picto--pin .nr-picto__shadow { rx: 4.5px; }
.novaref .nr-marker:hover .nr-picto,
.novaref .nr-marker:focus-visible .nr-picto {
	transform: translateY(-3px) scale(1.18);
	filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45));
}
.novaref .nr-marker:focus-visible { outline: none; }
.novaref .nr-marker:hover .nr-picto__ring { filter: brightness(1.2); }

/* ── Clusters: core + category ring + density halo ── */
.novaref .nr-cluster { background: none; border: 0; }
.nr-cluster > span {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	border-radius: 50%;
}
.nr-cluster__halo {
	background: radial-gradient(circle, color-mix(in srgb, var(--nr-accent) var(--nr-halo), transparent) 0, color-mix(in srgb, var(--nr-accent) 14%, transparent) 45%, transparent 70%);
	animation: nr-breathe 3.2s ease-in-out infinite;
	pointer-events: none;
}
.nr-cluster__ring {
	-webkit-mask: radial-gradient(circle, transparent calc(50% - 3px), #000 calc(50% - 2.5px));
	mask: radial-gradient(circle, transparent calc(50% - 3px), #000 calc(50% - 2.5px));
	opacity: .95;
}
.nr-cluster__core {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--nr-accent);
	color: #fff;
	font: 700 14px/1 var(--nr-font);
	font-variant-numeric: tabular-nums;
	box-shadow: 0 0 0 2px var(--nr-bg), 0 6px 18px rgba(0, 0, 0, .35);
	transition: transform .25s cubic-bezier(.2,.8,.2,1);
	cursor: pointer;
}
.novaref .nr-cluster:hover .nr-cluster__core { transform: translate(-50%, -50%) scale(1.1); }
.novaref .nr-cluster:hover .nr-cluster__halo { animation-duration: 1.4s; }

@keyframes nr-breathe {
	0%, 100% { transform: translate(-50%, -50%) scale(.85); opacity: .75; }
	50%      { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
}

/* markercluster animations (replaces MarkerCluster.css) */
.novaref .leaflet-cluster-anim .leaflet-marker-icon,
.novaref .leaflet-cluster-anim .leaflet-marker-shadow { transition: transform .3s ease-out, opacity .3s ease-in; }
.novaref .leaflet-cluster-spider-leg { stroke: var(--nr-muted); transition: stroke-dashoffset .3s ease-out, stroke-opacity .3s ease-in; }

/* ── Hover card ───────────────────────────────────── */
.novaref-card {
	--c: var(--nr-accent);
	position: absolute;
	z-index: 800;
	width: 280px;
	max-width: calc(100% - 20px);
	background: var(--nr-card);
	border: 1px solid var(--nr-line);
	border-radius: var(--nr-radius);
	box-shadow: var(--nr-shadow);
	overflow: hidden;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .18s ease, transform .22s cubic-bezier(.2,.8,.2,1);
	pointer-events: auto;
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}
.novaref-card.is-below { transform: translateY(-6px); }
.novaref-card.is-in { opacity: 1; transform: none; }
.novaref-card[hidden] { display: none; }

.nr-card__img {
	height: 132px;
	background: center / cover no-repeat;
	border-bottom: 3px solid var(--c);
}
.nr-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px 18px 18px;
}
.nr-card__cat {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--c);
}
.nr-card__cat i { width: 14px; height: 3px; background: var(--c); }
.nr-card__title {
	font-size: 19px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--nr-text);
}
.nr-card__title.is-anon { font-weight: 600; color: color-mix(in srgb, var(--nr-text) 85%, transparent); font-style: italic; }
.nr-card__place { font-size: 14px; color: var(--nr-muted); }
.nr-card__facts {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 4px;
	font-size: 14px;
	color: var(--nr-text);
	font-variant-numeric: tabular-nums;
}
.nr-card__facts b { font-size: 17px; font-weight: 700; }
.nr-card__facts em { width: 1px; height: 14px; background: var(--nr-line); }

.novaref .nr-card__link {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 10px;
	padding: 8px 8px 8px 16px;
	border: 1.5px solid color-mix(in srgb, var(--nr-text) 85%, transparent);
	border-radius: 8px;
	color: var(--nr-text);
	font-size: 14px;
	font-weight: 500;
	letter-spacing: .02em;
	text-decoration: none;
	transition: background .2s, border-color .2s;
}
.novaref .nr-card__link:hover { color: var(--nr-on-accent); background: var(--nr-accent); border-color: var(--nr-accent); }
.nr-arrow {
	display: inline-grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--nr-accent);
	transition: background .2s, transform .2s;
}
.nr-arrow svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.novaref .nr-card__link:hover .nr-arrow { background: #fff; transform: translateX(2px); }
.novaref .nr-card__link:hover .nr-arrow svg { stroke: var(--nr-accent); }

.nr-card--cluster { width: 250px; }
.nr-card__count { font-size: 28px; font-weight: 700; line-height: 1; }
.nr-card__count span { font-size: 13px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--nr-muted); }
.nr-card__bars { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.nr-card__bars li {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 4px 10px;
	font-size: 13px;
	margin: 0;
	padding: 0;
}
.nr-card__bars b { font-variant-numeric: tabular-nums; }
.nr-card__bars i {
	grid-column: 1 / -1;
	height: 3px;
	border-radius: 2px;
	background: var(--c);
	min-width: 4px;
}

/* ── Controls ─────────────────────────────────────── */
.nr-controls {
	position: absolute;
	right: clamp(16px, 3vw, 32px);
	bottom: clamp(16px, 3vw, 32px);
	z-index: 700;
	display: flex;
	flex-direction: column;
	border: 1px solid var(--nr-line);
	border-radius: 8px;
	overflow: hidden;
	background: color-mix(in srgb, var(--nr-bg) 80%, transparent);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}
.novaref .nr-controls button {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	margin: 0;
	border: 0;
	border-top: 1px solid var(--nr-line);
	background: transparent;
	color: var(--nr-text);
	cursor: pointer;
	transition: background .2s;
}
.novaref .nr-controls button:first-child { border-top: 0; }
.novaref .nr-controls button:hover { color: var(--nr-on-accent); background: var(--nr-accent); }
.novaref .nr-controls button:focus-visible { outline: 2px solid var(--nr-accent); outline-offset: -2px; }
.nr-controls svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }

/* ── Light theme ──────────────────────────────────── */
.novaref--light {
	--nr-line: color-mix(in srgb, var(--nr-text) 13%, transparent);
	--nr-card: #fff;
	--nr-shadow: 0 28px 56px -18px color-mix(in srgb, var(--nr-text) 35%, transparent), 0 2px 6px color-mix(in srgb, var(--nr-text) 7%, transparent);
	--nr-tank-shadow: color-mix(in srgb, var(--nr-text) 22%, transparent);
	--nr-halo: 30%;
}
/* Soft light pool behind the continents */
.novaref--light .novaref-stage {
	background: radial-gradient(ellipse 60% 55% at 50% 48%, #fff 0, color-mix(in srgb, #fff 40%, transparent) 55%, transparent 80%);
}
.novaref--light .nr-land { stroke-opacity: 1; stroke-width: .9px; }
.novaref--light .nr-graticule { stroke: var(--nr-dots); stroke-opacity: .55; }
.novaref--light .nr-picto__body { fill: color-mix(in srgb, var(--nr-tank) 9%, #fff); }
.novaref--light .nr-picto__line { stroke-opacity: .3; }
.novaref--light .nr-cluster__core { box-shadow: 0 0 0 2.5px #fff, 0 8px 20px -4px color-mix(in srgb, var(--nr-accent) 55%, transparent); }
.novaref--light .novaref-counter__n { color: var(--nr-text); }
.novaref--light .nr-controls { background: #fff; box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--nr-text) 30%, transparent); }
.novaref--light .novaref-card { -webkit-backdrop-filter: none; backdrop-filter: none; }
.novaref--light .nr-card__img { border-bottom-width: 3px; }

@media (max-width: 767px) {
	.novaref-stage { height: var(--nr-h-m); }
	.novaref-counter { padding: 0 16px; }
	.novaref-counter__l { font-size: 11px; }
	.novaref-filters { flex-wrap: nowrap; overflow-x: auto; margin-right: calc(-1 * clamp(20px, 3vw, 36px)); padding-bottom: 4px; scrollbar-width: none; }
	.novaref-filters::-webkit-scrollbar { display: none; }
	.novaref .nr-pill { flex: 0 0 auto; }
	.novaref-card { width: 250px; }
	.novaref-stage::after {
		background:
			linear-gradient(to bottom, var(--nr-bg) 0, transparent 24px, transparent calc(100% - 24px), var(--nr-bg) 100%),
			linear-gradient(to right, var(--nr-bg) 0, transparent 16px, transparent calc(100% - 16px), var(--nr-bg) 100%);
	}
	.nr-cluster__core { font-size: 12px; }
	.nr-card__img { height: 110px; }
}

@media (prefers-reduced-motion: reduce) {
	.nr-cluster__halo { animation: none; }
	.novaref *, .novaref *::before, .novaref *::after { transition-duration: .01ms !important; }
}
