/* Amble — editorial city guide.
   Photography-led, calm typography, map as the primary surface. */

:root {
	--ink: #1b1b1b;
	--ink-soft: #55504a;
	--ink-faint: #8b847c;
	--paper: #faf8f5;
	--paper-raised: #ffffff;
	--rule: #e4ded5;
	--accent: #ffcc00; /* used sparingly, as a mark rather than a fill */
	--shadow: 0 2px 6px rgba(27, 27, 27, .07), 0 12px 32px rgba(27, 27, 27, .10);
	--radius: 4px;
	--serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
	--sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--sans);
	-webkit-font-smoothing: antialiased;
}

#amble-root { height: 100%; }

.noscript {
	padding: 24px;
	font-family: var(--sans);
}

/* ---------- layout ---------- */

.amble-app {
	position: relative;
	height: 100%;
	overflow: hidden;
}

/* The child selector is load-bearing, not decoration. MapLibre's stylesheet
   contains `.maplibregl-map { position: relative }` and is injected at runtime,
   so it lands after this file and wins on equal specificity — which drops the
   container to `position: relative` with no content, collapsing it to zero
   height and rendering a blank map. Two classes outrank one, whatever the
   injection order. Explicit width/height back that up. */
.amble-app > .amble-map {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background: #e8e4dd;
}

/* ---------- masthead + search ---------- */

.amble-masthead {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 10;
	display: flex;
	align-items: flex-start;
	gap: 16px;
	padding: 18px 20px;
	pointer-events: none;
}

.amble-masthead > * { pointer-events: auto; }

.amble-wordmark {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--paper-raised);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 10px 16px;
	flex: none;
}

.amble-wordmark .bar {
	width: 6px;
	height: 22px;
	background: var(--accent);
	flex: none;
}

.amble-wordmark h1 {
	margin: 0;
	font-family: var(--serif);
	font-size: 20px;
	font-weight: 600;
	letter-spacing: .01em;
}

.amble-search {
	position: relative;
	flex: 1 1 auto;
	max-width: 420px;
}

.amble-search input {
	width: 100%;
	font-family: var(--sans);
	font-size: 15px;
	color: var(--ink);
	background: var(--paper-raised);
	border: none;
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 14px 16px;
	outline: none;
}

.amble-search input::placeholder { color: var(--ink-faint); }

.amble-search input:focus {
	box-shadow: var(--shadow), 0 0 0 2px var(--accent);
}

.amble-suggestions {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	background: var(--paper-raised);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	max-height: 320px;
	overflow-y: auto;
}

.amble-suggestions:empty { display: none; }

.amble-suggestion {
	padding: 11px 16px;
	cursor: pointer;
	border-bottom: 1px solid var(--rule);
	font-size: 14px;
	line-height: 1.35;
}

