/*!
 * Stacked Sun Path — v1.0.0
 * Every colour is a custom property, so a child theme can restyle the
 * whole widget by overriding .sunpath { --sp-* }.
 */

.sunpath {
	--sp-ink: #1b1a18;
	--sp-muted: #6d6a64;
	--sp-line: rgba(24, 23, 21, 0.85);
	--sp-halo: rgba(255, 255, 255, 0.95);
	--sp-beam: #e04b23;
	--sp-sun: #f7b32b;
	--sp-panel: #fbfaf8;
	--sp-border: #e5e1da;
	--sp-radius: 6px;
	--sp-beam-opacity: 1;
	--sp-beam-width: 2.4;

	margin: 0 0 1.75em;
	font-size: 15px;
	line-height: 1.5;
	color: var(--sp-ink);
}

.sunpath *,
.sunpath *::before,
.sunpath *::after {
	box-sizing: border-box;
}

/* ---------- stage: the site plan + the dial on top ---------- */

.sunpath__stage {
	position: relative;
	overflow: hidden;
	border-radius: var(--sp-radius) var(--sp-radius) 0 0;
	background: #eee;
	line-height: 0;
}

.sunpath__stage > img,
.sunpath__stage > svg.sunpath__plan {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
}

.sunpath__dial {
	position: absolute;
	transform: translate(-50%, -50%);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.sunpath.is-ready .sunpath__dial {
	opacity: 1;
}

.sunpath__svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
	/* one halo for the whole overlay, so it reads over dark greenery
	   and pale roofs alike without doubling every stroke */
	filter: drop-shadow(0 0 1.5px var(--sp-halo)) drop-shadow(0 0 3px rgba(255, 255, 255, 0.6));
}

.sunpath__ring,
.sunpath__axis,
.sunpath__tick {
	fill: none;
	stroke: var(--sp-line);
	stroke-width: 0.6;
}

.sunpath__ring {
	stroke-width: 0.7;
}

.sunpath__tick {
	stroke-width: 0.5;
}

.sunpath__cardinal {
	fill: var(--sp-ink);
	font-family: inherit;
	font-size: 5px;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.sunpath__track {
	stroke: var(--sp-beam);
	stroke-width: 1.2;
	stroke-linecap: round;
	opacity: 0.42;
}

.sunpath__hour {
	stroke: var(--sp-line);
	stroke-width: 0.45;
	opacity: 0.7;
}

.sunpath__band {
	stroke: var(--sp-line);
	stroke-width: 3.4;
	stroke-linecap: butt;
	opacity: 0.22;
}

.sunpath__bandcap {
	fill: var(--sp-line);
	opacity: 0.45;
}

.sunpath__beamline {
	stroke: var(--sp-beam);
	stroke-width: var(--sp-beam-width);
	stroke-linecap: round;
	opacity: var(--sp-beam-opacity);
}

.sunpath__beamhead {
	fill: var(--sp-beam);
	opacity: var(--sp-beam-opacity);
}

.sunpath__sun {
	fill: var(--sp-sun);
	stroke: #fff;
	stroke-width: 1;
}

.sunpath__halo {
	fill: var(--sp-sun);
	opacity: 0.28;
}

.sunpath.is-night .sunpath__beamline,
.sunpath.is-night .sunpath__beamhead,
.sunpath.is-night .sunpath__sun,
.sunpath.is-night .sunpath__halo {
	display: none;
}

.sunpath__credit {
	position: absolute;
	right: 10px;
	bottom: 8px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.14em;
	line-height: 1;
	text-transform: uppercase;
	color: #fff;
	background: rgba(20, 19, 17, 0.72);
	padding: 5px 8px;
	border-radius: 3px;
}

/* ---------- controls ---------- */

.sunpath__controls {
	display: flex;
	flex-wrap: wrap;
	gap: 14px 20px;
	align-items: flex-end;
	padding: 14px 16px;
	background: var(--sp-panel);
	border: 1px solid var(--sp-border);
	border-top: 0;
}

.sunpath__row {
	flex: 1 1 220px;
	min-width: 0;
}

.sunpath__row--actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 14px;
}

.sunpath__field {
	display: block;
}

.sunpath__label {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 10px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--sp-muted);
	margin-bottom: 6px;
}

.sunpath__value {
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0;
	text-transform: none;
	color: var(--sp-ink);
	font-variant-numeric: tabular-nums;
}

.sunpath__range-input {
	-webkit-appearance: none;
	appearance: none;
	display: block;
	width: 100%;
	height: 20px;
	margin: 0;
	background: transparent;
	cursor: pointer;
}

.sunpath__range-input::-webkit-slider-runnable-track {
	height: 4px;
	border-radius: 2px;
	background: var(--sp-border);
}

.sunpath__range-input::-moz-range-track {
	height: 4px;
	border-radius: 2px;
	background: var(--sp-border);
}

.sunpath__range-input::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	margin-top: -7px;
	border-radius: 50%;
	background: var(--sp-beam);
	border: 2px solid var(--sp-panel);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.sunpath__range-input::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--sp-beam);
	border: 2px solid var(--sp-panel);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.sunpath__range-input:focus-visible {
	outline: 2px solid var(--sp-beam);
	outline-offset: 4px;
}

.sunpath__btn {
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	padding: 8px 16px;
	border-radius: 999px;
	border: 1px solid var(--sp-ink);
	background: transparent;
	color: var(--sp-ink);
	cursor: pointer;
	white-space: nowrap;
}

.sunpath__btn:hover {
	background: var(--sp-ink);
	color: var(--sp-panel);
}

.sunpath__btn.is-playing {
	background: var(--sp-ink);
	color: var(--sp-panel);
}

.sunpath__toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--sp-muted);
	cursor: pointer;
	white-space: nowrap;
}

/* ---------- readout ---------- */

.sunpath__readout {
	padding: 14px 16px 16px;
	background: var(--sp-panel);
	border: 1px solid var(--sp-border);
	border-top: 0;
	border-radius: 0 0 var(--sp-radius) var(--sp-radius);
}

.sunpath__headline {
	margin: 0 0 4px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
}

.sunpath__detail {
	margin: 0 0 6px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--sp-ink);
	opacity: 0.88;
}

.sunpath__times {
	margin: 0;
	font-size: 12.5px;
	color: var(--sp-muted);
	font-variant-numeric: tabular-nums;
}

/* no JS: the plan still shows, nothing is broken */
.sunpath:not(.is-ready) .sunpath__controls,
.sunpath:not(.is-ready) .sunpath__readout {
	display: none;
}

@media (max-width: 600px) {
	.sunpath__controls {
		gap: 12px;
	}

	.sunpath__row {
		flex: 1 1 100%;
	}

	.sunpath__row--actions {
		flex: 1 1 100%;
		justify-content: space-between;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sunpath__dial {
		transition: none;
	}
}

.sunpath__caption {
	margin: 8px 2px 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--sp-muted);
}
