/**
 * Base element styles.
 *
 * Document-level defaults: body, links, focus, selection, reduced motion.
 * Heading/paragraph/measure treatment lives in typography.css instead —
 * this file is about document behaviour, not the type scale.
 *
 * Brand look: paper-grey page, ink text, navy links (Figma Foundations).
 */

html {
	/* Native smooth anchor scrolling for touch / reduced-motion-off devices
	   where Lenis is not created; Lenis takes over on desktop pointers
	   (html.lenis resets this, see below). Disabled for reduced motion. */
	scroll-behavior: smooth;
	/* Anchor / focus offset below the sticky header (motion-spec §3.3): 64 + 24
	   on mobile, 84 + 24 = 108 on desktop (same as the sticky TOC top). The cookie
	   banner raises scroll-padding-bottom while it is visible (WCAG 2.4.11). */
	scroll-padding-top: calc(var(--sf-header-height-mobile) + 1.5rem);
	scroll-padding-bottom: var(--sf-consent-offset, 0px);
}

@media (min-width: 64em) {
	html {
		scroll-padding-top: calc(var(--sf-header-height-desktop) + 1.5rem);
	}
}

/* Orders/checkout use the compact header, no top bar: keep it consistent. */
body.sf-no-topbar {
	--sf-topbar-height: 0px;
}

body {
	/* 320px is the minimum supported viewport (see SF-TASK-02 report) —
	   this is a floor for layout sanity, not a horizontal-overflow fix.
	   Overflow-x:hidden is deliberately never used as a blanket patch;
	   overflow must be prevented by correct component layout. */
	min-width: 20rem;
	background: var(--sf-color-bg);
	color: var(--sf-color-text);
	font-family: var(--sf-font-sans);
	font-size: var(--sf-text-base);
	line-height: var(--sf-leading-body);
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/*
 * Link foundation. Colour alone never carries the affordance — the default
 * underline (typography.css sets weight/offset) stays on. Hover changes
 * decoration thickness/colour rather than introducing a brand accent.
 */
a {
	color: var(--sf-color-link);
	text-decoration-color: currentcolor;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	transition:
		color var(--sf-duration-fast) var(--sf-ease-standard),
		text-decoration-color var(--sf-duration-fast) var(--sf-ease-standard);
}

a:hover {
	color: var(--sf-color-link-hover);
	text-decoration-color: transparent; /* Figma Text Link: underline leaves on hover */
}

/*
 * Never remove focus outlines globally. `:focus-visible` gives keyboard
 * users a clear indicator while staying out of the way for mouse/touch
 * interaction, without hiding focus altogether.
 */
:focus {
	outline: 2px solid transparent;
}

:focus-visible {
	outline: 2px solid var(--sf-color-focus);
	outline-offset: 2px;
}

::selection {
	background: var(--sf-color-action);
	color: var(--sf-color-on-action);
}

/*
 * Reduced motion. The Motion tokens (tokens.css) switch to their Reduced
 * mode in one place, so every transition in the theme becomes a fade of
 * 150ms at most with no displacement; the block below is only the safety
 * net for ANIMATIONS (keyframes) and the scroll behaviour. It deliberately
 * no longer zeroes `transition-duration`, which would also kill the fades
 * the reduced mode keeps (motion-spec §2.3).
 * assets/js/core/motion.js mirrors the preference onto
 * `<html class="has-reduced-motion">` for JS and updates it live.
 */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

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

/* -------------------------------------------------------------------
 * Lenis 1.3.27 base CSS (dist/lenis.css, MIT) — inlined so it costs no
 * extra request. Only matters while Lenis is running (html.lenis).
 * ----------------------------------------------------------------- */
html.lenis,
html.lenis body {
	height: auto;
}

html.lenis {
	scroll-behavior: auto;
}

.lenis:not(.lenis-autoToggle).lenis-stopped {
	overflow: clip;
}

.lenis [data-lenis-prevent],
.lenis [data-lenis-prevent-wheel],
.lenis [data-lenis-prevent-touch],
.lenis [data-lenis-prevent-vertical],
.lenis [data-lenis-prevent-horizontal] {
	overscroll-behavior: contain;
}

.lenis.lenis-smooth iframe {
	pointer-events: none;
}

.lenis.lenis-autoToggle {
	transition-property: overflow;
	transition-duration: 1ms;
	transition-behavior: allow-discrete;
}
