/* ==========================================================================
   GrowthReader — core.css
   Design tokens · reset · typography · layout primitives · buttons · forms ·
   accessibility helpers.

   Mobile-first: base rules target phones (320px+); min-width queries add
   tablet / desktop. Breakpoints: 640 · 768 · 900 · 1100 · 1280.
   Brand colours and fonts are overridden at runtime from the Customizer
   (inline :root block printed by inc/setup.php → gr_token_css()).
   ========================================================================== */

:root {
	/* Brand (overridden by the Customizer) */
	--gr-ink: #10202e;
	--gr-ink-2: #1b3145;
	--gr-accent: #0f766e;
	--gr-accent-hover: #0b5f58;
	--gr-accent-soft: #e3f1ee;
	--gr-accent-on-dark: #7fd6c9;

	/* Neutrals */
	--gr-text: #1c2b38;
	--gr-muted: #566773;
	--gr-bg: #ffffff;
	--gr-surface: #ffffff;
	--gr-paper: #f7f6f2;
	--gr-line: #e3e1da;
	--gr-line-strong: #c9c5b9;
	--gr-control-border: #6f7d89; /* form-field borders: >= 3:1 on white (WCAG 1.4.11) */

	/* Status */
	--gr-danger: #b42318;
	--gr-danger-soft: #fdecea;
	--gr-success: #146c43;
	--gr-success-soft: #e6f4ec;
	--gr-sale-bg: #fdf0e4;
	--gr-sale-fg: #8a3b00;

	/* Type */
	--gr-font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--gr-font-head: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
	--gr-fs-xs: 0.8125rem;
	--gr-fs-sm: 0.9375rem;
	--gr-fs-base: 1rem;
	--gr-fs-lg: 1.125rem;
	--gr-fs-h4: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
	--gr-fs-h3: clamp(1.1875rem, 1.05rem + 0.6vw, 1.4375rem);
	--gr-fs-h2: clamp(1.5rem, 1.2rem + 1.4vw, 2.125rem);
	--gr-fs-h1: clamp(1.875rem, 1.3rem + 2.8vw, 3.25rem);

	/* Space (4px scale) */
	--gr-s1: 4px;
	--gr-s2: 8px;
	--gr-s3: 12px;
	--gr-s4: 16px;
	--gr-s5: 24px;
	--gr-s6: 32px;
	--gr-s7: 48px;
	--gr-s8: 64px;
	--gr-section: clamp(40px, 6vw, 88px);

	/* Shape + depth */
	--gr-radius-sm: 6px;
	--gr-radius: 10px;
	--gr-radius-lg: 16px;
	--gr-shadow-sm: 0 1px 2px rgba(16, 32, 46, 0.06);
	--gr-shadow: 0 10px 30px -12px rgba(16, 32, 46, 0.22);

	/* Layout */
	--gr-max: 1200px;
	--gr-narrow: 760px;
	--gr-gutter: clamp(16px, 4vw, 32px);
	--gr-header-h: 60px;

	/* Motion */
	--gr-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--gr-dur: 160ms;
}

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-top: calc(var(--gr-header-h) + 16px);
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--gr-bg);
	color: var(--gr-text);
	font-family: var(--gr-font-body);
	font-size: var(--gr-fs-base);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: clip; /* safety net: nothing may cause sideways scrolling */
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}

.gr-main { flex: 1 0 auto; outline: none; }
.gr-main:focus { outline: none; }

img, svg, video, canvas, iframe { max-width: 100%; height: auto; }
img { display: block; }
svg { flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gr-accent); text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
a:hover { color: var(--gr-accent-hover); }
p, ul, ol, dl, figure { margin: 0 0 var(--gr-s4); }
ul, ol { padding-left: 1.25rem; }
[hidden] { display: none !important; }
hr { border: 0; border-top: 1px solid var(--gr-line); margin: var(--gr-s6) 0; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--gr-accent-soft); color: var(--gr-ink); }

