/*
 * Shared UI components that sit above theme.json: button behaviour, the
 * section rhythm primitives, and the eyebrow label. Every value comes from a
 * theme.json token - no literal colours or timings here.
 */

/* --- Buttons -------------------------------------------------------- */

.wp-element-button,
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--wp--preset--spacing--2);
	border: 1px solid transparent;
	line-height: 1.2;
	text-decoration: none;
	transition:
		background-color var(--wp--custom--duration--fast) var(--wp--custom--ease--out),
		border-color var(--wp--custom--duration--fast) var(--wp--custom--ease--out),
		color var(--wp--custom--duration--fast) var(--wp--custom--ease--out),
		transform var(--wp--custom--duration--fast) var(--wp--custom--ease--out);
}

.wp-element-button:hover,
.wp-block-button__link:hover {
	transform: translateY(-1px);
}

.wp-element-button:active,
.wp-block-button__link:active {
	transform: translateY(0);
}

/* Outline variant: transparent until hover, then inverts to solid ink. */
.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background),
.wp-element-button.is-style-outline {
	background-color: transparent;
	border-color: var(--wp--custom--border--on-light);
	color: var(--wp--preset--color--contrast);
}

.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background):hover,
.wp-element-button.is-style-outline:hover {
	background-color: var(--wp--preset--color--contrast);
	border-color: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

/* On dark sections the outline flips to light-on-dark. */
.section--dark .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background),
.section--dark .wp-element-button.is-style-outline {
	border-color: var(--wp--custom--border--on-dark);
	color: var(--wp--preset--color--base);
}

.section--dark .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background):hover,
.section--dark .wp-element-button.is-style-outline:hover {
	background-color: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

/* Arrow affordance: any button whose label ends in an arrow nudges it. */
.wp-element-button .btn-arrow,
.wp-block-button__link .btn-arrow {
	display: inline-block;
	transition: transform var(--wp--custom--duration--fast) var(--wp--custom--ease--out);
}

.wp-element-button:hover .btn-arrow,
.wp-block-button__link:hover .btn-arrow {
	transform: translateX(4px);
}

/* --- Section rhythm ------------------------------------------------- */

.section {
	padding-block: var(--wp--custom--section--padding);
}

.section--tight {
	padding-block: var(--wp--custom--section--padding-tight);
}

.section--soft {
	background: var(--wp--preset--color--base-soft);
}

.section--muted {
	background: var(--wp--preset--color--base-subtle);
}

.section--dark {
	background: var(--wp--preset--color--base-dark);
	color: var(--wp--preset--color--base);
}

.section--dark :where(h1, h2, h3, h4, h5, h6) {
	color: var(--wp--preset--color--base);
}

.section--dark :where(p, li) {
	color: var(--wp--preset--color--on-dark-muted);
}

/*
 * Links on dark grounds.
 *
 * theme.json paints every link with `primary`, which is #111111 in the
 * monochrome palette - inherited onto a #0A0A0A section that renders at a
 * 1.05:1 contrast ratio, i.e. invisible. This is the guard so any future dark
 * section is safe by default; buttons keep their own colours.
 *
 * Wrapped in :where() on purpose - zero specificity, so it only ever acts as a
 * floor. A component that wants a quieter link colour (the footer does) still
 * wins without needing !important.
 */
:where(.section--dark, .cine) :where(a:not(.wp-element-button):not(.wp-block-button__link)) {
	color: var(--wp--preset--color--base);
}

/* --- Eyebrow label -------------------------------------------------- */

/*
 * Grey, not black: the eyebrow sits directly above a near-black headline, and
 * matching its colour would make the two compete instead of reading as a
 * label and its heading.
 */
.section__eyebrow {
	margin: 0;
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wp--preset--color--contrast-subtle);
}

.section--dark .section__eyebrow {
	color: var(--wp--preset--color--accent);
}

/* --- Section head (title left, link right) --------------------------- */

.section__head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--4);
	margin-bottom: var(--wp--preset--spacing--10);
}

.section__head .section__title {
	margin: var(--wp--preset--spacing--2) 0 0;
}

