/* TriStar Internal Coms — portal design system
 * From the redesign handoff (design/README.md): NAV-OPS console aesthetic,
 * calmer and more readable for long-form text. Replaces the green terminal
 * theme; legacy classes (.singleCol, .sidebar, .col, tables) are restyled,
 * not removed, so existing chronicle/history markup keeps working.
 */

:root {
	--bg: #050a14;
	--panel: #081120;
	--panel-t: rgba(6, 12, 24, 0.92);
	--border: #2c4a6e;
	--border-faint: rgba(128, 160, 200, 0.18);
	--text: #d5e3f5;
	--muted: #7e97b8;
	--accent: #4da3ff;
	--warn: #f3d333;
	--ok: #47d18a;
	--hover-fill: rgba(128, 160, 200, 0.08);
	--accent-fill: rgba(77, 163, 255, 0.12);
}

@font-face {
	font-family: "Departure Mono";
	src: url("/fonts/DepartureMono-Regular.woff2") format("woff2");
}

* { box-sizing: border-box; }

html { width: 100%; }
html, body {
	margin: 0;
	padding: 0;
	background-color: var(--bg);
	color: var(--text);
	font-family: "Departure Mono", monospace;
	font-size: 13px;
	color-scheme: dark;
}

a { color: var(--accent); text-decoration: none; }
a:hover { background-color: var(--accent-fill); color: var(--accent); }
a.info { color: var(--warn); }
b, strong { color: var(--warn); font-weight: bold; }
hr { border: none; border-top: 1px solid var(--border-faint); margin: 24px 0; }
img { max-width: 100%; }

/* ---------- page chrome ---------- */

.site-header {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 10px 20px;
	background: var(--panel);
	border-bottom: 1px solid var(--border);
}
.site-header .brand { display: flex; align-items: center; gap: 10px; }
.site-header .brand img { width: 44px; height: 34px; object-fit: contain; }
.site-header .wordmark { font-size: 16px; font-weight: bold; letter-spacing: 0.12em; line-height: 1.2; }
.site-header .wordmark span { color: var(--accent); }
.site-header .subtitle { font-size: 9px; letter-spacing: 0.22em; color: var(--muted); }
.site-header .divider { width: 1px; align-self: stretch; background: var(--border); }
.site-header .tagline { flex: 1 1 auto; font-size: 10px; color: var(--muted); letter-spacing: 0.06em; }
.site-header .status {
	text-align: right;
	font-size: 10px;
	line-height: 1.6;
	letter-spacing: 0.08em;
	white-space: nowrap;
}
.site-header .status .label { color: var(--muted); }
.site-header .status .secure { color: var(--ok); }
.site-header .status .dot {
	display: inline-block;
	width: 6px; height: 6px;
	border-radius: 50%;
	background: var(--ok);
	animation: blink 2s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }

.site-nav {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 6px 20px;
	background: var(--panel);
	border-bottom: 1px solid var(--border);
	overflow-x: auto;
	scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
	flex: 0 0 auto;
	border: 1px solid var(--border);
	color: var(--text);
	padding: 5px 12px;
	font-size: 11px;
	font-weight: bold;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	white-space: nowrap;
}
.site-nav a:hover { background: var(--border); color: var(--text); }
.site-nav a.active {
	border-color: var(--accent);
	color: var(--accent);
	background: rgba(77, 163, 255, 0.15);
}
.site-nav .scan-toggle {
	margin-left: auto;
	border: 1px solid var(--border);
	background: transparent;
	color: var(--muted);
	padding: 5px 10px;
	font-family: inherit;
	font-size: 10px;
	letter-spacing: 0.08em;
	cursor: pointer;
	white-space: nowrap;
}
.site-nav .scan-toggle:hover { background: var(--border); color: var(--text); }

.badge-new {
	background: var(--warn);
	color: var(--bg);
	font-size: 8px;
	padding: 1px 5px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin-left: 6px;
	vertical-align: middle;
}

#scanlines {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 50;
	background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.14) 2px 3px);
	mix-blend-mode: multiply;
}
#scanlines.off { display: none; }

