/* =====================================================================
   PM Prem — built-in lightweight CSS framework (no Bootstrap)
   Mobile-first, CSS Grid + Flexbox, CSS Variables.
   ===================================================================== */

/* ---------- Design tokens / CSS variables ---------- */
:root {
	--primary-color: #e01818;
	--secondary-color: #f5c400;
	--text-color: #181818;
	--muted-color: #666;
	--bg-color: #ffffff;
	--surface-color: #f6f8fb;
	--border-color: #e3e8ef;
	--radius: 10px;
	--maxw: 1200px;
	--gap: 1.5rem;
	--font-sans: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
	--font-head: "Source Sans Pro", "Roboto", Helvetica, Arial, sans-serif;
	--shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
	--transition: 0.2s ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	margin: 0;
	font-family: var(--font-sans);
	font-size: 1rem;
	line-height: 1.65;
	color: var(--text-color);
	background: var(--bg-color);
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--primary-color); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--secondary-color); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-head); line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.25rem; }
blockquote {
	margin: 1.5rem 0; padding: 1rem 1.25rem;
	border-left: 4px solid var(--primary-color);
	background: var(--surface-color); border-radius: var(--radius);
}
code { background: var(--surface-color); padding: .15em .4em; border-radius: 4px; }

/* ---------- Layout ---------- */
.pm-container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1rem; }
.pm-section { padding-block: 3rem; }
.site-content { padding-block: 2.5rem; }

/* Grid utility */
.pm-grid { display: grid; gap: var(--gap); }
.pm-grid-2 { grid-template-columns: minmax(0, 1fr); }
.pm-grid-3 { grid-template-columns: minmax(0, 1fr); }
.pm-grid-4 { grid-template-columns: minmax(0, 1fr); }

/* Flex utilities */
.pm-flex { display: flex; gap: var(--gap); }
.pm-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pm-flex-center { display: flex; align-items: center; justify-content: center; }

/* Content + sidebar */
.pm-content-area { display: grid; gap: var(--gap); grid-template-columns: 1fr; }

