/* Maintour Trails Map — earthy outdoor palette. Colours come from Maintour Map > Settings. */
.mt-root {
	--mt-primary: #3f6b3a;
	--mt-accent: #d9c7a3;
	--mt-height: 600px;
	--mt-ink: #2b2a26;
	--mt-muted: #6f6a5f;
	--mt-line: rgba(43, 42, 38, .14);
	--mt-panel: #f7f2e8;
	--mt-panel: color-mix(in srgb, var(--mt-accent) 28%, #fff);
	--mt-radius: 14px;
	color: var(--mt-ink);
	line-height: 1.45;
	container-type: inline-size;
}
.mt-root *, .mt-root *::before, .mt-root *::after { box-sizing: border-box; }
.mt-root [hidden] { display: none !important; }

/* Buttons */
.mt-root .mt-btn, .leaflet-container .mt-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	padding: 8px 14px; border: 1px solid var(--mt-primary); border-radius: 999px;
	background: var(--mt-primary); color: #fff !important; font: inherit; font-size: 14px; font-weight: 600;
	line-height: 1.2; text-decoration: none !important; cursor: pointer; white-space: nowrap;
	transition: filter .15s ease;
}
.mt-root .mt-btn:hover, .leaflet-container .mt-btn:hover { filter: brightness(1.1); }
.mt-root .mt-btn-ghost, .leaflet-container .mt-btn-ghost { background: transparent; color: var(--mt-primary) !important; }

/* ---------------- Explore layout ---------------- */
.mt-layout {
	position: relative; display: flex; height: var(--mt-height); min-height: 380px;
	border: 1px solid var(--mt-line); border-radius: var(--mt-radius); overflow: hidden; background: #fff;
}
.mt-mapwrap { position: relative; flex: 1 1 auto; min-width: 0; }
.mt-map { position: absolute; inset: 0; z-index: 0; background: #e8e4da; }
.mt-loading {
	position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500;
	padding: 6px 14px; border-radius: 999px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); font-size: 14px;
}

