/* --- Contents Bar (tablets and mobiles) --- */

/*
 Above 1024px (Impreza's tablets breakpoint) the sidebar card shows the
 contents list, so the bar stays hidden.
*/
@media (min-width: 1025px) {
	.itx-contents-bar {
		display: none !important;
	}
}

/*
 Fixed directly under Impreza's sticky header (and the WP admin bar, when
 logged in). contents-bar.js overrides --itx-contents-bar-top with the
 header's actual bottom edge, which moves as the admin bar scrolls away on
 phones; this calc() is the starting value before the script runs. Parked behind the header with translateY(-100%) until the
 script adds .is-visible, so it slides down out of it. The visibility delay
 keeps it out of the tab order once it has slid away.

 z-index: below the header (so it slides out from behind it) while closed,
 and above the global UI overlay (9998) while its list is open.
*/
.itx-contents-bar {
	--itx-contents-bar-top: calc( var(--header-sticky-height, var(--header-height, 0px)) + var(--wp-admin--admin-bar--height, 0px) );
	position: fixed;
	top: var(--itx-contents-bar-top);
	right: 0;
	left: 0;
	z-index: 110;
	padding-right: var(--scrollbar-width, 0px);
	background: #fff;
	border-bottom: 1px solid var(--color-content-border, #e8e8e8);
	box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .15);
	transform: translateY(-100%);
	visibility: hidden;
	transition: transform .25s ease, visibility 0s linear .25s;
}

.itx-contents-bar.is-visible {
	transform: translateY(0);
	visibility: visible;
	transition: transform .25s ease;
}

.itx-contents-bar.is-open {
	z-index: 9999;
}

.itx-contents-bar__toggle {
	display: flex;
	align-items: center;
	gap: .75rem;
	width: 100%;
	min-height: 3rem;
	margin: 0;
	padding: .5rem 1.5rem;
	border: 0;
	background: none;
	color: var(--color-content-heading, #303030);
	font-size: .95rem;
	line-height: 1.3;
	text-align: left;
	cursor: pointer;
}

.itx-contents-bar__toggle:focus-visible {
	outline: 2px solid #000;
	outline-offset: -4px;
}

.itx-contents-bar__label {
	flex: 0 0 auto;
	/* Matches the site's eyebrow labels (.itx-eyebrow in css/elements.css). */
	color: var(--color-content-primary, #f27a21);
	font-size: .8125rem;
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
}

/* The section being read: one line, cut short with an ellipsis if long. */
.itx-contents-bar__current {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.itx-contents-bar__icon {
	flex: 0 0 auto;
	font-size: .85rem;
	transition: transform .2s ease;
}

.itx-contents-bar.is-open .itx-contents-bar__icon {
	transform: rotate(180deg);
}

/* Drop-down list. Scrolls on its own if it's taller than the screen. */
.itx-contents-bar__panel {
	max-height: calc( 100vh - var(--itx-contents-bar-top) - 5rem );
	max-height: calc( 100dvh - var(--itx-contents-bar-top) - 5rem );
	padding: .25rem 1.5rem 1rem;
	border-top: 1px solid var(--color-content-border, #e8e8e8);
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* Roomier tap targets than the sidebar card's list. */
.itx-contents-bar .itx-section-contents__item > a {
	display: block;
	padding: .6rem 0;
}

/* Locks page scroll behind the open list, as the other panels do. */
body.itx-contents-bar-is-open {
	overflow: hidden;
}

/*
 Section jumps land below the header and the bar, not under them. The bar
 is 3rem plus its 1px border. The "Let's talk" row had no offset before.
 The admin bar isn't added here: WordPress already sets scroll-padding-top
 on <html> to its height, so adding it again would count it twice.
*/
@media (max-width: 1024px) {
	.itx-section,
	.itx-related-content,
	#letsTalkAboutYourApplication {
		scroll-margin-top: calc( var(--header-sticky-height, var(--header-height, 0px)) + 3rem + 1px );
	}
}

@media (prefers-reduced-motion: reduce) {
	.itx-contents-bar,
	.itx-contents-bar.is-visible,
	.itx-contents-bar__icon {
		transition: none;
	}
}
