/* =========================================================================
 * Nav List 001 — Floating Chapters Menu
 *
 * A Details block fixed to the bottom left of the screen: the summary is a
 * paper pill, the list opens upward above it as a small card, numbered.
 * pattern.js marks the current chapter (`is-current`) and writes its name
 * into the pill (`.nav-list-001__now`).
 * ========================================================================= */

/* Above the page's sections, below the header's open mega panel (1000).
   Doubled class: the editor makes every block position: relative. In the
   editor it simply sits in the flow, where it can be edited. */
.nav-list-001.nav-list-001 {
	position: fixed;
	left: var(--header-gutter);
	bottom: var(--space-md);
	z-index: 950;
	margin: 0;
	font-size: var(--wp--preset--font-size--sm);
}

.editor-styles-wrapper .nav-list-001.nav-list-001 {
	position: relative;
	left: auto;
	bottom: auto;
	width: fit-content;
	/* On the left, under the logo, not centred like content: core's
	   constrained layout centres with !important, so this needs it too. */
	margin-inline: var(--header-gutter) auto !important;
	margin-block: var(--space-sm) !important;
}

/* It floats and takes no room, so the block after it gets no gap from it
   (the page's block gap would otherwise open a strip above the cover). */
.wp-block-post-content > .nav-list-001.nav-list-001 + * {
	margin-block-start: 0;
}

/* The pill. */
.nav-list-001 > summary {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	padding: var(--space-xs) var(--space-sm);
	border-radius: 999px;
	background: color-mix(in srgb, var(--color-background) 90%, transparent);
	backdrop-filter: blur(8px);
	color: var(--color-text);
	box-shadow: 0 10px 30px color-mix(in srgb, var(--color-ink-deep) 18%, transparent);
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	list-style: none;
	cursor: pointer;
	user-select: none;
	transition: box-shadow 0.3s ease;
}

.nav-list-001 > summary::-webkit-details-marker {
	display: none;
}

.nav-list-001 > summary:hover {
	box-shadow: 0 12px 34px color-mix(in srgb, var(--color-ink-deep) 26%, transparent);
}

.nav-list-001 > summary:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 3px;
}

/* A small chevron: points up when closed (the list opens upward). */
.nav-list-001 > summary::after {
	content: "";
	width: 0.4rem;
	height: 0.4rem;
	border-top: 1.5px solid currentColor;
	border-left: 1.5px solid currentColor;
	translate: 0 0.12rem;
	rotate: 45deg;
	transition: rotate 0.3s ease, translate 0.3s ease;
}

.nav-list-001[open] > summary::after {
	rotate: 225deg;
	translate: 0 -0.12rem;
}

/* The chapter you are in, after the word "Chapters". */
.nav-list-001__now {
	color: var(--color-muted);
	letter-spacing: 0.1em;
}

.nav-list-001__now::before {
	content: "· ";
}

/* The card: above the pill, opening upward. */
.nav-list-001 .nav-list-001__list.nav-list-001__list {
	position: absolute;
	left: 0;
	bottom: calc(100% + var(--space-xs));
	min-width: 14rem;
	margin: 0;
	padding: var(--space-xs);
	border-radius: var(--radius-lg);
	background: var(--color-background);
	box-shadow: 0 18px 50px color-mix(in srgb, var(--color-ink-deep) 22%, transparent);
	list-style: none;
	counter-reset: chapter;
}

.editor-styles-wrapper .nav-list-001 .nav-list-001__list.nav-list-001__list {
	position: static;
	margin-top: var(--space-xs);
}

@media (prefers-reduced-motion: no-preference) {
	.nav-list-001[open] .nav-list-001__list {
		animation: nav-list-001-open 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	}
}

@keyframes nav-list-001-open {
	from { opacity: 0; translate: 0 0.5rem; }
}

.nav-list-001__list li {
	margin: 0;
	counter-increment: chapter;
}

.nav-list-001__list a {
	display: flex;
	align-items: baseline;
	gap: var(--space-sm);
	padding: var(--space-xs) var(--space-sm);
	border-radius: var(--radius-sm);
	color: var(--color-text);
	text-decoration: none;
	transition: background-color 0.25s ease;
}

.nav-list-001__list a::before {
	content: counter(chapter, decimal-leading-zero);
	color: var(--color-muted);
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.08em;
}

.nav-list-001__list a:hover,
.nav-list-001__list a:focus-visible {
	background: color-mix(in srgb, var(--color-border) 35%, transparent);
	outline: none;
}

.nav-list-001__list li.is-current a {
	font-weight: 500;
}

.nav-list-001__list li.is-current a::before {
	color: var(--color-accent);
}

/* A phone: not shown. The page is read straight down there, and the pill
   covered the foot of every section. (The editor still shows it.) */
@media (max-width: 40rem) {
	body:not(.wp-admin) .nav-list-001.nav-list-001:not(.editor-styles-wrapper *) {
		display: none;
	}
}
