/* Vars */
:root {
  --main-color: #951d1e;
  --main-color-fade: #a94442;
}

/* CSS */
body {
	line-height: 2;
	font-family: 'THSarabunNew', sans-serif;
	overflow-y: scroll;
}

h1,h2,h3 {
	margin-bottom: 1rem;
	font-family: 'THSarabunNew', sans-serif;
}
h1, .masthead h1 {
	font-size: 2.4rem;
	line-height: 1.4;
}
h2 {
	font-size: 2.2rem;
	line-height: 1.3;
}
h3 {
	font-size: 2rem;
	line-height: 1.2;
}
h4 {
	font-size: 1.2rem;
	line-height: 1.5;
}

.bg-primary a:link, .bg-primary a:visited {
	color: #fff;
}

.callout h2 {
	color: #fff;
}

.btn {
	border: 0;
	border-radius: 0;
}

.btn-primary {
	position: relative;
	background-color: var(--main-color) !important;
}

.btn-primary:hover {
	background-color: var(--main-color-fade) !important;
}

.lead {
	font-size: 1.15rem;
}

.top-header {
	position: fixed;
	width: 100%;
	height: 40px;
	line-height: 40px;
	background-color: #000;
	color: #fff;
	z-index: 111;
}

.top-header p {
	margin-bottom: 0;
}

.header-fixed {
	top: 40px;
	position: fixed;
	width: 100%;
	height: 100px;
	background-color: #fffffffa;
	z-index: 111;
}

.header-brand {
	padding: 10px;
	height: 100px;
}

.header-brand img {
	max-height: 100%;
}

.menu-toggle {
	display: none;
	top: 65px;
	background: var(--main-color);
	transition: all 0.3s;
}

.menu-toggle:hover {
	background: var(--main-color-fade);
}

.header-brand .custom-logo-link {
	align-self: center
}

ul.main-nav {
	position: relative;
	margin: auto;
	padding: 0;
}

ul.main-nav li {
	display: inline-block;
}

ul.main-nav li:last-child {
	margin-right: 20px;
}

ul.main-nav li a {
	padding: 1rem 2rem;
	font-weight: bold;
	text-decoration: none;
	color: #00000090;
	transition: 0.3s linear;
}

ul.main-nav li ul.sub-menu {
	display: none;
	position: absolute;
	margin: 1rem 0 0 0;
	padding: 0;
	background: #f8f9fa;
	border-bottom: solid 4px var(--main-color);
}

ul.main-nav li ul.sub-menu li {
	display: block;
	width: 100%;
}

ul.main-nav li ul.sub-menu li a {
	display: block;
}

ul.main-nav li ul.sub-menu li a:hover {
	background-color: #ccc;
}

.sidebar-wrapper {
	top: 40px;
	background: #343a40;
	z-index: 998;
}

.sidebar-wrapper .lang {
  padding-left: 15px;
	font-size: 1rem;
	color: #fff;
  line-height: 100px;
  height: 100px;
	background: #00000055;
}

@media (max-width: 991px) {
	.menu-toggle {
		display: block;
	}
	.nav-wrapper {
		display: none;
	}
	ul.sidebar-nav ul.sub-menu {
		list-style: none;
		padding-left: 20px;
	}
	.img-fluid {
		width: 100%;
	}
}

.sidebar-nav li a {
	padding: 15px 20px;
}

.main {
	padding-top: 140px;
}

.callout {
	padding: 8rem 0;
}

.portfolio-item .caption .caption-content {
	margin: 0;
	width: 100%;
	text-align: center;
}

.portfolio-item .caption .caption-content h2 {
	position: relative;
	top: 50%;
	padding: 0 5rem;
	transform: translate(0,-50%);
	font-size: 1rem;
}

.portfolio-item:hover .caption {
	background-color: #951d1ebb;
}

.scroll-to-top i {
	padding-top: 15px;
}

.bg-primary {
	background-color: var(--main-color) !important;
}

#contact {
	padding-bottom: 1.5rem;
}

footer.footer .social-link {
	background-color: var(--main-color);
}

.carousel-caption {
  right: 0;
  left: 0;
  top: 50%;
  bottom: 0;
  height: fit-content;
  transform: translate(0, -50%);
}

#archive, #taxonomy, #single{
	position: relative;
}

#archive .archive-title, #single .single-title{
	background-color: var(--main-color);
	color: #fff;
}

#taxonomy .taxonomy-title {
	padding-top: 80px;
	padding-bottom: 80px;;
	background-size: cover;
	background-attachment: fixed;
}

#taxonomy table td {
	vertical-align: middle;
}

.clickable-row {
	cursor: pointer;
}

.product a {
	text-decoration: none;
	color: #000;
}

.product-formular p {
	margin-bottom: 0;
}

