/* megous.com — site stylesheet */

:root {
	--brand: #4a45a8;
	--brand-600: #3d388f;
	--brand-100: #eceafb;
	--bg: #ffffff;
	--bg-alt: #f6f6fa;
	--surface: #ffffff;
	--text: #1b1b24;
	--muted: #5d5d70;
	--line: #e3e3ec;
	--code-bg: #f1f1f7;
	--ok: #1c7c3d;
	--radius: 12px;
	--shadow: 0 1px 2px rgba(20, 20, 40, 0.06), 0 8px 24px rgba(20, 20, 40, 0.06);
	--font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	--max: 1120px;
	--gutter: clamp(1rem, 4vw, 2rem);
}

@media (prefers-color-scheme: dark) {
	:root {
		--brand: #8b86e8;
		--brand-600: #a6a2f0;
		--brand-100: #24224a;
		--bg: #0f0f16;
		--bg-alt: #16161f;
		--surface: #1b1b26;
		--text: #ececf4;
		--muted: #a2a2b8;
		--line: #2a2a3a;
		--code-bg: #1f1f2c;
		--ok: #5fcf85;
		--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
	}
}

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	font-family: var(--font);
	font-size: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
	line-height: 1.6;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
}

img,
video { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-600); }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 1.3rem + 2.2vw, 2.75rem); font-weight: 800; }
h2 { font-size: clamp(1.35rem, 1.15rem + 1vw, 1.85rem); font-weight: 700; margin-top: 2.25rem; }
h3 { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem); font-weight: 650; margin-top: 1.5rem; }
p, ul, ol, dl, pre, table { margin: 0 0 1em; }

code, kbd, pre {
	font-family: var(--mono);
	font-size: 0.92em;
}
code, kbd {
	background: var(--code-bg);
	padding: 0.12em 0.4em;
	border-radius: 6px;
}
pre {
	background: var(--code-bg);
	padding: 1rem 1.25rem;
	border-radius: var(--radius);
	overflow-x: auto;
	line-height: 1.5;
}
pre code { background: none; padding: 0; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

table { border-collapse: collapse; width: 100%; font-size: 0.95em; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 650; }

.container {
	width: min(100% - 2 * var(--gutter), var(--max));
	margin-inline: auto;
}

.skip-link {
	position: absolute;
	left: -999px;
	top: 0.5rem;
	background: var(--brand);
	color: #fff;
	padding: 0.5rem 1rem;
	border-radius: 8px;
	z-index: 100;
}
.skip-link:focus { left: 0.5rem; }

/* ---------- Header / nav ---------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: saturate(160%) blur(10px);
	-webkit-backdrop-filter: saturate(160%) blur(10px);
	border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
	.site-header { background: var(--bg); }
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: 1rem;
	min-height: 64px;
	position: relative;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	font-weight: 750;
	font-size: 1.1rem;
	color: var(--text);
	text-decoration: none;
	letter-spacing: -0.01em;
}
.brand__logo { border-radius: 50%; }

.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem; }
.site-nav a {
	display: block;
	padding: 0.5rem 0.8rem;
	border-radius: 8px;
	color: var(--text);
	text-decoration: none;
	font-weight: 550;
	font-size: 0.95rem;
}
.site-nav a:hover { background: var(--bg-alt); color: var(--brand); }
.site-nav a[aria-current="page"] { background: var(--brand-100); color: var(--brand); }

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-burger {
	display: none;
	margin-left: auto;
	width: 44px;
	height: 44px;
	border-radius: 10px;
	cursor: pointer;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
}
.nav-burger span {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--text);
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-burger:hover { background: var(--bg-alt); }

@media (max-width: 800px) {
	.nav-burger { display: flex; }
	.site-nav {
		display: none;
		position: absolute;
		left: 0;
		right: 0;
		top: 100%;
		background: var(--surface);
		border-bottom: 1px solid var(--line);
		box-shadow: var(--shadow);
		padding: 0.5rem var(--gutter) 1rem;
		margin: 0;
	}
	.site-nav ul { flex-direction: column; gap: 0; }
	.site-nav a { padding: 0.75rem 0.5rem; font-size: 1.05rem; }
	.nav-toggle:checked ~ .site-nav { display: block; }
	.nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
	.nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
	.nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
	.nav-toggle:focus-visible ~ .nav-burger { outline: 2px solid var(--brand); }
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs { font-size: 0.875rem; color: var(--muted); padding-top: 1rem; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.breadcrumbs li + li::before { content: "/"; margin: 0 0.4rem; color: var(--line); }
.breadcrumbs a { color: var(--muted); }

/* ---------- Main content blocks ---------- */

.site-main { padding-bottom: 3rem; }

.section { padding-block: clamp(2rem, 5vw, 3.5rem); }
.section--alt { background: var(--bg-alt); }
.section__head { max-width: 62ch; margin-bottom: 1.5rem; }
.section__head p { color: var(--muted); font-size: 1.05em; }

.prose { max-width: 72ch; }
.prose > :first-child { margin-top: 0; }
.prose img { border-radius: var(--radius); }

.lead { font-size: 1.15em; color: var(--muted); max-width: 60ch; }

/* Hero */

.hero {
	padding-block: clamp(2.5rem, 7vw, 5rem);
	background:
		radial-gradient(60% 80% at 100% 0%, var(--brand-100) 0%, transparent 60%),
		linear-gradient(180deg, var(--bg-alt), var(--bg));
	border-bottom: 1px solid var(--line);
}
.hero__inner { display: grid; gap: 2rem; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 900px) {
	.hero__inner { grid-template-columns: 1.1fr 1fr; gap: 3rem; }
}
.hero__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.8rem;
	font-weight: 650;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--brand);
	background: var(--brand-100);
	padding: 0.3rem 0.7rem;
	border-radius: 999px;
	margin-bottom: 1rem;
}
.hero h1 { margin-bottom: 0.75rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.hero__meta { margin-top: 1rem; font-size: 0.875rem; color: var(--muted); }
.hero__meta code { font-size: 0.85em; }
.hero__media video {
	width: 100%;
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	background: #000;
	aspect-ratio: 16 / 9;
}

/* Buttons */

.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.7rem 1.2rem;
	border-radius: 10px;
	font-weight: 650;
	text-decoration: none;
	border: 1px solid transparent;
	line-height: 1.2;
	transition: transform 0.12s ease, background 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-600); color: #fff; }
