/*
Theme Name: Sari-Sari Store
Theme URI: https://sari-saristore.ca
Author: Sari-Sari Store
Description: A warm, hand-painted block theme for an online sari-sari store: "anything under the sun", sold the way the corner tindahan does it. Built for WooCommerce and print-on-demand (Printful / Printify), with a Paskong Pinoy Christmas look out of the box and an everyday style variation for the rest of the year.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.4.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sari-sari
Tags: e-commerce, block-patterns, full-site-editing, style-variations, custom-colors, wide-blocks
WC requires at least: 9.0
WC tested up to: 11.2
*/

/* ---------- Global niceties ---------- */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

::selection { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--contrast); }

:where(.wp-site-blocks) a:focus-visible,
:where(.wp-site-blocks) button:focus-visible,
:where(.wp-site-blocks) input:focus-visible,
:where(.wp-site-blocks) select:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
}

/* Buttons: the "sticker" press effect */
.wp-element-button,
.wp-block-button__link,
.wc-block-components-button:not(.is-link),
.woocommerce a.button,
.woocommerce button.button {
	transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.wp-element-button:hover,
.wp-block-button__link:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 0 var(--wp--preset--color--contrast); }
.wp-element-button:active,
.wp-block-button__link:active { transform: translate(3px, 3px); box-shadow: 0 0 0 0 var(--wp--preset--color--contrast); }

/* Outline button style (core) */
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	border: 2px solid var(--wp--preset--color--contrast);
}
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--wp--preset--color--accent); }

/* ---------- Header ---------- */
.sari-topbar { font-weight: 800; letter-spacing: .01em; }
.sari-topbar p { margin: 0; }
.sari-topbar a { color: inherit; }

.sari-header .wp-block-site-title { white-space: nowrap; }
.sari-header .wp-block-site-logo img { display: block; }
.sari-header .wc-block-mini-cart__button,
.sari-header .wc-block-customer-account a { color: var(--wp--preset--color--contrast); }
.sari-header .wc-block-mini-cart__badge {
	background: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--base) !important;
	font-weight: 800;
}

/* The awning: red/cream stripes with scalloped edge, like a tindahan's yero canopy */
.sari-awning {
	--awning-stripe: 46px;
	height: 26px;
	margin-top: 0 !important;
	position: relative;
	background:
		repeating-linear-gradient(90deg,
			var(--wp--preset--color--primary) 0 var(--awning-stripe),
			var(--wp--preset--color--base) var(--awning-stripe) calc(var(--awning-stripe) * 2));
	border-top: 2px solid var(--wp--preset--color--contrast);
}
.sari-awning::after {
	content: "";
	position: absolute;
	left: 0; right: 0; top: 100%;
	height: 14px;
	background:
		radial-gradient(ellipse calc(var(--awning-stripe) / 2) 14px at 50% 0, var(--wp--preset--color--primary) 97%, transparent 100%) calc(var(--awning-stripe) / -2) 0 / calc(var(--awning-stripe) * 2) 14px repeat-x,
		radial-gradient(ellipse calc(var(--awning-stripe) / 2) 14px at 50% 0, var(--wp--preset--color--base) 97%, transparent 100%) calc(var(--awning-stripe) / 2) 0 / calc(var(--awning-stripe) * 2) 14px repeat-x;
	filter: drop-shadow(0 2px 0 var(--wp--preset--color--contrast));
	z-index: 2;
	pointer-events: none;
}
.sari-awning + * { padding-top: calc(var(--wp--preset--spacing--40) + 14px); }

/* ---------- Seasonal backgrounds ---------- */
.sari-starry {
	background-image:
		radial-gradient(circle at 12% 18%, rgba(251, 244, 230, .55) 0 2px, transparent 3px),
		radial-gradient(circle at 78% 12%, rgba(251, 244, 230, .45) 0 2px, transparent 3px),
		radial-gradient(circle at 42% 70%, rgba(251, 244, 230, .35) 0 1.5px, transparent 2.5px),
		radial-gradient(circle at 90% 80%, rgba(242, 182, 50, .55) 0 2px, transparent 3px),
		radial-gradient(circle at 25% 88%, rgba(251, 244, 230, .4) 0 1.5px, transparent 2.5px),
		radial-gradient(circle at 62% 30%, rgba(242, 182, 50, .45) 0 1.5px, transparent 2.5px);
	background-size: 340px 300px;
}

