/*
Theme Name: pang-watcharapong.com
Theme URI: https://www.pang-watcharapong.com
Author: PhranakornSoft
Author URI: https://www.phranakornsoft.com
Description: Block themes for pang-watcharapong.com
Version: 1.0.0
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License
License URI: license.txt
Text Domain: pang-watcharapong
Tags: block-theme, full-site-editing, one-column, custom-colors, custom-logo, custom-menu, editor-style, featured-images, translation-ready, threaded-comments, blog, portfolio
*/

/* ==============================================================
   1. การเข้าถึง (Accessibility)
   ============================================================== */

/* โฟกัสที่มองเห็นชัดเจนสำหรับผู้ใช้คีย์บอร์ด */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

.wp-element-button:focus-visible,
.wp-block-button__link:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
}

/* ข้อความสำหรับโปรแกรมอ่านหน้าจอ */
.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background-color: var(--wp--preset--color--base);
	clip-path: none;
	color: var(--wp--preset--color--contrast);
	display: block;
	font-size: 1rem;
	height: auto;
	left: 5px;
	line-height: normal;
	padding: 1rem 1.5rem;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
}

/* เลื่อนหน้าแบบนุ่มนวลเฉพาะผู้ที่ไม่ได้ปิดการเคลื่อนไหว */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

::selection {
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--base);
}

/* ==============================================================
   2. องค์ประกอบทั่วไป
   ============================================================== */

.wp-element-button,
.wp-block-button__link {
	transition: background-color 0.2s ease, color 0.2s ease;
}

.wp-block-navigation .current-menu-item > a,
.wp-block-navigation .current_page_item > a {
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
	text-underline-offset: 0.35em;
}

.wp-block-image img {
	height: auto;
}

/* ==============================================================
   3. Block styles ของธีม
   ============================================================== */

/* กลุ่มแบบการ์ด */
.is-style-card {
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--outline);
	border-radius: var(--wp--custom--radius--large);
	box-shadow: var(--wp--custom--shadow--card);
	height: 100%;
}

/* รายการแบบติ๊กถูก */
ul.is-style-checkmark {
	list-style: none;
	padding-left: 0;
}

ul.is-style-checkmark li {
	padding-left: 1.75em;
	position: relative;
	margin-bottom: 0.5em;
}

ul.is-style-checkmark li::before {
	content: "\2713";
	position: absolute;
	left: 0;
	top: 0;
	color: var(--wp--preset--color--accent);
	font-weight: 700;
}

/* ==============================================================
   4. เส้นทางหน้า (Breadcrumbs) — รองรับ Rank Math SEO
   ============================================================== */

.pang-breadcrumbs,
.rank-math-breadcrumb {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
	margin-bottom: var(--wp--preset--spacing--30);
}

.pang-breadcrumbs a,
.rank-math-breadcrumb a {
	color: inherit;
	text-decoration: none;
}

.pang-breadcrumbs a:hover,
.pang-breadcrumbs a:focus,
.rank-math-breadcrumb a:hover,
.rank-math-breadcrumb a:focus {
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
}

.pang-breadcrumbs .sep,
.rank-math-breadcrumb .separator {
	margin: 0 0.4em;
}

/* ==============================================================
   5. Fluent Forms / Fluent Forms Pro
   ============================================================== */

.fluentform .ff-el-form-control {
	width: 100%;
	padding: 0.75rem 1rem;
	border: 1px solid var(--wp--preset--color--outline);
	border-radius: var(--wp--custom--radius--small);
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.fluentform .ff-el-form-control:focus {
	border-color: var(--wp--preset--color--primary);
	box-shadow: 0 0 0 3px rgba(29, 53, 87, 0.18);
	outline: none;
}

.fluentform .ff-el-input--label label {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	color: inherit;
}

.fluentform .ff-el-group {
	margin-bottom: 1.25rem;
}

.fluentform .ff-btn-submit {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	border: none;
	border-radius: 999px;
	padding: 0.75rem 1.75rem;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.fluentform .ff-btn-submit:hover,
.fluentform .ff-btn-submit:focus {
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--base);
}

/* ข้อความแจ้งเตือน/ผิดพลาด ให้คอนทราสต์เพียงพอ (WCAG AA) */
.fluentform .ff-el-is-error .ff-el-form-control {
	border-color: #b91c1c;
}

.fluentform .error,
.fluentform .text-danger,
.fluentform .ff-el-is-error .error {
	color: #b91c1c;
}

.fluentform .ff-message-success {
	border: 1px solid var(--wp--preset--color--outline);
	border-radius: var(--wp--custom--radius--medium);
	padding: 1rem 1.25rem;
	background-color: var(--wp--preset--color--tint);
}

/* ข้อความแนะนำเมื่อยังไม่ได้ติดตั้ง Fluent Forms (เห็นเฉพาะผู้ดูแล) */
.pang-form-notice {
	border: 1px dashed var(--wp--preset--color--outline);
	border-radius: var(--wp--custom--radius--medium);
	padding: 1rem 1.25rem;
	font-size: var(--wp--preset--font-size--small);
}

/* ==============================================================
   6. FluentCRM / FluentCRM Pro (หน้า unsubscribe / จัดการการติดตาม)
   ============================================================== */

.fluentcrm_unsubscribe_form_wrapper,
.fluentcrm_manage_sub_wrapper,
.fc_unsubscribe_wrapper {
	max-width: var(--wp--style--global--content-size, 44rem);
	margin-inline: auto;
	padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
}

.fluentcrm_unsubscribe_form_wrapper input[type="email"],
.fluentcrm_manage_sub_wrapper input[type="text"],
.fluentcrm_manage_sub_wrapper input[type="email"] {
	width: 100%;
	padding: 0.75rem 1rem;
	border: 1px solid var(--wp--preset--color--outline);
	border-radius: var(--wp--custom--radius--small);
}

/* ==============================================================
   7. คอมเมนต์และรายละเอียดปลีกย่อย
   ============================================================== */

.wp-block-comments {
	margin-top: var(--wp--preset--spacing--60);
}

.wp-block-post-comments-form input:not([type="submit"]),
.wp-block-post-comments-form textarea {
	border: 1px solid var(--wp--preset--color--outline);
	border-radius: var(--wp--custom--radius--small);
	padding: 0.75rem 1rem;
}

.wp-block-table table {
	border-collapse: collapse;
}

.wp-block-table td,
.wp-block-table th {
	border: 1px solid var(--wp--preset--color--outline);
	padding: 0.5rem 0.75rem;
}
