/* ==========================================================
   Hobby Baker — theme styles
   Breakpoints: mobile < 760px · tablet 760–1099px · desktop ≥ 1100px
   ========================================================== */
:root {
	--hb-cream: #FAF6EC;
	--hb-card: #FFFDF8;
	--hb-wheat: #EEE6D2;
	--hb-sage: #DCE6DA;
	--hb-line: #E6DECB;
	--hb-green: #3E6B57;
	--hb-green-dark: #34604D;
	--hb-forest: #2E4A3C;
	--hb-ink: #263A30;
	--hb-muted: #6B6656;
	--hb-gold: #C9A15F;
	--hb-warn-bg: #FBEBD9;
	--hb-warn: #8A4B0F;

	--hb-sans: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
	--hb-serif: 'Zilla Slab', 'Noto Serif Thai', Georgia, serif;

	--hb-max: 1200px;
	--hb-gutter: clamp(16px, 4vw, 32px);
	--hb-radius: 20px;
	--hb-radius-sm: 14px;
	--hb-header-h: 76px;
	--hb-tabbar-h: 0px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--hb-header-h) + 12px); }
body {
	margin: 0;
	background: var(--hb-cream);
	color: var(--hb-ink);
	font-family: var(--hb-sans);
	font-size: clamp(15px, 0.35vw + 14px, 17px);
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
	padding-bottom: var(--hb-tabbar-h);
}
img, video, svg { max-width: 100%; height: auto; }
a { color: var(--hb-forest); text-decoration: none; }
a:hover { color: #1F3329; }
:focus-visible { outline: 3px solid var(--hb-gold); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { font-family: var(--hb-serif); color: var(--hb-forest); line-height: 1.25; letter-spacing: -0.01em; margin: 0 0 .5em; text-wrap: balance; }
.lang-th h1, .lang-th h2, .lang-th h3, .lang-th h4 { letter-spacing: 0; line-height: 1.35; }
p { margin: 0 0 1em; }
.hb-muted { color: var(--hb-muted); }
.hb-wrap { width: 100%; max-width: var(--hb-max); margin-inline: auto; padding-inline: var(--hb-gutter); }
.hb-skip { position: absolute; left: -9999px; top: 8px; z-index: 200; background: var(--hb-forest); color: #fff; padding: 10px 16px; border-radius: 10px; }
.hb-skip:focus { left: 12px; color: #fff; }

/* ---------- Header ---------- */
.hb-header {
	position: sticky; top: 0; z-index: 100;
	background: rgba(250, 246, 236, .92);
	-webkit-backdrop-filter: saturate(1.4) blur(14px);
	backdrop-filter: saturate(1.4) blur(14px);
	border-bottom: 1px solid var(--hb-line);
}
.admin-bar .hb-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .hb-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .hb-header { top: 0; } }
.hb-header__inner { display: flex; align-items: center; gap: 24px; min-height: var(--hb-header-h); }
.hb-brand { display: flex; align-items: center; gap: 12px; color: var(--hb-forest); flex-shrink: 0; }
.hb-brand__logo { width: auto; height: 56px; display: block; mix-blend-mode: multiply; }
.hb-brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.hb-brand__name { font-family: var(--hb-serif); font-weight: 700; font-size: 22px; color: var(--hb-forest); }
.hb-brand__tag { font-size: 12px; color: var(--hb-muted); }

.hb-nav { flex: 1; display: flex; justify-content: center; }
.hb-nav__list { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.hb-nav__list a {
	display: block; padding: 10px 14px; border-radius: 999px;
	color: var(--hb-ink); font-weight: 500; font-size: 15px; white-space: nowrap;
	transition: background .15s, color .15s;
}
.hb-nav__list a:hover { background: var(--hb-wheat); color: var(--hb-forest); }
.hb-nav__list a[aria-current="page"], .hb-nav__list .current-menu-item > a { background: var(--hb-wheat); color: var(--hb-forest); font-weight: 600; }

.hb-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hb-lang { display: inline-flex; background: var(--hb-wheat); border-radius: 999px; padding: 3px; }
.hb-lang a {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 7px 12px; min-height: 36px; border-radius: 999px;
	font-size: 13px; font-weight: 600; color: var(--hb-muted);
}
.hb-lang a.is-current { background: #fff; color: var(--hb-forest); box-shadow: 0 1px 2px rgba(38, 58, 48, .08); }
.hb-flag { display: inline-flex; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.hb-flag svg { display: block; }
.hb-cart {
	position: relative; display: inline-flex; align-items: center; gap: 8px;
	height: 44px; padding: 0 16px; border-radius: 999px;
	background: #fff; border: 1px solid var(--hb-line);
	color: var(--hb-ink); font-weight: 600; font-size: 14px;
}
.hb-cart-count {
	min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
	background: var(--hb-green); color: #fff; font-size: 12px; font-weight: 700;
	display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.hb-cart-count.is-empty { display: none; }
.hb-burger, .hb-drawer__close {
	display: none; width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--hb-line);
	background: #fff; color: var(--hb-ink); align-items: center; justify-content: center; cursor: pointer; padding: 0;
}

/* ---------- Drawer (tablet & mobile) ---------- */
.hb-drawer { position: fixed; inset: 0; z-index: 150; background: rgba(38, 58, 48, .35); }
.hb-drawer[hidden] { display: none; }
.hb-drawer__panel {
	position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 88vw);
	background: var(--hb-cream); padding: 18px 20px calc(24px + env(safe-area-inset-bottom));
	display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
	box-shadow: -12px 0 40px rgba(38, 58, 48, .18);
	animation: hb-slide .22s ease-out;
}
@keyframes hb-slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.hb-drawer__top { display: flex; align-items: center; justify-content: space-between; }
.hb-drawer__close { display: inline-flex; }
.hb-drawer__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hb-drawer__list a {
	display: flex; align-items: center; gap: 14px; padding: 14px 14px; border-radius: var(--hb-radius-sm);
	color: var(--hb-ink); font-size: 17px; font-weight: 500;
}
.hb-drawer__list a[aria-current="page"] { background: var(--hb-wheat); color: var(--hb-forest); font-weight: 600; }
.hb-drawer__list .hb-icon { color: var(--hb-green); }
.hb-drawer .hb-lang { align-self: flex-start; }
body.hb-no-scroll { overflow: hidden; }

/* ---------- Mobile tab bar ---------- */
.hb-tabbar { display: none; }
.hb-tabbar a { position: relative; }
.hb-tabbar__cart { position: relative; display: inline-flex; }
.hb-tabbar__cart .hb-cart-count { position: absolute; top: -6px; right: -10px; min-width: 18px; height: 18px; font-size: 11px; }

/* ---------- Page content (block editor output) ---------- */
.hb-main { display: block; min-height: 50vh; }
.hb-page__head { padding-top: clamp(28px, 5vw, 56px); }
.hb-page__title { font-size: clamp(30px, 4vw, 44px); }
.hb-content > * { margin-block: 0; }
.hb-content .wp-block-group { margin-block: 0; }
.hb-content .wp-block-group.is-layout-constrained > * { max-width: var(--wp--style--global--content-size, var(--hb-max)); margin-inline: auto; }
/* Block groups keep their own inline max-width; make sure side gutters scale */
.hb-content > .wp-block-group { padding-left: var(--hb-gutter) !important; padding-right: var(--hb-gutter) !important; }

/* Fluid type overrides for headings that were set in px in the editor */
.hb-content h1, .hb-content h1.wp-block-heading { font-size: clamp(32px, 5.2vw, 54px) !important; line-height: 1.2 !important; }
.lang-th .hb-content h1 { line-height: 1.35 !important; }
.hb-content h2 { font-size: clamp(26px, 3.2vw, 36px); }
.hb-content h3 { font-size: clamp(19px, 1.6vw, 22px); }
.hb-content p[style*="font-size:18px"] { font-size: clamp(16px, 1.2vw, 19px) !important; }

/* Columns: 3 → 1 on mobile, 3 stays 3 on tablet but tighter */
.hb-content .wp-block-columns { display: flex; gap: clamp(12px, 2vw, 20px); margin-bottom: 0; }
.hb-content .wp-block-column { flex: 1 1 0; min-width: 0; }
.hb-content .wp-block-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
@media (min-width: 760px) and (max-width: 1099px) {
	.hb-content .wp-block-columns { flex-wrap: nowrap !important; }
	.hb-content .wp-block-column { flex-basis: 0 !important; flex-grow: 1; }
	.hb-content .wp-block-column h3 { font-size: 18px; }
}
@media (max-width: 759px) {
	.hb-content .wp-block-columns { flex-wrap: wrap !important; }
	.hb-content .wp-block-column { flex-basis: 100% !important; }
}

.hb-content ul.wp-block-list { padding-left: 1.2em; }
.hb-content ul.wp-block-list li { margin-bottom: .6em; }
.hb-content ul.wp-block-list li::marker { color: var(--hb-gold); }

/* Buttons */
.wp-block-button__link, .wp-element-button, .hb-btn,
.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
.woocommerce #respond input#submit, .woocommerce a.button.alt, .woocommerce button.button.alt,
.wc-block-components-button:not(.is-link) {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 50px; padding: 12px 24px !important;
	background: var(--hb-green) !important; color: #fff !important;
	border: 0 !important; border-radius: var(--hb-radius-sm) !important;
	font-family: var(--hb-sans) !important; font-weight: 600 !important; font-size: 16px !important;
	line-height: 1.2 !important; text-decoration: none !important; cursor: pointer;
	transition: background .15s, transform .1s;
}
.wp-block-button__link:hover, .hb-btn:hover, .woocommerce a.button:hover, .woocommerce button.button:hover,
.wc-block-components-button:not(.is-link):hover { background: var(--hb-green-dark) !important; color: #fff !important; }
.wp-block-button__link:active, .woocommerce .button:active { transform: translateY(1px); }
.wp-block-button.is-style-outline .wp-block-button__link {
	background: #fff !important; color: var(--hb-forest) !important; border: 1px solid var(--hb-line) !important;
}
@media (max-width: 759px) {
	.hb-content .wp-block-buttons { flex-direction: column; align-items: stretch; }
	.hb-content .wp-block-buttons .wp-block-button { width: 100%; }
	.hb-content .wp-block-buttons .wp-block-button__link { width: 100%; }
}

.hb-badge {
	display: inline-block; background: var(--hb-wheat); color: var(--hb-forest);
	font-weight: 600; font-size: 14px; padding: 6px 14px; border-radius: 999px; margin: 0 0 16px;
}

/* ---------- WooCommerce: product grid ---------- */
.woocommerce ul.products, .woocommerce-page ul.products {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: clamp(12px, 2vw, 22px);
	margin: 0 0 24px !important; padding: 0 !important;
}
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none !important; }
@media (max-width: 1099px) { .woocommerce ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 759px) {
	/* Mobile: compact list rows like the app mockup (photo left, details right) */
	.woocommerce ul.products { grid-template-columns: 1fr; gap: 12px; }
	.woocommerce ul.products li.product {
		display: grid !important; grid-template-columns: 104px 1fr; grid-template-rows: auto auto;
		column-gap: 14px; row-gap: 8px; align-items: center; padding: 10px !important; border-radius: 18px;
	}
	.woocommerce ul.products li.product > a.woocommerce-LoopProduct-link,
	.woocommerce ul.products li.product > a:first-child { display: contents; }
	.woocommerce ul.products li.product a img { grid-row: 1 / span 2; grid-column: 1; width: 104px; height: 104px; margin: 0 !important; border-radius: 14px; }
	.woocommerce ul.products li.product .woocommerce-loop-product__title { grid-column: 2; font-size: 15px !important; margin: 0; padding: 0 !important; align-self: end; }
	.woocommerce ul.products li.product .price { grid-column: 2; margin: 0 !important; padding: 0; align-self: start; font-size: 16px !important; }
	.woocommerce ul.products li.product .button, .woocommerce ul.products li.product .added_to_cart { grid-column: 1 / -1; }
	.woocommerce ul.products li.product .button { min-height: 44px; }
	.woocommerce ul.products li.product:hover { transform: none; }
}
.woocommerce ul.products li.product {
	width: auto !important; margin: 0 !important; float: none !important;
	background: var(--hb-card); border: 1px solid var(--hb-line); border-radius: 22px;
	padding: 12px 12px 16px; display: flex; flex-direction: column;
	transition: box-shadow .2s, transform .2s;
}
.woocommerce ul.products li.product:hover { box-shadow: 0 10px 30px rgba(38, 58, 48, .08); transform: translateY(-2px); }
.woocommerce ul.products li.product a img {
	width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 16px; margin: 0 0 12px !important; background: var(--hb-wheat);
}
.woocommerce ul.products li.product .woocommerce-loop-product__title {
	font-family: var(--hb-sans); font-size: 16px !important; font-weight: 600; color: var(--hb-ink);
	padding: 0 4px !important; line-height: 1.4; margin-bottom: 6px;
}
.woocommerce ul.products li.product .price { color: var(--hb-ink) !important; font-weight: 700; font-size: 17px !important; padding: 0 4px; margin-bottom: 12px !important; }
.woocommerce ul.products li.product .button { margin-top: auto !important; width: 100%; }
.woocommerce ul.products li.product .added_to_cart { display: block; text-align: center; padding-top: 8px; font-weight: 600; }

/* ---------- WooCommerce: shop / single / cart / checkout ---------- */
.hb-woo { padding-top: clamp(24px, 4vw, 48px); padding-bottom: clamp(32px, 5vw, 64px); }
.woocommerce-products-header__title, .woocommerce .product_title { font-size: clamp(28px, 3.6vw, 40px); }
.woocommerce .woocommerce-breadcrumb { color: var(--hb-muted); font-size: 13px; margin-bottom: 16px; }
.woocommerce .woocommerce-breadcrumb a { color: var(--hb-muted); }
.woocommerce .woocommerce-result-count, .woocommerce .woocommerce-ordering { margin-bottom: 18px; color: var(--hb-muted); font-size: 14px; }
.woocommerce .woocommerce-ordering select, .woocommerce form .form-row input.input-text, .woocommerce form .form-row textarea,
.woocommerce form .form-row select, .woocommerce .quantity .qty, .select2-container .select2-selection {
	border: 1px solid var(--hb-line) !important; border-radius: 12px !important; background: #FFFDF8 !important;
	min-height: 46px; padding: 10px 12px; font-family: var(--hb-sans); font-size: 16px; color: var(--hb-ink);
}
.woocommerce div.product { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 56px); align-items: start; }
.woocommerce div.product div.images, .woocommerce div.product div.summary { width: 100% !important; float: none !important; margin: 0 !important; }
.woocommerce div.product div.images img { border-radius: 22px; }
.woocommerce div.product .woocommerce-tabs, .woocommerce div.product .related, .woocommerce div.product .up-sells { grid-column: 1 / -1; }
.woocommerce div.product p.price { color: var(--hb-ink) !important; font-size: 26px !important; font-weight: 700; }
.woocommerce div.product form.cart { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin: 20px 0 !important; }
.woocommerce div.product form.cart .quantity .qty { width: 84px; height: 50px; text-align: center; }
.woocommerce div.product form.cart .single_add_to_cart_button { flex: 1; min-width: 200px; }
.hb-bake-note {
	display: flex; gap: 8px; align-items: flex-start; background: var(--hb-wheat); color: var(--hb-forest);
	padding: 12px 14px; border-radius: var(--hb-radius-sm); font-size: 14px; font-weight: 500;
}
.hb-bake-note .hb-icon { flex-shrink: 0; margin-top: 2px; }
.woocommerce div.product .woocommerce-tabs ul.tabs { padding: 0 !important; margin: 0 0 16px !important; display: flex; gap: 6px; flex-wrap: wrap; }
.woocommerce div.product .woocommerce-tabs ul.tabs::before, .woocommerce div.product .woocommerce-tabs ul.tabs li::before, .woocommerce div.product .woocommerce-tabs ul.tabs li::after { display: none !important; }
.woocommerce div.product .woocommerce-tabs ul.tabs li { border: 1px solid var(--hb-line) !important; background: #fff !important; border-radius: 999px !important; margin: 0 !important; padding: 0 !important; }
.woocommerce div.product .woocommerce-tabs ul.tabs li a { padding: 8px 16px !important; color: var(--hb-ink) !important; font-weight: 600; }
.woocommerce div.product .woocommerce-tabs ul.tabs li.active { background: var(--hb-wheat) !important; }
@media (max-width: 759px) {
	.woocommerce div.product { grid-template-columns: 1fr; }
	.woocommerce div.product form.cart .single_add_to_cart_button { min-width: 0; }
}

.woocommerce-message, .woocommerce-info, .woocommerce-error {
	border: 0 !important; border-radius: var(--hb-radius-sm); background: var(--hb-card) !important;
	box-shadow: inset 0 0 0 1px var(--hb-line); color: var(--hb-ink) !important;
}
.woocommerce-message::before, .woocommerce-info::before { color: var(--hb-green) !important; }
.woocommerce table.shop_table { border: 1px solid var(--hb-line) !important; border-radius: var(--hb-radius) !important; background: var(--hb-card); overflow: hidden; }
.woocommerce table.shop_table th, .woocommerce table.shop_table td { border-color: var(--hb-line) !important; padding: 14px !important; }
.hb-page--shop { padding: clamp(24px, 4vw, 48px) 0 clamp(32px, 5vw, 64px); }
.hb-page--shop .hb-page__head { padding-inline: 0; padding-top: 0; }
/* Block cart / checkout */
.wc-block-cart, .wc-block-checkout { font-family: var(--hb-sans); }
.wc-block-components-sidebar-layout .wc-block-components-main, .wc-block-components-sidebar {
	background: var(--hb-card); border: 1px solid var(--hb-line); border-radius: var(--hb-radius); padding: clamp(14px, 2.5vw, 24px) !important;
}
.wc-block-components-text-input input, .wc-block-components-combobox .wc-block-components-combobox-control input, .wc-blocks-components-select__select {
	border-radius: 12px !important; border-color: var(--hb-line) !important; background: #FFFDF8 !important;
}
.wc-block-components-radio-control__option, .wc-block-components-radio-control-accordion-option { border-radius: var(--hb-radius-sm) !important; }
.wc-block-components-product-name { color: var(--hb-ink) !important; font-weight: 600; }

/* ---------- Footer ---------- */
.hb-footer { background: var(--hb-card); border-top: 1px solid var(--hb-line); margin-top: clamp(40px, 6vw, 72px); }
.hb-footer__inner {
	display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: clamp(20px, 3vw, 40px);
	padding-top: clamp(32px, 5vw, 56px); padding-bottom: 28px;
}
.hb-footer__brand { display: flex; gap: 14px; align-items: flex-start; }
.hb-footer__brand img { width: 64px; height: auto; mix-blend-mode: multiply; }
.hb-footer__name { font-family: var(--hb-serif); font-size: 22px; font-weight: 700; color: var(--hb-forest); margin: 4px 0 4px; }
.hb-footer__h { font-weight: 700; color: var(--hb-forest); margin-bottom: 8px; font-size: 15px; }
.hb-footer__col p { font-size: 14px; color: var(--hb-muted); }
.hb-footer__links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.hb-footer__links a { color: var(--hb-muted); }
.hb-footer__links a:hover { color: var(--hb-forest); }
.hb-footer__base {
	display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
	border-top: 1px solid var(--hb-line); padding-top: 18px; padding-bottom: 24px;
	font-size: 13px; color: var(--hb-muted);
}

/* ==========================================================
   Tablet (760–1099px): compact header, drawer for nav
   ========================================================== */
@media (max-width: 1099px) {
	:root { --hb-header-h: 68px; }
	.hb-nav { display: none; }
	.hb-burger { display: inline-flex; }
	.hb-header__inner { justify-content: space-between; gap: 12px; }
	.hb-brand__logo { height: 48px; }
	.hb-footer__inner { grid-template-columns: 1fr 1fr; }
	.hb-footer__brand { grid-column: 1 / -1; }
}

/* ==========================================================
   Mobile (< 760px): app-style header + bottom tab bar
   ========================================================== */
@media (max-width: 759px) {
	:root { --hb-header-h: 60px; --hb-tabbar-h: calc(64px + env(safe-area-inset-bottom)); }
	.hb-brand { gap: 8px; }
	.hb-brand__logo { height: 42px; }
	.hb-brand__name { font-size: 19px; }
	.hb-brand__tag { font-size: 11px; }
	.hb-actions { gap: 6px; }
	.hb-actions > .hb-cart { display: none; }           /* cart lives in the tab bar */
	.hb-lang a { padding: 6px 9px; min-height: 34px; font-size: 12px; gap: 4px; }
	.hb-burger { width: 40px; height: 40px; }

	.hb-tabbar {
		display: flex; justify-content: space-around; align-items: stretch;
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
		height: var(--hb-tabbar-h); padding: 6px 6px env(safe-area-inset-bottom);
		background: rgba(255, 253, 248, .96);
		-webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
		border-top: 1px solid var(--hb-line);
	}
	.hb-tabbar a {
		flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
		font-size: 11px; color: var(--hb-muted); border-radius: 12px; min-height: 52px;
	}
	.hb-tabbar a[aria-current="page"] { color: var(--hb-forest); font-weight: 600; }
	.hb-tabbar a[aria-current="page"] .hb-icon { color: var(--hb-green); }

	.hb-footer__inner { grid-template-columns: 1fr; }
	.hb-footer__base { flex-direction: column; }
	.hb-content .wp-block-group[style*="padding:56px"], .hb-content .wp-block-group[style*="padding:48px"] { padding-top: 32px !important; padding-bottom: 32px !important; }
}

/* Very small phones */
@media (max-width: 360px) {
	.hb-brand__tag { display: none; }
	.hb-lang .hb-flag { display: none; }
}

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