/*
 * Nuvora documentation styles.
 *
 * 1. Tokens (light and dark)
 * 2. Base
 * 3. Layout: sidebar and content
 * 4. Content parts: steps, notes, tables, figures, keys
 * 5. Media queries
 */

/* 1. Tokens ---------------------------------------------------------------------------------------------------- */
:root {
	--bg: #f8f6f1;
	--surface: #ffffff;
	--text: #28241f;
	--muted: #5b6b75;
	--line: #e1e7ea;
	--brand: #765123;
	--brand-soft: #f1e7d9;
	--accent: #ea580c;
	--note: #eff6ff;
	--note-line: #3b82f6;
	--warn: #fff7ed;
	--warn-line: #f97316;
	--code: #eef2f4;
	--shadow: 0 1px 2px rgba(16, 24, 32, 0.06), 0 8px 24px rgba(16, 24, 32, 0.06);
	--radius: 10px;
	--sidebar: 290px;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0f1619;
		--surface: #162126;
		--text: #e3eaed;
		--muted: #9aabb3;
		--line: #26363d;
		--brand: #edc78b;
		--brand-soft: #3d3020;
		--accent: #fb923c;
		--note: #13233a;
		--note-line: #60a5fa;
		--warn: #2b1d10;
		--warn-line: #fb923c;
		--code: #1e2c33;
		--shadow: none;
		color-scheme: dark;
	}
}

/* 2. Base ------------------------------------------------------------------------------------------------------ */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--doc-topbar-height, 0px) + 24px);
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a {
	color: var(--brand);
}

h1,
h2,
h3 {
	line-height: 1.25;
}

h2 {
	margin: 0 0 12px;
	font-size: 1.6rem;
}

h3 {
	margin: 32px 0 8px;
	font-size: 1.15rem;
}

code {
	padding: 1px 6px;
	border-radius: 5px;
	background: var(--code);
	font-size: 0.9em;
}

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

/* 3. Layout ---------------------------------------------------------------------------------------------------- */
.doc-sidebar {
	position: fixed;
	inset: 0 auto 0 0;
	display: flex;
	flex-direction: column;
	width: var(--sidebar);
	border-right: 1px solid var(--line);
	background: var(--surface);
}

.doc-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 20px 20px 16px;
	color: inherit;
	text-decoration: none;
}

.doc-brand__mark {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--brand);
	color: #fff;
	font-weight: 700;
}

.doc-brand__name {
	display: block;
	font-weight: 700;
}

.doc-brand__sub {
	display: block;
	color: var(--muted);
	font-size: 0.85rem;
}

.doc-search {
	margin: 0 20px 12px;
}

.doc-search input {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--bg);
	color: inherit;
	font: inherit;
	font-size: 0.95rem;
}

.doc-nav {
	flex: 1;
	overflow-y: auto;
	padding: 0 12px 24px;
}

.doc-nav__group {
	margin: 18px 8px 6px;
	color: var(--muted);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

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

.doc-nav a {
	display: block;
	padding: 6px 10px;
	border-radius: 7px;
	color: var(--text);
	font-size: 0.95rem;
	text-decoration: none;
}

.doc-nav a:hover {
	background: var(--bg);
}

.doc-nav a.is-active {
	background: var(--brand-soft);
	color: var(--brand);
	font-weight: 600;
}

.doc-nav__empty {
	margin: 12px 10px;
	color: var(--muted);
	font-size: 0.9rem;
}

.doc-menu-button {
	display: none;
}

.doc-main {
	margin-left: var(--sidebar);
	padding: 48px 48px 96px;
}

.doc-content {
	max-width: 880px;
	margin: 0 auto;
}

.doc-hero {
	margin-bottom: 40px;
}

.doc-hero h1 {
	margin: 0 0 12px;
	font-size: 2.3rem;
}

.doc-hero p {
	margin: 0;
	color: var(--muted);
	font-size: 1.1rem;
}

.doc-section {
	margin-bottom: 32px;
	padding: 32px 36px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow);
}

.doc-section > p:first-of-type {
	margin-top: 0;
}

.doc-footer {
	color: var(--muted);
	font-size: 0.9rem;
	text-align: center;
}

.doc-topbar {
	position: sticky;
	top: 0;
	z-index: 10;
	margin-left: var(--sidebar);
}

.doc-online {
	padding: 8px 16px;
	background: #765123;
	color: #fff;
}

.doc-online > div {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 12px;
	max-width: 880px;
	margin: 0 auto;
	font-size: 0.9rem;
}

.doc-online p {
	flex: 1;
	margin: 0;
	font-weight: 700;
	line-height: 1.35;
}

.doc-online a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 14px;
	border-radius: 6px;
	background: #fff;
	color: #69451c;
	font-weight: 700;
	text-decoration: none;
}

.doc-online a:hover {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.doc-online a:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* 4. Content parts --------------------------------------------------------------------------------------------- */
.doc-steps {
	margin: 12px 0 16px;
	padding: 0;
	counter-reset: step;
	list-style: none;
}

.doc-steps > li {
	position: relative;
	margin-bottom: 10px;
	padding-left: 40px;
	counter-increment: step;
}

.doc-steps > li::before {
	content: counter(step);
	position: absolute;
	top: 1px;
	left: 0;
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--brand-soft);
	color: var(--brand);
	font-size: 0.85rem;
	font-weight: 700;
}

