/* Haramain Live — countdown, Imam and weather.
 *
 * Every rule is scoped under the .hptl root. That is deliberate: a bare
 * `.hptl-list` (specificity 0-1-0) loses to a theme's `body.x ul` (0-1-1), and
 * themes routinely ship global ul/li/p rules that would otherwise indent the
 * prayer rows and collapse the spacing inside the card. `.hptl .hptl-list`
 * (0-2-0) wins without needing !important.
 */

.hptl {
	--hptl-green: #0e6b41;
	--hptl-green-dark: #094e2f;
	--hptl-gold: #c9a45c;
	--hptl-bg: #f7f6f2;
	--hptl-card: #fffdf8;
	--hptl-line: #e6e2d8;
	--hptl-text: #1f2d25;
	--hptl-muted: #6b7a71;
	--hptl-pad: 20px;
	--hptl-inset: 16px;
	font-family: inherit;
	font-size: 16px;
	line-height: 1.5;
	color: var(--hptl-text);
	max-width: 960px;
	margin-left: auto;
	margin-right: auto;
	text-align: left;
}

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

.hptl .hptl-title {
	text-align: center;
	font-size: 1.5rem;
	line-height: 1.3;
	margin: 0 0 6px;
	padding: 0;
	color: var(--hptl-green);
}

.hptl .hptl-week {
	text-align: center;
	font-size: .8rem;
	line-height: 1.5;
	color: var(--hptl-muted);
	margin: 0 0 20px;
	padding: 0;
}

.hptl .hptl-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 22px;
	align-items: start;
	justify-content: center;
	margin: 0;
	padding: 0;
}

/* ---------------------------------------------------------------- Card -- */

.hptl .hptl-card {
	position: relative;
	background: var(--hptl-card);
	border: 1px solid var(--hptl-line);
	border-radius: 18px;
	padding: var(--hptl-pad);
	margin: 0;
	overflow: hidden;
	text-align: left;
	box-shadow: 0 4px 18px rgba(31, 45, 37, .07);
}

.hptl .hptl-card::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 4px;
	background: linear-gradient(90deg, var(--hptl-green), var(--hptl-gold));
}

.hptl .hptl-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin: 0;
	padding: 0 0 14px;
	border-bottom: 1px solid var(--hptl-line);
}

.hptl .hptl-id {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.hptl .hptl-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #2eb85c;
	box-shadow: 0 0 0 0 rgba(46, 184, 92, .55);
	animation: hptl-pulse 2s infinite;
	flex: none;
}

@keyframes hptl-pulse {
	0% { box-shadow: 0 0 0 0 rgba(46, 184, 92, .55); }
	70% { box-shadow: 0 0 0 9px rgba(46, 184, 92, 0); }
	100% { box-shadow: 0 0 0 0 rgba(46, 184, 92, 0); }
}

.hptl .hptl-name {
	margin: 0;
	padding: 0;
	font-size: 1.1rem;
	line-height: 1.25;
	color: var(--hptl-green);
}

.hptl .hptl-city {
	margin: 3px 0 0;
	padding: 0;
	font-size: .72rem;
	line-height: 1.2;
	color: var(--hptl-muted);
	text-transform: uppercase;
	letter-spacing: .08em;
}

/* ------------------------------------------------------------- Weather -- */

.hptl .hptl-wx {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: none;
	background: rgba(14, 107, 65, .07);
	border: 1px solid rgba(14, 107, 65, .12);
	border-radius: 999px;
	padding: 5px 12px 5px 9px;
	margin: 0;
	white-space: nowrap;
}

.hptl .hptl-wx-icon {
	font-size: 1.05rem;
	line-height: 1;
}

.hptl .hptl-wx-temp {
	font-size: .9rem;
	font-weight: 700;
	color: var(--hptl-green);
	font-variant-numeric: tabular-nums;
}

.hptl .hptl-dates {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 10px;
	font-size: .76rem;
	line-height: 1.4;
	color: var(--hptl-muted);
	margin: 14px 0 16px;
	padding: 0 var(--hptl-inset);
	min-height: 1em;
}

.hptl .hptl-dates span:first-child {
	color: var(--hptl-green);
	font-weight: 600;
}

.hptl .hptl-dates span:empty { display: none; }

/* ------------------------------------------------------------ Countdown -- */

.hptl .hptl-next {
	background: linear-gradient(140deg, var(--hptl-green), var(--hptl-green-dark));
	color: #fff;
	border-radius: 14px;
	padding: 18px var(--hptl-inset) 16px;
	/* Clear separation from the timetable below. */
	margin: 0 0 22px;
	text-align: center;
}

.hptl .hptl-next-label {
	margin: 0;
	padding: 0;
	font-size: .68rem;
	line-height: 1.3;
	text-transform: uppercase;
	letter-spacing: .14em;
	opacity: .78;
	text-align: center;
}

.hptl .hptl-next-name {
	display: flex;
	align-items: baseline;
	justify-content: center;
	flex-wrap: wrap;
	gap: 4px 8px;
	margin: 6px 0 14px;
	padding: 0;
	font-size: 1.3rem;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
}

