/* ============================================================
   Big Bang Registry — shared tool shell & primitives
   Scoped to .bbr-tool so the dark "observatory" styling never
   leaks into the light WikiPress site chrome. Reused by the
   calculator suite (age, redshift, lookback, CMB temperature…).
   ============================================================ */

.bbr-tool {
	--bbr-bg: #0a0e1a;
	--bbr-bg-2: #111730;
	--bbr-panel: #131a30;
	--bbr-panel-2: #0e1426;
	--bbr-ink: #eef2fb;
	--bbr-muted: #9aa7c4;
	--bbr-faint: #66739a;
	--bbr-line: rgba(255, 255, 255, 0.10);
	--bbr-line-soft: rgba(255, 255, 255, 0.06);
	--bbr-accent: #6aa8ff;
	--bbr-accent-2: #9d7bff;
	--bbr-glow: rgba(106, 168, 255, 0.45);
	--bbr-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
	--bbr-ui: var(--wikipress-font-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);

	margin: 28px 0 8px;
	padding: clamp(18px, 3vw, 34px);
	background:
		radial-gradient(1200px 400px at 12% -10%, rgba(106, 168, 255, 0.10), transparent 60%),
		radial-gradient(900px 500px at 100% 0%, rgba(157, 123, 255, 0.10), transparent 55%),
		linear-gradient(180deg, var(--bbr-bg-2) 0%, var(--bbr-bg) 100%);
	border: 1px solid var(--bbr-line);
	border-radius: 16px;
	color: var(--bbr-ink);
	font-family: var(--bbr-ui);
	box-shadow: 0 30px 80px rgba(2, 6, 20, 0.45);
}

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

.bbr-tool h2,
.bbr-tool h3 {
	font-family: var(--bbr-ui);
	color: #fff;
	border: 0;
	padding: 0;
	margin: 0;
	line-height: 1.2;
}

/* ---- Inputs ---- */
.bbr-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 18px 24px;
	align-items: flex-end;
}

.bbr-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bbr-field-label {
	font-size: 0.74rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--bbr-faint);
}

.bbr-field-hint {
	font-size: 0.74rem;
	color: var(--bbr-faint);
	margin-top: 2px;
}

.bbr-input {
	font-family: var(--bbr-mono);
	font-size: 1.15rem;
	font-weight: 600;
	color: var(--bbr-ink);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--bbr-line);
	border-radius: 9px;
	padding: 12px 14px;
	width: 100%;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-moz-appearance: textfield;
}

.bbr-input:focus {
	outline: none;
	border-color: var(--bbr-accent);
	box-shadow: 0 0 0 3px var(--bbr-glow);
}

.bbr-input:invalid {
	border-color: #fb7185;
}

.bbr-field--lead .bbr-input {
	font-size: 1.6rem;
	padding: 14px 16px;
}

.bbr-input::-webkit-outer-spin-button,
.bbr-input::-webkit-inner-spin-button {
	opacity: 0.35;
	height: 26px;
}

/* ---- Preset chips ---- */
.bbr-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 14px;
}

.bbr-chip {
	font-family: var(--bbr-ui);
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--bbr-ink);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--bbr-line);
	border-radius: 999px;
	padding: 6px 14px;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.bbr-chip:hover {
	background: rgba(255, 255, 255, 0.09);
	border-color: rgba(255, 255, 255, 0.24);
	transform: translateY(-1px);
}

.bbr-chip:focus-visible {
	outline: 2px solid var(--bbr-accent);
	outline-offset: 2px;
}

.bbr-chip.is-active {
	background: linear-gradient(180deg, rgba(106, 168, 255, 0.22), rgba(106, 168, 255, 0.08));
	border-color: rgba(106, 168, 255, 0.55);
	color: #fff;
}

.bbr-chip-label {
	color: var(--bbr-faint);
	margin-right: 4px;
}

/* ---- Buttons ---- */
.bbr-btn {
	font-family: var(--bbr-ui);
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--bbr-ink);
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--bbr-line);
	border-radius: 8px;
	padding: 9px 16px;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.bbr-btn:hover {
	background: rgba(255, 255, 255, 0.10);
	border-color: rgba(255, 255, 255, 0.25);
}

.bbr-btn:focus-visible {
	outline: 2px solid var(--bbr-accent);
	outline-offset: 2px;
}

/* ---- Result cards ---- */
.bbr-results {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px;
	margin-top: 26px;
}

