/*
Theme Name: Abels Grain
Theme URI: https://abelsgrain.com/
Author: Inventh
Author URI: https://inventh.com/
Description: Custom block theme for Abels Grain, a Kerala millet brand (processed millet grains, millet flours and millet cookies). Built on the WordPress Site Editor and WooCommerce, in the Abels Grain corporate colours. Every page, header, footer and section is editable from Appearance > Editor without code.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: abels-grain
Tags: block-patterns, full-site-editing, e-commerce, custom-colors, editor-style, wide-blocks
WC requires at least: 9.0
*/

/* ------------------------------------------------------------
   Brand tokens not expressible in theme.json
   ------------------------------------------------------------ */
:root {
	--ag-leaf-radius: 40px 6px 40px 6px;
	--ag-leaf-radius-sm: 22px 4px 22px 4px;
	--ag-ease: cubic-bezier(.2, .7, .2, 1);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { transition: none !important; animation: none !important; }
	.ag-hero h1 em { background-position: 0 0 !important; }
}

/* Accessible skip link focus */
.skip-link:focus { background: var(--wp--preset--color--sun); color: var(--wp--preset--color--ink); }

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--sun);
	outline-offset: 3px;
}

/* ------------------------------------------------------------
   Utility classes (add under Block > Advanced > Additional CSS class)
   ------------------------------------------------------------ */
.ag-eyebrow {
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--wp--preset--color--forest);
}
.ag-script { font-family: var(--wp--preset--font-family--caveat); font-weight: 700; line-height: 1.1; }
.ag-ml { font-family: "Noto Sans Malayalam", var(--wp--preset--font-family--poppins); }

/* Leaf shape: two rounded opposite corners, taken from the Abels Grain logo mark */
.is-style-leaf,
.is-style-leaf img,
.ag-leaf { border-radius: var(--ag-leaf-radius) !important; overflow: hidden; }
.is-style-leaf-small,
.is-style-leaf-small img { border-radius: var(--ag-leaf-radius-sm) !important; overflow: hidden; }

/* Card hover lift */
.is-style-lift-card {
	transition: transform .35s var(--ag-ease), box-shadow .35s var(--ag-ease);
	background: var(--wp--preset--color--white);
}
.is-style-lift-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--wp--preset--shadow--lift);
}

