/* Pelk Site — the docs (/docs/): the home with its groups, and a page with the sidebar, the body and its table of
   contents. The body is HTML from inc/docs-markdown.php (doc-* classes). */

:root {
	--docs-top: calc(var(--nav-top) + var(--nav-height) + var(--admin-bar) + 24px);
	--docs-note: #f4f1ef;
	--docs-tip: #fff3ef;
	--docs-warning: #fff6e5;
	--docs-warning-line: #e8a317;
}

/* A page: sidebar | body | table of contents --------------------------------------------------------------------- */

.docs {
	display: grid;
	grid-template-columns: 236px minmax(0, 1fr) 196px;
	gap: 56px;
	align-items: start;
	width: var(--container);
	margin: 0 auto;
	padding: calc(var(--docs-top) + 32px) 0 96px;
}

.docs__nav,
.docs__toc {
	position: sticky;
	top: var(--docs-top);
	max-height: calc(100vh - var(--docs-top) - 24px);
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}

.docs-search {
	position: relative;
	display: flex;
	align-items: center;
}
.docs-search .icon {
	position: absolute;
	inset-inline-start: 14px;
	width: 17px;
	height: 17px;
	color: var(--subtle);
	pointer-events: none;
}
.docs-search input[type="search"] {
	width: 100%;
	height: 44px;
	padding-inline: 40px 16px;
	border: 1px solid var(--sand-line);
	border-radius: 999px;
	background: var(--white);
	color: var(--ink);
	font: inherit;
	font-size: 15px;
	transition: border-color 0.2s, box-shadow 0.2s;
}
.docs-search input[type="search"]::placeholder { color: var(--subtle); }
.docs-search input[type="search"]:focus {
	border-color: var(--coral);
	outline: none;
	box-shadow: 0 0 0 4px rgba(255, 107, 74, 0.14);
}

.docs__menu { margin-top: 24px; }
.docs__menu-toggle { display: none; }
.docs__group {
	margin: 24px 0 8px;
	padding-inline: 12px;
	color: var(--subtle);
	font-size: 13px;
	font-weight: 700;
}
.docs__group:first-child { margin-top: 0; }
.docs__pages { display: flex; flex-direction: column; gap: 2px; }
.docs__pages a {
	position: relative;
	display: block;
	padding: 8px 12px;
	border-radius: 10px;
	color: var(--muted);
	font-size: 15px;
	font-weight: 500;
	transition: background-color 0.2s, color 0.2s;
}
.docs__pages a:hover { background: var(--sand); color: var(--ink); }
.docs__pages a[aria-current="page"] {
	background: var(--sand);
	color: var(--ink);
	font-weight: 700;
}
.docs__pages a[aria-current="page"]::before {
	content: "";
	position: absolute;
	inset-block: 10px;
	inset-inline-start: 0;
	width: 3px;
	border-radius: 3px;
	background: var(--coral);
}

.docs__toc-title {
	margin-bottom: 12px;
	color: var(--subtle);
	font-size: 13px;
	font-weight: 700;
}
.docs__toc ul { border-inline-start: 1px solid var(--sand-line); }
.docs__toc a {
	display: block;
	margin-inline-start: -1px;
	padding: 5px 14px;
	border-inline-start: 1px solid transparent;
	color: var(--muted);
	font-size: 14px;
	line-height: 1.6;
	transition: color 0.2s, border-color 0.2s;
}
.docs__toc-3 a { padding-inline-start: 26px; font-size: 13px; }
.docs__toc a:hover { color: var(--ink); }
.docs__toc a.is-active { border-color: var(--coral); color: var(--coral-deep); }

/* The page's head ------------------------------------------------------------------------------------------------ */

.doc { min-width: 0; max-width: 760px; }

.doc__crumbs {
	display: flex;
	gap: 8px;
	margin-bottom: 14px;
	color: var(--subtle);
	font-size: 14px;
	font-weight: 500;
}
.doc__crumbs a { color: var(--coral-deep); }
.doc__crumbs a:hover { text-decoration: underline; }

.doc__title {
	font-size: 42px;
	font-weight: 900;
	line-height: 1.3;
	letter-spacing: -0.01em;
}
.doc__lead {
	margin-top: 14px;
	color: var(--muted);
	font-size: 19px;
	line-height: 1.8;
}
.doc__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	margin-top: 22px;
	padding-bottom: 28px;
	border-bottom: 1px solid var(--sand-line);
	color: var(--subtle);
	font-size: 14px;
}
.doc__meta span { display: inline-flex; align-items: center; gap: 6px; }
.doc__meta .icon { width: 15px; height: 15px; }

