.tbt-map-container {
	position: relative;
	width: 100%;
	height: clamp(450px, 88svh, 880px);
}

/* Mapbox attribution sits above the default z-index stack. */
.tbt-map-container .mapboxgl-ctrl-attrib {
	font-size: 11px;
}

/* -------------------------------------------------------------------------
   Wrapper — provides the positioning context for all overlays.
   ------------------------------------------------------------------------- */
.tbt-map-wrap {
	position: relative;
	overflow: hidden;
}

/* -------------------------------------------------------------------------
   Filter rows
   ------------------------------------------------------------------------- */
.tbt-map-filter-wrap {
	position: absolute;
	top:      20px;
	left:     20px;
	z-index:  10;
}

.tbt-map-filter-bar {
	display:     none;
	align-items: center;
	gap:         8px;
	margin-bottom: 8px;
}

.tbt-filter-toggle-btn {
	display:       flex;
	align-items:   center;
	text-transform: uppercase;
	gap:           6px;
	padding:       8px 14px;
	background:    rgba(255,255,255,0.85);
	backdrop-filter: blur(10px);
	border:        none;
	border-radius: var(--tbt-radius-pill);
	font-size:     16px;
	font-weight:   700;
	font-family:   var(--tbt-font-heading);
	color:         var(--tbt-navy);
	cursor:        pointer;
}

.tbt-filter-toggle-btn:hover,
.tbt-filter-toggle-btn:focus {
	background:    rgba(255,255,255,0.85);
	color:         var(--tbt-navy);
}

.tbt-filter-toggle-btn svg {
	width:       16px;
	height:      16px;
	flex-shrink: 0;
}

.tbt-filter-toggle-btn.has-filters {
	background: var(--tbt-navy);
	color:      var(--tbt-acid);
}

.tbt-map-filters {
	display:        flex;
	flex-direction: column;
	gap:            8px;
}

.tbt-map-filter-row {
	position:     relative;
	display:      flex;
	align-items:  center;
	gap:          12px;
	padding:      3px 12px 4px 15px;
	background: rgba(255,255,255,0.80);
	backdrop-filter: blur(10px);
	border-radius: var(--tbt-radius-pill);
	cursor:       pointer;
	width: 250px;
}
.tbt-map-filter-row:hover {
	background: rgba(255,255,255,0.95);
	cursor: pointer;
}

.tbt-map-filter-label {
	font-size:      20px;
	font-weight:    700;
	font-family: var(--tbt-font-heading);
	color:          var(--tbt-navy);
	width: 66px;
	flex-shrink:    0;
}

.tbt-map-filter-value {
	flex:          1;
	font-size:     var(--tbt-font-base);
	font-weight: 500;
	color:         var(--tbt-navy);
	overflow:      hidden;
	white-space:   nowrap;
	text-overflow: ellipsis;
}

.tbt-map-filter-select {
	position: absolute;
	inset:    0;
	opacity:  0;
	cursor:   pointer;
	width:    100%;
	height:   100%;
	padding: 0;
}

.tbt-map-filter-chevron {
	flex-shrink:    0;
	width:          16px;
	height:         16px;
	pointer-events: none;
}

.tbt-map-filter-chevron svg {
	width:        100%;
	height:       100%;
	stroke:       var(--tbt-navy);
	fill:         none;
	stroke-width: 1;
}

/* Toggle row */
.tbt-map-filter-row--toggle {
	gap: 12px;
	height: 37px;
	padding: 4px 7px 4px;
}

.tbt-map-filter-toggle-wrap {
	display:     flex;
	align-items: center;
	flex-shrink: 0;
}

.tbt-map-filter-toggle-label {
	font-size: var(--tbt-font-base);
	color:     var(--tbt-navy);
	font-weight: 500;
}

.tbt-toggle-input {
	position: absolute;
	opacity:  0;
	width:    0;
	height:   0;
}

