/* =========================
   Theme Variables
   Colors follow cellml.org: CellML red, charcoal and the
   soft blue-gray page background.
========================= */
:root {
	color-scheme: light;

	/* Backgrounds */
	--bg-page: #e6e8f0;
	--bg-panel: #ffffff;
	--bg-panel-hover: #f7f8fb;
	--bg-header: #333333;
	--bg-code-inline: #f1f2f6;
	--bg-code-block: #2b2d33;

	/* Text */
	--text-main: #222222;
	--text-muted: #4a4d57;
	--text-on-dark: #ffffff;
	--text-on-dark-muted: #d6d8df;
	--text-code-block: #eceef3;

	/* Accents */
	--accent-red: #cc0000;
	--accent-red-dark: #990000;
	--accent-red-soft: #fbeaea;

	/* UI */
	--border-soft: #d3d6e0;
	--border-strong: #666666;
	--shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.08);
	--radius: 10px;
}

/* =========================
   Reset + Base
========================= */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family:
		system-ui,
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		Roboto,
		sans-serif;
	background: var(--bg-page);
	color: var(--text-main);
	line-height: 1.65;
}

/* =========================
   Typography
========================= */
h1,
h2,
h3 {
	font-weight: 600;
	line-height: 1.25;
	color: var(--text-main);
}

h1 {
	font-size: clamp(1.8rem, 4vw, 2.3rem);
	margin-bottom: 0.75rem;
}

h2 {
	font-size: 1.35rem;
	margin-bottom: 0.6rem;
}

h3 {
	font-size: 1.1rem;
	margin: 1.25rem 0 0.5rem;
}

p,
li {
	color: var(--text-muted);
	max-width: 70ch;
}

p {
	margin-bottom: 1rem;
}

ul,
ol {
	margin: 0 0 1rem 1.4rem;
}

li {
	margin-bottom: 0.35rem;
}

