/*
 * dbi services · Neve Child Theme
 * eggs/console/search-egg.css — easter egg console (eggs/console/search-egg.php,
 * eggs/console/search-egg.js, enhancements #45).
 *
 * A phosphor terminal over the whole viewport: near-black glass,
 * green text with a soft bloom, scanlines, a vignette and a faint
 * flicker — the Fallout / Silo register. The [dbi] lines switch to the
 * brand teal (token from .dbi-scope, which the layer carries) so the
 * brand visibly takes the console over. Enter: the picture collapses to
 * a bright horizontal line, then a dot (CRT power-off). Leave: a short
 * bright flash, then the console fades and the overlay is back.
 *
 * Everything is CSS; no webfont, so the cut is instant. Under
 * prefers-reduced-motion every animation is off and the text is static.
 *
 * Removing search-egg.php's require in eggs/eggs.php unloads this file.
 */

.dbi-egg {
	position: fixed;
	inset: 0;
	z-index: 2147483000; /* above Neve's canvas search (9999999) */
	overflow: hidden;
	background: #0a0d0b;
	color: #7dff8f;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
	font-size: 15px;
	line-height: 1.6;
	cursor: default;
	outline: none;
	-webkit-user-select: none;
	user-select: none;
	animation: dbi-egg-cut 120ms steps( 2, end ) both;
}

/* Scanlines and vignette, above the text, never in the way. */
.dbi-egg::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: repeating-linear-gradient( 0deg, rgba( 0, 0, 0, .26 ) 0 1px, transparent 1px 3px );
	mix-blend-mode: multiply;
}
.dbi-egg::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: radial-gradient( ellipse at center, transparent 55%, rgba( 0, 0, 0, .6 ) 100% );
}

/* CRT power-off: the last picture as one bright line that shrinks to a
   dot. Decoration only; the script removes the element afterwards. */
.dbi-egg-crt {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 3px;
	margin-top: -1px;
	background: #d9ffe0;
	box-shadow: 0 0 14px 4px rgba( 125, 255, 143, .7 );
	transform-origin: center;
	animation: dbi-egg-collapse 280ms cubic-bezier( .2, .8, .2, 1 ) 60ms both;
}

.dbi-egg-screen {
	position: relative;
	margin: 0;
	padding: 7vh 6vw;
	max-width: 70ch;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	font: inherit;
	color: inherit;
	background: none;
	border: 0;
	text-shadow: 0 0 2px rgba( 125, 255, 143, .55 ), 0 0 12px rgba( 125, 255, 143, .22 );
	animation: dbi-egg-flicker 3.2s infinite;
}

.dbi-egg-line {
	min-height: 1.6em;
}
.dbi-egg-line.is-head {
	color: #b9ffc2;
	letter-spacing: .04em;
}
.dbi-egg-line.is-echo {
	color: #d9ffe0;
}
.dbi-egg-line.is-fatal {
	font-weight: 700;
	color: #b9ffc2;
}
.dbi-egg-line.is-dbi {
	color: var( --teal, #00aaa0 );
	text-shadow: 0 0 2px rgba( 0, 170, 160, .6 ), 0 0 12px rgba( 0, 170, 160, .28 );
}
.dbi-egg-line.is-love {
	margin-top: .4em;
	font-weight: 700;
}
/* "Eggs found: n of 3" — the same gold on every egg's end screen. */
.dbi-egg-line.is-eggs {
	margin-top: .4em;
	color: #ffd166;
	text-shadow: 0 0 2px rgba( 255, 209, 102, .5 ), 0 0 12px rgba( 255, 180, 60, .3 );
}
.dbi-egg-line.dbi-egg-wait {
	margin-top: 1.2em;
	color: #b9ffc2;
	animation: dbi-egg-blink 1.3s steps( 1, end ) infinite;
}

.dbi-egg-cursor {
	display: inline-block;
	width: .6em;
	height: 1.1em;
	margin-left: .1em;
	vertical-align: -.15em;
	background: currentColor;
	animation: dbi-egg-blink 1s steps( 1, end ) infinite;
}
.dbi-egg-wait .dbi-egg-cursor {
	animation: none;
}

/* Leave: a bright pulse, then the glass goes dark and the page is back. */
.dbi-egg.is-leaving {
	animation: dbi-egg-off 220ms ease-in both;
}

/* Visually hidden live region for screen readers. */
.dbi-egg-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

@keyframes dbi-egg-cut {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@keyframes dbi-egg-collapse {
	0%   { transform: scaleX( 1 ) scaleY( 1 ); opacity: 1; }
	70%  { transform: scaleX( .02 ) scaleY( 1.4 ); opacity: 1; }
	100% { transform: scaleX( 0 ) scaleY( .2 ); opacity: 0; }
}
@keyframes dbi-egg-flicker {
	0%, 100% { opacity: 1; }
	7%       { opacity: .96; }
	8%       { opacity: 1; }
	43%      { opacity: .97; }
	44%      { opacity: 1; }
	71%      { opacity: .95; }
	72%      { opacity: 1; }
}
@keyframes dbi-egg-blink {
	0%, 49%   { opacity: 1; }
	50%, 100% { opacity: 0; }
}
@keyframes dbi-egg-off {
	0%   { opacity: 1; filter: brightness( 1 ); }
	30%  { opacity: 1; filter: brightness( 2.2 ); }
	100% { opacity: 0; filter: brightness( 1 ); }
}

/* The page's own scrollbar would sit in the gutter of the blackout;
   the class is set on <html> by the script for the console's lifetime. */
html.dbi-egg-open {
	overflow: hidden;
}

@media ( min-width: 1024px ) {
	.dbi-egg {
		font-size: 17px;
	}
}
@media ( max-width: 480px ) {
	.dbi-egg {
		font-size: 13px;
	}
	.dbi-egg-screen {
		padding: 5vh 16px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.dbi-egg,
	.dbi-egg-crt,
	.dbi-egg-screen,
	.dbi-egg-cursor,
	.dbi-egg-line.dbi-egg-wait,
	.dbi-egg.is-leaving {
		animation: none;
	}
	.dbi-egg::before {
		background: none;
	}
}