.section__link {
	display: inline-flex;
	align-items: center;
	gap: var(--wp--preset--spacing--2);
	flex-shrink: 0;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	text-decoration: none;
	color: var(--wp--preset--color--contrast);
	padding-bottom: 2px;
	border-bottom: 1px solid var(--wp--custom--border--on-light);
	transition:
		color var(--wp--custom--duration--fast) var(--wp--custom--ease--out),
		border-color var(--wp--custom--duration--fast) var(--wp--custom--ease--out);
}

.section__link:hover {
	color: var(--wp--preset--color--primary);
	border-bottom-color: var(--wp--preset--color--primary);
}

.section__link .btn-arrow {
	transition: transform var(--wp--custom--duration--fast) var(--wp--custom--ease--out);
}

.section__link:hover .btn-arrow {
	transform: translateX(4px);
}

.section--dark .section__link {
	color: var(--wp--preset--color--base);
	border-bottom-color: var(--wp--custom--border--on-dark);
}

/*
 * Full-bleed sections (see cinematic.css) use the 100vw + negative-margin
 * technique, and 100vw includes the scrollbar - so on a desktop with a
 * classic scrollbar they overshoot the viewport by ~15px and the page can
 * scroll sideways.
 *
 * `clip` rather than `hidden` on purpose: `hidden` would turn this into a
 * scroll container and silently break position:sticky anywhere inside it
 * (the product gallery relies on that).
 */
.wp-site-blocks {
	overflow-x: clip;
}

/*
 * wp-content/plugins/visa-acceptance-solutions/public/css/
 * visa-acceptance-payment-gateway-blocks.css ships, inside its own
 * `@media (max-width: 481px)`, a bare `.woocommerce { display: grid; }` -
 * clearly meant to restyle one specific card-details form (the same query
 * also targets `#exp-month-div`), but the selector has no scoping at all.
 * `.woocommerce` is WooCommerce core's own namespacing class, printed on
 * <body> AND on several structural wrapper divs (the single-product content
 * wrapper among them) - below 481px this silently turns every one of them
 * into a grid container. A grid item's default `auto` track has no upper
 * bound of its own - it sizes to its widest descendant's content width - so
 * <main> (a grid item of the product-content wrapper, itself a grid item of
 * <body>) rendered at that content width and was then only visually clipped
 * by `.wp-site-blocks`'s `overflow-x: clip` above instead of actually
 * reflowing to the viewport: on a product page this pushed the gallery image
 * and everything after it well past the right edge on any phone-width
 * screen, nested two levels deep, past the plain `body.woocommerce` this
 * rule first only fixed for the outermost case.
 *
 * Scoped to the same media query as the plugin's own rule (not applied
 * unconditionally) so nothing here overrides a legitimate flex/grid layout
 * some other `.woocommerce`-classed element might genuinely use above
 * 481px. The doubled class matches the plugin's selector but at specificity
 * (0,2,0) instead of (0,1,0), so it wins regardless of the two stylesheets'
 * load order without needing `!important`.
 */
@media (max-width: 481px) {
	.woocommerce.woocommerce {
		display: block;
	}
}

/*
 * Anywhere WooCommerce's sale flash does still render, pull it into the
 * palette - core styles it olive from its own stylesheet, not from a token.
 */
.onsale {
	background-color: var(--wp--preset--color--sale);
	color: var(--wp--preset--color--base);
}

/*
 * Touch targets.
 *
 * Inline text CTAs measure their own line height (~26px), which is fine to
 * click with a mouse and awkward to hit with a thumb. On touch layouts they
 * get a 44px tap area without changing how they look - the underline still
 * hugs the text, the box around it just grows.
 */
@media (max-width: 781px) {
	.section__link,
	.uc__cta,
	.cmp__cta {
		min-height: 44px;
	}

	/* Footer link lists are the densest stack of small targets on the site. */
	.site-footer__col ul {
		gap: 0;
	}

	.site-footer__col li a {
		display: flex;
		align-items: center;
		min-height: 44px;
	}
}

/* --- Empty states (404, no posts) ------------------------------------ */

.notfound {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--4);
	padding-block: var(--wp--custom--section--padding);
	max-width: 46ch;
}

.notfound--inline {
	padding-block: var(--wp--preset--spacing--12);
}

.notfound__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--xl-5);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.04em;
	text-wrap: balance;
}

