/* =============================================================================
   Docs (/resources/docs)
   Standalone stylesheet — NOT built by webpack. Link directly from DocsPage.ss.
   Uses the design-token system from refs/crowdhandler-html.html (scoped to .docs
   so tokens don't leak onto pages still on the legacy stylesheet).
   ============================================================================= */

.docs {
	/* Design tokens — mirror refs/crowdhandler-html.html */
	--bg:       #ffffff;
	--surface:  #eef1f7;
	--border:   #e2e2ec;
	--accent:   #426dad;
	--text:     #0f0f1a;
	--muted:    #6b6b8a;

	--font-body: 'Avenir Next', 'Avenir', 'Nunito Sans', sans-serif;
	--font-mono: 'JetBrains Mono', 'Fira Code', monospace;

	--radius-sm: 8px;
	--radius-md: 12px;
	--radius-lg: 20px;
	--radius-pill: 99px;

	--shadow-card: 0 8px 24px rgba(0,0,0,0.08);
	--shadow-dropdown: 0 8px 32px rgba(0,0,0,0.10);

	/* Docs-specific */
	--docs-sidebar-width: 280px;
	--docs-max-width: 1200px;
	--docs-reading-width: 760px;

	font-family: var(--font-body);
	color: var(--text);
	background: var(--bg);
	line-height: 1.55;
}

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

.docs__layout {
	display: grid;
	grid-template-columns: var(--docs-sidebar-width) 1fr;
	gap: 48px;
	max-width: var(--docs-max-width);
	margin: 0 auto;
	padding: 32px 24px 80px;
}

.docs__sidebar {
	position: sticky;
	top: 80px;
	align-self: start;
	max-height: calc(100vh - 100px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 4px 16px 24px 0;
	border-right: 1px solid var(--border);

	/* Firefox: thin, invisible-until-interacted-with */
	scrollbar-width: thin;
	scrollbar-color: transparent transparent;
	scrollbar-gutter: stable;

	/* Soft fade at top/bottom so content melts into the edge */
	-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
	        mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);

	transition: scrollbar-color 0.2s ease;
}

.docs__sidebar:hover,
.docs__sidebar:focus-within {
	scrollbar-color: rgba(15, 27, 38, 0.22) transparent;
}

/* WebKit / Chromium */
.docs__sidebar::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}
.docs__sidebar::-webkit-scrollbar-track {
	background: transparent;
}
.docs__sidebar::-webkit-scrollbar-thumb {
	background-color: transparent;
	border-radius: 3px;
	transition: background-color 0.2s ease;
}
.docs__sidebar:hover::-webkit-scrollbar-thumb,
.docs__sidebar:focus-within::-webkit-scrollbar-thumb {
	background-color: rgba(15, 27, 38, 0.22);
}
.docs__sidebar::-webkit-scrollbar-thumb:hover,
.docs__sidebar::-webkit-scrollbar-thumb:active {
	background-color: rgba(15, 27, 38, 0.4);
}

.docs__main {
	min-width: 0;
	max-width: var(--docs-reading-width);
}

/* Standalone Help page: a narrow, centred content column inside the normal site
   .section/.container shell (the Help page is NOT a docs page — no sidebar/docs
   layout — it just reuses the search / ticket / FAQ components). */
.help-page {
	max-width: 760px;
	margin: 0 auto;
}
.help-page > * + * {
	margin-top: 32px;
}

.docs__header { margin-bottom: 32px; }
.docs__title {
	font-size: clamp(32px, 4vw, 44px);
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -1px;
	margin: 0 0 12px;
}
.docs__lede {
	font-size: 18px;
	color: var(--muted);
	line-height: 1.6;
	margin: 0;
}

/* -----------------------------------------------------------------------------
   Sidebar
   ----------------------------------------------------------------------------- */

.docs-sidebar { font-size: 14px; }

.docs-sidebar__home {
	display: block;
	padding: 8px 0;
	margin-bottom: 8px;
	font-weight: 700;
	color: var(--text);
	text-decoration: none;
	border-bottom: 1px solid var(--border);
}
.docs-sidebar__home:hover { color: var(--accent); }
.docs-sidebar__home.is-current { color: var(--accent); }

