/* ==========================================================================
   site-navigation.css — JS-free navigation layer (2026-07)

   IMPORTANT: This file is linked DIRECTLY from the master page <head> via a
   plain <link> tag. It is deliberately NOT the master stylesheet, so Flare's
   CSS processing (ResolveCssVariables etc.) never touches it.

   Target location in the project:
   Content/Resources/Stylesheets/site-navigation.css

   Do NOT merge this into Styles.css.
   Requires evergreen browsers (Chrome/Edge/Firefox/Safari ~2023+).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1) Smooth scrolling + sticky-header anchor offset (replaces old JS scroll)
   -------------------------------------------------------------------------- */

html {
	scroll-behavior: smooth;
	/* Keep anchor targets clear of the fixed top bar (100px) + breadcrumb
	   header (84px). scroll-padding on the root works for EVERY anchor jump,
	   regardless of the target element. */
	scroll-padding-top: 210px;
}

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


/* --------------------------------------------------------------------------
   2) TOC toggle (FAB) via checkbox + :has()
   -------------------------------------------------------------------------- */

#toc-toggle {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	cursor: pointer;
	display: inline-block;
}

#toc-toggle:focus-visible {
	outline: 2px solid #4e9af1;
	outline-offset: 2px;
}

/* Lift the TOC toggle above the Cookiebot consent widget, which is injected
   at runtime at the bottom-left corner (#CookiebotWidget, ~48px tall at
   bottom:10px). We move OUR button instead of the widget: the widget is a
   compliance requirement and its internals may change with updates.
   (If you ever prefer to move the widget instead, this would work:
   div#CookiebotWidget { bottom: 70px !important; } ) */

#toc-toggle {
	bottom: max(72px, env(safe-area-inset-bottom) + 44px);
}

/* Desktop: unchecked = sidebar visible (default), checked = collapsed */

@media (min-width: 901px) {
	#toc-toggle {
		background-image: url('../Images/icons/icon-toc-close.svg');
	}

	html:has(#toc-toggle:checked) #toc-toggle {
		background-image: url('../Images/icons/icon-toc-open.svg');
	}

	html:has(#toc-toggle:checked) {
		--sidebar-width: 0px;
		--sidebar-border: 0px;
		--content-offset: 0px;
	}

	html:has(#toc-toggle:checked) #toc-sidebar {
		display: none !important;
	}

	html:has(#toc-toggle:checked) body > .content-header {
		left: 0 !important;
	}

	html:has(#toc-toggle:checked) body .main-content {
		margin-left: 0 !important;
		margin-right: 0 !important;
		width: 100% !important;
		inline-size: 100% !important;
		max-width: none !important;
		max-inline-size: none !important;
		padding-left: clamp(12px, 20px, 24px) !important;
		padding-right: clamp(12px, 20px, 24px) !important;
		box-sizing: border-box !important;
	}

	html:has(#toc-toggle:checked) body #mc-main-content {
		width: 100% !important;
		max-width: 1200px !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
		box-sizing: border-box !important;
	}

	html:has(#toc-toggle:checked) body #doc-breadcrumbs {
		margin-left: 0 !important;
		margin-right: 0 !important;
		width: min(100%, 1200px) !important;
		max-width: 1200px !important;
		box-sizing: border-box !important;
	}
}

/* Mobile: unchecked = sidebar hidden (default), checked = overlay visible.
   Content always uses full width. */

@media (max-width: 900px) {
	#toc-toggle {
		background-image: url('../Images/icons/icon-toc-open.svg');
	}

	html:has(#toc-toggle:checked) #toc-toggle {
		background-image: url('../Images/icons/icon-toc-close.svg');
	}

	#toc-sidebar {
		display: none !important;
	}

	html:has(#toc-toggle:checked) #toc-sidebar {
		display: block !important;
	}

	html body .main-content {
		margin-left: 0 !important;
		margin-right: 0 !important;
		width: 100% !important;
		inline-size: 100% !important;
		max-width: none !important;
		max-inline-size: none !important;
		padding-left: clamp(12px, 20px, 24px) !important;
		padding-right: clamp(12px, 20px, 24px) !important;
		box-sizing: border-box !important;
	}

	html body > .content-header {
		left: 0 !important;
	}

	html body #doc-breadcrumbs {
		padding-right: clamp(12px, 20px, 24px) !important;
	}
}

/* --------------------------------------------------------------------------
   3) Static sidebar TOC (injected by postbuild_static_toc.py)
   -------------------------------------------------------------------------- */

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

.static-toc li {
	list-style: none;
	margin: 3px 0;
}

.static-toc > ul > li {
	margin: 6px 0;
}

.static-toc ul ul {
	padding-left: 12px;
}

.static-toc a {
	display: block;
	padding: 2px 0;
	line-height: 1.3;
	color: inherit;
	text-decoration: none;
	overflow-wrap: break-word;
}

.static-toc a:hover,
.static-toc a:focus-visible {
	text-decoration: underline;
}

.static-toc a[aria-current="page"] {
	color: #0062cc;
	font-weight: 600;
}

/* Hierarchy scaling (matches previous .menu behavior) */

.static-toc ul ul a {
	font-size: 0.85em !important;
}

.static-toc ul ul ul a {
	font-size: 0.80em !important;
}

/* Branches: details/summary with custom triangles */

.static-toc summary {
	list-style: none;
	display: flex;
	align-items: flex-start;
	gap: 6px;
	cursor: pointer;
}

.static-toc summary::-webkit-details-marker {
	display: none;
}

.static-toc summary::before {
	content: "\25b6";
	color: #666;
	font-size: 0.85em;
	line-height: 1.6;
	flex: 0 0 auto;
}

