/* ZECMON — amber phosphor terminal.
 *
 * One deliberate look: P3 amber on dark grey, monospace throughout, no
 * light theme. The page is a CRT, so the "chrome" is faint scanlines and a
 * blinking block caret; everything else is plain text on a fixed grid.
 *
 * LEGIBILITY RULES THIS FILE, and it is the one thing to keep in mind
 * before making it look more "authentic". Two things were making it hard
 * to read and neither was the colour:
 *
 *   - The glow. A heavy text-shadow smears the glyph edges; it reads as
 *     phosphor for about ten seconds and as eye strain after that. Body
 *     text now carries none at all — only the wordmark and the progress
 *     fill, which are shapes rather than words.
 *   - The scanlines. Darkening every other row costs real contrast on
 *     small text. They are now a whisper, and off entirely under
 *     prefers-reduced-motion.
 *
 * Palette is three ambers (heading / body / dim) plus one green for
 * "found a note" — the only other colour that ever appears, so a hit is
 * unmissable on the progress bar and in the list.
 */

/* Self-hosted — the CSP is default-src 'self', and a terminal that
 * phones a CDN for its typeface would be a poor advertisement for a page
 * whose whole pitch is "nothing leaves this origin". Latin subsets only. */
@font-face {
	font-family: 'Plex Mono';
	src: url('fonts/plexmono-400.woff2') format('woff2');
	font-weight: 400;
	font-display: swap;
}
@font-face {
	font-family: 'Plex Mono';
	src: url('fonts/plexmono-500.woff2') format('woff2');
	font-weight: 500;
	font-display: swap;
}
@font-face {
	font-family: 'Plex Mono';
	src: url('fonts/plexmono-600.woff2') format('woff2');
	font-weight: 600;
	font-display: swap;
}
@font-face {
	font-family: 'Orbitron';
	src: url('fonts/orbitron-700.woff2') format('woff2');
	font-weight: 700;
	font-display: swap;
}

:root {
	/* Phosphor ambers straight off the reference sheet: P3 amber at 600nm
	 * for body, the 593nm light amber for headings and live values. */
	--amber:     #FFB000;
	--amber-hi:  #FFCC00;
	--amber-dim: #C68A2E;   /* labels, rules, secondary prose */

	/* Panels sit on the sheet's #282828; the page behind them is a shade
	 * darker so the panels read as raised and body contrast stays ~8:1. */
	--bg:        #1e1e1e;
	--bg-panel:  #282828;
	--rule:      #4a4030;

	--hit:       #33FF33;   /* P1 green — a witnessed note, and nothing else */
	--hit-dim:   #2f9c2f;
	--bad:       #FF6B5E;

	/* Plex Mono because this is a terminal and every column of hex, height
	 * and amount has to line up — and because it stays legible at the
	 * small sizes the readout uses, which the previous system stack did
	 * not. Orbitron is display only; it has no box-drawing or tabular
	 * figures and would be unreadable as body text. */
	--mono: 'Plex Mono', ui-monospace, "SF Mono", "SFMono-Regular", Menlo,
	        Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
	--display: 'Orbitron', var(--mono);
}

* { box-sizing: border-box }

html {
	background: var(--bg);
	color-scheme: dark;
}

