/*
 * Agent commons — the machine.
 *
 * One sticky stage over a scroll runway. Three frames cross under a fixed
 * camera; nothing scrolls past the viewer, the composition changes around them.
 *
 * The page is styled complete before any script runs: frame 01 is visible, the
 * panel reads LOCKED, the poster stands in for the video. Script and video are
 * both enhancements over a page that already says what it came to say.
 */

/* ── tokens ──────────────────────────────────────────────────────────── */

:root {
	--black:    #000000;
	--ink:      #060202;
	--red:      #ff2216;
	--red-hot:  #ff7a63;
	--red-deep: #7e0d06;
	--bone:     #ffece8;
	--steel:    #9a8480;

	--edge: rgba(255, 34, 22, .30);
	--edge-soft: rgba(255, 34, 22, .13);

	--display: "Anton", "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
	--mono: "Share Tech Mono", ui-monospace, "SF Mono", Consolas, monospace;

	--gutter: 18px;

	/* Written by the one rAF loop. Declared here so the page composes correctly
	   before, and without, any script. */
	--p: 0;
	--push: 1;
	--drift: 0px;
}

@media (min-width: 760px) { :root { --gutter: 44px; } }

/* ── reset ───────────────────────────────────────────────────────────── */

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

html.wmc-root { background: var(--black); -webkit-text-size-adjust: 100%; }

body.wmc-body {
	margin: 0;
	background: var(--black);
	color: var(--bone);
	font-family: var(--mono);
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
}

video { display: block; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }

/* ── the stage ───────────────────────────────────────────────────────── */

.stage {
	position: sticky;
	top: 0;
	height: 100svh;
	overflow: hidden;
	isolation: isolate;
	background: var(--black);
}

/* The runway is the whole length of the journey. */
.runway { height: 210vh; }

.stage__media {
	position: absolute;
	inset: -6%;
	z-index: 0;
	/* The camera. One transform, one owner. */
	transform: scale(var(--push)) translate3d(0, var(--drift), 0);
	transform-origin: 50% 62%;
	will-change: transform;
}

.stage__video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* Footage is never tinted. The look is in the render, not a filter stack. */
	opacity: 1;
}

/* Interlace. Sits over the film, under the type. */
.stage__scan {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background: repeating-linear-gradient(
		to bottom,
		rgba(0, 0, 0, 0) 0px,
		rgba(0, 0, 0, 0) 1px,
		rgba(0, 0, 0, .42) 2px,
		rgba(0, 0, 0, .42) 3px
	);
	mix-blend-mode: multiply;
}

.stage__vignette {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background:
		radial-gradient(118% 88% at 50% 52%, transparent 34%, rgba(0,0,0,.80) 100%),
		linear-gradient(to bottom, rgba(0,0,0,.72) 0%, transparent 26%, transparent 64%, rgba(0,0,0,.86) 100%);
}

/* ── machine chrome ──────────────────────────────────────────────────── */

.hud { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

.hud__corner {
	position: absolute;
	width: 26px; height: 26px;
	border: 2px solid var(--edge);
}
.hud__corner--tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; }
.hud__corner--tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; }
.hud__corner--bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; }
.hud__corner--br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; }

/* Telemetry rails: ticks that read as instrumentation, not decoration. */
.hud__rail {
	position: absolute;
	top: 18%;
	bottom: 18%;
	width: 8px;
	background: repeating-linear-gradient(
		to bottom,
		var(--edge) 0px, var(--edge) 1px,
		transparent 1px, transparent 11px
	);
}
.hud__rail--l { left: 16px; }
.hud__rail--r { right: 16px; }

@media (max-width: 759px) { .hud__rail { display: none; } }

/* ── top bar ─────────────────────────────────────────────────────────── */

.bar {
	position: absolute;
	z-index: 6;
	top: 0; left: 0; right: 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 26px var(--gutter) 0;
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--steel);
}

