/**
 * Islamic Prayer Times - front-end styles.
 *
 * Everything is scoped under .ipt and driven by custom properties so themes
 * and page builders can override any single value without fighting the plugin.
 */

.ipt {
	--ipt-accent: #0f766e;
	--ipt-bg: #ffffff;
	--ipt-bg-alt: #f8fafc;
	--ipt-text: #0f172a;
	--ipt-muted: #64748b;
	--ipt-border: #e2e8f0;
	--ipt-radius: 12px;
	--ipt-shadow: 0 1px 2px rgba( 15, 23, 42, 0.04 ), 0 8px 24px -12px rgba( 15, 23, 42, 0.18 );
	--ipt-gap: 0.75rem;
	--ipt-pad: 0.75rem 1rem;

	box-sizing: border-box;
	color: var( --ipt-text );
	font-size: 1rem;
	line-height: 1.45;
	max-width: 100%;
}

.ipt *,
.ipt *::before,
.ipt *::after {
	box-sizing: inherit;
}

/* -------------------------------------------------------------- Themes -- */

.ipt--theme-dark {
	--ipt-bg: #0f172a;
	--ipt-bg-alt: #1e293b;
	--ipt-text: #f1f5f9;
	--ipt-muted: #94a3b8;
	--ipt-border: #334155;
	--ipt-shadow: 0 1px 2px rgba( 0, 0, 0, 0.4 ), 0 8px 24px -12px rgba( 0, 0, 0, 0.6 );
}

@media ( prefers-color-scheme: dark ) {
	.ipt--theme-auto {
		--ipt-bg: #0f172a;
		--ipt-bg-alt: #1e293b;
		--ipt-text: #f1f5f9;
		--ipt-muted: #94a3b8;
		--ipt-border: #334155;
		--ipt-shadow: 0 1px 2px rgba( 0, 0, 0, 0.4 ), 0 8px 24px -12px rgba( 0, 0, 0, 0.6 );
	}
}

.ipt--theme-minimal {
	--ipt-bg: transparent;
	--ipt-bg-alt: transparent;
	--ipt-border: currentColor;
	--ipt-text: inherit;
	--ipt-muted: inherit;
	--ipt-shadow: none;
	--ipt-radius: 0;
	color: inherit;
}

.ipt--theme-minimal .ipt__table,
.ipt--theme-minimal .ipt__list {
	border: 0;
	box-shadow: none;
}

/* -------------------------------------------------------------- Header -- */

.ipt__header {
	align-items: baseline;
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	justify-content: space-between;
	margin-bottom: 0.75rem;
}

.ipt__title {
	font-size: 1.125em;
	font-weight: 600;
	line-height: 1.3;
	margin: 0;
}

.ipt__meta {
	align-items: baseline;
	color: var( --ipt-muted );
	display: flex;
	flex-wrap: wrap;
	font-size: 0.875em;
	gap: 0.4rem;
}

/* The dot lives on the second item so it can never wrap onto its own line. */
.ipt__meta > * + *::before {
	content: '·';
	margin-inline-end: 0.4rem;
	opacity: 0.5;
}

/* --------------------------------------------------------- Next prayer -- */

.ipt__next {
	align-items: baseline;
	background: color-mix( in srgb, var( --ipt-accent ) 10%, var( --ipt-bg ) );
	border: 1px solid color-mix( in srgb, var( --ipt-accent ) 28%, transparent );
	border-radius: var( --ipt-radius );
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.7rem;
	margin-bottom: 0.75rem;
	padding: var( --ipt-pad );
}

.ipt__next-label {
	color: var( --ipt-muted );
	font-size: 0.75em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	width: 100%;
}

.ipt__next-name {
	color: var( --ipt-accent );
	font-size: 1.125em;
	font-weight: 700;
}