body {
	margin: 0;
	padding: 0;
	background:
		radial-gradient(ellipse 120% 80% at 50% 0%, #1b1409 0%, var(--bg) 64%);
	color: var(--amber);
	font: 500 17px/1.62 var(--mono);
	min-height: 100vh;
	/* No glow on body text — see the note at the top of this file. */
}

/* Fixed scanline overlay. Pointer-events off so it never eats a click. */
.scanlines {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 9;
	background: repeating-linear-gradient(
		to bottom,
		rgba(0, 0, 0, 0) 0px,
		rgba(0, 0, 0, 0) 2px,
		rgba(0, 0, 0, .07) 3px,
		rgba(0, 0, 0, .07) 4px
	);
	box-shadow: inset 0 0 190px 60px rgba(0, 0, 0, .38);
}
@media (prefers-reduced-motion: reduce) {
	.scanlines { background: none }
}

.crt {
	max-width: 74ch;
	margin: 0 auto;
	padding: 2.4rem 1.2rem 4rem;
}

/* ── Masthead ─────────────────────────────────────────────────── */

.masthead { margin: 0 0 1.5rem }

.logo {
	margin: 0;
	color: var(--amber-hi);
	font-family: var(--display);
	font-size: clamp(30px, 8.5vw, 54px);
	font-weight: 700;
	line-height: 1;
	letter-spacing: .1em;
	/* The wordmark is a shape, not something you read word by word, so it
	 * is the one place a real phosphor bloom earns its keep. */
	text-shadow: 0 0 22px rgba(255, 176, 0, .45);
	transition: font-size .25s ease;
}
/* Once a scan is running the wordmark steps back out of the way. */
body[data-mode="scanning"] .logo { font-size: clamp(22px, 5vw, 32px) }

.strap {
	margin: .7rem 0 0;
	color: var(--amber-dim);
	font-size: .82rem;
	font-weight: 600;
	letter-spacing: .18em;
	text-transform: uppercase;
}
.link-state { letter-spacing: .06em; text-transform: none }

/* ── Panels ───────────────────────────────────────────────────── */

.panel {
	border: 1px solid var(--rule);
	background: var(--bg-panel);
	padding: 1.1rem 1.2rem 1.25rem;
	margin: 0 0 1.1rem;
}

.panel__title {
	margin: 0 0 .9rem;
	color: var(--amber-hi);
	font-family: var(--display);
	font-size: .82rem;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
}
.panel__title .count { color: var(--amber-dim); letter-spacing: 0; font-weight: 500 }

.dim { color: var(--amber-dim) }

/* Small print that still has to be readable. */
.hint {
	margin: .85rem 0 0;
	font-size: .84rem;
	color: var(--amber-dim);
}
.linkish {
	border: 0;
	background: none;
	padding: 0;
	font: inherit;
	color: var(--amber);
	text-decoration: underline dotted;
	text-underline-offset: 3px;
	cursor: pointer;
}
.linkish:hover { color: var(--amber) }

/* ── Key entry ────────────────────────────────────────────────── */

body[data-mode="scanning"] #entry { display: none }

.prompt {
	display: flex;
	align-items: flex-start;
	gap: .5ch;
	border: 1px solid var(--amber-dim);
	background: #141414;
	padding: .6rem .65rem;
}
.prompt:focus-within { border-color: var(--amber) }

.caret {
	color: var(--amber-hi);
	line-height: 1.62;
	animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none } }

#ufvk {
	flex: 1;
	border: 0;
	outline: 0;
	resize: vertical;
	background: transparent;
	color: var(--amber);
	font: inherit;
	font-size: .94rem;
	line-height: 1.62;
	word-break: break-all;
	text-shadow: inherit;
}
#ufvk::placeholder { color: #6d4f21 }

.controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .65rem .95rem;
	margin-top: .95rem;
}

