/* PulseCast display. Original design: deep charcoal, electric blue accent, system type. */
:root {
	--pc-bg: #0f1216;
	--pc-surface: #181d24;
	--pc-text: #f2f5f8;
	--pc-muted: #9aa6b4;
	--pc-accent: #2f7bff;
	--pc-line: #262d37;
	--pc-gap: clamp(0.75rem, 1.6vw, 2rem);
	--pc-pad: clamp(1rem, 2.4vw, 3rem);
}

:root[data-theme="light"] {
	--pc-bg: #f3f5f8;
	--pc-surface: #ffffff;
	--pc-text: #10151b;
	--pc-muted: #566272;
	--pc-accent: #0b5fe0;
	--pc-line: #dde3ea;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	height: 100%;
	background: var(--pc-bg);
	color: var(--pc-text);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	overflow: hidden;
	cursor: none;
}

#pulsecast {
	height: 100vh;
	height: 100dvh;
	padding: var(--pc-pad);
	display: flex;
	flex-direction: column;
	font-size: clamp(14px, 1.5vw, 40px);
}

.pc-stage {
	flex: 1;
	min-height: 0;
	display: grid;
	gap: var(--pc-gap);
	overflow: hidden;
}

[data-layout="cards"] .pc-stage {
	grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}

.pc-title {
	margin: 0;
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.01em;
	overflow-wrap: anywhere;
}

.pc-meta {
	display: flex;
	gap: 0.75em;
	align-items: baseline;
	color: var(--pc-muted);
	font-size: 0.8em;
}