.bbr-results--four {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
	.bbr-results--four {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Inline geometry / status pill shown next to inputs. */
.bbr-geometry {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
	margin-top: 16px;
	padding: 8px 14px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--bbr-line);
	border-radius: 999px;
	font-size: 0.85rem;
	color: var(--bbr-muted);
}

.bbr-geometry strong {
	font-family: var(--bbr-mono);
	color: var(--bbr-ink);
}

.bbr-geometry .bbr-geom-name {
	font-family: var(--bbr-ui);
	font-weight: 700;
	text-transform: capitalize;
	color: var(--bbr-accent);
}

.bbr-card {
	background: linear-gradient(180deg, var(--bbr-panel), var(--bbr-panel-2));
	border: 1px solid var(--bbr-line);
	border-radius: 12px;
	padding: 20px;
	min-width: 0;
}

.bbr-card--primary {
	border-color: rgba(106, 168, 255, 0.45);
	box-shadow: inset 0 0 0 1px rgba(106, 168, 255, 0.12), 0 12px 30px rgba(3, 8, 24, 0.4);
}

.bbr-card-label {
	display: block;
	font-size: 0.74rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--bbr-faint);
	margin-bottom: 10px;
}

.bbr-card-value {
	font-family: var(--bbr-mono);
	font-size: clamp(1.5rem, 3.4vw, 2.1rem);
	font-weight: 700;
	line-height: 1.1;
	color: #fff;
	overflow-wrap: anywhere;
}

.bbr-card--primary .bbr-card-value {
	color: var(--bbr-accent);
}

.bbr-card-value sup {
	font-size: 0.6em;
}

.bbr-card-sub {
	margin-top: 8px;
	font-size: 0.85rem;
	line-height: 1.5;
	color: var(--bbr-muted);
}

/* ---- Context strip (secondary readouts) ---- */
.bbr-context {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 28px;
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1px solid var(--bbr-line-soft);
}

.bbr-context-item {
	font-size: 0.85rem;
	color: var(--bbr-muted);
}

.bbr-context-item strong {
	font-family: var(--bbr-mono);
	font-weight: 600;
	color: var(--bbr-ink);
	margin-left: 6px;
}

/* ---- Interpretation line ---- */
.bbr-interpret {
	margin-top: 20px;
	padding: 14px 18px;
	background: rgba(106, 168, 255, 0.07);
	border: 1px solid rgba(106, 168, 255, 0.22);
	border-radius: 10px;
	font-size: 0.98rem;
	line-height: 1.6;
	color: #dbe6fb;
}

/* ---- Advanced (collapsible) ---- */
.bbr-details {
	margin-top: 22px;
	border-top: 1px solid var(--bbr-line-soft);
	padding-top: 16px;
}

.bbr-summary {
	cursor: pointer;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--bbr-accent);
	list-style: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

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

.bbr-summary::before {
	content: "+";
	font-family: var(--bbr-mono);
	font-size: 1rem;
	line-height: 1;
}

.bbr-details[open] .bbr-summary::before {
	content: "−";
}

.bbr-details-body {
	margin-top: 16px;
}

/* ---- Formula / assumptions ---- */
.bbr-formula {
	margin-top: 22px;
	padding: 16px 18px;
	background: var(--bbr-panel-2);
	border: 1px solid var(--bbr-line);
	border-radius: 10px;
	font-family: var(--bbr-mono);
	font-size: 0.92rem;
	line-height: 1.7;
	color: var(--bbr-ink);
	overflow-x: auto;
}

.bbr-note {
	margin-top: 12px;
	font-size: 0.86rem;
	line-height: 1.6;
	color: var(--bbr-muted);
}

/* ---- Data table (reference values) ---- */
.bbr-table-wrap {
	margin-top: 16px;
	overflow-x: auto;
	border: 1px solid var(--bbr-line);
	border-radius: 12px;
}

.bbr-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
	min-width: 460px;
}

.bbr-table caption {
	text-align: left;
	padding: 14px 16px 0;
	font-size: 0.8rem;
	color: var(--bbr-faint);
}

.bbr-table th,
.bbr-table td {
	padding: 10px 16px;
	text-align: right;
	border-bottom: 1px solid var(--bbr-line-soft);
}

.bbr-table th:first-child,
.bbr-table td:first-child {
	text-align: left;
}

.bbr-table thead th {
	font-family: var(--bbr-ui);
	font-size: 0.72rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--bbr-faint);
	border-bottom: 1px solid var(--bbr-line);
}

.bbr-table tbody td {
	font-family: var(--bbr-mono);
	color: var(--bbr-ink);
}

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

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

.bbr-table .bbr-row-label {
	font-family: var(--bbr-ui);
	color: var(--bbr-muted);
}

/* ---- Intro copy (sits above the dark shell, on the light page) ---- */
.bbr-tool-intro {
	max-width: 72ch;
	color: var(--wikipress-text, #202122);
}

/* ---- Responsive ---- */
@media (max-width: 720px) {
	.bbr-results {
		grid-template-columns: 1fr;
	}
	.bbr-field--lead {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bbr-chip,
	.bbr-btn,
	.bbr-input {
		transition: none;
	}
	.bbr-chip:hover {
		transform: none;
	}
}
