/* Thanita Vision Center — สไตล์เสริม theme.json
 * สีทั้งหมดอ้าง token จาก theme.json (--wp--preset--color--*) ห้ามใส่ hex ตรงในนี้ */

:root {
	--tvc-radius: 12px;
	--tvc-bar-h: 4.25rem;
	--tvc-focus: 3px solid var(--wp--preset--color--foreground);
}

html { scroll-padding-top: 1rem; }
body { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }

.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important;
}

:where(a, button, summary, input, select, textarea):focus-visible { outline: var(--tvc-focus); outline-offset: 3px; }

.tvc-icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.2em; }

/* ส่วนหัว */
.tvc-header { border-bottom: 1px solid var(--wp--preset--color--border); background: var(--wp--preset--color--surface); }
.tvc-logo { text-decoration: none; display: inline-flex; flex-direction: column; line-height: 1.1; min-height: 44px; justify-content: center; }
.tvc-logo__name { font-weight: 800; font-size: 1.375rem; letter-spacing: .08em; color: var(--wp--preset--color--primary); }
.tvc-logo__sub { font-weight: 700; font-size: .75rem; letter-spacing: .28em; color: var(--wp--preset--color--accent); }
.tvc-header .wp-block-navigation a { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.tvc-header .wp-block-navigation a:hover { text-decoration: underline; }
.tvc-header .wp-block-navigation__responsive-container-open,
.tvc-header .wp-block-navigation__responsive-container-close { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
/* ปุ่มเมนูมือถือ: แสดงเฉพาะจอเล็ก — ห้ามตั้ง display ทุกจอ ไม่งั้นทับกฎซ่อนของ WordPress (ปุ่มโผล่บนจอคอม เมนูตกบรรทัด) */
@media (max-width: 599px) { .tvc-header .wp-block-navigation__responsive-container-open { display: inline-flex; } }
.tvc-header .is-menu-open .wp-block-navigation__responsive-container-close { display: inline-flex; }

/* ปุ่ม */
.tvc-btn {
	display: inline-flex; align-items: center; gap: .5rem; justify-content: center;
	min-height: 48px; padding: .75rem 1.25rem; border-radius: var(--tvc-radius);
	background: var(--wp--preset--color--primary); color: var(--wp--preset--color--surface);
	font-weight: 600; text-decoration: none; transition: background-color .2s ease;
}
.tvc-btn:hover { background: var(--wp--preset--color--primary-dark); color: var(--wp--preset--color--surface); }
.tvc-btn--line { background: var(--wp--preset--color--line); color: var(--wp--preset--color--on-line); }
.tvc-btn--line:hover { background: var(--wp--preset--color--line); color: var(--wp--preset--color--on-line); filter: brightness(.95); }
.tvc-btn--ghost { background: transparent; color: var(--wp--preset--color--primary); box-shadow: inset 0 0 0 2px var(--wp--preset--color--primary); }
.tvc-btn--ghost:hover { background: var(--wp--preset--color--muted); color: var(--wp--preset--color--foreground); }

/* การ์ดสาขา */
.tvc-branch { background: var(--wp--preset--color--surface); border-radius: var(--tvc-radius); padding: clamp(1rem, 3vw, 2rem); box-shadow: 0 1px 3px rgb(19 78 74 / .12); }
.tvc-branch__photo { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: calc(var(--tvc-radius) - 4px); margin-bottom: 1.5rem; }
.tvc-branch__facts { margin: 0; display: grid; gap: 1.25rem; }
.tvc-branch__facts dt { font-weight: 700; display: flex; gap: .5rem; align-items: center; color: var(--wp--preset--color--primary); }
.tvc-branch__facts dd { margin: .25rem 0 0 1.75rem; }
.tvc-branch__facts dd a { font-weight: 700; font-size: 1.25rem; }
.tvc-branch__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.tvc-hours { border-collapse: collapse; width: 100%; max-width: 22rem; }
.tvc-hours th, .tvc-hours td { text-align: left; padding: .25rem 0; font-weight: 400; border-bottom: 1px solid var(--wp--preset--color--muted); }
.tvc-hours td { text-align: right; font-variant-numeric: tabular-nums; }
.tvc-note { font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--muted-foreground); margin-top: .5rem; }

/* รายการสาขา */
.tvc-branch-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: 1fr; }
/* 4 สาขา: มือถือ 1 คอลัมน์ · จอกลาง 2×2 · จอกว้าง 4 ใบแถวเดียว (ไม่ให้เหลือการ์ดเดี่ยวแถวล่าง) */
@media (min-width: 600px) { .tvc-branch-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .tvc-branch-list { grid-template-columns: repeat(4, 1fr); } }
.tvc-branch-list li { background: var(--wp--preset--color--surface); border-radius: var(--tvc-radius); padding: 1.25rem; box-shadow: 0 1px 3px rgb(19 78 74 / .12); }
.tvc-branch-list h3 { margin: 0 0 .5rem; font-size: var(--wp--preset--font-size--large); }
.tvc-branch-list p { margin: .25rem 0; }
.tvc-branch-list a[href^="tel:"] { display: inline-flex; gap: .5rem; align-items: center; min-height: 44px; font-weight: 700; }

