/*
 * Site UI components (no third-party libraries):
 *   1. .cs-slider  - fade image slider (no pan / zoom)
 *   2. .cc         - centered, looping image carousel
 *   3. .ug-gallery - justified image gallery
 *   4. .lb         - lightbox used by the gallery
 * Behaviour lives in js/site-ui.js
 */

:root {
	--ui-accent: #B10501;
	--ui-radius: 10px;
}

/* ------------------------------------------------------------------ 1. Slider */
.cs-slider {
	position: relative;
	width: 100%;
	aspect-ratio: 1400 / 850;
	overflow: hidden;
	background: #111;
	touch-action: pan-y;
	z-index: 0;
}
.cs-slider:focus-visible { outline: 3px solid var(--ui-accent); outline-offset: -3px; }

.cs-slide {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity .8s ease, visibility 0s linear .8s;
}
.cs-slide.is-active {
	opacity: 1;
	visibility: visible;
	z-index: 1;
	transition: opacity .8s ease;
}
.cs-slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 50%;
	-webkit-user-drag: none;
	user-select: none;
}
.cs-slide__caption {
	position: absolute;
	left: 1.5%;
	right: 1.5%;
	bottom: 48px;
	padding: clamp(10px, 2vw, 26px) clamp(12px, 2vw, 25px);
	border-radius: var(--ui-radius);
	background: rgba(0, 0, 0, .6);
	color: #fff;
	text-align: center;
	font-size: clamp(15px, 2.4vw, 34px);
	line-height: 1.4;
}

.cs-slider__btn {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 44px;
	height: 44px;
	margin-top: -22px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .45);
	color: #fff;
	font-size: 26px;
	line-height: 44px;
	text-align: center;
	cursor: pointer;
	transition: background .2s;
}
.cs-slider__btn:hover, .cs-slider__btn:focus-visible { background: var(--ui-accent); }
.cs-slider__btn--prev { left: 12px; }
.cs-slider__btn--next { right: 12px; }

.cs-slider__dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 14px;
	z-index: 3;
	display: flex;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.cs-slider__dots button {
	display: block;
	width: 14px;
	height: 14px;
	padding: 0;
	border: 2px solid var(--ui-accent);
	border-radius: 10px;
	background: rgba(255, 255, 255, .85);
	cursor: pointer;
}
.cs-slider__dots button[aria-current="true"] { background: var(--ui-accent); }

/* ---------------------------------------------------------------- 2. Carousel */
.cc {
	position: relative;
	padding: 0 0 38px;
}
.cc__viewport {
	overflow: hidden;
	padding: 8px 0;
	touch-action: pan-y;
	cursor: grab;
}
.cc__track {
	position: relative;
	display: flex;
	align-items: center;
	will-change: transform;
}
.cc__track.is-dragging { cursor: grabbing; }
.cc__slide {
	flex: 0 0 auto;
	padding: 10px;
}
.cc__slide img {
	display: block;
	width: 300px;
	max-width: calc(100vw - 60px);
	height: auto;
	border-radius: var(--ui-radius);
	box-shadow: 0 4px 8px #00000061;
	-webkit-user-drag: none;
	user-select: none;
}
.cc__btn {
	position: absolute;
	top: calc(50% - 19px);
	z-index: 2;
	width: 40px;
	height: 40px;
	margin-top: -20px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .45);
	color: #fff;
	font-size: 24px;
	line-height: 40px;
	cursor: pointer;
	transition: background .2s;
}
.cc__btn:hover, .cc__btn:focus-visible { background: var(--ui-accent); }
.cc__btn--prev { left: 10px; }
.cc__btn--next { right: 10px; }
.cc__dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 8px;
	display: flex;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.cc__dots button {
	display: block;
	width: 12px;
	height: 12px;
	padding: 0;
	border: 2px solid var(--ui-accent);
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
}
.cc__dots button[aria-current="true"] { background: var(--ui-accent); }

/* ----------------------------------------------------------------- 3. Gallery */
.ug-gallery {
	--ug-gap: 6px;
	--ug-row: 200px;
	display: flex;
	flex-wrap: wrap;
	gap: var(--ug-gap);
	margin: 1rem 0;
}
/* keeps the last row from stretching to full width */
.ug-gallery::after { content: ""; flex-grow: 1000000; }

.ug-item {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 12px;
	background: #ececec;
	flex: calc(var(--ug-ratio) * 100) 1 calc(var(--ug-ratio) * var(--ug-row));
}
.ug-item::before {
	content: "";
	display: block;
	padding-bottom: calc(100% / var(--ug-ratio));
}
.ug-item img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .35s ease;
}
.ug-item::after {
	content: "\f00e"; /* Font Awesome: search-plus */
	font-family: "Font Awesome 6 Free", sans-serif;
	font-weight: 900;
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .6);
	color: #fff;
	font-size: 26px;
	opacity: 0;
	transition: opacity .25s ease;
}
.ug-item:hover::after, .ug-item:focus-visible::after { opacity: 1; }
.ug-item:hover img { transform: scale(1.04); }
.ug-item:focus-visible { outline: 3px solid var(--ui-accent); outline-offset: 2px; }

