/* Page-level layout and nav motion that Bricks classes cannot express (page wrappers, :nth-child delays). Tokens: docs/design.md */

:root {
	--falb-nav-gutter: 15rem;
}

/* From 992px the nav is fixed on the right: content and footer never run under it. */
@media (min-width: 992px) {
	#brx-content,
	#brx-footer {
		padding-right: var(--falb-nav-gutter);
	}
}

@keyframes falb-nav-in {
	from {
		opacity: 0;
		transform: translateX(0.75rem);
	}
}

@keyframes falb-nav-rise {
	from {
		opacity: 0;
		transform: translateY(0.75rem);
	}
}

@media (prefers-reduced-motion: no-preference) {
	@media (min-width: 992px) {
		.falb-nav .brx-nav-nested-items > li {
			animation: falb-nav-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
		}
	}

	.falb-nav.brx-open .brx-nav-nested-items > li {
		animation: falb-nav-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	.falb-nav .brx-nav-nested-items > li:nth-child(2) { animation-delay: 0.04s; }
	.falb-nav .brx-nav-nested-items > li:nth-child(3) { animation-delay: 0.08s; }
	.falb-nav .brx-nav-nested-items > li:nth-child(4) { animation-delay: 0.12s; }
	.falb-nav .brx-nav-nested-items > li:nth-child(5) { animation-delay: 0.16s; }
	.falb-nav .brx-nav-nested-items > li:nth-child(6) { animation-delay: 0.2s; }
	.falb-nav .brx-nav-nested-items > li:nth-child(7) { animation-delay: 0.24s; }
}

/* The brand dot is the class's ::after: Bricks' text-link gap would split "FA" from it, and a class gap is
   only output on layout elements. */
.falb-brand {
	gap: 0;
}

/* Consent (socle module): tokens for consent.css, plus what the socle structure leaves to the site. */
.consent-placeholder,
.consent-dialog {
	--ip-consent-bg: var(--bg);
	--ip-consent-text: var(--neutral);
	--ip-consent-accent: var(--primary-d-1);
	--ip-consent-radius: 0;
	--ip-consent-space: var(--space-m);
}

.consent-placeholder button,
.consent-dialog button {
	letter-spacing: 0.04em;
	transition: background-color 0.2s;
}

.consent-dialog::backdrop {
	background: color-mix(in srgb, var(--neutral) 60%, transparent);
}

.consent-dialog__title {
	font-size: var(--text-xl);
}

/* Photo credit = the attachment caption (Bricks image markup): a small label, bottom right.
   A backing, not a text shadow: white text over a light photo is unreadable otherwise (text and label still give ~4:1 on white).
   Bricks sets pointer-events: none on the caption, which would kill a link to the photographer. */
.brxe-image .bricks-image-caption,
.falb-prose .wp-caption-text {
	inset: auto 0 0 auto;
	width: auto;
	padding: var(--space-2xs) var(--space-xs);
	background: color-mix(in srgb, var(--neutral) 65%, transparent);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	color: color-mix(in srgb, var(--bg) 85%, transparent);
	font-size: var(--text-xs);
	letter-spacing: 0.04em;
	line-height: 1.4;
	text-align: right;
	pointer-events: auto;
}

/* With a caption Bricks wraps the img in a figure that takes the element's classes: their object-fit
   lands on the figure while the img is stretched to 100% x 100%. */
.brxe-image.caption img {
	object-fit: inherit;
	object-position: inherit;
}

.brxe-image .bricks-image-caption a,
.falb-prose .wp-caption-text a {
	color: inherit;
	text-decoration: none;
}

.brxe-image .bricks-image-caption a:hover,
.brxe-image .bricks-image-caption a:focus-visible,
.falb-prose .wp-caption-text a:hover,
.falb-prose .wp-caption-text a:focus-visible {
	text-decoration: underline;
}

/* Media inserted in a wysiwyg field (project "Further text"). Bricks blocks align their children to
   flex-start: without width 100% a large image sizes the column past a phone screen. */
.falb-prose {
	display: flow-root;
	width: 100%;
}

.falb-prose img {
	display: block;
	max-width: 100%;
	height: auto;
}

/* WordPress' default caption box (white background, border, padding, 96% width) and its inline width go. */
.falb-prose .wp-caption {
	position: relative;
	max-width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	text-align: inherit;
}

.falb-prose .wp-caption img {
	max-width: 100%;
}

.falb-prose .wp-caption-text {
	position: absolute;
	margin: 0;
}

/* WordPress floats .alignleft at every width: on a phone the image stays in the flow. */
.falb-prose .alignleft,
.falb-prose .alignright {
	float: none;
	margin: 0 0 var(--space-s);
}

.falb-prose > * + .wp-caption {
	margin-top: var(--space-m);
}

.falb-prose .aligncenter {
	margin-inline: auto;
}

.falb-prose :is(h2, h3, h4, h5, h6) {
	clear: both;
}

@media (min-width: 768px) {
	.falb-prose .alignleft,
	.falb-prose .alignright {
		max-width: 50%;
	}

	.falb-prose .alignleft {
		float: left;
		margin-right: var(--space-m);
	}

	.falb-prose .alignright {
		float: right;
		margin-left: var(--space-m);
	}
}

/* Tracks (socle media player): same round button and rhythm as the video list. */
.ip-audio {
	--ip-media-accent: var(--primary-d-1);
	--ip-media-on-accent: var(--bg);
	--ip-media-line: var(--neutral-l-3);
	gap: var(--space-m);
	max-inline-size: none;
}

.ip-audio__toggle {
	inline-size: 2.75rem;
	block-size: 2.75rem;
	border-color: var(--primary);
}

.ip-audio__toggle svg {
	inline-size: 1.125rem;
	block-size: 1.125rem;
}

.ip-audio__title {
	font-family: Fraunces, serif;
	font-size: var(--text-m);
	color: var(--neutral);
}

/* The Bricks text element holding the list shrinks to its content in the flex section, unlike the videos list. */
.brxe-text:has(> .falb-tracks) {
	align-self: stretch;
}

.falb-tracks {
	margin: 0;
	padding: 0;
	list-style: none;
}

.falb-tracks__item {
	padding-block: var(--space-s);
	border-bottom: 1px solid var(--neutral-l-3);
}

.falb-prose .ip-audio,
.falb-prose video.ip-media-video {
	margin-block: var(--space-m);
}
