/* ==========================================================================
   หน้า attachment — โหลดเฉพาะหน้า attachment (ดู attachment-functions.php)
   ทุก selector ขึ้นต้นด้วย body.attachment จึงไม่กระทบหน้าอื่นแน่นอน

   โครงหน้า:  H1
              [ ซ้าย: รูป | เส้นแบ่ง | ขวา: ข้อความ -> ปุ่ม LINE/โทร ]
              Description (ถ้ามี)
              หมวดสินค้า 5 ช่อง (ไอคอน + ปุ่มชื่อหมวด)
              (มือถือ: รูป -> ข้อความ -> ปุ่ม เรียงลงมา ไม่มีเส้นแบ่ง + แถบ LINE/โทร ติดขอบล่างจอ)
              ลิงก์หน้าแม่ + รูปก่อนหน้า/ถัดไป
   ========================================================================== */

/* สีหลักที่ใช้ซ้ำ แก้ที่เดียวได้ */
body.attachment {
	--att-brand: #883980;         /* สีปุ่มหมวดสินค้า */
	--att-divider: #000;          /* สีเส้นแบ่งซ้าย-ขวา */
	--att-brand-dark: #6b2c65;    /* สีปุ่มหมวดตอนเอาเมาส์ชี้ */
	--att-line: #06c755;          /* สีปุ่ม LINE */
	--att-call: #d9480f;          /* สีปุ่มโทร */
}

/* เนื้อหาไม่กว้างเกินไปแม้ไม่มี sidebar */
body.attachment .att-entry {
	max-width: 1000px;
	margin: 0 auto;
}

/* ---------- H1 ---------- */
body.attachment .att-title {
	margin: 0 0 22px;
}

/* ==========================================================================
   กล่องซ้าย-ขวา
   ========================================================================== */
body.attachment .att-split {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 3px minmax(0, 1fr);   /* ซ้าย | เส้น 3px | ขวา */
	column-gap: 28px;
	align-items: stretch;
	margin: 0 0 30px;
}

/* ซ้าย: รูปอยู่กลางทั้งแนวตั้งและแนวนอน */
body.attachment .att-split-left {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 260px;
}
body.attachment .att-image {
	margin: 0;
}
body.attachment .att-image img {
	width: auto;        /* แสดงขนาดจริงของรูป ไม่ขยายให้เบลอ */
	max-width: 100%;    /* แต่ถ้ารูปใหญ่กว่าคอลัมน์ให้ย่อลงมา */
	height: auto;
	display: block;
	margin: 0 auto;
	border-radius: 6px;
}
body.attachment .att-image figcaption {
	font-size: 0.9em;
	color: #777;
	margin-top: 0.5em;
	text-align: center;
}

/* เส้นแบ่งแนวตั้ง (เฉพาะ desktop) */
body.attachment .att-split-divider {
	width: 3px;
	align-self: stretch;
	background: var(--att-divider);
}

/* ขวา: ข้อความ -> ปุ่ม เรียงบนลงล่าง จัดกลางแนวตั้ง */
body.attachment .att-split-right {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 18px;
}

/* ---------- หัวข้อ H2 ในคอลัมน์ขวา ---------- */
body.attachment .att-sub {
	font-size: 1.2em;
	font-weight: 600;
	line-height: 1.5;
	margin: 0;
}

/* ---------- ข้อความที่คุณเขียนเอง ---------- */
body.attachment .att-intro {
	font-size: 1.05em;
	margin: 0;
	padding: 14px 18px;
	background: #f6f5f1;
	border-left: 3px solid var(--att-brand);
}

/* ---------- ปุ่ม LINE + โทร ---------- */
body.attachment .att-cta {
	display: flex;
	flex-direction: column;   /* บน desktop เรียงบนลงล่างในคอลัมน์ขวา */
	gap: 12px;
	margin: 0;
}
body.attachment .att-btn {
	display: block;
	text-align: center;
	padding: 15px 20px;
	border-radius: 6px;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	color: #fff;
	text-decoration: none;
}
body.attachment .att-btn:hover,
body.attachment .att-btn:focus {
	color: #fff;
	opacity: 0.9;
	text-decoration: none;
}
body.attachment .att-btn-line { background: var(--att-line); }
body.attachment .att-btn-call { background: var(--att-call); }

