/* CLAUDE #635: the edit pages' question index (forms/question-index.js; owner, 2026-11-09: "When editing an existing listing, show a question
   index on the side, to allow for quickly going to a particular question"), in the forms' colors: the link blue, and the yellow accent marking
   the question in view, as the nav marks the current tab. Where the margin left of the form (1024px wide, centered) has room, it stays there
   as the form scrolls, scrolling itself when it's long; narrower, a Questions button (the forms' outlined button) opens it over the form */

main form fieldset {
	scroll-margin-top: calc(var(--app-bar-h, 0px) + 1rem); /* a chosen question stops a little below the top. CLAUDE #881: below Break Legs' bar (app-nav.css) */
}

/* CLAUDE #881: on the form's right (owner: "The index on editor forms no longer works. Move it to the right side of the form"; it was in the
   margin left of the centered form, which the sidebar covers now, and the form is at the left, beside it), under Break Legs' bar: where the
   window has room right of the form (1024px wide, after the sidebar while it shows), it stays there as the form scrolls; narrower, the
   Questions button opens it along the form's left edge, over its questions' legends (owner: "When there isn't enough room to expand the index,
   put it along the left edge of the form, where the question legends are"; was over the form's right side, its answers) */
nav.question_index {
	position: fixed;
	top: var(--app-bar-h, 0px);
	bottom: 0;
	left: 0;
	z-index: 20; /* over the form; under Break Legs' menus (app-nav.css) */
	display: none;
	box-sizing: border-box;
	width: min(20rem, 85%);
	padding: 1rem 1rem 4.5rem; /* clear of the button */
	overflow-y: auto;
	overscroll-behavior: contain;
	border-right: 1px solid var(--horizontalRuleColor, #888);
	background-color: var(--backgroundColor, #111);
	box-shadow: 0 0 1rem rgba(0, 0, 0, 0.6);
	font-family: "Barlow Semi Condensed", Barlow, sans-serif;
	font-size: 1rem;
	line-height: 1.3;
}

nav.question_index.open {
	display: block;
}

nav.question_index h2 {
	margin: 0 0 0.5rem;
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
}

nav.question_index ol {
	margin: 0;
	padding: 0;
	list-style: none;
}

nav.question_index a,
nav.question_index a:link,
nav.question_index a:visited {
	display: block;
	padding: 0.2rem 0 0.2rem 0.6rem;
	border: 0; /* the sites' links' underline border, as the forms' nav removes it (form-chrome.css) */
	border-left: 2px solid transparent;
	color: var(--link-color);
	text-decoration: none;
}

nav.question_index a:hover {
	text-decoration: underline;
}

nav.question_index a[aria-current] {
	border-left-color: var(--accent-color);
	color: #fff;
}

button.question_index_toggle {
	display: block;
	position: fixed;
	left: 1rem; /* CLAUDE #881: at the form's left, under the list it opens (was the window's right) */
	bottom: 1rem;
	z-index: 21;
	width: auto; /* the forms' buttons are full width (submit.css) */
	background-color: var(--backgroundColor, #111);
}

/* the form's left edge is after the sidebar while it shows (desktop and iPad: app-nav.css) */
@media (min-width: 768px) {
	html.app-apple.app-sidebar-open nav.question_index {
		left: var(--app-sidebar-w, 0px);
	}

	html.app-apple.app-sidebar-open button.question_index_toggle {
		left: calc(var(--app-sidebar-w, 0px) + 1rem);
	}
}

/* CLAUDE #904: without the sidebar the form is centered (app-nav.css; owner, 2026-11-16), so its left edge is half the window's room left of
   it: there the Questions list opens, and its button sits */
@media (min-width: 1024px) {
	html:not(.app-sidebar-open) nav.question_index {
		left: calc(50% - 512px);
	}

	html:not(.app-sidebar-open) button.question_index_toggle {
		left: calc(50% - 512px + 1rem);
	}
}

/* room right of the form: beside it, always (13rem at least; the sidebar's 16rem while it shows), starting where the form ends (owner: "The
   index should start where the form ends"; the form is 1024px wide, after the sidebar while it shows) */
/* CLAUDE #904: without the sidebar, the centered form ends at half the window plus 512px, so there's room from 1440px (was 1232px, the form
   at the left) */
@media (min-width: 1440px) {
	html:not(.app-sidebar-open) nav.question_index {
		display: block;
		right: auto;
		left: calc(50% + 512px);
		width: calc(50% - 512px);
		max-width: 18rem;
		padding-bottom: 1rem;
		border: 0;
		background: none;
		box-shadow: none;
	}

	html:not(.app-sidebar-open) button.question_index_toggle {
		display: none;
	}
}

@media (min-width: 1488px) {
	html.app-apple.app-sidebar-open nav.question_index { /* as the rule above it names it, so this one wins */
		display: block;
		right: auto;
		left: calc(var(--app-sidebar-w, 0px) + 1024px);
		width: calc(100% - var(--app-sidebar-w, 0px) - 1024px);
		max-width: 18rem;
		padding-bottom: 1rem;
		border: 0;
		background: none;
		box-shadow: none;
	}

	html.app-apple.app-sidebar-open button.question_index_toggle {
		display: none;
	}
}

@media print {
	nav.question_index,
	button.question_index_toggle {
		display: none;
	}
}
