/**
 * Deep Sky Time — calendar UI.
 * Matches the Elementor kit: #141314 bg · Inter · teal #00AAC4 primary
 * (same token pattern as the astromania plugin's rovimen.css).
 */

.dst-app {
	--dst-primary:     var(--e-global-color-primary,   #00AAC4);
	--dst-secondary:   var(--e-global-color-secondary, #F7A715);
	--dst-text:        var(--e-global-color-text,      #E6E1E3);

	--dst-bg:          #141314;
	--dst-surface:     #1e1d1e;
	--dst-surface-alt: #252325;
	--dst-border:      #2e2c2e;
	--dst-border-mid:  #3a383a;
	--dst-muted:       #8a8688;

	--dst-font: var(--e-global-typography-text-font-family, "Inter"), system-ui, sans-serif;
	--dst-primary-dim:  rgba(0, 170, 196, .12);
	--dst-primary-glow: rgba(0, 170, 196, .25);
	--dst-radius-sm: 6px;
	--dst-radius:    10px;
	--dst-radius-lg: 16px;

	font-family: var(--dst-font);
	color: var(--dst-text);
}

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

/* The Elementor kit gives every <p> a large bottom margin; neutralize it
   inside the widget (specific margins below re-add what we need). */
.dst-app p {
	margin: 0;
}

.dst-loading,
.dst-error {
	padding: 2rem 1rem;
	text-align: center;
	color: var(--dst-muted);
}

.dst-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.dst-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .75rem 1rem;
	margin-bottom: 1rem;
}

.dst-title {
	margin: 0;
	font-size: 1.35rem;
	font-weight: 600;
	text-transform: capitalize;
	min-width: 11rem;
}

.dst-nav {
	display: flex;
	gap: .375rem;
}

.dst-btn {
	background: var(--dst-surface);
	border: 1px solid var(--dst-border);
	border-radius: var(--dst-radius-sm);
	color: var(--dst-text);
	font-family: inherit;
	font-size: .95rem;
	line-height: 1;
	padding: .5rem .75rem;
	cursor: pointer;
	transition: border-color .15s, box-shadow .15s;
}

.dst-btn:hover {
	border-color: var(--dst-primary);
	box-shadow: 0 0 0 3px var(--dst-primary-dim);
}

/* The Elementor kit paints its own background/color on button hover/focus/
   active; pin ours down with higher specificity so cells never change hue. */
.dst-app button.dst-btn,
.dst-app button.dst-btn:hover,
.dst-app button.dst-btn:focus,
.dst-app button.dst-btn:active {
	background: var(--dst-surface);
	color: var(--dst-text);
}

.dst-app button.dst-cell,
.dst-app button.dst-cell:hover,
.dst-app button.dst-cell:focus,
.dst-app button.dst-cell:active {
	background: var(--dst-surface);
	color: var(--dst-text);
	/* The kit also pill-rounds every button (24px); keep cells crisp. */
	border-radius: 4px;
}

.dst-app button:focus-visible {
	outline: 2px solid var(--dst-primary);
	outline-offset: 1px;
}

/* ── Location autocomplete ───────────────────────────────────────────────── */

.dst-location {
	position: relative;
	margin-left: auto;
	min-width: 220px;
}

.dst-loc-input {
	width: 100%;
	background: var(--dst-surface);
	border: 1px solid var(--dst-border);
	border-radius: var(--dst-radius-sm);
	color: var(--dst-text);
	font-family: inherit;
	font-size: .95rem;
	padding: .5rem .75rem;
}

.dst-loc-input {
	padding-right: 2.3rem; /* room for the GPS button */
}

.dst-loc-input:focus {
	outline: none;
	border-color: var(--dst-primary);
	box-shadow: 0 0 0 3px var(--dst-primary-dim);
}

/* GPS detect button, inside the input on the right. */
.dst-app button.dst-geo {
	position: absolute;
	top: 50%;
	right: .3rem;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.7rem;
	height: 1.7rem;
	padding: 0;
	background: none;
	border: none;
	border-radius: 50%;
	color: var(--dst-muted);
	cursor: pointer;
}

.dst-app button.dst-geo:hover,
.dst-app button.dst-geo:focus {
	background: none;
	color: var(--dst-primary);
}

.dst-geo-busy svg {
	animation: dst-rot 1s linear infinite;
}

@keyframes dst-rot {
	to { transform: rotate(360deg); }
}

.dst-loc-list {
	position: absolute;
	z-index: 30;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	margin: 0;
	padding: .25rem;
	list-style: none;
	background: var(--dst-surface-alt);
	border: 1px solid var(--dst-border-mid);
	border-radius: var(--dst-radius-sm);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
	max-height: 280px;
	overflow-y: auto;
}

.dst-loc-item {
	display: flex;
	justify-content: space-between;
	gap: .75rem;
	padding: .45rem .6rem;
	border-radius: var(--dst-radius-sm);
	cursor: pointer;
	font-size: .9rem;
}

.dst-loc-item:hover {
	background: var(--dst-primary-dim);
}

.dst-loc-county {
	color: var(--dst-muted);
	font-size: .8rem;
}

.dst-loc-empty {
	padding: .45rem .6rem;
	color: var(--dst-muted);
	font-size: .9rem;
}

/* ── Calendar grid ───────────────────────────────────────────────────────── */

.dst-weekdays {
	display: grid;
	/* minmax(0, …) lets cells shrink below their content width, otherwise the
	   grid refuses to compress on narrow screens and overflows the viewport. */
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 6px;
	margin-bottom: 6px;
	color: var(--dst-muted);
	font-size: .75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	text-align: center;
}

.dst-grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 6px;
}

.dst-cell {
	display: flex;
	flex-direction: column;
	gap: .3rem;
	min-width: 0;
	overflow: hidden;
	min-height: 96px;
	padding: .5rem .55rem;
	background: var(--dst-surface);
	border: 1px solid var(--dst-border);
	border-radius: 4px;
	color: var(--dst-text);
	font-family: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color .15s, box-shadow .15s;
}

.dst-cell:hover {
	border-color: var(--dst-primary);
	box-shadow: 0 0 12px var(--dst-primary-dim);
}

.dst-cell-blank {
	background: transparent;
	border-color: transparent;
	cursor: default;
	pointer-events: none;
}

/* Today: amber border on the cell plus the day number in a filled amber
   circle. Scoped with .dst-app so the hover rule can't retint the border. */
.dst-app .dst-cell-today {
	border-color: var(--dst-secondary);
}

.dst-cell-today .dst-cell-date {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.5rem;
	height: 1.5rem;
	padding: 0 .3rem;
	margin: -.15rem 0;
	border-radius: 999px;
	background: var(--dst-secondary);
	color: var(--dst-bg);
}

.dst-cell-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.dst-cell-date {
	font-weight: 600;
	font-size: .95rem;
}

.dst-cell-moon {
	display: inline-flex;
	border-radius: 50%;
}

.dst-cell-moon-quarter {
	box-shadow: 0 0 0 2px var(--dst-primary-glow);
}

.dst-cell-body {
	display: flex;
	flex-direction: column;
	gap: .2rem;
}

.dst-cell-wait {
	color: var(--dst-muted);
}

.dst-badge {
	align-self: flex-start;
	max-width: 100%;
	background: var(--dst-primary-dim);
	color: var(--dst-primary);
	border-radius: var(--dst-radius-sm);
	padding: .1rem .4rem;
	font-size: .85rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.dst-badge-zero {
	background: var(--dst-surface-alt);
	color: var(--dst-muted);
	font-weight: 400;
}

.dst-cell-row {
	display: flex;
	align-items: center;
	gap: .3rem;
	color: var(--dst-muted);
	font-size: .72rem;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.dst-cell-ico {
	width: .9em;
	text-align: center;
}

/* Deep-sky interval shown right under the duration badge. */
.dst-cell-win {
	color: var(--dst-primary);
	opacity: .85;
}

/* ── Moon icon ───────────────────────────────────────────────────────────── */

.dst-moon-disk {
	fill: var(--dst-surface-alt);
	stroke: var(--dst-border-mid);
	stroke-width: 1;
}

.dst-moon-lit {
	fill: #d9d4d6;
}

/* ── Day detail ──────────────────────────────────────────────────────────── */

.dst-detail {
	margin-bottom: 1.25rem;
}

.dst-detail-title {
	margin: 0 0 .5rem;
	font-size: 1rem;
	font-weight: 600;
}

.dst-detail-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: .5rem;
}

/* Cards stretch to equal height; flex column lets the timeline sit at the
   bottom of the deep-sky card so the four columns read as one balanced row. */
.dst-card {
	display: flex;
	flex-direction: column;
	background: var(--dst-surface);
	border: 1px solid var(--dst-border);
	border-radius: var(--dst-radius);
	padding: .55rem .7rem;
}

.dst-card h5 {
	margin: 0 0 .35rem;
	color: var(--dst-muted);
	font-size: .68rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .08em;
}

.dst-card-main {
	border-color: var(--dst-border-mid);
}

.dst-app .dst-detail-total {
	margin: 0 0 .25rem;
	color: var(--dst-primary);
	font-size: 1.35rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.dst-detail-total-zero {
	color: var(--dst-muted);
}

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

.dst-windows li {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: .2rem 0;
	border-top: 1px solid var(--dst-border);
	font-size: .875rem;
	font-variant-numeric: tabular-nums;
}

.dst-win-dur {
	color: var(--dst-muted);
}

.dst-note {
	margin: 0;
	color: var(--dst-muted);
	font-size: .8rem;
	line-height: 1.4;
}

.dst-row {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: .12rem 0;
	font-size: .875rem;
	font-variant-numeric: tabular-nums;
}

.dst-row-label {
	color: var(--dst-muted);
}

.dst-moon-line {
	display: flex;
	align-items: center;
	gap: .5rem;
	margin-bottom: .25rem;
	font-size: .875rem;
	line-height: 1.3;
}

.dst-app .dst-quarter {
	margin: 0 0 .25rem;
	color: var(--dst-secondary);
	font-size: .8rem;
}

.dst-twilight {
	width: 100%;
	border-collapse: collapse;
	font-size: .875rem;
	font-variant-numeric: tabular-nums;
}

/* The Elementor kit adds its own table borders/padding; reset them first. */
.dst-twilight th,
.dst-twilight td {
	padding: .2rem 0 .2rem .75rem;
	text-align: right;
	font-weight: 400;
	border: none;
	border-bottom: 1px solid var(--dst-border);
	background: none;
	white-space: nowrap;
}

.dst-twilight th:first-child {
	text-align: left;
	padding-left: 0;
	color: var(--dst-muted);
}

.dst-twilight thead th {
	color: var(--dst-muted);
	font-size: .65rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
}

.dst-twilight tbody tr:last-child th,
.dst-twilight tbody tr:last-child td {
	border-bottom: none;
}

.dst-deg {
	font-size: 9px;
	color: var(--dst-muted);
	white-space: nowrap;
}

/* ── Night timeline (sunset → sunrise) ───────────────────────────────────── */

.dst-timeline {
	margin-top: auto;
	padding-top: .6rem;
}

.dst-tl-bar {
	position: relative;
	height: 12px;
	border-radius: 6px;
	background: var(--dst-surface-alt);
	border: 1px solid var(--dst-border);
	overflow: hidden;
}

.dst-tl-win {
	position: absolute;
	top: 0;
	bottom: 0;
	background: linear-gradient(180deg, #16c2dd, var(--dst-primary));
	box-shadow: 0 0 6px var(--dst-primary-glow);
}

.dst-tl-scale {
	position: relative;
	height: 1rem;
	margin-top: .3rem;
	font-size: .65rem;
	color: var(--dst-muted);
	font-variant-numeric: tabular-nums;
}

.dst-tl-edge {
	position: absolute;
	left: 0;
	color: var(--dst-text);
}

.dst-tl-edge-end {
	left: auto;
	right: 0;
}

.dst-tl-tick {
	position: absolute;
	transform: translateX(-50%);
	padding-top: 3px;
}

.dst-tl-tick::before {
	content: '';
	position: absolute;
	top: -3px;
	left: 50%;
	width: 1px;
	height: 4px;
	background: var(--dst-border-mid);
}

/* Discreet one-shot "view more" link for the tonight panel; phones only. */
.dst-app a.dst-more {
	display: none;
	margin-top: .45rem;
	color: var(--dst-primary);
	font-size: .8rem;
	text-decoration: none;
	cursor: pointer;
}

.dst-app a.dst-more:hover,
.dst-app a.dst-more:focus {
	color: var(--dst-primary);
	text-decoration: underline;
}

/* ── Day modal ───────────────────────────────────────────────────────────── */

.dst-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.dst-modal[hidden] {
	display: none;
}

.dst-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .65);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
}

.dst-modal-dialog {
	position: relative;
	width: 100%;
	max-width: 1060px;
	max-height: 90vh;
	overflow-y: auto;
	background: var(--dst-bg);
	border: 1px solid var(--dst-border-mid);
	border-radius: var(--dst-radius-lg);
	padding: 1.25rem;
	box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
}

.dst-modal-close {
	position: absolute;
	top: .75rem;
	right: .75rem;
	font-size: 1.2rem;
	line-height: 1;
	padding: .3rem .55rem;
}

.dst-modal-body .dst-detail-title {
	padding-right: 2.5rem;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
	.dst-cell-row {
		display: none;
	}

	.dst-cell {
		min-height: 64px;
	}
}

@media (max-width: 600px) {
	.dst-grid,
	.dst-weekdays {
		gap: 3px;
	}

	.dst-weekdays {
		font-size: .62rem;
		letter-spacing: .03em;
	}

	.dst-cell {
		min-height: 52px;
		padding: .3rem .25rem;
		gap: .2rem;
		align-items: center;
		text-align: center;
	}

	.dst-cell-head {
		flex-direction: column;
		gap: .15rem;
	}

	/* Duration as plain teal text: the pill chrome costs width that 48px
	   cells don't have. */
	.dst-badge {
		align-self: center;
		background: none;
		padding: 0;
		font-size: .62rem;
	}

	.dst-badge-zero {
		background: none;
	}

	.dst-cell-date {
		font-size: .8rem;
	}

	.dst-cell-today .dst-cell-date {
		min-width: 1.2rem;
		height: 1.2rem;
		padding: 0 .2rem;
	}

	.dst-cell-moon svg {
		width: 11px;
		height: 11px;
	}

	.dst-title {
		font-size: 1.1rem;
		min-width: 0;
	}

	.dst-location {
		margin-left: 0;
		width: 100%;
	}

	.dst-detail-grid {
		grid-template-columns: 1fr;
	}

	.dst-app a.dst-more {
		display: inline-block;
	}

	.dst-detail.dst-detail-collapsed .dst-card:not(.dst-card-main) {
		display: none;
	}

	/* Modal becomes a bottom sheet on phones. */
	.dst-modal {
		align-items: flex-end;
		padding: 0;
	}

	.dst-modal-dialog {
		max-width: none;
		max-height: 92vh;
		border-radius: var(--dst-radius-lg) var(--dst-radius-lg) 0 0;
		border-bottom: none;
		padding: 1rem .9rem;
	}
}