/* แถบติดต่อ: มือถือติดล่างจอ · เดสก์ท็อปอยู่ในส่วนท้ายตามปกติ (REQ-07) */
.tvc-bar { display: flex; gap: .75rem; }
.tvc-bar__btn {
	flex: 1; display: flex; gap: .5rem; align-items: center; justify-content: center;
	box-sizing: border-box; min-height: 52px; padding: .5rem 1rem; border-radius: var(--tvc-radius);
	font-weight: 700; text-decoration: none; cursor: pointer; list-style: none;
}
.tvc-bar__btn::-webkit-details-marker { display: none; }
.tvc-bar__btn--line { background: var(--wp--preset--color--line); color: var(--wp--preset--color--on-line); }
.tvc-bar__btn--call { background: var(--wp--preset--color--primary); color: var(--wp--preset--color--surface); }
.tvc-bar__btn--call:hover, .tvc-bar__btn--line:hover { filter: brightness(.95); }
.tvc-bar__sub { font-weight: 400; }
.tvc-bar__call { flex: 1; position: relative; }
.tvc-bar__menu {
	position: absolute; bottom: calc(100% + .5rem); right: 0; width: min(22rem, calc(100vw - 2rem));
	background: var(--wp--preset--color--surface); border-radius: var(--tvc-radius); padding: 1rem;
	box-shadow: 0 8px 24px rgb(19 78 74 / .25);
}
.tvc-bar__menu p { margin: 0 0 .5rem; font-weight: 700; }
.tvc-bar__menu ul { list-style: none; margin: 0; padding: 0; }
.tvc-bar__menu a { display: flex; justify-content: space-between; gap: 1rem; min-height: 48px; align-items: center; border-bottom: 1px solid var(--wp--preset--color--muted); text-decoration: none; color: var(--wp--preset--color--foreground); }
.tvc-bar__menu a .tvc-bar__sub { color: var(--wp--preset--color--primary); font-weight: 700; }

@media (max-width: 767px) {
	.tvc-bar {
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
		padding: .5rem 1rem calc(.5rem + env(safe-area-inset-bottom));
		background: var(--wp--preset--color--surface); box-shadow: 0 -2px 12px rgb(19 78 74 / .15);
	}
	.tvc-bar .tvc-bar__sub { display: none; }
	body { padding-bottom: calc(var(--tvc-bar-h) + env(safe-area-inset-bottom)); }
}
@media (min-width: 768px) {
	.tvc-bar { max-width: 32rem; }
}

/* หน้าแรก */
.tvc-hero { padding-block: clamp(2rem, 7vw, 5rem); }
.tvc-hero h1 { max-width: 20ch; }
.tvc-hero__lead { font-size: var(--wp--preset--font-size--large); max-width: 40ch; }
.tvc-hero .tvc-btn { font-size: var(--wp--preset--font-size--medium); }
.tvc-section { padding-block: clamp(1.5rem, 5vw, 3.5rem); }
.tvc-band { background: var(--wp--preset--color--surface); }

