/**
 * Foundations: the reset and the element defaults everything else builds on.
 *
 * Replaces the design-system plugin's foundations module, which was scoped to
 * `body.hpds-enabled` inside a cascade layer and carried a set of `hpds-*`
 * utility classes that no markup in this theme referenced. What is left is only
 * what a page actually needs.
 */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	tab-size: 4;
	scroll-behavior: smooth;
	/* The header is sticky, so an in-page anchor would otherwise land underneath
	 * it. One value here covers every anchor on the site. */
	scroll-padding-block-start: 6rem;
}

/* Selected text takes the accent wash rather than the browser's blue, so a
 * shopper dragging across a price or a product name stays inside the palette. */
::selection {
	background: var(--hp-accent-soft);
	color: var(--hp-text);
}

body {
	min-height: 100%;
	text-rendering: optimizeLegibility;
}

/* ---- rhythm ----
 * Margins are removed at the root and reinstated where a component asks for
 * them, so nothing inherits spacing it did not choose.
 */

h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ol, ul {
	margin: 0;
}

ol[class],
ul[class] {
	padding: 0;
	list-style: none;
}

/* ---- media ---- */

img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
}

img {
	height: auto;
	border: none;
}

svg {
	fill: currentColor;
}

/* An svg drawn with strokes must not be filled by the rule above. */
svg[fill="none"] {
	fill: none;
}

iframe,
embed,
object {
	max-width: 100%;
	border: none;
}

/* ---- interaction ---- */

a {
	color: inherit;
	text-decoration: none;
}

button {
	background: none;
	border: none;
	padding: 0;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

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

/* The UA ring is replaced above, not simply removed: a keyboard user needs to
 * see where they are. */
:focus:not(:focus-visible) {
	outline: none;
}

[hidden] {
	display: none !important;
}

/* ---- tables ---- */

table {
	border-collapse: collapse;
	width: 100%;
}

th {
	text-align: start;
	font-weight: 600;
}

/* ---- selection ---- */

::selection {
	background: var(--hp-accent-soft);
	color: var(--hp-text);
}

hr {
	height: 0;
	margin-block: var(--hp-space-8);
	border: none;
	border-block-start: 1px solid var(--hp-border);
}