.amble-suggestion:last-child { border-bottom: none; }
.amble-suggestion:hover,
.amble-suggestion.is-active { background: #fdf6dd; }

.amble-suggestion .name { display: block; font-weight: 600; }
.amble-suggestion .context {
	display: block;
	color: var(--ink-faint);
	font-size: 12.5px;
	margin-top: 1px;
}

/* ---------- buttons ---------- */

.amble-btn {
	font-family: var(--sans);
	font-size: 14px;
	font-weight: 600;
	border: none;
	border-radius: var(--radius);
	padding: 13px 18px;
	cursor: pointer;
	white-space: nowrap;
}

.amble-btn-chrome {
	background: var(--paper-raised);
	color: var(--ink);
	box-shadow: var(--shadow);
	flex: none;
}

.amble-btn-chrome:hover { background: #fdf6dd; }

.amble-btn-primary {
	background: var(--ink);
	color: var(--paper);
}

.amble-btn-primary:hover { background: #000; }

.amble-btn-quiet {
	background: transparent;
	color: var(--ink-soft);
}

.amble-btn-quiet:hover { color: var(--ink); text-decoration: underline; }

/* ---------- preferences modal ---------- */

.amble-modal {
	position: fixed;
	inset: 0;
	z-index: 40;
	background: rgba(27, 27, 27, .45);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.amble-modal-card {
	background: var(--paper);
	border-radius: var(--radius);
	box-shadow: 0 24px 64px rgba(0, 0, 0, .3);
	width: 100%;
	max-width: 480px;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.amble-modal-head {
	padding: 24px 26px 16px;
	border-bottom: 1px solid var(--rule);
}

.amble-modal-head h2 {
	margin: 0;
	font-family: var(--serif);
	font-size: 24px;
	font-weight: 600;
}

.amble-modal-head .subtitle {
	margin-top: 6px;
	font-size: 13px;
	line-height: 1.45;
	color: var(--ink-soft);
}

.amble-pref-list {
	flex: 1;
	overflow-y: auto;
	padding: 6px 26px;
}

.amble-pref {
	padding: 13px 0;
	border-bottom: 1px solid var(--rule);
}

.amble-pref:last-child { border-bottom: none; }

.amble-pref .label {
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 7px;
}

.amble-pref .controls {
	display: flex;
	align-items: center;
	gap: 14px;
}

.amble-pref .value {
	flex: none;
	width: 68px;
	text-align: right;
	font-size: 12px;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

/* Muted categories are not fetched at all, so the row is dimmed to make that
   read as off rather than merely low. */
.amble-pref.is-muted .label { color: var(--ink-faint); }
.amble-pref.is-muted .value { color: #b9b1a7; }

/* The element itself is a 32px touch target with no visible background; the
   track is drawn by the vendor pseudo-elements. Do NOT put `height: 4px` and
   vertical padding on the input — the global `box-sizing: border-box` subtracts
   the padding from that height, collapsing the track to nothing and leaving a
   thumb floating on an invisible line. */
.amble-pref input[type="range"] {
	flex: 1;
	-webkit-appearance: none;
	appearance: none;
	height: 32px;
	background: transparent;
	outline: none;
	cursor: pointer;
	margin: 0;
}

.amble-pref input[type="range"]::-webkit-slider-runnable-track {
	height: 4px;
	border-radius: 2px;
	background: var(--rule);
}

.amble-pref input[type="range"]::-moz-range-track {
	height: 4px;
	border-radius: 2px;
	background: var(--rule);
}

.amble-pref input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--ink);
	cursor: pointer;
	border: 2px solid var(--paper);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	/* Centre the thumb on the track: (track 4px - thumb 20px) / 2. */
	margin-top: -8px;
}

.amble-pref input[type="range"]::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--ink);
	cursor: pointer;
	border: 2px solid var(--paper);
}

.amble-pref input[type="range"]:focus-visible::-webkit-slider-thumb {
	box-shadow: 0 0 0 3px var(--accent);
}

.amble-pref.is-muted input[type="range"]::-webkit-slider-thumb { background: #b9b1a7; }
.amble-pref.is-muted input[type="range"]::-moz-range-thumb { background: #b9b1a7; }

.amble-modal-foot {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 8px;
	padding: 14px 26px;
	border-top: 1px solid var(--rule);
	background: var(--paper-raised);
}

/* ---------- account form ---------- */

.amble-modal-narrow { max-width: 380px; }

.amble-form { padding: 18px 26px 6px; }

.amble-field { margin-bottom: 14px; }

.amble-field .label {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--ink-soft);
	margin-bottom: 5px;
}

.amble-field input {
	width: 100%;
	font-family: var(--sans);
	font-size: 15px;
	color: var(--ink);
	background: var(--paper-raised);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	padding: 11px 12px;
	outline: none;
}

.amble-field input:focus { border-color: var(--ink); box-shadow: 0 0 0 2px var(--accent); }

.amble-form-error {
	display: none;
	font-size: 13px;
	line-height: 1.4;
	color: #a3271c;
	background: #fdeeec;
	border-radius: var(--radius);
	padding: 9px 11px;
	margin-bottom: 6px;
}

.amble-form-error.is-visible { display: block; }

.amble-btn[disabled] { opacity: .55; cursor: default; }

.amble-account-btn {
	max-width: 160px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------- results drawer ---------- */

.amble-drawer {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 360px;
	z-index: 9;
	background: var(--paper);
	box-shadow: -8px 0 32px rgba(27, 27, 27, .10);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}

.amble-drawer.is-open { transform: translateX(0); }

.amble-drawer-head {
	padding: 76px 22px 14px;
	border-bottom: 1px solid var(--rule);
}

.amble-drawer-head h2 {
	margin: 0;
	font-family: var(--serif);
	font-size: 24px;
	font-weight: 600;
	line-height: 1.2;
}

.amble-drawer-head .count {
	margin-top: 4px;
	font-size: 12px;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

/* ---------- plan bar ---------- */

.amble-plan-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 14px;
}

.amble-plan-bar .amble-btn { padding: 10px 14px; font-size: 13px; }

.amble-duration {
	flex: 1;
	font-family: var(--sans);
	font-size: 13px;
	color: var(--ink);
	background: var(--paper-raised);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	padding: 9px 10px;
	cursor: pointer;
}

/* The way back to the full list only exists once there is an itinerary to leave. */
.amble-back { display: none; padding-left: 0; }
.amble-drawer.is-tour .amble-back { display: inline-block; }

/* ---------- itinerary ---------- */

.amble-stop { align-items: flex-start; }

.amble-stop .leg {
	font-size: 11.5px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--ink-faint);
	margin-bottom: 3px;
}

.amble-stop .clock {
	flex: none;
	margin-left: auto;
	padding-left: 8px;
	font-size: 12px;
	font-weight: 600;
	color: var(--ink-soft);
	white-space: nowrap;
}

/* ---------- POI content (Wikipedia) ---------- */

.amble-photo {
	margin: 9px 0 7px;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--rule);
}

.amble-photo img {
	display: block;
	width: 100%;
	/* Fixed box so a slow image cannot reflow the itinerary under the reader. */
	height: 132px;
	object-fit: cover;
}

.amble-photo .credit,
.amble-credit {
	display: block;
	font-size: 10.5px;
	letter-spacing: .03em;
	color: var(--ink-faint);
	text-decoration: none;
}

.amble-photo .credit { padding: 4px 7px; background: var(--paper-raised); }

.amble-credit { margin-top: 5px; }

.amble-photo .credit:hover,
.amble-credit:hover { color: var(--ink); text-decoration: underline; }

.amble-summary {
	margin-top: 7px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--ink-soft);
}

.amble-poi-list {
	flex: 1;
	overflow-y: auto;
	padding: 4px 0 24px;
}

.amble-poi {
	display: flex;
	gap: 12px;
	padding: 14px 22px;
	cursor: pointer;
	border-bottom: 1px solid var(--rule);
}

.amble-poi:hover { background: var(--paper-raised); }

.amble-poi .marker {
	flex: none;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--ink);
	color: var(--paper);
	font-size: 11px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 2px;
}

.amble-poi .name {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}

.amble-poi .category {
	font-size: 11.5px;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--ink-faint);
	margin-top: 3px;
}