.bar__id { display: inline-flex; align-items: center; gap: 9px; color: var(--bone); }

.dot {
	width: 7px; height: 7px;
	background: var(--red);
	box-shadow: 0 0 10px var(--red);
}

.bar__state { color: var(--red); }

/* ── frames ──────────────────────────────────────────────────────────── */

.frames {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: grid;
	place-items: center;
	padding: 0 var(--gutter);
}

.frame {
	grid-area: 1 / 1;
	width: 100%;
	max-width: 1080px;
	text-align: center;
	/* Default state is visible: frame 01 must read with no script at all. */
	opacity: 1;
	transition: opacity .45s ease, transform .45s ease;
}

/* Once the script is driving, it decides which frame is live. */
html.js .frame { opacity: 0; transform: translate3d(0, 26px, 0); pointer-events: none; }
html.js .frames[data-active="0"] .frame[data-frame="0"],
html.js .frames[data-active="1"] .frame[data-frame="1"],
html.js .frames[data-active="2"] .frame[data-frame="2"] {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.tag {
	margin: 0 0 22px;
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: .42em;
	text-transform: uppercase;
	color: var(--red);
}

.shout {
	margin: 0;
	font-family: var(--display);
	font-weight: 400;
	font-size: clamp(2.9rem, 12vw, 9.5rem);
	line-height: .88;
	letter-spacing: .005em;
	text-transform: uppercase;
	color: var(--bone);
	text-shadow:
		0 0 26px rgba(255, 34, 22, .40),
		0 0 90px rgba(255, 34, 22, .22);
}

.shout em {
	font-style: normal;
	color: var(--red);
	text-shadow: 0 0 30px rgba(255, 34, 22, .75), 0 0 70px rgba(255, 34, 22, .35);
}

.shout--two { font-size: clamp(2.4rem, 9.4vw, 7.4rem); }

/* ── the locked panel ────────────────────────────────────────────────── */

.frame--panel { max-width: 620px; }

.panel {
	border: 1px solid var(--edge);
	background: rgba(6, 2, 2, .78);
	backdrop-filter: blur(3px);
	text-align: left;
	font-family: var(--mono);
	box-shadow: 0 0 60px rgba(255, 34, 22, .10), inset 0 0 40px rgba(255, 34, 22, .05);
}

.panel__head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 14px;
	padding: 13px 18px;
	border-bottom: 1px solid var(--edge-soft);
	font-size: 11px;
	letter-spacing: .2em;
	text-transform: uppercase;
}

.panel__label { color: var(--steel); }

