/**
 * Sysgage Uptime Monitor: public status page.
 *
 * Neutrals are derived from the theme's own text colour (currentColor), so the
 * page reads well on light and dark themes alike. Status colours are fixed and
 * always paired with a text label.
 */

.sgu-status {
	--sgu-s-good: #0aac23;
	--sgu-s-warn: #fbb315;
	--sgu-s-serious: #f18a59;
	--sgu-s-bad: #dc3c3d;
	--sgu-s-info: #257de0;
	--sgu-s-empty: color-mix(in srgb, currentColor 14%, transparent);
	--sgu-s-line: color-mix(in srgb, currentColor 14%, transparent);
	--sgu-s-soft: color-mix(in srgb, currentColor 4%, transparent);
	--sgu-s-muted: color-mix(in srgb, currentColor 68%, transparent);
	max-width: 860px;
	margin: 0 auto 2em;
	font-size: 16px;
	line-height: 1.5;
}

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

.sgu-status-title {
	margin: 0 0 .25em;
}

.sgu-status-intro {
	margin: 0 0 1.25em;
	color: var(--sgu-s-muted);
}

/* Overall banner */

.sgu-status-banner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin: 0 0 1.5em;
	padding: 16px 20px;
	border-radius: 12px;
	background: #0a7d1c;
	color: #fff;
	font-weight: 600;
}

.sgu-status-banner.is-degraded {
	background: #fbb315;
	color: #1f1400;
}

.sgu-status-banner.is-partial {
	background: #b8460f;
	color: #fff;
}

.sgu-status-banner.is-major {
	background: #b3261e;
	color: #fff;
}

.sgu-status-banner.is-maintenance {
	background: #1f63b8;
	color: #fff;
}

.sgu-status-banner.is-unknown {
	background: var(--sgu-s-soft);
	color: inherit;
	border: 1px solid var(--sgu-s-line);
}

.sgu-status-banner-icon {
	display: inline-grid;
	place-items: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .22);
	font-size: 15px;
	line-height: 1;
}

.sgu-status-banner.is-degraded .sgu-status-banner-icon {
	background: rgba(0, 0, 0, .12);
}

.sgu-status-banner-text {
	flex: 1 1 auto;
	font-size: 1.1em;
}

.sgu-status-updated {
	font-size: .85em;
	font-weight: 400;
	opacity: .9;
}

/* Upcoming maintenance */

.sgu-status-notice {
	margin: 0 0 1.5em;
	padding: 12px 16px;
	border: 1px solid var(--sgu-s-line);
	border-left: 4px solid var(--sgu-s-info);
	border-radius: 8px;
	background: var(--sgu-s-soft);
}

.sgu-status-notice ul {
	margin: .35em 0 0 1.1em;
	padding: 0;
}

/* Groups and monitors */

.sgu-status-group,
.sgu-status-history {
	margin: 0 0 1.5em;
}

.sgu-status-group-title {
	margin: 0 0 .5em;
	font-size: 1em;
	font-weight: 600;
}

.sgu-status-list,
.sgu-status-incidents {
	margin: 0;
	padding: 0;
	list-style: none;
	border: 1px solid var(--sgu-s-line);
	border-radius: 12px;
	overflow: visible;
}

.sgu-status-item {
	margin: 0;
	padding: 16px 18px 12px;
	border-top: 1px solid var(--sgu-s-line);
}

.sgu-status-item:first-child {
	border-top: 0;
}

.sgu-status-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 12px;
	margin-bottom: 10px;
}

.sgu-status-name {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.sgu-status-state {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: .9em;
	font-weight: 500;
}

.sgu-status .sgu-dot {
	display: inline-block;
	flex: none;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--sgu-s-good);
}

