/* RGB Intelligence Suite (rgb-intel) - Liquid Glass Dark v3.0
 * Compliance:
 *  - Uniform 1px borders only (zero single-edge colored stripes)
 *  - Zero eyebrow micro-badges above headings
 *  - Zero px font-sizes (rem / clamp only), zero RTL letter-spacing
 *  - Tabular numerals on all metrics & tables, BiDi-safe <bdi dir="ltr">
 *  - Baseline Widely Available + prefers-reduced-motion + forced-colors
 */

.rgbi-strip {
	padding: var(--sp-5, 20px) 0 0;
}

.rgbi-strip-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--sp-3, 12px);
}

.rgbi-kpi {
	background: var(--surface, rgba(255, 255, 255, 0.045));
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	border-radius: var(--r-md, 18px);
	padding: var(--sp-4, 16px) var(--sp-5, 20px);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
	display: flex;
	flex-direction: column;
	gap: var(--sp-1, 4px);
	min-width: 0;
}

.rgbi-kpi-label {
	font-size: 0.84rem;
	line-height: 1.5;
	color: var(--text-3, #8690a6);
	font-weight: 600;
}

.rgbi-kpi-val {
	font-size: clamp(1.25rem, 2.2vw, 1.65rem);
	line-height: 1.3;
	font-weight: 800;
	color: var(--text, #eef1f8);
	font-variant-numeric: tabular-nums;
	display: flex;
	align-items: baseline;
	gap: var(--sp-2, 8px);
	flex-wrap: wrap;
}

.rgbi-kpi-sub {
	font-size: 0.8rem;
	line-height: 1.55;
	color: var(--text-2, #a9b1c3);
	font-variant-numeric: tabular-nums;
}

.rgbi-delta {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: var(--r-pill, 999px);
	font-size: 0.76rem;
	font-weight: 700;
	line-height: 1.4;
	font-variant-numeric: tabular-nums;
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	background: var(--surface-2, rgba(255, 255, 255, 0.075));
	color: var(--text-2, #a9b1c3);
}

.rgbi-delta.is-up {
	border-color: rgba(46, 230, 168, 0.32);
	background: rgba(46, 230, 168, 0.1);
	color: var(--green, #2ee6a8);
}

.rgbi-delta.is-down {
	border-color: rgba(255, 77, 106, 0.32);
	background: rgba(255, 77, 106, 0.1);
	color: var(--red, #ff4d6a);
}

.rgbi-delta.is-info {
	border-color: rgba(77, 159, 255, 0.32);
	background: rgba(77, 159, 255, 0.1);
	color: var(--blue, #4d9fff);
}

.rgbi-delta.is-warn {
	border-color: rgba(255, 195, 77, 0.34);
	background: rgba(255, 195, 77, 0.1);
	color: var(--amber, #ffc34d);
}

/* Main Intelligence Section Shell */
.rgbi-sec {
	padding: var(--sp-10, 40px) 0;
}

.rgbi-sec-inline {
	margin: var(--sp-8, 32px) 0;
	padding: 0;
}

.rgbi-shell {
	background: var(--surface, rgba(255, 255, 255, 0.045));
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	border-radius: var(--r-lg, 26px);
	padding: var(--sp-6, 24px) var(--sp-8, 32px);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 24px 60px -18px rgba(0, 0, 0, 0.55);
}

.rgbi-sec-inline .rgbi-shell {
	padding: var(--sp-6, 24px);
	border-radius: var(--r-md, 18px);
}

.rgbi-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--sp-4, 16px);
	margin-bottom: var(--sp-5, 20px);
}

.rgbi-head-copy {
	max-width: 70ch;
}

.rgbi-title {
	margin: 0 0 var(--sp-2, 8px);
	font-size: clamp(1.35rem, 2.5vw, 1.85rem);
	line-height: 1.45;
	font-weight: 800;
	color: var(--text, #eef1f8);
	text-wrap: balance;
}

.rgbi-sec-inline .rgbi-title {
	font-size: clamp(1.25rem, 2.1vw, 1.55rem);
}

.rgbi-lead {
	margin: 0;
	font-size: 0.96rem;
	line-height: 1.85;
	color: var(--text-2, #a9b1c3);
}

.rgbi-meta-stamp {
	font-size: 0.8rem;
	line-height: 1.5;
	color: var(--text-3, #8690a6);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* Interactive Tabs (Accessible WAI-ARIA) */
.rgbi-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2, 8px);
	margin-bottom: var(--sp-5, 20px);
	padding-bottom: var(--sp-3, 12px);
	border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.09));
}

.rgbi-tab {
	appearance: none;
	background: var(--surface-2, rgba(255, 255, 255, 0.075));
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	border-radius: var(--r-pill, 999px);
	color: var(--text-2, #a9b1c3);
	font-family: inherit;
	font-size: 0.88rem;
	font-weight: 700;
	line-height: 1.4;
	padding: 0.52rem 1.05rem;
	min-height: 44px;
	cursor: pointer;
}

.rgbi-tab[aria-selected="true"] {
	background: var(--blue-fill, #2563eb);
	border-color: rgba(77, 159, 255, 0.55);
	color: #ffffff;
}

.rgbi-tab:focus-visible,
.rgbi-sort-btn:focus-visible,
.rgbi-acc-sum:focus-visible {
	outline: 2px solid transparent;
	outline-offset: 2px;
	box-shadow: 0 0 0 3px rgba(77, 159, 255, 0.32);
}

.rgbi-panel[hidden] {
	display: none;
}

/* Cards & Grids inside shell (concentric radius: 26 - 14 = 12px / 18px) */
.rgbi-grid-2 {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--sp-4, 16px);
	margin-bottom: var(--sp-5, 20px);
}

.rgbi-grid-3 {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--sp-4, 16px);
	margin-bottom: var(--sp-5, 20px);
}

.rgbi-card {
	background: var(--bg-2, #0b0f1a);
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	border-radius: var(--r-md, 18px);
	padding: var(--sp-5, 20px);
	min-width: 0;
}

.rgbi-card h3 {
	margin: 0 0 var(--sp-3, 12px);
	font-size: 1.04rem;
	line-height: 1.5;
	font-weight: 800;
	color: var(--text, #eef1f8);
}

.rgbi-card-note {
	margin: var(--sp-2, 8px) 0 0;
	font-size: 0.84rem;
	line-height: 1.7;
	color: var(--text-3, #8690a6);
}

/* Authority Ring Gauge + Stat List */
.rgbi-ring-wrap {
	display: flex;
	align-items: center;
	gap: var(--sp-5, 20px);
	flex-wrap: wrap;
}

.rgbi-ring-svg {
	width: 92px;
	height: 92px;
	flex: 0 0 auto;
}

.rgbi-ring-track {
	fill: none;
	stroke: rgba(255, 255, 255, 0.09);
	stroke-width: 8;
}

.rgbi-ring-val {
	fill: none;
	stroke-width: 8;
	stroke-linecap: round;
	transform: rotate(-90deg);
	transform-origin: 50% 50%;
}

.rgbi-ring-num {
	fill: var(--text, #eef1f8);
	font-size: 1.35rem;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

.rgbi-ring-cap {
	fill: var(--text-3, #8690a6);
	font-size: 0.62rem;
	font-weight: 600;
}

.rgbi-stat-dl {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--sp-3, 12px) var(--sp-5, 20px);
	margin: 0;
	flex: 1 1 200px;
}

.rgbi-stat-dl dt {
	font-size: 0.78rem;
	color: var(--text-3, #8690a6);
	line-height: 1.45;
}

.rgbi-stat-dl dd {
	margin: 2px 0 0;
	font-size: 1rem;
	font-weight: 800;
	color: var(--text, #eef1f8);
	font-variant-numeric: tabular-nums;
}

/* Inline SVG Sparkline */
.rgbi-spark-box {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2, 8px);
}

.rgbi-spark-svg {
	width: 100%;
	height: 76px;
	display: block;
	overflow: visible;
}

.rgbi-spark-axis {
	display: flex;
	direction: ltr;
	justify-content: space-between;
	font-size: 0.75rem;
	color: var(--text-3, #8690a6);
	font-variant-numeric: tabular-nums;
}

/* Stacked Distribution Bar (Channels / Tech / SERP Features) */
.rgbi-stack-bar {
	display: flex;
	height: 14px;
	border-radius: var(--r-pill, 999px);
	overflow: hidden;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	margin: var(--sp-3, 12px) 0;
}

.rgbi-stack-seg {
	height: 100%;
	min-width: 2px;
}

.rgbi-legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2, 8px) var(--sp-4, 16px);
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 0.82rem;
	color: var(--text-2, #a9b1c3);
	font-variant-numeric: tabular-nums;
}

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

.rgbi-dot {
	width: 9px;
	height: 9px;
	border-radius: var(--r-pill, 999px);
	flex: 0 0 auto;
}

/* Responsive Data Table */
.rgbi-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	border-radius: var(--r-md, 18px);
	background: var(--bg-2, #0b0f1a);
	margin-bottom: var(--sp-4, 16px);
}

.rgbi-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.88rem;
	line-height: 1.55;
	font-variant-numeric: tabular-nums;
}

.rgbi-table thead th {
	text-align: start;
	padding: 0.78rem 0.9rem;
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--text-3, #8690a6);
	border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	white-space: nowrap;
}

.rgbi-sort-btn {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	color: inherit;
	font: inherit;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.rgbi-sort-btn[aria-sort]::after {
	content: "";
	display: inline-block;
	width: 8px;
	height: 6px;
	background: var(--blue, #4d9fff);
}

.rgbi-sort-btn[aria-sort="descending"]::after {
	clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.rgbi-sort-btn[aria-sort="ascending"]::after {
	clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.rgbi-table tbody td {
	text-align: start;
	padding: 0.78rem 0.9rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.055);
	color: var(--text, #eef1f8);
	vertical-align: middle;
}

.rgbi-table tbody tr:last-child td {
	border-bottom: 0;
}

.rgbi-table tbody tr:hover td {
	background: rgba(255, 255, 255, 0.03);
}

.rgbi-dom-cell {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
}

.rgbi-dom {
	font-weight: 700;
	color: var(--text, #eef1f8);
}

.rgbi-rank-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	border-radius: var(--r-xs, 8px);
	background: var(--surface-2, rgba(255, 255, 255, 0.075));
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	font-size: 0.76rem;
	font-weight: 800;
	color: var(--text-2, #a9b1c3);
}

.rgbi-nowrap {
	white-space: nowrap;
}

/* Proportional inline bar inside table cells */
.rgbi-bar {
	display: block;
	height: 5px;
	width: 100%;
	max-width: 110px;
	border-radius: var(--r-pill, 999px);
	background: rgba(255, 255, 255, 0.07);
	overflow: hidden;
	margin-top: 5px;
}

.rgbi-bar > span {
	display: block;
	height: 100%;
	width: var(--w, 0%);
	border-radius: var(--r-pill, 999px);
	background: var(--blue, #4d9fff);
}

.rgbi-bar.is-green > span { background: var(--green, #2ee6a8); }
.rgbi-bar.is-purple > span { background: var(--purple, #b06bff); }
.rgbi-bar.is-amber > span { background: var(--amber, #ffc34d); }
.rgbi-bar.is-red > span { background: var(--red, #ff4d6a); }

/* Tag chips inside tables & related queries */
.rgbi-tags {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2, 8px);
	list-style: none;
	margin: 0;
	padding: 0;
}

.rgbi-tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0.34rem 0.78rem;
	border-radius: var(--r-pill, 999px);
	background: var(--surface, rgba(255, 255, 255, 0.045));
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	font-size: 0.82rem;
	line-height: 1.45;
	color: var(--text-2, #a9b1c3);
}

.rgbi-tag-sm {
	display: inline-flex;
	align-items: center;
	padding: 0.16rem 0.52rem;
	border-radius: var(--r-xs, 8px);
	background: var(--surface-2, rgba(255, 255, 255, 0.075));
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	font-size: 0.74rem;
	line-height: 1.4;
	color: var(--text-2, #a9b1c3);
	white-space: nowrap;
}

.rgbi-tag-sm.is-ok {
	border-color: rgba(46, 230, 168, 0.3);
	background: rgba(46, 230, 168, 0.09);
	color: var(--green, #2ee6a8);
}

.rgbi-tag-sm.is-warn {
	border-color: rgba(255, 195, 77, 0.3);
	background: rgba(255, 195, 77, 0.09);
	color: var(--amber, #ffc34d);
}

/* Real Search Questions Accordion (Native <details>) */
.rgbi-acc-list {
	display: grid;
	gap: var(--sp-2, 8px);
}

.rgbi-acc {
	background: var(--bg-2, #0b0f1a);
	border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	border-radius: var(--r-sm, 12px);
	padding: var(--sp-3, 12px) var(--sp-4, 16px);
}

.rgbi-acc-sum {
	cursor: pointer;
	font-weight: 700;
	font-size: 0.92rem;
	line-height: 1.65;
	color: var(--text, #eef1f8);
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-3, 12px);
}

.rgbi-acc-sum::-webkit-details-marker {
	display: none;
}

.rgbi-acc-body {
	margin-top: var(--sp-2, 8px);
	padding-top: var(--sp-2, 8px);
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	font-size: 0.86rem;
	line-height: 1.75;
	color: var(--text-2, #a9b1c3);
}

/* Provenance & Methodology Footer */
.rgbi-foot {
	margin-top: var(--sp-5, 20px);
	padding-top: var(--sp-4, 16px);
	border-top: 1px solid var(--border, rgba(255, 255, 255, 0.09));
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-3, 12px);
	font-size: 0.8rem;
	line-height: 1.7;
	color: var(--text-3, #8690a6);
}

.rgbi-foot a {
	color: var(--blue, #4d9fff);
	text-decoration: none;
}

.rgbi-foot a:hover {
	text-decoration: underline;
}

/* Reduced Motion & Transitions */
@media (prefers-reduced-motion: no-preference) {
	.rgbi-tab,
	.rgbi-kpi,
	.rgbi-acc {
		transition: border-color 160ms cubic-bezier(0.4, 0, 0.2, 1),
			background-color 160ms cubic-bezier(0.4, 0, 0.2, 1);
	}
}

/* Forced Colors Accessibility */
@media (forced-colors: active) {
	.rgbi-shell,
	.rgbi-kpi,
	.rgbi-card,
	.rgbi-table-wrap,
	.rgbi-acc,
	.rgbi-tab {
		border: 1px solid CanvasText;
	}
	.rgbi-bar > span,
	.rgbi-stack-seg {
		background: Highlight;
	}
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
	.rgbi-strip-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.rgbi-grid-3 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 720px) {
	.rgbi-shell {
		padding: var(--sp-5, 20px) var(--sp-4, 16px);
		border-radius: var(--r-md, 18px);
	}
	.rgbi-grid-2,
	.rgbi-grid-3 {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 520px) {
	.rgbi-strip-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.rgbi-stat-dl {
		grid-template-columns: minmax(0, 1fr);
	}
}