.mt-panel {
	flex: 0 0 320px; width: 320px; display: flex; flex-direction: column; min-height: 0;
	background: var(--mt-panel); border-right: 1px solid var(--mt-line); z-index: 2;
}
.mt-panel-top { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--mt-line); }
.mt-root .mt-search {
	flex: 1; min-width: 0; margin: 0; padding: 9px 12px; border: 1px solid var(--mt-line); border-radius: 999px;
	background: #fff; font: inherit; font-size: 15px; color: var(--mt-ink); box-shadow: none;
}
.mt-root .mt-search:focus { outline: 2px solid var(--mt-primary); outline-offset: 1px; }
.mt-root .mt-close {
	display: none; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%;
	background: #fff; color: var(--mt-ink); font-size: 24px; line-height: 1; cursor: pointer;
}
.mt-filters { padding: 4px 12px 10px; border-bottom: 1px solid var(--mt-line); }
.mt-root .mt-fs { margin: 8px 0 0; padding: 0; border: 0; min-width: 0; }
.mt-root .mt-fs legend {
	margin: 0 0 6px; padding: 0; font-size: 11px; font-weight: 700; letter-spacing: .06em;
	text-transform: uppercase; color: var(--mt-muted);
}
.mt-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.mt-root .mt-checks label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; cursor: pointer; }
.mt-root .mt-checks input { margin: 0; accent-color: var(--mt-primary); width: 16px; height: 16px; }
.mt-sw { display: inline-block; width: 18px; height: 4px; border-radius: 2px; }
.mt-sw-ico { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%; }
.mt-sw-ico svg { width: 13px; height: 13px; fill: #fff; }
.mt-sw-round { width: 12px; height: 12px; border-radius: 50%; }
.mt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mt-root .mt-chip-btn {
	margin: 0; padding: 5px 12px; border: 1px solid var(--mt-line); border-radius: 999px;
	background: #fff; color: var(--mt-ink); font: inherit; font-size: 13px; line-height: 1.2; cursor: pointer;
}
.mt-root .mt-chip-btn[aria-pressed="true"] { background: var(--mt-primary); border-color: var(--mt-primary); color: #fff; }
.mt-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.mt-root .mt-row label {
	display: flex; flex-direction: column; gap: 4px; margin: 0;
	font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mt-muted);
}
.mt-root .mt-row select {
	width: 100%; margin: 0; padding: 7px 8px; border: 1px solid var(--mt-line); border-radius: 8px;
	background: #fff; font: inherit; font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--mt-ink); height: auto;
}
.mt-root .mt-reset {
	margin: 10px 0 0; padding: 0; border: 0; background: none; color: var(--mt-primary);
	font: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; cursor: pointer;
}
.mt-results { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.mt-count { padding: 10px 12px 6px; font-size: 13px; color: var(--mt-muted); }
.mt-count strong { color: var(--mt-ink); }
.mt-root .mt-list { flex: 1 1 auto; min-height: 0; margin: 0; padding: 0 6px 10px; overflow-y: auto; list-style: none; }
.mt-root .mt-list li { margin: 0; padding: 0; }
.mt-root .mt-list button {
	display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; padding: 8px 6px;
	border: 0; border-radius: 10px; background: transparent; color: var(--mt-ink);
	font: inherit; text-align: left; cursor: pointer;
}
.mt-root .mt-list button:hover, .mt-root .mt-list button:focus-visible { background: rgba(255,255,255,.75); }
.mt-ico {
	flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.mt-ico svg { width: 17px; height: 17px; fill: #fff; }
.mt-li-text { display: flex; flex-direction: column; min-width: 0; }
.mt-li-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-li-meta { font-size: 12px; color: var(--mt-muted); }
.mt-root .mt-empty { padding: 14px 8px; font-size: 14px; color: var(--mt-muted); }

/* Floating "Filters" button (mobile only) */
.mt-root .mt-toggle {
	display: none; position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 600;
	box-shadow: 0 4px 14px rgba(0,0,0,.25);
}

/* ---------------- Markers ---------------- */
.mt-pin { background: none; border: 0; }
.mt-pin span {
	display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
	border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.mt-pin svg { width: 16px; height: 16px; fill: #fff; }
.mt-cluster { background: none; }
.mt-cluster span {
	display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%;
	background: var(--mt-primary); color: #fff; font-weight: 700; font-size: 13px;
	border: 3px solid rgba(255,255,255,.85); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mt-primary) 30%, transparent);
}
.mt-locate {
	width: 34px; height: 34px; padding: 6px; background: #fff; border: 2px solid rgba(0,0,0,.2) !important;
	border-radius: 4px; cursor: pointer;
}
.mt-locate svg { width: 100%; height: 100%; fill: #333; }
.mt-tip { font-weight: 600; }

/* ---------------- Popups ---------------- */
.mt-pop { font-size: 14px; color: #2b2a26; }
.mt-pop h4 { margin: 6px 0 8px; font-size: 17px; line-height: 1.25; color: #2b2a26; }
.mt-pop p { margin: 8px 0; }
.mt-chip {
	display: inline-block; padding: 2px 9px; border-radius: 999px; color: #fff;
	font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.mt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px 0; border-top: 1px solid rgba(0,0,0,.08); border-bottom: 1px solid rgba(0,0,0,.08); }
.mt-stats div { display: flex; flex-direction: column; }
.mt-stats b { font-size: 14px; }
.mt-stats span { font-size: 11px; color: #6f6a5f; }
.mt-note { font-size: 13px; color: #6f6a5f; }
.mt-pop-img { display: block; width: 100%; max-height: 140px; object-fit: cover; border-radius: 8px; margin: 4px 0 8px; }
.mt-pop-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 6px 0; }
.mt-pop-facts div { display: flex; flex-direction: column; }
.mt-pop-facts dt { font-size: 11px; color: #6f6a5f; }
.mt-pop-facts dd { margin: 0; font-weight: 600; }
.mt-pop-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-container .mt-pop-actions .mt-btn { padding: 6px 12px; font-size: 13px; }

/* ---------------- Single trail / place pages ---------------- */
.mt-summary { margin: 0 0 1.5em; }
.mt-single { position: relative; height: var(--mt-height); border-radius: var(--mt-radius); overflow: hidden; border: 1px solid var(--mt-line); }
.mt-single .mt-map, .mt-hikes-map .mt-map { position: absolute; inset: 0; }
.mt-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 16px 0; padding: 0; }
.mt-facts div { padding: 10px 12px; border-radius: 10px; background: var(--mt-panel); }
.mt-facts dt { margin: 0; font-size: 12px; color: var(--mt-muted); }
.mt-facts dd { margin: 2px 0 0; font-weight: 700; }
.mt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-source { font-size: 13px; color: var(--mt-muted); }

/* ---------------- Member hikes ---------------- */
.mt-hikes { margin: 0 0 1.5em; }
.mt-hikes-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.mt-hikes-stats div { flex: 1 1 110px; display: flex; flex-direction: column; padding: 10px 14px; border-radius: 12px; background: var(--mt-panel); }
.mt-hikes-stats strong { font-size: 20px; }
.mt-hikes-stats span { font-size: 12px; color: var(--mt-muted); }
.mt-hikes-map { position: relative; height: var(--mt-height); margin: 0 0 14px; border-radius: var(--mt-radius); overflow: hidden; border: 1px solid var(--mt-line); }
.mt-hike-add { margin: 0 0 14px; }
.mt-hike-add > summary { list-style: none; }
.mt-hike-add > summary::-webkit-details-marker { display: none; }
.mt-root .mt-hike-form { margin-top: 12px; padding: 16px; border: 1px solid var(--mt-line); border-radius: 12px; background: #fff; }
.mt-root .mt-hike-form p { margin: 0 0 12px; }
.mt-root .mt-hike-form label { display: block; margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.mt-root .mt-hike-form input[type="text"], .mt-root .mt-hike-form input[type="date"],
.mt-root .mt-hike-form select, .mt-root .mt-hike-form textarea {
	width: 100%; padding: 8px 10px; border: 1px solid var(--mt-line); border-radius: 8px; font: inherit; background: #fff;
}
.mt-root .mt-hike-form small { display: block; margin-top: 4px; color: var(--mt-muted); }
.mt-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mt-root .mt-hike-list { margin: 0; padding: 0; list-style: none; }
.mt-root .mt-hike { margin: 0; padding: 12px 0; border-top: 1px solid var(--mt-line); }
.mt-root .mt-hike-title {
	display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; background: none;
	color: var(--mt-ink); font: inherit; font-size: 16px; font-weight: 700; text-align: left; cursor: pointer;
}
.mt-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; }
.mt-hike-meta { margin: 2px 0 0 20px; font-size: 13px; color: var(--mt-muted); }
.mt-hike-notes { margin: 6px 0 0 20px; font-size: 14px; }
.mt-hike-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 16px; margin: 6px 0 0 20px; font-size: 13px; }
.mt-hike-actions a, .mt-hike-edit > summary { color: var(--mt-primary); font-weight: 600; cursor: pointer; }
.mt-hike-edit { flex: 1 1 100%; order: 3; }
.mt-hike-edit:not([open]) { flex: 0 0 auto; order: 0; }
.mt-hike-delete { margin: 0; }
.mt-root .mt-link-danger { margin: 0; padding: 0; border: 0; background: none; color: #b03a2e; font: inherit; font-weight: 600; cursor: pointer; }
.mt-badge { padding: 1px 7px; border-radius: 999px; background: var(--mt-panel); font-size: 11px; }
.mt-notice { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.mt-notice-success { background: #e6f2e2; color: #24501f; }
.mt-notice-error { background: #f8e3e0; color: #7a241a; }

/* ---------------- Member tools: Record + Upload ---------------- */
.mt-hike-tools { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.mt-hike-tools > details { flex: 0 0 auto; margin: 0; }
.mt-hike-tools > details[open] { flex: 1 1 100%; order: -1; }
.mt-hike-tools > details > summary { list-style: none; }
.mt-hike-tools > details > summary::-webkit-details-marker { display: none; }
.mt-root .mt-btn-rec { background: #c0392b; border-color: #c0392b; gap: 8px; }
.mt-rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: 0 0 10px; }
.mt-btn-rec .mt-rec-dot, .mt-rec-start .mt-rec-dot { background: #fff; }

/* ---------------- Live recorder ---------------- */
.mt-recorder { margin-top: 12px; }
.mt-rec { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--mt-line); border-radius: var(--mt-radius); background: #fff; }
.mt-rec-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.mt-root .mt-rec-act {
	display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 10px 12px;
	border: 2px solid var(--mt-line); border-radius: 12px; background: #fff; color: var(--mt-ink);
	font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.mt-root .mt-rec-act.is-on { border-color: var(--mt-primary); background: var(--mt-panel); }
.mt-root .mt-rec-act:disabled:not(.is-on) { opacity: .4; cursor: default; }
.mt-root .mt-rec-act:focus-visible { outline: 2px solid var(--mt-primary); outline-offset: 2px; }
.mt-rec-banner { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.mt-rec-banner[hidden] { display: none; }
.mt-rec-banner-rec { background: #fbe9e7; color: #8e2a1f; }
.mt-rec-banner-warn { background: #fff4d6; color: #6b4e00; }
.mt-rec-banner-rec .mt-rec-dot { animation: mt-blink 1.2s ease-in-out infinite; }
@keyframes mt-blink { 50% { opacity: .2; } }
.mt-rec-mapwrap { position: relative; height: 46vh; min-height: 260px; max-height: 520px; border-radius: 12px; overflow: hidden; border: 1px solid var(--mt-line); }
.mt-rec-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mt-rec-stats div { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; background: var(--mt-panel); min-width: 0; }
.mt-rec-stats b { font-size: 22px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.mt-rec-stats span { font-size: 11px; color: var(--mt-muted); }
.mt-rec-ctrl { display: flex; flex-wrap: wrap; gap: 10px; }
.mt-rec-ctrl .mt-btn { flex: 1 1 140px; justify-content: center; min-height: 52px; font-size: 17px; gap: 8px; }
.mt-rec-ctrl .mt-btn[hidden] { display: none; }
.mt-root .mt-rec-start { background: #c0392b; border-color: #c0392b; }
.mt-root .mt-rec-finish { background: var(--mt-ink); border-color: var(--mt-ink); }
.mt-root .mt-rec-form { margin-top: 0; }
.mt-rec-form[hidden], .mt-rec-msg:empty { display: none; }
.mt-rec-formbtns { display: flex; align-items: center; gap: 16px; }
.mt-rec-msg.mt-notice { margin: 0; }
.mt-notice-warn { background: #fff4d6; color: #6b4e00; }
@media (max-width: 480px) {
	.mt-rec { padding: 10px; }
	.mt-rec-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
	.mt-rec-banner-rec .mt-rec-dot { animation: none; }
}

/* ---------------- Narrow: mobile, or a map placed in a narrow column ---------------- */
@container (max-width: 720px) {
	.mt-layout { display: block; height: var(--mt-height); max-height: 85vh; }
	.mt-mapwrap { position: absolute; inset: 0; }
	.mt-panel {
		position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: 78%;
		border-right: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -6px 20px rgba(0,0,0,.2);
		transform: translateY(105%); transition: transform .25s ease; z-index: 700;
	}
	.mt-panel-open .mt-panel { transform: none; }
	.mt-root .mt-close { display: block; }
	.mt-root .mt-toggle { display: inline-flex; }
	.mt-nopanel .mt-toggle { display: none; }
	.mt-form-row { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 760px) {
	.mt-layout { display: block; height: var(--mt-height); max-height: 85vh; }
	.mt-mapwrap { position: absolute; inset: 0; }
	.mt-panel {
		position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: 78%;
		border-right: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -6px 20px rgba(0,0,0,.2);
		transform: translateY(105%); transition: transform .25s ease; z-index: 700;
	}
	.mt-panel-open .mt-panel { transform: none; }
	.mt-root .mt-close { display: block; }
	.mt-root .mt-toggle { display: inline-flex; }
	.mt-nopanel .mt-toggle { display: none; }
	.mt-form-row { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.mt-panel { transition: none; }
}