/* The body ------------------------------------------------------------------------------------------------------- */

.doc__body {
	padding-top: 12px;
	color: #2c2938;
	font-size: 17px;
	line-height: 2;
}
.doc__body > * + * { margin-top: 18px; }

.doc__body h2,
.doc__body h3,
.doc__body h4 {
	position: relative;
	color: var(--ink);
	line-height: 1.45; /* Where a link to a heading stops: the page's scroll-padding-top (base.css), nothing more. */
}
.doc__body h2 { margin-top: 56px; font-size: 26px; font-weight: 900; }
.doc__body h3 { margin-top: 36px; font-size: 20px; font-weight: 800; }
.doc__body h4 { margin-top: 28px; font-size: 17px; font-weight: 800; }
.doc__body h2 + *, .doc__body h3 + *, .doc__body h4 + * { margin-top: 12px; }

.doc-anchor {
	position: absolute;
	inset-inline-start: -1.1em;
	color: var(--subtle);
	font-weight: 500;
	opacity: 0;
	transition: opacity 0.15s;
}
.doc__body :is(h2, h3, h4):hover .doc-anchor { opacity: 1; }
.doc-anchor:hover { color: var(--coral); }

/* A page of steps (`steps: true`): its ## headings numbered in coral discs. */
.doc__body--steps { counter-reset: step; }
.doc__body--steps h2 {
	display: flex;
	align-items: center;
	gap: 14px;
	counter-increment: step;
}
.doc__body--steps h2::before {
	content: counter(step, persian);
	display: grid;
	flex: none;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--coral);
	color: var(--white);
	font-size: 18px;
	font-weight: 800;
	box-shadow: 0 0 0 6px var(--docs-tip);
}
.doc__body--steps h2 .doc-anchor { inset-inline-start: -1.6em; }

.doc__body a:not(.doc-anchor) {
	color: var(--coral-deep);
	text-decoration: underline;
	text-decoration-color: rgba(200, 64, 31, 0.3);
	text-underline-offset: 4px;
	transition: text-decoration-color 0.2s;
}
.doc__body a:not(.doc-anchor):hover { text-decoration-color: currentColor; }

.doc__body strong { color: var(--ink); font-weight: 700; }

.doc__body ul, .doc__body ol { padding-inline-start: 24px; }
.doc__body ul { list-style: disc; }
.doc__body ol { list-style: persian; }
.doc__body li { padding-inline-start: 4px; }
.doc__body li + li { margin-top: 8px; }
.doc__body li > ul, .doc__body li > ol { margin-top: 8px; }
.doc__body li::marker { color: var(--coral); font-weight: 700; }

.doc__body hr {
	height: 1px;
	margin: 48px 0;
	border: 0;
	background: var(--sand-line);
}

.doc__body :not(pre) > code {
	padding: 2px 7px;
	border-radius: 6px;
	background: var(--sand);
	color: var(--ink);
	font-size: 0.84em;
	unicode-bidi: isolate;
	white-space: nowrap;
}

.doc__body blockquote {
	padding-inline-start: 18px;
	border-inline-start: 3px solid var(--sand-line);
	color: var(--muted);
}

.doc-callout {
	padding: 18px 22px;
	border-inline-start: 3px solid var(--ink);
	border-radius: 4px 14px 14px 4px;
	background: var(--docs-note);
	font-size: 16px;
	line-height: 1.9;
}
[dir="rtl"] .doc-callout { border-radius: 14px 4px 4px 14px; }
.doc-callout > * + * { margin-top: 10px; }
.doc-callout ul { margin-top: 10px; }
.doc-callout__title {
	color: var(--ink);
	font-size: 14px;
	font-weight: 800;
}
.doc-callout--tip { border-color: var(--coral); background: var(--docs-tip); }
.doc-callout--tip .doc-callout__title { color: var(--coral-deep); }
.doc-callout--warning { border-color: var(--docs-warning-line); background: var(--docs-warning); }
.doc-callout--warning .doc-callout__title { color: #a06a00; }

.doc-code { position: relative; }
.doc-code pre {
	margin: 0;
	padding: 18px 22px;
	padding-right: 84px; /* The copy button's room. */
	overflow-x: auto;
	border-radius: 14px;
	background: var(--ink);
	color: #f4f1ef;
	font-size: 14px;
	line-height: 1.8;
	text-align: left;
	tab-size: 4;
}
.doc-code pre code { font-family: var(--mono); }
.doc-code__copy {
	position: absolute;
	top: 12px;
	right: 12px;
	padding: 4px 12px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.06);
	color: rgba(255, 255, 255, 0.8);
	font-size: 13px;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}
