/* D3x status page. Brand tokens follow d3x.ai (ink #1a1a1a, canvas #fafafa, lines #e5e5e5). */
:root {
	--ink: #1a1a1a;
	--muted: #5c5c5c;
	--canvas: #fafafa;
	--surface: #ffffff;
	--line: #e5e5e5;
	--accent: #7c3aed;
	--radius: 10px;

	/* Status colors: --x-text passes WCAG AA on white, --x-fill is for dots and bars. */
	--operational-text: #047857;
	--operational-fill: #10b981;
	--under_maintenance-text: #1d4ed8;
	--under_maintenance-fill: #3b82f6;
	--degraded_performance-text: #a16207;
	--degraded_performance-fill: #eab308;
	--partial_outage-text: #c2410c;
	--partial_outage-fill: #f97316;
	--major_outage-text: #b91c1c;
	--major_outage-fill: #dc2626;

	font-family:
		Inter,
		ui-sans-serif,
		system-ui,
		-apple-system,
		'Segoe UI',
		Roboto,
		sans-serif;
	color: var(--ink);
	background: var(--canvas);
	line-height: 1.5;
	-webkit-text-size-adjust: 100%;
}

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

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

a {
	color: var(--ink);
	text-underline-offset: 3px;
}

a:hover {
	color: var(--accent);
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 4px;
}

.wrap {
	width: 100%;
	max-width: 880px;
	margin: 0 auto;
	padding: 0 20px;
}

main.wrap {
	flex: 1;
	padding-top: 28px;
	padding-bottom: 48px;
}

.skip {
	position: absolute;
	left: -9999px;
}

.skip:focus {
	left: 12px;
	top: 12px;
	background: var(--surface);
	padding: 8px 12px;
	z-index: 10;
}

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

/* Header and footer */

.site-header {
	background: var(--surface);
	border-bottom: 1px solid var(--line);
}

.header-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 64px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
	text-decoration: none;
}

.brand-label {
	font-size: 15px;
	color: var(--muted);
	border-left: 1px solid var(--line);
	padding-left: 12px;
}

nav {
	display: flex;
	gap: 20px;
	font-size: 14px;
}

nav a {
	text-decoration: none;
	color: var(--muted);
}

nav a:hover {
	color: var(--ink);
}

.site-footer {
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 13px;
	background: var(--surface);
}

.footer-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 8px 24px;
	padding-top: 20px;
	padding-bottom: 20px;
}

.site-footer a {
	color: var(--muted);
}

/* Typography */

h1,
h2,
h3,
h4 {
	line-height: 1.25;
	margin: 0;
}

h2 {
	font-size: 18px;
	font-weight: 600;
	margin: 36px 0 12px;
}

h3 {
	font-size: 16px;
	font-weight: 600;
}

h4 {
	font-size: 14px;
	font-weight: 600;
}

.page-title {
	font-size: 28px;
	font-weight: 600;
	letter-spacing: -0.01em;
}

p {
	margin: 0 0 8px;
}

.muted,
.meta {
	color: var(--muted);
}

.meta {
	font-size: 13px;
}

code {
	font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.9em;
}

/* Status indicators */

.dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex: none;
}

.dot.level-operational {
	background: var(--operational-fill);
}
.dot.level-under_maintenance {
	background: var(--under_maintenance-fill);
}
.dot.level-degraded_performance {
	background: var(--degraded_performance-fill);
}
.dot.level-partial_outage {
	background: var(--partial_outage-fill);
}
.dot.level-major_outage {
	background: var(--major_outage-fill);
}

.badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
}

.badge.level-operational {
	color: var(--operational-text);
}
.badge.level-under_maintenance {
	color: var(--under_maintenance-text);
}
.badge.level-degraded_performance {
	color: var(--degraded_performance-text);
}
.badge.level-partial_outage {
	color: var(--partial_outage-text);
}
.badge.level-major_outage {
	color: var(--major_outage-text);
}