.notfound__text {
	margin: 0;
	font-size: var(--wp--preset--font-size--lg);
	line-height: 1.55;
	color: var(--wp--preset--color--contrast-subtle);
}

.notfound__search {
	display: flex;
	gap: var(--wp--preset--spacing--2);
	width: 100%;
	max-width: 420px;
	margin-top: var(--wp--preset--spacing--2);
}

.notfound__search input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 48px;
	padding: 0 var(--wp--preset--spacing--4);
	border: 1px solid var(--wp--custom--border--on-light);
	border-radius: var(--wp--custom--radius--md);
	font-size: var(--wp--preset--font-size--base);
}

.notfound__search button {
	flex-shrink: 0;
	min-height: 48px;
	padding: 0 var(--wp--preset--spacing--5);
	border: 0;
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	cursor: pointer;
	transition: background-color var(--wp--custom--duration--fast) var(--wp--custom--ease--out);
}

.notfound__search button:hover {
	background: var(--wp--preset--color--primary-hover);
}

.notfound__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--3);
	margin-top: var(--wp--preset--spacing--2);
}

/* Post listing (blog / generic archive). */
.wp-block-query .wp-block-post-title {
	margin: 0 0 var(--wp--preset--spacing--2);
	font-size: var(--wp--preset--font-size--xl-2);
	letter-spacing: -0.025em;
}

.wp-block-query .wp-block-post-template > li + li {
	margin-top: var(--wp--preset--spacing--10);
	padding-top: var(--wp--preset--spacing--10);
	border-top: 1px solid var(--wp--custom--border--on-light);
}

.archive-heading {
	margin: var(--wp--preset--spacing--10) 0 var(--wp--preset--spacing--8);
	font-size: var(--wp--preset--font-size--xl-4);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.035em;
	text-wrap: balance;
}

/* --- Static content pages (Гарантія, Контакти, Доставка …) ------------ */

/*
 * These pages were left with no treatment at all: the title rendered at the
 * default heading size with no vertical rhythm, which read as unfinished next
 * to the rest of the site.
 */
/*
 * Named .content-page, not .page: WordPress puts a `page` class on <body> for
 * every page, so a bare `.page` rule here also matched the document body and
 * added 144px of padding under the footer on every single page.
 */
.content-page {
	padding-bottom: var(--wp--custom--section--padding);
}

.content-page__title {
	margin: var(--wp--preset--spacing--8) 0 var(--wp--preset--spacing--10);
	font-size: var(--wp--preset--font-size--xl-4);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.035em;
	text-wrap: balance;
}

.content-page .wp-block-post-content {
	font-size: var(--wp--preset--font-size--lg);
	line-height: 1.7;
	color: var(--wp--preset--color--contrast-subtle);
}

.content-page .wp-block-post-content > * + * {
	margin-top: var(--wp--preset--spacing--5);
}

.content-page .wp-block-post-content :where(h2, h3, h4) {
	margin-top: var(--wp--preset--spacing--12);
	color: var(--wp--preset--color--contrast);
}

.content-page .wp-block-post-content :where(ul, ol) {
	padding-left: var(--wp--preset--spacing--5);
}

.content-page .wp-block-post-content li + li {
	margin-top: var(--wp--preset--spacing--2);
}

/* Breadcrumbs are shared by pages, the catalogue and single products. */
.wp-block-woocommerce-breadcrumbs {
	margin-top: var(--wp--preset--spacing--6);
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--contrast-muted);
}

.wp-block-woocommerce-breadcrumbs a {
	color: var(--wp--preset--color--contrast-subtle);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color var(--wp--custom--duration--fast) var(--wp--custom--ease--out);
}

.wp-block-woocommerce-breadcrumbs a:hover {
	border-bottom-color: var(--wp--preset--color--contrast-subtle);
}

/*
 * WordPress gives every top-level block a --wp--style--block-gap margin. The
 * header is position:fixed and out of flow, so that margin landed on <main>
 * instead - a 24px white strip above the hero, and another above the footer.
 * Header, main and footer are meant to sit flush.
 */
.wp-site-blocks > header,
.wp-site-blocks > main,
.wp-site-blocks > footer {
	margin-block: 0;
}