.tbt-toggle-track {
	display:       inline-flex;
	align-items:   center;
	width:         44px;
	height:        26px;
	border-radius: var(--tbt-radius-pill);
	background:    var(--tbt-ui-4);
	transition:    background var(--tbt-transition);
	flex-shrink:   0;
	position:      relative;
}

.tbt-toggle-thumb {
	position:      absolute;
	left:          3px;
	width:         20px;
	height:        20px;
	border-radius: 50%;
	background:    var(--tbt-white);
	transition:    transform var(--tbt-transition);
	box-shadow:    0 1px 3px rgba(0, 0, 0, 0.2);
}

.tbt-toggle-input:checked + .tbt-toggle-track {
	background: var(--tbt-navy);
}

.tbt-toggle-input:checked + .tbt-toggle-track .tbt-toggle-thumb {
	transform:  translateX(18px);
	background: var(--tbt-acid);
}

@media ( max-width: 1024px ) {
	.tbt-map-filter-wrap {
		top:  8px;
		left: 8px;
	}

	.tbt-map-filter-bar {
		display: flex;
	}

	.tbt-map-filters {
		opacity:        0;
		transform:      translateY(-6px);
		pointer-events: none;
		transition:     opacity 0.2s ease, transform 0.2s ease;
	}

	.tbt-map-filters.is-open {
		opacity:        1;
		transform:      translateY(0);
		pointer-events: auto;
	}
}

/* -------------------------------------------------------------------------
   Stats counter
   ------------------------------------------------------------------------- */
.tbt-map-wrap .tbt-stats-counter {
	position:       absolute;
	bottom:         30px;
	left:           20px;
	z-index:        10;
	pointer-events: none;
}

.tbt-map-wrap .tbt-stat {
	font-size:      var(--tbt-font-3xl);
	font-family: var(--tbt-font-heading);
	font-weight:    800;
	color:          var(--tbt-navy);
	text-shadow:
	3px 3px 0 var(--tbt-ocean),
	-3px 3px 0 var(--tbt-ocean),
	-3px -3px 0 var(--tbt-ocean),
	3px -3px 0 var(--tbt-ocean);
	line-height:    0.85;
}

.tbt-map-wrap .tbt-stat-clip {
	display:        inline-block;
	overflow-y:       hidden;
	vertical-align: bottom;
	position:       relative;
}

.tbt-map-wrap .tbt-stat-number {
	display: block;
	padding: 0 4px;
}

/* -------------------------------------------------------------------------
   Map overlay (dimming layer behind panel)
   ------------------------------------------------------------------------- */
.tbt-map-wrap .tbt-map-overlay {
	position:       absolute;
	inset:          0;
	background:     color-mix(in srgb, var(--tbt-ocean) 55%, transparent);
	backdrop-filter: blur(10px);
	z-index:        19;
	opacity:        0;
	pointer-events: none;
	transition:     opacity 0.3s ease;
}

.tbt-map-wrap .tbt-map-overlay.is-open {
	opacity:        1;
	pointer-events: auto;
}

/* -------------------------------------------------------------------------
   Member detail panel — slides up from the bottom
   ------------------------------------------------------------------------- */
.tbt-map-wrap .tbt-map-panel {
	position:       absolute;
	bottom:         0;
	left:           0;
	right:          0;
	height: 90%;
	max-height: 730px;
	z-index:        20;
	color:          var(--tbt-white);
	display:        flex;
	flex-direction: column;
	transform:      translateY(100%);
	transition:     transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	overflow:       hidden;
	pointer-events: none;
}

.tbt-map-wrap .tbt-panel-close,
.tbt-map-wrap .tbt-panel-left,
.tbt-map-wrap .tbt-panel-right {
	pointer-events: auto;
}

.tbt-map-wrap .tbt-map-panel.is-open {
	transform: translateY(0);
}