/* Secondary button style: sun orange with dark text (passes WCAG AA) */
.wp-block-button.is-style-sun .wp-block-button__link {
	background: var(--wp--preset--color--sun);
	color: var(--wp--preset--color--ink);
}
.wp-block-button.is-style-sun .wp-block-button__link:hover { background: var(--wp--preset--color--harvest); }
.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--forest);
	border: 2px solid currentColor;
}
.wp-block-button.is-style-outline .wp-block-button__link:hover { background: var(--wp--preset--color--forest); color: #fff; border-color: var(--wp--preset--color--forest); }
.has-deep-background-color .wp-block-button.is-style-outline .wp-block-button__link,
.has-forest-background-color .wp-block-button.is-style-outline .wp-block-button__link { color: #fff; }

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */
.ag-site-header { position: sticky; top: 0; z-index: 50; }
.ag-site-header > * { margin-block-start: 0 !important; }
.ag-header-icons .wp-block-search__button {
	background: transparent; color: var(--wp--preset--color--deep);
	padding: .4rem; border: 0; margin: 0; min-width: 0;
}
.ag-header-icons .wp-block-search__button:hover { background: var(--wp--preset--color--leaf-tint); }
.ag-header-icons .wp-block-search__button svg { width: 24px; height: 24px; fill: currentColor; }
.ag-header-icons .wp-block-search__inside-wrapper { border: 0; }
.ag-header-icons .wp-block-search__input { border-radius: 999px; border: 1px solid var(--wp--preset--color--sand); padding: .45rem .9rem; }
.admin-bar .ag-site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .ag-site-header { top: 46px; } }
.ag-site-header .wp-block-site-logo img { height: auto; max-height: 64px; width: auto; }
.ag-announce a { color: inherit; }
.ag-header-icons .wc-block-mini-cart__button,
.ag-header-icons .wp-block-woocommerce-customer-account a { color: var(--wp--preset--color--deep); }
.wc-block-mini-cart__badge { background: var(--wp--preset--color--sun) !important; color: var(--wp--preset--color--ink) !important; }

/* ------------------------------------------------------------
   Hero (animated)
   Entrance: text rises in sequence, photo reveals in the leaf shape.
   Ambient: two leaf shapes from the logo drift slowly; photo floats.
   All motion is switched off for visitors who set "reduce motion".
   ------------------------------------------------------------ */
.ag-hero { position: relative; overflow: hidden; isolation: isolate; }
.ag-hero::before,
.ag-hero::after {
	content: "";
	position: absolute;
	z-index: -1;
	pointer-events: none;
}
/* Large green leaf, top right */
.ag-hero::after {
	right: -110px; top: -110px;
	width: 360px; height: 360px;
	background: var(--wp--preset--color--leaf);
	opacity: .14;
	border-radius: 180px 20px 180px 20px;
	animation: ag-drift 14s ease-in-out infinite alternate;
}
/* Small orange leaf, bottom left (the orange quarter of the logo) */
.ag-hero::before {
	left: -40px; bottom: -40px;
	width: 160px; height: 160px;
	background: var(--wp--preset--color--sun);
	opacity: .16;
	border-radius: 80px 10px 80px 10px;
	animation: ag-drift 11s ease-in-out infinite alternate-reverse;
}
.ag-hero h1 em { font-style: normal; color: var(--wp--preset--color--field); }

/* Text entrance, staggered */
.ag-hero .wp-block-column:first-child > * {
	animation: ag-rise .8s var(--ag-ease) both;
}
.ag-hero .wp-block-column:first-child > :nth-child(1) { animation-delay: .05s; }
.ag-hero .wp-block-column:first-child > :nth-child(2) { animation-delay: .18s; }
.ag-hero .wp-block-column:first-child > :nth-child(3) { animation-delay: .34s; }
.ag-hero .wp-block-column:first-child > :nth-child(4) { animation-delay: .48s; }
.ag-hero .wp-block-column:first-child > :nth-child(5) { animation-delay: .62s; }

/* "Happier lives." sweeps in from gold to green */
.ag-hero h1 em {
	background: linear-gradient(90deg, var(--wp--preset--color--field) 0 50%, var(--wp--preset--color--harvest) 50% 100%);
	background-size: 200% 100%;
	background-position: 100% 0;
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	animation: ag-sweep 1.1s .7s var(--ag-ease) both;
}

/* Photo: leaf-shaped reveal, then a slow float */
.ag-hero .wp-block-column:last-child .wp-block-image {
	animation:
		ag-reveal 1.1s .25s var(--ag-ease) both,
		ag-float 7s 1.4s ease-in-out infinite;
}

@keyframes ag-rise {
	from { opacity: 0; transform: translateY(22px); }
	to   { opacity: 1; transform: none; }
}
@keyframes ag-sweep {
	from { background-position: 100% 0; }
	to   { background-position: 0 0; }
}
@keyframes ag-reveal {
	from { opacity: 0; transform: scale(.94); clip-path: inset(12% 12% 12% 12% round 40px 6px 40px 6px); }
	to   { opacity: 1; transform: none; clip-path: inset(0 0 0 0 round 40px 6px 40px 6px); }
}
@keyframes ag-float {
	0%, 100% { transform: translateY(0); }
	50%      { transform: translateY(-10px); }
}
@keyframes ag-drift {
	from { transform: translate(0, 0) rotate(0deg); }
	to   { transform: translate(-24px, 18px) rotate(8deg); }
}

/* Keep the editor calm: show everything immediately while editing */
.editor-styles-wrapper .ag-hero *,
.editor-styles-wrapper .ag-hero::before,
.editor-styles-wrapper .ag-hero::after { animation: none !important; }
.editor-styles-wrapper .ag-hero h1 em { -webkit-text-fill-color: currentColor; background: none; }

/* Category and product cards */
.ag-card img { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; }
.ag-card .wp-block-image { margin-bottom: 0; width: 100%; }
.ag-card .wp-block-image a { display: block; }
.ag-card a { text-decoration: none; }
.ag-card a:hover { text-decoration: underline; }

/* Process steps */
.ag-steps .ag-step-num {
	display: inline-grid; place-items: center;
	width: 44px; height: 44px; border-radius: 16px 4px 16px 4px;
	background: var(--wp--preset--color--sun); color: var(--wp--preset--color--ink);
	font-weight: 700;
}

/* ------------------------------------------------------------
   WooCommerce: classic loop (used by [products] shortcode) and blocks
   ------------------------------------------------------------ */
.woocommerce ul.products { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; margin: 0; padding: 0; }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none !important; }
.woocommerce ul.products.columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .woocommerce ul.products, .woocommerce ul.products.columns-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .woocommerce ul.products { gap: .9rem; } }
.woocommerce ul.products li.product {
	width: auto !important; margin: 0 !important; float: none !important;
	background: #fff; border-radius: var(--wp--custom--radius--card); padding: .75rem .75rem 1.25rem;
	text-align: center;
	transition: transform .35s var(--ag-ease), box-shadow .35s var(--ag-ease);
}
.woocommerce ul.products li.product:hover { transform: translateY(-4px); box-shadow: var(--wp--preset--shadow--lift); }
.woocommerce ul.products li.product a img { border-radius: 14px; aspect-ratio: 1/1; object-fit: cover; margin-bottom: .75rem; }
.woocommerce ul.products li.product .woocommerce-loop-product__title { font-size: var(--wp--preset--font-size--medium); font-weight: 600; color: var(--wp--preset--color--deep); padding: 0 .25rem; }
.woocommerce ul.products li.product .price { color: var(--wp--preset--color--forest); font-weight: 600; font-size: var(--wp--preset--font-size--medium); }
.woocommerce ul.products li.product .button,
.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
.woocommerce #respond input#submit {
	background: var(--wp--preset--color--forest); color: #fff;
	border-radius: 999px; font-weight: 600; padding: .75rem 1.4rem;
}
.woocommerce a.button:hover, .woocommerce button.button:hover { background: var(--wp--preset--color--deep); color: #fff; }
.woocommerce a.button.alt, .woocommerce button.button.alt { background: var(--wp--preset--color--sun); color: var(--wp--preset--color--ink); }
.woocommerce span.onsale { background: var(--wp--preset--color--sun); color: var(--wp--preset--color--ink); }
.woocommerce .star-rating span::before { color: var(--wp--preset--color--harvest); }

/* WooCommerce block templates (shop, product, cart, checkout) */
.wc-block-components-product-name, .wc-block-grid__product-title { color: var(--wp--preset--color--deep); }
.wc-block-components-button:not(.is-link),
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button {
	background: var(--wp--preset--color--forest) !important; color: #fff !important; border-radius: 999px !important;
}
.wc-block-components-button:not(.is-link):hover { background: var(--wp--preset--color--deep) !important; }
.wc-block-product-template .wc-block-components-product-image img,
.wp-block-woocommerce-product-image img { border-radius: 14px; }
.wc-block-components-notice-banner.is-success { border-color: var(--wp--preset--color--forest); }

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.ag-footer a { color: inherit; text-decoration: none; }
.ag-footer a:hover { text-decoration: underline; color: var(--wp--preset--color--sun); }
.ag-footer .wp-block-site-logo img { background: #fff; padding: 10px 14px; border-radius: 18px 4px 18px 4px; }
.ag-footer ul { list-style: none; padding-left: 0; }
.ag-footer ul li { margin-bottom: .4rem; }

/* Floating WhatsApp button (rendered by functions.php, toggle in Customizer-free settings constant) */
.ag-wa-float {
	position: fixed; right: 18px; bottom: 18px; z-index: 60;
	width: 56px; height: 56px; border-radius: 50%;
	display: grid; place-items: center;
	background: #25D366; color: #fff; box-shadow: 0 10px 24px -8px rgba(0,0,0,.35);
	transition: transform .25s var(--ag-ease);
}
.ag-wa-float:hover { transform: scale(1.06); color: #fff; }
.ag-wa-float svg { width: 30px; height: 30px; }

/* Mobile tidy-ups */
@media (max-width: 781px) {
	.ag-hide-mobile { display: none !important; }
	.ag-hero::after { width: 200px; height: 200px; right: -80px; top: -80px; }
	.ag-hero::before { width: 110px; height: 110px; }
}

/* Trust strip: leaf marker in the logo's colours (three green, one orange) */
.ag-trust-item { text-align: center; }
.ag-trust-item::before {
	content: ""; display: block; width: 44px; height: 44px; margin: 0 auto .7rem;
	border-radius: 20px 4px 20px 4px; background: var(--wp--preset--color--leaf);
}
.ag-trust-item:nth-child(4n)::before { background: var(--wp--preset--color--sun); }
.ag-trust-item p { margin: 0; }
.has-leaf-to-forest-gradient-background .wp-block-button.is-style-outline .wp-block-button__link { color: #fff; border-color: #fff; }
.has-leaf-to-forest-gradient-background .wp-block-button.is-style-outline .wp-block-button__link:hover { background: #fff; color: var(--wp--preset--color--deep); }

/* FAQ accordion */
.wp-block-details summary {
	cursor: pointer; list-style: none; font-weight: 600; color: var(--wp--preset--color--deep);
	display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.wp-block-details summary::-webkit-details-marker { display: none; }
.wp-block-details summary::after {
	content: "+"; flex: none; width: 30px; height: 30px; display: grid; place-items: center;
	border-radius: 12px 3px 12px 3px; background: var(--wp--preset--color--leaf-tint);
	color: var(--wp--preset--color--forest); font-weight: 700;
	transition: transform .25s var(--ag-ease);
}
.wp-block-details[open] summary::after { content: "\2212"; background: var(--wp--preset--color--sun); color: var(--wp--preset--color--ink); }
.wp-block-details > :not(summary) { color: var(--wp--preset--color--muted); margin-top: .6rem; }