.docs-sidebar__list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.docs-sidebar__list--root > .docs-sidebar__item { margin-top: 12px; }
.docs-sidebar__list--root > .docs-sidebar__item > .docs-sidebar__link,
.docs-sidebar__list--root > .docs-sidebar__item > .docs-sidebar__disclosure > .docs-sidebar__summary .docs-sidebar__link {
	font-weight: 600;
	color: var(--text);
}

.docs-sidebar__list .docs-sidebar__list {
	padding-left: 14px;
	margin-top: 4px;
	border-left: 1px solid var(--border);
}

.docs-sidebar__item { margin: 2px 0; }

.docs-sidebar__link {
	display: block;
	padding: 4px 8px;
	color: var(--muted);
	text-decoration: none;
	border-radius: var(--radius-sm);
	transition: color 0.12s, background 0.12s;
}
.docs-sidebar__link:hover {
	color: var(--accent);
	background: rgba(66, 109, 173, 0.06);
}
.docs-sidebar__link[aria-current="page"] {
	color: var(--accent);
	background: rgba(66, 109, 173, 0.1);
	font-weight: 600;
}

.docs-sidebar__disclosure > summary {
	list-style: none;
	cursor: pointer;
	display: flex;
	align-items: center;
}
.docs-sidebar__disclosure > summary::-webkit-details-marker { display: none; }
.docs-sidebar__disclosure > summary::before {
	content: "";
	display: inline-block;
	width: 0;
	height: 0;
	margin-right: 6px;
	border-top: 4px solid transparent;
	border-bottom: 4px solid transparent;
	border-left: 5px solid var(--muted);
	transition: transform 0.15s ease;
	flex-shrink: 0;
}
.docs-sidebar__disclosure[open] > summary::before { transform: rotate(90deg); }
.docs-sidebar__disclosure > summary .docs-sidebar__link { flex: 1; }

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

.docs-breadcrumbs {
	font-size: 13px;
	color: var(--muted);
	margin-bottom: 20px;
}
.docs-breadcrumbs a {
	color: var(--muted);
	text-decoration: none;
}
.docs-breadcrumbs a:hover { color: var(--accent); }

/* SilverStripe's $Breadcrumbs emits a series of <a> separated by &raquo; by default.
   We style whatever markup comes through. */
.docs-breadcrumbs > * { display: inline; }

/* -----------------------------------------------------------------------------
   Markdown body styling lives in public/css/styles.css under .markdown-body
   so docs, news, and solutions all share the same typography. The docs page
   just applies the .markdown-body class alongside .docs__body.
   ----------------------------------------------------------------------------- */

/* -----------------------------------------------------------------------------
   Child listings
   ----------------------------------------------------------------------------- */

.docs-children {
	margin-top: 48px;
	padding-top: 32px;
	border-top: 1px solid var(--border);
}
.docs-children__heading {
	font-size: 20px;
	font-weight: 700;
	margin: 0 0 16px;
	letter-spacing: -0.3px;
}

.docs-children__list { list-style: none; padding: 0; margin: 0; }
.docs-children__list-item { border-bottom: 1px solid var(--border); }
.docs-children__list-item:last-child { border-bottom: none; }
.docs-children__list-link {
	display: block;
	padding: 14px 0;
	color: var(--text);
	text-decoration: none;
}
.docs-children__list-link:hover .docs-children__list-title { color: var(--accent); }
.docs-children__list-title {
	display: block;
	font-weight: 600;
	font-size: 16px;
}
.docs-children__list-excerpt {
	display: block;
	color: var(--muted);
	font-size: 14px;
	margin-top: 2px;
}

.docs-children__grid {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}
.docs-children__grid-item { display: flex; }

.docs-card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 20px 22px;
	width: 100%;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg);
	color: var(--text);
	text-decoration: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.docs-card:hover {
	border-color: var(--accent);
	box-shadow: var(--shadow-card);
	transform: translateY(-1px);
}
.docs-card__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin-bottom: 4px;
	border-radius: var(--radius-sm);
	background: rgba(66, 109, 173, 0.08);
}
.docs-card__icon img {
	display: block;
	width: 24px;
	height: 24px;
}
.docs-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.docs-card__title {
	display: block;
	font-weight: 600;
	font-size: 16px;
	line-height: 1.3;
	color: var(--text);
	letter-spacing: -0.2px;
	overflow-wrap: break-word;
}
.docs-card:hover .docs-card__title { color: var(--accent); }
.docs-card__excerpt {
	display: block;
	color: var(--muted);
	font-size: 14px;
	line-height: 1.55;
	overflow-wrap: break-word;
}