/* Close button */
.tbt-map-wrap .tbt-panel-close {
	position:    absolute;
	top:         16px;
	right:       16px;
	background:  none;
	border:      1px solid rgba(255,255,255,0.5);
	border-radius: 22px;
	color:       var(--tbt-acid);
	font-size:   28px;
	line-height: 1;
	cursor:      pointer;
	width: 44px;
	height: 44px;
	z-index:     1;
	padding: 5px 0 0;
	display: flex;
	align-items: baseline;
	justify-content: center;

	transition:  border-color 0.15s;
}

.tbt-map-wrap .tbt-panel-close:hover {
	border-color: var(--tbt-acid);
}

/* Two-column inner layout */
.tbt-map-wrap .tbt-panel-inner {
	display:  flex;
	flex:     1 1 auto;
	justify-content: flex-end;
	gap: 1px;
	overflow: hidden;
}

/* Left column — member detail */
.tbt-map-wrap .tbt-panel-left {
	flex:       0 0 55%;
	max-width:  620px;
	background: var(--tbt-navy);
	position:   relative;
	overflow:   hidden;
}

.tbt-map-wrap .tbt-panel-scroll {
	height:    100%;
	overflow-y: auto;
	padding:   35px 70px 0;
}

.tbt-map-wrap .tbt-panel-left::before,
.tbt-map-wrap .tbt-panel-left::after {
	content:        '';
	position:       absolute;
	left:           0;
	right:          0;
	pointer-events: none;
	z-index:        1;
}

.tbt-map-wrap .tbt-panel-left::before {
	top:        0;
	height:     30px;
	background: linear-gradient( to top, transparent, var(--tbt-navy) );
}

.tbt-map-wrap .tbt-panel-left::after {
	bottom:     0;
	height:     50px;
	background: linear-gradient( to bottom, transparent, var(--tbt-navy) );
}

.tbt-panel-detail {
	display:    flex;
	flex-direction: column;
	justify-content: space-between;
	height:     100%;
	transition: opacity 0.15s ease;
}

.tbt-panel-detail-bottom {
	padding-bottom: 50px;
}


/* Right column — region member list */
.tbt-map-wrap .tbt-panel-right {
	flex:           1 1 auto;
	display:        flex;
	flex-direction: column;
	max-width: 350px;
	overflow:       hidden;
	background:     var(--tbt-navy);
	padding:        35px 0 0;
	position:       relative;
}

.tbt-map-wrap .tbt-panel-right::after {
	content:        '';
	position:       absolute;
	bottom:         0;
	left:           0;
	right:          0;
	height:         50px;
	background:     linear-gradient( to bottom, transparent, var(--tbt-navy) );
	pointer-events: none;
	z-index:        1;
}

.tbt-map-wrap .tbt-panel-region-title {
	font-size:      var(--tbt-font-xl);
	font-family: var(--tbt-font-heading);
	font-weight:    700;
	color:          var(--tbt-ui-5);
	text-transform: uppercase;
	margin:         0 0 10px;
	padding:        0 30px;
	position:       relative;
}

.tbt-map-wrap .tbt-panel-region-title::after {
	content:    '';
	position:   absolute;
	top:        100%;
	left:       0;
	right:      0;
	height:     30px;
	background: linear-gradient( to bottom, var(--tbt-navy), transparent );
	pointer-events: none;
	z-index:    1;
}

.tbt-map-wrap .tbt-panel-region-list {
	list-style: none;
	margin:     0;
	padding:    0 0 16px;
	overflow-y: auto;
	flex:       1 1 auto;
}

.tbt-map-wrap .tbt-panel-country-heading {
	font-size:      var(--tbt-font-sm);
	font-weight:    800;
	/* letter-spacing: 0.1em; */
	text-transform: uppercase;
	color:          var(--tbt-ui-3);
	padding:        16px 30px 4px;
}

.tbt-map-wrap .tbt-panel-region-item {
	display:     flex;
	align-items: center;
	gap:         10px;
	padding:     8px 30px;
	cursor:      pointer;
	transition:  background 0.15s;
}

