/**
 * ACB — stili applicativi.
 *
 * theme.json copre colori, tipografia e spaziature. Qui restano solo
 * layout, stati interattivi e accessibilità, che theme.json non esprime.
 */

/* -------------------------------------------------------------- Tema --- */

/*
 * Ruoli semantici. theme.json e i componenti puntano a queste variabili, non
 * ai colori della palette: così il tema scuro si ottiene ridefinendo i ruoli
 * in un solo punto.
 *
 * Alcuni colori della palette restano invece fissi in entrambe le modalità,
 * perché indicano un colore di marca e non un ruolo: `base` e `cyan` servono
 * da testo su fondo scuro nel footer e nella banda di invito, `navy` è quel
 * fondo scuro. Ribaltarli renderebbe illeggibili proprio quelle sezioni.
 */
:root {
	color-scheme: light;

	--acb-bg: #FBFAF7;
	--acb-surface: #FFFFFF;
	--acb-alt-bg: #F0EAE0;
	--acb-text: #101322;
	--acb-text-muted: #5A6072;
	--acb-heading: #0E1A4A;
	--acb-border: #D9E1EF;
	--acb-link: #1A56B0;
	--acb-link-hover: #0E1A4A;
	--acb-accent: #C4157E;

	--acb-button-bg: #0E1A4A;
	--acb-button-text: #FBFAF7;
	--acb-button-hover-bg: #1A56B0;
	--acb-button-hover-text: #FBFAF7;

	/* Bagliori ambientali ripresi dal materiale grafico dell'Associazione:
	   appena percettibili sul chiaro, protagonisti sullo scuro. */
	--acb-glow-violet: rgba(122, 63, 168, 0.07);
	--acb-glow-ember: rgba(176, 58, 14, 0.05);
	--acb-glow-marine: rgba(26, 86, 176, 0.06);
	--acb-glow-size: 46rem;

	--acb-shadow-soft: 0 1px 2px rgba(16, 19, 34, 0.04), 0 8px 24px rgba(16, 19, 34, 0.06);
}

/*
 * I valori della modalità scura sono ripetuti in due selettori: la media query
 * copre chi non ha ancora scelto, la regola su [data-theme] copre la scelta
 * esplicita fatta con l'interruttore. Tenendoli identici, le due strade
 * portano allo stesso risultato.
 */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;

		--acb-bg: #07123F;
		--acb-surface: #101B4D;
		--acb-alt-bg: rgba(242, 243, 247, 0.055);
		--acb-text: #F2F3F7;
		--acb-text-muted: #A9B2CE;
		--acb-heading: #F2F3F7;
		--acb-border: #2B3768;
		--acb-link: #8FC0F2;
		--acb-link-hover: #C6DEF8;
		--acb-accent: #E58BC4;

		--acb-button-bg: #F2F3F7;
		--acb-button-text: #07123F;
		--acb-button-hover-bg: #C08BE0;
		--acb-button-hover-text: #07123F;

		--acb-glow-violet: rgba(161, 104, 196, 0.30);
		--acb-glow-ember: rgba(224, 99, 44, 0.22);
		--acb-glow-marine: rgba(60, 100, 200, 0.20);

		--acb-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 28px rgba(0, 0, 0, 0.36);

		/* Preset che esprimono un ruolo e non un colore di marca: seguono il tema. */
		--wp--preset--color--surface: #101B4D;
		--wp--preset--color--sand: #0C1748;
		--wp--preset--color--mist: #2B3768;
		--wp--preset--color--muted: #A9B2CE;
		--wp--preset--color--marine: #8FC0F2;
		--wp--preset--color--magenta: #E58BC4;
		--wp--preset--color--violet: #C08BE0;
		--wp--preset--color--ember: #F0864F;
	}
}

