/* sections.css — generated by bin/build-css.php from src/css/. Don't edit; edit the sources and rebuild. */

/* ── src/css/settings/_tokens.css ── */

/* ==========================================================================
   SETTINGS — design tokens
   Every token is prefixed --sections- so a site can override it, e.g.
   :root { --sections-offset: 4rem; }

   Colours are read from the shared names every one of my plugins and the
   site can set (--fg, --bg, --muted, --line, --accent). After the comma is
   what applies on a site that sets none of them.
   ========================================================================== */

:root {
	/* Colour */
	--sections-muted: var(--muted, #666);
	--sections-line: var(--line, #e5e5e5);
	--sections-accent: var(--accent, var(--core-color-accent, #0b5fff));
	--sections-surface: var(--bg, #fff);

	/* Space */
	--sections-space-m: 1rem;
	--sections-space-l: 1.5rem;
	--sections-space-xl: 3rem;

	/* Measures */
	--sections-offset: 0px;                   /* height of a fixed or sticky header that covers the top of every screen */
	--sections-lead: 0px;                     /* what the page has above the first section (an ordinary header); sections.js measures it */
	--sections-max-width: 40rem;              /* width of a section's content */
	--sections-dot-size: 0.625rem;
	--sections-dot-target: 1.75rem;           /* clickable area of a dot */

	/* Layer: the dots stay above the content */
	--sections-z-nav: 10;
}

/* ── src/css/components/_sections.css ── */

/* ==========================================================================
   COMPONENT — c-sections
   A column of full-screen sections that the browser snaps to while scrolling.

   - Only the page with sections snaps: html:has() (browsers since 2023);
     older ones scroll as usual.
   - `proximity`, not `mandatory`: a section taller than the screen (a long
     list on a phone) stays fully scrollable.
   - Smooth scrolling only for people who don't ask for less motion.
   - Whatever the page has above the first section (a header that scrolls
     away) is the "lead". The first section is that much shorter, so the first
     screen is complete, and it snaps to the top of the page, so the header
     is not scrolled away on load. sections.js measures the lead and adds
     c-sections--lead; without it the first section simply doesn't snap.
   ========================================================================== */

html:has(.c-sections) {
	scroll-snap-type: y proximity;
	scroll-padding-top: var(--sections-offset);
}

@media (prefers-reduced-motion: no-preference) {
	html:has(.c-sections) {
		scroll-behavior: smooth;
	}
}

.c-sections__section {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: calc(100vh - var(--sections-offset));          /* fallback */
	min-height: calc(100svh - var(--sections-offset));
	padding: var(--sections-space-xl) var(--sections-space-l);
	scroll-snap-align: start;
	scroll-snap-stop: normal;
}

@supports (height: 100dvh) {
	.c-sections__section {
		min-height: calc(100dvh - var(--sections-offset));
	}
}

.c-sections__section:first-of-type {
	min-height: calc(100vh - var(--sections-offset) - var(--sections-lead));
	min-height: calc(100svh - var(--sections-offset) - var(--sections-lead));
	scroll-snap-align: none;
}

@supports (height: 100dvh) {
	.c-sections__section:first-of-type {
		min-height: calc(100dvh - var(--sections-offset) - var(--sections-lead));
	}
}

.c-sections--lead .c-sections__section:first-of-type {
	scroll-snap-align: start;
	scroll-margin-top: var(--sections-lead);
}

.c-sections__inner {
	box-sizing: border-box;
	width: 100%;
	max-width: var(--sections-max-width);
	margin-inline: auto;
}

/* room for the dots at the right edge, so content never sits below them */
@media (min-width: 40.0625rem) {
	.c-sections__section {
		padding-inline: calc(var(--sections-dot-target) + var(--sections-space-l));
	}
}

/* room for the dots at the bottom on a phone */
@media (max-width: 40rem) {
	.c-sections__section {
		padding-block-end: calc(var(--sections-space-xl) + var(--sections-dot-target));
	}
}

/* ── src/css/components/_sections-nav.css ── */

/* ==========================================================================
   COMPONENT — c-sections__nav
   The dots: a column at the right edge, a row at the bottom on a phone.
   The current section's dot is filled (set by sections.js with
   aria-current="true"). The text of a link is for screen readers only.
   ========================================================================== */

.c-sections__nav {
	position: fixed;
	z-index: var(--sections-z-nav);
	inset-block: 0;
	inset-inline-end: var(--sections-space-m);
	display: flex;
	align-items: center;
	pointer-events: none;                     /* only the dots take clicks */
}

.c-sections__dots {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
}

.c-sections__item {
	margin: 0;
	padding: 0;
	pointer-events: auto;
}

.c-sections__dot {
	position: relative;
	display: block;
	box-sizing: border-box;
	width: var(--sections-dot-target);
	height: var(--sections-dot-target);
	color: var(--sections-muted);
	text-decoration: none;
}

/* the dot itself is drawn, the link around it stays easy to hit */
.c-sections__dot::before {
	content: '';
	position: absolute;
	inset: 50% auto auto 50%;
	width: var(--sections-dot-size);
	height: var(--sections-dot-size);
	border: 2px solid currentColor;
	border-radius: 50%;
	background: transparent;
	transform: translate(-50%, -50%);
	transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}

.c-sections__dot:hover,
.c-sections__dot:focus-visible {
	color: var(--sections-accent);
}

.c-sections__dot:focus-visible {
	outline: 2px solid var(--sections-accent);
	outline-offset: -2px;
	border-radius: 50%;
}

.c-sections__dot[aria-current='true'] {
	color: var(--sections-accent);
}

.c-sections__dot[aria-current='true']::before {
	background: currentColor;
	transform: translate(-50%, -50%) scale(1.25);
}

@media (prefers-reduced-motion: reduce) {
	.c-sections__dot::before {
		transition: none;
	}
}

@media (max-width: 40rem) {
	.c-sections__nav {
		inset-block: auto var(--sections-space-m);
		inset-inline: 0;
		justify-content: center;
	}

	.c-sections__dots {
		flex-direction: row;
		border-radius: 999px;
		background: color-mix(in srgb, var(--sections-surface) 85%, transparent);
		pointer-events: auto;
	}
}

/* ── src/css/utilities/_sections-visually-hidden.css ── */

/* ==========================================================================
   UTILITY — u-sections-visually-hidden
   Text for screen readers only: the name of a dot.
   !important is fine here: a utility must always win.
   ========================================================================== */

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