/*
Theme Name: Haoyi B2B
Description: Buyer-focused presentation theme for the shared TTCH Catalog Core.
Version: 0.4.0
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: haoyi-b2b
*/

:root {
	--haoyi-ink: #17211d;
	--haoyi-muted: #59645f;
	--haoyi-paper: #f6f3eb;
	--haoyi-surface: #fff;
	--haoyi-soft: #e8eee9;
	--haoyi-accent: #1f654d;
	--haoyi-accent-dark: #124636;
	--haoyi-gold: #d99b38;
	--haoyi-line: #d9e0dc;
	--haoyi-radius: 1.25rem;
	--haoyi-shadow: 0 1.2rem 3rem rgba(23, 33, 29, .08);
	--haoyi-shell: 74rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--haoyi-paper);
	color: var(--haoyi-ink);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 1rem;
	line-height: 1.65;
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--haoyi-accent-dark); }
a:hover { color: var(--haoyi-accent); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
	outline: 3px solid var(--haoyi-gold);
	outline-offset: 3px;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	top: 1rem;
	left: 1rem;
	z-index: 10000;
	width: auto;
	height: auto;
	padding: .75rem 1rem;
	clip: auto;
	background: var(--haoyi-surface);
}

.haoyi-shell,
.site-shell,
.ttch-shell {
	width: min(calc(100% - 2rem), var(--haoyi-shell));
	margin-inline: auto;
}

.haoyi-site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	border-bottom: 1px solid rgba(217, 224, 220, .9);
	background: rgba(246, 243, 235, .94);
	backdrop-filter: blur(12px);
}

.admin-bar .haoyi-site-header { top: 32px; }

.haoyi-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	min-height: 5rem;
}

.haoyi-brand {
	display: inline-flex;
	align-items: center;
	gap: .7rem;
	color: var(--haoyi-ink);
	font-size: 1.28rem;
	font-weight: 850;
	letter-spacing: -.035em;
	text-decoration: none;
}

.haoyi-brand__mark {
	display: grid;
	place-items: center;
	width: 2.3rem;
	height: 2.3rem;
	border-radius: .75rem .75rem .75rem .2rem;
	background: var(--haoyi-accent);
	color: #fff;
	font-size: 1rem;
	font-weight: 850;
}