:root[data-theme="dark"] {
	color-scheme: dark;

	--acb-bg: #07123F;
	--acb-surface: #101B4D;
	--acb-alt-bg: rgba(242, 243, 247, 0.055);
	--acb-text: #F2F3F7;
	--acb-text-muted: #A9B2CE;
	--acb-heading: #F2F3F7;
	--acb-border: #2B3768;
	--acb-link: #8FC0F2;
	--acb-link-hover: #C6DEF8;
	--acb-accent: #E58BC4;

	--acb-button-bg: #F2F3F7;
	--acb-button-text: #07123F;
	--acb-button-hover-bg: #C08BE0;
	--acb-button-hover-text: #07123F;

	--acb-glow-violet: rgba(161, 104, 196, 0.30);
	--acb-glow-ember: rgba(224, 99, 44, 0.22);
	--acb-glow-marine: rgba(60, 100, 200, 0.20);

	--acb-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 28px rgba(0, 0, 0, 0.36);

	--wp--preset--color--surface: #101B4D;
	--wp--preset--color--sand: #0C1748;
	--wp--preset--color--mist: #2B3768;
	--wp--preset--color--muted: #A9B2CE;
	--wp--preset--color--marine: #8FC0F2;
	--wp--preset--color--magenta: #E58BC4;
	--wp--preset--color--violet: #C08BE0;
	--wp--preset--color--ember: #F0864F;
}

/* Footer e banda di invito sono superfici scure in entrambe le modalità:
   i loro colori di testo restano quelli chiari. */
.acb-footer,
.acb-cta {
	--acb-text: #F2F3F7;
	--acb-text-muted: #A9B2CE;
	--acb-heading: #F2F3F7;
	--acb-link: var(--wp--preset--color--cyan);
	--acb-link-hover: #A8E0EF;
	--acb-border: rgba(242, 243, 247, 0.18);
	--acb-button-bg: var(--wp--preset--color--cyan);
	--acb-button-text: #07123F;
	--acb-button-hover-bg: #A8E0EF;
	--acb-button-hover-text: #07123F;
}

:root[data-theme="dark"] .acb-footer,
:root[data-theme="dark"] .acb-cta {
	/* Sullo scuro il footer scende sotto il fondo pagina, così resta distinto. */
	--wp--preset--color--navy: #040B2B;
	--wp--preset--color--navy-deep: #02061A;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .acb-footer,
	:root:not([data-theme="light"]) .acb-cta {
		--wp--preset--color--navy: #040B2B;
		--wp--preset--color--navy-deep: #02061A;
	}
}

/* ---------------------------------------------------------------- Base --- */

html {
	scroll-behavior: smooth;
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	font-optical-sizing: auto;
}

/* Il titolo usa l'asse ottico di Fraunces: più "display" quando è grande. */
h1,
h2,
.acb-hero__title {
	font-variation-settings: "SOFT" 0, "WONK" 0;
}

/* --------------------------------------------------------- Accessibilità --- */

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	position: fixed !important;
	top: 0.5rem;
	left: 0.5rem;
	z-index: 999;
	width: auto;
	height: auto;
	padding: 0.75rem 1.25rem;
	clip: auto;
	clip-path: none;
	background: var(--acb-button-bg);
	color: var(--acb-button-text);
	border-radius: var(--wp--custom--radius--md);
	font-size: var(--wp--preset--font-size--small);
	text-decoration: none;
}

