/*
 * Layout + typography for the /docs subsite.
 *
 * Loaded ON TOP of the marketing site's `styles.css`, so it inherits every
 * design token (colours, fonts, container widths) and only adds the pieces
 * that don't exist there: the sidebar/content grid, the doc-nav rows, the
 * prose treatment for markdown-rendered content, and code-block styling.
 *
 * Rule: no hard-coded colours here that don't reuse one of styles.css's
 * variables (--bg, --text, --amber, --border, …). The marketing palette is
 * where those are defined; docs must not fork it.
 */

/* ── Layout ─────────────────────────────────────────────────────────────── */

body.docs-body {
	font-family: var(--font-body);
}

/* Two columns: sticky sidebar, flexible content. Collapses at 860px. */
.docs-shell {
	display: grid;
	grid-template-columns: 240px 1fr;
	gap: 40px;
	align-items: start;
	padding-top: 32px;
	padding-bottom: 96px;
}

.docs-sidebar {
	position: sticky;
	top: 32px;
	max-height: calc(100vh - 64px);
	overflow-y: auto;
	padding-right: 12px;
	font-family: var(--font-body);

	/* Quiet the browser's default scrollbar so it stops competing with the
	   sidebar rows visually. Firefox + modern WebKit/Chromium honour the
	   two `scrollbar-*` properties; older WebKit uses the pseudo-element
	   fallback below. `scrollbar-gutter: stable` reserves the column so
	   the sidebar doesn't shift left/right as it goes between scrollable
	   and non-scrollable states on window resize. */
	scrollbar-width: thin;
	scrollbar-color: rgba(243, 236, 224, 0.14) transparent;
	scrollbar-gutter: stable;
}

.docs-sidebar::-webkit-scrollbar {
	width: 8px;
}
.docs-sidebar::-webkit-scrollbar-track {
	background: transparent;
}
.docs-sidebar::-webkit-scrollbar-thumb {
	background: rgba(243, 236, 224, 0.14);
	border-radius: 999px;
}
.docs-sidebar:hover::-webkit-scrollbar-thumb {
	background: rgba(243, 236, 224, 0.22);
}

.docs-nav-section + .docs-nav-section {
	margin-top: 20px;
}

.docs-nav-title {
	font-family: var(--font-display);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: var(--text-dim);
	padding: 6px 10px;
}

.docs-nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.docs-nav-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 10px;
	border-radius: 8px;
	text-decoration: none;
	color: var(--text-muted);
	font-size: 14px;
	line-height: 1.35;
}
.docs-nav-link:hover {
	background: var(--surface);
	color: var(--text);
}
.docs-nav-link.is-active {
	background: var(--surface-2);
	color: var(--text-strong);
}
.docs-nav-link.is-active .docs-nav-label {
	border-left: 2px solid var(--amber);
	padding-left: 8px;
	margin-left: -10px;
}
.docs-nav-link.is-tbd {
	color: var(--text-dim);
}
.docs-nav-link.is-tbd:hover {
	color: var(--text-muted);
}

.docs-pill {
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	padding: 2px 7px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.03);
	color: var(--text-dim);
	border: 1px solid var(--border);
}

.docs-content {
	min-width: 0;
	max-width: 780px;
}

/* ── Landing-page cards ─────────────────────────────────────────────────── */

.docs-lede {
	font-size: 18px;
	color: var(--text-muted);
	max-width: 62ch;
	margin: 0 0 40px;
	line-height: 1.55;
}

.docs-card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 14px;
	margin: 12px 0 32px;
}

.docs-card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 18px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	text-decoration: none;
	color: var(--text);
	transition:
		border-color 120ms,
		background 120ms,
		transform 120ms;
}
.docs-card:hover:not(.is-stub) {
	border-color: var(--amber);
	background: var(--surface-2);
	transform: translateY(-1px);
}

.docs-card.is-stub {
	cursor: default;
	opacity: 0.75;
}

.docs-card-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 16px;
	color: var(--text-strong);
}

.docs-card-blurb {
	margin: 0;
	font-size: 14px;
	color: var(--text-muted);
	line-height: 1.55;
	flex: 1;
}

.docs-card-cta {
	font-size: 13px;
	font-weight: 600;
	color: var(--amber);
}

/* ── Spec-page header ───────────────────────────────────────────────────── */

.spec-header {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 28px;
}