.ticker {
	overflow: hidden;
	white-space: nowrap;
	border-top: 1px solid var(--border);
	background: var(--panel);
	padding: 5px 0;
	margin-top: 56px;
}
.ticker > div { display: inline-flex; animation: ticker 75s linear infinite; }
.ticker span { font-size: 10px; letter-spacing: 0.14em; color: var(--muted); padding-right: 60px; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- content column ---------- */

.page {
	max-width: 760px;
	margin: 0 auto;
	padding: 28px 20px 56px 20px;
}
.page-wide { max-width: 880px; }
.page-xl { max-width: 1100px; }

.kicker {
	font-size: 10px;
	letter-spacing: 0.16em;
	color: var(--muted);
	text-transform: uppercase;
	margin: 0 0 8px 0;
}
h1 {
	font-size: 26px;
	line-height: 1.3;
	letter-spacing: 0.02em;
	margin: 0 0 18px 0;
}
h2 {
	font-size: 17px;
	letter-spacing: 0.04em;
	color: var(--accent);
	margin: 30px 0 10px 0;
}
h3 {
	font-size: 14px;
	letter-spacing: 0.04em;
	margin: 22px 0 8px 0;
}
p, li { font-size: 14px; line-height: 1.75; }
ul, ol { padding-left: 22px; }
.muted { color: var(--muted); }
.fine {
	font-size: 10px;
	letter-spacing: 0.1em;
	color: var(--muted);
	text-transform: uppercase;
}

/* ---------- tables (new + legacy) ---------- */

table {
	border-collapse: collapse;
	border-spacing: 0;
	width: 100%;
	margin: 12px 0;
	font-size: 12px;
	border: 1px solid var(--border);
	break-inside: avoid-column;
}
th {
	background: transparent;
	color: var(--muted);
	font-size: 10px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-align: left;
	padding: 8px 10px;
	border-bottom: 1px solid var(--border);
	font-weight: bold;
}
td {
	padding: 7px 10px;
	border: none;
	border-bottom: 1px solid var(--border-faint);
	line-height: 1.55;
	vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--hover-fill); }

/* ---------- legacy classes (chronicle / history markup) ---------- */

.singleCol { max-width: 880px; margin: 0 auto; }
.col { column-count: 1; }

blockquote {
	color: var(--muted);
	border-left: 2px solid var(--border);
	margin: 16px 0;
	padding: 4px 0 4px 16px;
	font-size: 13px;
	line-height: 1.7;
}
blockquote div, blockquote div p { color: var(--text); }

.sidebar {
	display: block;
	border: 1px solid var(--border);
	background: var(--panel-t);
	padding: 14px 16px;
	margin: 16px 0;
	font-size: 12px;
	line-height: 1.65;
	color: var(--muted);
}
.sidebar b { color: var(--warn); }
.sidebar p { font-size: 12px; line-height: 1.65; margin: 0 0 10px 0; }
.sidebar p:last-child { margin-bottom: 0; }

pre {
	font-family: inherit;
	font-size: 11px;
	line-height: 1.5;
	color: var(--muted);
	overflow-x: auto;
}

/* ---------- components ---------- */

/* home manifest rows / hub listings */
.manifest-label {
	font-size: 10px;
	letter-spacing: 0.16em;
	color: var(--muted);
	text-transform: uppercase;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--border);
	margin: 26px 0 0 0;
}
a.manifest-row {
	display: grid;
	grid-template-columns: 74px 1fr auto;
	gap: 4px 14px;
	align-items: baseline;
	padding: 12px 8px;
	border-bottom: 1px solid var(--border-faint);
	color: var(--text);
}
a.manifest-row:hover { background: var(--hover-fill); }
.manifest-row .code { font-size: 10px; color: var(--muted); letter-spacing: 0.1em; }
.manifest-row .title { font-size: 14px; font-weight: bold; color: var(--accent); }
.manifest-row .blurb { font-size: 12px; color: var(--muted); grid-column: 2; line-height: 1.6; }
.manifest-row .arrow { color: var(--muted); grid-row: 1; grid-column: 3; }

/* card grids (home B, class packs, planet guide) */
.card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 12px;
	margin: 18px 0;
}
a.card {
	display: block;
	border: 1px solid var(--border);
	background: var(--panel-t);
	padding: 14px 16px;
	color: var(--text);
	position: relative;
}
a.card:hover { border-color: var(--accent); background: var(--panel-t); }
.card .code { display: block; font-size: 9px; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; padding-right: 44px; }
.card .name { display: block; font-size: 14px; font-weight: bold; color: var(--accent); margin: 4px 0; }
.card .desc { display: block; font-size: 11px; color: var(--muted); line-height: 1.6; }
.card .corner { position: absolute; top: 10px; right: 12px; }

/* timeline rows (story) */
.timeline-row {
	display: grid;
	grid-template-columns: 80px 1fr;
	gap: 14px;
	padding: 12px 0;
	border-bottom: 1px solid var(--border-faint);
}
.timeline-row .year { font-size: 15px; font-weight: bold; color: var(--accent); }
.timeline-row .tl-title { font-size: 14px; font-weight: bold; margin-bottom: 4px; }
.timeline-row .tl-body { font-size: 13px; line-height: 1.75; }