/* ----------------------------------------------------------------- 4. Lightbox */
html.lb-open { overflow: hidden; }
.lb {
	position: fixed;
	inset: 0;
	z-index: 10050;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .88);
	touch-action: pan-y;
}
.lb[hidden] { display: none; }
.lb__stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 100vw;
	margin: 0;
	padding: 0 64px;
}
.lb__img {
	display: block;
	max-width: min(92vw, 1600px);
	max-height: 82vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	transition: opacity .2s ease;
}
.lb.is-loading .lb__img { opacity: .25; }
.lb__cap {
	max-width: 92vw;
	margin-top: 12px;
	color: #e8e8e8;
	font-size: 15px;
	line-height: 1.4;
	text-align: center;
}
.lb__btn {
	position: absolute;
	z-index: 2;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	font-size: 28px;
	line-height: 46px;
	text-align: center;
	cursor: pointer;
	transition: background .2s;
}
.lb__btn:hover, .lb__btn:focus-visible { background: var(--ui-accent); }
.lb__close { top: 14px; right: 14px; }
.lb__prev { left: 12px; top: 50%; margin-top: -23px; }
.lb__next { right: 12px; top: 50%; margin-top: -23px; }
.lb__count {
	position: absolute;
	top: 22px;
	left: 18px;
	color: #ddd;
	font-size: 14px;
}
@media (max-width: 575.98px) {
	.lb__stage { padding: 0 8px; }
	.lb__prev, .lb__next { top: auto; bottom: 14px; margin-top: 0; }
	.lb__prev { left: 14px; }
	.lb__next { right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
	.cs-slide, .cs-slide.is-active, .ug-item img, .ug-item::after, .lb__img { transition: none; }
}

/* ----------------------------------------------------------- 5. Contact dock */
.skip-link {
	position: absolute;
	left: 8px;
	top: -60px;
	z-index: 10100;
	padding: 8px 14px;
	background: #fff;
	color: #B10501;
	border-radius: 8px;
	transition: top .2s;
}
.skip-link:focus { top: 8px; }

.contact-dock {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 9990;
	display: flex;
	flex-direction: column;
	gap: 10px;
	animation: dock-in .5s ease both;
}
.contact-dock__item {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 190px;
	padding: 6px 18px 6px 6px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .96);
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
	color: #222;
	text-decoration: none;
	transition: transform .2s, box-shadow .2s;
}
.contact-dock__item:hover, .contact-dock__item:focus-visible {
	transform: translateX(-4px);
	box-shadow: 0 8px 26px rgba(0, 0, 0, .3);
	color: #222;
}
.contact-dock__icon {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 20px;
	background: var(--dock-color, #B10501);
}
.contact-dock__text { display: flex; flex-direction: column; line-height: 1.2; font-family: 'Noto Sans Thai', sans-serif; }
.contact-dock__text small { font-size: 12px; color: #666; }
.contact-dock__text strong { font-size: 16px; font-weight: 600; }
.contact-dock__item.is-tel { --dock-color: #ff8800; }
.contact-dock__item.is-line { --dock-color: #06C755; }
.contact-dock__item.is-msg { --dock-color: #0A7CFF; }

@keyframes dock-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

@media (max-width: 767.98px) {
	.contact-dock {
		left: 0;
		right: 0;
		bottom: 0;
		flex-direction: row;
		gap: 0;
		background: #fff;
		box-shadow: 0 -4px 16px rgba(0, 0, 0, .18);
	}
	.contact-dock__item {
		flex: 1 1 0;
		min-width: 0;
		flex-direction: column;
		gap: 2px;
		padding: 6px 4px 8px;
		border-radius: 0;
		background: transparent;
		box-shadow: none;
		text-align: center;
	}
	.contact-dock__item:hover, .contact-dock__item:focus-visible { transform: none; box-shadow: none; }
	.contact-dock__icon { width: 34px; height: 34px; font-size: 17px; }
	.contact-dock__text small { display: none; }
	.contact-dock__text strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
	body { padding-bottom: 66px; }
}
@media (prefers-reduced-motion: reduce) { .contact-dock { animation: none; } .contact-dock__item { transition: none; } }

/* ---------------------------------------------------------- 6. Cookie consent */
.ck-banner[hidden], .ck-modal[hidden] { display: none !important; }
.ck-banner {
	position: fixed;
	left: 16px;
	right: 16px;
	bottom: 16px;
	z-index: 10060;
	display: flex;
	align-items: center;
	gap: 20px;
	max-width: 1100px;
	margin: 0 auto;
	padding: 18px 22px;
	border-radius: 16px;
	background: #fff;
	color: #333;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
	font-family: 'Noto Sans Thai', sans-serif;
	font-size: 14.5px;
	line-height: 1.55;
}
.ck-banner p { margin: 4px 0 0 !important; color: #444; line-height: 1.55 !important; }
.ck-banner a { color: #B10501; text-decoration: underline; }
.ck-banner__text { flex: 1 1 auto; }
.ck-banner__actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.ck-btn {
	padding: 9px 18px;
	border: 2px solid #B10501;
	border-radius: 999px;
	background: #fff;
	color: #B10501;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	transition: background .2s, color .2s;
}
.ck-btn:hover, .ck-btn:focus-visible { background: #fbeaea; }
.ck-btn--primary { background: #B10501; color: #fff; }
.ck-btn--primary:hover, .ck-btn--primary:focus-visible { background: #8f0401; }

.ck-modal {
	position: fixed;
	inset: 0;
	z-index: 10070;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, .6);
	font-family: 'Noto Sans Thai', sans-serif;
}
.ck-modal__box {
	width: 100%;
	max-width: 560px;
	max-height: 92vh;
	overflow: auto;
	padding: 24px;
	border-radius: 16px;
	background: #fff;
	color: #333;
}
.ck-modal__box h2 { margin: 0 0 6px; font-size: 22px; color: #B10501; }
.ck-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid #eee; }
.ck-row small { display: block; margin-top: 2px; color: #666; font-size: 13px; line-height: 1.45; }
.ck-modal__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.ck-switch { position: relative; flex: 0 0 auto; width: 48px; height: 28px; margin: 0; }
.ck-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ck-switch span { position: absolute; inset: 0; border-radius: 999px; background: #bbb; transition: background .2s; pointer-events: none; }
.ck-switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.ck-switch input:checked + span { background: #B10501; }
.ck-switch input:checked + span::before { transform: translateX(20px); }
.ck-switch input:disabled + span { opacity: .55; }
.ck-switch input:focus-visible + span { outline: 3px solid #f5a3a1; outline-offset: 2px; }

.ck-embed {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px;
	border: 2px dashed #ccc;
	border-radius: 12px;
	background: #f6f6f6;
	text-align: center;
	font-family: 'Noto Sans Thai', sans-serif;
}
.ck-embed p { margin: 0 !important; color: #555; }

@media (max-width: 767.98px) {
	.ck-banner { flex-direction: column; align-items: stretch; left: 8px; right: 8px; bottom: 8px; padding: 14px; max-height: 80vh; overflow: auto; }
	.ck-banner__actions { justify-content: stretch; }
	.ck-banner__actions .ck-btn { flex: 1 1 auto; }
}

/* policy pages */
.policy { font-family: 'Noto Sans Thai', sans-serif; max-width: 900px; }
.policy h2 { margin: 28px 0 8px; font-size: 22px; color: #B10501; }
.policy p, .policy li { line-height: 1.75 !important; color: #333; }
.policy table { width: 100%; margin: 10px 0 16px; border-collapse: collapse; font-size: 15px; }
.policy th, .policy td { padding: 8px 10px; border: 1px solid #ddd; vertical-align: top; }
.policy th { background: #f4f4f4; }
.footer-links a { margin: 0 8px; }
.footer-links button { background: none; border: 0; padding: 0; margin: 0 8px; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }

/* ------------------------------------------------------------------- 7. FAQ */
.faq__item { margin-bottom: 10px; border: 1px solid #e4e4e4; border-radius: 12px; background: #fafafa; }
.faq__item summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; }
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after { content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900; color: #B10501; font-size: 14px; transition: transform .2s; }
.faq__item[open] summary::after { transform: rotate(180deg); }
.faq__item summary h3 { margin: 0; font-size: 18px; line-height: 1.5; color: #222; }
.faq__item p { margin: 0 !important; padding: 0 18px 16px; line-height: 1.7 !important; }

/* ------------------------------------------------------------- 8. Pagination */
.pager { margin: 8px 0 28px; text-align: center; }
.pager .pagination {
	display: inline-flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 6px;
	border-radius: 999px;
	background: #fff;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .1);
}
.pager .page-link {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	border: 0;
	border-radius: 999px !important;
	background: transparent;
	color: #444;
	font-size: 16px;
	font-weight: 500;
	line-height: 1;
	transition: background .2s, color .2s, transform .2s, box-shadow .2s;
}
.pager a.page-link:hover, .pager a.page-link:focus-visible {
	background: #fbeaea;
	color: #B10501;
	transform: translateY(-2px);
	box-shadow: none;
}
.pager a.page-link:focus-visible { outline: 3px solid #f5a3a1; outline-offset: 2px; }
.pager .page-item.active .page-link {
	background: linear-gradient(135deg, #e50002 0%, #9b0701 100%);
	color: #fff;
	font-weight: 700;
	box-shadow: 0 4px 12px rgba(177, 5, 1, .4);
}
.pager .page-item.disabled .page-link { background: transparent; color: #c8c8c8; }
.pager .page-gap span { display: block; min-width: 20px; color: #999; text-align: center; }
.pager__info { margin: 12px 0 0 !important; color: #777; font-size: 14px; }
@media (max-width: 575.98px) {
	.pager .pagination { gap: 2px; padding: 4px; }
	.pager .page-link { min-width: 36px; height: 36px; padding: 0 8px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .pager .page-link { transition: none; } .pager a.page-link:hover { transform: none; } }
