/* Arthur Developer Platform
   Paleta oficial tomada de milapis/apps/users/models.py:77-91
   (arthur_color_dark_blue #005182, arthur_color_green #4bef7e,
    arthur_color_text #252f4a). */

:root {
	--arthur-blue: #005182;
	--arthur-blue-dark: #02436b;
	--arthur-green: #4bef7e;
	--arthur-text: #252f4a;

	--accent: var(--arthur-blue);
	--bg: #ffffff;
	--bg-subtle: #f7f9fb;
	--bg-inset: #eef2f6;
	--text: var(--arthur-text);
	--text-muted: #5a6478;
	--border: #dde3ea;
	--code-bg: #f2f5f8;
	--callout-bg: #eaf2f8;
	--callout-border: var(--arthur-blue);

	--header-height: 56px;
	--sidebar-width: 248px;
	--content-width: 46rem;

	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
		Arial, sans-serif;
	--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
		"Liberation Mono", monospace;

	color-scheme: light;
}

[data-theme="dark"] {
	--accent: var(--arthur-green);
	--bg: #0f151f;
	--bg-subtle: #151c28;
	--bg-inset: #1b2432;
	--text: #e6ebf2;
	--text-muted: #97a3b6;
	--border: #263041;
	--code-bg: #161e2b;
	--callout-bg: rgba(75, 239, 126, 0.08);
	--callout-border: var(--arthur-green);

	color-scheme: dark;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

code {
	font-family: var(--font-mono);
	font-size: 0.875em;
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 0.1em 0.35em;
}

/* El código en línea puede ser una ruta larga sin espacios
   (POST /bookings/{localizer}/rooms/{bookingroom_id}/): debe romper en vez de
   arrastrar toda la página hacia la derecha en pantallas estrechas. */
:not(pre) > code {
	overflow-wrap: anywhere;
}

pre {
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 1rem;
	overflow-x: auto;
}

pre code {
	background: none;
	border: 0;
	padding: 0;
	font-size: 0.85rem;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100;
	background: var(--accent);
	color: #fff;
	padding: 0.5rem 1rem;
}

.skip-link:focus {
	left: 0;
}

/* ------------------------------------------------------------- cabecera */

.site-header {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 1.25rem;
	height: var(--header-height);
	padding: 0 1rem;
	background: var(--bg);
	border-bottom: 1px solid var(--border);
}

.brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	color: var(--text);
	font-weight: 600;
	white-space: nowrap;
}

.brand:hover {
	text-decoration: none;
}

.brand img {
	display: block;
}

[data-theme="dark"] .brand img {
	filter: brightness(0) invert(1);
}

.brand-name {
	font-size: 0.95rem;
	color: var(--text-muted);
	font-weight: 500;
}

.product-switcher {
	min-width: 0;
	overflow-x: auto;
	scrollbar-width: none;
}

.product-switcher::-webkit-scrollbar {
	display: none;
}

