/**
 * TRVL — Descoperă România pe județe (homepage discovery map).
 * Dark, cinematic section directly below the hero.
 */

/* `.home-section` gives every homepage section `position: relative; z-index: 1`,
   which makes each one its own stacking context. The mobile popup is a fixed
   bottom sheet that reaches past the section box, so while it is open the whole
   section has to outrank the sections below it — but stay under the sticky
   header (50) and the mobile bottom nav (100). */
.home-county-discovery.is-popup-open {
	z-index: 40;
}

.home-county-discovery {
	--cd-surface: #12151c;
	--cd-surface-raised: rgba(255, 255, 255, 0.05);
	--cd-border: rgba(245, 240, 232, 0.12);
	--cd-text: #f5f0e8;
	--cd-text-muted: rgba(245, 240, 232, 0.66);
	--cd-text-faint: rgba(245, 240, 232, 0.44);
	--cd-accent: #ff8a3d;
	--cd-accent-strong: #ff641a;

	position: relative;
	padding-block: clamp(2.5rem, 5.5vw, 4rem);
	background:
		radial-gradient(120% 90% at 78% 12%, rgba(255, 138, 61, 0.14) 0%, rgba(255, 138, 61, 0) 58%),
		linear-gradient(180deg, #0d0f14 0%, #141821 52%, #10131a 100%);
	color: var(--cd-text);
	overflow: hidden;
}

.county-discovery__grid {
	display: grid;
	gap: clamp(1.5rem, 3vw, 2.25rem);
	align-items: start;
}

@media (min-width: 992px) {
	.county-discovery__grid {
		grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
		gap: clamp(2rem, 3.5vw, 3.25rem);
	}
}

/* ── Left: editorial ─────────────────────────────────────── */

.county-discovery__overline {
	margin: 0 0 0.75rem;
	font-family: var(--font-ui);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--cd-accent);
}

.county-discovery__title {
	margin: 0 0 0.75rem;
	font-family: var(--font-heading);
	font-size: clamp(1.75rem, 2.4vw + 1rem, 2.75rem);
	font-weight: 700;
	line-height: 1.12;
	letter-spacing: -0.02em;
	color: #fff;
}

.county-discovery__lede {
	margin: 0 0 clamp(1.25rem, 2.5vw, 1.75rem);
	max-width: 32rem;
	font-size: clamp(0.95rem, 0.35vw + 0.88rem, 1.05rem);
	line-height: 1.6;
	color: var(--cd-text-muted);
}

.county-discovery__county {
	position: relative;
	padding: clamp(1rem, 2vw, 1.35rem) clamp(1rem, 2vw, 1.4rem);
	border: 1px solid var(--cd-border);
	border-radius: var(--trvl-radius-md);
	background: var(--cd-surface-raised);
}

.county-discovery__county::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: 3px;
	border-radius: var(--trvl-radius-md) 0 0 var(--trvl-radius-md);
	background: linear-gradient(180deg, var(--cd-accent) 0%, rgba(255, 138, 61, 0) 100%);
}

.county-discovery__county-eyebrow {
	margin: 0 0 0.3rem;
	font-family: var(--font-ui);
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--cd-text-faint);
}

.county-discovery__county-name {
	margin: 0 0 0.35rem;
	font-family: var(--font-heading);
	font-size: clamp(1.5rem, 1.6vw + 1rem, 2rem);
	font-weight: 700;
	line-height: 1.1;
	color: #fff;
}

.county-discovery__county-essence {
	margin: 0 0 0.6rem;
	font-size: 0.98rem;
	font-weight: 600;
	line-height: 1.45;
	color: var(--cd-accent);
}

/* The one memorable thing about the county — set apart from the description. */
.county-discovery__county-fact {
	margin: 0 0 0.6rem;
	padding-left: 0.7rem;
	border-left: 2px solid rgba(255, 138, 61, 0.35);
	font-size: 0.9rem;
	font-style: italic;
	line-height: 1.55;
	color: rgba(245, 240, 232, 0.82);
}

.county-discovery__county-fact[hidden] {
	display: none;
}

.county-discovery__county-text {
	margin: 0;
	font-size: 0.93rem;
	line-height: 1.6;
	color: var(--cd-text-muted);
}

.county-discovery__county.is-switching .county-discovery__county-name,
.county-discovery__county.is-switching .county-discovery__county-essence,
.county-discovery__county.is-switching .county-discovery__county-fact,
.county-discovery__county.is-switching .county-discovery__county-text {
	animation: county-discovery-swap 0.32s ease both;
}