/* ---------- map markers ---------- */

.amble-marker {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--ink);
	border: 2px solid var(--paper);
	box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
	cursor: pointer;
}

.amble-marker:hover { background: #c8a200; }

/* Tour stops carry their position in the walk. Sized up from the browse dot so
   the digits are legible, and ringed so they read as a sequence. */
.amble-marker-numbered {
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--paper);
	font-family: var(--sans);
	font-size: 12px;
	font-weight: 700;
	border-color: var(--accent);
}

.maplibregl-popup-content {
	font-family: var(--sans);
	border-radius: var(--radius);
	padding: 12px 14px;
}

.amble-popup .name {
	font-family: var(--serif);
	font-size: 16px;
	font-weight: 600;
}

.amble-popup .category {
	font-size: 11px;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--ink-faint);
	margin-top: 2px;
}

/* ---------- you are here ---------- */

.amble-locate {
	position: absolute;
	right: 10px;
	bottom: 78px;
	z-index: 11;
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 50%;
	background: var(--paper-raised);
	box-shadow: var(--shadow);
	cursor: pointer;
	/* A crosshair, drawn rather than shipped as an icon file. */
	background-image:
		radial-gradient(circle at 50% 50%, var(--ink) 0 3px, transparent 3px),
		linear-gradient(var(--ink), var(--ink)),
		linear-gradient(var(--ink), var(--ink));
	background-repeat: no-repeat;
	background-position: 50% 50%, 50% 50%, 50% 50%;
	background-size: 100% 100%, 1.5px 13px, 13px 1.5px;
}