.btn--ghost { border-color: var(--line); color: var(--text); background: var(--surface); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }

/* Cards / grids */

.grid {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}
.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1.25rem;
	box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; font-size: 1.05rem; }
.card p:last-child { margin-bottom: 0; }
.card--link { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s ease, transform 0.15s ease; }
.card--link:hover { border-color: var(--brand); transform: translateY(-2px); color: inherit; }
.card__icon {
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border-radius: 10px;
	background: var(--brand-100);
	color: var(--brand);
	margin-bottom: 0.75rem;
	font-weight: 800;
}
.card__meta { font-size: 0.85rem; color: var(--muted); }

/* Download list */

.dl-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.dl-list li {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	align-items: baseline;
	padding: 0.75rem 1rem;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
}
.dl-list a { font-family: var(--mono); font-size: 0.92em; word-break: break-all; }
.dl-list small { color: var(--muted); }

/* Timeline (news / history) */

.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1.25rem 1.5rem; }
.timeline li::before {
	content: "";
	position: absolute;
	left: -7px;
	top: 0.45em;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--brand);
	border: 2px solid var(--bg);
}
.timeline time { display: block; font-size: 0.8rem; font-weight: 650; color: var(--muted); letter-spacing: 0.02em; }
.timeline p { margin: 0.15rem 0 0; }
.timeline--collapsed li:nth-child(n + 9) { display: none; }
.timeline-toggle { margin-top: 0.5rem; }
details.timeline-more > summary { cursor: pointer; color: var(--brand); font-weight: 600; list-style: none; }
details.timeline-more > summary::-webkit-details-marker { display: none; }
details.timeline-more[open] > summary { display: none; }