.ipt__next-time {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.ipt__countdown {
	background: color-mix( in srgb, var( --ipt-accent ) 16%, transparent );
	border-radius: 999px;
	color: var( --ipt-accent );
	font-size: 0.8125em;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	margin-inline-start: auto;
	padding: 0.15em 0.65em;
	white-space: nowrap;
}

/* --------------------------------------------------------------- Table -- */

.ipt__table {
	background: var( --ipt-bg );
	border: 1px solid var( --ipt-border );
	border-collapse: collapse;
	border-radius: var( --ipt-radius );
	border-spacing: 0;
	box-shadow: var( --ipt-shadow );
	overflow: hidden;
	width: 100%;
}

.ipt__table th,
.ipt__table td {
	border: 0;
	border-bottom: 1px solid var( --ipt-border );
	padding: var( --ipt-pad );
	text-align: start;
	vertical-align: middle;
}

.ipt__table thead th {
	background: var( --ipt-bg-alt );
	color: var( --ipt-muted );
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ipt__table tbody tr:last-child th,
.ipt__table tbody tr:last-child td {
	border-bottom: 0;
}

.ipt__table .ipt__name {
	font-weight: 600;
}

.ipt__adhan,
.ipt__iqamah {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ipt__dash {
	color: var( --ipt-muted );
}

/* ---------------------------------------------------------- List views -- */

.ipt__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ipt__item {
	align-items: baseline;
	border-bottom: 1px solid var( --ipt-border );
	display: flex;
	gap: var( --ipt-gap );
	justify-content: space-between;
	padding: var( --ipt-pad );
}

.ipt__item:last-child {
	border-bottom: 0;
}

.ipt__times {
	display: flex;
	font-variant-numeric: tabular-nums;
	gap: 0.75rem;
	white-space: nowrap;
}

.ipt__times .ipt__iqamah {
	color: var( --ipt-muted );
}

/* Cards */

.ipt--layout-cards .ipt__list {
	display: grid;
	gap: var( --ipt-gap );
	grid-template-columns: repeat( auto-fit, minmax( 8.5rem, 1fr ) );
}

.ipt--layout-cards .ipt__item {
	align-items: center;
	background: var( --ipt-bg );
	border: 1px solid var( --ipt-border );
	border-radius: var( --ipt-radius );
	box-shadow: var( --ipt-shadow );
	flex-direction: column;
	gap: 0.35rem;
	padding: 1rem 0.75rem;
	text-align: center;
}

.ipt--layout-cards .ipt__times {
	flex-direction: column;
	gap: 0.15rem;
}

.ipt--layout-cards .ipt__time {
	font-size: 1.25em;
	font-weight: 700;
}

/* Inline */

.ipt--layout-inline .ipt__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
}

.ipt--layout-inline .ipt__item {
	border: 0;
	flex-direction: column;
	gap: 0.1rem;
	padding: 0;
}

.ipt--layout-inline .ipt__name {
	color: var( --ipt-muted );
	font-size: 0.75em;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.ipt--layout-inline .ipt__time {
	font-size: 1.0625em;
	font-weight: 700;
}

/* Stacked */

.ipt--layout-stacked .ipt__list {
	background: var( --ipt-bg );
	border: 1px solid var( --ipt-border );
	border-radius: var( --ipt-radius );
	box-shadow: var( --ipt-shadow );
	overflow: hidden;
}

/* ------------------------------------------------------------ Emphasis -- */

.ipt__row.is-next,
.ipt__item.is-next {
	background: color-mix( in srgb, var( --ipt-accent ) 12%, var( --ipt-bg ) );
	position: relative;
}

.ipt__row.is-next .ipt__name,
.ipt__row.is-next .ipt__adhan,
.ipt__item.is-next .ipt__name,
.ipt__item.is-next .ipt__time {
	color: var( --ipt-accent );
	font-weight: 700;
}

.ipt--layout-cards .ipt__item.is-next {
	border-color: var( --ipt-accent );
	box-shadow: 0 0 0 2px color-mix( in srgb, var( --ipt-accent ) 30%, transparent );
}

.ipt__row.is-current,
.ipt__item.is-current {
	background: var( --ipt-bg-alt );
}

.ipt__row.is-past .ipt__name,
.ipt__row.is-past .ipt__adhan,
.ipt__row.is-past .ipt__iqamah,
.ipt__item.is-past {
	opacity: 0.62;
}

/* ------------------------------------------------------------- Arabic --- */

.ipt__arabic {
	color: var( --ipt-muted );
	display: block;
	font-size: 0.875em;
	font-weight: 400;
	line-height: 1.3;
}

.ipt--layout-inline .ipt__arabic,
.ipt--layout-cards .ipt__arabic {
	display: block;
}

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

.ipt--countdown {
	align-items: center;
	background: var( --ipt-bg );
	border: 1px solid var( --ipt-border );
	border-radius: var( --ipt-radius );
	box-shadow: var( --ipt-shadow );
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 1.25rem 1rem;
	text-align: center;
}

.ipt--countdown .ipt__title {
	color: var( --ipt-muted );
	font-size: 0.8125em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ipt__countdown-name {
	color: var( --ipt-accent );
	font-size: 1.25em;
	font-weight: 700;
}

.ipt__countdown--large {
	background: none;
	font-size: 2.25em;
	font-weight: 800;
	letter-spacing: 0.02em;
	line-height: 1.1;
	margin: 0;
	padding: 0;
}

.ipt__countdown-time {
	color: var( --ipt-muted );
	font-size: 0.875em;
	font-variant-numeric: tabular-nums;
}

.ipt--next {
	display: block;
}

.ipt--next .ipt__next {
	margin-bottom: 0;
}

/* ---------------------------------------------------------------- Misc -- */

.ipt--empty {
	background: var( --ipt-bg-alt );
	border: 1px dashed var( --ipt-border );
	border-radius: var( --ipt-radius );
	color: var( --ipt-muted );
	padding: 1rem;
}

.ipt--empty p {
	margin: 0;
}

.ipt .screen-reader-text {
	border: 0;
	clip: rect( 1px, 1px, 1px, 1px );
	clip-path: inset( 50% );
	height: 1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

@media ( max-width: 480px ) {
	.ipt {
		--ipt-pad: 0.625rem 0.75rem;
	}

	.ipt__table thead th:last-child,
	.ipt__table tbody td:last-child {
		white-space: nowrap;
	}

	/* The dates stack on narrow screens, so the separator would read as a
	   stray bullet at the start of the second line. */
	.ipt__meta > * + *::before {
		content: none;
	}

	.ipt__meta {
		gap: 0.1rem 0.6rem;
	}
}

/* Fallback for browsers without color-mix support. */
@supports not ( background: color-mix( in srgb, red 10%, white ) ) {
	.ipt__next,
	.ipt__row.is-next,
	.ipt__item.is-next {
		background: var( --ipt-bg-alt );
	}

	.ipt__countdown {
		background: var( --ipt-bg-alt );
	}
}