/* แถบติดขอบล่างจอ (พิมพ์ออกที่ wp_footer) ซ่อนบน desktop */
body.attachment .att-cta-sticky {
	display: none;
}

/* ---------- Description จาก Media Library (แสดงเมื่อมีของจริงเท่านั้น) ---------- */
body.attachment .att-description {
	margin: 0 0 26px;
}
body.attachment .att-description p {
	margin: 0 0 14px;
}

/* ==========================================================================
   หมวดสินค้า 5 ช่อง: ไอคอน + ปุ่มชื่อหมวด (ทั้งช่องกดได้)
   ========================================================================== */
body.attachment .att-cats {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 16px;
	margin: 34px 0 28px;
}
body.attachment .att-cat {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: inherit;
}
body.attachment .att-cat img {
	width: 64px;               /* ขนาดไอคอน ปรับได้ */
	height: 64px;
	object-fit: contain;
	display: block;
	transition: transform 0.2s ease;
}
/* เอาเมาส์ชี้: ไอคอนขยายนิด ๆ + ปุ่มเข้มขึ้น */
body.attachment .att-cat:hover img,
body.attachment .att-cat:focus img {
	transform: scale(1.12);
}
body.attachment .att-cat span {
	display: block;
	width: 100%;
	text-align: center;
	padding: 9px 8px;
	border-radius: 6px;
	background: var(--att-brand);
	color: #fff;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.3;
	transition: background 0.2s ease;
}
body.attachment .att-cat:hover span,
body.attachment .att-cat:focus span {
	background: var(--att-brand-dark);
}

/* ---------- ลิงก์หน้าแม่ + รูปก่อนหน้า/ถัดไป ---------- */
body.attachment .att-parent,
body.attachment .att-nav {
	font-size: 0.9em;
	color: #777;
}
body.attachment .att-parent {
	margin: 0 0 8px;
}
body.attachment .att-nav {
	display: flex;
	justify-content: space-between;
	border-top: 1px solid #e6e3dc;
	padding-top: 12px;
}
body.attachment .att-nav a {
	color: #777;
	text-decoration: none;
}
body.attachment .att-nav a:hover {
	color: var(--att-brand);
}

/* ==========================================================================
   มือถือ (จอแคบกว่า 768px)
   ========================================================================== */
@media (max-width: 767px) {

	/* ซ้าย-ขวา กลายเป็นบนลงล่าง: รูป -> ข้อความ -> ปุ่ม (ไม่มีเส้นแบ่ง) */
	body.attachment .att-split {
		grid-template-columns: 1fr;
		row-gap: 18px;
		margin-bottom: 22px;
	}
	body.attachment .att-split-left {
		min-height: 0;
	}
	body.attachment .att-split-divider {
		display: none;
	}
	body.attachment .att-split-right {
		gap: 14px;
	}
	body.attachment .att-btn {
		padding: 13px 12px;
		font-size: 16px;
	}

	/* แถบ LINE/โทร ติดขอบล่างจอ */
	body.attachment .att-cta-sticky {
		display: flex;
		gap: 10px;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 9999;
		padding: 10px 12px;
		background: #fff;
		box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.12);
	}
	body.attachment .att-cta-sticky .att-btn {
		flex: 1;
		padding: 12px 8px;
		font-size: 15px;
	}

	/* หมวดสินค้า 2 คอลัมน์ ช่องที่ 5 เต็มแถว ไอคอนเล็กลงนิด */
	body.attachment .att-cats {
		grid-template-columns: repeat(2, 1fr);
		gap: 14px;
	}
	body.attachment .att-cats .att-cat:last-child {
		grid-column: 1 / -1;
	}
	body.attachment .att-cat img {
		width: 52px;
		height: 52px;
	}

	/* เว้นที่ด้านล่างไม่ให้แถบบัง footer และปุ่ม scroll-to-top ของ Enfold */
	body.attachment #socket {
		padding-bottom: 70px;
	}
	body.attachment #scroll-top-link {
		bottom: 80px;
	}
}
