/* 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 the header that stays at the top; sections.js measures it */
	--sections-header-height: 3.5rem;         /* the guess for it on a page without JavaScript */
	--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;
	--sections-z-header: 20;
}

/* ── 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. Snapping starts when sections.js has
     measured the header (c-sections--ready); without JavaScript the page
     scrolls normally.
   - `mandatory` with `scroll-snap-stop: always`: one flick moves one
     section, a fast flick can't skip one. (`proximity`, 0.1.0, only snaps
     when you stop very close to a section start, so it felt as if nothing
     snapped.) A section taller than the screen stays fully scrollable: the
     browser lets you scroll freely inside a snap area larger than the screen.
   - Smooth scrolling only for people who don't ask for less motion.
   - The footer is a snap target at the end of the page (see the end of this
     file), else `mandatory` would keep it out of reach.
   - Header: a header marked data-sections-header stays at the top
     (c-sections--fixed, see _sections-header.css); every section is then the
     screen minus the header, and snaps right below it.
   - Without such a header, 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. Snapping itself only starts when
     the script has added c-sections--ready (below), so without JavaScript
     nothing snaps.
   ========================================================================== */

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

/* The snapping switches on when sections.js says c-sections--ready: the script
   has measured the header by then, and snapping while the sections still change
   height makes the browser jump to a section. Without JavaScript the page scrolls
   normally and the dots are ordinary links. */
html:has(.c-sections.c-sections--ready) {
	scroll-snap-type: y mandatory;
}

@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: always;
}

@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);
}

/* a fixed header: the first section snaps like the others, right below it */
.c-sections--fixed .c-sections__section:first-of-type {
	scroll-snap-align: start;
}

.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));
	}
}

/* The footer below the last section is a snap target at the end of the page.
   Without it `mandatory` would never let you scroll far enough to see it.
   A footer directly in <body>, or marked data-sections-footer. */
html:has(.c-sections) :is(body > footer, [data-sections-footer]) {
	scroll-snap-align: end;
}

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

/* ==========================================================================
   COMPONENT — the header of a page with sections
   A header marked data-sections-header (the attribute is yours to set, or
   sections.js sets it on the first <header> or <nav> directly in <body>)
   stays at the top while the sections scroll under it. The attribute does
   nothing on a page without sections.

   - position: sticky, so the header keeps its place in the flow: at the top of
     the page it is simply above the first section. It needs a parent as high
     as the page (<body> is); sections.js checks that and gives up if not.
   - The header's height is --sections-offset: every section is the screen
     minus the header and snaps right below it. sections.js measures it
     (also when it wraps on a phone); the value here is the guess for a
     page without JavaScript.
   - A thin line instead of a border, so the header's height doesn't change.
   ========================================================================== */

html:has(.c-sections):has([data-sections-header]) {
	--sections-offset: var(--sections-header-height);
}

html:has(.c-sections) [data-sections-header] {
	position: sticky;
	top: 0;
	z-index: var(--sections-z-header);
	background: var(--sections-surface);
	box-shadow: 0 1px 0 var(--sections-line);
}

/* ── 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: var(--sections-offset) 0;      /* centred below the header */
	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;
}