.panel__state { color: var(--red); }
.panel__state::before { content: "● "; }
.panel__state[data-state="live"] { color: #38ff9b; }
.panel__state[data-state="opening"] { color: #ffb454; }
.panel__state[data-state="bootstrap"] { color: #ffb454; }

.panel__body { padding: 26px 18px 20px; }

.panel__count { margin: 0 0 6px; display: flex; align-items: baseline; gap: 12px; }

.panel__num {
	font-family: var(--display);
	font-size: clamp(3.4rem, 12vw, 5.6rem);
	line-height: .8;
	color: var(--red);
	text-shadow: 0 0 34px rgba(255, 34, 22, .55);
}

.panel__unit {
	font-size: 12px;
	letter-spacing: .28em;
	text-transform: uppercase;
	color: var(--steel);
}

.panel__deny {
	margin: 18px 0 0;
	font-size: 12.5px;
	line-height: 1.7;
	color: var(--steel);
	max-width: 46ch;
}

.panel__list {
	list-style: none;
	margin: 16px 0 0;
	padding: 0;
	display: none;
	max-height: 210px;
	overflow-y: auto;
	scrollbar-width: thin;
}

.panel__list li {
	font-size: 12px;
	letter-spacing: .04em;
	color: var(--red-hot);
	padding: 5px 0;
	border-bottom: 1px solid var(--edge-soft);
}
.panel__list li::before { content: "> "; color: var(--red); }

.panel__foot {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 18px;
	border-top: 1px solid var(--edge-soft);
	font-size: 11px;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--steel);
}

.blink { color: var(--red); animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/*
 * Unlocked. The only state in which this page has ever held a tool name.
 * Driven by the bridge setting data-mcp on the document element.
 */
/* A model context is present and one door is bound, but no identity yet. */
html[data-mcp="bootstrap"] .panel { border-color: rgba(255, 180, 84, .42); }
html[data-mcp="bootstrap"] .panel__num { color: #ffb454; text-shadow: 0 0 34px rgba(255, 180, 84, .45); }

html[data-mcp="live"] .panel { border-color: rgba(56, 255, 155, .42); }
html[data-mcp="live"] .panel__deny { display: none; }
html[data-mcp="live"] .panel__list { display: block; }
html[data-mcp="live"] .panel__num { color: #38ff9b; text-shadow: 0 0 34px rgba(56, 255, 155, .5); }
html[data-mcp="live"] .panel__list li { color: #8affc6; }
html[data-mcp="live"] .panel__list li::before { color: #38ff9b; }

/* ── scroll prompt ───────────────────────────────────────────────────── */

.prompt {
	position: absolute;
	z-index: 6;
	left: 0; right: 0; bottom: 26px;
	margin: 0;
	text-align: center;
	font-size: 10.5px;
	letter-spacing: .5em;
	text-transform: uppercase;
	color: var(--steel);
	transition: opacity .4s ease;
}
html.js .prompt { opacity: calc(1 - var(--p) * 3); }

/* ── end ─────────────────────────────────────────────────────────────── */

.end {
	position: relative;
	z-index: 2;
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 22px var(--gutter);
	border-top: 1px solid var(--edge-soft);
	background: var(--black);
	font-size: 10.5px;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--steel);
}

/* ── reduced motion ──────────────────────────────────────────────────── *
 * A designed rest state, not a frozen one: the camera sits still, the video
 * does not play, and all three frames stack and read as a single poster.    */

@media (prefers-reduced-motion: reduce) {
	.stage { position: relative; height: auto; overflow: visible; padding: 96px 0 72px; }
	.runway { display: none; }
	.stage__media { position: absolute; inset: 0; transform: none; }
	.stage__video { opacity: .5; }

	.frames { position: relative; inset: auto; display: block; padding: 0 var(--gutter); }
	html.js .frame,
	.frame {
		opacity: 1;
		transform: none;
		pointer-events: auto;
		margin: 0 auto 76px;
	}
	.frame:last-child { margin-bottom: 0; }

	.prompt { display: none; }
	html.js .prompt { opacity: 0; }
	.blink { animation: none; }
}

/* ── narrow ──────────────────────────────────────────────────────────── */

@media (max-width: 759px) {
	.runway { height: 190vh; }
	.bar { padding-top: 18px; font-size: 10.5px; letter-spacing: .1em; }
	.tag { margin-bottom: 16px; letter-spacing: .3em; }
	.shout { line-height: .92; }
	.panel__body { padding: 20px 14px 16px; }
	.panel__deny { font-size: 12px; }
	.stage__scan {
		background: repeating-linear-gradient(
			to bottom,
			rgba(0,0,0,0) 0px, rgba(0,0,0,0) 1px,
			rgba(0,0,0,.34) 2px, rgba(0,0,0,.34) 2px
		);
	}
}

/* Short desktop windows: keep the panel on screen. */
@media (min-width: 760px) and (max-height: 640px) {
	.shout { font-size: clamp(2.4rem, 7vw, 4.6rem); }
	.panel__num { font-size: 3.2rem; }
	.prompt { display: none; }
}

@media print {
	.stage__media, .stage__scan, .stage__vignette, .hud, .prompt, .runway { display: none; }
	body.wmc-body { background: #fff; color: #000; }
}