/* -----------------------------------------------------------------------------
   Prev / Next
   ----------------------------------------------------------------------------- */

.docs-prevnext {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-top: 48px;
	padding-top: 32px;
	border-top: 1px solid var(--border);
}
.docs-prevnext__link {
	display: flex;
	flex-direction: column;
	padding: 16px 20px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	text-decoration: none;
	color: var(--text);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.docs-prevnext__link:hover {
	border-color: var(--accent);
	box-shadow: var(--shadow-card);
}
.docs-prevnext__link--next {
	text-align: right;
	grid-column: 2;
}
.docs-prevnext__label {
	font-size: 12px;
	color: var(--muted);
	margin-bottom: 4px;
	letter-spacing: 0.3px;
}
.docs-prevnext__title {
	font-weight: 600;
	color: var(--accent);
	font-size: 15px;
}
.docs-prevnext__spacer { display: block; }

/* -----------------------------------------------------------------------------
   Related pages
   ----------------------------------------------------------------------------- */

.docs-related {
	margin-top: 48px;
	padding-top: 32px;
	border-top: 1px solid var(--border);
}
.docs-related__heading {
	font-size: 20px;
	font-weight: 700;
	margin: 0 0 16px;
	letter-spacing: -0.3px;
}
.docs-related__list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 12px;
}
.docs-related__link {
	display: block;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	text-decoration: none;
	color: var(--text);
}
.docs-related__link:hover { border-color: var(--accent); }
.docs-related__title {
	display: block;
	font-weight: 600;
	color: var(--accent);
	font-size: 15px;
}
.docs-related__excerpt {
	display: block;
	color: var(--muted);
	font-size: 14px;
	margin-top: 2px;
}

/* -----------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------------- */

@media (max-width: 900px) {
	.docs__layout {
		grid-template-columns: 1fr;
		gap: 24px;
	}
	.docs__sidebar {
		position: static;
		max-height: none;
		padding-right: 0;
		border-right: none;
		border-bottom: 1px solid var(--border);
		padding-bottom: 16px;
		margin-bottom: 16px;
	}
	.docs-prevnext { grid-template-columns: 1fr; }
	.docs-prevnext__link--next { grid-column: 1; text-align: left; }
}

/* ─────────────────────────────────────────────
   DOCS LANDING PAGE — big search + FAQ list
───────────────────────────────────────────── */
.docs-hero-search {
	margin: 8px 0 32px;
}

.docs-hero-search__btn {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 16px 20px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	color: var(--muted);
	font-size: 16px;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.docs-hero-search__btn:hover,
.docs-hero-search__btn:focus-visible {
	border-color: var(--accent);
	background: var(--bg);
	outline: none;
}

.docs-hero-search__icon {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

.docs-hero-search__label {
	flex: 1;
	text-align: left;
}

.docs-hero-search__kbd {
	font-size: 12px;
	color: var(--muted);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 2px 6px;
	background: var(--bg);
}

.docs-faq {
	margin-top: 40px;
}

.docs-faq__heading {
	font-size: 20px;
	font-weight: 600;
	margin: 0 0 12px;
}

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

.docs-faq__item {
	border-bottom: 1px solid var(--border);
}

.docs-faq__item:last-child {
	border-bottom: none;
}

.docs-faq__link {
	display: block;
	padding: 14px 4px;
	text-decoration: none;
	color: inherit;
}

.docs-faq__q {
	display: block;
	font-weight: 600;
	font-size: 15px;
	color: var(--text);
}

.docs-faq__link:hover .docs-faq__q {
	color: var(--accent);
}

.docs-faq__a {
	display: block;
	margin-top: 4px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--muted);
}

/* Related pages listed horizontally under the excerpt. Sits outside the main
   link (no nested anchors), so pull it up to group it with the excerpt. */
.docs-faq__item:has(.docs-faq__related) .docs-faq__link {
	padding-bottom: 6px;
}

.docs-faq__related {
	list-style: none;
	margin: 0;
	padding: 0 4px 14px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
}

.docs-faq__related-link {
	font-size: 13px;
	color: var(--accent);
	text-decoration: none;
}

.docs-faq__related-link:hover {
	text-decoration: underline;
}