/* Un anello di focus visibile e coerente su tutto il sito. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--acb-link);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Su fondo scuro il blu marino non si vedrebbe: usiamo il ciano. */
.acb-footer :where(a, button):focus-visible,
.acb-cta :where(a, button):focus-visible,
.wp-block-navigation__responsive-container.is-menu-open :where(a, button):focus-visible {
	outline-color: var(--wp--preset--color--cyan);
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* ------------------------------------------------------------- Header --- */

.acb-header {
	position: sticky;
	top: 0;
	z-index: 20;
	border-bottom: 1px solid var(--acb-border);
	backdrop-filter: saturate(1.4) blur(8px);
	background-color: color-mix(in srgb, var(--acb-bg) 88%, transparent);
}

.acb-header__title a {
	text-decoration: none;
}

.acb-header__brand {
	min-width: 0;
}

.acb-header .wp-block-site-logo img {
	border-radius: 50%;
}

.acb-header .wp-block-navigation a:where(:not(.wp-element-button)) {
	text-decoration: none;
	padding-block: 0.5rem;
	border-bottom: 2px solid transparent;
	transition: border-color var(--wp--custom--transition--base);
}

.acb-header .wp-block-navigation .current-menu-item > a,
.acb-header .wp-block-navigation a:hover {
	border-bottom-color: var(--acb-accent);
}

/* Nell'overlay mobile il bordo inferiore non serve. */
.wp-block-navigation__responsive-container.is-menu-open a {
	border-bottom: 0 !important;
	font-size: var(--wp--preset--font-size--large);
}

/* -------------------------------------------------- Selettore di lingua --- */

.acb-langswitch__list {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.acb-langswitch__link {
	display: grid;
	place-items: center;
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding-inline: 0.5rem;
	border-radius: var(--wp--custom--radius--pill);
	color: var(--acb-text-muted);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-decoration: none;
	transition: color var(--wp--custom--transition--base), background-color var(--wp--custom--transition--base);
}

.acb-langswitch__link:hover {
	color: var(--acb-heading);
	background-color: var(--acb-alt-bg);
}

.acb-langswitch__link.is-current {
	color: var(--acb-heading);
	background-color: var(--acb-border);
}

/* --------------------------------------------------------------- Hero --- */

.acb-hero__eyebrow,
.acb-eyebrow {
	margin-bottom: 0;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.acb-hero__title {
	max-width: 16ch;
	text-wrap: balance;
}

.acb-hero__lead {
	max-width: var(--wp--custom--measure--prose);
	text-wrap: pretty;
}

/* Il layout "constrained" di WordPress centra i figli con
   `margin-left/right: auto !important`. Per allineare a sinistra titolo e
   sommario non c'è alternativa a un !important pari grado: senza, la regola
   del core vince a prescindere dalla specificità. */
.wp-block-group.acb-hero.is-layout-constrained > *,
.wp-block-group.acb-blog__head.is-layout-constrained > *,
.wp-block-group.acb-catfilter.is-layout-constrained > * {
	margin-inline: 0 !important;
}

.acb-blog__head p {
	max-width: var(--wp--custom--measure--prose);
	text-wrap: pretty;
}

.acb-blog__head h1 {
	max-width: 20ch;
	text-wrap: balance;
}

/* -------------------------------------------------------------- Schede --- */

.acb-card {
	height: 100%;
}

.acb-card__media {
	overflow: hidden;
	border-radius: 10px;
	margin-bottom: 0;
}

.acb-card__media img {
	width: 100%;
	transition: transform 400ms cubic-bezier(0.2, 0, 0.2, 1);
}

.acb-card:hover .acb-card__media img {
	transform: scale(1.03);
}

.acb-card__title {
	text-wrap: balance;
}

.acb-card__title a {
	text-decoration: none;
}

.acb-card:hover .acb-card__title a {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.acb-card__excerpt {
	color: var(--acb-text-muted);
}

.acb-card__excerpt a {
	display: none; /* Il titolo è già il link: evitiamo un secondo "Leggi tutto". */
}

/* --------------------------------------------------- Filtro categorie --- */

.acb-catfilter__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.acb-catfilter__list li {
	margin: 0;
}

.acb-catfilter__list a {
	display: inline-flex;
	align-items: center;
	min-height: 2.5rem;
	padding: 0.35rem 1rem;
	border: 1px solid var(--acb-border);
	border-radius: var(--wp--custom--radius--pill);
	color: var(--acb-heading);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	text-decoration: none;
	transition: background-color var(--wp--custom--transition--base), border-color var(--wp--custom--transition--base);
}

.acb-catfilter__list a:hover {
	background-color: var(--acb-alt-bg);
	border-color: var(--acb-link);
}

/* ------------------------------------------------------------ Articolo --- */

.acb-article__meta {
	align-items: baseline;
	column-gap: 1rem;
}

.acb-article__cats {
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--acb-text-muted);
}

.acb-article__cats a {
	color: var(--acb-text-muted);
	text-decoration: none;
}

.acb-article__cats a:hover {
	color: var(--acb-link);
	text-decoration: underline;
}

.acb-article__lead {
	color: var(--acb-text-muted);
	text-wrap: pretty;
}

.acb-article__cover img {
	width: 100%;
	max-height: 70vh;
	object-fit: cover;
	border-radius: 12px;
}

.acb-article .wp-block-post-content > * + * {
	margin-block-start: var(--wp--preset--spacing--40);
}

.acb-article .wp-block-post-content h2 {
	margin-block-start: var(--wp--preset--spacing--60);
}

.acb-article .wp-block-post-content h3 {
	margin-block-start: var(--wp--preset--spacing--50);
}

.acb-article figcaption {
	text-align: center;
}

/* ---------------------------------------------------------- Condividi --- */

.acb-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	padding-block: var(--wp--preset--spacing--40);
	border-block: 1px solid var(--acb-border);
}

.acb-share__label {
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--acb-text-muted);
}

.acb-share__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.acb-share__link {
	display: inline-flex;
	align-items: center;
	min-height: 2.5rem;
	padding: 0.35rem 0.9rem;
	border: 1px solid var(--acb-border);
	border-radius: var(--wp--custom--radius--pill);
	font-size: var(--wp--preset--font-size--small);
	text-decoration: none;
	transition: background-color var(--wp--custom--transition--base);
}

.acb-share__link:hover {
	background-color: var(--acb-alt-bg);
}

/* --------------------------------------------------------- Correlati --- */

.acb-related {
	padding-top: var(--wp--preset--spacing--60);
	border-top: 1px solid var(--acb-border);
}

.acb-related__heading {
	margin-bottom: var(--wp--preset--spacing--50);
	font-size: var(--wp--preset--font-size--x-large);
}

.acb-related__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
	gap: var(--wp--preset--spacing--50);
	margin: 0;
	padding: 0;
	list-style: none;
}

