/* TRAIL MAP STYLING */

html, body {
	padding: 0;
	margin: 0;
	width: 100%;
	height: 100%;
}

#map {
	position: fixed;
	top: 0;
	left: 0;
    top: env(safe-area-inset-top);
	bottom: constant(safe-area-inset-bottom);
    bottom: env(safe-area-inset-bottom);
    left: env(safe-area-inset-left);
    right: env(safe-area-inset-right);
}

.centered-map-window {
	background-color: rgba(0,0,0,.70);
	border: 2px solid #FFF;
	border-radius: 5px;
	padding: 10px;
    position: fixed;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
	overflow-y: auto;
	box-sizing: border-box;
	max-height: 100%;
	max-width: 100%;
}

/* UPLOAD FORM */

#gpx-upload-result {
	margin-top: 10px;
	margin-bottom: 10px;
}

/* NEW TRAIL STUFF */

div.nav-margin {
	margin-top: 10vh;
}

div.small-map-ss {
	position: relative;
	display: inline-block;
	width: calc(25% - 10px);
	min-width: 260px;
	max-width: 500px;
	margin: 5px;
	cursor: pointer;
	vertical-align: top;
	margin-top: 10px;
}

div.small-map-ss img {
	display: block;
	position: relative;
	overflow: hidden;
	border: 2px solid #000;
	max-width: 100% !important;
	max-height: 100% !important;
	border-radius: 5px;
}

img.mapStaticThumb {
	width: calc(100% - 4px);
}

div.stat-grid > p {
	display: block;
	margin: 0;
	min-width: 0;
	flex: 1 1 150px;
	max-width: 190px;
	padding: 10px 12px;
	border: 1px solid rgba(240, 223, 193, 0.14);
	border-radius: 8px;
	background: rgba(26, 20, 16, 0.52);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

div.stat-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin: 16px auto 0;
	max-width: 960px;
}

div.stat-grid p > span {
	font-size: 20px; 
	color: var(--accent-bright);
}

div.stat-grid p > span:first-of-type {
	display: inline-block;
	margin-bottom: 3px;
	color: var(--text-soft);
	letter-spacing: 0.04em;
}

.changelog-scroll {
	max-height: 70vh;
	overflow-y: auto;
	margin-top: 18px;
	padding: 18px 20px;
	text-align: left;
	background: rgba(20, 14, 11, 0.78);
	border: 1px solid rgba(240, 223, 193, 0.16);
	border-radius: 10px;
	box-shadow: inset 0 1px 0 rgba(255, 245, 221, 0.05);
	-webkit-overflow-scrolling: touch;
}

#ele-profile-container, #flow-graph-container {
	width: 50%;
	height: 200px;
}

/* newer one in testing */
div#map-small-3 {
	width: 175%;
	border: 2px solid #000;
	border-radius: 5px;
	height: 50vh;
	display: inline-block;
}

.trail-name {
	position: absolute;
	z-index: 20;
	text-align: center;
	width: 100%;
	max-width: 100%;
	color: #FFF;
	font-weight: bold;
	top: 2px;
	left: 2px;
	background-color: rgba(16, 12, 10, 0.78);
}

.trail-details {
	position: absolute;
	z-index: 20;
	text-align: center;
	width: 100%;
	max-width: 100%;
	color: #FFF;
	font-weight: bold;
	bottom: 2px;
	left: 2px;
	background-color: rgba(16, 12, 10, 0.78);
}

.trail-name-hover {
	color: var(--accent-bright);
	text-shadow: 0 0 12px rgba(201, 155, 71, 0.28);
}

img.intermap-img {
	width: 50%;
	border: 2px solid #000;
	border-radius: 5px;
}

img.rating-img {
	width: 35%;
	border: 2px solid #000;
	border-radius: 5px;
}

div.small-map-inner {
	position: relative;
	overflow: hidden;
	max-width: 100%;
}

div.trans-fill {
	display: none;
	width: 100%;
	max-width: 100%;
	height: calc(100% - 4px);
	background-color: rgba(24, 18, 14, 0.58);
	position: absolute;
	right: -2px;
	top: 2px;
	z-index: 10;
}

div#map-settings {
	display: none;
}

div#upload-imp-info {
	display: inline-block;
	width: 50%;
	box-sizing: border-box;
}

div#file-upload-wrapper {
	margin-top: 10px;
	background: rgb(192,192,192);
	background: radial-gradient(circle, rgba(192,192,192,1) 0%, rgba(92,92,92,1) 100%);
	border: 2px solid #000;
	color: #000;
	border-radius: 5px; 
	padding: 25px; 
	display: inline-block;
	text-align: center;
	width: 40%;
	box-sizing: border-box;
}