.sgu-status-state.is-down .sgu-dot { background: var(--sgu-s-bad); }
.sgu-status-state.is-degraded .sgu-dot { background: var(--sgu-s-warn); }
.sgu-status-state.is-maintenance .sgu-dot { background: var(--sgu-s-info); }
.sgu-status-state.is-paused .sgu-dot,
.sgu-status-state.is-pending .sgu-dot { background: var(--sgu-s-empty); }

/* Day bars (shared markup with the admin) */

.sgu-status .sgu-bars {
	position: relative;
	display: flex;
	gap: 2px;
	height: 34px;
	align-items: stretch;
}

.sgu-status .sgu-bar {
	flex: 1 1 0;
	min-width: 2px;
	border-radius: 3px;
	background: var(--sgu-s-empty);
	transition: transform .1s;
}

.sgu-status .sgu-bar:hover,
.sgu-status .sgu-bar:focus-visible {
	transform: scaleY(1.12);
}

.sgu-status .sgu-bar:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 1px;
}

.sgu-status .sgu-bar.is-up { background: var(--sgu-s-good); }
.sgu-status .sgu-bar.is-minor { background: var(--sgu-s-warn); }
.sgu-status .sgu-bar.is-major { background: var(--sgu-s-bad); }

.sgu-status .sgu-bars-tip {
	position: absolute;
	bottom: calc(100% + 8px);
	z-index: 5;
	max-width: min(320px, 90vw);
	padding: 6px 10px;
	border-radius: 8px;
	background: #0f172a;
	color: #fff;
	font-size: 13px;
	line-height: 1.4;
	white-space: normal;
	pointer-events: none;
	box-shadow: 0 6px 18px rgba(15, 23, 42, .25);
}

.sgu-status .sgu-bars-tip[hidden] {
	display: none;
}

.sgu-status-meta {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	margin-top: 6px;
	font-size: .8em;
	color: var(--sgu-s-muted);
}

.sgu-status-uptime {
	font-weight: 500;
	color: inherit;
	text-align: center;
}

.sgu-status-from-short {
	display: none;
}

/* Past incidents */

.sgu-status-incidents li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 12px;
	margin: 0;
	padding: 12px 18px;
	border-top: 1px solid var(--sgu-s-line);
}

.sgu-status-incidents li:first-child {
	border-top: 0;
}

.sgu-status-inc-state {
	padding: 1px 9px;
	border-radius: 99px;
	font-size: .8em;
	font-weight: 600;
	background: color-mix(in srgb, var(--sgu-s-good) 16%, transparent);
}

.sgu-status-inc-state.is-open {
	background: color-mix(in srgb, var(--sgu-s-bad) 18%, transparent);
}

.sgu-status-inc-time {
	margin-left: auto;
	font-size: .85em;
	color: var(--sgu-s-muted);
}

.sgu-status-empty {
	margin: 0;
	padding: 14px 18px;
	border: 1px dashed var(--sgu-s-line);
	border-radius: 12px;
	color: var(--sgu-s-muted);
}

.sgu-status-powered {
	margin: 0;
	font-size: .75em;
	color: var(--sgu-s-muted);
	text-align: center;
}

/* Small screens: show a 30-day window of bars so each stays tappable. */

@media (max-width: 600px) {
	.sgu-status-banner {
		padding: 14px 16px;
	}

	.sgu-status-item {
		padding: 14px 14px 10px;
	}

	.sgu-status .sgu-bars.is-long .sgu-bar:nth-last-of-type(n+31),
	.sgu-status-from-full:has(+ .sgu-status-from-short) {
		display: none;
	}

	.sgu-status-from-short {
		display: inline;
	}

	.sgu-status-inc-time {
		margin-left: 0;
		flex-basis: 100%;
	}
}

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

@media (forced-colors: active) {
	.sgu-status .sgu-bar {
		forced-color-adjust: none;
		border: 1px solid CanvasText;
	}

	.sgu-status-banner {
		border: 2px solid CanvasText;
	}
}

@media print {
	.sgu-status .sgu-bar {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}
