/* Interactive emulator spectra explorer
   Visual tone follows the main site: light, academic, single blue accent. */

:root {
	--text: #4a4a4a;
	--heading: #333;
	--muted: #888;
	--accent: #6a9fb5;
	--accent-dark: #4d7c91;
	--rule: #e4e4e4;
	--card: #f7f7f7;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	background: #fff;
	color: var(--text);
	font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
}

main {
	max-width: 1180px;
	margin: 0 auto;
	padding: 2.5em 1.5em 4em;
}

h1 {
	font-size: 1.9em;
	font-weight: 600;
	letter-spacing: -0.01em;
	color: var(--heading);
	margin: 0.2em 0 1em;
	line-height: 1.25;
}

h2 {
	font-size: 1.15em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--heading);
	margin: 0 0 0.8em;
	padding-bottom: 0.5em;
	border-bottom: 1px solid var(--rule);
}

h3 { font-size: 1em; font-weight: 600; color: var(--heading); margin: 0; }

p { margin: 0 0 1em; }

a { color: var(--accent-dark); text-decoration: none; border-bottom: 1px dotted var(--accent); }
a:hover { color: var(--accent); }

section { margin-bottom: 3em; }

#intro { max-width: 780px; }
#intro p { text-align: justify; }

.breadcrumb {
	font-size: 0.85em;
	margin-bottom: 0.5em;
}
.breadcrumb a { border: none; color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

.note {
	font-size: 0.9em;
	color: var(--muted);
	border-left: 3px solid var(--accent);
	padding-left: 1em;
}

/* ---------- status / errors ---------- */

#status-badge {
	font-size: 0.6em;
	font-weight: 400;
	letter-spacing: 0.05em;
	text-transform: none;
	color: var(--accent-dark);
	background: #eaf2f6;
	border-radius: 10px;
	padding: 0.15em 0.7em;
	margin-left: 0.6em;
	vertical-align: middle;
}

#error-banner {
	background: #fdf1f1;
	border-left: 3px solid #c0605e;
	color: #8f3634;
	padding: 0.9em 1.2em;
	font-size: 0.92em;
	margin-bottom: 1.5em;
}

/* ---------- loading overlay ---------- */

#loading-overlay {
	position: fixed;
	inset: 0;
	background: rgba(255, 255, 255, 0.97);
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
}
#loading-overlay.hidden { display: none; }

.loading-box { text-align: center; max-width: 24em; padding: 1em; }
.loading-box p { margin: 0.6em 0 0; }
#loading-message { font-size: 1em; color: var(--heading); }
.loading-note { font-size: 0.82em; color: var(--muted); }

.spinner {
	width: 34px;
	height: 34px;
	margin: 0 auto;
	border: 3px solid var(--rule);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-track {
	height: 4px;
	background: var(--rule);
	border-radius: 2px;
	margin: 1em 0 0;
	overflow: hidden;
}
#progress-bar {
	height: 100%;
	width: 0;
	background: var(--accent);
	transition: width 0.15s linear;
}

/* ---------- buttons and inputs ---------- */

button {
	font-family: inherit;
	font-size: 0.85em;
	letter-spacing: 0.04em;
	color: #fff;
	background: var(--accent);
	border: none;
	border-radius: 3px;
	padding: 0.5em 1.1em;
	cursor: pointer;
}
button:hover { background: var(--accent-dark); }
button:disabled { background: #cfcfcf; cursor: default; }

button.secondary {
	color: var(--accent-dark);
	background: none;
	border: 1px solid var(--rule);
}
button.secondary:hover { background: var(--card); color: var(--accent-dark); }

button.remove {
	color: var(--muted);
	background: none;
	border: 1px solid var(--rule);
	padding: 0.35em 0.8em;
}
button.remove:hover { color: #8f3634; background: #fdf1f1; }

input[type="number"], select {
	font-family: inherit;
	font-size: 0.85em;
	color: var(--text);
	background: #fff;
	border: 1px solid var(--rule);
	border-radius: 3px;
	padding: 0.3em 0.4em;
}
input[type="number"]:focus, select:focus {
	outline: none;
	border-color: var(--accent);
}

.hint { font-size: 0.82em; color: var(--muted); margin-left: 0.8em; }

/* ---------- baseline histogram grid ---------- */

.baseline-toolbar { margin-bottom: 1.2em; }

#histogram-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
	gap: 0.9em;
}

.hist-card {
	background: var(--card);
	border: 1px solid var(--rule);
	border-radius: 4px;
	padding: 0.6em 0.7em 0.7em;
}

.hist-label {
	font-size: 0.78em;
	font-weight: 600;
	color: var(--heading);
	line-height: 1.3;
	min-height: 2.6em;
}

.hist-plot { width: 100%; height: 108px; }

.hist-value { display: flex; align-items: center; gap: 0.4em; margin-top: 0.3em; }
.hist-value input { width: 100%; }

/* ---------- comparison panels ---------- */

.comparison-toolbar { margin-bottom: 1.2em; }

.panel {
	background: #fff;
	border: 1px solid var(--rule);
	border-radius: 4px;
	padding: 1em 1.1em 1.2em;
	margin-bottom: 1.5em;
}

.panel-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.9em;
	margin-bottom: 0.6em;
}
.panel-controls label {
	font-size: 0.82em;
	color: var(--muted);
	display: flex;
	align-items: center;
	gap: 0.4em;
}
.panel-controls select { max-width: 17em; }
.panel-controls .steps { width: 4.5em; }
.panel-controls .spacer { flex: 1 1 auto; }

.panel-plot { width: 100%; height: 430px; }

/* ---------- footer ---------- */

footer {
	border-top: 1px solid var(--rule);
	padding-top: 1.2em;
	font-size: 0.82em;
	color: var(--muted);
}
footer p { margin: 0; }

@media screen and (max-width: 736px) {
	main { padding: 1.5em 1em 3em; }
	h1 { font-size: 1.5em; }
	#intro p { text-align: left; }
	.panel-plot { height: 340px; }
	#histogram-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