.amble-locate:hover { background-color: #fdf6dd; }

.amble-locate.is-active {
	background-color: var(--ink);
	background-image:
		radial-gradient(circle at 50% 50%, var(--accent) 0 3px, transparent 3px),
		linear-gradient(var(--accent), var(--accent)),
		linear-gradient(var(--accent), var(--accent));
}

.amble-me {
	position: relative;
	width: 18px;
	height: 18px;
}

.amble-me-dot {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: #1a73e8;
	border: 2.5px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}

/* How sure the device is, to scale. Sized in JS because it is a real distance. */
.amble-me-ring {
	position: absolute;
	left: 50%;
	top: 50%;
	border-radius: 50%;
	background: rgba(26, 115, 232, .15);
	border: 1px solid rgba(26, 115, 232, .35);
	pointer-events: none;
}

/* The facing cone. Rotated about the dot's centre, so its transform origin sits
   at the bottom of the element rather than the middle. */
.amble-me-cone {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 34px;
	height: 30px;
	transform-origin: 50% 100%;
	pointer-events: none;
	background: linear-gradient(to top, rgba(26, 115, 232, .45), rgba(26, 115, 232, 0));
	clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

/* ---------- status pill ---------- */

.amble-status {
	position: absolute;
	left: 50%;
	bottom: 28px;
	transform: translateX(-50%);
	z-index: 11;
	background: var(--ink);
	color: var(--paper);
	font-size: 13px;
	padding: 9px 18px;
	border-radius: 100px;
	box-shadow: var(--shadow);
	opacity: 0;
	transition: opacity .2s;
	pointer-events: none;
	white-space: nowrap;
}

.amble-status.is-visible { opacity: 1; }

/* ---------- attribution (ODbL requires this stays visible) ---------- */

.amble-attribution {
	position: absolute;
	right: 8px;
	bottom: 6px;
	z-index: 8;
	font-size: 11px;
	color: var(--ink-soft);
	background: rgba(250, 248, 245, .82);
	padding: 3px 8px;
	border-radius: 3px;
}

.amble-attribution a { color: inherit; }

/* ---------- narrow screens ---------- */

@media (max-width: 720px) {
	.amble-masthead {
		/* Wrap rather than stack: wordmark and the taste button share the top row,
		   and the search box takes the whole of the next one. Stacking all three
		   would eat a third of a phone screen before the map appears. */
		flex-wrap: wrap;
		align-items: center;
		gap: 10px;
		padding: 12px;
		/* Installed as a PWA the app draws under the status bar (the host page
		   sets viewport-fit=cover), so the chrome has to inset itself. Falls back
		   to 0 everywhere the env() vars do not exist. */
		padding-top: calc(12px + env(safe-area-inset-top, 0px));
	}

	.amble-masthead .amble-btn-chrome { margin-left: auto; }

	.amble-search {
		max-width: none;
		order: 3;
		flex: 1 1 100%;
	}

	.amble-modal { padding: 0; align-items: flex-end; }

	.amble-modal-card {
		max-width: none;
		height: 92%;
		border-radius: var(--radius) var(--radius) 0 0;
	}

	.amble-modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }

	.amble-drawer {
		width: 100%;
		top: auto;
		height: 52%;
		transform: translateY(100%);
		box-shadow: 0 -8px 32px rgba(27, 27, 27, .12);
	}

	.amble-drawer.is-open { transform: translateY(0); }
	.amble-drawer-head { padding-top: 18px; }

	/* Keep the last POI clear of the home indicator. */
	.amble-poi-list { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }

	.amble-status { bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
}