/* promoted banner (console links) */
a.promo-banner {
	display: flex;
	align-items: center;
	gap: 14px;
	border: 1px solid var(--accent);
	padding: 12px 16px;
	margin: 18px 0;
	color: var(--text);
}
a.promo-banner:hover { background: var(--accent-fill); }
.promo-banner img { width: 30px; height: 30px; object-fit: contain; }
.promo-banner .p-title { font-size: 14px; font-weight: bold; color: var(--accent); }
.promo-banner .p-sub { font-size: 11px; color: var(--muted); }
.promo-banner .arrow { margin-left: auto; color: var(--accent); }

/* stat panel (planet/unit stat blocks) */
.stat-block {
	border: 1px solid var(--border);
	background: var(--panel-t);
	padding: 4px 14px 10px 14px;
	margin: 16px 0;
}
.stat-block table { border: none; margin: 0; }
.stat-block td:first-child { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }

/* doc nav footer (prev/index/next) */
.doc-nav {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 40px;
	padding-top: 14px;
	border-top: 1px solid var(--border);
	font-size: 12px;
}

/* status colors for roster tables */
.st-active { color: var(--ok); }
.st-deployed { color: var(--warn); }
.st-forming { color: var(--muted); }

/* ---------- responsive ---------- */

@media only screen and (min-width: 844px) {
	.sidebar { float: right; width: 33%; margin: 4px 0 16px 20px; clear: right; }
	.col { column-count: 2; }
}
@media only screen and (max-width: 720px) {
	.site-header .tagline, .site-header .divider, .site-header .status .operator { display: none; }
	a.manifest-row { grid-template-columns: 1fr auto; }
	.manifest-row .code { display: none; }
	.manifest-row .blurb { grid-column: 1; }
	.timeline-row { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- print (preserved behavior: black on white) ---------- */

@media only print {
	html, body { background: #fff; color: #000; font-family: sans-serif; }
	.site-header, .site-nav, .ticker, #scanlines, .doc-nav, .promo-banner { display: none !important; }
	a { color: #008; }
	b, strong, .card .name, h2 { color: #000; }
	table { border: 1px solid #000; color: #000; }
	th { color: #fff; background: #000; }
	td { border: 1px solid #000; }
	.sidebar { border: 1px solid #000; color: #000; background: #fff; }
	blockquote { color: #222; border-left-color: #000; }
	.col { column-count: 3; }
}
/*----section-characters------*/

.section-characters h3 {color: var(--warn);}
/*----section-bestiary------*/

.section-bestiary h3 {color: var(--warn);}
/* ---------- MegaMek technical readout ---------- */
.readout-doc h2 { color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.readout-doc h3 { color: var(--accent); }
.readout-doc table { max-width: 620px; }
.readout-doc table[width] { width: auto; }
.readout-doc .row { margin-bottom: 12px; }
.dl-file {
	font-size: 10px; letter-spacing: 0.04em; color: var(--ok);
	white-space: nowrap; text-transform: none; font-weight: normal;
}
.dl-file:hover { background: rgba(71,209,138,0.14); color: var(--ok); }

/* cross-reference links between unit readouts (model codes in flavor text) */
.unit-xref { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); }
.unit-xref:hover { border-bottom-style: solid; }

/* compact per-variant armor row in technical readouts */
.readout-doc .armor-row {
	display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 12px;
	margin: 6px 0 16px; font-size: 11px;
}
.readout-doc .armor-total {
	color: var(--warn); font-weight: bold; letter-spacing: 0.08em;
	border: 1px solid var(--border); padding: 1px 7px;
}
.readout-doc .armor-chip { color: var(--text); white-space: nowrap; }
.readout-doc .armor-chip .al { color: var(--muted); }
.readout-doc .armor-chip .ar { color: var(--muted); }

/* ---------- Fiction: long-form reading ---------- */
/* scanlines off in the fiction reading area */
body.section-fiction #scanlines { display: none !important; }
body.section-fiction .scan-toggle { display: none; }
.fiction-wrap { max-width: 48rem; margin: 0 auto; padding: 0 0.5rem; }
.fiction-title { text-align: center; font-size: 34px; letter-spacing: 0.04em; margin: 1.75rem 0 0.35rem; color: var(--text); }
.fiction-byline { text-align: center; color: var(--muted); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; margin: 0 0 2.25rem; }
.fiction-toc { border: 1px solid var(--border-faint); border-radius: 4px; padding: 0.9rem 1.2rem; margin: 0 auto 3.5rem; max-width: 22rem; font-size: 12px; }
.fiction-toc .lbl { color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; font-size: 10px; }
.fiction-toc ol { margin: 0.55rem 0 0; padding-left: 1.5rem; }
.fiction-toc li { margin: 0.2rem 0; letter-spacing: 0.02em; }
.fiction-toc a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--border); }
.fiction-toc a:hover { color: var(--accent); }
.fiction-actions { text-align: center; margin: 0 0 2.5rem; }
.reading-toggle, .pdf-download { font-family: "Departure Mono", monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: 3px; padding: 4px 14px; cursor: pointer; text-decoration: none; margin: 0 0.35rem; display: inline-block; }
.reading-toggle:hover { color: var(--accent); border-color: var(--accent); }
.pdf-download:hover { color: var(--ok); border-color: var(--ok); }

/* fiction: light / "paper" reading surface (toggled) */
html.reading-light .fiction-wrap { background: #f5efe1; color: #2b2721; border: 1px solid rgba(0,0,0,0.12); border-radius: 5px; padding: 1.75rem 2.25rem 2.75rem; box-shadow: 0 2px 44px rgba(0,0,0,0.45); }
html.reading-light .kicker, html.reading-light .fiction-byline, html.reading-light .fiction-toc .lbl { color: #8c7a63; }
html.reading-light .fiction-title { color: #2b2721; }
html.reading-light .fiction-toc { border-color: rgba(0,0,0,0.18); }
html.reading-light .fiction-toc a { color: #2b2721; border-bottom-color: rgba(0,0,0,0.22); }
html.reading-light .fiction-toc a:hover, html.reading-light a { color: #8a5a2b; }
html.reading-light .reading-toggle, html.reading-light .pdf-download { color: #6f6252; border-color: rgba(0,0,0,0.22); }
html.reading-light .reading-toggle:hover, html.reading-light .pdf-download:hover { color: #8a5a2b; border-color: #8a5a2b; }
html.reading-light .story { color: #2b2721; }
html.reading-light .story .chapter { color: #8a5a2b; }
html.reading-light .story .chapter::before, html.reading-light .story .chapter::after { background: rgba(138,90,43,0.4); }
html.reading-light .story .epigraph, html.reading-light .story .ledger { background: #ece1cb; border-left-color: #8a5a2b; color: #6f6252; }
html.reading-light .story b, html.reading-light .story strong { color: #2b2721; }
html.reading-light .story .opening::first-letter { color: #8a5a2b; }
html.reading-light .story .scene, html.reading-light .story .the-end { color: #a08b6f; }

.story { font-family: Georgia, "Iowan Old Style", Charter, "Times New Roman", serif; font-size: 18px; line-height: 1.78; color: var(--text); max-width: 42rem; margin: 0 auto; }
.story .chapter { font-family: "Departure Mono", monospace; color: var(--accent); text-align: center; font-size: 13px; font-weight: normal; letter-spacing: 0.14em; text-transform: uppercase; margin: 4rem 0 1.75rem; }
.story .chapter::before, .story .chapter::after { content: ""; display: inline-block; width: 1.6rem; height: 1px; background: var(--border); vertical-align: middle; margin: 0 0.7rem; }
.story .epigraph, .story .ledger { font-family: "Departure Mono", monospace; font-size: 12px; line-height: 1.6; color: var(--muted); background: var(--accent-fill); border-left: 2px solid var(--accent); padding: 0.8rem 1rem; letter-spacing: 0.02em; }
.story .epigraph { margin: 0 0 2.25rem; }
.story .ledger { margin: 1.9rem 0; }
.story p { margin: 0 0 1.2rem; }
.story i, .story em { font-style: italic; }
.story b, .story strong { color: var(--text); font-weight: bold; }
.story .opening::first-letter { font-family: "Departure Mono", monospace; font-size: 3rem; line-height: 0.7; float: left; padding: 0.32rem 0.55rem 0 0; color: var(--accent); }
.story .scene { text-align: center; color: var(--muted); font-family: "Departure Mono", monospace; letter-spacing: 0.5em; margin: 2rem 0; }
.story .the-end { text-align: center; color: var(--muted); font-family: "Departure Mono", monospace; font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; margin: 3.5rem 0 1rem; }
@media (max-width: 640px) { .story { font-size: 17px; } .fiction-title { font-size: 27px; } }