.tvc-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); list-style: none; padding: 0; margin: 0; }
.tvc-card { background: var(--wp--preset--color--surface); border-radius: var(--tvc-radius); padding: 1.5rem; box-shadow: 0 1px 3px rgb(19 78 74 / .12); position: relative; }
.tvc-card h3 { margin: 0 0 .5rem; }
.tvc-card h3 a { text-decoration: none; color: var(--wp--preset--color--primary); }
.tvc-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--tvc-radius); }
.tvc-card h3 a:focus-visible { outline: none; }
.tvc-card:has(a:focus-visible) { outline: var(--tvc-focus); outline-offset: 3px; }
.tvc-card:hover { box-shadow: 0 4px 14px rgb(19 78 74 / .18); }
.tvc-card p { margin: 0; }

.tvc-facts { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); list-style: none; padding: 0; margin: 0; }
.tvc-facts li { border-left: 4px solid var(--wp--preset--color--accent); padding-left: 1rem; }
.tvc-facts strong { display: block; font-size: var(--wp--preset--font-size--large); color: var(--wp--preset--color--foreground); }

/* ราคา */
.tvc-price { background: var(--wp--preset--color--surface); border-radius: var(--tvc-radius); padding: 1.25rem 1.5rem; border-left: 6px solid var(--wp--preset--color--accent); }
.tvc-price p { margin: 0; }
.tvc-price__label { font-weight: 700; }
.tvc-price__value { font-size: var(--wp--preset--font-size--x-large); font-weight: 800; color: var(--wp--preset--color--foreground); }
.tvc-price__value span { font-size: var(--wp--preset--font-size--medium); font-weight: 600; }
.tvc-price__ask a { font-weight: 700; }

/* บทความที่เกี่ยวข้อง */
.tvc-related { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.tvc-related a { display: flex; flex-direction: column; gap: .75rem; height: 100%; background: var(--wp--preset--color--surface); border-radius: var(--tvc-radius); padding: 1rem; text-decoration: none; color: var(--wp--preset--color--foreground); font-weight: 700; box-shadow: 0 1px 3px rgb(19 78 74 / .12); }
.tvc-related a:hover span { text-decoration: underline; }
.tvc-related img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: calc(var(--tvc-radius) - 4px); }

/* กล่องชวนติดต่อท้ายบทความ */
.tvc-cta { margin-block: 2.5rem; padding: 1.5rem; border-radius: var(--tvc-radius); background: var(--wp--preset--color--muted); }
.tvc-cta__title { margin: 0 0 1rem; font-weight: 700; font-size: var(--wp--preset--font-size--large); }
.tvc-cta__actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* รีวิว */
.tvc-review { margin: 0; height: 100%; background: var(--wp--preset--color--surface); border-radius: var(--tvc-radius); padding: 1.5rem; border-left: 4px solid var(--wp--preset--color--primary); }
.tvc-review p { font-size: var(--wp--preset--font-size--large); }
.tvc-review cite { font-style: normal; color: var(--wp--preset--color--muted-foreground); font-size: var(--wp--preset--font-size--small); }

/* ส่วนท้าย */
.tvc-footer { background: var(--wp--preset--color--foreground); color: var(--wp--preset--color--background); }
.tvc-footer a { color: var(--wp--preset--color--background); }
.tvc-footer .tvc-logo__name { color: var(--wp--preset--color--surface); }
.tvc-footer .tvc-logo__sub { color: var(--wp--preset--color--muted); }
.tvc-footer .tvc-bar__btn--line { color: var(--wp--preset--color--on-line); }
.tvc-footer .tvc-bar__menu a { color: var(--wp--preset--color--foreground); }
.tvc-footer .tvc-branch-list li { background: transparent; box-shadow: none; padding: 0; }
.tvc-footer .tvc-branch-list h3 a, .tvc-footer h2, .tvc-footer h3 { color: var(--wp--preset--color--surface); }