.pc-source {
	color: var(--ac, var(--pc-accent));
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

[data-show-source="0"] .pc-source,
[data-show-time="0"] .pc-time,
[data-show-images="0"] .pc-image {
	display: none;
}

/* Featured Cards */
.pc-card {
	display: flex;
	flex-direction: column;
	gap: 0.6em;
	min-height: 0;
	padding: 1em;
	background: var(--pc-surface);
	border: 1px solid var(--pc-line);
	border-radius: 0.9em;
	overflow: hidden;
}

.pc-image {
	flex: 1 1 auto;
	min-height: 0;
	border-radius: 0.6em;
	overflow: hidden;
	background: var(--pc-line);
}

.pc-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.pc-image-empty {
	display: none;
}

.pc-featured {
	border-top: 0.25em solid var(--pc-accent);
}

.pc-featured .pc-title {
	font-size: 2.2em;
}

.pc-summary {
	margin: 0;
	color: var(--pc-muted);
	font-size: 1.1em;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pc-secondary {
	display: grid;
	grid-template-rows: repeat(5, minmax(0, 1fr));
	gap: var(--pc-gap);
	min-height: 0;
}

.pc-secondary .pc-card {
	flex-direction: row;
	align-items: center;
	gap: 1em;
}

.pc-secondary .pc-image {
	flex: 0 0 32%;
	align-self: stretch;
}

.pc-secondary .pc-title {
	font-size: 1.25em;
}

.pc-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.4em;
	min-width: 0;
}

/* Keep text blocks at their natural height, clamp long headlines, and let only images flex. */
.pc-featured .pc-title,
.pc-featured .pc-summary,
.pc-featured .pc-meta {
	flex-shrink: 0;
}

.pc-featured .pc-title {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pc-secondary .pc-body {
	justify-content: center;
	min-height: 0;
	overflow: hidden;
}

.pc-secondary .pc-title {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 1.15em;
}

.pc-secondary .pc-meta {
	flex-shrink: 0;
}

/* Headline Wall */
.pc-wall {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-template-rows: repeat(6, minmax(0, 1fr));
	grid-auto-flow: column;
	gap: 0 calc(var(--pc-gap) * 2);
	min-height: 0;
}

.pc-row {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.3em;
	min-height: 0;
	padding: 0.4em 0 0.4em 0.9em;
	border-bottom: 1px solid var(--pc-line);
	border-left: 0.2em solid var(--pc-accent);
	overflow: hidden;
}

.pc-row .pc-title {
	font-size: 1.5em;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Connection status */
.pc-status {
	position: fixed;
	right: 1.2rem;
	bottom: 0.9rem;
	padding: 0.25em 0.8em;
	font-size: 0.7em;
	color: var(--pc-muted);
	background: var(--pc-surface);
	border: 1px solid var(--pc-line);
	border-radius: 2em;
	opacity: 0.85;
}

.pc-status[hidden] {
	display: none;
}

/* Portrait and narrow screens */
@media (orientation: portrait), (max-width: 800px) {
	[data-layout="cards"] .pc-stage {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: minmax(0, 1.4fr) minmax(0, 1fr);
	}

	.pc-wall {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: repeat(12, minmax(0, 1fr));
	}

	.pc-featured .pc-title {
		font-size: 1.7em;
	}
}

/* ==========================================================================
   Command Center
   ========================================================================== */
[data-layout="command"] {
	--pc-bg: #080b10;
	--pc-surface: #10151d;
	--pc-raised: #171e29;
	--pc-text: #f4f7fb;
	--pc-muted: #a7b3c2;
	--pc-line: #232c3a;
	--pc-al: 68%;
}

[data-layout="command"][data-theme="light"] {
	--pc-bg: #eef1f6;
	--pc-surface: #ffffff;
	--pc-raised: #f6f8fb;
	--pc-text: #0d131b;
	--pc-muted: #4a5667;
	--pc-line: #d5dce6;
	--pc-al: 38%;
}

[data-layout="command"] body,
[data-layout="command"] {
	background:
		radial-gradient(120% 80% at 85% -10%, var(--pc-glow, rgba(47, 123, 255, 0.16)), transparent 60%),
		radial-gradient(90% 70% at 0% 110%, var(--pc-glow-2, rgba(47, 123, 255, 0.08)), transparent 60%),
		var(--pc-bg);
}

[data-layout="command"] #pulsecast {
	padding: clamp(0.6rem, 1.4vmin, 2rem);
	font-size: clamp(13px, min(1.1vw, 2.1vh), 46px);
}

[data-layout="command"] .pc-stage {
	display: block;
}

.pc-cc {
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	gap: 0.9em;
	height: 100%;
	min-height: 0;
}

.pc-cc-header {
	display: flex;
	align-items: center;
	gap: 1.4em;
	padding: 0.2em 0.4em;
}

.pc-brand {
	display: flex;
	align-items: center;
	gap: 0.6em;
	font-weight: 800;
	font-size: 1.25em;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.pc-logo {
	width: 1.1em;
	height: 1.1em;
	border-radius: 0.3em;
	background:
		linear-gradient(135deg, transparent 45%, #fff 46% 54%, transparent 55%),
		linear-gradient(135deg, var(--pc-accent), var(--pc-accent));
	box-shadow: 0 0 0.8em var(--pc-glow, rgba(47, 123, 255, 0.55));
}

.pc-live {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.25em 0.8em;
	border: 1px solid var(--pc-line);
	border-radius: 2em;
	background: var(--pc-surface);
	font-size: 0.8em;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.pc-live-dot {
	width: 0.6em;
	height: 0.6em;
	border-radius: 50%;
	background: #2bd576;
	animation: pc-pulse 2.4s ease-in-out infinite;
}

.pc-live[data-state="wait"] .pc-live-dot {
	background: #f5b83d;
	animation: none;
}

.pc-live[data-state="off"] .pc-live-dot {
	background: #ff5a5f;
	animation: none;
}

.pc-counts {
	color: var(--pc-muted);
	font-size: 0.85em;
	letter-spacing: 0.04em;
}

.pc-clock {
	margin-left: auto;
	display: flex;
	align-items: baseline;
	gap: 0.8em;
	white-space: nowrap;
}

.pc-clock-time {
	font-size: 1.9em;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.01em;
}

.pc-clock-date {
	color: var(--pc-muted);
	font-size: 0.95em;
}

.pc-cc-main {
	display: grid;
	grid-template-columns: minmax(0, 57fr) minmax(0, 43fr);
	gap: 0.9em;
	min-height: 0;
}

.pc-feature,
.pc-panel,
.pc-strip {
	min-height: 0;
	min-width: 0;
}

.pc-feature-card {
	--ah: var(--ac, hsl(var(--h, 215) 85% var(--pc-al)));
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	height: 100%;
	padding: 1.6em;
	border: 1px solid var(--pc-line);
	border-radius: 1em;
	overflow: hidden;
	color: var(--pc-text);
	background:
		repeating-linear-gradient(135deg, hsl(var(--h, 215) 40% 50% / 0.07) 0 0.12em, transparent 0.12em 1.1em),
		linear-gradient(150deg, hsl(var(--h, 215) 55% 22% / 0.9), var(--pc-surface) 70%);
}

[data-theme="light"] .pc-feature-card {
	background:
		repeating-linear-gradient(135deg, hsl(var(--h, 215) 40% 40% / 0.08) 0 0.12em, transparent 0.12em 1.1em),
		linear-gradient(150deg, hsl(var(--h, 215) 70% 88%), var(--pc-surface) 75%);
}

.pc-feature-card::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 0.3em;
	background: var(--ah);
	z-index: 2;
}

.pc-feature-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.pc-has-image::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(5, 8, 12, 0.94) 8%, rgba(5, 8, 12, 0.72) 42%, rgba(5, 8, 12, 0.25) 100%);
}

.pc-has-image {
	color: #f4f7fb;
}

.pc-feature-body {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 0.6em;
	min-height: 0;
}

.pc-feature-body .pc-meta {
	order: -1;
	font-size: 0.95em;
}

.pc-has-image .pc-meta,
.pc-has-image .pc-summary {
	color: #d3dbe6;
}

.pc-feature .pc-title {
	text-wrap: balance;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pc-t-l {
	font-size: 2.9em;
	-webkit-line-clamp: 4;
}

.pc-t-m {
	font-size: 2.3em;
	-webkit-line-clamp: 5;
}

.pc-t-s {
	font-size: 1.8em;
	-webkit-line-clamp: 6;
}

.pc-feature .pc-summary {
	font-size: 1.1em;
	-webkit-line-clamp: 3;
	color: var(--pc-muted);
}

.pc-source {
	color: var(--ac, hsl(var(--h, 215) 85% var(--pc-al, 68%)));
}

.pc-panel {
	display: flex;
	flex-direction: column;
	padding: 1em 1.2em;
	border: 1px solid var(--pc-line);
	border-radius: 1em;
	background: var(--pc-surface);
}

.pc-panel-title {
	margin: 0 0 0.4em;
	color: var(--pc-muted);
	font-size: 0.8em;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.pc-headlines {
	flex: 1;
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
	min-height: 0;
}

.pc-headline {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.25em;
	min-height: 0;
	padding: 0.3em 0 0.3em 0.9em;
	border-left: 0.2em solid var(--ac, hsl(var(--h, 215) 85% var(--pc-al)));
	border-bottom: 1px solid var(--pc-line);
	overflow: hidden;
}

.pc-headline:last-child {
	border-bottom: 0;
}

.pc-headline .pc-title {
	font-size: 1.3em;
	text-wrap: balance;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pc-strip {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	gap: 0.9em;
}

.pc-strip[hidden] {
	display: none;
}

.pc-mini {
	display: flex;
	flex-direction: column;
	gap: 0.4em;
	padding: 0.8em 1em;
	min-height: 7.2em;
	border: 1px solid var(--pc-line);
	border-top: 0.25em solid var(--ac, hsl(var(--h, 215) 85% var(--pc-al)));
	border-radius: 0.8em;
	background: var(--pc-surface);
	overflow: hidden;
}

.pc-mini .pc-meta {
	order: -1;
	font-size: 0.75em;
}

.pc-mini .pc-title {
	font-size: 1.1em;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pc-fade > * {
	animation: pc-fade-in 0.6s ease-out;
}

@keyframes pc-fade-in {
	from {
		opacity: 0;
		transform: translateY(0.3em);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes pc-pulse {
	50% {
		opacity: 0.35;
	}
}

[data-layout="command"] .pc-status {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.pc-fade > *,
	.pc-live-dot {
		animation: none;
	}
}

/* Portrait: featured on top, headlines below, a shorter strip. */
@media (orientation: portrait) {
	[data-layout="command"] #pulsecast {
		font-size: clamp(13px, min(2.2vw, 1.25vh), 46px);
	}

	.pc-cc-main {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
	}

	.pc-t-l {
		font-size: 2.4em;
	}

	.pc-t-m {
		font-size: 2em;
	}

	.pc-counts {
		display: none;
	}
}

/* Short or narrow windows: tighter header. */
@media (max-width: 800px), (max-height: 620px) {
	.pc-counts,
	.pc-clock-date {
		display: none;
	}

	.pc-feature-card {
		padding: 1em;
	}

	.pc-feature .pc-summary {
		display: none;
	}
}

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

/* ==========================================================================
   Palettes. Midnight and Light are the original dark and light designs; the
   others change colours only. Written after the layouts so they take priority.
   ========================================================================== */
:root[data-palette="ocean"] {
	--pc-bg: #06141f;
	--pc-surface: #0c2233;
	--pc-raised: #12304a;
	--pc-text: #eaf6ff;
	--pc-muted: #9dc0d8;
	--pc-line: #1c3d57;
	--pc-accent: #22b8e8;
	--pc-glow: rgba(34, 184, 232, 0.18);
	--pc-glow-2: rgba(34, 184, 232, 0.08);
	--pc-al: 68%;
}

:root[data-palette="ember"] {
	--pc-bg: #140c09;
	--pc-surface: #22140f;
	--pc-raised: #2d1a13;
	--pc-text: #fff4ec;
	--pc-muted: #d1ad9a;
	--pc-line: #3b241b;
	--pc-accent: #ff7a2f;
	--pc-glow: rgba(255, 122, 47, 0.18);
	--pc-glow-2: rgba(255, 122, 47, 0.08);
	--pc-al: 68%;
}

:root[data-palette="forest"] {
	--pc-bg: #08130d;
	--pc-surface: #10221a;
	--pc-raised: #163026;
	--pc-text: #edf8f0;
	--pc-muted: #a4c4b0;
	--pc-line: #1d3a2a;
	--pc-accent: #3ecf7a;
	--pc-glow: rgba(62, 207, 122, 0.16);
	--pc-glow-2: rgba(62, 207, 122, 0.07);
	--pc-al: 68%;
}

.pc-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