.doc-note,
.doc-warn {
	margin: 16px 0;
	padding: 12px 16px;
	border-left: 4px solid var(--note-line);
	border-radius: 0 8px 8px 0;
	background: var(--note);
}

.doc-warn {
	border-left-color: var(--warn-line);
	background: var(--warn);
}

.doc-note p,
.doc-warn p {
	margin: 0;
}

.doc-table-wrap {
	overflow-x: auto;
	margin: 12px 0 16px;
}

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

th,
td {
	padding: 9px 12px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
}

th {
	color: var(--muted);
	font-size: 0.8rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

td:first-child {
	font-weight: 600;
	white-space: nowrap;
}

.doc-figure {
	margin: 16px 0 24px;
}

.doc-figure a {
	display: inline-block;
	max-width: 100%;
	border: 1px solid var(--line);
	border-radius: 8px;
	overflow: hidden;
	line-height: 0;
	cursor: zoom-in;
}

@media (hover: none) {
	.doc-figure a::after {
		content: "View full size";
		display: block;
		padding: 8px 12px;
		border-top: 1px solid var(--line);
		font-size: 0.85rem;
		line-height: 1.4;
	}
}

.doc-figure--narrow a {
	max-width: 420px;
}

.doc-figure figcaption {
	margin-top: 8px;
	color: var(--muted);
	font-size: 0.88rem;
}

.doc-section details {
	margin: 12px 0;
	padding: 10px 14px;
	border: 1px solid var(--line);
	border-radius: 8px;
}

.doc-section summary {
	color: var(--brand);
	font-weight: 600;
	cursor: pointer;
}

.doc-section details > :last-child {
	margin-bottom: 0;
}

.doc-lightbox {
	width: fit-content;
	max-width: calc(100% - 24px);
	max-height: calc(100% - 24px);
	max-height: calc(100dvh - 24px);
	padding: 0;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text);
}

.doc-lightbox[open] {
	display: flex;
	flex-direction: column;
}

.doc-lightbox::backdrop {
	background: rgb(0 0 0 / 75%);
}

html:has(.doc-lightbox[open]) {
	overflow: hidden;
}

.doc-lightbox__toolbar {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
	padding: 8px 12px;
	border-bottom: 1px solid var(--line);
}

.doc-lightbox button {
	min-height: 44px;
	padding: 6px 12px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--surface);
	color: inherit;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.doc-lightbox button[aria-pressed="true"] {
	border-color: var(--brand);
	background: var(--brand-soft);
}

.doc-lightbox__view {
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
}

.doc-lightbox__view:focus-visible {
	outline-offset: -3px;
}

.doc-lightbox__view img {
	display: block;
	max-height: calc(100vh - 9rem);
	max-height: calc(100dvh - 9rem);
	margin-inline: auto;
}

.doc-lightbox__view.is-zoomed img {
	max-width: none;
	max-height: none;
}

.doc-lightbox__caption {
	margin: 0;
	padding: 8px 12px;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 0.88rem;
}

.doc-path {
	font-weight: 600;
}

kbd {
	padding: 1px 6px;
	border: 1px solid var(--line);
	border-radius: 5px;
	background: var(--bg);
	font: inherit;
	font-size: 0.9em;
}

.doc-columns {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px 24px;
	margin: 12px 0;
	padding: 0;
	list-style: none;
}

.doc-columns li::before {
	content: "–";
	margin-right: 8px;
	color: var(--muted);
}

/* 5. Media queries --------------------------------------------------------------------------------------------- */
@media (max-width: 960px) {
	.doc-js .doc-sidebar {
		transform: translateX(-100%);
		visibility: hidden;
		z-index: 20;
		box-shadow: var(--shadow);
		transition: transform 0.2s ease;
	}

	.doc-js .doc-sidebar.is-open {
		transform: none;
		visibility: visible;
	}

	html:not(.doc-js) .doc-sidebar {
		position: static;
		width: auto;
		max-height: none;
	}

	html:not(.doc-js) .doc-search {
		display: none;
	}

	.doc-js .doc-menu-button {
		display: flex;
		align-items: center;
		gap: 10px;
		width: 100%;
		padding: 12px 16px;
		border: 0;
		border-bottom: 1px solid var(--line);
		background: var(--surface);
		color: var(--text);
		font: inherit;
		font-weight: 600;
		cursor: pointer;
	}

	.doc-main {
		margin-left: 0;
		padding: 24px 16px 64px;
	}

	.doc-topbar {
		margin-left: 0;
	}

	.doc-section {
		padding: 22px 18px;
	}

	.doc-hero h1 {
		font-size: 1.8rem;
	}
}

@media (max-width: 560px) {
	.doc-columns {
		grid-template-columns: 1fr;
	}

	td:first-child {
		white-space: normal;
	}
}

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

	.doc-sidebar {
		transition: none;
	}
}