a {
	color: var(--accent-red);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

a:hover {
	color: var(--accent-red-dark);
}

a:focus-visible,
button:focus-visible {
	outline: 3px solid var(--accent-red);
	outline-offset: 2px;
}

strong {
	color: var(--text-main);
}

/* =========================
   Code
========================= */
p code,
li code,
td code,
h3 code,
.card code {
	background: var(--bg-code-inline);
	color: var(--accent-red-dark);
	padding: 0.1rem 0.35rem;
	border-radius: 5px;
	font-size: 0.88em;
	font-family: "Fira Code", Consolas, monospace;
	overflow-wrap: anywhere;
}

pre {
	background: var(--bg-code-block);
	color: var(--text-code-block);
	border-left: 4px solid var(--accent-red);
	border-radius: var(--radius);
	padding: 1rem;
	margin: 1.25rem 0 1.5rem;
	overflow-x: auto;
	max-width: 100%;
}

pre code {
	font-family: "Fira Code", Consolas, monospace;
	font-size: 0.88rem;
	line-height: 1.55;
	white-space: pre;
}

/* =========================
   Layout Containers
========================= */
.container {
	max-width: 960px;
	margin: 0 auto;
	padding: 2rem 1.25rem 3rem;
}

.article {
	max-width: 840px;
}

section {
	margin-bottom: 2rem;
}

/* Section headings carry the red top rule cellml.org uses on its panels */
.article section > h2 {
	border-top: 2px solid var(--accent-red);
	padding-top: 0.6rem;
}

/* =========================
   Navbar
========================= */
.navbar {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem;
	background: var(--bg-header);
	border-bottom: 4px solid var(--accent-red);
}

.brand {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.logo {
	width: 56px;
	height: 56px;
	object-fit: contain;
	/* The logo has a white margin; round it so it sits as a tile on the dark bar */
	border-radius: 18%;
	background: #ffffff;
}

.site-title {
	font-size: 1.4rem;
	font-weight: 600;
	color: var(--text-on-dark);
}

.navbar .subtitle {
	color: var(--text-on-dark-muted);
	font-size: 0.9rem;
	margin: 0.15rem 0 0;
}

.nav-links {
	display: flex;
	gap: 1.25rem;
}

.nav-links a {
	color: var(--text-on-dark);
	font-weight: 500;
	text-decoration: none;
	padding-bottom: 2px;
	border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
	color: var(--text-on-dark);
	border-bottom-color: var(--accent-red);
}

/* =========================
   Intro text under a page title
========================= */
.lead {
	font-size: 1.05rem;
}

/* =========================
   Cards
========================= */
.cards {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
	margin-top: 1.5rem;
}

.card {
	display: block;
	padding: 1.4rem;
	background: var(--bg-panel);
	border-left: 4px solid var(--accent-red);
	border-radius: var(--radius);
	box-shadow: var(--shadow-soft);
	color: var(--text-main);
	text-decoration: none;
	transition:
		background 0.2s ease,
		transform 0.2s ease;
}

a.card:hover {
	background: var(--bg-panel-hover);
	color: var(--text-main);
	transform: translateY(-2px);
}

.card h2 {
	font-size: 1.15rem;
	color: var(--accent-red-dark);
}

.card p {
	font-size: 0.95rem;
}

.card p:last-child {
	margin-bottom: 0;
}

.card .meta {
	display: block;
	margin-top: 0.75rem;
	font-size: 0.82rem;
	color: var(--text-muted);
}

/* =========================
   Article meta line and status
========================= */
.meta {
	font-size: 0.92rem;
	color: var(--text-muted);
}

.status {
	display: inline-block;
	padding: 0.05rem 0.55rem;
	border-radius: 999px;
	background: var(--accent-red-soft);
	color: var(--accent-red-dark);
	font-size: 0.8rem;
	font-weight: 600;
}

/* =========================
   Panels / Callouts
========================= */
.panel {
	background: var(--bg-panel);
	border-left: 4px solid var(--accent-red);
	border-radius: var(--radius);
	padding: 1.2rem 1.4rem;
	margin: 1.5rem 0;
}

.panel p:last-child {
	margin-bottom: 0;
}

/* =========================
   Tables
========================= */
.table-wrap {
	overflow-x: auto;
	margin: 1rem 0 1.5rem;
	background: var(--bg-panel);
	border-radius: var(--radius);
	box-shadow: var(--shadow-soft);
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
}

th,
td {
	text-align: left;
	padding: 0.6rem 0.8rem;
	border-bottom: 1px solid var(--border-soft);
	vertical-align: top;
}

th {
	background: var(--bg-header);
	color: var(--text-on-dark);
	font-weight: 600;
}

tr:last-child td {
	border-bottom: none;
}

td {
	color: var(--text-muted);
}

/* =========================
   Pagination
========================= */
.pagination {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 2rem 0;
}

.pagination:empty {
	display: none;
}

.page-button {
	background: var(--bg-panel);
	border: 1px solid var(--border-soft);
	color: var(--text-main);
	padding: 0.5rem 0.9rem;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.95rem;
	min-width: 2.5rem;
}

.page-button.active {
	background: var(--accent-red);
	border-color: var(--accent-red);
	color: var(--text-on-dark);
}

.page-button:hover {
	border-color: var(--accent-red);
}

/* =========================
   Footer
========================= */
footer {
	text-align: center;
	padding: 2rem 1rem;
	font-size: 0.85rem;
	color: var(--text-muted);
	border-top: 1px solid var(--border-soft);
}

footer p {
	max-width: none;
	margin: 0.25rem 0;
}

/* =========================
   Desktop
========================= */
@media (min-width: 768px) {
	.logo {
		width: 72px;
		height: 72px;
	}

	.site-title {
		font-size: 1.75rem;
	}

	.cards {
		grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	}
}

/* =========================
   Phones
========================= */
@media (max-width: 767px) {
	body {
		font-size: 15px;
	}

	.container {
		padding: 1.25rem 1rem 2.5rem;
	}

	.navbar {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.6rem;
		padding: 0.8rem 1rem;
	}

	.logo {
		width: 40px;
		height: 40px;
	}

	.site-title {
		font-size: 1.1rem;
	}

	.navbar .subtitle {
		font-size: 0.8rem;
	}

	h1 {
		font-size: 1.6rem;
	}

	h2 {
		font-size: 1.2rem;
	}

	pre {
		padding: 0.8rem;
	}

	pre code {
		font-size: 0.8rem;
	}

	a {
		overflow-wrap: anywhere;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.card {
		transition: none;
	}

	a.card:hover {
		transform: none;
	}
}