/* The "rehas": the iron grille of a sari-sari store window */
.sari-grille {
	background-image:
		repeating-linear-gradient(90deg, rgba(42, 28, 20, .07) 0 3px, transparent 3px 26px),
		linear-gradient(0deg, transparent calc(50% - 1.5px), rgba(42, 28, 20, .07) calc(50% - 1.5px) calc(50% + 1.5px), transparent calc(50% + 1.5px));
}

/* ---------- Hero ---------- */
.sari-hero .sari-eyebrow {
	display: inline-block;
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--contrast);
	border: 2px solid var(--wp--preset--color--contrast);
	border-radius: 999px;
	padding: .2em .9em;
	transform: rotate(-2deg);
	box-shadow: var(--wp--preset--shadow--sticker);
}
.sari-hero h1 { text-shadow: 3px 3px 0 var(--wp--preset--color--secondary-dark); }
.sari-hero .sari-hero-art img { width: 100%; height: auto; filter: drop-shadow(0 18px 24px rgba(0,0,0,.25)); }

@media (prefers-reduced-motion: no-preference) {
	.sari-hero-art img { animation: sari-sway 6s ease-in-out infinite alternate; transform-origin: 50% 0; }
	@keyframes sari-sway { from { transform: rotate(-.6deg); } to { transform: rotate(.6deg); } }
}

/* Hand-lettered sign heading */
.sari-sign {
	display: inline-block;
	background: var(--wp--preset--color--base);
	border: 3px solid var(--wp--preset--color--contrast);
	border-radius: 12px;
	padding: .15em .6em;
	box-shadow: 0 0 0 6px var(--wp--preset--color--accent), 6px 6px 0 6px var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--primary);
}

/* ---------- Cards & tiles ---------- */
.sari-card {
	border: 2px solid var(--wp--preset--color--contrast);
	border-radius: var(--wp--custom--radius);
	box-shadow: var(--wp--preset--shadow--sticker);
	overflow: hidden;
	transition: transform .15s ease, box-shadow .15s ease;
}
.sari-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 0 var(--wp--preset--color--contrast); }
.sari-card .wp-block-image { margin: 0; }
.sari-card .wp-block-image img { display: block; width: 100%; height: auto; }
.sari-card h3 a { text-decoration: none; color: inherit; }
.sari-card h3 a::after { content: " →"; }
.sari-card a:focus-visible { outline-offset: -3px; }

.sari-step-num {
	display: inline-grid;
	place-items: center;
	width: 2.2em; height: 2.2em;
	border-radius: 50%;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	border: 2px solid var(--wp--preset--color--contrast);
}

/* ---------- WooCommerce ---------- */
/* Product cards in collections */
.wc-block-product-template .wc-block-product,
.wp-block-woocommerce-product-template > li {
	background: var(--wp--preset--color--base);
	border: 2px solid var(--wp--preset--color--contrast);
	border-radius: var(--wp--custom--radius);
	box-shadow: var(--wp--preset--shadow--sticker);
	padding: 0 0 1rem;
	overflow: hidden;
	transition: transform .15s ease, box-shadow .15s ease;
}
.wc-block-product-template .wc-block-product:hover,
.wp-block-woocommerce-product-template > li:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 0 var(--wp--preset--color--contrast); }
.wc-block-product-template .wc-block-product > *:not(.wc-block-components-product-image),
.wp-block-woocommerce-product-template > li > *:not(.wc-block-components-product-image) { padding-left: .9rem; padding-right: .9rem; }
.wc-block-product-template .wc-block-components-product-image { margin-bottom: .75rem !important; background: var(--wp--preset--color--base-2); border-bottom: 2px solid var(--wp--preset--color--contrast); }
.wc-block-product-template .wc-block-components-product-image img { border-radius: 0 !important; }

/* Price as a little hand-written price tag */
.wc-block-product-template .wc-block-components-product-price,
.sari-price-tag .wc-block-components-product-price {
	display: inline-block;
	position: relative;
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--contrast);
	border: 2px solid var(--wp--preset--color--contrast);
	border-radius: 6px 6px 6px 6px;
	padding: .1em .6em .1em 1.1em;
	transform: rotate(-2deg);
	font-family: var(--wp--preset--font-family--display);
}
.wc-block-product-template .wc-block-components-product-price::before,
.sari-price-tag .wc-block-components-product-price::before {
	content: "";
	position: absolute;
	left: .4em; top: 50%;
	width: .35em; height: .35em;
	margin-top: -.175em;
	border-radius: 50%;
	background: var(--wp--preset--color--base);
	border: 1.5px solid var(--wp--preset--color--contrast);
}
.wc-block-components-product-price del { opacity: .65; font-size: .85em; }
.wc-block-components-product-price ins { text-decoration: none; }

