/* Override the block-editor-applied `top: 0` on the sticky sidebar column. */
.wp-block-column:has(.omg-post-nav) {
	top: calc(var(--omg-header-height, 88px) + 58px) !important;
}

.omg-post-nav {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--space-32);
}

/*
 * Double class selector (0,2,0) so the title size beats theme.json's global
 * `:root :where(h2)` rule (0,1,0), which would otherwise force the H2 size.
 */
.omg-post-nav .omg-post-nav__title {
	margin: 0;
	flex-shrink: 0;
	font-family: var(--wp--preset--font-family--archivo);
	font-size: var(--wp--preset--font-size--h6);
	font-weight: 800;
	line-height: 1.4;
	color: var(--wp--preset--color--dark-blue);
}

.omg-post-nav__list {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--space-16);
	margin: 0;
	padding: 0;
	list-style: none;
}

.omg-post-nav__item {
	margin: 0;
	padding: 0;
}

.omg-post-nav__item.is-level-3 {
	padding-left: var(--wp--preset--spacing--space-16);
}

.omg-post-nav__link,
.omg-post-nav__text {
	display: block;
	position: relative;
	padding-left: var(--wp--preset--spacing--space-16);
	padding-right: var(--wp--preset--spacing--space-24);
	font-family: var(--wp--preset--font-family--inter);
	font-size: var(--wp--preset--font-size--body);
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: -0.32px;
	color: var(--wp--preset--color--dark-blue);
	text-decoration: none;
	opacity: 0.8;
	transition: opacity 0.2s ease;
}

.omg-post-nav__link:hover,
.omg-post-nav__link:focus {
	opacity: 1;
}

.omg-post-nav__item.is-active .omg-post-nav__link,
.omg-post-nav__item.is-active .omg-post-nav__text {
	font-weight: 700;
	opacity: 1;
}

.omg-post-nav__item.is-active .omg-post-nav__link::before,
.omg-post-nav__item.is-active .omg-post-nav__text::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 4px;
	border-radius: 4px;
	background-color: var(--wp--preset--color--primary);
}

.omg-post-nav__placeholder {
	margin: 0;
	font-family: var(--wp--preset--font-family--inter);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--dark-blue);
	opacity: 0.6;
}

.omg-post-nav__scroll {
	min-height: 0;
}

/* Fixed reading-progress bar across the top of the viewport. */
.omg-post-nav__top-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	height: 3px;
}

.omg-post-nav__top-progress-bar {
	width: 0;
	height: 100%;
	background-color: var(--wp--preset--color--primary);
	transition: width 0.1s linear;
}

/*
 * Offset the bar below the WordPress admin bar when it is present, matching
 * core's own fixed-toolbar heights: 32px by default, 46px at <=782px, and
 * scrolling away (so no offset needed) at <=600px.
 */
.admin-bar .omg-post-nav__top-progress {
	top: 32px;
}

@media screen and (max-width: 782px) {

	.admin-bar .omg-post-nav__top-progress {
		top: 46px;
	}
}

@media screen and (max-width: 600px) {

	.admin-bar .omg-post-nav__top-progress {
		top: 0;
	}
}

/* Reading progress card. Stays put; only the link list above it scrolls. */
.omg-post-nav__progress {
	flex-shrink: 0;
	padding: var(--wp--preset--spacing--space-16);
	border-radius: var(--wp--preset--spacing--space-8);
	background-color: var(--wp--preset--color--primary-tint-6);
}

.omg-post-nav__progress-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-bottom: var(--wp--preset--spacing--space-8);
	font-family: var(--wp--preset--font-family--inter);
}

.omg-post-nav__progress-label {
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 500;
	color: var(--wp--preset--color--dark-blue-tint-1);
}

.omg-post-nav__progress-value {
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 700;
	color: var(--wp--preset--color--dark-blue);
}

.omg-post-nav__progress-track {
	height: 5px;
	overflow: hidden;
	border-radius: 999px;
	background-color: var(--wp--preset--color--primary-tint-4);
}

.omg-post-nav__progress-fill {
	width: 0;
	height: 100%;
	border-radius: 999px;
	background-color: var(--wp--preset--color--primary);
	transition: width 0.1s linear;
}

/*
 * Bound the nav to the viewport so a long list scrolls inside its own
 * container instead of running past the fold. Scoped to 782px+ to match the
 * theme's sticky column (single.css, top: space-40). `--omg-post-nav-max` is
 * the tuning knob: it allows for the sticky top offset plus a matching bottom
 * gap, and absorbs the taxonomy-pills row that sits above the nav.
 */
@media (min-width: 782px) {

	.omg-post-nav {
		--omg-post-nav-max: calc(100vh - (var(--wp--preset--spacing--space-40) * 2));
		max-height: var(--omg-post-nav-max);
	}

	.omg-post-nav__scroll {
		flex: 1 1 auto;
		overflow-x: hidden;
		overflow-y: auto;
		padding-right: var(--wp--preset--spacing--space-8);
		margin-right: calc(var(--wp--preset--spacing--space-8) * -1);
		scrollbar-width: thin;
		scrollbar-color: var(--wp--preset--color--primary-tint-4) transparent;
	}

	.omg-post-nav__scroll::-webkit-scrollbar {
		width: 4px;
	}

	.omg-post-nav__scroll::-webkit-scrollbar-track {
		background: transparent;
	}

	.omg-post-nav__scroll::-webkit-scrollbar-thumb {
		border-radius: 4px;
		background-color: var(--wp--preset--color--primary-tint-4);
	}

	.omg-post-nav__scroll::-webkit-scrollbar-thumb:hover {
		background-color: var(--wp--preset--color--primary);
	}
}