.btn {
	border: 1px solid var(--amber);
	background: transparent;
	color: var(--amber);
	font: inherit;
	font-size: .88rem;
	font-weight: 700;
	letter-spacing: .1em;
	padding: .5rem 1.15rem;
	cursor: pointer;
	text-shadow: inherit;
}
.btn:hover:not(:disabled) { background: var(--amber); color: #1e1e1e; text-shadow: none }
.btn:disabled { border-color: var(--amber-dim); color: var(--amber-dim); cursor: not-allowed }
.btn--tiny {
	font-size: .74rem;
	padding: .18rem .7rem;
	border-color: var(--amber-dim);
	color: var(--amber-dim);
	letter-spacing: .08em;
}
.btn--tiny:hover { background: var(--amber-dim); color: #1e1e1e; text-shadow: none }

.opt {
	display: inline-flex;
	align-items: center;
	gap: .5ch;
	font-size: .84rem;
	color: var(--amber-dim);
	cursor: pointer;
}
.opt input { accent-color: var(--amber); margin: 0 }

.height-in {
	border: 1px solid var(--amber-dim);
	background: #141414;
	color: var(--amber);
	font: inherit;
	font-size: .84rem;
	padding: .35rem .5rem;
	width: 11ch;
}
.height-in:focus { outline: 0; border-color: var(--amber) }

.err {
	margin: .9rem 0 0;
	color: var(--bad);
	font-size: .86rem;
	font-weight: 600;
}

/* ── Which key are we watching ────────────────────────────────── */

.keyline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem .9ch;
	margin: 0 0 .9rem;
	font-size: .86rem;
}
.keyline__label {
	color: var(--amber-dim);
	text-transform: uppercase;
	letter-spacing: .09em;
	font-size: .72rem;
	font-weight: 700;
}
.keyline code {
	color: var(--amber-hi);
	font-size: .88rem;
	word-break: break-all;
}

/* ── The bar ──────────────────────────────────────────────────── */

.phase-note {
	margin: 0 0 1rem;
	font-size: .86rem;
	color: var(--amber-dim);
	min-height: 2.7em;
}

.bar { margin: 0 0 1.15rem }

.bar__track {
	position: relative;
	height: 28px;
	border: 1px solid var(--amber-dim);
	background: #141414;
	overflow: hidden;
}

/* Hatched so movement is legible even when the fill creeps a few pixels
 * per poll. */
.bar__fill {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 0;
	background:
		repeating-linear-gradient(
			135deg,
			rgba(255, 202, 106, .9) 0px,
			rgba(255, 202, 106, .9) 6px,
			rgba(255, 170, 60, .5) 6px,
			rgba(255, 170, 60, .5) 12px
		);
	box-shadow: 0 0 14px rgba(255, 160, 40, .45);
	transition: left .45s linear, width .45s linear;
}
.bar--reverse .bar__fill { animation: hatch-back 1s linear infinite }
@keyframes hatch-back { to { background-position: 34px 0 } }
@media (prefers-reduced-motion: reduce) {
	.bar--reverse .bar__fill { animation: none }
	.bar__fill { transition: none }
}

/* Note ticks sit above the fill so a hit stays visible once passed. */
.bar__notes { position: absolute; inset: 0; pointer-events: none }
.bar__notes i {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 2px;
	margin-left: -1px;
	background: var(--hit);
	box-shadow: 0 0 7px var(--hit), 0 0 16px rgba(134, 255, 164, .55);
}

.bar__scale {
	display: flex;
	justify-content: space-between;
	gap: 1ch;
	margin-top: .4rem;
	font-size: .78rem;
	color: var(--amber-dim);
}

/* ── Readout ──────────────────────────────────────────────────── */

.readout {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(12ch, 1fr));
	gap: .5rem 1.2rem;
	margin: 0 0 .95rem;
	font-size: .86rem;
}
.readout div { display: flex; flex-direction: column; gap: .12rem; min-width: 0 }
.readout dt {
	color: var(--amber-dim);
	text-transform: uppercase;
	letter-spacing: .09em;
	font-size: .7rem;
	font-weight: 700;
}
.readout dd {
	margin: 0;
	color: var(--amber-hi);
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
}
.readout dd.is-hit { color: var(--hit) }