.haoyi-nav ul {
	display: flex;
	align-items: center;
	gap: .25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.haoyi-nav a {
	display: inline-flex;
	align-items: center;
	min-height: 2.8rem;
	padding: .55rem .8rem;
	border-radius: 999px;
	color: var(--haoyi-ink);
	font-size: .91rem;
	font-weight: 720;
	text-decoration: none;
}

.haoyi-nav a:hover { background: rgba(31, 101, 77, .08); }
.haoyi-nav__cta a { padding-inline: 1rem; background: var(--haoyi-accent); color: #fff; }
.haoyi-nav__cta a:hover { background: var(--haoyi-accent-dark); color: #fff; }

.menu-toggle {
	display: none;
	align-items: center;
	gap: .6rem;
	min-height: 2.8rem;
	padding: .55rem .8rem;
	border: 1px solid var(--haoyi-line);
	border-radius: 999px;
	background: var(--haoyi-surface);
	color: var(--haoyi-ink);
	font: inherit;
	font-weight: 750;
}

.menu-toggle__icon,
.menu-toggle__icon::before,
.menu-toggle__icon::after {
	display: block;
	width: 1.1rem;
	height: 2px;
	background: currentColor;
	content: "";
}
.menu-toggle__icon { position: relative; }
.menu-toggle__icon::before { position: absolute; top: -.35rem; }
.menu-toggle__icon::after { position: absolute; top: .35rem; }

.haoyi-main { min-height: 62vh; }
.haoyi-page,
.haoyi-product,
.haoyi-not-found { padding-block: clamp(3rem, 7vw, 6rem); }

.haoyi-page__header,
.haoyi-product__header { max-width: 52rem; margin-bottom: 2rem; }

h1,
h2,
h3 {
	margin-top: 0;
	line-height: 1.08;
	letter-spacing: -.035em;
}
h1 { font-size: clamp(2.65rem, 7vw, 5.4rem); }
h2 { font-size: clamp(1.9rem, 4vw, 3.1rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.45rem); }
p { margin-top: 0; }

.haoyi-eyebrow,
.ttch-kicker,
.eyebrow {
	margin-bottom: .8rem;
	color: var(--haoyi-accent);
	font-size: .74rem;
	font-weight: 850;
	letter-spacing: .16em;
	text-transform: uppercase;
}

.haoyi-hero {
	position: relative;
	display: grid;
	align-items: center;
	min-height: min(42rem, calc(100vh - 5rem));
	overflow: hidden;
	background:
		radial-gradient(circle at 82% 18%, rgba(31, 101, 77, .2), transparent 23rem),
		linear-gradient(135deg, #fbfaf6 0%, #e9eee8 100%);
}

.haoyi-hero::after {
	position: absolute;
	right: -7rem;
	bottom: -12rem;
	width: 34rem;
	height: 34rem;
	border: 5rem solid rgba(255, 255, 255, .5);
	border-radius: 50%;
	content: "";
}

.haoyi-hero__inner { position: relative; z-index: 1; padding-block: clamp(4rem, 9vw, 7rem); }
.haoyi-hero h1 { max-width: 13ch; margin-bottom: 1.2rem; }
.haoyi-lede { max-width: 44rem; margin: 0; color: var(--haoyi-muted); font-size: clamp(1.1rem, 2vw, 1.4rem); }

.haoyi-actions,
.wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .8rem;
	margin-top: 1.8rem;
}

.haoyi-button,
.ttch-button,
.button,
.wp-block-button__link,
.haoyi-catalog-filter button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 3rem;
	padding: .72rem 1.2rem;
	border: 1px solid var(--haoyi-accent);
	border-radius: 999px;
	background: var(--haoyi-accent);
	color: #fff;
	font: inherit;
	font-weight: 760;
	text-decoration: none;
	cursor: pointer;
}

.haoyi-button:hover,
.ttch-button:hover,
.button:hover,
.wp-block-button__link:hover,
.haoyi-catalog-filter button:hover { background: var(--haoyi-accent-dark); color: #fff; }
.is-style-outline .wp-block-button__link { background: transparent; color: var(--haoyi-accent-dark); }
.is-style-outline .wp-block-button__link:hover { background: rgba(31, 101, 77, .08); }

.haoyi-section { padding-block: clamp(3.5rem, 7vw, 6.5rem); }
.haoyi-section--light { background: var(--haoyi-surface); }
.haoyi-section h2 { max-width: 16ch; margin-bottom: 2rem; }

.haoyi-category-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1rem;
}

.haoyi-category-card {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	min-height: 9.5rem;
	padding: 1.25rem;
	border: 1px solid var(--haoyi-line);
	border-radius: var(--haoyi-radius);
	background: linear-gradient(145deg, #fff, #edf2ee);
	box-shadow: 0 .6rem 1.8rem rgba(23, 33, 29, .05);
	color: var(--haoyi-ink);
	text-decoration: none;
}

.haoyi-category-card:hover { transform: translateY(-2px); border-color: rgba(31, 101, 77, .4); }
.haoyi-category-card span { font-size: 1.18rem; font-weight: 800; }
.haoyi-category-card small { color: var(--haoyi-muted); }

.haoyi-steps { gap: 1rem; }
.haoyi-steps .wp-block-column,
.haoyi-feature-columns .wp-block-column {
	padding: 1.3rem;
	border-top: 3px solid var(--haoyi-accent);
	background: var(--haoyi-paper);
}
.haoyi-steps h3,
.haoyi-feature-columns h2 { margin-bottom: .65rem; font-size: 1.18rem; }
.haoyi-steps p,
.haoyi-feature-columns p { margin: 0; color: var(--haoyi-muted); }

.haoyi-final-cta {
	padding: clamp(2rem, 5vw, 4rem);
	border-radius: calc(var(--haoyi-radius) * 1.4);
	background: var(--haoyi-ink);
	color: #fff;
}
.haoyi-final-cta h2 { margin-bottom: .75rem; }
.haoyi-final-cta p { max-width: 42rem; color: #d9e1dc; }

.ttch-featured-products { padding-block: clamp(3.5rem, 7vw, 6.5rem); background: #edf1ed; }
.section-head { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.section-head > p { max-width: 34rem; color: var(--haoyi-muted); }
.featured-products-footer { margin-top: 1.5rem; }

.ttch-product-grid,
.ttch-featured-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.25rem;
}

.ttch-product-card,
.ttch-featured-card {
	overflow: hidden;
	border: 1px solid var(--haoyi-line);
	border-radius: var(--haoyi-radius);
	background: var(--haoyi-surface);
	box-shadow: var(--haoyi-shadow);
}

.ttch-product-card > a,
.ttch-featured-card > a { display: block; height: auto; color: inherit; text-decoration: none; }
.ttch-product-card:hover,
.ttch-featured-card:hover { transform: translateY(-3px); }

.ttch-product-visual { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #e4ebe6; }
.ttch-product-placeholder { display: block; width: 100%; height: 100%; background: linear-gradient(145deg, #dfe7e1, #f4f6f3); }
.ttch-product-image { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.ttch-product-card:hover .ttch-product-image,
.ttch-featured-card:hover .ttch-product-image { transform: scale(1.025); }
.visual-badge { position: absolute; left: .8rem; bottom: .8rem; padding: .3rem .55rem; border-radius: 999px; background: rgba(23, 33, 29, .82); color: #fff; font-size: .7rem; }

.ttch-card-body { padding: 1.2rem; }
.ttch-card-body h2,
.ttch-card-body h3 { margin-bottom: .55rem; font-size: 1.28rem; }
.ttch-card-body p { color: var(--haoyi-muted); }
.ttch-card-link { display: inline-flex; margin-top: .3rem; color: var(--haoyi-accent-dark); font-weight: 760; }
.ttch-card-specs { margin: 1rem 0; padding: 0; list-style: none; }
.ttch-card-specs li { display: flex; justify-content: space-between; gap: .75rem; padding-block: .45rem; border-top: 1px solid var(--haoyi-line); font-size: .83rem; }

.haoyi-catalog { padding-block: clamp(3rem, 6vw, 5rem); }
.haoyi-catalog__header { max-width: 50rem; margin-bottom: 2rem; }
.haoyi-catalog__header h1 { margin-bottom: 1rem; }
.haoyi-catalog__header p { color: var(--haoyi-muted); font-size: 1.15rem; }

.haoyi-catalog-filter {
	display: grid;
	grid-template-columns: 1.4fr 1fr auto;
	align-items: end;
	gap: 1rem;
	margin-bottom: 1rem;
	padding: 1rem;
	border: 1px solid var(--haoyi-line);
	border-radius: var(--haoyi-radius);
	background: var(--haoyi-surface);
}
.haoyi-catalog-filter label { display: grid; gap: .35rem; color: var(--haoyi-muted); font-size: .8rem; font-weight: 720; }
.haoyi-catalog-filter input,
.haoyi-catalog-filter select,
.ttch-form input,
.ttch-form textarea {
	width: 100%;
	min-height: 3rem;
	padding: .7rem .8rem;
	border: 1px solid #aeb8b2;
	border-radius: .65rem;
	background: #fff;
	color: var(--haoyi-ink);
	font: inherit;
}
.haoyi-result-count { margin-bottom: 1rem; color: var(--haoyi-muted); font-size: .9rem; }
.haoyi-empty { padding: 2rem; border: 1px dashed #aeb8b2; border-radius: var(--haoyi-radius); background: var(--haoyi-surface); text-align: center; }
.haoyi-empty h2 { margin-bottom: .5rem; font-size: 1.5rem; }
.haoyi-pagination { display: flex; gap: .4rem; margin-top: 2rem; }
.haoyi-pagination .page-numbers { display: grid; place-items: center; min-width: 2.5rem; min-height: 2.5rem; padding: .4rem; border: 1px solid var(--haoyi-line); border-radius: .6rem; background: #fff; text-decoration: none; }
.haoyi-pagination .current { background: var(--haoyi-accent); color: #fff; }

.haoyi-page__content { max-width: 58rem; }
.haoyi-page__content > h1:first-child,
.haoyi-page__content > .wp-block-heading:first-child { max-width: 14ch; }
.haoyi-page__content > p,
.haoyi-page__content > ul { max-width: 48rem; }
.haoyi-page__content > h2 { margin-top: 3rem; }
.haoyi-feature-columns { margin-top: 2rem; }
.haoyi-page__content .ttch-rfq { max-width: none; }

.haoyi-product { max-width: var(--haoyi-shell); }
.haoyi-product__header { padding-bottom: 1rem; border-bottom: 1px solid var(--haoyi-line); }
.haoyi-product__content { display: grid; gap: 2rem; max-width: none; }
.haoyi-product__content > p { max-width: 48rem; font-size: 1.08rem; }

.ttch-product-gallery { display: grid; grid-template-columns: 1fr 6rem; gap: .8rem; margin: 0 0 2rem; }
.ttch-gallery-main { display: block; overflow: hidden; border-radius: var(--haoyi-radius); background: #e6ebe7; }
.ttch-gallery-main img { width: 100%; max-height: 42rem; object-fit: contain; }
.ttch-gallery-thumbs { display: grid; align-content: start; gap: .6rem; }
.ttch-gallery-thumbs a { overflow: hidden; border: 2px solid transparent; border-radius: .6rem; }
.ttch-gallery-thumbs a[aria-current="true"] { border-color: var(--haoyi-accent); }
.ttch-gallery-thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.ttch-product-specs,
.ttch-rfq {
	margin-top: 2.5rem;
	padding: clamp(1.4rem, 4vw, 2.5rem);
	border: 1px solid var(--haoyi-line);
	border-radius: var(--haoyi-radius);
	background: var(--haoyi-surface);
}
.ttch-product-specs h2,
.ttch-rfq h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
.spec-list { margin: 0; }
.spec-list > div { display: grid; grid-template-columns: minmax(8rem, .4fr) 1fr; gap: 1rem; padding-block: .75rem; border-top: 1px solid var(--haoyi-line); }
.spec-list dt { font-weight: 750; }
.spec-list dd { margin: 0; color: var(--haoyi-muted); }
.ttch-form { display: grid; gap: 1rem; }
.ttch-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.ttch-field { display: grid; gap: .35rem; color: var(--haoyi-muted); font-size: .86rem; font-weight: 700; }
.ttch-consent { display: flex; align-items: flex-start; gap: .6rem; }
.ttch-consent input { width: auto; min-height: 0; margin-top: .35rem; }
.ttch-honeypot { position: absolute; left: -9999px; }
.ttch-notice--success { padding: 1rem; border-left: 4px solid var(--haoyi-accent); background: #e7f2ec; }

.haoyi-not-found { text-align: center; }
.haoyi-not-found h1 { font-size: clamp(2.5rem, 7vw, 4.8rem); }

.haoyi-site-footer { margin-top: 0; border-top: 1px solid var(--haoyi-line); background: #e8ede8; }
.haoyi-footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 3rem; padding-block: 3.5rem; }
.haoyi-brand--footer { margin-bottom: 1rem; }
.haoyi-footer__grid > div > p { max-width: 24rem; color: var(--haoyi-muted); }
.haoyi-footer__grid h2 { margin-bottom: .8rem; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.haoyi-footer__grid ul { margin: 0; padding: 0; list-style: none; }
.haoyi-footer__grid li + li { margin-top: .5rem; }
.haoyi-footer__grid a { color: var(--haoyi-ink); text-decoration: none; }
.haoyi-footer__legal { display: flex; justify-content: space-between; gap: 1rem; padding-block: 1rem 1.5rem; border-top: 1px solid #cbd4ce; color: var(--haoyi-muted); font-size: .85rem; }
.haoyi-footer__legal p { margin: 0; }
.haoyi-footer__legal a + a { margin-left: 1rem; }

@media (max-width: 64rem) {
	.haoyi-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ttch-product-grid,
	.ttch-featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 52rem) {
	.admin-bar .haoyi-site-header { top: 46px; }
	.haoyi-header__inner { min-height: 4.5rem; }
	.has-js .menu-toggle { display: inline-flex; margin-left: auto; }
	.has-js .primary-nav {
		display: none;
		position: absolute;
		top: 100%;
		left: 1rem;
		right: 1rem;
		padding: .8rem;
		border: 1px solid var(--haoyi-line);
		border-radius: 0 0 var(--haoyi-radius) var(--haoyi-radius);
		background: var(--haoyi-surface);
		box-shadow: var(--haoyi-shadow);
	}
	.has-js .primary-nav.is-open { display: block; }
	.has-js .primary-nav ul { align-items: stretch; flex-direction: column; }
	.has-js .primary-nav a { justify-content: space-between; width: 100%; }
	.section-head { flex-direction: column; gap: .5rem; }
	.haoyi-catalog-filter { grid-template-columns: 1fr 1fr; }
	.haoyi-catalog-filter button { grid-column: 1 / -1; }
	.haoyi-footer__grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
	.haoyi-footer__grid > div:first-child { grid-column: 1 / -1; }
}

@media (max-width: 36rem) {
	.haoyi-hero { min-height: 35rem; }
	.haoyi-hero__inner { padding-block: 3.8rem; }
	.haoyi-hero h1 { max-width: 11ch; }
	.haoyi-category-grid,
	.ttch-product-grid,
	.ttch-featured-grid,
	.haoyi-catalog-filter,
	.ttch-two,
	.haoyi-footer__grid { grid-template-columns: 1fr; }
	.haoyi-category-card { min-height: 7.5rem; }
	.haoyi-catalog-filter button { grid-column: auto; }
	.ttch-product-gallery { grid-template-columns: 1fr; }
	.ttch-gallery-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.spec-list > div { grid-template-columns: 1fr; gap: .2rem; }
	.haoyi-footer__grid > div:first-child { grid-column: auto; }
	.haoyi-footer__legal { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.ttch-product-image { transition: none; }
}