div#file-upload-wrapper:hover {
	cursor: pointer;
}

.upl-success {
	background: rgb(217,217,217) !important;
	background: radial-gradient(circle, rgba(217,217,217,1) 0%, rgba(127,255,0,1) 100%) !important;
}

.upl-maybe {
	background: rgb(217,217,217) !important;
	background: radial-gradient(circle, rgba(217,217,217,1) 0%, rgba(251,255,0,1) 100%) !important;
}

.upl-fail {
	background: rgb(217,217,217) !important;
	background: radial-gradient(circle, rgba(217,217,217,1) 0%, rgba(255,0,0,1) 100%) !important;
}

span#uplstatus {
	display: block;
}

div#file-upload-wrapper > img,
div#file-upload-wrapper > svg {
	margin: 0 auto;
	display: block;
	height: 50px;
}

div.stats-wrapper-2 {
	align-self: flex-start;
	margin-left: 20px;
	width: 100%;
}

div.trailinfo-wrapper-1 {
	display: flex;
	align-items: flex-start;
	margin-top: 10px;
	border: 2px solid #000;
	border-radius: 5px;
	padding: 5px;
	background-image: url("../images/trail-details-wp.webp");
	background-color: black;
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
}	

table.trail-stats {
	width: 100%;
}

table.trail-stats tr td:nth-child(2) {
	padding-left: 150px;
	float: right;
}

table.trail-stats td {
	vertical-align: top;
}

.file-link {
	display: inline-block;
	box-sizing: border-box;
	text-align: center;
	margin-top: 10px;
	margin-right: 10px;
	padding: 10px 14px;
	background: rgba(26, 20, 16, 0.72);
	border: 1px solid rgba(240, 223, 193, 0.22);
	color: var(--text-main) !important;
	border-radius: 10px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	backdrop-filter: blur(4px);
	font: inherit;
	line-height: 1.2;
	text-decoration: none !important;
	cursor: pointer;
	appearance: none;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.file-link:hover,
.file-link:focus-visible {
	background: rgba(44, 31, 22, 0.88) !important;
	border-color: rgba(201, 155, 71, 0.58);
	color: var(--accent-bright) !important;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
	transform: translateY(-1px);
	outline: none;
	text-decoration: none !important;
}

.file-link:disabled {
	background: rgba(246, 237, 220, 0.03) !important;
	border-color: rgba(215, 198, 175, 0.22);
	color: rgba(215, 198, 175, 0.5) !important;
	box-shadow: none;
	transform: none;
	cursor: not-allowed;
}

.file-link-recommended {
	border-color: rgba(201, 155, 71, 0.55);
	background:
		linear-gradient(180deg, rgba(201, 155, 71, 0.16), rgba(26, 20, 16, 0.82));
	color: var(--accent-bright) !important;
}

img.trail-preview-img {
	border: 2px solid #000;
	border-radius: 5px;
	width: 30vw;
	max-width: 400px;
}

div#gpx-upl-comp-wrapper-1 > div {
	padding: 10px;
}

div#gpx-upl-comp-wrapper-1 {
	display: flex;
	align-items: center;
	justify-content: center;
}

div#gpx-upl-stats-wrapper {
	text-align: left;
	width: 400px;
	border: 2px solid #FFF;
	border-radius: 5px;
	box-sizing: border-box;
}

table#gpx-upl-stats tr td:first-child {
	padding-right: 100px;
}

div#trail-search-wrapper {
	width: 100%;
}

form#trail-search {
	display: inline-block;
	margin-bottom: 10px;
}

form#trail-search input,
form#trail-search select {
	box-sizing: border-box;
	width: 100%;
}

/* UPLOAD FORM OVERRIDES */

#gpx-upload-form input,textarea,select {
	width: 30vw !important;
}

/* MAPBOX CSS OVERRIDES */

.mapboxgl-marker:hover {
	cursor: pointer;
}

.mapboxgl-popup {
	color: var(--text-main);
	max-width: none;
}

.trail-popup.mapboxgl-popup {
	max-width: min(420px, calc(100vw - 24px)) !important;
}

.trail-popup .mapboxgl-popup-content {
	padding: 0;
	background:
		linear-gradient(180deg, rgba(42, 31, 24, 0.98), rgba(19, 14, 11, 0.98));
	border: 1px solid rgba(240, 223, 193, 0.2);
	border-radius: 10px !important;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
	overflow: hidden;
}

.trail-popup .mapboxgl-popup-tip {
	border-top-color: rgba(19, 14, 11, 0.98);
	border-bottom-color: rgba(19, 14, 11, 0.98);
}