.ticker {
	margin: 0;
	font-size: .82rem;
	color: var(--amber-dim);
	min-height: 1.5em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── Findings ─────────────────────────────────────────────────── */

.totals {
	margin: 0 0 .95rem;
	color: var(--amber-hi);
	font-size: .95rem;
	font-weight: 600;
}
.totals b { color: var(--hit); font-weight: 700 }

.notes {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: .86rem;
}
.notes li {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: .3rem 1.1ch;
	padding: .42rem 0;
	border-top: 1px solid var(--rule);
}
.notes li:first-child { border-top: 0 }
.notes .n-amt { color: var(--hit); font-weight: 600; min-width: 12ch }
.notes .n-h { color: var(--amber-dim) }
.notes .n-memo {
	flex-basis: 100%;
	color: var(--amber-dim);
	font-size: .8rem;
	word-break: break-word;
}
.notes .n-spent,
.notes .n-pool {
	padding: 0 .5ch;
	font-size: .72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
}
.notes .n-spent {
	color: var(--amber-dim);
	border: 1px solid var(--rule);
}
/* Which pool a note landed in — brighter than `spent`, because since
 * NU6.3 this marks the note as CURRENT, not as a caveat. Deliberately
 * not green: that stays reserved for "a note was found at all". */
.notes .n-pool {
	color: var(--amber-hi);
	border: 1px solid var(--amber);
}
.notes a { color: var(--amber); text-decoration: none; border-bottom: 1px dotted var(--amber-dim) }
.notes a:hover { color: var(--hit); border-bottom-color: var(--hit) }

/* ── The fold-away box ────────────────────────────────────────── */

body[data-mode="scanning"] .info { display: none }

.info {
	border: 1px solid var(--rule);
	background: var(--bg-panel);
	margin: 0;
}

.info > summary {
	list-style: none;
	cursor: pointer;
	padding: .85rem 1.2rem;
	color: var(--amber-hi);
	font-size: .92rem;
	font-weight: 700;
	letter-spacing: .08em;
}
.info > summary::-webkit-details-marker { display: none }
.info > summary:hover { color: #ffdd9c }
.info__chev {
	display: inline-block;
	width: 1.6ch;
	color: var(--amber-dim);
}
.info__chev::before { content: "+" }
.info[open] > summary .info__chev::before { content: "−" }

.info__body {
	padding: 0 1.2rem 1.3rem;
	font-size: .88rem;
	color: var(--amber-dim);
	line-height: 1.7;
}
.info__body h3 {
	margin: 1.1rem 0 .4rem;
	color: var(--amber);
	font-size: .82rem;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
}
.info__body h3:first-child { margin-top: 0 }
.info__body p { margin: 0 0 .7rem }
.info__body ul { margin: 0 0 .7rem; padding-left: 2.4ch }
.info__body li { margin: 0 0 .35rem }
.info__body li::marker { color: var(--amber-dim) }
.info__body b { color: var(--amber); font-weight: 700 }
.info__body em { font-style: normal; text-decoration: underline; text-underline-offset: 3px }
.info__body code { color: var(--amber) }
.info__body a { color: var(--amber) }
.info__body a:hover { color: var(--amber) }
.colophon {
	margin: 1.2rem 0 0;
	padding-top: .9rem;
	border-top: 1px solid var(--rule);
	font-size: .78rem;
}

a { color: var(--amber) }
a:hover { color: var(--amber) }

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

/* ── Queue ───────────────────────────────────────────────────────
   A queued job draws no progress, so the position is the only thing
   distinguishing "waiting" from "broken". It gets to look deliberate. */
.queued {
	margin: .8rem 0 0;
	padding: .75rem .9rem;
	border: 1px dashed var(--rule);
	background: rgba(255, 176, 0, .04);
	display: flex;
	flex-wrap: wrap;
	gap: .35rem 1.2rem;
	align-items: baseline;
}
.queued__pos {
	font-family: var(--display);
	font-weight: 700;
	letter-spacing: .08em;
	color: var(--amber-hi);
	animation: queue-pulse 2.4s ease-in-out infinite;
}
.queued__note { color: var(--amber-dim); font-size: .82rem }

@keyframes queue-pulse {
	0%, 100% { opacity: 1 }
	50%      { opacity: .55 }
}
@media (prefers-reduced-motion: reduce) {
	.queued__pos { animation: none }
}

/* ── The deeper sweep, offered ───────────────────────────────── */
.panel--offer {
	border-color: var(--amber);
	box-shadow: 0 0 0 1px rgba(255, 176, 0, .12) inset;
}
.offer__body { margin: 0 0 .7rem; max-width: 68ch }
.offer__body b { color: var(--amber-hi); font-weight: 700 }
.btn--ghost {
	background: transparent;
	border-color: var(--rule);
	color: var(--amber-dim);
}
.btn--ghost:hover { color: var(--amber); border-color: var(--amber-dim) }

/* ── Ironwood standing ───────────────────────────────────────── */
.iron__verdict {
	margin: 0 0 .5rem;
	font-family: var(--display);
	font-weight: 700;
	font-size: 1.02rem;
	letter-spacing: .06em;
	color: var(--amber-hi);
}
.panel--iron.is-hit .iron__verdict { color: var(--hit) }
.panel--iron.is-hit { border-color: var(--hit) }
/* The common verdict now: notes exist, none of them in Ironwood yet.
 * Advisory, so it borrows the "offered" treatment rather than the hit. */
.panel--iron.is-warn {
	border-color: var(--amber);
	box-shadow: 0 0 0 1px rgba(255, 176, 0, .12) inset;
}
.iron__detail { margin: 0 0 .8rem; max-width: 68ch; color: var(--amber-dim) }

@media (max-width: 560px) {
	body { font-size: 16px }
	.crt { padding: 1.6rem .85rem 3rem }
	.panel { padding: .9rem .85rem 1rem }
	.info > summary { padding: .8rem .85rem }
	.info__body { padding: 0 .85rem 1.1rem }
}