/* Sale badge = parol red sticker */
.wc-block-components-product-sale-badge {
	background: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--base) !important;
	border: 2px solid var(--wp--preset--color--contrast) !important;
	border-radius: 999px !important;
	font-family: var(--wp--preset--font-family--display);
	text-transform: none !important;
	transform: rotate(-6deg);
}

/* Single product */
.sari-single-product .wp-block-woocommerce-product-image-gallery,
.sari-single-product .wp-block-woocommerce-product-gallery {
	background: var(--wp--preset--color--base-2);
	border: 2px solid var(--wp--preset--color--contrast);
	border-radius: var(--wp--custom--radius);
	box-shadow: var(--wp--preset--shadow--sticker);
	padding: 1rem;
}
.sari-single-product .wc-block-components-product-price { font-size: var(--wp--preset--font-size--x-large); }
.woocommerce div.product form.cart .variations select,
.wc-block-add-to-cart-form select,
.wp-block-add-to-cart-form select {
	border: 2px solid var(--wp--preset--color--contrast);
	border-radius: 10px;
	padding: .5em .75em;
	background-color: var(--wp--preset--color--base);
	font: inherit;
}
.wp-block-add-to-cart-form .quantity .qty,
.wc-block-add-to-cart-form .quantity .qty {
	border: 2px solid var(--wp--preset--color--contrast);
	border-radius: 10px;
	min-height: 3rem;
}
.wp-block-add-to-cart-form .single_add_to_cart_button,
.wc-block-add-to-cart-form .single_add_to_cart_button {
	background: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--base) !important;
	border: 2px solid var(--wp--preset--color--contrast) !important;
	border-radius: 999px !important;
	box-shadow: var(--wp--preset--shadow--sticker);
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.125rem !important;
	padding: .8em 1.8em !important;
}
.sari-pod-note {
	border: 2px dashed var(--wp--preset--color--secondary);
	border-radius: var(--wp--custom--radius);
}
.sari-pod-note p { margin: 0; }

/* Tabs / details */
.wp-block-woocommerce-product-details .wc-tabs li a { font-family: var(--wp--preset--font-family--display); font-weight: 400; }

/* Breadcrumbs & sorting */
.wc-block-breadcrumbs, .woocommerce-breadcrumb { font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--muted); }
.wc-block-catalog-sorting select,
.woocommerce-ordering select {
	border: 2px solid var(--wp--preset--color--contrast);
	border-radius: 999px;
	padding: .4em 1em;
	background: var(--wp--preset--color--base);
	font: inherit;
	font-weight: 700;
}

/* Store notices */
.wc-block-components-notice-banner { border-radius: var(--wp--custom--radius) !important; border-width: 2px !important; }

/* Pagination */
.wp-block-query-pagination a,
.wp-block-query-pagination .page-numbers {
	display: inline-grid; place-items: center;
	min-width: 2.4em; height: 2.4em;
	border: 2px solid var(--wp--preset--color--contrast);
	border-radius: 999px;
	text-decoration: none;
	font-weight: 800;
	color: var(--wp--preset--color--contrast);
}
.wp-block-query-pagination .page-numbers.current { background: var(--wp--preset--color--primary); color: var(--wp--preset--color--base); }

/* ---------- Footer ---------- */
.sari-footer a { color: var(--wp--preset--color--base); }
.sari-footer a:hover { color: var(--wp--preset--color--accent); }
.sari-footer .wp-block-navigation a { text-decoration: none; }
.sari-footer .wp-block-navigation a:hover { text-decoration: underline; }
.sari-footer h2, .sari-footer h3 { color: var(--wp--preset--color--accent); }
.sari-footer-bunting {
	height: 30px;
	margin-top: 0 !important;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='30'%3E%3Cpath d='M0 3 Q22 9 44 3 T88 3' fill='none' stroke='%23FBF4E6' stroke-width='2'/%3E%3Cpath d='M6 5 L38 5 L22 28 Z' fill='%23C8202F' stroke='%232A1C14' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M50 5 L82 5 L66 28 Z' fill='%23F2B632' stroke='%232A1C14' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0 / 88px 30px repeat-x;
}

