/*
Theme Name: Neova
Theme URI: https://neova.bio
Author: Oleg Dez
Author URI: https://dez.kiev.ua
Description: Блочна тема магазину фінських біостимуляторів Neova.
Version: 0.7.3
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.3
License: Proprietary
Text Domain: neova
*/

/* Розробка та дизайн: Oleg Dez · dezoleg@gmail.com · https://dez.kiev.ua */

/*
 * Глобальні стилі, яких не дає theme.json: фокус, поля форм, стани, висоти кнопок.
 * Кольори й розміри — лише змінні з theme.json (--wp--preset--*, --wp--custom--*).
 * Стилі окремих блоків — у assets/css/blocks/, підключаються лише там, де є блок.
 */

/* Брейкпоінти (А-08): < 768 мобільний, 768–1199 планшет, ≥ 1200 desktop. */

/* ---------- Заголовки: шкала з TOKENS §2 ---------- */

.has-h-2-home-font-size { line-height: var(--wp--custom--line-height--h-2-home); }
.has-h-2-post-font-size { line-height: var(--wp--custom--line-height--h-2-post); }
.has-h-3-card-font-size { line-height: var(--wp--custom--line-height--h-3-card); }
.has-stat-font-size { line-height: var(--wp--custom--line-height--stat); }
.has-lead-font-size { line-height: var(--wp--custom--line-height--lead); }
.has-small-font-size { line-height: var(--wp--custom--line-height--small); }
.has-meta-font-size,
.has-caption-font-size { line-height: var(--wp--custom--line-height--tight); }

/* ---------- Фокус (А-13): лише з клавіатури ---------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
:where(.wp-element-button):focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--primary);
	outline-offset: var(--wp--custom--focus--offset);
}

/* На темному тлі — м'ятний. */
:where(.has-ink-background-color, .has-primary-background-color, .has-line-dark-background-color) :where(a, button, input, select, textarea, summary, [tabindex], .wp-element-button):focus-visible {
	outline-color: var(--wp--preset--color--mint);
}

/* ---------- Кнопки: висоти L / M / S (А-10) ----------
 * L — за замовчуванням, без класу. M / S — класи is-size-m / is-size-s (поле «Додаткові класи CSS»),
 * працюють для всіх варіантів, крім «посилання зі стрілкою» (у нього немає висоти й рамки).
 */

.wp-element-button,
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--wp--preset--spacing--20);
	min-height: var(--wp--custom--button--height--l);
	box-sizing: border-box;
	text-align: center;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.wp-block-button.is-size-m:not(.is-style-arrow) > .wp-block-button__link,
.wp-element-button.is-size-m {
	min-height: var(--wp--custom--button--height--m);
	padding-inline: var(--wp--custom--button--padding--m);
	font-size: var(--wp--preset--font-size--button-m);
}

.wp-block-button.is-size-s:not(.is-style-arrow) > .wp-block-button__link,
.wp-element-button.is-size-s {
	min-height: var(--wp--custom--button--height--s);
	padding-inline: var(--wp--custom--button--padding--s);
	font-size: var(--wp--preset--font-size--button-m);
}

@media (max-width: 767px) {
	.wp-element-button,
	.wp-block-button__link {
		min-height: var(--wp--custom--button--height--l-mobile);
	}

	.wp-block-button.is-size-s:not(.is-style-arrow) > .wp-block-button__link,
	.wp-element-button.is-size-s {
		padding-inline: var(--wp--custom--button--padding--s-mobile);
		font-size: var(--wp--preset--font-size--small);
	}
}

/* ---------- Disabled (А-13) ---------- */

.wp-element-button:disabled,
.wp-element-button[aria-disabled="true"],
.wp-block-button__link[aria-disabled="true"],
.wp-block-button.is-disabled > .wp-block-button__link,
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
	opacity: var(--wp--custom--disabled--opacity);
	cursor: not-allowed;
}

/* Неактивна кнопка-блок (клас is-disabled у «Додаткові класи CSS»): не реагує на клік і hover. */
.wp-block-button.is-disabled > .wp-block-button__link {
	pointer-events: none;
}

.wp-element-button:disabled:hover,
.wp-element-button[aria-disabled="true"]:hover,
.wp-block-button__link[aria-disabled="true"]:hover {
	background-color: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
}

/* ---------- Поля форм (А-03): рамка muted, фокус — primary, помилка — error ---------- */