/* ---------- Buttons ---------- */
.pm-btn, button, input[type="submit"], .button {
	display: inline-block;
	background: var(--primary-color);
	color: #fff;
	padding: .75rem 1.5rem;
	border: none;
	border-radius: var(--radius);
	font-weight: 600;
	cursor: pointer;
	transition: background var(--transition), transform var(--transition);
}
.pm-btn:hover, button:hover, input[type="submit"]:hover, .button:hover {
	background: var(--secondary-color); color: #181818; transform: translateY(-2px);
}
.pm-btn-outline {
	background: transparent; color: var(--primary-color);
	border: 2px solid var(--primary-color);
}
.pm-btn-outline:hover { background: var(--primary-color); color: #fff; }

/* ---------- Forms ---------- */
input, textarea, select {
	width: 100%; padding: .7rem .9rem;
	border: 1px solid var(--border-color); border-radius: var(--radius);
	font: inherit; background: #fff; color: var(--text-color);
}
input:focus, textarea:focus, select:focus {
	outline: 2px solid var(--primary-color); outline-offset: 1px; border-color: var(--primary-color);
}

/* ---------- Header ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; }
.top-bar { background: var(--surface-color); font-size: .85rem; border-bottom: 1px solid var(--border-color); }
.top-bar .pm-container { display: flex; justify-content: flex-end; }
.top-menu ul { list-style: none; display: flex; gap: 1rem; margin: .4rem 0; padding: 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .9rem; }
.site-branding .logo-mobile { display: none; }
.site-title { font-size: 1.4rem; font-weight: 700; color: var(--text-color); }

/* Primary nav */
.primary-nav ul { list-style: none; display: flex; gap: 1.25rem; margin: 0; padding: 0; }
.primary-nav a { color: var(--text-color); font-weight: 500; padding: .4rem 0; }
.primary-nav a:hover, .primary-nav .current-menu-item > a { color: var(--primary-color); }
.primary-nav .sub-menu {
	position: absolute; background: #fff; box-shadow: var(--shadow);
	border-radius: var(--radius); padding: .5rem; min-width: 200px; display: none; flex-direction: column;
}
.primary-nav li { position: relative; }
.primary-nav li:hover > .sub-menu { display: flex; }

.header-actions { display: flex; align-items: center; gap: 1rem; }
.pm-cart-link { display: inline-flex; align-items: center; gap: .25rem; color: var(--text-color); font-weight: 600; }
.pm-cart-count {
	background: var(--primary-color); color: #fff; border-radius: 999px;
	min-width: 1.5em; text-align: center; padding: 0 .35em; font-size: .8rem;
}

/* Mobile toggle */
.menu-toggle {
	display: inline-flex; flex-direction: column; gap: 4px; width: 40px; height: 40px;
	background: transparent; border: 1px solid var(--border-color); border-radius: 8px;
	align-items: center; justify-content: center; padding: 0;
}
.menu-toggle span { width: 20px; height: 2px; background: var(--text-color); display: block; }

/* ---------- Hero ---------- */
.pm-hero {
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
	color: #fff; text-align: center; padding-block: clamp(3rem, 8vw, 6rem);
	background-size: cover; background-position: center;
}
.pm-hero h1 { color: #fff; }
.pm-hero p { font-size: 1.15rem; opacity: .95; max-width: 640px; margin-inline: auto; }
.pm-hero .pm-btn { background: #fff; color: var(--primary-color); margin-top: 1rem; }
.pm-hero .pm-btn:hover { background: rgba(255,255,255,.85); }

/* ---------- Cards / posts ---------- */
.pm-card, .post-card {
	background: #fff; border: 1px solid var(--border-color);
	border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
	transition: transform var(--transition);
}
.pm-card:hover, .post-card:hover { transform: translateY(-4px); }
.post-card .card-body { padding: 1.25rem; }
.post-card .entry-meta { font-size: .85rem; color: var(--muted-color); margin-bottom: .5rem; }
.post-card h2, .post-card h3 { margin-bottom: .4rem; }
.entry-thumb img { width: 100%; aspect-ratio: 3/2; object-fit: cover; }

/* Single */
.entry-header { margin-bottom: 1.5rem; }
.entry-meta { color: var(--muted-color); font-size: .9rem; }
.pm-breadcrumbs { font-size: .85rem; color: var(--muted-color); margin-bottom: 1rem; }
.pm-breadcrumbs .sep { margin-inline: .35rem; }

/* ---------- Sidebar / widgets ---------- */
.widget { background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.5rem; }
.widget-title { margin-top: 0; font-size: 1.1rem; border-bottom: 2px solid var(--primary-color); padding-bottom: .4rem; }

/* ---------- Footer ---------- */
.site-footer { background: #181818; color: #c7d0dc; margin-top: 3rem; }
.site-footer a { color: #fff; }
.footer-widgets { display: grid; gap: var(--gap); grid-template-columns: 1fr; padding-block: 3rem; }
.site-footer .widget { background: transparent; border: none; padding: 0; }
.site-footer .widget-title { color: #fff; border-color: var(--secondary-color); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding-block: 1.25rem; font-size: .9rem; }
.footer-menu ul { list-style: none; display: flex; flex-wrap: wrap; gap: 1rem; padding: 0; margin: 0; }
.pm-footer-html { padding-block: 1.5rem; }
.pm-footer-divider { border: 0; border-top: 1px solid rgba(255,255,255,.12); margin: 0; }
.pm-footer-credit { text-align: center; font-size: .85rem; color: rgba(255,255,255,.55); padding-block: 1rem; }
.pm-footer-credit a { color: #cbd5e1; text-decoration: underline; }
.pm-footer-credit a:hover { color: #fff; }

/* ---------- WooCommerce: catalog cards ---------- */
.woocommerce ul.products,
.woocommerce-page ul.products {
	display: grid !important;
	gap: var(--gap);
	grid-template-columns: 1fr;
	margin: 0 0 2rem;
	padding: 0;
	list-style: none;
}
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
	list-style: none;
	margin: 0;
	width: auto !important;
	float: none !important;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--border-color);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
	transition: transform var(--transition), box-shadow var(--transition);
	text-align: center;
}
.woocommerce ul.products li.product:hover {
	transform: translateY(-6px);
	box-shadow: 0 12px 30px rgba(0,0,0,.14);
}
/* Bigger, uniform product images */
.woocommerce ul.products li.product a img,
.woocommerce ul.products li.product img {
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	margin: 0 0 .75rem;
	border-radius: 0;
	display: block;
}
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2 {
	font-size: 1.05rem;
	font-weight: 600;
	padding: 0 1rem;
	margin: .25rem 0 .5rem;
	min-height: 2.6em;
	color: var(--text-color);
}
.woocommerce ul.products li.product .price {
	color: var(--primary-color);
	font-size: 1.2rem;
	font-weight: 700;
	display: block;
	padding: 0 1rem;
	margin-bottom: .75rem;
}
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .pm-inquiry-btn {
	margin: auto 1rem 1.25rem;
	display: inline-block;
}
.woocommerce span.onsale {
	background: var(--secondary-color);
	color: #181818;
	font-weight: 700;
	border-radius: 999px;
	padding: .25em .8em;
	min-height: auto;
	min-width: auto;
	line-height: 1.4;
}
.woocommerce-product-gallery { margin-bottom: 1.5rem; }
.woocommerce div.product .product_title { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.woocommerce div.product p.price,
.woocommerce div.product span.price { color: var(--primary-color); font-weight: 700; font-size: 1.6rem; }

/* Catalog mode: emphasise price, hide cart-y bits if any slip through */
.pm-catalog-mode .woocommerce ul.products li.product .added_to_cart,
.pm-catalog-mode .add_to_cart_button { display: none !important; }
.pm-inquiry-btn { background: var(--secondary-color); color: #181818; }
.pm-inquiry-btn:hover { background: var(--primary-color); color: #fff; }

/* ---------- Helpers / accessibility ---------- */
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px,1px,1px,1px); white-space: nowrap;
}
.skip-link { position: absolute; left: -9999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 1000; }
.skip-link:focus { left: 1rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; } .mb-1 { margin-bottom: 1rem; }

/* =====================================================================
   Responsive breakpoints (mobile-first)
   ===================================================================== */

/* Tablet >= 600px */
@media (min-width: 600px) {
	.pm-grid-2 { grid-template-columns: repeat(2, 1fr); }
	.pm-grid-4 { grid-template-columns: repeat(2, 1fr); }
	.footer-widgets { grid-template-columns: repeat(2, 1fr); }
	.woocommerce ul.products { grid-template-columns: repeat(2, 1fr); }
}

/* Desktop >= 900px */
@media (min-width: 900px) {
	.pm-grid-3 { grid-template-columns: repeat(3, 1fr); }
	.pm-grid-4 { grid-template-columns: repeat(4, 1fr); }
	.footer-widgets { grid-template-columns: repeat(4, 1fr); }
	.woocommerce ul.products { grid-template-columns: repeat(3, 1fr); }
	.has-sidebar .pm-content-area { grid-template-columns: minmax(0, 1fr) 320px; }
}

/* Large screens >= 1400px */
@media (min-width: 1400px) {
	:root { --maxw: 1320px; }
}

/* ---------- Mobile navigation behaviour (< 900px) ---------- */
@media (max-width: 899px) {
	.site-branding .logo-desktop { display: none; }
	.site-branding .logo-mobile { display: block; }
	.site-branding .logo-mobile img { max-height: 60px; }
	.menu-toggle { display: inline-flex; }
	.primary-nav {
		position: fixed; inset: 0 0 0 auto; width: min(80vw, 320px);
		background: #fff; box-shadow: var(--shadow); transform: translateX(100%);
		transition: transform var(--transition); padding: 4rem 1.25rem; z-index: 200; overflow-y: auto;
	}
	.primary-nav.is-open { transform: translateX(0); }
	.primary-nav ul { flex-direction: column; gap: .25rem; }
	.primary-nav .sub-menu { position: static; box-shadow: none; display: flex; padding-left: 1rem; }
}

@media (min-width: 900px) {
	.menu-toggle { display: none; }
}

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

/* =====================================================================
   CSS Engineering — custom enhancements (logo + red gradient nav)
   ===================================================================== */

/* ---- Logo instead of long text title (single logo, all screens) ---- */
.site-branding { flex: 0 0 auto; }
.site-branding .site-logo { display: inline-block; line-height: 0; }
.site-branding .site-logo img { max-height: 96px; width: auto; height: auto; }
@media (max-width: 899px) {
	.site-branding .site-logo img { max-height: 60px; }
}

/* ---- Primary menu: dark-red gradient bar with depth ---- */
@media (min-width: 900px) {
	.primary-nav .primary-menu-list {
		background: linear-gradient(180deg, #e51b1b 0%, #b91111 55%, #8f0c0c 100%);
		border-radius: 999px;
		padding: .35rem .6rem;
		gap: .25rem;
		box-shadow: 0 6px 18px rgba(143, 12, 12, .35), inset 0 1px 0 rgba(255,255,255,.25);
	}
	.primary-nav .primary-menu-list > li > a {
		color: #fff;
		font-weight: 600;
		padding: .55rem 1.05rem;
		border-radius: 999px;
		line-height: 1;
		transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
	}
	.primary-nav .primary-menu-list > li > a:hover {
		color: #fff;
		background: rgba(255, 255, 255, .18);
		box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
		transform: translateY(-1px);
	}
	.primary-nav .primary-menu-list > li.current-menu-item > a,
	.primary-nav .primary-menu-list > li.current_page_item > a {
		background: rgba(255, 255, 255, .92);
		color: #b91111;
		box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
	}
	/* Dropdowns keep readable styling under the red bar */
	.primary-nav .sub-menu { margin-top: .4rem; padding: .4rem; }
	.primary-nav .sub-menu a { color: var(--text-color); padding: .5rem .75rem; border-radius: 8px; display: block; }
	.primary-nav .sub-menu a:hover { background: var(--surface-color); color: var(--primary-color); }
}

/* ---- Top bar links a touch nicer ---- */
.top-menu-list a { color: var(--muted-color); }
.top-menu-list a:hover { color: var(--primary-color); }

/* ---- Hide post date / reading-time meta everywhere ---- */
.entry-meta { display: none !important; }

/* ---- Mobile-friendly content: stop horizontal overflow ---- */
html, body { overflow-x: hidden; max-width: 100%; }

.entry-content img,
.site-content img,
.pm-hero img { max-width: 100% !important; height: auto !important; }

/* Long unbreakable strings / wide content wrap instead of overflowing */
.entry-content { overflow-wrap: break-word; word-wrap: break-word; }

/* Let flex/grid items shrink below their content width (key overflow fix).
   Scoped to the whole content area (#content), not just .entry-content,
   so the homepage post-card grids are covered too. */
#content, #content * { min-width: 0 !important; }

/* Thai text has no spaces between words -> force it to wrap so a long
   string cannot push grid/flex tracks wider than the viewport. */
#content p, #content h1, #content h2, #content h3, #content h4, #content h5,
#content a, #content li, #content span, #content td, #content div,
#content .entry-title, #content .entry-summary, #content .entry-content {
	overflow-wrap: anywhere;
}

/* Content Views plugin grids -> full width, no fixed columns/negative margins */
.entry-content .pt-cv-view,
.entry-content .pt-cv-content-list,
.entry-content .pt-cv-rows,
.entry-content .pt-cv-colsys,
.entry-content [class*="pt-cv-row"] {
	width: 100% !important;
	max-width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}
.entry-content [class*="pt-cv-"][class*="-col"],
.entry-content .pt-cv-content-item {
	width: 100% !important;
	max-width: 100% !important;
	float: none !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

/* Tables become horizontally scrollable rather than breaking layout */
.entry-content table { display: block; width: 100% !important; max-width: 100%; overflow-x: auto; }

@media (max-width: 782px) {
	/* Neutralise fixed pixel widths pasted into the page content */
	.entry-content [style*="width"],
	.entry-content [width] { width: auto !important; max-width: 100% !important; }
	.entry-content iframe,
	.entry-content video,
	.entry-content embed { max-width: 100% !important; }
	/* Generic safety net for any wide child element */
	.entry-content * { max-width: 100%; }

	/* WordPress Columns block -> stack to one column */
	.entry-content .wp-block-columns {
		display: flex !important;
		flex-wrap: wrap !important;
		flex-direction: column !important;
		gap: 1rem;
	}
	.entry-content .wp-block-column {
		flex-basis: 100% !important;
		max-width: 100% !important;
		margin-left: 0 !important;
	}

	/* Latest Posts / gallery grids -> one column */
	.entry-content ul.wp-block-latest-posts.is-grid,
	.entry-content .wp-block-latest-posts.is-grid,
	.entry-content .wp-block-gallery,
	.entry-content .blocks-gallery-grid {
		display: grid !important;
		grid-template-columns: 1fr !important;
	}

	/* Wide / full-width blocks must not exceed the viewport */
	.entry-content .alignwide,
	.entry-content .alignfull {
		width: 100% !important;
		max-width: 100% !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	/* Any leftover flex/table rows wrap instead of overflowing */
	.entry-content table,
	.entry-content tbody,
	.entry-content tr { display: block !important; width: 100% !important; }
	.entry-content td,
	.entry-content th { display: block !important; width: 100% !important; }
}

/* ---- Footer credit: single tidy line ---- */
.footer-bottom .pm-flex-between { justify-content: center; }
.pm-footer-credit { padding-top: .5rem; }