/* ---------- Small screens ---------- */
@media (max-width: 781px) {
	.sari-header .wp-block-site-title { font-size: 1.35rem !important; }
	.sari-header .wp-block-site-logo img { width: 40px !important; }
	.sari-header > .alignwide { gap: .75rem !important; }
	.sari-hero { text-align: center; }
	.sari-hero .wp-block-buttons { justify-content: center; }
	.sari-header-tools { gap: .5rem !important; }
	.sari-awning { --awning-stripe: 30px; height: 18px; }
}

/* ---------- Helpers added after first pass ---------- */
.sari-sign.has-text-align-center { display: table; margin-left: auto !important; margin-right: auto !important; }
.sari-card { position: relative; }
.sari-card h3 a::before { content: ""; position: absolute; inset: 0; z-index: 1; }

/* Header search: a quiet icon button, not a pill */
.sari-header .wp-block-search__button,
.sari-header .wp-block-search__button:hover {
	background: transparent !important;
	color: var(--wp--preset--color--contrast) !important;
	border: 0 !important;
	box-shadow: none !important;
	transform: none !important;
	padding: .35em !important;
	margin-left: 0 !important;
}
.sari-header .wp-block-search__button svg { width: 26px; height: 26px; fill: currentColor; }
.wp-block-search__input { border: 2px solid var(--wp--preset--color--contrast); border-radius: 999px; padding: .4em .9em; background: var(--wp--preset--color--base); }

/* Cards: art runs edge to edge unless padding is set on the block */
.sari-card.wp-block-group:not([style*="padding"]) { padding: 0; }

/* Product cards: left-align the button with the title and price */
.wc-block-product-template .wp-block-woocommerce-product-button,
.wc-block-product-template .wc-block-components-product-button { justify-content: flex-start; align-items: flex-start; text-align: left; }
.wc-block-product-template .wc-block-components-product-button__button { box-shadow: var(--wp--preset--shadow--sticker); border: 2px solid var(--wp--preset--color--contrast) !important; border-radius: 999px !important; }

/* Header icons share the ink colour */
.sari-header .wp-block-woocommerce-customer-account a,
.sari-header .wp-block-woocommerce-customer-account svg { color: var(--wp--preset--color--contrast); fill: currentColor; }

/* Classic sale flash on the product gallery */
.woocommerce span.onsale,
.wp-block-woocommerce-product-image-gallery span.onsale {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	border: 2px solid var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--display);
	font-weight: 400;
	min-height: 0; min-width: 0;
	padding: .35em .8em;
	line-height: 1.2;
	border-radius: 999px;
	transform: rotate(-6deg);
	z-index: 3;
}

/* Variation dropdowns: room for the arrow */
.wp-block-add-to-cart-form table.variations select,
.wc-block-add-to-cart-form table.variations select {
	padding-right: 2.75em !important;
	min-width: 12rem;
	background-position: right .9em center !important;
}
.wp-block-add-to-cart-form table.variations th.label { vertical-align: middle; font-weight: 800; }
.wp-block-add-to-cart-form .reset_variations { font-size: var(--wp--preset--font-size--small); }

/* ---------- All-sales-final notice (cart & checkout) ---------- */
.sari-policy-notice {
	max-width: var(--wp--style--global--wide-size, 1240px);
	margin: 0 auto 1.5rem;
	padding: .9rem 1.2rem;
	border: 2px dashed var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--radius);
	background: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--small);
}
.sari-policy-notice p { margin: 0; }
.sari-policy-notice strong { color: var(--wp--preset--color--primary); }
.woocommerce-checkout-review-order .sari-policy-notice { margin: 0 0 1rem; }

/* ---------- Policy page ---------- */
.sari-policy h2 { margin-top: var(--wp--preset--spacing--40); font-size: var(--wp--preset--font-size--large); }
.sari-policy .sari-policy-lead {
	padding: 1rem 1.25rem;
	border: 2px solid var(--wp--preset--color--contrast);
	border-radius: var(--wp--custom--radius);
	background: var(--wp--preset--color--base-2);
	box-shadow: var(--wp--preset--shadow--sticker);
	font-weight: 700;
}
