/*
 * Team Grassroots base: reset, elements, layout primitives, a11y.
 * Component styles live in components.css.
 */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* Nothing may push the page sideways.
   The migrated content carries markup from three page builders whose CSS no
   longer loads - SiteOrigin panels (14 pages), bootstrap grid classes (44) and
   the old theme's `cfa-` components (12) - and some of it lays out wider than a
   phone however the modern layout is written. Each instance could be chased,
   but the content is the client's to rebuild and a stray wide element should
   never be able to break the whole page in the meantime.
   `clip`, NOT `hidden`: `overflow: hidden` turns the element into a scroll
   container, which silently breaks every `position: sticky` on the page (the
   article sidebar, the filter rail). `clip` just clips. Browsers without it
   (Safari below 16) simply behave as they do now. */
html, body { overflow-x: clip; }

body {
	margin: 0;
	font-family: var(--tg-font-body);
	font-size: var(--tg-fs-base);
	line-height: var(--tg-lh-base);
	color: var(--tg-text);
	background: var(--tg-bg);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* Reserve space for the fixed mobile bottom bar so content is never hidden. */
@media (max-width: 768px) {
	body { padding-bottom: calc(var(--tg-bottombar-h) + env(safe-area-inset-bottom, 0px)); }
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--tg-font-head);
	font-weight: var(--tg-fw-black);
	line-height: var(--tg-lh-tight);
	margin: 0 0 var(--tg-sp-4);
	letter-spacing: -0.01em;
}
h1 { font-size: clamp(var(--tg-fs-2xl), 6vw, var(--tg-fs-4xl)); }
h2 { font-size: clamp(var(--tg-fs-xl), 4vw, var(--tg-fs-3xl)); }
h3 { font-size: var(--tg-fs-xl); }
h4 { font-size: var(--tg-fs-lg); }

p { margin: 0 0 var(--tg-sp-4); }

a { color: var(--tg-link); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg, video { max-width: 100%; height: auto; display: block; }

ul, ol { margin: 0 0 var(--tg-sp-4); padding-left: 1.25em; }

button { font: inherit; cursor: pointer; }

hr { border: 0; border-top: var(--tg-bw) solid var(--tg-border); margin: var(--tg-sp-6) 0; }

/* ---- Focus (never rely on colour alone) ---- */
:focus-visible {
	outline: 3px solid var(--tg-focus);
	outline-offset: 2px;
	border-radius: 4px;
}
/* A confirmation that the script focuses so a screen reader announces it. It
   has tabindex="-1", so it is never reached by tabbing and nobody needs a ring
   on it - and drawing one puts a blue box round the success message. */
[data-tg-focus]:focus, [data-tg-focus]:focus-visible { outline: none; }
/* The skip link's target. It is focusable only so the link can land on it. */
.tg-main:focus, .tg-main:focus-visible { outline: none; }

/* ---- Layout primitives ---- */
.tg-container {
	width: 100%;
	max-width: var(--tg-maxw);
	margin-inline: auto;
	padding-inline: var(--tg-gutter);
}
.tg-container--text { max-width: var(--tg-maxw-text); }

/* The title on a page the theme has no bespoke template for - the basket, My
   Account, a policy page. Without it they render at the hero's 64px in sentence
   case while every designed page is uppercase at 48. */
.tg-page-title {
	font-size: clamp(var(--tg-fs-2xl), 4vw, var(--tg-fs-3xl));
	text-transform: uppercase;
	margin: 0 0 var(--tg-sp-5);
}

/* Every full-width content band. Two stacked sections therefore sit
   2 x --tg-band-y apart, which is where the page's rhythm comes from. */
.tg-section { padding-block: var(--tg-band-y); }

/* Reading measure for loose block content.
   A paragraph written straight into a page sits in the full-width container, so
   on a desktop it ran to about 165 characters a line - roughly double what is
   comfortable.
   Lists are matched only when they carry no class, or the editor's own, because
   a class means a component: `ul.tg-product-grid` is a grid of cards that is
   also a direct child of a container, and capping it squeezed the club shop's
   products into a 620px column of the 1360 available. */
.tg-container > p,
.tg-container > blockquote,
.tg-container > ul:not([class]),
.tg-container > ol:not([class]),
.tg-container > ul.wp-block-list,
.tg-container > ol.wp-block-list,
.tg-accordion__body > p,
.tg-accordion__body > blockquote,
.tg-accordion__body > ul:not([class]),
.tg-accordion__body > ol:not([class]),
.tg-accordion__body > ul.wp-block-list,
.tg-accordion__body > ol.wp-block-list { max-width: 70ch; }

.tg-stack > * + * { margin-top: var(--tg-sp-4); }

.tg-grid { display: grid; gap: var(--tg-sp-5); }

/* ---- Accessibility helpers ---- */
.screen-reader-text,
.tg-visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
	white-space: nowrap; border: 0;
}

.tg-skip-link {
	position: absolute; left: -9999px; top: 0; z-index: var(--tg-z-toast);
	background: var(--tg-white); color: var(--tg-ink);
	padding: var(--tg-sp-3) var(--tg-sp-4); border-radius: 0 0 var(--tg-radius) 0;
	font-weight: var(--tg-fw-semi);
}
.tg-skip-link:focus { left: 0; }

/* Interactive elements meet the 48px minimum touch target on touch devices. */
@media (pointer: coarse) {
	a[href], button, input, select, .tg-tap {
		min-height: var(--tg-tap);
	}
}

[hidden] { display: none !important; }

/* In-page anchors have to clear the sticky header. The height is set from the
   header's real size by nav.js (--tg-sticky-h); this fallback is what applies
   before that runs or if it never does. Without it, every "#..." link on the
   site lands with its target tucked behind the header. */
html { scroll-padding-top: calc(var(--tg-sticky-h, 153px) + var(--tg-sp-4, 1rem)); }