.doc-code__copy:hover { background: rgba(255, 255, 255, 0.14); color: var(--white); }
.doc-code__copy.is-copied { border-color: var(--coral); color: var(--white); }

.doc-table {
	overflow-x: auto;
	border: 1px solid var(--sand-line);
	border-radius: 14px;
}
.doc-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: 15px;
	line-height: 1.7;
}
.doc-table th, .doc-table td {
	padding: 12px 18px;
	text-align: start;
	vertical-align: top;
}
.doc-table th {
	background: var(--sand);
	color: var(--ink);
	font-weight: 700;
	white-space: nowrap;
}
.doc-table td { border-top: 1px solid var(--sand-line); }
.doc__body .doc-table :not(pre) > code { white-space: normal; overflow-wrap: anywhere; } /* Long selectors wrap on phones. */
.doc-table :is(th, td):first-child { min-width: 76px; } /* …but a short code (`200`) keeps its line. */
.doc-table td:first-child { color: var(--ink); font-weight: 600; }

.doc-figure { margin-inline: 0; }
.doc-figure__open { display: block; cursor: zoom-in; }
.doc-figure img {
	width: 100%;
	height: auto;
	border: 1px solid var(--sand-line);
	border-radius: 14px;
}
.doc-figure figcaption {
	margin-top: 10px;
	color: var(--muted);
	font-size: 14px;
	text-align: center;
}

/* After the body: previous / next, and the way to ask -------------------------------------------------------------- */

.doc__pager {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-top: 64px;
}
.doc__pager-link {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 18px 22px;
	border: 1px solid var(--sand-line);
	border-radius: 16px;
	transition: border-color 0.2s, box-shadow 0.2s;
}
.doc__pager-link:hover { border-color: var(--coral); box-shadow: 0 8px 24px rgba(255, 107, 74, 0.1); }
.doc__pager-link--next { grid-column: 2; text-align: end; }
.doc__pager-label { color: var(--subtle); font-size: 13px; }
.doc__pager-title { color: var(--ink); font-weight: 700; }

.doc__help {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 24px;
	padding: 20px 24px;
	border-radius: 16px;
	background: var(--sand);
	color: var(--muted);
	font-size: 15px;
}
.doc__help strong { color: var(--ink); }
.doc__help .btn { height: 42px; padding-inline: 20px; font-size: 15px; }

/* The docs' home ----------------------------------------------------------------------------------------------------- */

.docs-home {
	width: min(var(--container), 1040px);
	margin: 0 auto;
	padding: calc(var(--docs-top) + 56px) 0 112px;
}

.docs-home__head { text-align: center; }
.docs-home__mono {
	color: var(--coral);
	font-family: var(--mono);
	font-size: 13px;
	letter-spacing: 0.12em;
}
.docs-home__title {
	margin-top: 12px;
	font-size: 56px;
	font-weight: 900;
	line-height: 1.25;
}
.docs-home__lead {
	max-width: 560px;
	margin: 14px auto 0;
	color: var(--muted);
	font-size: 18px;
	line-height: 1.8;
}
.docs-home__head .docs-search { max-width: 520px; margin: 32px auto 0; }
.docs-home__head .docs-search input[type="search"] { height: 54px; font-size: 16px; box-shadow: 0 8px 24px rgba(21, 19, 31, 0.05); }
.docs-home__head .docs-search .icon { inset-inline-start: 18px; }
.docs-home__head .docs-search input[type="search"] { padding-inline-start: 46px; }

.docs-start {
	position: relative;
	display: grid;
	gap: 10px;
	margin-top: 64px;
	padding: 40px 44px;
	overflow: hidden;
	border-radius: 28px;
	background: var(--ink);
	color: rgba(255, 255, 255, 0.72);
	isolation: isolate;
	transition: transform 0.3s var(--ease-out);
}
.docs-start::after {
	content: "";
	position: absolute;
	z-index: -1;
	inset-block-start: -120px;
	inset-inline-end: -80px;
	width: 360px;
	height: 360px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 107, 74, 0.55), rgba(255, 107, 74, 0) 70%);
}
.docs-start:hover { transform: translateY(-2px); }
.docs-start__tag {
	justify-self: start;
	padding: 4px 12px;
	border-radius: 999px;
	background: var(--coral);
	color: var(--white);
	font-size: 13px;
	font-weight: 700;
}
.docs-start__title { margin-top: 6px; color: var(--white); font-size: 32px; font-weight: 900; }
.docs-start__text { max-width: 520px; font-size: 17px; line-height: 1.8; }
.docs-start__go {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
	color: var(--white);
	font-weight: 700;
}
.docs-start__go .icon { transition: transform 0.25s var(--ease-out); }
.docs-start:hover .docs-start__go .icon { transform: translateX(-4px); }

