/* Fangcun unified responsive system — content and commerce presentation only. */
:root {
	--fc-page-max: 1160px;
	--fc-reading-max: 720px;
	--fc-gap: clamp(16px, 2vw, 24px);
	--fc-section-space: clamp(42px, 6vw, 78px);
	--fc-card-radius: 14px;
	--fc-text: #172033;
	--fc-muted: #5f6b7a;
	--fc-border: #dfe5ec;
	--fc-brand: #12659a;
	--fc-brand-dark: #0d4e78;
	--fc-surface: #ffffff;
	--fc-shadow: 0 10px 30px rgba(23, 32, 51, 0.07);
}

html { overflow-x: hidden; scroll-behavior: smooth; }
body {
	overflow-wrap: break-word;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
body:not(.wp-admin) {
	color: var(--fc-text);
	font-size: 16px;
	line-height: 1.75;
}
body:not(.wp-admin) img,
body:not(.wp-admin) video,
body:not(.wp-admin) iframe { max-width: 100%; }

/* Consistent readable typography. */
body:not(.wp-admin) :is(h1, h2, h3) {
	color: var(--fc-text);
	font-weight: 800;
	letter-spacing: -0.025em;
	text-wrap: balance;
}
body:not(.wp-admin) h1 {
	font-size: clamp(2rem, 4.1vw, 3.25rem);
	line-height: 1.15;
}
body:not(.wp-admin) h2 {
	font-size: clamp(1.55rem, 2.7vw, 2.2rem);
	line-height: 1.25;
}
body:not(.wp-admin) h3 {
	font-size: clamp(1.18rem, 1.8vw, 1.45rem);
	line-height: 1.35;
}
body:not(.wp-admin) :is(p, li) { line-height: 1.75; }
body:not(.wp-admin) p { text-wrap: pretty; }
body:not(.wp-admin) :is(.fc-lead, .woocommerce-product-details__short-description) {
	max-width: 44rem;
	font-size: clamp(1rem, 1.25vw, 1.1rem) !important;
	line-height: 1.8 !important;
}

/* Stable page gutters on desktop, tablet and phone. */
body:not(.wp-admin) :is(.ct-container, .ct-container-full) {
	padding-inline: clamp(18px, 4vw, 48px);
}
body.wp-singular main#main,
body.woocommerce-page main#main,
body.tax-product_cat main#main,
body.single-product main#main {
	min-width: 0;
}
body.wp-singular .site-main > .ct-container,
body.woocommerce-page .site-main > .ct-container,
body.tax-product_cat .site-main > .ct-container,
body.single-product .site-main > .ct-container {
	width: min(100%, calc(var(--fc-page-max) + clamp(36px, 8vw, 96px)));
}
.entry-content > :where(:not(.alignfull)) { min-width: 0; }

/* Reusable Fangcun sections and cards. */
body:not(.wp-admin) :is(
	.fc-hero,
	.fc-teacher-hero,
	.fc-video-hero,
	.fc-contact-hero,
	.fc-products-hero,
	.fc-teacher-panel,
	.fc-video-summary,
	.fc-contact-card,
	.fc-path-card
) {
	border-radius: var(--fc-card-radius) !important;
	box-shadow: var(--fc-shadow);
}
body:not(.wp-admin) :is(.fc-hero, .fc-teacher-hero, .fc-video-hero, .fc-contact-hero, .fc-products-hero) {
	padding: clamp(28px, 4.5vw, 56px) !important;
}
body:not(.wp-admin) :is(.fc-hero, .fc-teacher-hero, .fc-video-hero, .fc-contact-hero) {
	gap: clamp(26px, 5vw, 58px) !important;
}
body:not(.wp-admin) :is(.fc-steps, .fc-process, .fc-teacher-grid, .fc-video-grid, .fc-contact-grid, .fc-contact-next) {
	gap: var(--fc-gap) !important;
}
body:not(.wp-admin) :is(.fc-teacher-panel, .fc-video-summary, .fc-contact-card, .fc-path-card) {
	padding: clamp(20px, 2.6vw, 30px) !important;
}
body:not(.wp-admin) .fc-kicker {
	font-size: .78rem !important;
	font-weight: 800 !important;
	letter-spacing: .09em !important;
	line-height: 1.4 !important;
}