.hptl .hptl-next-at {
	margin: 0;
	font-size: .8rem;
	font-weight: 500;
	opacity: .82;
	font-variant-numeric: tabular-nums;
}

.hptl .hptl-clock {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	gap: 3px;
	margin: 0;
	padding: 0;
}

.hptl .hptl-seg {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 56px;
	background: rgba(255, 255, 255, .12);
	border-radius: 10px;
	padding: 7px 5px 5px;
	margin: 0;
}

.hptl .hptl-seg b {
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	letter-spacing: .02em;
}

.hptl .hptl-seg i {
	font-style: normal;
	font-size: .58rem;
	line-height: 1;
	text-transform: uppercase;
	letter-spacing: .1em;
	opacity: .72;
	margin-top: 5px;
}

.hptl .hptl-colon {
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1;
	padding-top: 11px;
	opacity: .45;
}

/* Breathing room between the countdown and the Imam line, plus a hairline
 * rule so the two read as separate pieces of information. */
.hptl .hptl-next-imam {
	margin: 16px 0 0;
	padding: 13px 0 0;
	border-top: 1px solid rgba(255, 255, 255, .18);
	font-size: .82rem;
	line-height: 1.45;
	opacity: .92;
	text-align: center;
}

.hptl .hptl-next-imam:empty { display: none; }

/* ------------------------------------------------------------ Timetable -- */

.hptl .hptl-list {
	list-style: none;
	margin: 0;
	padding: 0;
	text-align: left;
}

.hptl .hptl-list > li {
	list-style: none;
	margin: 0;
}

.hptl .hptl-list > li::marker { content: ""; }

.hptl .hptl-row {
	display: grid;
	grid-template-columns: minmax(62px, auto) 1fr auto;
	gap: 2px 14px;
	align-items: baseline;
	/* Same horizontal inset as .hptl-next, so both sections line up. */
	padding: 11px var(--hptl-inset);
	border-radius: 9px;
	border-bottom: 1px solid var(--hptl-line);
	text-align: left;
}

.hptl .hptl-list > li:last-child .hptl-row,
.hptl .hptl-row:last-child { border-bottom: none; }

.hptl .hptl-row-name {
	font-weight: 600;
	font-size: .9rem;
	line-height: 1.4;
}

.hptl .hptl-row-imam {
	font-size: .75rem;
	color: var(--hptl-muted);
	line-height: 1.4;
	overflow-wrap: anywhere;
}

.hptl .hptl-row-imam:empty { display: none; }

.hptl .hptl-row-time {
	font-size: .92rem;
	line-height: 1.4;
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

.hptl .hptl-row.is-next {
	background: rgba(14, 107, 65, .09);
	border-bottom-color: transparent;
	box-shadow: inset 3px 0 0 var(--hptl-gold);
}

.hptl .hptl-row.is-next .hptl-row-name,
.hptl .hptl-row.is-next .hptl-row-time {
	color: var(--hptl-green);
	font-weight: 700;
}

.hptl .hptl-foot {
	margin: 16px 0 0;
	padding: 12px var(--hptl-inset) 0;
	border-top: 1px solid var(--hptl-line);
	text-align: right;
	font-size: .7rem;
	line-height: 1.4;
	color: var(--hptl-muted);
}

.hptl .hptl-foot span:empty { display: none; }

.hptl .hptl-source {
	text-align: center;
	font-size: .75rem;
	color: var(--hptl-muted);
	margin: 20px 0 0;
	padding: 0;
	line-height: 1.7;
}

.hptl .hptl-source a {
	color: var(--hptl-green);
	text-decoration: underline;
}

/* A failed refresh dims the card rather than blanking it. */
.hptl .hptl-card.is-offline { opacity: .72; }
.hptl .hptl-card.is-offline .hptl-dot { animation: none; background: #b9a24a; }

/* ----------------------------------------------------------- Responsive -- */

@media (max-width: 400px) {
	.hptl {
		--hptl-pad: 16px;
		--hptl-inset: 12px;
	}

	.hptl .hptl-row {
		grid-template-columns: 1fr auto;
	}

	.hptl .hptl-row-imam {
		grid-column: 1 / -1;
		order: 3;
		margin-top: 2px;
	}

	.hptl .hptl-seg { min-width: 48px; }
	.hptl .hptl-seg b { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
	.hptl .hptl-dot { animation: none; }
}

@media (prefers-color-scheme: dark) {
	.hptl {
		--hptl-card: #16201a;
		--hptl-line: #2a3830;
		--hptl-text: #e8efe9;
		--hptl-muted: #9bada2;
	}

	.hptl .hptl-card { box-shadow: 0 4px 18px rgba(0, 0, 0, .3); }
	.hptl .hptl-name,
	.hptl .hptl-wx-temp,
	.hptl .hptl-dates span:first-child { color: #6fcf97; }
	.hptl .hptl-wx { background: rgba(111, 207, 151, .1); border-color: rgba(111, 207, 151, .2); }
	.hptl .hptl-row.is-next { background: rgba(111, 207, 151, .12); }
	.hptl .hptl-row.is-next .hptl-row-name,
	.hptl .hptl-row.is-next .hptl-row-time { color: #6fcf97; }
	.hptl .hptl-source a { color: #6fcf97; }
}