@keyframes county-discovery-swap {
	from {
		opacity: 0;
		transform: translateY(5px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.county-discovery__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
	margin-top: clamp(1.1rem, 2vw, 1.5rem);
}

.county-discovery__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 2.9rem;
	padding: 0.7rem 1.35rem;
	border-radius: var(--radius-ui);
	background: var(--cd-accent-strong);
	color: #14100c;
	font-family: var(--font-ui);
	font-size: 0.95rem;
	font-weight: 700;
	text-decoration: none;
	transition: background-color 0.2s ease, transform 0.15s ease;
}

.county-discovery__cta:hover,
.county-discovery__cta:focus-visible {
	background: #ff7a33;
	color: #14100c;
	text-decoration: none;
	transform: translateY(-1px);
}

.county-discovery__cta:focus-visible {
	outline: 2px solid var(--cd-accent);
	outline-offset: 3px;
}

.county-discovery__cta--unavailable,
.county-discovery__cta--unavailable:hover,
.county-discovery__cta--unavailable:focus-visible {
	background: rgba(245, 240, 232, 0.12);
	color: var(--cd-text-muted);
	cursor: not-allowed;
	transform: none;
	pointer-events: none;
}

.county-discovery__hint {
	margin: 0.8rem 0 0;
	font-size: 0.82rem;
	line-height: 1.5;
	color: var(--cd-text-faint);
}

/* ── Right: map stage ────────────────────────────────────── */

.county-discovery__stage {
	display: grid;
	gap: 0.7rem;
}

.county-discovery__random {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 2.9rem;
	padding: 0.5rem 0.95rem;
	border: 1px solid var(--cd-border);
	border-radius: var(--radius-ui);
	background: rgba(255, 255, 255, 0.05);
	color: var(--cd-text);
	font-family: var(--font-ui);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.county-discovery__random:hover {
	border-color: rgba(255, 138, 61, 0.55);
	background: rgba(255, 138, 61, 0.1);
}

.county-discovery__random:focus-visible {
	outline: 2px solid var(--cd-accent);
	outline-offset: 2px;
}

.county-discovery__map-card {
	position: relative;
	border: 1px solid var(--cd-border);
	border-radius: var(--trvl-radius-lg);
	background:
		radial-gradient(90% 70% at 50% 0%, rgba(255, 138, 61, 0.08) 0%, rgba(255, 138, 61, 0) 60%),
		linear-gradient(170deg, #171c25 0%, #10131a 100%);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
	overflow: hidden;
}

/* Leaflet puts .leaflet-container on the map element itself, so both selectors
   target the same node; the compound one outranks Leaflet default styling. */
.home-county-discovery .county-discovery__map,
.home-county-discovery .county-discovery__map.leaflet-container {
	position: relative;
	/* Own stacking context: keeps Leaflet's panes (z-index 400+) below the popup. */
	z-index: 0;
	width: 100%;
	height: clamp(300px, 42vw, 520px);
	background: transparent;
	font-family: inherit;
	outline: none;
}

.county-discovery__shape {
	cursor: pointer;
	transition: fill 0.22s ease, stroke 0.22s ease;
}

.county-discovery__shape:focus-visible {
	outline: 2px solid var(--cd-accent);
	outline-offset: 2px;
}

/* County abbreviations drawn over the map. Purely decorative: every pointer
   and keyboard interaction belongs to the polygon underneath. */
.home-county-discovery .county-discovery__label {
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	font-family: var(--font-ui);
	font-size: clamp(0.58rem, 1.15vw, 0.74rem);
	font-weight: 800;
	letter-spacing: 0.06em;
	color: rgba(245, 240, 232, 0.72);
	text-shadow: 0 1px 3px rgba(8, 10, 14, 0.9), 0 0 8px rgba(8, 10, 14, 0.75);
	transition: color 0.2s ease, text-shadow 0.2s ease;
}

.home-county-discovery .county-discovery__label.is-hover {
	color: #fff;
	text-shadow: 0 1px 3px rgba(8, 10, 14, 0.9), 0 0 10px rgba(255, 138, 61, 0.55);
}

.home-county-discovery .county-discovery__label.is-active {
	color: #14100c;
	text-shadow: 0 1px 2px rgba(255, 196, 150, 0.55);
}

.county-discovery__attrib {
	margin: 0;
	font-size: 0.7rem;
	color: rgba(245, 240, 232, 0.32);
	text-align: right;
}

/* No-JS / failed geometry fallback: plain county links. */

.county-discovery__fallback {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: clamp(1rem, 3vw, 2rem);
	list-style: none;
}

.county-discovery__fallback li {
	padding: 0.4rem 0.75rem;
	border: 1px solid var(--cd-border);
	border-radius: var(--radius-chip);
	font-size: 0.85rem;
	color: var(--cd-text-muted);
}

.county-discovery__fallback a {
	color: inherit;
	text-decoration: none;
}

.county-discovery__fallback a:hover {
	color: var(--cd-accent);
}

.home-county-discovery.is-map-ready .county-discovery__fallback {
	display: none;
}

.home-county-discovery.is-map-failed .county-discovery__map {
	display: none;
}

/* ── Floating discovery popup ────────────────────────────── */

.county-discovery__popup {
	position: absolute;
	left: 1rem;
	bottom: 1rem;
	z-index: 2;
	display: flex;
	flex-direction: column;
	width: min(21rem, calc(100% - 2rem));
	max-height: calc(100% - 2rem);
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: var(--trvl-radius-md);
	background: rgba(14, 17, 23, 0.92);
	box-shadow: 0 28px 64px rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(14px);
	overflow: hidden;
	outline: none;
	animation: county-discovery-pop 0.28s ease both;
}

.county-discovery__popup[data-anchor="right"] {
	left: auto;
	right: 1rem;
}

.county-discovery__popup[hidden] {
	display: none;
}

@keyframes county-discovery-pop {
	from {
		opacity: 0;
		transform: translateY(10px) scale(0.985);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.county-discovery__popup-close {
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	z-index: 4;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: var(--radius-sm);
	background: rgba(12, 14, 19, 0.72);
	color: var(--cd-text);
	cursor: pointer;
}

.county-discovery__popup-close:hover {
	background: rgba(255, 138, 61, 0.22);
}

.county-discovery__popup-close:focus-visible {
	outline: 2px solid var(--cd-accent);
	outline-offset: 2px;
}

.county-discovery__popup-visual {
	position: relative;
	flex: 0 0 auto;
	aspect-ratio: 3 / 2;
	background: linear-gradient(145deg, #243040 0%, #131922 100%);
	overflow: hidden;
}

.county-discovery__popup-visual[data-category="natura"] {
	background: linear-gradient(145deg, #1d3a33 0%, #101a19 100%);
}

.county-discovery__popup-visual[data-category="istorie"] {
	background: linear-gradient(145deg, #3d2f1d 0%, #1a1510 100%);
}

.county-discovery__popup-visual[data-category="traditie"] {
	background: linear-gradient(145deg, #3d2028 0%, #1a1013 100%);
}

.county-discovery__popup-visual[data-category="experienta"] {
	background: linear-gradient(145deg, #2c2745 0%, #14121f 100%);
}

.county-discovery__popup-visual[data-category="drum"] {
	background: linear-gradient(145deg, #1f3146 0%, #101720 100%);
}

.county-discovery__popup-visual[data-category="gastronomie"] {
	background: linear-gradient(145deg, #43291a 0%, #1c1310 100%);
}

.county-discovery__popup-image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.county-discovery__popup-visual::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background: linear-gradient(
		180deg,
		rgba(0, 0, 0, 0) 0%,
		rgba(0, 0, 0, 0.08) 42%,
		rgba(0, 0, 0, 0.38) 68%,
		rgba(0, 0, 0, 0.66) 100%
	);
}

.county-discovery__popup-credit {
	position: absolute;
	left: 0.7rem;
	top: 2.55rem;
	z-index: 3;
	max-width: 58%;
	padding: 0.15rem 0.4rem;
	border-radius: 6px;
	background: rgba(10, 12, 16, 0.55);
	color: rgba(245, 240, 232, 0.78);
	font-size: 0.58rem;
	line-height: 1.3;
}

.county-discovery__popup-shape {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 78%;
	height: 78%;
	transform: translate(-50%, -50%);
	fill: rgba(255, 138, 61, 0.16);
	stroke: rgba(255, 176, 122, 0.5);
	stroke-width: 0.6;
}

.county-discovery__popup-image:not([hidden]) ~ .county-discovery__popup-shape {
	display: none;
}

.county-discovery__popup-badge {
	position: absolute;
	top: 0.7rem;
	left: 0.7rem;
	z-index: 3;
	padding: 0.25rem 0.5rem;
	border-radius: var(--radius-sm);
	background: rgba(255, 100, 26, 0.92);
	color: #14100c;
	font-family: var(--font-ui);
	font-size: 0.62rem;
	font-weight: 800;
	letter-spacing: 0.12em;
}

.county-discovery__popup-overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	display: grid;
	gap: 0.2rem;
	padding: 1.4rem 0.9rem 0.85rem;
	pointer-events: none;
}

.county-discovery__popup-category {
	justify-self: start;
	padding: 0;
	border: 0;
	background: transparent;
	font-family: var(--font-ui);
	font-size: 0.66rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.86);
}

.county-discovery__popup-body {
	flex: 1 1 auto;
	padding: 0.8rem 1rem 0.9rem;
	overflow-y: auto;
	scrollbar-width: none;
}

.county-discovery__popup-body::-webkit-scrollbar {
	display: none;
}

.county-discovery__popup-title {
	margin: 0;
	font-family: var(--font-heading);
	font-size: clamp(1.2rem, 1vw + 1rem, 1.45rem);
	font-weight: 700;
	line-height: 1.15;
	color: #fff;
	text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.county-discovery__popup-area {
	margin: 0;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: rgba(255, 255, 255, 0.78);
}

.county-discovery__popup-text {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	margin: 0 0 0.7rem;
	overflow: hidden;
	font-size: 0.87rem;
	line-height: 1.55;
	color: var(--cd-text-muted);
}

/* Exactly two curated picks, so they fit side by side without scrolling. */
.county-discovery__popup-picks {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.4rem;
	margin-bottom: 0.7rem;
}

.county-discovery__pick {
	display: grid;
	gap: 0.15rem;
	min-width: 0;
	padding: 0.45rem 0.6rem;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: var(--radius-sm);
	background: rgba(255, 255, 255, 0.04);
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.county-discovery__pick:hover {
	border-color: rgba(255, 138, 61, 0.5);
	background: rgba(255, 138, 61, 0.1);
}

.county-discovery__pick.is-active {
	border-color: rgba(255, 138, 61, 0.75);
	background: rgba(255, 138, 61, 0.18);
}

.county-discovery__pick:focus-visible {
	outline: 2px solid var(--cd-accent);
	outline-offset: 2px;
}

.county-discovery__pick-category {
	font-family: var(--font-ui);
	font-size: 0.6rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--cd-text-faint);
}

.county-discovery__pick-title {
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.25;
	color: var(--cd-text);
}

.county-discovery__popup-actions {
	display: grid;
	gap: 0.4rem;
}

.county-discovery__popup-cta,
.county-discovery__popup-alt {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.45rem;
	padding: 0.5rem 0.9rem;
	border-radius: var(--radius-ui);
	font-family: var(--font-ui);
	font-size: 0.85rem;
	font-weight: 700;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.county-discovery__popup-cta {
	border: 0;
	background: var(--cd-accent-strong);
	color: #14100c;
	transition: background-color 0.2s ease;
}

.county-discovery__popup-cta:hover,
.county-discovery__popup-cta:focus-visible {
	background: #ff7a33;
	color: #14100c;
	text-decoration: none;
}

.county-discovery__popup-alt {
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: transparent;
	color: var(--cd-text-muted);
	transition: color 0.2s ease, border-color 0.2s ease;
}

.county-discovery__popup-alt:hover {
	border-color: rgba(255, 138, 61, 0.55);
	color: #fff;
}

.county-discovery__popup-cta:focus-visible,
.county-discovery__popup-alt:focus-visible {
	outline: 2px solid var(--cd-accent);
	outline-offset: 2px;
}

/* ── Mobile: popup becomes a bottom sheet ────────────────── */

@media (max-width: 767px) {
	.county-discovery__actions {
		gap: 0.5rem;
	}

	.county-discovery__cta,
	.county-discovery__random {
		flex: 1 1 100%;
	}

	/* Two-letter labels stay legible at phone width; the halo carries contrast. */
	.home-county-discovery .county-discovery__label {
		font-size: 0.6rem;
		letter-spacing: 0.04em;
	}

	.county-discovery__popup,
	.county-discovery__popup[data-anchor="right"] {
		position: fixed;
		inset: auto 0 0 0;
		/* Above mobile bottom nav (100); consent reopen is hidden while open. */
		z-index: 120;
		width: 100%;
		max-height: 82vh;
		border-width: 1px 0 0;
		border-radius: var(--trvl-radius-lg) var(--trvl-radius-lg) 0 0;
		box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.6);
		overflow-y: auto;
		animation-name: county-discovery-sheet;
	}

	.county-discovery__popup-visual {
		aspect-ratio: 3 / 2;
	}

	/* Clear the fixed mobile bottom nav so the sheet's CTAs stay tappable. */
	.county-discovery__popup-body {
		padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
	}

	.county-discovery__popup-actions {
		position: sticky;
		bottom: 0;
		z-index: 2;
		margin: 0 -1rem;
		padding: 0.65rem 1rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
		background: linear-gradient(
			180deg,
			rgba(14, 17, 23, 0) 0%,
			rgba(14, 17, 23, 0.92) 28%,
			rgba(14, 17, 23, 0.98) 100%
		);
	}
}

@keyframes county-discovery-sheet {
	from {
		opacity: 0;
		transform: translateY(24px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.county-discovery__popup,
	.county-discovery__county.is-switching .county-discovery__county-name,
	.county-discovery__county.is-switching .county-discovery__county-essence,
	.county-discovery__county.is-switching .county-discovery__county-fact,
	.county-discovery__county.is-switching .county-discovery__county-text {
		animation: none;
	}

	.county-discovery__shape,
	.home-county-discovery .county-discovery__label,
	.county-discovery__cta,
	.county-discovery__pick {
		transition: none;
	}
}