.docs-groups {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 20px;
	margin-top: 20px;
}
.docs-group {
	padding: 28px;
	border: 1px solid var(--sand-line);
	border-radius: 22px;
}
.docs-group__title { font-size: 20px; font-weight: 900; }
.docs-group__text { margin-top: 6px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.docs-group ul { margin-top: 16px; }
.docs-group li + li { border-top: 1px solid var(--sand-line); }
.docs-group a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 0;
	color: var(--ink);
	font-weight: 600;
	transition: color 0.2s;
}
.docs-group a .icon { width: 16px; height: 16px; color: var(--subtle); transition: transform 0.25s var(--ease-out), color 0.2s; }
.docs-group a:hover { color: var(--coral-deep); }
.docs-group a:hover .icon { color: var(--coral); transform: translateX(-3px); }

.docs-results { display: grid; gap: 12px; max-width: 760px; margin: 48px auto 0; }
.docs-card {
	display: grid;
	gap: 4px;
	padding: 20px 24px;
	border: 1px solid var(--sand-line);
	border-radius: 16px;
	transition: border-color 0.2s;
}
.docs-card:hover { border-color: var(--coral); }
.docs-card__group { color: var(--coral-deep); font-size: 13px; font-weight: 700; }
.docs-card__title { color: var(--ink); font-size: 18px; font-weight: 800; }
.docs-card__text { color: var(--muted); font-size: 15px; line-height: 1.8; }

.docs-empty { margin-top: 48px; color: var(--muted); text-align: center; }
.docs-empty a { color: var(--coral-deep); text-decoration: underline; }

/* Narrower screens: no table of contents below 1180px; one column, the sidebar folded, below 900px. -------------- */

@media (max-width: 1180px) {
	.docs { grid-template-columns: 220px minmax(0, 1fr); gap: 44px; }
	.docs__toc { display: none; }
}

@media (max-width: 899px) {
	.docs {
		grid-template-columns: minmax(0, 1fr);
		gap: 28px;
		padding-top: calc(var(--docs-top) + 12px);
	}
	.docs__nav { position: static; max-height: none; overflow: visible; }
	.docs__menu {
		margin-top: 12px;
		border: 1px solid var(--sand-line);
		border-radius: 16px;
	}
	.docs__menu-toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 12px 16px;
		color: var(--ink);
		font-weight: 700;
		list-style: none;
		cursor: pointer;
	}
	.docs__menu-toggle::-webkit-details-marker { display: none; }
	.docs__menu-toggle .icon { transition: transform 0.25s var(--ease-out); }
	.docs__menu[open] .docs__menu-toggle .icon { transform: rotate(180deg); }
	.docs__menu nav { padding: 0 4px 12px; }
	.doc__title { font-size: 32px; }
	.doc__lead { font-size: 17px; }
	.doc__body { font-size: 16px; line-height: 1.95; }
	.doc__body h2 { margin-top: 44px; font-size: 22px; }
	.doc__body h3 { font-size: 18px; }
	.doc__body--steps h2::before { width: 32px; height: 32px; font-size: 16px; }
	.doc-anchor { display: none; }
	.doc-code pre { padding: 48px 18px 16px; } /* The copy button above the first line, not over it. */
	.doc__pager { grid-template-columns: minmax(0, 1fr); }
	.doc__pager-link--next { grid-column: auto; }
	.doc__help { flex-direction: column; align-items: flex-start; }
	.docs-home { padding-top: calc(var(--docs-top) + 28px); }
	.docs-home__title { font-size: 38px; }
	.docs-home__lead { font-size: 16px; }
	.docs-start { margin-top: 40px; padding: 28px 24px; border-radius: 22px; }
	.docs-start__title { font-size: 26px; }
	.docs-groups { grid-template-columns: minmax(0, 1fr); }
	.docs-group { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	.docs-start, .docs-start__go .icon, .docs-group a .icon { transition: none; }
}