/* Product card (taxonomy grid) */
.product > a {
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100%;
	padding: 15px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	background-color: #fff;
	color: #334155;
	text-decoration: none;
	transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.product > a:hover {
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
	transform: translateY(-4px);
	border-color: #0284c7;
}

.product-thumbnail img {
	object-fit: contain;
	max-height: 145px;
	width: auto;
	margin-bottom: 10px;
}

.product-title {
	text-align: center;
	font-size: 1rem;
	color: #0f172a;
	margin-bottom: 8px;
}

.product-formular img {
	max-width: 100%;
	height: auto;
	opacity: 0.8;
}

/* Reflow the category-description table on mobile
   (analytical-chemicals keeps a <table> in its term description) */
@media (max-width: 767.98px) {
	/* Solvents: a 3-col LAYOUT table (middle column = spacer) — stack it so
	   the side-by-side groups don't overflow. (Best replaced by <div> cols;
	   see WP-ADMIN-SOLVENTS-GUIDE.md.) */
	#taxonomy .table-borderless,
	#taxonomy .table-borderless tbody,
	#taxonomy .table-borderless tr,
	#taxonomy .table-borderless td {
		display: block;
		width: 100%;
	}
	#taxonomy .table-borderless td:empty {
		display: none;
	}
	/* Analytical: a real 2-col DATA table (Name | Formula) — keep it tabular,
	   just shrink + let long names wrap so the pair stays side by side */
	#taxonomy .table-striped {
		font-size: 0.85rem;
	}
	#taxonomy .table-striped td {
		padding: 6px 8px;
		word-break: break-word;
	}
	/* 2-per-row product cards: tighten card + title for small screens */
	.product > a {
		padding: 10px;
	}
	.product-thumbnail img {
		max-height: 110px;
	}
	.product-title {
		font-size: 0.9rem;
		line-height: 1.3;
	}
	/* drop hard line-breaks in centered intro copy so it doesn't wrap raggedly
	   (term-description intro is a plain <blockquote>; wpautop may inject <br>) */
	#taxonomy blockquote br {
		display: none;
	}
}

ul.product-sidebar {
	margin: 0;
	padding: 0;
	color: #64748b;
	font-size: 14px;
}

/* Gap between sidebar (.col-md-3.p-0) and product content (.col-md-9),
   only when columns sit side-by-side (>=768px, the col-md breakpoint) */
@media (min-width: 768px) {
	ul.product-sidebar {
		padding-right: 30px;
	}
}

ul.product-sidebar li.cat-item {
	list-style: none;
	display: flex;
	flex-wrap: wrap;          /* let .children drop to its own line */
	align-items: center;
	padding: 10px 0;
	border-bottom: 1px solid #f1f5f9;
	line-height: 1.6;
}

ul.product-sidebar > li.cat-item:last-child {
	border-bottom: none;
}

ul.product-sidebar li.cat-item > a {
	flex: 1;                  /* take the row, push the count pill right */
	color: #334155;
	text-decoration: none;
	transition: color 0.2s ease-in-out;
}

ul.product-sidebar li.cat-item > a:hover {
	color: #0284c7;
}

ul.product-sidebar li.current-cat > a {
	font-weight: 600;
	color: #0284c7;
}

ul.product-sidebar .count {
	flex: 0 0 auto;
	margin-left: 8px;
	padding: 2px 8px;
	background: #f1f5f9;
	color: #64748b;
	border-radius: 12px;
	font-size: 0.85em;
}

ul.product-sidebar ul.children {
	flex-basis: 100%;         /* full width below its parent row */
	list-style: none;
	padding-left: 16px;
	margin: 8px 0 4px;
	border-left: 2px solid #e2e8f0;
}

ul.product-sidebar ul.children li.cat-item {
	padding: 6px 0;
	border-bottom: none;
	font-size: 0.95em;
}

ul.product-sidebar ul.children li.cat-item > a {
	color: #475569;
}

/* --- Collapsible category box (หีบเปิดปิด) --- */
/* Collapse every sub-category list by default (FOUC-safe, pure CSS) */
ul.product-sidebar li.cat-item > ul.children {
	display: none;
}
/* Keep the branch of the category you're currently viewing open */
ul.product-sidebar li.current-cat > ul.children,
ul.product-sidebar li.current-cat-parent > ul.children,
ul.product-sidebar li.current-cat-ancestor > ul.children {
	display: block;
}

/* Toggle caret injected by scripts.js after the count pill */
ul.product-sidebar .cat-toggle {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	margin-left: 6px;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	color: #94a3b8;
	font-size: 11px;
	line-height: 22px;
	text-align: center;
	transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
}
ul.product-sidebar .cat-toggle::before {
	content: "\25B6";        /* ▶ collapsed */
}
ul.product-sidebar li.cat-has-children.open > .cat-toggle {
	transform: rotate(90deg); /* ▼ expanded */
	color: #0284c7;
}

@media (max-width: 1024px) {
	ul.product-sidebar {
		font-size: 14px;
	}
	ul.product-sidebar ul.children {
		padding-left: 5px;
	}
}

@media (max-width: 991px) {
	ul.product-sidebar {
		margin-bottom: 20px;
	}
}

/* Pagination */
.pagination {
    clear:both;
    display: table;
    margin: 0 auto;
    padding: 20px 0;
    position:relative;
    font-size:13px;
    line-height:13px;
}
.pagination span, .pagination a {
    margin: 2px 2px 2px 0;
    padding:5px 10px;
    text-decoration:none;
    width:auto;
    color:#fff;
    background: grey;
}
.pagination a:hover{
    color:#fff;
    background: var(--main-color);
}
.pagination .current{
    background: var(--main-color);
    color:#fff;
}

.callout h2 {
	font-size: 2.4rem;
	max-width: initial;
	line-height: 1.6;
}

/* Search */
input[type=text] {
	border: 0;
	border-radius: 5px;
	padding: 2px 10px;
}
input[type=button], input[type=submit], input[type=reset] {
  	border: none;
  	border-radius: 5px;
	padding: 3px 20px;
}