.chip {
	display: inline-block;
	font-size: 12px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 999px;
	background: #f0f0f0;
	color: var(--ink);
	white-space: nowrap;
}

.chip.status-investigating,
.chip.status-identified {
	background: #fff1e6;
	color: #9a3412;
}
.chip.status-monitoring,
.chip.status-scheduled,
.chip.status-in_progress {
	background: #e8efff;
	color: #1e40af;
}
.chip.status-resolved,
.chip.status-completed {
	background: #e7f6ef;
	color: #065f46;
}

/* Overall banner */

.overall {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 20px 22px;
	border-radius: var(--radius);
	background: var(--surface);
	border: 1px solid var(--line);
	border-left-width: 6px;
}

.overall .dot {
	width: 14px;
	height: 14px;
}

.overall h1 {
	font-size: 22px;
	font-weight: 600;
}

.overall .meta {
	margin: 2px 0 0;
}

.overall.level-operational {
	border-left-color: var(--operational-fill);
}
.overall.level-under_maintenance {
	border-left-color: var(--under_maintenance-fill);
}
.overall.level-degraded_performance {
	border-left-color: var(--degraded_performance-fill);
}
.overall.level-partial_outage {
	border-left-color: var(--partial_outage-fill);
}
.overall.level-major_outage {
	border-left-color: var(--major_outage-fill);
}

/* Cards */

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 18px 20px;
	margin-bottom: 12px;
}

.incident-card {
	border-left-width: 4px;
}

.level-border-operational {
	border-left-color: var(--operational-fill);
}
.level-border-under_maintenance {
	border-left-color: var(--under_maintenance-fill);
}
.level-border-degraded_performance {
	border-left-color: var(--degraded_performance-fill);
}
.level-border-partial_outage {
	border-left-color: var(--partial_outage-fill);
}
.level-border-major_outage {
	border-left-color: var(--major_outage-fill);
}

.card-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.card-head a {
	text-decoration: none;
}

.card-head a:hover {
	text-decoration: underline;
}

.affected {
	list-style: none;
	padding: 0;
	margin: 0 0 10px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	font-size: 14px;
}

.affected li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.update-body p {
	margin-bottom: 8px;
}

.upstream {
	font-size: 14px;
	color: var(--muted);
	font-style: italic;
}

.window {
	font-size: 14px;
}

.notice {
	background: #f4f4f4;
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 14px;
	margin: 12px 0;
}

.notice-ok {
	background: #e7f6ef;
	color: #065f46;
}

.notice-error {
	background: #fdecec;
	color: #7f1d1d;
}

.notice-error ul {
	margin: 6px 0 0;
	padding-left: 20px;
}

/* Component groups */

.group {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	margin-bottom: 10px;
}

.group > summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 20px;
	cursor: pointer;
	list-style: none;
}

.group > summary::-webkit-details-marker {
	display: none;
}

.group > summary::before {
	content: '';
	width: 8px;
	height: 8px;
	border-right: 2px solid var(--muted);
	border-bottom: 2px solid var(--muted);
	transform: rotate(-45deg);
	transition: transform 0.15s;
	flex: none;
}

.group[open] > summary::before {
	transform: rotate(45deg);
}

.group-name {
	font-weight: 600;
	flex: 1;
}

.components {
	list-style: none;
	margin: 0;
	padding: 0 20px 8px;
}

.component {
	border-top: 1px solid var(--line);
	padding: 14px 0 10px;
}

.component-row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}

.component-name {
	font-weight: 500;
}

.component-desc {
	display: block;
	font-size: 13px;
	color: var(--muted);
}

.bars-wrap {
	margin-top: 10px;
}

.bars {
	display: flex;
	gap: 2px;
	height: 28px;
}

.bar {
	flex: 1;
	min-width: 2px;
	border-radius: 2px;
	background: var(--operational-fill);
	opacity: 0.85;
}

