/*
 * Base: reset bits (replacing Hello's reset.css), typography, links, focus, forms.
 * English/LTR frontend, written with logical properties only so an RTL locale still works.
 */

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

[hidden] {
	display: none !important;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-block-start: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

body {
	margin: 0;
	background-color: var(--color-paper);
	color: var(--color-text);
	font-family: var(--font-sans);
	font-size: var(--fs-body);
	font-weight: 400;
	line-height: var(--lh-body);
	overflow-x: clip;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	font-kerning: normal;
}

/* Headings: heavy and tight (1.15–1.3), no tracking changes. */
h1, h2, h3, h4, h5, h6 {
	color: inherit;
	font-family: inherit;
	font-weight: 800;
	margin-block: 0 .6em;
	text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 700; }
h4 { font-size: var(--fs-h4); line-height: 1.3; font-weight: 700; }
h5 { font-size: var(--fs-lead); line-height: 1.3; font-weight: 700; }
h6 { font-size: var(--fs-body); line-height: 1.3; font-weight: 700; }

p {
	margin-block: 0 1em;
	text-wrap: pretty;
}

small,
.cm-small {
	font-size: var(--fs-small);
	line-height: var(--lh-small);
}

strong,
b {
	font-weight: 700;
}

/* Links: inherit by default; content links get the accent. */
:where(a) {
	color: inherit;
	text-decoration: none;
	text-underline-offset: .35em;
	text-decoration-thickness: 1px;
	transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

:where(a):hover,
:where(a):active {
	color: inherit;
}

/* Hello's theme.css underlines every .page-content link (incl. buttons); keep it to prose links. */
.page-content a[class],
.cm-woo-flow .page-content a {
	text-decoration: none;
}

:where(.entry-content, .page-content, .comment-content, .cm-prose) :where(p, li, td, blockquote) > a:not([class]) {
	color: var(--color-accent);
	text-decoration: underline;
}

:where(.entry-content, .page-content, .comment-content, .cm-prose) :where(p, li, td, blockquote) > a:not([class]):hover {
	color: var(--color-accent-hover);
}

/* Focus: visible ring for keyboard users only. */
:where(:focus) {
	outline: none;
}

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

::selection {
	background: var(--color-accent);
	color: var(--color-white);
}

/* Media. */
img,
video,
canvas {
	max-inline-size: 100%;
	block-size: auto;
	vertical-align: middle;
}

img {
	border-style: none;
}

svg {
	vertical-align: middle;
}

.cm-icon {
	flex-shrink: 0;
	inline-size: 1.25em;
	block-size: 1.25em;
}

iframe {
	max-inline-size: 100%;
	border: 0;
}

figure {
	margin: 0;
}

figcaption {
	color: var(--color-muted);
	font-size: var(--fs-small);
	font-style: normal;
	line-height: var(--lh-small);
	margin-block-start: var(--space-2);
}

hr {
	border: 0;
	border-block-start: 1px solid var(--color-line);
	margin-block: var(--space-7);
}

blockquote {
	margin: var(--space-7) 0;
	padding-inline-start: var(--space-6);
	border-inline-start: 3px solid var(--color-accent);
	font-size: var(--fs-lead);
	font-weight: 500;
}

code,
kbd,
samp,
pre {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	direction: ltr;
	unicode-bidi: isolate;
}

/* Isolated direction fragments (numbers, emails) — matters when an RTL locale is active. */
bdi,
[dir="ltr"] {
	unicode-bidi: isolate;
}

/*
 * Normalize (replaces Hello's reset.css, which the theme dequeues because its
 * #c36 button colours fight every component). Zero specificity via :where().
 */
:where(html) { line-height: 1.15; }
:where(b, strong) { font-weight: 700; }
:where(small) { font-size: 80%; }
:where(sub, sup) { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
:where(sub) { bottom: -.25em; }
:where(sup) { top: -.5em; }
:where(abbr[title]) { text-decoration: underline dotted; }
:where(ul, ol, dl, dd) { margin-block: 0; }
:where(details) { display: block; }
:where(summary) { display: list-item; cursor: pointer; }
:where(template) { display: none; }
:where(button, input, optgroup, select, textarea) { font-family: inherit; font-size: 1rem; line-height: 1.5; margin: 0; }
:where(button, input) { overflow: visible; }
:where(button, select) { text-transform: none; }
:where(select) { display: block; }
:where(textarea) { overflow: auto; resize: vertical; }
:where([type="number"])::-webkit-inner-spin-button,
:where([type="number"])::-webkit-outer-spin-button { height: auto; }
:where([type="search"]) { -webkit-appearance: textfield; outline-offset: -2px; }
:where([type="search"])::-webkit-search-decoration { -webkit-appearance: none; }
::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; }
:where(fieldset) { padding: .35em .75em .625em; }
:where(legend) { box-sizing: border-box; color: inherit; display: table; max-width: 100%; padding: 0; white-space: normal; }

/* Buttons: neutral base; real looks come from .cm-btn / Woo / Elementor classes. */
:where(button, [type="button"], [type="submit"], [type="reset"]) {
	-webkit-appearance: button;
	display: inline-block;
	padding: .5rem 1rem;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	background-color: transparent;
	color: inherit;
	font-family: inherit;
	font-size: inherit;
	line-height: 1.5;
	text-align: center;
	user-select: none;
	transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

:where(button, [type="button"], [type="submit"]):not(:disabled) {
	cursor: pointer;
}

/* Form controls. */
:where(
	input[type="date"],
	input[type="email"],
	input[type="number"],
	input[type="password"],
	input[type="search"],
	input[type="tel"],
	input[type="text"],
	input[type="time"],
	input[type="url"],
	select,
	textarea
) {
	inline-size: 100%;
	min-block-size: 48px;
	padding: 10px 16px;
	border: 1px solid var(--color-line);
	border-radius: 12px;
	background-color: var(--color-white);
	color: var(--color-text);
	font-family: inherit;
	font-size: max(16px, var(--fs-body)); /* ≥16px avoids iOS zoom */
	line-height: 1.6;
	transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

:where(textarea) {
	min-block-size: 120px;
}

:where(input, textarea)::placeholder {
	color: color-mix(in srgb, var(--color-muted) 80%, transparent);
	opacity: 1;
}

:where(input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"]), select, textarea):hover {
	border-color: color-mix(in srgb, var(--color-muted) 45%, var(--color-line));
}

:where(
	input[type="date"],
	input[type="email"],
	input[type="number"],
	input[type="password"],
	input[type="search"],
	input[type="tel"],
	input[type="text"],
	input[type="time"],
	input[type="url"],
	select,
	textarea
):focus {
	border-color: var(--color-accent);
	box-shadow: var(--focus-ring);
	outline: none;
}

/* Emails, phones and URLs are always LTR, aligned to the inline start of the page. */
:where(input[type="email"], input[type="tel"], input[type="url"]) {
	direction: ltr;
	text-align: start;
}

:where([dir="rtl"]) :where(input[type="email"], input[type="tel"], input[type="url"]) {
	text-align: end;
}

:where(input[type="checkbox"], input[type="radio"]) {
	accent-color: var(--color-accent);
	inline-size: 18px;
	block-size: 18px;
}

:where(label) {
	line-height: 1.5;
}

/* Tables: quiet editorial look. */
:where(table) {
	border-collapse: collapse;
	inline-size: 100%;
	font-size: inherit;
	margin-block-end: var(--space-5);
}

:where(table td, table th) {
	border: 0;
	border-block-end: 1px solid var(--color-line);
	padding: 12px 8px;
	text-align: start;
	vertical-align: middle;
	line-height: 1.55;
}

:where(table th) {
	font-weight: 700;
}

/* Screen-reader text (WP core class). */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	block-size: 1px;
	inline-size: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	word-wrap: normal !important;
	white-space: nowrap;
}

.screen-reader-text:focus,
.skip-link:focus {
	background-color: var(--color-white);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-md);
	clip: auto !important;
	clip-path: none;
	color: var(--color-text);
	display: block;
	font-size: 1rem;
	font-weight: 700;
	block-size: auto;
	inline-size: auto;
	inset-block-start: 8px;
	inset-inline-start: 8px;
	line-height: normal;
	padding: 12px 20px;
	text-decoration: none;
	white-space: normal;
	z-index: 100000;
}

/* Reduced motion: kill transitions and animations globally. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}