/* เนื้อหาบทความ */
.wp-block-post-content img { height: auto; border-radius: calc(var(--tvc-radius) - 4px); }
.wp-block-post-content :where(p, li) { max-width: 70ch; }
/* ตารางในเนื้อหา (เช่น ตารางคุกกี้ในหน้านโยบาย) ตัดคำให้พอดีจอมือถือ ไม่เลื่อนแนวนอน */
.wp-block-table table { width: 100%; table-layout: fixed; }
.wp-block-table :where(th, td) { overflow-wrap: anywhere; vertical-align: top; }

/* ตัวสลับภาษา (REQ-01) */
.tvc-header__end { gap: .5rem; }
.tvc-lang {
	display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 .75rem;
	border: 2px solid var(--wp--preset--color--primary); border-radius: var(--tvc-radius);
	color: var(--wp--preset--color--primary); font-weight: 700; text-decoration: none;
}
.tvc-lang:hover { background: var(--wp--preset--color--muted); }

/* แบนเนอร์คุกกี้ Complianz (REQ-10): ยอมรับ = ปฏิเสธ หน้าตาเดียวกัน · ใช้สีและฟอนต์ของร้าน · มือถืออยู่เหนือแถบติดต่อ */
body .cmplz-cookiebanner.cmplz-cookiebanner {
	--cmplz_banner_background_color: var(--wp--preset--color--surface);
	--cmplz_text_color: var(--wp--preset--color--foreground);
	--cmplz_hyperlink_color: var(--wp--preset--color--primary);
	--cmplz_button_accept_background_color: var(--wp--preset--color--primary);
	--cmplz_button_accept_border_color: var(--wp--preset--color--primary);
	--cmplz_button_accept_text_color: var(--wp--preset--color--surface);
	--cmplz_button_deny_background_color: var(--wp--preset--color--primary);
	--cmplz_button_deny_border_color: var(--wp--preset--color--primary);
	--cmplz_button_deny_text_color: var(--wp--preset--color--surface);
	--cmplz_button_settings_background_color: var(--wp--preset--color--surface);
	--cmplz_button_settings_border_color: var(--wp--preset--color--primary);
	--cmplz_button_settings_text_color: var(--wp--preset--color--primary);
	--cmplz_button_border_radius: var(--tvc-radius);
	--cmplz_button_font_size: var(--wp--preset--font-size--small);
	--cmplz_text_font_size: var(--wp--preset--font-size--small);
	font-family: inherit;
}
body .cmplz-cookiebanner .cmplz-btn { font-family: inherit; font-weight: 700; min-height: 48px; height: auto; }
body .cmplz-cookiebanner .cmplz-links a:empty, body .cmplz-cookiebanner .cmplz-links li:has(> a:empty) { display: none; }
/* ลิงก์เดี่ยวที่ไม่ได้อยู่กลางประโยค ให้กดง่าย ≥ 44px */
.tvc-legal a, .wp-block-post-terms a, .wp-block-query-pagination a, .wp-block-query-pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
}
.tvc-linkbtn {
	min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer;
	font: inherit; color: inherit; text-decoration: underline; text-underline-offset: .2em;
}
body .cmplz-cookiebanner .cmplz-btn:focus-visible { outline: var(--tvc-focus); outline-offset: 3px; }
@media (max-width: 767px) {
	body .cmplz-cookiebanner.cmplz-cookiebanner {
		bottom: calc(var(--tvc-bar-h) + env(safe-area-inset-bottom) + .5rem) !important;
		max-height: calc(100dvh - var(--tvc-bar-h) - 4rem); overflow-y: auto;
		padding: 1rem; row-gap: .5rem;
	}
	body .cmplz-cookiebanner .cmplz-buttons { flex-direction: row; flex-wrap: wrap; gap: .5rem; }
	body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn { flex: 1 1 6rem; width: auto; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}
