/*
 * enitan hope: buttons, C-12 forms and interim errors (design handoff 26 Nov, 1.3 and 1.4).
 * Loaded on every page. Our own forms use it: Sign in / Join, password pages, order confirmation
 * "Save your details", Coming soon sign-up, Feedback. WooCommerce's Checkout block keeps its own
 * fields (basket-checkout.css only moves the label above and draws the underline).
 *
 * Markup:
 *   <p class="eh-fld"><label for="x">Label</label><input id="x" aria-describedby="x-hint">
 *     <span id="x-hint" class="eh-fld__hint">Hint</span></p>
 *   Error (forms.js adds it): input[aria-invalid="true"] + <span class="eh-fld__msg">…</span>
 *   Two-up row: .eh-row2 · CTA block: .eh-cta (left) / .eh-cta--end (right, under a two-up row)
 *   Checkbox / radio: <label class="eh-check"><input type="checkbox"> Text</label>
 *   Select: <span class="eh-select"><select>…</select></span>
 * Tokens only. Breakpoint 690px.
 */

/* ---------- Buttons ---------- */
.eh-btn {
	display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
	min-height: var(--wp--custom--eh--control); padding: 12px 30px; max-width: 100%;
	border: var(--wp--custom--eh--border-strong); border-radius: 0;
	font-family: var(--wp--preset--font-family--sans); font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; line-height: 1.3; text-align: center; text-wrap: balance; /* C-03 (DS-09): may wrap to two lines, never three */
	text-decoration: none !important; cursor: pointer;
	transition: background var(--wp--custom--eh--motion), color var(--wp--custom--eh--motion), border-color var(--wp--custom--eh--motion);
}
.eh-btn--ink, .eh-btn--ink:visited { background: var(--wp--preset--color--ink); color: var(--wp--preset--color--white) !important; }
.eh-btn--line, .eh-btn--line:visited { background: transparent; color: var(--wp--preset--color--ink) !important; }
.eh-btn--midnight, .eh-btn--midnight:visited { background: var(--wp--preset--color--midnight); border-color: var(--wp--preset--color--midnight); color: var(--wp--preset--color--white) !important; }
@media (hover: hover) and (pointer: fine) { .eh-btn:hover { background: var(--wp--preset--color--blue); border-color: var(--wp--preset--color--blue); color: var(--wp--preset--color--white) !important; } }
.eh-btn:active { background: var(--wp--preset--color--blue-pressed); border-color: var(--wp--preset--color--blue-pressed); transform: translateY(1px); }
.eh-btn:focus-visible { outline: var(--wp--custom--eh--focus); outline-offset: 2px; }
.eh-btn[disabled], .eh-btn[aria-disabled="true"] { background: var(--wp--preset--color--studio-grey); border-color: var(--wp--preset--color--line); color: var(--wp--preset--color--muted) !important; cursor: not-allowed; transform: none; }
.eh-btn--full { width: 100%; }

/* ---------- C-05 everywhere (follow-up 27 Nov, section 4): no white, borderless CTAs ----------
 * Only four styles exist: primary (ink fill, white text, 1px ink border; hover blue, pressed blue
 * pressed), outline (transparent, ink text, 1px ink border; hover blue fill, white text), accent
 * (yellow, where the design uses it) and feedback (midnight). Square, 48px, Inter 500 12px caps
 * +0.14em. Blocksy's --theme-button-* variables and WooCommerce block buttons follow these rules
 * here, once, instead of per button. */
.wp-block-button:not(.is-style-outline) > .wp-block-button__link:not(.has-background) {
	background-color: var(--wp--preset--color--ink); color: var(--wp--preset--color--white);
	border: var(--wp--custom--eh--border-strong) !important;
}
.wp-block-button.is-style-outline > .wp-block-button__link,
.wc-block-components-product-button__button,
.wp-block-woocommerce-product-button .wp-block-button__link {
	background-color: transparent !important; color: var(--wp--preset--color--ink) !important;
	border: var(--wp--custom--eh--border-strong) !important;
}
:is(.wp-block-button__link, .wc-block-components-product-button__button) {
	min-height: var(--wp--custom--eh--control); border-radius: 0 !important; box-sizing: border-box; line-height: 1.3; text-wrap: balance;
	font-family: var(--wp--preset--font-family--sans); font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
}
 .wp-block-button__link:focus-visible, .wc-block-components-product-button__button:focus-visible {
	background-color: var(--wp--preset--color--blue) !important; border-color: var(--wp--preset--color--blue) !important; color: var(--wp--preset--color--white) !important;
}
@media (hover: hover) and (pointer: fine) { .wp-block-button__link:hover, .wc-block-components-product-button__button:hover, .wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--blue) !important; border-color: var(--wp--preset--color--blue) !important; color: var(--wp--preset--color--white) !important;
} }
.wp-block-button__link:active, .wc-block-components-product-button__button:active {
	background-color: var(--wp--preset--color--blue-pressed) !important; border-color: var(--wp--preset--color--blue-pressed) !important; color: var(--wp--preset--color--white) !important;
}
.wp-block-button__link:focus-visible, .wc-block-components-product-button__button:focus-visible { outline: var(--wp--custom--eh--focus); outline-offset: 2px; }
/* Blocksy's own buttons (WooCommerce .button, Blocksy forms): ink with a border, never white on white. */
html:root {
	--theme-button-background-initial-color: var(--wp--preset--color--ink);
	--theme-button-text-initial-color: var(--wp--preset--color--white);
	--theme-button-background-hover-color: var(--wp--preset--color--blue);
	--theme-button-text-hover-color: var(--wp--preset--color--white);
	--theme-button-border: 1px solid var(--wp--preset--color--ink);
}

