/*
 * The summary of the page Chi sono as a radio dial (site:nav/dial), as the preview approved on 2026-11-21. On the
 * page's colour, between two lines; the scale of ticks, the stations in a row (sideways on a phone). The station of
 * the chapter being read lights up with its needle: each link follows the scroll timeline of its chapter
 * (--ado-c1 … --ado-c12, --ado-passioni: the chapters name them, the site's CSS shares them across the page).
 */

/* Held under the header while the chapters run (the user, 2026-11-21: "in un contenitore con il fixed"). */
.axyo-site-nav {
	--section-bg: var(--color-background);
	position: sticky;
	top: var(--axyo-top, 0);
	z-index: 20;
	background-color: var(--color-background);
	border-block: 1px solid var(--section-line);
	container-type: inline-size;
}

.axyo-site-nav.axyo-site-nav { padding-block: 0.5em 0.8em; }

.axyo-site-nav .dial::before {
	content: '';
	display: block;
	height: 1.4em;
	border-bottom: 1px solid var(--section-line);
	background: repeating-linear-gradient(90deg, var(--section-line) 0 1px, transparent 1px 0.75em);
	-webkit-mask: linear-gradient(90deg, transparent, var(--section-fg) 4%, var(--section-fg) 96%, transparent);
	mask: linear-gradient(90deg, transparent, var(--section-fg) 4%, var(--section-fg) 96%, transparent);
}

.axyo-site-nav .dial ol {
	display: grid;
	grid-template-columns: repeat(13, minmax(0, 1fr));
	margin: -2.1em 0 0;
	padding: 2.6em 0 0;
	list-style: none;
}

.axyo-site-nav .dial li { position: relative; }

.axyo-site-nav .dial a {
	display: block;
	padding: 0.2em 0.4em 0.2em 0;
	overflow: hidden;
	font-size: 0.8125em;
	font-weight: 500;
	color: var(--section-muted);
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
	transition: color 0.25s;
}

/* The bar lives inside the room the page keeps free above an anchor (scroll-padding): without this every Tab on a
   station pushes the page up to bring the station under that room. */
.axyo-site-nav .dial a {
	scroll-margin-top: calc(-1 * (var(--axyo-top, 0rem) + 7rem));
	scroll-margin-bottom: calc(var(--axyo-top, 0rem) + 7rem);
}

.axyo-site-nav .dial-n { display: block; font: 500 0.85em ui-monospace, monospace; opacity: 0.8; }
.axyo-site-nav .dial a:is(:hover, :focus-visible) { color: var(--section-fg); }

/* The needle: a dot and a line from the scale down to the station. */
.axyo-site-nav .dial a::before {
	content: '';
	position: absolute;
	left: 0;
	bottom: calc(100% - 0.4em);
	width: 0.65em;
	height: 2.6em;
	background:
		radial-gradient(circle at 50% 0.32em, var(--section-accent) 0.28em, transparent 0.31em),
		linear-gradient(var(--section-accent), var(--section-accent)) 50% 0 / 2px 100% no-repeat;
	opacity: 0;
	pointer-events: none;
}

@container (max-width: 56em) {
	.axyo-site-nav .dial ol { display: flex; gap: 1.6em; overflow-x: auto; scrollbar-width: none; }
	.axyo-site-nav .dial a { overflow: visible; }
}

/* The station of the chapter on screen: from when its top passes the middle of the screen to when its bottom does. */
@media (prefers-reduced-motion: no-preference) {
	@supports (animation-timeline: view()) {
		/* :where() keeps these lighter than the lines below, which give each station its chapter's timeline. */
		.axyo-site-nav :where(.dial a) { animation: nav-on linear none; animation-range: entry 50% exit 50%; }
		.axyo-site-nav :where(.dial a)::before { animation: nav-needle linear none; animation-range: entry 50% exit 50%; }
		.axyo-site-nav .dial-to-c1, .axyo-site-nav .dial-to-c1::before { animation-timeline: --ado-c1; }
		.axyo-site-nav .dial-to-c2, .axyo-site-nav .dial-to-c2::before { animation-timeline: --ado-c2; }
		.axyo-site-nav .dial-to-c3, .axyo-site-nav .dial-to-c3::before { animation-timeline: --ado-c3; }
		.axyo-site-nav .dial-to-c4, .axyo-site-nav .dial-to-c4::before { animation-timeline: --ado-c4; }
		.axyo-site-nav .dial-to-c5, .axyo-site-nav .dial-to-c5::before { animation-timeline: --ado-c5; }
		.axyo-site-nav .dial-to-c6, .axyo-site-nav .dial-to-c6::before { animation-timeline: --ado-c6; }
		.axyo-site-nav .dial-to-c7, .axyo-site-nav .dial-to-c7::before { animation-timeline: --ado-c7; }
		.axyo-site-nav .dial-to-c8, .axyo-site-nav .dial-to-c8::before { animation-timeline: --ado-c8; }
		.axyo-site-nav .dial-to-c9, .axyo-site-nav .dial-to-c9::before { animation-timeline: --ado-c9; }
		.axyo-site-nav .dial-to-c10, .axyo-site-nav .dial-to-c10::before { animation-timeline: --ado-c10; }
		.axyo-site-nav .dial-to-c11, .axyo-site-nav .dial-to-c11::before { animation-timeline: --ado-c11; }
		.axyo-site-nav .dial-to-passioni, .axyo-site-nav .dial-to-passioni::before { animation-timeline: --ado-passioni; }
		.axyo-site-nav .dial-to-c12, .axyo-site-nav .dial-to-c12::before { animation-timeline: --ado-c12; }
	}
}

@keyframes nav-on { from, to { color: var(--section-fg); font-weight: 600; } }
@keyframes nav-needle { from, to { opacity: 1; } }

/* With the site's script (assets/tuner.js) the station is the one it marks: also between two chapters, with less
   movement and where the browser has no scroll timelines. The timelines above stay for a page without scripts. */
.axyo-site-nav .dial:has(a[aria-current]) li > a,
.axyo-site-nav .dial:has(a[aria-current]) li > a::before { animation: none; }
.axyo-site-nav .dial li > a[aria-current] { color: var(--section-fg); font-weight: 600; }
.axyo-site-nav .dial li > a[aria-current]::before { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
	.axyo-site-nav * { animation: none; }
}