/* Buttons remain easy to tap and align consistently. */
body:not(.wp-admin) :is(.wp-element-button, .wp-block-button__link, .button, button, input[type="submit"], .fc-button) {
	min-height: 46px;
	border-radius: 7px !important;
	font-weight: 700;
	line-height: 1.35;
}
body:not(.wp-admin) :is(.wp-block-buttons, .fc-card-actions) {
	display: flex;
	flex-wrap: wrap;
	gap: 12px !important;
}

/* Category navigation adapts to the actual number of categories. */
body:not(.wp-admin) :is(.fangcun-hpb-front, .fc-dynamic-product-categories) {
	display: grid !important;
	grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)) !important;
	gap: 18px !important;
	width: min(100%, 960px);
	margin-inline: auto !important;
}
body:not(.wp-admin) .fangcun-hpb-front-card {
	min-height: 132px;
	justify-content: center;
	padding: 24px !important;
	border: 1px solid var(--fc-border) !important;
	border-radius: 12px !important;
	box-shadow: 0 8px 22px rgba(23, 32, 51, .06);
	transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
body:not(.wp-admin) .fangcun-hpb-front-card:hover,
body:not(.wp-admin) .fangcun-hpb-front-card:focus-visible {
	transform: translateY(-3px);
	border-color: var(--fc-brand) !important;
	box-shadow: 0 12px 28px rgba(23, 32, 51, .11);
}
body:not(.wp-admin) .fangcun-hpb-front-card strong {
	font-size: clamp(1.18rem, 1.9vw, 1.45rem) !important;
	line-height: 1.35;
}

/* WooCommerce product and category grids. */
body.woocommerce :is(ul.products, .wc-block-grid__products) { row-gap: 24px !important; }
body.woocommerce ul.products > li.product:not(.product-category) {
	min-width: 0;
	padding-bottom: 18px;
	border-radius: 12px;
}
body.woocommerce ul.products .woocommerce-loop-product__title {
	font-size: clamp(1.05rem, 1.5vw, 1.24rem) !important;
	line-height: 1.45 !important;
}
body.woocommerce ul.products .price {
	font-size: 1.05rem !important;
	font-weight: 800;
}
body.single-product .product {
	display: grid;
	grid-template-columns: minmax(0, .92fr) minmax(340px, 1.08fr);
	gap: clamp(28px, 5vw, 62px);
	align-items: start;
}
body.single-product .product > * { min-width: 0; }
body.single-product .woocommerce-product-gallery,
body.single-product .summary { width: auto !important; float: none !important; }
body.single-product .product .woocommerce-tabs,
body.single-product .product .related,
body.single-product .product .up-sells { grid-column: 1 / -1; }
body.single-product .summary .product_title { margin-bottom: 14px; }
body.single-product .summary .price { font-size: clamp(1.35rem, 2vw, 1.75rem) !important; }

/* Cart and checkout use a calm, readable card layout. */
body.woocommerce-cart .woocommerce,
body.woocommerce-checkout .woocommerce {
	width: min(100%, 1040px);
	margin-inline: auto;
}
body.woocommerce-cart :is(.woocommerce-cart-form, .cart-collaterals, .wc-empty-cart-message),
body.woocommerce-checkout :is(.woocommerce-billing-fields, .woocommerce-additional-fields, #order_review) {
	border-radius: 12px;
}
body.woocommerce table.shop_table {
	border-color: var(--fc-border);
	border-radius: 10px;
	background: var(--fc-surface);
}
body.woocommerce :is(input.input-text, textarea, select) {
	min-height: 46px;
	border-radius: 7px;
}
body.woocommerce textarea { min-height: 112px; }
body.woocommerce-checkout .col2-set {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 28px;
}
body.woocommerce-checkout .col2-set > * { width: auto !important; float: none !important; }

/* Tablet: stack hero sections, keep useful two-column grids. */
@media (max-width: 999px) {
	body:not(.wp-admin) { font-size: 16px; }
	body:not(.wp-admin) :is(.fc-hero, .fc-teacher-hero, .fc-video-hero, .fc-contact-hero) {
		grid-template-columns: 1fr !important;
	}
	body:not(.wp-admin) :is(.fc-hero__content, .fc-teacher-intro, .fc-video-summary) {
		max-width: var(--fc-reading-max);
	}
	body:not(.wp-admin) :is(.fc-hero__media, .fc-teacher-portrait) {
		width: min(100%, 680px);
		margin-inline: auto;
	}
	body:not(.wp-admin) :is(.fc-process, .fc-steps, .fc-contact-grid) {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
	body.single-product .product { grid-template-columns: 1fr; }
	body.single-product .woocommerce-product-gallery { width: min(100%, 680px) !important; margin-inline: auto; }
}

/* Phone: compact spacing, one-column reading flow and full-width actions. */
@media (max-width: 689px) {
	:root { --fc-section-space: 38px; }
	body:not(.wp-admin) { font-size: 15.8px; line-height: 1.7; }
	body:not(.wp-admin) :is(.ct-container, .ct-container-full) { padding-inline: 18px; }
	body:not(.wp-admin) h1 { font-size: clamp(1.85rem, 9vw, 2.38rem); line-height: 1.18; }
	body:not(.wp-admin) h2 { font-size: clamp(1.42rem, 7vw, 1.8rem); }
	body:not(.wp-admin) :is(.fc-hero, .fc-teacher-hero, .fc-video-hero, .fc-contact-hero, .fc-products-hero) {
		padding: 24px 20px !important;
		border-radius: 12px !important;
	}
	body:not(.wp-admin) :is(.fc-process, .fc-steps, .fc-teacher-grid, .fc-video-grid, .fc-contact-grid, .fc-contact-next) {
		grid-template-columns: 1fr !important;
	}
	body:not(.wp-admin) :is(.wp-block-buttons, .fc-card-actions) { align-items: stretch; }
	body:not(.wp-admin) :is(.wp-block-button, .fc-card-actions > *) { width: 100%; }
	body:not(.wp-admin) :is(.wp-block-button__link, .fc-card-actions a, .fc-card-actions button) {
		display: flex !important;
		width: 100%;
		align-items: center;
		justify-content: center;
		text-align: center;
	}
	body:not(.wp-admin) :is(.fangcun-hpb-front, .fc-dynamic-product-categories) {
		grid-template-columns: 1fr !important;
		gap: 14px !important;
	}
	body:not(.wp-admin) .fangcun-hpb-front-card { min-height: 112px; padding: 20px !important; }
	body.woocommerce ul.products { grid-template-columns: 1fr !important; }
	body.woocommerce ul.products > li.product { width: 100% !important; margin-inline: 0 !important; }
	body.woocommerce-cart .woocommerce-cart-form { overflow-x: auto; -webkit-overflow-scrolling: touch; }
	body.woocommerce-cart table.shop_table { min-width: 620px; }
	body.woocommerce-cart .cart-collaterals,
	body.woocommerce-cart .cart_totals { width: 100% !important; float: none !important; }
	body.woocommerce-checkout .col2-set { grid-template-columns: 1fr; gap: 20px; }
	body.woocommerce :is(input.input-text, textarea, select) { font-size: 16px; }
	body.woocommerce :is(.checkout-button, #place_order, button.button, a.button) { width: 100%; text-align: center; }
}

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

/* Keep category cards consistent on pages with or without an outer section. */
body:not(.wp-admin) .fc-dynamic-product-categories {
	display: block !important;
	width: 100% !important;
	max-width: none !important;
	margin-inline: 0 !important;
}
body:not(.wp-admin) .fangcun-hpb-front {
	display: grid !important;
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	gap: 18px !important;
	width: min(100%, 960px) !important;
	max-width: 960px !important;
	margin-inline: auto !important;
}
@media (max-width: 689px) {
	body:not(.wp-admin) .fangcun-hpb-front {
		grid-template-columns: 1fr !important;
		gap: 14px !important;
	}
}