.product-switcher ul {
	display: flex;
	gap: 0.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.product-switcher a {
	display: block;
	padding: 0.35rem 0.7rem;
	border-radius: 6px;
	color: var(--text-muted);
	font-size: 0.9rem;
	white-space: nowrap;
}

.product-switcher a:hover {
	background: var(--bg-inset);
	color: var(--text);
	text-decoration: none;
}

.product-switcher a[aria-current] {
	background: var(--bg-inset);
	color: var(--accent);
	font-weight: 600;
}

.base-url {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 0 auto;
	font-size: 0.8rem;
	min-width: 0;
}

/* `display: flex` gana al `[hidden]` de la hoja de estilos del navegador. */
.base-url[hidden] {
	display: none;
}

.base-url-label {
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: 0.7rem;
	font-weight: 600;
}

.base-url code {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.theme-toggle,
.menu-toggle {
	flex: none;
	background: none;
	border: 1px solid var(--border);
	border-radius: 6px;
	color: var(--text);
	cursor: pointer;
	font-size: 0.95rem;
	line-height: 1;
	padding: 0.45rem 0.6rem;
}

.theme-toggle:hover,
.menu-toggle:hover {
	background: var(--bg-inset);
}

/* -------------------------------------------------------------- layout */

.layout {
	display: flex;
	align-items: flex-start;
}

.sidebar {
	position: sticky;
	top: var(--header-height);
	flex: none;
	width: var(--sidebar-width);
	height: calc(100vh - var(--header-height));
	overflow-y: auto;
	padding: 1.5rem 1rem;
	border-right: 1px solid var(--border);
	background: var(--bg-subtle);
}

.sidebar[hidden] {
	display: none;
}

.sidebar-product {
	margin: 0 0 0.75rem;
	padding: 0 0.6rem;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.sidebar ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sidebar a {
	display: block;
	padding: 0.4rem 0.6rem;
	border-radius: 6px;
	color: var(--text-muted);
	font-size: 0.92rem;
}

.sidebar a:hover {
	background: var(--bg-inset);
	color: var(--text);
	text-decoration: none;
}

.sidebar a[aria-current] {
	background: var(--bg-inset);
	color: var(--accent);
	font-weight: 600;
}

.sidebar-note {
	margin: 1.5rem 0 0;
	padding: 0.75rem 0.6rem 0;
	border-top: 1px solid var(--border);
	font-size: 0.78rem;
	line-height: 1.5;
	color: var(--text-muted);
}

.sidebar-note code {
	font-size: 0.72rem;
	word-break: break-all;
}

.main {
	flex: 1;
	min-width: 0;
	outline: none;
}

/* --------------------------------------------------------------- vistas */

.view {
	padding: 2.5rem 2rem 5rem;
}

.prose {
	max-width: var(--content-width);
}

.prose h1 {
	font-size: 2rem;
	line-height: 1.25;
	margin: 0 0 1rem;
}

.prose h2 {
	font-size: 1.35rem;
	margin: 2.5rem 0 0.75rem;
	padding-bottom: 0.3rem;
	border-bottom: 1px solid var(--border);
}

.prose h3 {
	font-size: 1.1rem;
	margin: 2rem 0 0.5rem;
}

.table-scroll {
	overflow-x: auto;
	margin: 1.25rem 0;
	-webkit-overflow-scrolling: touch;
}

.prose table {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
	font-size: 0.92rem;
}

.prose th,
.prose td {
	border: 1px solid var(--border);
	padding: 0.5rem 0.75rem;
	text-align: left;
}

.prose th {
	background: var(--bg-subtle);
}

.prose blockquote {
	margin: 1.25rem 0;
	padding: 0.25rem 1rem;
	border-left: 3px solid var(--border);
	color: var(--text-muted);
}

.page-kicker {
	margin: 0 0 0.35rem;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--accent);
}

.callout {
	margin: 0 0 2rem;
	padding: 0.9rem 1rem;
	border-left: 3px solid var(--callout-border);
	border-radius: 0 6px 6px 0;
	background: var(--callout-bg);
	font-size: 0.9rem;
}

.callout code {
	background: var(--bg);
	word-break: break-all;
}

.source-note {
	margin-top: 3rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border);
	font-size: 0.82rem;
	color: var(--text-muted);
}

/* -------------------------------------------------------------- landing */

.hero {
	max-width: var(--content-width);
	margin-bottom: 3rem;
}

.hero h1 {
	font-size: 2.5rem;
	line-height: 1.15;
	margin: 0 0 1rem;
}

.hero-lead {
	font-size: 1.15rem;
	color: var(--text-muted);
	margin: 0 0 1rem;
}

.hero-note {
	margin: 0;
	padding: 0.75rem 1rem;
	border-left: 3px solid var(--callout-border);
	background: var(--callout-bg);
	border-radius: 0 6px 6px 0;
	font-size: 0.9rem;
}

.product-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
	gap: 1.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
	max-width: 62rem;
}

.product-card {
	padding: 1.5rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--bg-subtle);
}

.product-card h2 {
	margin: 0 0 0.5rem;
	font-size: 1.2rem;
}

.product-card h2 a {
	color: var(--text);
}

.product-card h2 a:hover {
	color: var(--accent);
}

.product-card p {
	margin: 0 0 0.9rem;
	color: var(--text-muted);
	font-size: 0.93rem;
}

.product-card-base {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	align-items: flex-start;
}

.product-card-base code {
	word-break: break-all;
	font-size: 0.78rem;
}

.product-card-links {
	display: flex;
	gap: 1rem;
	margin: 0;
	font-size: 0.9rem;
	font-weight: 500;
}

/* ------------------------------------------------------------ reference */

.reference {
	height: calc(100vh - var(--header-height));
	overflow: hidden;
	/* Scalar arranca con withDefaultFonts: false, así que hereda estas. */
	--scalar-font: var(--font);
	--scalar-font-code: var(--font-mono);
}

.reference[hidden] {
	display: none;
}

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

@media (max-width: 860px) {
	.site-header {
		gap: 0.75rem;
		padding: 0 0.75rem;
	}

	.brand-name,
	.base-url {
		display: none;
	}

	.product-switcher {
		margin-right: auto;
	}

	.sidebar {
		position: fixed;
		top: var(--header-height);
		left: 0;
		z-index: 15;
		transform: translateX(-100%);
		transition: transform 0.15s ease-out;
		box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
	}

	.sidebar.is-open {
		transform: translateX(0);
	}

	.view {
		padding: 1.75rem 1rem 4rem;
	}

	.hero h1 {
		font-size: 1.9rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sidebar {
		transition: none;
	}
}