:where(input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="range"], [type="color"], [type="file"], [type="hidden"]), select, textarea) {
	box-sizing: border-box;
	width: 100%;
	min-height: var(--wp--custom--field--height);
	padding: 0 var(--wp--custom--field--padding);
	border: var(--wp--custom--line--width) solid var(--wp--preset--color--muted);
	border-radius: var(--wp--custom--radius--field);
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--custom--field--font-size); /* не менше 16 px, інакше iOS масштабує сторінку */
	line-height: var(--wp--custom--line-height--tight);
	transition: border-color .15s ease, box-shadow .15s ease;
}

:where(textarea) {
	min-height: calc(var(--wp--custom--field--height) * 2);
	padding-block: var(--wp--custom--field--padding);
	resize: vertical;
}

::placeholder {
	color: var(--wp--preset--color--muted);
	opacity: 1;
}

:where(input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"]), select, textarea):focus {
	outline: none;
	border-color: var(--wp--preset--color--primary);
	box-shadow: inset 0 0 0 var(--wp--custom--line--width) var(--wp--preset--color--primary);
}

:where(input, select, textarea)[aria-invalid="true"],
.neova-field.is-error :where(input, select, textarea) {
	border-color: var(--wp--preset--color--error);
	box-shadow: inset 0 0 0 var(--wp--custom--line--width) var(--wp--preset--color--error);
}

:where(input[type="checkbox"], input[type="radio"]) {
	width: var(--wp--custom--field--check-size);
	height: var(--wp--custom--field--check-size);
	margin: 0;
	accent-color: var(--wp--preset--color--primary);
}

/* Сортування каталогу WooCommerce стоїть у рядку з лічильником — без ширини 100 % (шаблон каталогу — етап 4). */
.wc-block-catalog-sorting,
.woocommerce-ordering {
	min-width: 0;
}

.woocommerce-ordering select {
	width: 100%;
	max-width: 100%;
	text-overflow: ellipsis;
}

.neova-field {
	display: flex;
	flex-direction: column;
	gap: var(--wp--custom--field--label-gap);
}

.neova-field label,
.neova-field__label {
	color: var(--wp--preset--color--body-text);
	font-size: var(--wp--preset--font-size--small);
	line-height: var(--wp--custom--line-height--tight);
}

.neova-field__required {
	color: var(--wp--preset--color--error);
}

.neova-field__hint,
.neova-field__error {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	line-height: var(--wp--custom--line-height--small);
}

.neova-field__hint {
	color: var(--wp--preset--color--muted);
}

.neova-field__error {
	color: var(--wp--preset--color--error);
}

.neova-check {
	display: flex;
	gap: var(--wp--preset--spacing--30);
	align-items: flex-start;
	color: var(--wp--preset--color--body-text);
	font-size: var(--wp--preset--font-size--small);
	line-height: var(--wp--custom--line-height--small);
}

@media (max-width: 767px) {
	:where(input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="range"], [type="color"], [type="file"], [type="hidden"]), select) {
		min-height: var(--wp--custom--field--height-mobile);
	}
}

/* ---------- Кнопка-іконка 44 px: пошук, кошик, бургер (AUDIT §2) ---------- */

.neova-icon-button {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: var(--wp--custom--icon-button--size);
	height: var(--wp--custom--icon-button--size);
	padding: 0;
	border: 0;
	border-radius: var(--wp--custom--radius--round);
	background: transparent;
	color: var(--wp--preset--color--primary);
	cursor: pointer;
	transition: background-color .15s ease;
}

.neova-icon-button:hover,
.neova-icon-button[aria-expanded="true"],
.neova-icon-button.is-current {
	background-color: var(--wp--preset--color--hover);
}

.neova-icon {
	display: block;
	flex: none;
}

/* ---------- Верхня смуга: 36 px, ink, лише ≥ 1200 px ---------- */

.neova-top-bar-part,
.neova-top-bar {
	display: none;
}

.neova-top-bar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--50);
	min-height: var(--wp--custom--header--top-bar-height);
}

.neova-top-bar__slogan {
	margin: 0;
	font-size: var(--wp--preset--font-size--meta);
	line-height: var(--wp--custom--line-height--tight);
}

/* ---------- Header: 60 px до 1199, 80 px від 1200 (А-08) ---------- */

.neova-header {
	position: relative;
	z-index: 50;
	border-bottom: var(--wp--custom--line--width) solid var(--wp--preset--color--line);
}

