/*
Theme Name: KefirBuy
Description: Block theme for KefirBuy — small-batch kefir, grains and live-culture goods.
Author: The DaaS Labs
Version: 0.7.2
Requires at least: 6.7
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kefirbuy
WC requires at least: 8.0
*/

/*
This file intentionally contains only the theme header.
Global styles live in theme.json; add custom CSS below as the theme grows.
*/

/* ---------------------------------------------------------------- Forms */

.kb-form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
	gap: var(--wp--preset--spacing--20);
	margin-top: var(--wp--preset--spacing--30);
}

.kb-form__row {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
}

.kb-form__row--wide {
	grid-column: 1 / -1;
}

.kb-form input[type="text"],
.kb-form input[type="tel"],
.kb-form input[type="email"],
.kb-form textarea {
	padding: 0 14px;
	border: 1px solid var(--wp--preset--color--sand);
	border-radius: var(--wp--custom--radius--sm);
	background: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--ink);
	font: inherit;
	font-weight: 400;
}

.kb-form input[type="text"],
.kb-form input[type="tel"],
.kb-form input[type="email"] {
	height: 48px;
}

.kb-form textarea {
	padding: 12px 14px;
	resize: vertical;
}

.kb-form :is(input, textarea):focus-visible {
	outline: 2px solid var(--wp--preset--color--forest);
	outline-offset: 1px;
}

/* Honeypot: off-screen rather than display:none, which some bots detect. */
.kb-form__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.kb-form__notice {
	grid-column: 1 / -1;
	margin: 0;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
}

.kb-form__notice--ok {
	color: var(--wp--preset--color--forest);
}

.kb-form__notice--error {
	color: var(--wp--preset--color--rust);
}

/* --------------------------------------------------------------- Motion */

/*
 * Scroll reveals.
 *
 * The hidden state is applied by JavaScript (.kb-r) and removed again
 * (.kb-in), so with JavaScript off nothing is ever hidden. motion.js also
 * refuses to hide anything already on screen, and force-reveals after a
 * timeout if its observer never fires.
 */

.kb-r {
	opacity: 0;
	transform: translateY(40px);
	transition:
		opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
		transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
	will-change: opacity, transform;
}

.kb-r.kb-in {
	opacity: 1;
	transform: none;
	/* will-change: transform makes this element the containing block for
	   absolutely positioned descendants, which would shrink every
	   stretched-link overlay (category tiles, learn cards) to the text. */
	will-change: auto;
}

/* Headline words rise and unblur one after another. */
.kb-w {
	display: inline-block;
	opacity: 0;
	transform: translateY(70%) rotate(6deg);
	filter: blur(8px);
	transition:
		opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
		transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
		filter 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.kb-in .kb-w,
.kb-w.kb-in {
	opacity: 1;
	transform: none;
	filter: blur(0);
}

/* A heading that has been word-split must not fade as a block as well. */
.kb-r:has(.kb-w) {
	opacity: 1;
	transform: none;
}

/* Cards lift slightly under the pointer, as in the design. */
@media (hover: hover) and (pointer: fine) {
	.wc-block-product,
	.wp-block-post-content .wp-block-column > .wp-block-group {
		transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
	}

	.wc-block-product:hover,
	.wp-block-post-content .wp-block-column > .wp-block-group:hover {
		transform: translateY(-4px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.kb-r,
	.kb-w,
	.kb-r.kb-in,
	.kb-in .kb-w {
		opacity: 1 !important;
		transform: none !important;
		filter: none !important;
		transition: none !important;
	}
}
