/* ============================================================
 * palawan-map.css — [palawan_map] shortcode (homepage hero map)
 * Enqueued by the palawan_map shortcode in functions.php, alongside
 * mapbox-gl, so it only loads where the shortcode renders.
 * Extracted from the inline <style> block inside that shortcode.
 * ============================================================ */

.palawan-map-wrap {
	width: 100%;
	max-width: 100%;
	/* Pull the map up under the hero so its faded top edge overlaps the photo,
	 * then mask the satellite canvas to fade-in over the seam (below). Painted
	 * above the hero (z-index) so the transparent top reveals the beach photo. */
	position: relative;
	z-index: 3;
	/* Map barely overlaps the hero now — it sits below the empty photo band
	 * (created by the hero's bottom padding) rather than reaching up into it.
	 * The small overlap + short fade just softens the top edge into the ocean. */
	margin-top: -30px;
}
.palawan-map-wrap #palawan-map {
	width: 100%;
	/* Viewport-scaled but intentionally cropped from the bottom so a strip of
	 * the next section always peeks below — that off-map strip is the handle
	 * users grab to scroll past the one-finger map without getting trapped.
	 * dvh wins where supported (accounts for mobile browser chrome). Low floor
	 * keeps the map from ever exceeding a small phone's viewport. */
	height: 80vh;
	height: 80dvh;
	min-height: 420px;
}
/* Fade only the satellite imagery into the photo above — markers and zoom
 * controls stay crisp because they're separate overlays, not the canvas. */
.palawan-map-wrap .mapboxgl-canvas {
	/* Long fade so the high northern landmass dissolves into ocean and the map
	 * only reads as solid well below the "Explore the map" cue. The page bg is
	 * #11202a (same navy as the map ocean), so the part of the fade past the
	 * photo still reads as continuous ocean. */
	-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 150px);
	        mask-image: linear-gradient(to bottom, transparent 0, #000 150px);
}
/* Move the zoom controls out of the top-right — after the map is pulled up
 * under the hero they collide with the sticky header when scrolled. Re-anchor
 * to the bottom-right, stacked just above the attribution button. */
.palawan-map-wrap .mapboxgl-ctrl-top-right {
	z-index: 10;
	top: auto;
	bottom: 44px;
}
/* The theme's global button styles bloat Mapbox's compact attribution button
 * (it renders ~64×36px with its ⓘ icon tiling → looks like two icons). Force
 * the proper single, centered, non-repeating ⓘ. Attribution is kept (required
 * by Mapbox ToS) — just cleaned up. */
.palawan-map-wrap .mapboxgl-ctrl-attrib-button {
	width: 24px;
	height: 24px;
	min-width: 0;
	min-height: 0;
	padding: 0;
	background-repeat: no-repeat;
	background-position: center;
	background-size: 16px 16px;
}
.palawan-map-wrap .mapboxgl-ctrl-attrib.mapboxgl-compact {
	min-height: 24px;
	padding: 0;
}
.palawan-map-wrap .mapboxgl-popup-content {
	background: #1a2a3a;
	color: #e8d5b7;
	border-radius: 8px;
	padding: 12px 16px;
	font-family: 'Georgia', serif;
	box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.palawan-map-wrap .mapboxgl-popup-tip {
	border-top-color: #1a2a3a;
}
.palawan-map-wrap .mapboxgl-popup-close-button {
	color: #8ba4a8;
}
.palawan-map-wrap .area-name {
	font-size: 1rem;
	font-weight: bold;
	margin-bottom: 4px;
}
.palawan-map-wrap .area-desc {
	font-size: 0.8rem;
	color: #8ba4a8;
}
.map-overlay {
	/* Fixed, viewport-level modal. JS moves this node to <body> on load so it
	 * escapes the .palawan-map-wrap (z-index:3) stacking context — otherwise its
	 * z-index is trapped below the hero cue (z-4) and the sticky header (z-99).
	 * At body level with z-index:9999 it sits above everything. */
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0);
	pointer-events: none;
	transition: background 600ms ease;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}
.map-overlay.active {
	background: rgba(0,0,0,0.65);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	pointer-events: auto;
}
.category-panel {
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 400ms ease 300ms, transform 400ms ease 300ms;
	text-align: center;
}
.map-overlay.active .category-panel {
	opacity: 1;
	transform: translateY(0);
}
.category-panel h2 {
	color: #e8d5b7;
	font-family: system-ui, sans-serif;
	font-size: 1.8rem;
	font-weight: 600;
	margin-bottom: 6px;
}
.category-panel .area-subtitle {
	color: rgba(232,213,183,0.6);
	font-family: system-ui, sans-serif;
	font-size: 0.9rem;
	margin-bottom: 30px;
}
.category-buttons {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
	justify-content: center;
}
.category-btn {
	background: rgba(232,213,183,0.08);
	color: #e8d5b7;
	border: 1px solid rgba(232,213,183,0.25);
	padding: 0;
	border-radius: 10px;
	overflow: hidden;
	width: 140px;
	font-family: system-ui, sans-serif;
	cursor: pointer;
	transition: all 250ms ease;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}
