/*
Theme Name: Cartonomic
Theme URI: https://cartonomic.com
Author: Cartonomic
Description: Lightweight, mobile-first block theme for Cartonomic: unofficial motorsport fan gifts. Dark charcoal, off-white and one accent colour.
Requires at least: 6.6
Tested up to: 6.9
Requires PHP: 7.4
Version: 1.0.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cartonomic-theme
*/

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body { overflow-wrap: break-word; }
img, svg, video { max-width: 100%; height: auto; }

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

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Small uppercase label above headings */
.cn-eyebrow {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--accent);
	margin-bottom: 0.5rem;
}

/* ---------- Header ---------- */
.cn-header {
	border-bottom: 1px solid rgba(245, 243, 238, 0.12);
}
.cn-header .wp-block-site-title a { color: var(--wp--preset--color--offwhite); }
.cn-header .wp-block-site-title a::after {
	content: "";
	display: inline-block;
	width: 0.45em;
	height: 0.45em;
	margin-left: 0.25em;
	background: var(--wp--preset--color--accent);
	vertical-align: baseline;
}
.cn-header .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--charcoal);
	color: var(--wp--preset--color--offwhite);
	padding: 1.5rem;
}

/* ---------- Sections ---------- */
.cn-section {
	padding-top: var(--wp--preset--spacing--60);
	padding-bottom: var(--wp--preset--spacing--60);
}
.cn-light {
	background: var(--wp--preset--color--offwhite);
	color: var(--wp--preset--color--charcoal);
}
.cn-light a:not(.wp-element-button):not(.wp-block-button__link) { color: var(--wp--preset--color--accent-deep); }
.cn-light .cn-eyebrow { color: var(--wp--preset--color--accent-deep); }
.cn-graphite { background: var(--wp--preset--color--graphite); }
.cn-lead { font-size: var(--wp--preset--font-size--large); color: var(--wp--preset--color--muted); max-width: 40ch; }
.cn-light .cn-lead { color: var(--wp--preset--color--ink-muted); }

/* Hero with an abstract racing-stripe motif (pure CSS, no images) */
.cn-hero {
	position: relative;
	overflow: hidden;
	padding-top: clamp(4rem, 12vw, 9rem);
	padding-bottom: clamp(4rem, 12vw, 9rem);
	isolation: isolate;
}
.cn-hero::before {
	content: "";
	position: absolute;
	inset: 0 -20% 0 auto;
	width: 45%;
	z-index: -1;
	background:
		repeating-linear-gradient(-62deg, transparent 0 46px, rgba(245, 243, 238, 0.05) 46px 52px),
		linear-gradient(-62deg, transparent 0 58%, var(--wp--preset--color--accent) 58% 60%, transparent 60% 64%, rgba(245, 243, 238, 0.18) 64% 65%, transparent 65%);
	pointer-events: none;
}
.cn-hero h1 { margin-top: 0; }
/* On phones keep the stripes to the right edge so they never sit behind text. */
@media (max-width: 781px) {
	.cn-hero::before { width: 40%; inset: 0 -22% 0 auto; opacity: 0.45; }
}

/* Chequered divider */
.cn-chequer {
	height: 14px;
	background: repeating-conic-gradient(var(--wp--preset--color--offwhite) 0 25%, var(--wp--preset--color--charcoal) 0 50%) 0 0 / 14px 14px;
	opacity: 0.85;
	margin: 0;
}