.spec-pills {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.spec-pill {
	font-size: 12px;
	font-weight: 500;
	padding: 3px 10px;
	border-radius: 999px;
	border: 1px solid var(--border);
}
.spec-pill.is-version {
	background: var(--amber-soft);
	color: var(--amber);
	border-color: rgba(240, 162, 58, 0.35);
}
.spec-pill.is-open {
	background: var(--surface);
	color: var(--text-muted);
}

.spec-hint {
	margin: 0;
	font-size: 14px;
	color: var(--text-muted);
	max-width: 62ch;
}

/* ── Markdown-rendered prose ────────────────────────────────────────────── */

.docs-content h1 {
	font-family: var(--font-display);
	font-size: 34px;
	font-weight: 800;
	letter-spacing: -0.01em;
	margin: 0 0 12px;
	color: var(--text-strong);
}

.docs-content h2 {
	font-family: var(--font-display);
	font-size: 22px;
	font-weight: 700;
	margin: 44px 0 12px;
	padding-top: 20px;
	border-top: 1px solid var(--border);
	color: var(--text-strong);
}
.docs-content h2:first-of-type {
	border-top: none;
	padding-top: 0;
	margin-top: 32px;
}

.docs-content h3 {
	font-family: var(--font-display);
	font-size: 17px;
	font-weight: 700;
	margin: 28px 0 10px;
	color: var(--text-strong);
}

.docs-content h4 {
	font-size: 15px;
	font-weight: 600;
	margin: 20px 0 8px;
	color: var(--text-strong);
}

.docs-content p {
	margin: 0 0 14px;
	color: var(--text);
	line-height: 1.65;
}

/* Prose-only: markdown links inside paragraphs, list items, tables, and
   blockquotes get the underlined-amber treatment. Component anchors — the
   card grid on the landing page, sidebar rows — are deliberately excluded so
   they can style themselves (they wrap their own content and would inherit
   the underline into every child otherwise). */
.docs-content :is(p, li, td, blockquote) a {
	color: var(--amber);
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-thickness: 1px;
}
.docs-content :is(p, li, td, blockquote) a:hover {
	color: var(--amber-hover);
}

.docs-content ul,
.docs-content ol {
	margin: 0 0 16px;
	padding-left: 22px;
	color: var(--text);
	line-height: 1.65;
}
.docs-content li {
	margin: 4px 0;
}

.docs-content hr {
	border: none;
	border-top: 1px solid var(--border);
	margin: 32px 0;
}

.docs-content blockquote {
	margin: 16px 0;
	padding: 12px 16px;
	border-left: 3px solid var(--amber);
	background: var(--amber-soft);
	border-radius: 0 8px 8px 0;
	color: var(--text);
}
.docs-content blockquote p:last-child {
	margin-bottom: 0;
}

.docs-content code {
	font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.88em;
	padding: 1px 5px;
	border-radius: 4px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--text-strong);
}

.docs-content kbd {
	font-family: var(--font-mono);
	font-size: 0.85em;
	padding: 1px 6px;
	border-radius: 5px;
	border: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.04);
	color: var(--text-strong);
}

/* Screenshots. The figure shrinks to the image (a 1x-sized capture stays
   small instead of stretching) and never overflows the column. */
.docs-figure {
	margin: 20px 0 28px;
	width: fit-content;
	max-width: 100%;
}
.docs-figure img {
	display: block;
	max-width: 100%;
	height: auto;
	border: 1px solid var(--border);
	border-radius: 12px;
}
.docs-figure figcaption {
	margin-top: 8px;
	font-size: 14px;
	color: var(--text-dim);
}

.docs-content pre {
	margin: 0 0 18px;
	padding: 14px 16px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	overflow-x: auto;
	font-size: 13px;
	line-height: 1.55;
}
.docs-content pre code {
	background: none;
	border: none;
	padding: 0;
	font-size: inherit;
	color: var(--text-strong);
}

.docs-content table {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 20px;
	font-size: 14px;
	color: var(--text);
}
.docs-content thead {
	background: var(--surface-2);
}
.docs-content th,
.docs-content td {
	text-align: left;
	vertical-align: top;
	padding: 8px 12px;
	border: 1px solid var(--border);
}
.docs-content th {
	font-family: var(--font-display);
	font-weight: 700;
	color: var(--text-strong);
}
.docs-content td {
	color: var(--text-muted);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
	.docs-shell {
		grid-template-columns: 1fr;
		gap: 24px;
	}
	.docs-sidebar {
		position: static;
		max-height: none;
		padding-right: 0;
		padding-bottom: 16px;
		border-bottom: 1px solid var(--border);
	}
	.docs-content {
		max-width: none;
	}
}