.acb-related__link {
	display: grid;
	gap: 0.6rem;
	text-decoration: none;
	color: inherit;
}

.acb-related__media {
	display: block;
	overflow: hidden;
	border-radius: 10px;
	aspect-ratio: 4 / 3;
}

.acb-related__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 400ms cubic-bezier(0.2, 0, 0.2, 1);
}

.acb-related__link:hover .acb-related__media img {
	transform: scale(1.03);
}

.acb-related__date {
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--acb-accent);
}

.acb-related__title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.2;
	color: var(--acb-heading);
	text-wrap: balance;
}

.acb-related__link:hover .acb-related__title {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.acb-related--placeholder {
	padding: var(--wp--preset--spacing--40);
	border: 1px dashed var(--acb-border);
	border-radius: var(--wp--custom--radius--md);
}

/* ---------------------------------------------------------- Home/varie --- */

.acb-latest__head {
	align-items: baseline;
	gap: var(--wp--preset--spacing--30);
}

.acb-latest__all {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.acb-latest__all a {
	text-decoration: none;
}

.acb-latest__all a:hover {
	text-decoration: underline;
}

.acb-mission {
	background-color: var(--acb-alt-bg);
}

.acb-mission__grid h3 {
	padding-top: var(--wp--preset--spacing--30);
	border-top: 2px solid var(--acb-link);
}

.wp-block-group.acb-cecilia.is-layout-constrained > * {
	margin-inline: 0 !important;
}

.acb-cecilia__title {
	max-width: 20ch;
}

.acb-cecilia__text {
	max-width: var(--wp--custom--measure--prose);
	text-wrap: pretty;
}

/* ------------------------------------------------------ Stili di blocco --- */

.wp-block-button.is-style-outline-navy .wp-block-button__link {
	background-color: transparent;
	color: var(--acb-heading);
	border: 1.5px solid currentColor;
}

.wp-block-button.is-style-outline-navy .wp-block-button__link:hover {
	background-color: var(--acb-button-bg);
	color: var(--acb-button-text);
}

.acb-footer .wp-block-button.is-style-outline-navy .wp-block-button__link,
.acb-cta .wp-block-button.is-style-outline-navy .wp-block-button__link {
	color: var(--acb-text);
	border-color: var(--wp--preset--color--cyan);
}

.wp-block-group.is-style-card {
	padding: var(--wp--preset--spacing--40);
	background-color: var(--acb-surface);
	border: 1px solid var(--acb-border);
	border-radius: var(--wp--custom--radius--lg);
	box-shadow: var(--acb-shadow-soft);
}

.wp-block-image.is-style-framed img {
	border: 1px solid var(--acb-border);
	border-radius: var(--wp--custom--radius--lg);
	box-shadow: var(--acb-shadow-soft);
}

.wp-block-list.is-style-checklist {
	list-style: none;
	padding-left: 0;
}

.wp-block-list.is-style-checklist li {
	position: relative;
	padding-left: 1.75rem;
	margin-bottom: 0.6rem;
}

.wp-block-list.is-style-checklist li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.55em;
	width: 0.7rem;
	height: 0.7rem;
	border-radius: 50%;
	background: var(--acb-link);
}

/* --------------------------------------------------------------- Footer --- */

.acb-footer__title a {
	text-decoration: none;
}

.acb-footer__contacts {
	line-height: 2;
	word-break: break-word;
}

.acb-footer__legal {
	gap: var(--wp--preset--spacing--30);
}

.acb-footer__legal p {
	margin: 0;
	color: var(--acb-text-muted);
}

.acb-cta__lead {
	color: var(--acb-text-muted);
}

/* --------------------------------------------------------------- Mobile --- */

@media (max-width: 781px) {
	.acb-header {
		position: static;
	}

	.acb-header__title {
		font-size: var(--wp--preset--font-size--medium);
	}

	.acb-article__cover img {
		max-height: 55vh;
	}

	.acb-share {
		align-items: flex-start;
		flex-direction: column;
	}
}

@media (max-width: 480px) {
	.acb-header .wp-block-site-logo img {
		width: 40px;
	}
}

/* ------------------------------------------------------ Bagliori di fondo --- */

/*
 * Le grafiche dell'Associazione hanno grandi aloni sfumati — viola, arancio
 * caldo, blu — che affiorano dal blu notte. Qui sono uno strato fisso dietro
 * tutta la pagina, non un riquadro dentro una sezione: dentro una sezione i
 * gradienti verrebbero tagliati e si vedrebbe lo spigolo.
 *
 * Sono quasi impercettibili sul chiaro e riconoscibili sullo scuro.
 */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background:
		radial-gradient(60rem 46rem at 84% -10%, var(--acb-glow-violet), transparent 70%),
		radial-gradient(44rem 38rem at -8% 2%, var(--acb-glow-ember), transparent 66%),
		radial-gradient(52rem 44rem at 24% 98%, var(--acb-glow-marine), transparent 72%);
}