/* ---------- Checkbox and radio: Swedish blue ticks everywhere ---------- */
body { --theme-form-selection-field-active-color: var(--wp--preset--color--blue); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--wp--preset--color--blue); }

/* ---------- C-12 fields ---------- */
.eh-fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; }
.eh-fld > label, .eh-fld__label { margin: 0; font-size: var(--wp--preset--font-size--meta); font-weight: 400; line-height: 1.4; color: var(--wp--preset--color--stone); }
.eh-fld :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
	--theme-form-field-height: var(--wp--custom--eh--field);
	width: 100%; height: var(--wp--custom--eh--field); box-sizing: border-box;
	margin: 0; padding: 0; border: 0; border-bottom: var(--wp--custom--eh--border-strong); border-radius: 0;
	background: transparent; box-shadow: none;
	font-family: var(--wp--preset--font-family--sans); font-size: var(--wp--preset--font-size--body); font-weight: 400; color: var(--wp--preset--color--ink);
}
.eh-fld textarea { height: 112px; min-height: 112px; padding: 10px 0; line-height: 1.5; resize: vertical; }
.eh-fld :is(input, textarea)::placeholder { color: var(--wp--preset--color--muted); opacity: 1; }
@media (hover: hover) and (pointer: fine) { .eh-fld :is(input, select, textarea):hover { border-bottom-width: 2px !important; } }
.eh-fld :is(input, select, textarea):focus { box-shadow: none; }
.eh-fld :is(input, select, textarea):focus-visible { outline: var(--wp--custom--eh--focus); outline-offset: 2px; }
.eh-fld :is(input, select, textarea):disabled { color: var(--wp--preset--color--muted); border-bottom: 1px dashed var(--wp--preset--color--muted) !important; cursor: not-allowed; }
.eh-fld:has(:disabled) > label { color: var(--wp--preset--color--muted); }
.eh-fld__hint { font-size: var(--wp--preset--font-size--hint); line-height: 1.5; color: var(--wp--preset--color--stone); }

/* Select: custom chevron (a mask, so it takes the ink colour token). */
.eh-select { position: relative; display: block; }
.eh-select select { appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer; }
.eh-select::after {
	content: ""; position: absolute; right: 0; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); pointer-events: none;
	background-color: var(--wp--preset--color--ink);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E") center / 16px no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E") center / 16px no-repeat;
}

/* Checkbox / radio row: 20px box, the whole label is clickable. */
.eh-check { display: flex; align-items: flex-start; gap: var(--wp--preset--spacing--xs); min-height: var(--wp--custom--eh--tap); padding: 10px 0; box-sizing: border-box; margin: 0; cursor: pointer; font-size: var(--wp--preset--font-size--small); line-height: 1.5; color: var(--wp--preset--color--ink); }
.eh-check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; cursor: pointer; }
.eh-check input:focus-visible { outline: var(--wp--custom--eh--focus); outline-offset: 2px; }

/* ---------- 1.4 Errors (interim) ---------- */
.eh-fld [aria-invalid="true"] { border-bottom: 2px solid var(--wp--preset--color--error) !important; }
@media (hover: hover) and (pointer: fine) { .eh-fld [aria-invalid="true"]:hover { border-bottom: 2px solid var(--wp--preset--color--error) !important; } }
.eh-fld__msg { display: flex; align-items: center; gap: 6px; font-size: var(--wp--preset--font-size--hint); line-height: 1.5; color: var(--wp--preset--color--error); }
.eh-fld__msg svg { flex: none; }
.eh-alert { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--wp--preset--color--error); background: var(--wp--preset--color--white); color: var(--wp--preset--color--error); font-size: 14px; line-height: 1.5; }
.eh-alert svg { flex: none; margin-top: 2px; }
.eh-alert[hidden] { display: none; } /* display:flex above beat the hidden attribute: H-11 showed its error on load (27 Nov). */

/* ---------- Layout: two-up rows and the CTA rule ---------- */
.eh-row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--wp--preset--spacing--m); }
.eh-cta { display: flex; flex-direction: column; align-items: flex-start; gap: var(--wp--preset--spacing--xs); }
.eh-cta--end { align-items: flex-end; text-align: right; }
.eh-cta__note { margin: 0; font-size: var(--wp--preset--font-size--meta); line-height: 1.6; color: var(--wp--preset--color--stone); }

@media (max-width: 689px) {
	.eh-cta, .eh-cta--end { align-items: stretch; text-align: center; }
	.eh-cta .eh-btn { width: 100%; }
}
