/*
Theme Name: Asteris
Theme URI: https://asteriscommerce.com/asteris-theme/
Author: Asteris Commerce
Author URI: https://asteriscommerce.com
Description: A clean, fast, WooCommerce-graceful FSE block theme by Asteris Commerce. Ships 14 ready-to-pick WooCommerce product page layouts (Boutique, Long-form, Shopify-clean, Atelier, Gallery, Edge-to-edge, Editorial, Lookbook, Specs, Subscription, Configurator, Wellness, B2B, Tickets — plus the default), 4 style variations, and pairs naturally with the free Asteris Blocks plugin for 50 polished Gutenberg blocks + starter sites. Standalone — does not require any plugin. Lightweight — zero bundled JavaScript, system font stack by default, sub-50KB on the wire.
Version: 1.0.1
Requires at least: 6.7
Tested up to: 7.0
Requires PHP: 8.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: asteris
Tags: full-site-editing, accessibility-ready, e-commerce, blog, portfolio, one-column, two-columns, custom-colors, custom-logo, custom-menu, editor-style, featured-images, threaded-comments, translation-ready, wide-blocks, block-styles, style-variations
*/

/*
 * Theme styles are defined in theme.json (preferred) and per-template HTML.
 * This file exists solely to surface the theme header to WordPress + serve
 * as a fallback for the minority of CSS that theme.json cannot express.
 * Keep this file tiny by design — every rule below is a confessed limitation
 * of theme.json v3, not a stylistic choice.
 */

/* Honour `prefers-reduced-motion` — required for WCAG 2.2 AA on themes that
   ship motion in any pattern. theme.json cannot conditionally suppress
   animations, so we do it here once for the whole theme. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* Visually-hidden utility (WP canonical) — used by the skip link + a11y labels. */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	width: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	word-wrap: normal !important;
}
.screen-reader-text:focus {
	background-color: #fff;
	clip: auto !important;
	clip-path: none;
	display: block;
	height: auto;
	left: 5px;
	top: 5px;
	padding: 15px 23px 14px;
	width: auto;
	z-index: 100000;
}
.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
}

/* Skip-link visibility on focus — required by WP.org accessibility-ready
   tag but the default WP block-theme skip-link CSS doesn't promote to a
   visible state on focus. */