.trail-popup-card {
	padding: 16px;
	width: 100%;
	min-width: min(280px, calc(100vw - 48px));
	box-sizing: border-box;
}

.trail-popup-kicker {
	margin: 0 0 6px;
	color: var(--accent-bright);
	font-size: 12px;
	font-weight: bold;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.trail-popup-title {
	margin: 0 0 14px;
	font-size: 22px;
	line-height: 1.05;
	color: var(--text-main);
	text-wrap: balance;
}

.trail-popup-stats {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	margin-bottom: 14px;
}

.trail-popup-stats p {
	margin: 0;
	padding: 10px 12px;
	background: rgba(246, 237, 220, 0.04);
	border: 1px solid rgba(240, 223, 193, 0.14);
	border-radius: 10px !important;
}

.trail-popup-stats span,
.trail-popup-stats strong {
	display: block;
}

.trail-popup-stats span {
	margin-bottom: 2px;
	color: var(--text-soft);
	font-size: 12px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.trail-popup-stats strong {
	color: var(--text-main);
	font-size: 16px;
}

.trail-popup-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 42px;
	padding: 10px 14px;
	box-sizing: border-box;
	border-radius: 10px !important;
	border: 1px solid rgba(226, 187, 115, 0.52);
	background:
		linear-gradient(180deg, rgba(201, 155, 71, 0.2), rgba(71, 45, 24, 0.88));
	color: var(--accent-bright) !important;
	font-size: 14px;
	font-weight: bold;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	text-decoration: none !important;
	transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.trail-popup-link:hover,
.trail-popup-link:focus-visible {
	border-color: rgba(226, 187, 115, 0.78);
	box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
	transform: translateY(-1px);
	text-decoration: none !important;
}

/* TRAIL PICS GALLERY */

#trail-gallery {
	width: 100%;
	margin-top: 10px;
}

img.tpic-thumb {
	border: 2px solid #000;
	border-radius: 5px;
}

#style-menu {
	z-index: 5;
	position: fixed;
	bottom: 0;
	left: 50%;
	transform: translate(-50%, -50%);
	margin: 0 auto;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	justify-content: center;
	background:
		linear-gradient(180deg, rgba(42, 31, 24, 0.94), rgba(20, 14, 11, 0.94));
	border: 1px solid rgba(240, 223, 193, 0.22);
	border-radius: 10px;
	box-sizing: border-box;
	color: var(--text-main);
	padding: 10px 12px;
	font-size: 14px;
	font-weight: bold;
	box-shadow: 0 16px 38px rgba(0, 0, 0, 0.38);
	backdrop-filter: blur(8px);
}

#style-menu-toggle {
	display: none;
	position: fixed;
	left: 50%;
	bottom: 18px;
	transform: translateX(-50%);
	z-index: 6;
	padding: 12px 18px;
	border-radius: 10px;
	border: 1px solid rgba(226, 187, 115, 0.52);
	background:
		linear-gradient(180deg, rgba(42, 31, 24, 0.96), rgba(20, 14, 11, 0.96));
	color: var(--accent-bright);
	font: inherit;
	font-size: 14px;
	font-weight: bold;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	box-shadow: 0 16px 32px rgba(0, 0, 0, 0.32);
	backdrop-filter: blur(8px);
	cursor: pointer;
}

#style-menu-toggle:hover,
#style-menu-toggle:focus-visible {
	border-color: rgba(226, 187, 115, 0.72);
	background:
		linear-gradient(180deg, rgba(57, 41, 31, 0.96), rgba(28, 20, 15, 0.96));
}

#style-menu input[type="radio"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

#style-menu label {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 8px 10px;
	border-radius: 10px;
	border: 1px solid rgba(240, 223, 193, 0.14);
	background: rgba(246, 237, 220, 0.04);
	color: var(--text-soft);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 1;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}

#style-menu label:hover,
#style-menu label:focus-visible {
	background: rgba(201, 155, 71, 0.12);
	border-color: rgba(201, 155, 71, 0.36);
	color: var(--accent-bright);
	transform: translateY(-1px);
	box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

#style-menu input[type="radio"]:checked + label {
	background:
		linear-gradient(180deg, rgba(201, 155, 71, 0.22), rgba(71, 45, 24, 0.88));
	border-color: rgba(226, 187, 115, 0.72);
	color: var(--accent-bright);
	box-shadow:
		inset 0 1px 0 rgba(255, 245, 221, 0.18),
		0 12px 24px rgba(0, 0, 0, 0.24);
}