/* Long words and URLs must never break the layout */
h1, h2, h3, h4, p, li, dd, td, a { overflow-wrap: break-word; }

/* ----- Typography ------------------------------------------------------- */
h1, h2, h3, h4 {
	font-family: var(--gr-font-head);
	color: var(--gr-ink);
	line-height: 1.2;
	font-weight: 600;
	letter-spacing: -0.01em;
	margin: 0 0 var(--gr-s3);
	text-wrap: balance;
}
h1 { font-size: var(--gr-fs-h1); line-height: 1.12; }
h2 { font-size: var(--gr-fs-h2); }
h3 { font-size: var(--gr-fs-h3); }
h4 { font-size: var(--gr-fs-h4); }
.gr-eyebrow {
	font-family: var(--gr-font-body);
	font-size: var(--gr-fs-xs);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--gr-accent);
	margin: 0 0 var(--gr-s2);
}
.gr-eyebrow a { color: inherit; text-decoration: none; }
.gr-muted { color: var(--gr-muted); }
.gr-center { text-align: center; }

@media (min-width: 768px) {
	body { font-size: 1.0625rem; }
}

/* ----- Layout primitives ------------------------------------------------ */
.gr-container {
	width: 100%;
	max-width: var(--gr-max);
	margin-inline: auto;
	padding-left: max(var(--gr-gutter), env(safe-area-inset-left));
	padding-right: max(var(--gr-gutter), env(safe-area-inset-right));
}
.gr-container--narrow { max-width: calc(var(--gr-narrow) + 2 * var(--gr-gutter)); }

.gr-section { padding-block: var(--gr-section); }
.gr-section--tight { padding-block: clamp(20px, 3vw, 40px); }
.gr-section--alt { background: var(--gr-paper); }
.gr-section--dark {
	background: var(--gr-ink);
	color: #e8eef3;
}
.gr-section--dark h1, .gr-section--dark h2, .gr-section--dark h3 { color: #fff; }
.gr-section--dark a { color: var(--gr-accent-on-dark); }

/* Card grids: 2-up on phones (compact cards), then 3 / 4 */
.gr-grid {
	display: grid;
	gap: var(--gr-s3);
	list-style: none;
	padding: 0;
	margin: 0;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}
.gr-grid__item { min-width: 0; }
.gr-grid--2, .gr-grid--3 { grid-template-columns: minmax(0, 1fr); gap: var(--gr-s4); }

@media (min-width: 640px) {
	.gr-grid { gap: var(--gr-s4); }
	.gr-grid--2, .gr-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
	.gr-grid--4 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gr-s5); }
}
@media (min-width: 900px) {
	.gr-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gr-s5); }
}
@media (min-width: 1100px) {
	.gr-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ----- Accessibility helpers -------------------------------------------- */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}
.skip-link:focus {
	position: fixed !important;
	left: 12px;
	top: 12px;
	width: auto;
	height: auto;
	margin: 0;
	padding: 12px 18px;
	clip: auto;
	clip-path: none;
	z-index: 1000;
	background: var(--gr-ink);
	color: #fff;
	border-radius: var(--gr-radius-sm);
	text-decoration: none;
	font-weight: 600;
}