/* Notice */

.notice {
	border-left: 4px solid var(--ok);
	background: var(--bg-alt);
	padding: 0.85rem 1rem;
	border-radius: 0 10px 10px 0;
	margin: 1rem 0;
}

/* Sub-navigation (spkg, man) */

.subnav { margin: 1.5rem 0; }
.subnav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.subnav a {
	display: block;
	padding: 0.4rem 0.8rem;
	border: 1px solid var(--line);
	border-radius: 999px;
	font-size: 0.9rem;
	text-decoration: none;
	color: var(--text);
	background: var(--surface);
}
.subnav a:hover { border-color: var(--brand); color: var(--brand); }
.subnav a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Two-column doc layout (manual pages) */

.doc { display: grid; gap: 2rem; padding-block: 1.5rem 2rem; grid-template-columns: minmax(0, 1fr); }
.doc > * { min-width: 0; }
.doc__aside h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 0.5rem; }
.doc__aside ul { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.doc__aside a { display: block; padding: 0.35rem 0.6rem; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 0.93rem; font-family: var(--mono); }
.doc__aside a:hover { background: var(--bg-alt); color: var(--brand); }
.doc__aside a[aria-current="page"] { background: var(--brand-100); color: var(--brand); }
@media (min-width: 960px) {
	.doc { grid-template-columns: 240px minmax(0, 1fr); gap: 3rem; }
	.doc__aside { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; }
}
@media (max-width: 959px) {
	/* Sidebar goes below the article and becomes a chip cloud. */
	.doc__aside { order: 2; border-top: 1px solid var(--line); padding-top: 1.5rem; }
	.doc__aside ul { display: flex; flex-wrap: wrap; gap: 0.35rem; }
	.doc__aside a { border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.7rem; font-size: 0.85rem; background: var(--surface); }
	.doc__aside a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff; }
}
.manpage h1 code { background: none; padding: 0; font-size: 0.95em; }

/* Docbook man page normalisation */

.manpage .titlepage h2.title { font-size: 1.2rem; margin-top: 2.25rem; border-bottom: 1px solid var(--line); padding-bottom: 0.3rem; }
.manpage > .article > .titlepage h2.title { display: none; }
.manpage .toc { background: var(--bg-alt); border-radius: var(--radius); padding: 1rem 1.25rem; }
.manpage .toc p { margin: 0 0 0.5rem; }
.manpage .toc dl { margin: 0; }
.manpage .toc dt { margin: 0.2rem 0; }
.manpage .variablelist dt { font-weight: 650; margin-top: 0.75rem; }
.manpage .variablelist dd { margin: 0.25rem 0 0.5rem 1.25rem; }
.manpage .screen, .manpage pre.screen, .manpage .programlisting { background: var(--code-bg); padding: 1rem; border-radius: 10px; overflow-x: auto; }
.manpage .literal, .manpage .option, .manpage .replaceable { font-family: var(--mono); font-size: 0.92em; }
.manpage .cmdsynopsis { background: var(--code-bg); padding: 0.75rem 1rem; border-radius: 10px; font-family: var(--mono); font-size: 0.92em; }
.manpage a.ulink { word-break: break-word; }
.manpage table { font-size: 0.92em; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); background: var(--bg-alt); padding-block: 2.5rem 2rem; font-size: 0.93rem; }
.site-footer__inner { display: grid; gap: 1.5rem; }
@media (min-width: 720px) {
	.site-footer__inner { grid-template-columns: 1fr auto; align-items: start; }
	.site-footer__copy { grid-column: 1 / -1; }
}
.site-footer__brand { display: flex; gap: 0.75rem; align-items: flex-start; }
.site-footer__brand img { border-radius: 50%; }
.site-footer__brand p { margin: 0.2rem 0 0; color: var(--muted); }
.site-footer__nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site-footer__nav a { color: var(--text); text-decoration: none; }
.site-footer__nav a:hover { color: var(--brand); }
.site-footer__copy { color: var(--muted); margin: 0; }

/* ---------- Utilities ---------- */

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.muted { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

.prose .grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