.static-toc details[open] > summary::before {
	content: "\25bc";
}

.static-toc summary a {
	flex: 1 1 auto;
}

/* --------------------------------------------------------------------------
   4) Quick Navigation (mini-TOC panel) via checkbox + :has()
   -------------------------------------------------------------------------- */

/* Visually hidden checkbox; the <label class="qfn-toggle"> is the button
   (icon styling for .qfn-toggle comes from Styles.css) */

.qfn-toggle-cb {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

.qfn-toggle-cb:focus-visible ~ .qfn-toggle {
	outline: 2px solid #4e9af1;
	outline-offset: 2px;
}

#quick-float-nav {
	/* anchor for the absolutely positioned panel */
	position: fixed;
	/* same baseline as the TOC toggle (both lifted above the Cookiebot widget) */
	bottom: max(72px, env(safe-area-inset-bottom) + 44px);
}

#quick-float-nav .qfn-panel {
	display: none;
	position: absolute;
	bottom: 36px;
	right: 0;
	margin: 0;
	width: 320px;
	max-height: 60vh;
	overflow: auto;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 6px 16px rgba(0,0,0,.18);
	padding: .5rem;
	font: 14px / 1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

#quick-float-nav:has(.qfn-toggle-cb:checked) .qfn-panel {
	display: block;
}

@media (max-width: 600px) {
	#quick-float-nav .qfn-panel {
		width: min(90vw, 320px);
	}
}

/* Mini-TOC inside the panel: neutral list styling */

#qfn-panel ul {
	list-style: none;
	margin: .35rem 0 0;
	padding: 0;
}

#qfn-panel li {
	list-style: none;
	border-bottom: 1px dashed #eee;
	padding: .35rem 0;
}

#qfn-panel li li {
	border-bottom: none;
	padding: .15rem 0 .15rem 1rem;
}

#qfn-panel a {
	display: block;
	color: #333 !important;
	text-decoration: none;
	padding: .2rem .3rem;
	border-radius: 4px;
	font-weight: normal;
}

#qfn-panel a:hover,
#qfn-panel a:focus-visible {
	background: #f3f7ff;
	text-decoration: underline;
	outline: none;
}

#qfn-panel .qfn-top-link {
	font-weight: 600;
}

/* Level indentation for the static mini-TOC (built by postbuild_static_toc.py) */

#qfn-panel .qfn-lvl-3 {
	padding-left: 1rem;
	border-bottom: none;
}

#qfn-panel .qfn-lvl-4 {
	padding-left: 2rem;
	border-bottom: none;
}

/* Hide the whole Quick Nav on pages without headings (empty mini-TOC) */

#quick-float-nav:not(:has(.qfn-list a)) {
	display: none;
}

/* --------------------------------------------------------------------------
   5) Product switch (documentation selector) via checkbox + label + :has()
   -------------------------------------------------------------------------- */

.top-bar__dropdown {
	position: relative;
}

.product-switch-cb {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

/* The label mimics the previous <select> look */

.product-switch-label {
	display: flex;
	align-items: center;
	gap: .5em;
	height: 32px;
	padding: 0 8px;
	font-family: Roboto, sans-serif;
	font-size: 13px;
	color: #5F5F5F;
	border: 1px solid #ccc;
	background: #fff;
	cursor: pointer;
	box-sizing: border-box;
	white-space: nowrap;
}

.product-switch-label::after {
	content: "\25be";
	font-size: 11px;
	color: #5F5F5F;
}

.product-switch-cb:focus-visible ~ .product-switch-label {
	outline: 2px solid #4e9af1;
	outline-offset: 2px;
}

.top-bar__dropdown .product-menu {
	display: none;
	position: absolute;
	top: 34px;
	left: 0;
	z-index: 1500;
	min-width: 180px;
	max-height: 70vh;
	overflow: auto;
	list-style: none;
	margin: 0;
	padding: 4px 0;
	background: #fff;
	border: 1px solid #ccc;
	box-shadow: 0 6px 16px rgba(0,0,0,.18);
}

.top-bar__dropdown:has(.product-switch-cb:checked) .product-menu {
	display: block;
}

.top-bar__dropdown .product-menu li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.top-bar__dropdown .product-menu a {
	display: block;
	padding: 6px 12px;
	font-family: Roboto, sans-serif;
	font-size: 13px;
	color: #333 !important;
	text-decoration: none;
	white-space: nowrap;
}

.top-bar__dropdown .product-menu a:hover,
.top-bar__dropdown .product-menu a:focus-visible {
	background: #f3f7ff;
}

@media (max-width: 575px) {
	.top-bar__dropdown .product-menu {
		right: 0;
		left: auto;
	}

	/* Never let a long documentation name get clipped: the label keeps its
	   intrinsic width (overrides the legacy flex: 0 1 38% from Styles.css) */
	.top-bar__dropdown {
		flex: 0 0 auto !important;
		min-width: 0;
	}
}

/* --------------------------------------------------------------------------
   6) Layout fine-tuning (2026-07)
   -------------------------------------------------------------------------- */

/* The fixed header stack (top bar 100px + breadcrumb bar 84px) ends at 184px,
   but the content column started at 180px — the first heading visually
   touched the divider line. Give it breathing room. This does NOT affect
   anchor scrolling: the quick-nav offset is measured from the live bottom
   edge of the breadcrumb bar, not from this margin. */

html body .main-content {
	margin-top: 208px !important;
}

/* Align the breadcrumb text with the content column: the breadcrumb line was
   indented twice (content-header padding + its own padding). Keep only the
   header padding; +1px accounts for the sidebar border offset (270 vs 271). */

html body #doc-breadcrumbs {
	padding-left: 1px !important;
}