.bar.level-under_maintenance {
	background: var(--under_maintenance-fill);
}
.bar.level-degraded_performance {
	background: var(--degraded_performance-fill);
}
.bar.level-partial_outage {
	background: var(--partial_outage-fill);
}
.bar.level-major_outage {
	background: var(--major_outage-fill);
}

.bars-legend {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	color: var(--muted);
	margin-top: 4px;
}

.bars-legend .short {
	display: none;
}

.legend {
	list-style: none;
	padding: 0;
	margin: 14px 0 0;
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	font-size: 13px;
	color: var(--muted);
}

.legend li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.legend .bar {
	flex: none;
	width: 10px;
	height: 14px;
}

/* History and incident pages */

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

.history-item {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 12px 16px;
	margin-bottom: 8px;
}

.history-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-weight: 500;
}

.history-item .meta {
	margin: 4px 0 0;
}

.crumb {
	font-size: 14px;
	margin-bottom: 12px;
}

.incident-head {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}

.timeline {
	list-style: none;
	margin: 24px 0 0;
	padding: 0 0 0 20px;
	border-left: 2px solid var(--line);
}

.timeline li {
	position: relative;
	padding: 0 0 22px 4px;
}

.timeline li::before {
	content: '';
	position: absolute;
	left: -27px;
	top: 5px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--surface);
	border: 2px solid var(--muted);
}

.timeline-head {
	display: flex;
	gap: 12px;
	align-items: baseline;
	flex-wrap: wrap;
	margin-bottom: 4px;
}

.timeline-head time {
	color: var(--muted);
	font-size: 13px;
}

/* Admin */

.stack {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 14px;
	font-weight: 500;
}

input,
select,
textarea {
	font: inherit;
	font-weight: 400;
	padding: 8px 10px;
	border: 1px solid #c8c8c8;
	border-radius: 6px;
	background: var(--surface);
	color: var(--ink);
}

fieldset {
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 12px;
	margin: 0;
}

legend {
	font-size: 14px;
	font-weight: 600;
	padding: 0 4px;
}

button {
	font: inherit;
	font-weight: 600;
	padding: 10px 16px;
	border-radius: 8px;
	border: 1px solid var(--ink);
	background: var(--ink);
	color: #fff;
	cursor: pointer;
	align-self: flex-start;
}

button.secondary {
	background: var(--surface);
	color: var(--ink);
}

.impact-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 12px 20px;
}

.impact-group-name {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--muted);
	margin: 0 0 4px;
}

.impact-row {
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-weight: 400;
	margin-bottom: 4px;
}

.impact-row select {
	padding: 4px 6px;
	font-size: 13px;
}

.check {
	flex-direction: row;
	align-items: center;
	gap: 8px;
	font-weight: 400;
}

.two-col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	margin-top: 12px;
}

.rules {
	font-size: 14px;
	margin: 8px 0 0;
}

.preview {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 14px;
	white-space: pre-wrap;
	font-size: 14px;
}

.table-wrap {
	overflow-x: auto;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	background: var(--surface);
}

th,
td {
	text-align: left;
	padding: 6px 8px;
	border-bottom: 1px solid var(--line);
	white-space: nowrap;
}

/* Small screens: show the last 30 days of history and stack layouts. */
@media (max-width: 640px) {
	.bars .bar:nth-child(-n + 60) {
		display: none;
	}
	.bars-legend .long {
		display: none;
	}
	.bars-legend .short {
		display: inline;
	}
	.page-title {
		font-size: 24px;
	}
	.overall h1 {
		font-size: 19px;
	}
	nav {
		gap: 14px;
	}
	.two-col {
		grid-template-columns: 1fr;
	}
	.card-head,
	.history-head {
		flex-direction: column;
		align-items: flex-start;
		gap: 6px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.group > summary::before {
		transition: none;
	}
}