.tbt-map-wrap .tbt-panel-region-item:hover {
	background: rgba(255, 255, 255, 0.1);

	.tbt-panel-region-name {
		color: var(--tbt-white);
	}
}

.tbt-map-wrap .tbt-panel-region-item.is-active .tbt-panel-region-name {
	color: var(--tbt-acid);
}


.tbt-map-wrap .tbt-panel-region-name {
	font-size:     var(--tbt-font-base);
	color:         var(--tbt-ui-5);
	transition:  color 0.15s;
	flex:          1 1 auto;
	min-width:     0;
	overflow:      hidden;
	white-space:   nowrap;
	text-overflow: ellipsis;
}

/* Member detail content */
.tbt-map-wrap .tbt-panel-logo-wrap {
	margin-bottom: 16px;
}

.tbt-map-wrap .tbt-panel-logo {
	max-height: 90px;
	max-width:  200px;
	object-fit: contain;
}

.tbt-map-wrap .tbt-panel-country {
	display: inline-block;
	margin-bottom:  0.75em;
	margin-top: 3em;
}

.tbt-map-wrap .tbt-panel-title {
	font-size:   var(--tbt-font-3xl);
	color:       var(--tbt-acid);
	margin:      0 0 14px;
}

.tbt-map-wrap .tbt-panel-title--long {
	font-size:   var(--tbt-font-2xl);
}

.tbt-map-wrap .tbt-panel-summary {
	font-size: 18px;
	line-height:   1.6;
	margin-bottom: 20px;
}

.tbt-map-wrap .tbt-panel-summary p {
	margin: 0 0 10px;
}

.tbt-map-wrap .tbt-panel-actions {
	display:   flex;
	gap:       10px;
	flex-wrap: wrap;
}


/* -------------------------------------------------------------------------
   Loading spinner
   ------------------------------------------------------------------------- */
@keyframes tbt-spin {
	to { transform: rotate(360deg); }
}

.tbt-map-wrap .tbt-loading {
	width:            32px;
	height:           32px;
	border:           3px solid var(--tbt-ui-2);
	border-top-color: var(--tbt-acid);
	border-radius:    50%;
	animation:        tbt-spin 0.75s linear infinite;
	margin:           40px auto;
}

/* -------------------------------------------------------------------------
   Mobile — stack columns, taller panel
   ------------------------------------------------------------------------- */
@media ( max-width: 1024px ) {
	.tbt-map-wrap .tbt-map-panel {
		height: calc(100% - 20px);
		max-height: none;
	}

	.tbt-map-wrap .tbt-panel-inner {
		flex-direction: column;
	}

	.tbt-map-wrap .tbt-panel-left {
		flex:      1 0 45%;
		padding:   0;
		max-width: none;
	}

	.tbt-map-wrap .tbt-panel-right {
		flex:       0 1 auto;
		padding:    20px 0 0;
		max-width:  none;
		/* min-height: 0; */
		height: 204px;
	}

	.tbt-map-wrap .tbt-panel-summary {
		font-size: 16px;

		p {
			max-width: 40em;
		}
	}

	.tbt-map-wrap .tbt-panel-logo-wrap,
	.tbt-map-wrap .tbt-panel-country-heading {
		/* max-height: 48px;
		max-width:  160px; */
		display: none;
	}

	.tbt-map-wrap .tbt-panel-scroll {
		padding: 20px 25px 0;
	}

	.tbt-map-filter-row {
		width: 240px;
	}

	.tbt-map-filter-row--toggle {
		height: 34px;
		padding: 3px 5px 3px;
	}

	.tbt-map-filter-label {
		font-size:      18px;
		width: 50px;
	}

	.tbt-map-filter-value,
	.tbt-map-filter-toggle-label {
		font-size: 14px;
	}

	.tbt-map-wrap .tbt-panel-right::after {
		height:         23px;
	}

	.tbt-map-wrap .tbt-panel-region-title::after {
		height:     20px;
	}
}