:focus-visible {
	outline: 3px solid var(--gr-accent);
	outline-offset: 2px;
	border-radius: 2px;
}
.gr-section--dark :focus-visible,
.gr-footer :focus-visible,
.gr-announce :focus-visible { outline-color: var(--gr-accent-on-dark); }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ----- Buttons ---------------------------------------------------------- */
.gr-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 48px;
	padding: 0 22px;
	border: 1.5px solid transparent;
	border-radius: var(--gr-radius-sm);
	font-family: var(--gr-font-body);
	font-size: var(--gr-fs-base);
	font-weight: 650;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	background: var(--gr-accent);
	color: #fff;
	transition: background-color var(--gr-dur) var(--gr-ease), border-color var(--gr-dur) var(--gr-ease), color var(--gr-dur) var(--gr-ease), transform var(--gr-dur) var(--gr-ease), box-shadow var(--gr-dur) var(--gr-ease);
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}
.gr-btn:hover { background: var(--gr-accent-hover); color: #fff; }
.gr-btn:active { transform: translateY(1px); }
.gr-btn--primary { background: var(--gr-accent); }
.gr-btn--secondary {
	background: #fff;
	color: var(--gr-ink);
	border-color: var(--gr-line-strong);
}
.gr-btn--secondary:hover { background: var(--gr-paper); color: var(--gr-ink); border-color: var(--gr-ink); }
.gr-btn--on-dark { background: #fff; color: var(--gr-ink); }
.gr-btn--on-dark:hover { background: var(--gr-accent-soft); color: var(--gr-ink); }
.gr-btn--ghost-dark { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.gr-btn--ghost-dark:hover { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: #fff; }
.gr-btn--sm { min-height: 44px; padding: 0 16px; font-size: var(--gr-fs-sm); }
.gr-btn--lg { min-height: 54px; padding: 0 28px; font-size: var(--gr-fs-lg); }
.gr-btn--block { display: flex; width: 100%; }
.gr-btn[disabled], .gr-btn.is-loading { opacity: 0.7; cursor: progress; pointer-events: none; }

.gr-linkbtn {
	background: none;
	border: 0;
	padding: 10px 0;
	min-height: 44px;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.18em;
	font-size: var(--gr-fs-sm);
	cursor: pointer;
}
.gr-linkbtn:hover { color: var(--gr-accent-hover); }

.gr-iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 44px;
	min-height: 44px;
	padding: 0 10px;
	background: transparent;
	border: 0;
	border-radius: var(--gr-radius-sm);
	color: var(--gr-ink);
	text-decoration: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition: background-color var(--gr-dur) var(--gr-ease);
}
.gr-iconbtn:hover { background: var(--gr-paper); color: var(--gr-ink); }

/* ----- Forms ------------------------------------------------------------ */
.gr-field { margin-bottom: var(--gr-s4); }
.gr-field > label,
.gr-filters label:not(.gr-check) {
	display: block;
	font-size: var(--gr-fs-sm);
	font-weight: 600;
	color: var(--gr-ink);
	margin-bottom: 6px;
}
.gr-req { color: var(--gr-danger); }

input[type="text"], input[type="email"], input[type="search"], input[type="url"], input[type="tel"], input[type="number"], select, textarea {
	display: block;
	width: 100%;
	min-height: 48px;
	padding: 10px 14px;
	font-size: 16px; /* 16px stops iOS Safari zooming the page on focus */
	line-height: 1.4;
	color: var(--gr-text);
	background: #fff;
	border: 1.5px solid var(--gr-control-border);
	border-radius: var(--gr-radius-sm);
	appearance: none;
	-webkit-appearance: none;
	transition: border-color var(--gr-dur) var(--gr-ease), box-shadow var(--gr-dur) var(--gr-ease);
}
textarea { min-height: 140px; resize: vertical; }
select {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23566773' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 40px;
}
input::placeholder, textarea::placeholder { color: #5d6b77; opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--gr-muted); }
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--gr-accent);
	box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.25);
}
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] {
	border-color: var(--gr-danger);
	box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.15);
}
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

.gr-check {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin: 0 0 var(--gr-s4);
	font-size: var(--gr-fs-sm);
	line-height: 1.45;
	cursor: pointer;
}
.gr-check input {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	min-height: 0;
	margin: 0;
	accent-color: var(--gr-accent);
	cursor: pointer;
}
.gr-check--inline { margin: 0; align-items: center; min-height: 44px; }

/* Honeypot: invisible to people, tempting to bots */
.gr-hp {
	position: absolute !important;
	left: -10000px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