/* Мобільний header — поля 16 px, як у макеті. */
.wp-site-blocks .neova-header.has-global-padding {
	padding-inline: var(--wp--custom--header--padding-mobile);
}

.neova-header__row {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--50);
	min-height: var(--wp--custom--header--height-mobile);
}

.neova-header__actions {
	display: flex;
	flex: none;
	align-items: center;
	gap: var(--wp--custom--icon-button--gap);
}

.neova-header__nav.wp-block-navigation {
	display: none;
}

@media (min-width: 1200px) {
	.neova-top-bar-part,
	.neova-top-bar {
		display: block;
	}

	.wp-site-blocks .neova-header.has-global-padding {
		padding-inline: var(--wp--style--root--padding-left);
	}

	/* Сітка як у макеті: лого | меню 800 px по центру | іконки. */
	.neova-header__row {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, var(--wp--style--global--content-size)) minmax(0, 1fr);
		min-height: var(--wp--custom--header--height);
	}

	.neova-header__actions {
		justify-self: end;
	}

	.neova-header__nav.wp-block-navigation {
		display: flex;
		flex: 1 1 auto;
		align-self: stretch;
		justify-content: center;
	}

	.neova-header__nav .wp-block-navigation__container {
		gap: var(--wp--custom--header--nav-gap);
		align-self: stretch;
	}

	.neova-header__nav .wp-block-navigation-item {
		align-self: stretch;
	}

	/* Пункти меню: Onest 13 / 500, uppercase, ls .08em; hover і поточний — лінія 2 px знизу. */
	.neova-header__nav .wp-block-navigation-item__content {
		display: flex;
		align-items: center;
		height: 100%;
		color: var(--wp--preset--color--primary);
		font-size: var(--wp--preset--font-size--meta);
		font-weight: 500;
		letter-spacing: var(--wp--custom--letter-spacing--menu);
		line-height: 1;
		text-decoration: none;
		text-transform: uppercase;
	}

	.neova-header__nav .wp-block-navigation-item__content:hover,
	.neova-header__nav .current-menu-item > .wp-block-navigation-item__content {
		box-shadow: inset 0 calc(-1 * var(--wp--custom--line--accent)) 0 var(--wp--preset--color--primary);
		text-decoration: none;
	}

	.neova-header__nav .wp-block-navigation-item__content:focus-visible {
		outline-offset: calc(-1 * var(--wp--custom--focus--width));
	}

	/* Відкритий пошук стає на місце меню. */
	.neova-header.is-search-open .neova-header__nav {
		visibility: hidden;
	}
}

/* ---------- Пошук у header (А-04, В-11) ---------- */

.neova-icon--close,
.neova-header-search__label-close,
.is-search-open .neova-icon--search,
.is-search-open .neova-header-search__label-open {
	display: none;
}

.is-search-open .neova-icon--close {
	display: block;
}

.neova-header-search__form {
	position: absolute;
	top: 100%;
	right: calc(-1 * var(--wp--custom--header--padding-mobile));
	left: calc(-1 * var(--wp--custom--header--padding-mobile));
	z-index: 40;
	display: flex;
	gap: var(--wp--preset--spacing--20);
	padding: var(--wp--preset--spacing--30) var(--wp--custom--header--padding-mobile);
	border-bottom: var(--wp--custom--line--width) solid var(--wp--preset--color--line);
	background-color: var(--wp--preset--color--white);
}

.neova-header-search__form[hidden] {
	display: none;
}

.neova-header-search__form .neova-header-search__input {
	flex: 1 1 auto;
	min-width: 0;
	min-height: var(--wp--custom--button--height--s);
}

@media (min-width: 1200px) {
	.neova-header-search__form {
		top: 50%;
		right: auto;
		left: 50%;
		width: min(var(--wp--style--global--content-size), 100% - 2 * var(--wp--custom--header--search-inset));
		padding: 0;
		border: 0;
		background: transparent;
		transform: translate(-50%, -50%);
	}
}

/* ---------- Відступ від header до крихт і від крихт до H1 (TOKENS §3: D 48, M 24) ---------- */

.neova-main.has-crumbs {
	padding-top: var(--wp--custom--crumbs-gap);
}

.neova-main.has-crumbs > .neova-breadcrumbs + * {
	margin-block-start: var(--wp--custom--crumbs-gap);
}

/* Шапка сторінки (H1 + лід): від крихт 32 px на desktop, 16 px на мобільному — як у макеті «Доставка й оплата». */
.neova-page-head > .neova-breadcrumbs + *,
.neova-main.has-crumbs > .neova-breadcrumbs + .neova-page-intro {
	margin-block-start: var(--wp--custom--page-head-gap);
}