/* Le sezioni a fondo pieno hanno il proprio alone, che resta dentro i loro
   bordi perché occupano tutta la larghezza della finestra. */
.acb-cta,
.acb-footer {
	position: relative;
	isolation: isolate;
}

.acb-cta::before,
.acb-footer::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
}

/* Nella banda di invito l'alone caldo entra dall'alto a sinistra, come nella
   grafica "Chi siamo". */
.acb-cta::before {
	background:
		radial-gradient(34rem 34rem at 6% -20%, var(--acb-glow-ember), transparent 66%),
		radial-gradient(40rem 40rem at 96% 120%, var(--acb-glow-violet), transparent 70%);
}

.acb-footer::before {
	background: radial-gradient(44rem 44rem at 100% 0%, var(--acb-glow-violet), transparent 72%);
}

/* --------------------------------------------------- Interruttore tema --- */

.acb-themetoggle {
	display: inline-flex;
}

.acb-themetoggle__button {
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	border: 1px solid transparent;
	border-radius: var(--wp--custom--radius--pill);
	background: none;
	color: var(--acb-text-muted);
	cursor: pointer;
	transition: color var(--wp--custom--transition--base),
		background-color var(--wp--custom--transition--base),
		border-color var(--wp--custom--transition--base);
}

.acb-themetoggle__button:hover {
	color: var(--acb-heading);
	background-color: var(--acb-alt-bg);
	border-color: var(--acb-border);
}