.category-btn:hover {
	background: rgba(232,213,183,0.15);
	border-color: #e8d5b7;
	box-shadow: 0 0 20px rgba(232,213,183,0.25);
	color: #FFFFFF;
	transform: translateY(-2px);
}
.category-btn:hover .category-thumb {
	transform: scale(1.05);
}
.category-thumb {
	display: block;
	width: 100%;
	aspect-ratio: 2 / 3; /* portrait on desktop */
	object-fit: cover;
	transition: transform 400ms ease;
}
/* Grab handle — only shown on the mobile bottom sheet (hidden on desktop). */
.sheet-handle { display: none; }

.category-label {
	display: block;
	padding: 10px 8px;
	font-size: 0.85rem;
	letter-spacing: 1px;
	text-transform: uppercase;
	text-align: center;
	color: inherit;
}
/* Categories with no places in the selected area are hidden entirely
 * (was: greyed-out/disabled). JS still tags .is-empty per area on click. */
.category-btn.is-empty {
	display: none;
}
.category-panel .back-btn {
	margin-top: 24px;
	background: transparent !important;
	border: none !important;
	color: rgba(232,213,183,0.5);
	font-family: system-ui, sans-serif;
	font-size: 0.85rem;
	cursor: pointer;
	transition: background 250ms ease, color 250ms ease;
	padding: 8px 18px;
	border-radius: 6px;
	text-decoration: none !important;
	box-shadow: none !important;
}
.category-panel .back-btn:hover,
.category-panel .back-btn:focus {
	background: rgba(232,213,183,0.12) !important;
	color: #FFFFFF !important;
	text-decoration: none !important;
	box-shadow: none !important;
}

/* ============================================================
 * Mobile: turn the centered category overlay into a frosted bottom sheet.
 * The dimmed, blurred map stays behind it (same premium look, docked to the
 * bottom so it clears the browser address bar and lands in the thumb zone).
 * Fixed to the viewport; verified no ancestor transform/filter breaks
 * `position: fixed`. Kept at the END of the file so these overrides win the
 * cascade over the base rules above (same specificity → later wins).
 * ============================================================ */
@media (max-width: 600px) {
	.map-overlay {
		/* dock the sheet to the bottom (position/z-index now come from the base) */
		justify-content: flex-end;
		align-items: stretch;
	}
	.category-panel {
		opacity: 1;
		width: 100%;
		max-height: 94vh;
		max-height: 94dvh;
		display: flex;
		flex-direction: column;
		text-align: center;
		padding: 0 16px calc(18px + env(safe-area-inset-bottom));
		/* frosted glass — the blurred map ghosts faintly through the sheet */
		background: rgba(18, 28, 38, 0.72);
		-webkit-backdrop-filter: blur(22px) saturate(1.3);
		        backdrop-filter: blur(22px) saturate(1.3);
		border-top: 1px solid rgba(232, 213, 183, 0.18);
		border-radius: 22px 22px 0 0;
		box-shadow: 0 -14px 44px rgba(0, 0, 0, 0.5);
		/* slide up from below; snaps back / closes via JS drag.
		 * ease-out (fast → slow): quick off the mark, glides to a soft stop. */
		transform: translateY(100%);
		transition: transform 500ms cubic-bezier(0.33, 1, 0.68, 1);
	}
	.map-overlay.active .category-panel { transform: translateY(0); }
	.sheet-handle {
		display: block;
		flex: none;
		width: 42px; height: 4px;
		margin: 10px auto 8px;
		border-radius: 999px;
		background: rgba(232, 213, 183, 0.45);
	}
	.category-panel h2 { font-size: 1.3rem; margin: 2px 0; }
	.category-panel .area-subtitle { font-size: 0.78rem; margin-bottom: 14px; }
	.category-buttons {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 12px;
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		padding: 2px;
		align-content: start;
	}
	.category-btn { width: auto; position: relative; }
	.category-thumb { aspect-ratio: 1 / 1; }
	/* Label is a caption OVERLAID on the photo (gradient scrim), not a row below
	 * it — so it's always visible regardless of how iOS sizes the image. */
	.category-label {
		position: absolute;
		left: 0; right: 0; bottom: 0;
		padding: 22px 8px 10px;
		font-size: 0.72rem;
		letter-spacing: 0.5px;
		color: #f3e7d2;
		background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.4) 50%, rgba(0,0,0,0));
	}
	.category-panel .back-btn { flex: none; margin-top: 12px; }
}