/* ---------- Footer: D 64 / 40, M 32 / 32 (+ місце під мобільну панель) ---------- */

.neova-footer {
	padding-top: var(--wp--preset--spacing--60);
	padding-bottom: var(--wp--preset--spacing--60);
	font-size: var(--wp--preset--font-size--meta);
	line-height: var(--wp--custom--line-height--tight);
}

.neova-footer p {
	margin: 0;
}

.neova-footer a {
	color: inherit;
	text-decoration: none;
}

.neova-footer a:hover {
	text-decoration: underline;
}

.neova-footer__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--wp--preset--spacing--70);
}

.neova-footer__brand {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--40);
}

.neova-footer__tagline {
	font-size: var(--wp--preset--font-size--small);
}

.neova-footer__col,
.neova-footer__tagline {
	display: none;
}

.neova-footer__title {
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	line-height: var(--wp--custom--line-height--tight);
}

/* Крок посилань 28 px, як у макеті: рядок 14 × 1,4 + 8. */
nav.neova-footer__nav {
	margin-top: var(--wp--preset--spacing--20);
	font-size: var(--wp--preset--font-size--small);
	line-height: var(--wp--custom--line-height--tight);
}

.neova-footer__nav .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--20);
	margin: 0;
}

nav.neova-footer__mobile-nav {
	margin-top: var(--wp--preset--spacing--40);
}

.neova-footer__mobile-nav .wp-block-navigation__container {
	margin: 0;
}

.neova-footer__mobile-nav .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--20) var(--wp--preset--spacing--40);
}

.neova-footer__bottom {
	margin-top: var(--wp--preset--spacing--40);
}

.neova-footer__copy--full {
	display: none;
}

/* Місце під мобільну панель дзвінка (А-07): у макеті footer M 32 / 104. */
@media (max-width: 767px) {
	body:not(.single-product):has(.neova-contact--panel) .neova-footer {
		padding-bottom: calc(var(--wp--preset--spacing--60) + var(--wp--custom--mobile-bar--height));
	}
}

@media (min-width: 768px) {
	.neova-footer {
		padding-top: var(--wp--preset--spacing--80);
		padding-bottom: var(--wp--preset--spacing--70);
		font-size: var(--wp--preset--font-size--small);
	}

	.neova-footer__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.neova-footer__brand {
		grid-column: 1 / -1;
	}

	.neova-footer__col,
	.neova-footer__tagline {
		display: block;
	}

	.neova-footer__mobile-nav.wp-block-navigation {
		display: none;
	}

	.neova-footer__bottom {
		margin-top: var(--wp--preset--spacing--75);
		padding-top: var(--wp--preset--spacing--50);
		border-top: var(--wp--custom--line--width) solid var(--wp--preset--color--line-dark);
	}

	.neova-footer__copy--full {
		display: block;
	}

	.neova-footer__copy--short {
		display: none;
	}
}

@media (min-width: 1200px) {
	.neova-footer__grid {
		grid-template-columns: minmax(0, 432fr) repeat(3, minmax(0, 216fr));
		gap: var(--wp--preset--spacing--70);
	}

	.neova-footer__brand {
		grid-column: auto;
	}
}

/* Header, main і footer щільно один до одного (без blockGap між частинами шаблону);
   у flex-контейнерах header і footer відступи задає gap, а не margin блоків. */
.neova-top-bar__inner > *,
.neova-header__row > *,
.neova-header__actions > *,
.neova-footer__grid > *,
.neova-footer__brand > *,
.neova-footer__col > *,
.neova-footer__bottom > *,
.wp-site-blocks > *,
.wp-block-template-part > .neova-header,
.wp-block-template-part > .neova-footer,
.wp-block-template-part > .neova-top-bar {
	margin-block: 0;
}

/* Footer притиснутий до низу на коротких сторінках. */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
}

.wp-site-blocks > main,
.wp-site-blocks > .neova-main {
	flex: 1 0 auto;
}

/* ---------- Доступність ---------- */

.screen-reader-text:not(:focus):not(:active) {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0s !important;
		animation-duration: 0s !important;
	}
}

/* ---------- Сторінка стилів (патерн neova/style-guide) ---------- */

.neova-style-form {
	display: grid;
	gap: var(--wp--preset--spacing--50);
}

.neova-style-form__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--40);
}
