/**
 * Customer Pickup Display (0.10.0, ADR-053).
 *
 * Designed to be read from several metres away: order numbers use a
 * fluid clamp() so a 1920×1080 TV gets huge digits while a 320px phone
 * still fits. Status is never colour-only — every column and card
 * carries a text heading and an icon glyph. No flashing: a newly ready
 * number gets ONE short, reduced-motion-aware highlight, then rests.
 */

.rso-pickup-display {
	--rso-pd-bg: #14150f;
	--rso-pd-panel: #1e2018;
	--rso-pd-ink: #f7f6ef;
	--rso-pd-muted: #b9b7a6;
	--rso-pd-prep: #ffd166;
	--rso-pd-ready: #6ee787;
	--rso-pd-line: #34362a;

	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: clamp(8px, 1.5vh, 20px);
	min-height: 70vh;
	padding: clamp(10px, 2vh, 28px);
	padding-left: max(clamp(10px, 2vw, 28px), env(safe-area-inset-left, 0px));
	padding-right: max(clamp(10px, 2vw, 28px), env(safe-area-inset-right, 0px));
	padding-bottom: max(clamp(10px, 2vh, 28px), env(safe-area-inset-bottom, 0px));
	background: var(--rso-pd-bg);
	color: var(--rso-pd-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.rso-pickup-display *,
.rso-pickup-display *::before,
.rso-pickup-display *::after { box-sizing: border-box; }

.rso-pickup-display:fullscreen { min-height: 100vh; }

/* --- top bar --- */

.rso-pd-top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
}

.rso-pd-conn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 700;
	font-size: clamp(0.8rem, 1.4vh, 1rem);
	padding: 6px 14px;
	border-radius: 999px;
	border: 2px solid var(--rso-pd-line);
	color: var(--rso-pd-muted);
}
.rso-pd-conn .dot { width: 0.7em; height: 0.7em; border-radius: 50%; background: currentColor; flex: none; }
.rso-pd-conn.is-live { color: var(--rso-pd-ready); border-color: #2f5d3a; }
.rso-pd-conn.is-stale { color: var(--rso-pd-prep); border-color: #6a5a24; }
.rso-pd-conn.is-offline { color: #ff9f9a; border-color: #6a2f2b; }

.rso-pd-spacer { margin-left: auto; }

.rso-pd-fs {
	min-height: 48px;
	min-width: 48px;
	padding: 10px 18px;
	border-radius: 12px;
	border: 2px solid var(--rso-pd-line);
	background: var(--rso-pd-panel);
	color: var(--rso-pd-ink);
	font-weight: 800;
	font-size: clamp(0.85rem, 1.5vh, 1.05rem);
	cursor: pointer;
	white-space: normal;
	overflow-wrap: anywhere;
	line-height: 1.3;
}
.rso-pd-fs:hover { border-color: var(--rso-pd-muted); }
.rso-pd-fs:active { transform: translateY(1px); }
.rso-pd-fs:focus-visible { outline: 4px solid var(--rso-pd-ink); outline-offset: 3px; }

/* --- columns --- */

.rso-pd-columns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: clamp(8px, 1.6vw, 24px);
	flex: 1;
	min-height: 0;
}

.rso-pd-col {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--rso-pd-panel);
	border: 3px solid var(--rso-pd-line);
	border-radius: 18px;
	padding: clamp(8px, 1.4vh, 20px);
}

.rso-pd-col h2 {
	display: flex;
	align-items: center;
	gap: 0.4em;
	margin: 0 0 clamp(6px, 1.2vh, 16px);
	font-size: clamp(1rem, 3.2vh, 2.4rem);
	line-height: 1.15;
	overflow-wrap: anywhere;
}
.rso-pd-col h2 .icon { flex: none; }
.rso-pd-col.is-prep h2 { color: var(--rso-pd-prep); }
.rso-pd-col.is-ready h2 { color: var(--rso-pd-ready); }

.rso-pd-list {
	display: flex;
	flex-wrap: wrap;
	align-content: flex-start;
	gap: clamp(6px, 1.2vh, 16px);
	margin: 0;
	padding: 0;
	list-style: none;
	min-width: 0;
}

.rso-pd-num {
	flex: 1 1 auto;
	min-width: 0;
	text-align: center;
	font-weight: 900;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.01em;
	/* Readable across a room on a TV, still contained at 320px.
	   max() of a width- and a height-derived size deliberately: a TV
	   browser window is often WIDE BUT SHORT (address bar, overscan), and
	   sizing on vh alone shrinks the digits to unreadable on exactly the
	   screen this display exists for. */
	font-size: clamp(1.6rem, max(4vw, 7.5vh), 6rem);
	line-height: 1.1;
	padding: clamp(4px, 1vh, 16px) clamp(8px, 1vw, 20px);
	border-radius: 14px;
	border: 3px solid transparent;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.rso-pd-col.is-prep .rso-pd-num { background: #2a2716; color: #ffe6a3; border-color: #6a5a24; }
.rso-pd-col.is-ready .rso-pd-num { background: #16301d; color: #b9f6c6; border-color: #2f5d3a; }

/* One restrained highlight when a number becomes ready — a single
   short fade, never a repeating flash. */
@keyframes rso-pd-arrive {
	from { transform: scale(1.04); border-color: var(--rso-pd-ready); }
	to   { transform: scale(1); }
}
.rso-pd-num.is-new { animation: rso-pd-arrive 900ms ease-out 1; }

.rso-pd-empty {
	color: var(--rso-pd-muted);
	font-size: clamp(0.9rem, 2vh, 1.5rem);
	overflow-wrap: anywhere;
}

/* --- idle / states --- */

.rso-pd-idle {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: clamp(8px, 2vh, 24px);
	min-height: 0;
	text-align: center;
}
.rso-pd-idle video,
.rso-pd-idle img.poster {
	max-width: 100%;
	max-height: 70vh;
	border-radius: 18px;
}
.rso-pd-idle img.logo { max-width: min(60%, 420px); max-height: 30vh; }
.rso-pd-idle p { font-size: clamp(1rem, 3vh, 2.2rem); margin: 0; overflow-wrap: anywhere; }

.rso-pd-loading, .rso-pd-unavailable {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: clamp(1rem, 2.6vh, 1.8rem);
	color: var(--rso-pd-muted);
	text-align: center;
	overflow-wrap: anywhere;
}

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

/* --- narrow screens: stack the two columns --- */

@media (max-width: 640px) {
	.rso-pickup-display { --stacked: 1; }
	.rso-pd-columns { grid-template-columns: 1fr; }
	.rso-pd-num { font-size: clamp(1.5rem, 9vw, 3rem); }
}

@media (prefers-reduced-motion: reduce) {
	.rso-pd-num.is-new { animation: none; }
	.rso-pd-fs:active { transform: none; }
}