#style-menu input[type="radio"]:focus-visible + label {
	outline: 2px solid rgba(226, 187, 115, 0.75);
	outline-offset: 2px;
}

/* MOBILE */

@media only screen and (max-width: 1400px) {
	div.small-map-ss {
		width: calc(33.333% - 10px);
	}
}

@media only screen and (max-width: 1120px) {
	div.small-map-ss {
		width: calc(50% - 10px);
		min-width: 0;
	}
}

@media only screen and (max-device-width: 860px), only screen and (max-width: 860px) {
	/* map controls */
	
	#style-menu {
		display: none;
		bottom: 72px;
		transform: translateX(-50%);
		width: min(92vw, 460px);
		max-width: 92vw;
		max-height: min(60vh, 420px);
		overflow-y: auto;
		padding: 12px;
		gap: 6px;
		border-radius: 10px;
	}

	#style-menu.is-open {
		display: flex;
	}

	#style-menu label {
		flex: 1 1 calc(50% - 6px);
		min-width: 120px;
		padding: 10px 12px;
	}

	.trail-popup-card {
		min-width: 0;
		padding: 14px;
	}

	.trail-popup-stats {
		grid-template-columns: 1fr;
	}

	#style-menu-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
	
	
	
	/* ---------------------- */
	
	div.nav-margin {
		margin-top: 75px;
	}

	.file-link {
		display: block;
		width: 100%;
		margin-right: 0;
	}

	.centered-map-window {
		width: calc(100% - 20px);
	}
	
	/* NEW TRAIL STUFF */
	
	div.small-map-ss {
		width: calc(100% - 12px);
		box-sizing: border-box;
		margin: 10px auto 0;
	}

	div.stat-grid {
		gap: 8px;
	}

	div.stat-grid > p {
		flex-basis: 120px;
		max-width: 150px;
		padding: 8px 9px;
	}

	div.stat-grid p > span {
		font-size: 18px;
	}

	div.stat-grid p > span:first-of-type {
		font-size: 16px;
		line-height: 1.2;
	}

	.changelog-scroll {
		max-height: 65vh;
		padding: 14px 12px;
	}
	
	/*.small-map-inner img {
		width: calc(100% - 4px);
	}*/
	
	div#map-small-3 {
		height: 35vh;
		width: 100%;
		box-sizing: border-box;
	}
	
	img.intermap-img {
		width: 100%;
	}
	
	#gpx-upload-form {
		width: 100%;
	}
	
	form#gpx-upload-form input, 
	form#gpx-upload-form select, 
	form#gpx-upload-form textarea {
		width: 100% !important;
		box-sizing: border-box;
	}
	
	img.rating-img {
		width: 100%;
	}
	
	div#upload-imp-info {
		width: 100%;
	}
	
	div.trailinfo-wrapper-1 {
		border: none;
		border-radius: 0px;
		padding: 0px;
		background: none !important;
	}
	
	div.trailinfo-wrapper-1, div.trailinfo-wrapper-1 > div {
		display: block;
	}
	
	div.stats-wrapper-2, table.trail-stats {
		width: 100%;
		margin-left: 0;
	}
	
	table.trail-stats tr td:nth-child(2) {
		float: right;
		padding-left: 0;
	}
	
	div.stats-wrapper-2 {
		font-size: 18px;
	}
	
	img.trail-preview-img {
		width: calc(100% - 4px);
	}
	
	div#gpx-upl-comp-wrapper-1 {
		display: block;
		align-items: center;
		justify-content: center;
	}
	
	div#gpx-upl-comp-wrapper-1 div:first-child {
		border-right: none;
	}
	
	div#gpx-upl-stats-wrapper {
		text-align: center;
		width: 100%;
	}
	
	table#gpx-upl-stats {
		display: inline-block;
		margin: 0 auto;
		text-align: left;
	}
	
	div#trail-search-wrapper {
		width: 100%;
	}
	
	form#trail-search {
		display: block;
	}
	
	form#trail-search input,
	form#trail-search select {
		width: 100%;
	}
	
	img.tpic-thumb {
		box-sizing: border-box;
		width: 50%;
		max-width: 200px;
	}
	
	#ele-profile-container, #flow-graph-container {
		width: 100%;
	}
	
	div#file-upload-wrapper {
		width: 100%;
	}
	
}

@media only screen and (max-device-width: 860px) and (orientation: landscape), only screen and (max-width: 860px) and (orientation: landscape) {
	div#map-small-3 {
		height: 70vh;
	}
	
	div.small-map-ss {
		width: 40%;
		box-sizing: border-box;
		margin: 5px;
	}
}
	
