/**
 * Error hub archive — triage bar, two-column layout, diagnostic sidebar, cards.
 *
 * Loaded alongside error-library.css rather than replacing it, so existing card, badge and
 * single-post styles keep working untouched. Palette follows that file: #0073aa, not brand orange.
 */

/* ── Ad slots: reserve the space BEFORE the ad arrives ──────────────────────────
 *
 * This is the whole CLS fix. Without a reserved box the ad appears after the text has already
 * painted and pushes the fix down the screen — which, for someone following numbered steps
 * during an outage, means losing their place in a document they are actively working from.
 *
 * `contain: layout` stops anything inside the slot from affecting the rest of the page.
 */
.error-ad {
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 24px 0;
	contain: layout;
	overflow: hidden;
}

.error-ad--top   { min-height: 250px; }
.error-ad--rail  { min-height: 600px; }
.error-ad ins    { display: block; width: 100%; }

@media ( max-width: 781px ) {
	/* Mobile ad units are taller relative to the viewport, so they reserve more. */
	.error-ad--top  { min-height: 280px; }
	.error-ad--rail { min-height: 280px; }
}

/* ── Severity triage bar ────────────────────────────────────────────────────── */

.error-triage {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 28px;
}

.error-triage__all,
.error-triage__tier {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	border: 2px solid #e0e0e0;
	border-radius: 6px;
	background: #fff;
	color: #333;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: border-color .15s ease, background .15s ease;
}

.error-triage__all:hover,
.error-triage__tier:hover        { border-color: #0073aa; }
.error-triage__all.active,
.error-triage__tier.active       { background: #0073aa; border-color: #0073aa; color: #fff; }

/* A colour-coded left edge, so the tiers are distinguishable at a glance. Colour is never the
 * only signal — each tier is also labelled in words. */
.error-triage__tier--critical      { border-left: 6px solid #e74c3c; }
.error-triage__tier--warning       { border-left: 6px solid #f39c12; }
.error-triage__tier--informational { border-left: 6px solid #27ae60; }

.error-triage__count {
	padding: 1px 7px;
	border-radius: 10px;
	background: #f0f0f0;
	color: #666;
	font-size: 12px;
	font-weight: 700;
}
.error-triage__tier.active .error-triage__count,
.error-triage__all.active .error-triage__count { background: rgba( 255, 255, 255, .25 ); color: #fff; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */

.error-dir-layout {
	display: grid;
	grid-template-columns: minmax( 0, 1fr ) 300px;
	gap: 36px;
	align-items: start;
}

@media ( max-width: 1024px ) {
	.error-dir-layout { grid-template-columns: 1fr; }
	/* Filters before the list on narrow screens: on a phone, scrolling past 20 cards to reach the
	   filter that would have removed them is the wrong order. */
	.error-dir-sidebar { order: -1; }
}

.error-section { margin-bottom: 44px; }

.error-section__title {
	margin: 0 0 4px;
	font-size: 22px;
	line-height: 1.25;
}

.error-section__note {
	margin: 0 0 18px;
	color: #777;
	font-size: 14px;
}

.error-section--foundational {
	padding-bottom: 32px;
	border-bottom: 1px solid #e8e8e8;
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */

.error-cards-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 280px, 1fr ) );
	gap: 18px;
}

.error-card-code {
	margin: 0 0 8px;
	font-size: 12.5px;
	overflow-wrap: anywhere;
}
.error-card-code code {
	padding: 2px 6px;
	border-radius: 3px;
	background: #f4f4f4;
	color: #555;
}

.error-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 10px 0 0;
	padding-top: 10px;
	border-top: 1px solid #f0f0f0;
	font-size: 12px;
	color: #777;
}

.error-card-reads { font-weight: 600; color: #555; }

.error-card-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 10px;
}

/* ── Diagnostic sidebar ─────────────────────────────────────────────────────── */

.error-filter-block {
	margin-bottom: 26px;
	padding-bottom: 22px;
	border-bottom: 1px solid #eee;
}

.error-filter-block__title {
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: #333;
}

.error-filter-block__note,
.error-filter-block__empty {
	margin: 0 0 10px;
	font-size: 13px;
	color: #888;
}

.error-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.error-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 11px;
	border: 1px solid #ddd;
	border-radius: 14px;
	background: #fff;
	color: #333;
	font-size: 13px;
	text-decoration: none;
	transition: border-color .15s ease, color .15s ease;
}

.error-chip:hover        { border-color: #0073aa; color: #0073aa; }
.error-chip.active       { background: #0073aa; border-color: #0073aa; color: #fff; }

.error-chip__count { color: #999; font-size: 11.5px; }
.error-chip.active .error-chip__count { color: rgba( 255, 255, 255, .8 ); }

@media ( prefers-reduced-motion: reduce ) {
	.error-triage__all, .error-triage__tier, .error-chip { transition: none; }
}

/* ── Copy-to-clipboard on code blocks ───────────────────────────────────────────
 *
 * The button sits inside the <pre>, top-right. `padding-right` on the pre reserves room for it so
 * it never lands on top of the code itself — which matters most on the long single-line commands
 * these guides are full of.
 */
pre.cvg-has-copy {
	position: relative;
	padding-right: 84px;
}

.cvg-copy {
	position: absolute;
	top: 8px;
	right: 8px;
	padding: 5px 11px;
	border: 1px solid #c8d0d6;
	border-radius: 4px;
	background: #fff;
	color: #444;
	font: 600 12px/1 var(--cvg-font-body);
	cursor: pointer;
	/* Visible without hover: a control that only appears on hover does not exist on a
	   touchscreen, and a large share of these readers arrive on a phone. */
	opacity: .85;
	transition: opacity .15s ease, border-color .15s ease;
}

.cvg-copy:hover,
.cvg-copy:focus-visible {
	opacity: 1;
	border-color: #0073aa;
	color: #0073aa;
	outline: none;
}

.cvg-copy:focus-visible { box-shadow: 0 0 0 3px rgba( 0, 115, 170, .25 ); }

.cvg-copy.is-done   { border-color: #27ae60; color: #1a7e2f; background: #eafaf0; opacity: 1; }
.cvg-copy.is-failed { border-color: #e74c3c; color: #c0392b; background: #fdecea; opacity: 1; }

@media ( max-width: 600px ) {
	/* On a narrow screen, reserving 84px of a code block's width hurts more than the overlap
	   does — so the button moves above the code instead of floating over it. */
	pre.cvg-has-copy { padding-right: 14px; padding-top: 42px; }
	.cvg-copy { top: 6px; right: 6px; }
}

@media ( prefers-reduced-motion: reduce ) {
	.cvg-copy { transition: none; }
}