.acb-themetoggle__button svg {
	width: 1.25rem;
	height: 1.25rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/*
 * Si mostra sempre l'icona della destinazione: le onde quando si è sulla
 * spiaggia, il sole sull'orizzonte quando si è in mare. Il display va
 * dichiarato solo qui: una regola generica `svg { display: block }` avrebbe
 * specificità maggiore e terrebbe visibili entrambe le icone.
 */
.acb-themetoggle__icon--sea {
	display: block;
}

.acb-themetoggle__icon--beach {
	display: none;
}

:root[data-theme="dark"] .acb-themetoggle__icon--sea {
	display: none;
}

:root[data-theme="dark"] .acb-themetoggle__icon--beach {
	display: block;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .acb-themetoggle__icon--sea {
		display: none;
	}

	:root:not([data-theme="light"]) .acb-themetoggle__icon--beach {
		display: block;
	}
}

/* Sullo scuro le fotografie molto luminose stancano meno con un filo di
   contrasto in meno. */
:root[data-theme="dark"] .acb-card__media img,
:root[data-theme="dark"] .acb-related__media img,
:root[data-theme="dark"] .acb-article__cover img {
	filter: brightness(0.94) saturate(1.02);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .acb-card__media img,
	:root:not([data-theme="light"]) .acb-related__media img,
	:root:not([data-theme="light"]) .acb-article__cover img {
		filter: brightness(0.94) saturate(1.02);
	}
}

/* ------------------------------------------------------ Passaggio a onda --- */

/*
 * Il cambio fra chiaro e scuro è raccontato come il passaggio dalla spiaggia
 * al mare: un'onda sale dal basso, copre la pagina, il tema cambia al riparo e
 * l'onda esce dall'alto.
 *
 * Il livello è più alto della finestra di quanto misura la cresta, così a
 * riposo resta interamente fuori campo e a fine risalita il corpo copre tutto
 * lo schermo senza lasciare trasparire la pagina sotto la cresta.
 */
.acb-wave {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 9999;
	pointer-events: none;
	transform: translateY(100%);
	will-change: transform;
}

.acb-wave__body {
	position: absolute;
	/* Due pixel sotto i 96 della cresta (valore CREST in view.js): la
	   sovrapposizione evita la linea chiara che l'antialiasing lascia
	   sulla giunzione fra SVG e riquadro. */
	top: 94px;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--acb-wave-body);
}

.acb-wave__crest {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 200%;
	animation: acb-wave-drift 3.4s linear infinite;
}

.acb-wave__fill {
	fill: var(--acb-wave-crest);
}

.acb-wave__foam {
	fill: none;
	stroke: var(--acb-wave-foam);
	stroke-width: 3;
	stroke-linecap: round;
	vector-effect: non-scaling-stroke;
}

/* La cresta contiene due cicli identici: scorrendo di metà larghezza il
   disegno si ripete e il movimento non ha stacchi. */
@keyframes acb-wave-drift {
	from {
		transform: translateX(0);
	}

	to {
		transform: translateX(-50%);
	}
}

/* Verso il mare: il blu notte del fondo, con la schiuma chiara sulla cresta. */
.acb-wave--to-sea {
	--acb-wave-body: linear-gradient(180deg, #16265F 0%, #07123F 55%);
	--acb-wave-crest: #16265F;
	--acb-wave-foam: rgba(226, 236, 255, 0.8);
}

/* Verso la spiaggia: la sabbia, con la schiuma bianca del bagnasciuga. */
.acb-wave--to-beach {
	--acb-wave-body: linear-gradient(180deg, #F8F2E7 0%, #EDE3D2 100%);
	--acb-wave-crest: #F8F2E7;
	--acb-wave-foam: rgba(255, 255, 255, 0.95);
}

@media (prefers-reduced-motion: reduce) {
	.acb-wave__crest {
		animation: none;
	}
}