/* ---------- Product cards (markup from the Cartonomic Core plugin) ---------- */
.cn-cards {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}
.cn-card {
	background: var(--wp--preset--color--graphite);
	color: var(--wp--preset--color--offwhite);
	border-top: 4px solid var(--wp--preset--color--accent);
	display: flex;
	flex-direction: column;
	height: 100%;
}
.cn-light .cn-card { background: #fff; color: var(--wp--preset--color--charcoal); box-shadow: 0 1px 0 rgba(22, 24, 27, 0.08), 0 8px 24px rgba(22, 24, 27, 0.06); }
.cn-card__media { aspect-ratio: 4 / 3; overflow: hidden; background: #2c3036; }
.cn-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cn-card__body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.cn-card__title {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 800;
	text-transform: uppercase;
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.1;
	margin: 0;
}
.cn-card__price { font-weight: 700; margin: 0; }
.cn-card__benefit { margin: 0; color: var(--wp--preset--color--muted); }
.cn-light .cn-card__benefit { color: var(--wp--preset--color--ink-muted); }
.cn-card__cta { margin-top: auto; padding-top: 0.75rem; }

.cn-buy.wp-element-button,
.cn-buy {
	display: inline-block;
	text-decoration: none;
}
.cn-buy[aria-disabled="true"] {
	background: transparent;
	color: inherit;
	border: 2px solid currentColor;
	opacity: 0.75;
	cursor: not-allowed;
}

/* ---------- How it works (numbered steps) ---------- */
.cn-steps .wp-block-column { position: relative; padding-top: 3.25rem; }
.cn-steps { counter-reset: cn-step; }
.cn-steps .wp-block-column::before {
	counter-increment: cn-step;
	content: "0" counter(cn-step);
	position: absolute;
	top: 0;
	left: 0;
	font-family: var(--wp--preset--font-family--display);
	font-weight: 800;
	font-size: 2.5rem;
	line-height: 1;
	color: var(--wp--preset--color--accent);
}
.cn-light .cn-steps .wp-block-column::before { color: var(--wp--preset--color--accent-deep); }

/* ---------- Trust strip ---------- */
.cn-trust {
	border-top: 1px solid rgba(245, 243, 238, 0.12);
	border-bottom: 1px solid rgba(245, 243, 238, 0.12);
	padding-top: var(--wp--preset--spacing--40);
	padding-bottom: var(--wp--preset--spacing--40);
}
.cn-trust .wp-block-column p {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin: 0;
}
.cn-trust .wp-block-column p::before {
	content: "";
	display: inline-block;
	width: 0.6em;
	height: 0.6em;
	margin-right: 0.6em;
	background: var(--wp--preset--color--accent);
	transform: skewX(-20deg);
}

/* ---------- FAQ (Details blocks) ---------- */
.wp-block-details {
	border-bottom: 1px solid rgba(127, 127, 127, 0.35);
	padding: 1rem 0;
}
.wp-block-details summary {
	cursor: pointer;
	font-weight: 700;
	font-size: var(--wp--preset--font-size--large);
}
.wp-block-details > :not(summary) { margin-top: 0.75rem; }

/* ---------- Example portrait gallery ---------- */
.cn-gallery figcaption { font-size: var(--wp--preset--font-size--small); }

/* ---------- Notices ---------- */
.cn-notice {
	border-left: 4px solid var(--wp--preset--color--accent);
	background: var(--wp--preset--color--graphite);
	padding: 1rem 1.25rem;
}
.cn-light .cn-notice { background: #fff; }
.cn-draft-notice {
	border: 2px dashed var(--wp--preset--color--accent);
	padding: 1rem 1.25rem;
	font-weight: 700;
}

/* ---------- Style guide swatches ---------- */
.cn-swatch { min-height: 120px; padding: 1rem; display: flex; flex-direction: column; justify-content: flex-end; }
.cn-swatch p { margin: 0; }

/* ---------- Footer ---------- */
.cn-footer {
	border-top: 1px solid rgba(245, 243, 238, 0.12);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}
.cn-footer a { color: var(--wp--preset--color--offwhite); }
.cn-footer h2 {
	font-size: 1rem;
	letter-spacing: 0.12em;
	color: var(--wp--preset--color--offwhite);
}
.cn-footer ul { list-style: none; padding-left: 0; margin: 0; }
.cn-footer li + li { margin-top: 0.4rem; }
.cn-footer .cn-disclaimer {
	border-top: 1px solid rgba(245, 243, 238, 0.12);
	padding-top: 1.25rem;
}

/* ---------- Forms (sign-up, contact, comments) ---------- */
:where(input[type="email"], input[type="text"], input[type="search"], input[type="tel"], input[type="number"], select, textarea) {
	font: inherit;
	color: var(--wp--preset--color--charcoal);
	background: #fff;
	border: 2px solid #6b6f75;
	border-radius: 2px;
	padding: 0.7rem 0.85rem;
	max-width: 100%;
}

/* ---------- Shop home sections ---------- */
.cn-category-strip .wp-block-image img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.cn-category-strip h3 a { text-decoration: none; }
.cn-bestsellers ul.products { margin: 0; }
.cn-links-page { text-align: center; }
.cn-links-page .cn-lead { margin-left: auto; margin-right: auto; }
.cn-links { max-width: 26rem; margin: 2rem auto 0; display: grid; gap: 0.75rem; }
.cn-links .wp-block-buttons { justify-content: center; margin: 0; }
.cn-links .wp-block-button { width: 100%; }
.cn-links .wp-block-button__link { display: block; width: 100%; box-sizing: border-box; }
.cn-small { font-size: var(--wp--preset--font-size--small); }

/* ---------- Product grids (shop, categories, "Popular right now") ---------- */
ul.products {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 1.25rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}
ul.products::before, ul.products::after { display: none !important; }
ul.products li.product {
	width: auto !important;
	margin: 0 !important;
	float: none !important;
	background: #fff;
	color: var(--wp--preset--color--charcoal);
	border-top: 4px solid var(--wp--preset--color--accent);
	padding: 0 0 1rem;
	display: flex;
	flex-direction: column;
}
ul.products li.product a { text-decoration: none; color: inherit; }
ul.products li.product img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; margin: 0 0 0.75rem; display: block; }
ul.products li.product .woocommerce-loop-product__title {
	font-family: var(--wp--preset--font-family--body);
	text-transform: none;
	letter-spacing: 0;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.35;
	margin: 0 0.85rem 0.5rem;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
ul.products li.product .price { display: block; margin: 0 0.85rem 0.75rem; font-weight: 700; color: var(--wp--preset--color--charcoal); }
ul.products li.product .button { margin: auto 0.85rem 0; align-self: flex-start; }

/* Long product names: readable size on product pages */
body.single-product .wp-block-post-title,
body.single-product .product_title {
	font-size: clamp(1.5rem, 1.1rem + 2vw, 2.25rem);
	line-height: 1.15;
	letter-spacing: 0;
}
body.single-product .wp-block-woocommerce-product-meta .is-layout-flex { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
body.single-product .wp-block-woocommerce-product-meta { font-size: var(--wp--preset--font-size--small); }