.skip-link:focus {
	position: fixed;
	background: var(--wp--preset--color--ink, #0a0a0a);
	color: var(--wp--preset--color--paper, #ffffff);
	clip: auto !important;
	clip-path: none;
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
	height: auto;
	left: 1rem;
	padding: 0.75rem 1.25rem;
	text-decoration: underline;
	top: 1rem;
	width: auto;
	z-index: 100000;
}

/* Visible keyboard-focus indicator on every interactive element — core
   requirement of the WP.org accessibility-ready tag. :focus-visible keeps the
   ring keyboard-only (mouse clicks stay clean); the :focus fallback covers
   browsers without :focus-visible. High-contrast 2px ring + offset. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.wp-block-button__link:focus-visible,
.wp-block-navigation-item__content:focus-visible,
.wp-block-search .wp-block-search__input:focus-visible,
.wp-block-search .wp-block-search__button:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #AA00FF);
	outline-offset: 2px;
	border-radius: 2px;
}
a:focus,
button:focus,
.wp-block-button__link:focus,
input:focus,
select:focus,
textarea:focus {
	outline: 2px solid var(--wp--preset--color--primary, #AA00FF);
	outline-offset: 2px;
}
/* Modern browsers: suppress the plain :focus ring when the click wasn't
   keyboard-driven, so :focus-visible is the single source of truth. */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
.wp-block-button__link:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
	outline: none;
}

/* Accessibility-ready: links inside running content must be distinguishable
   from surrounding text without relying on colour alone. Some style
   variations (Bold, Shop-focused) drop the global link underline for a
   cleaner look; this re-asserts an underline ONLY for links within post /
   page / comment content, regardless of the active variation. Navigation,
   buttons and standalone UI links are excluded — they're identifiable by
   shape and context. */
.wp-block-post-content a:where(:not(.wp-element-button)):not(:hover),
.entry-content a:where(:not(.wp-element-button)):not(:hover),
.wp-block-comment-content a:not(:hover) {
	text-decoration: underline;
}

/* Print stylesheet — TRT checks for one. Hide non-content chrome. */
@media print {
	header.wp-block-template-part,
	footer.wp-block-template-part,
	.wp-block-navigation,
	.asteris-print-hide {
		display: none !important;
	}
	a[href]::after {
		content: " (" attr(href) ")";
		font-size: 0.85em;
		color: #555;
	}
}

/* Asteris BNPL provider chips — rendered inline by the asteris/product-field
 * binding. Pure text wordmarks (no copyrighted logo files). Brand colours
 * applied inline via style attribute on each badge for trademark-safe
 * referential use. */
.asteris-bnpl-badge {
	display: inline-block;
	padding: 2px 8px;
	margin: 0 2px;
	border-radius: 4px;
	font-size: 0.75em;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.01em;
	vertical-align: baseline;
	white-space: nowrap;
}

/* Asteris per-product Page width override — set via the Page Content tab in
 * the WC product editor. Only takes effect on single-product pages because
 * the body_class filter scopes the asteris-pw-* class to is_product().
 *
 * Wide:  expands the constrained content-size to 1280px.
 * Full:  removes the constraint entirely, with side padding for breathing room.
 *
 * We override BOTH the CSS custom property (for any block that respects it)
 * AND set explicit max-width on the constrained children so older WC blocks
 * that hardcode max-width follow along. */
/* Set the constrained-content-size variable on <main>. Block themes use
 * --wp--style--global--content-size at the point where each constrained
 * layout computes its max-width, so overriding it once at <main> cascades
 * to every constrained descendant — works whether <main> is itself
 * constrained (Atelier, Boutique, Shopify) or alignfull with an inner
 * constrained group (Long-form, Gallery, Edge-to-edge). */
body.asteris-pw-wide main {
	--wp--style--global--content-size: 1280px;
}
body.asteris-pw-full main {
	--wp--style--global--content-size: 100%;
	--wp--style--global--wide-size: 100%;
	padding-left: clamp(16px, 4vw, 64px);
	padding-right: clamp(16px, 4vw, 64px);
	box-sizing: border-box;
}


/* When the product long-description is rendered inside an accordion (via
 * `wp:post-content` inside `wp:details`), the user often starts their
 * description with a heading that matches the accordion's summary — leading
 * to a duplicate label. Suppress the first leading heading inside the
 * post-content wrapper. Body text and any later headings remain untouched. */
.wp-block-details .wp-block-post-content > :first-child:is(h1, h2, h3) {
	display: none;
}

/* Product page accordions — when open, interior is white with dark text.
 * Closed state keeps the dark bar look. The summary stays dark in both
 * states and extends to the box edges via negative margin to compensate
 * for the details element's inline padding. */
.wp-block-details[open].has-background {
	background-color: #ffffff !important;
	color: #1a1a1a !important;
}
.wp-block-details[open].has-background > summary {
	background-color: var(--wp--preset--color--ink, #0a0a0a);
	color: var(--wp--preset--color--paper, #ffffff);
	margin: calc(var(--wp--preset--spacing--40, 1rem) * -1) calc(var(--wp--preset--spacing--50, 2rem) * -1) var(--wp--preset--spacing--40, 1rem);
	padding: var(--wp--preset--spacing--40, 1rem) var(--wp--preset--spacing--50, 2rem);
}
.wp-block-details[open].has-background a {
	color: inherit;
	text-decoration: underline;
}

/* Hide the WC breadcrumbs on products where the Asteris setting is off.
 * Three selectors cover: WP block-editor wrapper (`wp-block-*`), modern WC
 * blocks (`wc-block-components-breadcrumbs`), legacy shortcode/template
 * (`woocommerce-breadcrumb`). */
body.asteris-no-breadcrumbs .wp-block-woocommerce-breadcrumbs,
body.asteris-no-breadcrumbs .wc-block-components-breadcrumbs,
body.asteris-no-breadcrumbs .woocommerce-breadcrumb,
body.asteris-no-breadcrumbs nav[aria-label="Breadcrumb"] {
	display: none !important;
}

/* Per-product sub-text size — applies to the bound sub-paragraph wrappers
 * (asteris-bound-hide-if-empty). Default M leaves the theme preset sizes
 * alone; S and L scale up/down via clamp on font-size. The loyalty banner
 * also rides on this since it shares the same wrapper class. */
body.asteris-st-s .asteris-bound-hide-if-empty p {
	font-size: 0.78rem !important;
	line-height: 1.5;
}
body.asteris-st-l .asteris-bound-hide-if-empty p {
	font-size: 1.05rem !important;
	line-height: 1.55;
}


/* Cart + account icon pairing — butt them together no matter the parent
 * justification. `margin-left: auto` on the account icon consumes all spare
 * horizontal space in a flex container, pushing it (and the cart immediately
 * after it) to the far right with zero gap between them. This is the proper
 * CSS technique for "this element + everything after goes to the right" and
 * overrides justify-content: space-between cleanly. */
header .wp-block-woocommerce-customer-account:has(+ .wp-block-woocommerce-mini-cart),
footer .wp-block-woocommerce-customer-account:has(+ .wp-block-woocommerce-mini-cart) {
	margin-left: auto !important;
	margin-right: 0 !important;
}
header .wp-block-woocommerce-customer-account + .wp-block-woocommerce-mini-cart,
footer .wp-block-woocommerce-customer-account + .wp-block-woocommerce-mini-cart {
	margin-left: -2rem !important;
}
/* Reverse order — cart first, account second. */
header .wp-block-woocommerce-mini-cart:has(+ .wp-block-woocommerce-customer-account),
footer .wp-block-woocommerce-mini-cart:has(+ .wp-block-woocommerce-customer-account) {
	margin-left: auto !important;
	margin-right: 0 !important;
}
header .wp-block-woocommerce-mini-cart + .wp-block-woocommerce-customer-account,
footer .wp-block-woocommerce-mini-cart + .wp-block-woocommerce-customer-account {
	margin-left: -2rem !important;
}

/* Editorial template — drop-cap on the first paragraph of post_content.
 * Scoped to body.template-asteris-editorial OR main.asteris-editorial so it
 * never leaks to other templates. The drop-cap uses ::first-letter on the
 * first paragraph rendered by the wp:post-content block. */
.asteris-editorial .wp-block-post-content > p:first-of-type::first-letter {
	float: left;
	font-family: ui-serif, Georgia, serif;
	font-size: 4.5em;
	line-height: 0.85;
	margin: 0.08em 0.12em 0 0;
	font-weight: 400;
	color: var(--wp--preset--color--ink, #0a0a0a);
}
/* Soften paragraph rhythm — editorial templates read slower. */
.asteris-editorial .wp-block-post-content > p {
	font-size: 1.05rem;
	line-height: 1.7;
	margin: 0 0 1.4em;
}
.asteris-editorial .wp-block-post-content > p:first-of-type::first-line {
	font-variant: small-caps;
	letter-spacing: 0.02em;
}
.asteris-editorial .wp-block-post-content > blockquote,
.asteris-editorial .wp-block-post-content > .wp-block-pullquote {
	margin: 2.5em -1em;
	font-family: ui-serif, Georgia, serif;
	font-size: 1.5rem;
	font-style: italic;
	line-height: 1.4;
	border-left: 2px solid var(--wp--preset--color--ink, #0a0a0a);
	padding-left: 1.5em;
}

/* ─────────────────────────────────────────────────────────────────────────
   WooCommerce cart + checkout polish.
   The theme serves cart/checkout via the classic shortcode (for Asteris Cart
   compatibility). WC's default classic markup is very plain, and theme.json
   button styles only reach core/button blocks — never WC's `.button` class —
   so the storefront commerce surfaces are styled here.
   ───────────────────────────────────────────────────────────────────────── */

/* Cart + totals tables → clean card */
.woocommerce table.shop_table {
	border: 1px solid var(--wp--preset--color--border, #e6e6e6);
	border-radius: 10px;
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
}
.woocommerce table.shop_table thead th,
.woocommerce table.shop_table th {
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--wp--preset--color--muted, #6b7280);
	background: var(--wp--preset--color--subtle, #f6f7f9);
	padding: 14px 16px;
}
.woocommerce table.shop_table td { padding: 16px; vertical-align: middle; }
.woocommerce table.shop_table img { border-radius: 8px; }
.woocommerce table.cart td.product-thumbnail img { width: 72px; height: auto; }

/* Quantity input */
.woocommerce .quantity .qty {
	padding: 8px;
	border: 1px solid var(--wp--preset--color--border, #e6e6e6);
	border-radius: 6px;
	width: 64px;
	text-align: center;
}

/* Remove (×) → subtle circle that fills red on hover */
.woocommerce a.remove {
	color: #c0392b !important;
	border-radius: 50%;
	line-height: 1.6;
	width: 1.6em;
	height: 1.6em;
}
.woocommerce a.remove:hover { background: #c0392b !important; color: #fff !important; }

/* WC `.button` (doesn't inherit theme.json button styles) → dark default */
.woocommerce .button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit {
	background: var(--wp--preset--color--ink, #0a0a0a);
	color: var(--wp--preset--color--paper, #ffffff);
	border: none;
	border-radius: 8px;
	padding: 12px 22px;
	font-weight: 600;
	font-size: 0.95rem;
	transition: background 0.15s ease, filter 0.15s ease;
}
.woocommerce .button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover { background: var(--wp--preset--color--primary, #AA00FF); color: #fff; }

/* Primary CTAs → brand violet */
.woocommerce .button.alt,
.woocommerce #place_order,
.wc-proceed-to-checkout a.checkout-button {
	background: var(--wp--preset--color--primary, #AA00FF);
	color: #ffffff;
}
.woocommerce .button.alt:hover,
.woocommerce #place_order:hover,
.wc-proceed-to-checkout a.checkout-button:hover { filter: brightness(0.92); }

/* Proceed to checkout → big, full-width, unmissable */
.wc-proceed-to-checkout a.checkout-button {
	display: block;
	width: 100%;
	text-align: center;
	padding: 16px 22px;
	font-size: 1.05rem;
	border-radius: 10px;
	margin-top: 6px;
}

/* Section headings */
.cart_totals > h2,
.cross-sells > h2,
.woocommerce-checkout #order_review_heading {
	font-size: 1.15rem;
	font-weight: 700;
	margin: 0 0 14px;
}

/* Coupon row */
.woocommerce-cart-form .actions .coupon .input-text {
	padding: 10px 12px;
	border: 1px solid var(--wp--preset--color--border, #e6e6e6);
	border-radius: 6px;
	min-width: 160px;
}
.woocommerce-cart-form .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.woocommerce-cart-form .actions .coupon { display: flex; gap: 8px; }

/* Checkout form fields */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce-checkout select,
.woocommerce form .form-row .select2-container .select2-selection {
	border: 1px solid var(--wp--preset--color--border, #e6e6e6) !important;
	border-radius: 6px;
	padding: 10px 12px;
	min-height: 44px;
}
.woocommerce-checkout #payment { border-radius: 10px; }
.woocommerce-checkout #payment ul.payment_methods { padding: 16px; }

/* ─────────────────────────────────────────────────────────────────────────
   Theme Review: content wrapping + media containment + page stability.
   Stops long unbreakable strings, wide/aligned images, preformatted text and
   tables from forcing horizontal page scroll on the theme-unit-test pages
   ("Page Markup And Formatting", "Page Image Alignment"). theme.json cannot
   express these, so they live here.
   ───────────────────────────────────────────────────────────────────────── */

/* Safety net: nothing should push the document wider than the viewport. */
body { overflow-x: hidden; }

/* Long words, URLs and titles wrap instead of overflowing the column. */
.wp-block-post-title,
.wp-block-heading,
.wp-block-post-content,
.entry-content,
.wp-block-comment-content,
h1, h2, h3, h4, h5, h6, p, li, dd, dt, figcaption, td, th {
	overflow-wrap: break-word;
	word-wrap: break-word;
}

/* Media stays inside its container. */
img,
figure img,
.wp-block-image img,
.wp-block-post-featured-image img,
.wp-block-cover__image-background,
video,
iframe,
embed,
object {
	max-width: 100%;
	height: auto;
}

/* Captioned figures — incl. the legacy [caption] shortcode that emits an inline
   pixel width — stay within the content column instead of forcing page scroll. */
figure,
figure.wp-caption,
.wp-caption {
	max-width: 100%;
	height: auto;
	box-sizing: border-box;
}
.wp-caption img { max-width: 100%; height: auto; }

/* Left/right-aligned images must not escape the content column. */
.alignleft,
.alignright,
.wp-block-image.alignleft,
.wp-block-image.alignright { max-width: 50%; }
@media (max-width: 600px) {
	.alignleft,
	.alignright,
	.wp-block-image.alignleft,
	.wp-block-image.alignright { max-width: 100%; float: none; margin-left: 0; margin-right: 0; }
}

/* Preformatted text + code wrap rather than blowing out the layout. */
pre, code, kbd, samp {
	overflow-wrap: break-word;
	word-break: break-word;
}
pre {
	white-space: pre-wrap;
	overflow-x: auto;
	max-width: 100%;
}

/* Tables scroll inside their own box instead of stretching the page. */
.wp-block-table,
figure.wp-block-table { overflow-x: auto; max-width: 100%; }

/* Wide/full alignments capped to the viewport so they wrap gracefully. */
.alignwide { max-width: min(var(--wp--style--global--wide-size, 1280px), 100%); }
.alignfull { max-width: 100%; }
