/* GTA 6 Interactive Map. Phones first: full-screen map with a bottom sheet;
   from 900 px a fixed panel on the left. Touch targets are at least 44 px. */

/* The look: Leonida at night. Deep indigo, the neon pastels of Vice City
   (pink, peach, lavender, mint, cream), pill buttons and rounded cards.
   Type: Figtree for text and headlines, Antonio for condensed capitals.
   Both SIL Open Font License, served from our own assets (src/fonts/). */
@font-face { font-family: "Figtree"; src: url(../fonts/figtree.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Antonio"; src: url(../fonts/antonio.woff2) format("woff2"); font-weight: 600 700; font-display: swap; }

:root {
	--bg: #0e0c1b;
	--panel: #16132a;
	--panel-2: #221d3b;
	--row: #241c38;
	--row-hover: #2f2547;
	--line: #342b4f;
	--text: #f7f0fb;
	--text-soft: #d9d0ec;
	--muted: #b0a6c9;
	--pink: #f77fb4;
	--peach: #f6c08a;
	--lavender: #a593f5;
	--mint: #8ef0dd;
	--cream: #fde6b0;
	--on-pastel: #1d0f24;
	--accent: var(--pink);
	--accent-2: var(--peach);
	--ok: var(--mint);
	--text-font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--caps-font: "Antonio", "Arial Narrow", Impact, sans-serif;
	--ad-overlay: 64px;
	color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
	height: 100%;
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 15px/1.5 var(--text-font);
	-webkit-text-size-adjust: 100%;
}

/* The page is two rows that fill the screen exactly: Raptive's header ad
   (when it is there) and the map. Everything else Raptive adds to the page
   (its privacy footer: "Do not sell or share…", "A Raptive partner site")
   goes to a zero-height row below the screen, as on the SoT map, so it never
   takes room from the map. Its links are offered in the panel's About section
   instead (app.js). Raptive's floating units (sticky footer ad, video) are
   fixed-position and unaffected.
   The footer must not make the page scrollable either: <body>'s overflow
   alone would pass up to the viewport (CSS makes the root's first overflow
   value the viewport's), leaving the footer's height as 129 px of scroll
   room, which iOS Safari used to make room for the keyboard when the search
   box took focus, and nothing could scroll back. With <html> hidden too, the
   viewport takes <html>'s value and <body> clips its own overflow itself:
   `clip` rather than `hidden`, so a script cannot scroll it either (hidden
   boxes still scroll programmatically; clipped ones are not scroll
   containers), with `hidden` for browsers from before 2022.
   Every child is placed in column 1 explicitly, so they overlap in that row:
   given a row alone, grid would give each its own new column to the right,
   and the map's column would shrink by their combined width. */
html { overflow: hidden; }
body {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: auto minmax(0, 1fr);
	grid-auto-rows: 0;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	overflow: clip;
}
body > * { grid-row: 3; grid-column: 1; }

a { color: var(--pink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; color: inherit; }

.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* Ads (pages with a Raptive id carry body.has-ads). No ad markup of our own:
   Raptive's site rules place the header ad just before #rt_map on pages that
   contain #map, as on the Sea of Thieves map, in its own box that reserves
   its height (Raptive's adthrive-ad-cls). In this flex column it takes its
   room from the map area, which resizes to fit (map.js, sheet.js). The
   footer ad is Raptive's dismissible overlay: no room is taken for it, but
   the panel ends with space to scroll its last item above it. */
body > .adthrive-header { grid-row: 1; }
@media (min-width: 768px) {
	:root { --ad-overlay: 100px; }
}

/* The id is Raptive's: their map header rule inserts the ad before #rt_map. */
#rt_map { grid-row: 2; position: relative; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 0; }
/* The map takes keyboard focus (arrows pan, + and - zoom): outline it then, not on a click. */
.leaflet-container { font: inherit; }
.leaflet-container:focus:not(:focus-visible) { outline: none; }
.leaflet-container:focus-visible { outline-offset: -3px; }

/* Map buttons */
.map-controls {
	position: absolute;
	right: calc(12px + env(safe-area-inset-right));
	top: calc(12px + env(safe-area-inset-top));
	z-index: 900;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.map-btn {
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	border: 1px solid var(--line);
	background: rgba(22, 19, 42, 0.92);
	color: var(--text);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
	cursor: pointer;
}
.map-btn[aria-disabled="true"] { opacity: 0.4; cursor: default; }

/* Markers */
.pin, .cluster { background: none; border: 0; }
/* Marker names on hover (mouse only, map.js). */
.leaflet-tooltip.pin-tip {
	padding: 4px 11px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: rgba(22, 19, 42, 0.96);
	color: var(--text);
	font: 600 13px/1.3 var(--text-font);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.leaflet-tooltip-top.pin-tip::before { border-top-color: rgba(22, 19, 42, 0.96); }
.pin__dot {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--c, var(--accent));
	border: 2px solid var(--bg);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--bg);
}
.pin__dot .icon { width: 18px; height: 18px; }
.pin__dot.is-found { opacity: 0.55; filter: saturate(0.4); }
.pin__dot--blank { background: var(--accent); }
.pin--selected { pointer-events: none; }
.pin--selected .pin__dot { position: absolute; left: 8px; top: 8px; transform: scale(1.15); opacity: 1; filter: none; }
.pin__ring {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 3px solid #fff;
	box-shadow: 0 0 0 3px rgba(247, 127, 180, 0.6);
	animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
	0% { transform: scale(0.85); opacity: 1; }
	100% { transform: scale(1.35); opacity: 0; }
}
/* Clusters grow with their count (map.js sets the size) and take the colour
   of the category most of their markers are in, so the map reads at a glance
   even zoomed out. */
.cluster span {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(22, 19, 42, 0.94);
	border: 2px solid var(--c, var(--accent));
	color: var(--text);
	font-weight: 800;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.cluster--m span { font-size: 13px; }
.cluster--l span { font-size: 14px; }

/* The panel: a bottom sheet on phones */
.sheet {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1000;
	height: var(--sheet-h, 85%);
	transform: translateY(var(--sheet-y, 40%));
	display: flex;
	flex-direction: column;
	background: var(--panel);
	border-radius: 24px 24px 0 0;
	box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.5);
	will-change: transform;
}
.sheet.is-animating { transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet__grip {
	flex: none;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: grab;
	touch-action: none;
}
.sheet__grip span { width: 40px; height: 5px; border-radius: 3px; background: #463c68; }
.sheet__head { flex: none; padding: 0 12px 10px; touch-action: none; }
.sheet__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	/* --sheet-hidden: how much of the sheet is below the screen at its
	   current height (sheet.js). Padded, so the end of the panel can always
	   be scrolled up into view, at half height too. */
	padding: 4px 16px calc(24px + var(--sheet-hidden, 0px) + env(safe-area-inset-bottom));
}
.has-ads .sheet__body { padding-bottom: calc(24px + var(--ad-overlay) + var(--sheet-hidden, 0px) + env(safe-area-inset-bottom)); }
/* A phone on its side: clear of the notch. */
.sheet__head, .sheet__body { margin-left: env(safe-area-inset-left); margin-right: env(safe-area-inset-right); }

@media (min-width: 900px) {
	.sheet {
		top: 12px;
		bottom: 12px;
		left: 12px;
		right: auto;
		width: 380px;
		height: auto;
		transform: none;
		border-radius: 24px;
		box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
	}
	.sheet__grip { display: none; }
	.sheet__head { padding-top: 12px; }
	.sheet__body { padding-bottom: 24px; }
	.has-ads .sheet__body { padding-bottom: calc(24px + var(--ad-overlay)); }

	/* Hide/show: the panel slides out to the left; its toggle stays on the
	   window's edge to bring it back. */
	.sheet { transition: transform 0.22s ease; }
	.sheet.is-collapsed { transform: translateX(calc(-100% - 12px)); box-shadow: none; }
	.sheet__toggle {
		display: flex;
		position: absolute;
		top: 16px;
		right: -36px;
		width: 36px;
		height: 48px;
		align-items: center;
		justify-content: center;
		border: 1px solid var(--line);
		border-left: 0;
		border-radius: 0 14px 14px 0;
		background: var(--panel);
		color: var(--muted);
		cursor: pointer;
		box-shadow: 4px 2px 10px rgba(0, 0, 0, 0.35);
	}
	.sheet__toggle .icon { transition: transform 0.22s ease; }
	.sheet.is-collapsed .sheet__toggle .icon { transform: rotate(180deg); }
	.sheet.is-instant, .sheet.is-instant .sheet__toggle .icon { transition: none; }
}

/* Large screens: a little more room for the panel's text beside a big map. */
@media (min-width: 1600px) {
	.sheet { width: 420px; }
}

@media (max-width: 899px) {
	.sheet__toggle { display: none; }
}

/* Search */
.search {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 46px;
	padding: 0 6px 0 16px;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: var(--panel-2);
	color: var(--muted);
}
.search input {
	flex: 1;
	min-width: 0;
	border: 0;
	outline: none;
	background: transparent;
	color: var(--text);
	font: inherit;
	font-size: 16px; /* under 16 px, iOS zooms the page on focus */
}
.search input::-webkit-search-cancel-button { display: none; }
.search__clear {
	width: 36px;
	height: 36px;
	border: 0;
	background: none;
	color: var(--muted);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.search__clear[hidden] { display: none; }
/* The "/" shortcut hint, for keyboards only, while the box is empty and not in use. */
.search__kbd {
	display: none;
	min-width: 22px;
	padding: 1px 6px;
	margin-right: 6px;
	border: 1px solid var(--line);
	border-radius: 8px;
	color: var(--muted);
	font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
	text-align: center;
}
@media (hover: hover) and (pointer: fine) {
	.search input:placeholder-shown ~ .search__kbd { display: inline-block; }
	.search:focus-within .search__kbd { display: none; }
}

/* Views */
/* Rare Thief's wordmark, at the top of the home panel. */
.view__title { font-size: 24px; font-weight: 800; line-height: 1.15; letter-spacing: -0.015em; margin: 6px 0 10px; display: flex; align-items: center; gap: 10px; }
.view-home .view__title { font-size: 26px; color: var(--pink); }
/* The intro: a little smaller and softer than list text, so the categories
   start higher up the panel (on a phone at half height, that is the fold). */
.view .lede { font-size: 14px; line-height: 1.45; color: var(--text-soft); }
/* Condensed capitals: section labels and headings over lists. */
.view__subtitle, .group__head h2, .about h2 {
	margin: 0;
	font: 700 17px/1.2 var(--caps-font);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--cream);
}
.view__subtitle { margin: 4px 0 8px; }
.view p { margin: 0 0 12px; }
.empty { color: var(--muted); padding: 8px 0; }

/* The countdown before launch: a card in the colours of a Vice City dusk. */
.notice {
	margin: 14px 0 18px;
	padding: 16px 18px;
	border-radius: 20px;
	background: linear-gradient(155deg, #33215a 0%, #57275a 55%, #7d3653 100%);
}
.notice p:last-child { margin-bottom: 0; }
.view .notice__date { font: 700 19px/1.15 var(--caps-font); letter-spacing: 0.03em; text-transform: uppercase; color: var(--cream); margin-bottom: 8px; }

input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* Settings are pill toggles (filter chips): off in the panel's colours, on
   in mint with a check, like the Found button. The checkbox inside does the
   work; browsers without :has() show it as a plain checkbox instead. */
.options { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.switch .icon { width: 18px; height: 18px; }
.switch__check { display: none; }
@supports selector(:has(a)) {
	.switch {
		position: relative;
		gap: 6px;
		min-height: 44px;
		padding: 0 14px 0 12px;
		border-radius: 999px;
		border: 1px solid var(--line);
		background: var(--panel-2);
		color: var(--muted);
		font-size: 14px;
		font-weight: 600;
	}
	.switch input[type="checkbox"] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
	.switch .icon { width: 16px; height: 16px; }
	.switch:has(:checked) { background: color-mix(in srgb, var(--mint) 16%, transparent); border-color: var(--mint); color: var(--mint); }
	.switch:has(:checked) .switch__check { display: block; }
	.switch:has(:checked) .switch__lead { display: none; }
	.switch:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
	/* A category that is switched off dims, so the list shows what the map shows. */
	.cat:has([data-toggle-cat]:not(:checked)) .badge { filter: saturate(0.3) brightness(0.55); }
	.cat:has([data-toggle-cat]:not(:checked)) .cat__name, .cat:has([data-toggle-cat]:not(:checked)) .cat__count { color: var(--muted); }
}

.group__head { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.link-btn { border: 0; background: none; color: var(--lavender); font-size: 13px; font-weight: 600; padding: 10px 0 10px 12px; cursor: pointer; }

/* Lists are rows of rounded cards: name in white, count in pink. */
/* minmax(0, 1fr): a long name is cut short with "…" instead of widening the list past the panel. */
.cats, .markers, .results { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.cat { display: flex; align-items: center; padding: 0 12px; border-radius: 14px; background: var(--row); }
.cat__toggle { display: flex; align-items: center; gap: 10px; min-height: 54px; padding-right: 10px; cursor: pointer; }
.cat__link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 54px; color: var(--text); font-weight: 600; text-decoration: none; }
.cat__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat__count { color: var(--pink); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cat__chev { width: 16px; height: 16px; color: var(--muted); }

.badge {
	width: 30px;
	height: 30px;
	flex: none;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--c);
	color: var(--bg);
}
.badge .icon { width: 18px; height: 18px; }

.about { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.about h2 { margin-bottom: 8px; }
.view .disclaimer { font-size: 12px; }
/* Our privacy policy link, then Raptive's (app.js), all in one wrapping row. */
.privacy-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.privacy-links [data-privacy-links] { display: contents; }
.privacy-links [data-privacy-links][hidden] { display: none; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; color: var(--muted); text-decoration: none; }
.crumbs .icon { width: 16px; height: 16px; }
.crumbs__sep { opacity: 0.5; }

.progress { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; }
.progress__bar { flex: 1; height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.progress__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--peach)); }
.progress__text { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.mk { display: flex; align-items: center; padding-left: 14px; border-radius: 14px; background: var(--row); }
.mk a { flex: 1; min-width: 0; padding: 14px 0; color: var(--text); font-weight: 600; text-decoration: none; }
.mk.is-found a { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(176, 166, 201, 0.5); }
.mk__found { width: 44px; height: 44px; flex: none; border: 0; background: none; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mk__found .icon { width: 24px; height: 24px; padding: 2px; border-radius: 50%; border: 2px solid var(--line); fill: transparent; }
.mk__found[aria-pressed="true"] .icon { background: var(--ok); border-color: var(--ok); fill: var(--bg); }

.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px 4px 6px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--c) 18%, transparent);
	color: var(--c);
	font-size: 13px;
	font-weight: 600;
}
.view .chip { margin: 0 0 12px; }
.chip .icon { width: 16px; height: 16px; }

.shot { margin: 0 0 12px; }
.shot img { display: block; width: 100%; height: auto; border-radius: 16px; background: var(--panel-2); }
.desc { margin-bottom: 4px; }
.desc--loading {
	min-height: 3em;
	border-radius: 12px;
	background: linear-gradient(90deg, var(--panel-2), #2c2548, var(--panel-2));
	background-size: 200% 100%;
	animation: shimmer 1.2s linear infinite;
	margin-bottom: 12px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 20px;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: var(--panel-2);
	color: var(--text);
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}
/* Pastel pills with dark words, as on a Vice City billboard. */
.btn--primary { background: var(--pink); border-color: var(--pink); color: var(--on-pastel); }
.btn--primary.is-on { background: var(--mint); border-color: var(--mint); color: var(--on-pastel); }
.btn--ghost { background: transparent; color: var(--muted); }

/* Previous / next on a marker page: its neighbours along the category's route. */
.pager { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.pager__pos, .pager__done { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.pager__done { margin: 0; color: var(--mint); font-weight: 600; }
.pager__links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pager__link { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; min-height: 64px; padding: 10px 14px; border-radius: 14px; background: var(--row); color: var(--text); text-decoration: none; }
.pager__link--next { align-items: flex-end; text-align: right; }
.pager__dir { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pager__dir .icon { width: 14px; height: 14px; }
.pager__title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; font-weight: 700; line-height: 1.25; }

.results a { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 12px; border-radius: 14px; background: var(--row); color: var(--text); font-weight: 600; text-decoration: none; }
.results__title { flex: 1; min-width: 0; }
.results small { color: var(--pink); font-weight: 500; }

.toast {
	position: fixed;
	left: 50%;
	top: calc(16px + env(safe-area-inset-top));
	z-index: 2000;
	max-width: calc(100vw - 32px);
	padding: 10px 18px;
	border-radius: 999px;
	background: #2a2244;
	color: var(--text);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
	transform: translate(-50%, -160%);
	opacity: 0;
	visibility: hidden;
	transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s;
	pointer-events: none;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* Mouse and trackpad: show what is clickable. Never on touch screens, where
   hover styles stick after a tap. */
@media (hover: hover) and (pointer: fine) {
	/* A mouse needs less room than a finger: tighter rows show more of a list. */
	.cats, .markers, .results { gap: 4px; }
	.cat__toggle, .cat__link, .results a { min-height: 48px; }
	.mk a { padding: 12px 0; }
	.switch { min-height: 40px; }
	.switch:hover { border-color: #4a3f6e; color: var(--text); }
	.switch:has(:checked):hover { border-color: #a9f5e7; color: #a9f5e7; }
	.pin__dot, .cat, .mk, .results a, .pager__link, .btn, .map-btn, .sheet__toggle, .cat__chev { transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.12s ease; }
	.pin:hover .pin__dot { transform: scale(1.12); }
	.cluster:hover span { background: #2a2244; }
	.cat:hover, .mk:hover, .results a:hover, .pager__link:hover { background: var(--row-hover); }
	.cat__link:hover .cat__name, .mk a:hover { color: #fff; }
	.cat__link:hover .cat__chev { color: var(--text); transform: translateX(2px); }
	.crumbs a:hover, .link-btn:hover, .btn--ghost:hover { color: var(--text); }
	.btn:hover { border-color: #4a3f6e; background: #2c2549; }
	.btn--primary:hover { border-color: #ff98c6; background: #ff98c6; }
	.btn--primary.is-on:hover { border-color: #a9f5e7; background: #a9f5e7; }
	.btn--ghost:hover { background: transparent; }
	.map-btn:not([aria-disabled="true"]):hover, .sheet__toggle:hover { background: #2a2244; color: #fff; }
	.mk__found:hover .icon { border-color: var(--ok); }
	.search:hover { border-color: #4a3f6e; }
	.cat__toggle:hover .badge { filter: brightness(1.1); }
}

@media (prefers-reduced-motion: reduce) {
	.sheet.is-animating, .toast { transition: none; }
	.pin__ring, .desc--loading { animation: none; }
}
