/*
Theme Name: โรงเรียนบ้านเหล่า
Description: ธีมลูกของ Twenty Twenty-Five ใช้สีจากตราโรงเรียนบ้านเหล่า ผ่านเกณฑ์ความคมชัดของสีตาม WCAG 2.1 (ข้อความหลัก AAA) พร้อมแถบปรับขนาดตัวอักษรและโหมดความคมชัดสูงสำหรับผู้พิการทางสายตา
Template: twentytwentyfive
Version: 1.6.0
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: banloa-school
*/

/* ---------- การเข้าถึง: พื้นฐาน ---------- */

/* ลิงก์ในเนื้อหามีเส้นใต้เสมอ ไม่ใช้สีอย่างเดียวบอกว่าเป็นลิงก์ (WCAG 1.4.1) */
a { text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

/* กรอบโฟกัสเห็นชัดทั้งบนพื้นขาวและบนปุ่มสีคราม (WCAG 2.4.7) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
.wp-element-button:focus-visible {
	outline: 3px solid var(--wp--preset--color--contrast);
	outline-offset: 2px;
	box-shadow: 0 0 0 6px var(--wp--preset--color--accent-1);
	border-radius: 2px;
}

/* ลิงก์ "ข้ามไปเนื้อหา" ของ WordPress ให้เห็นชัดเมื่อกด Tab */
.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--accent-1);
	color: var(--wp--preset--color--contrast);
	font-size: 1.1rem;
	font-weight: 700;
	padding: 12px 20px;
	z-index: 100000;
}

/* พื้นที่กดอย่างน้อย 44px สำหรับปุ่มและเมนู (WCAG 2.5.5) */
.wp-element-button,
.wp-block-navigation-item__content,
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close { min-height: 44px; display: inline-flex; align-items: center; }

/* ช่องกรอกข้อมูลมีขอบที่มองเห็นได้ (WCAG 1.4.11) */
input:not([type="checkbox"]):not([type="radio"]), select, textarea { border: 1px solid var(--wp--preset--color--accent-6); }

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

/* ---------- แถบช่วยการเข้าถึง ---------- */

.banloa-a11y {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	align-items: center;
	justify-content: flex-end;
	padding: 6px max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px));
	background: var(--wp--preset--color--accent-3);
	color: var(--wp--preset--color--base);
	font-size: 15px; /* ไม่ขยายตามปุ่มของตัวเอง แถบจะได้ไม่กระโดด */
	line-height: 1.4;
}
.banloa-a11y__group { display: flex; gap: 4px; align-items: center; }
.banloa-a11y__label { margin-right: 4px; }
.banloa-a11y button {
	font: inherit;
	min-width: 44px;
	min-height: 36px;
	padding: 2px 10px;
	border: 1px solid currentColor;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}
.banloa-a11y button[aria-pressed="true"] {
	background: var(--wp--preset--color--accent-1);
	color: var(--wp--preset--color--contrast);
	border-color: var(--wp--preset--color--accent-1);
	font-weight: 700;
}
.banloa-a11y button:focus-visible { outline-color: var(--wp--preset--color--accent-1); box-shadow: none; }
.banloa-a11y .s { font-size: 13px; }
.banloa-a11y .l { font-size: 19px; }

/* ---------- ขนาดตัวอักษร (ทั้งหน้าใช้หน่วย rem จึงขยายตามรากได้) ---------- */

html.a11y-text-1 { font-size: 112.5%; }
html.a11y-text-2 { font-size: 125%; }

/* ---------- โหมดความคมชัดสูง: พื้นดำ ตัวขาว ลิงก์/ปุ่มเหลือง ---------- */

html.a11y-contrast {
	--wp--preset--color--base: #000000;
	--wp--preset--color--contrast: #ffffff;
	--wp--preset--color--accent-1: #ffff00;
	--wp--preset--color--accent-2: #000000;
	--wp--preset--color--accent-3: #ffff00;
	--wp--preset--color--accent-4: #ffffff;
	--wp--preset--color--accent-5: #000000;
	--wp--preset--color--accent-6: #ffffff;
	--wp--preset--color--school-red: #ffff00;
	--wp--preset--color--school-green: #ffffff;
	--wp--preset--color--school-purple: #ffffff;
}
html.a11y-contrast body { background: #000 !important; color: #fff !important; }
html.a11y-contrast a { color: #ffff00 !important; }
html.a11y-contrast .wp-element-button,
html.a11y-contrast button:not(.banloa-a11y button) { background: #ffff00 !important; color: #000 !important; border: 2px solid #ffff00 !important; }
html.a11y-contrast .banloa-a11y { background: #000; color: #fff; border-bottom: 2px solid #ffff00; }
html.a11y-contrast img { filter: none; }
html.a11y-contrast :focus-visible { outline-color: #ffff00 !important; box-shadow: 0 0 0 6px #000 !important; }

/* ---------- การ์ดข่าว ---------- */

.banloa-card .wp-block-post-title { margin: 0; line-height: 1.45; }
.banloa-card .wp-block-post-title a { text-decoration: none; }
.banloa-card .wp-block-post-title a:hover { text-decoration: underline; }
.banloa-card .wp-block-post-excerpt__excerpt { margin: 0; color: var(--wp--preset--color--accent-4); }
.banloa-card .wp-block-post-featured-image img { border-radius: 6px; }

/* หมวดข่าวในหน้าข่าวทั้งหมด แสดงเป็นปุ่มให้กดง่าย */
.banloa-cat-chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.banloa-cat-chips li a {
	display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
	border: 1px solid var(--wp--preset--color--accent-3); border-radius: 999px; text-decoration: none;
}
.banloa-cat-chips li.current-cat a, .banloa-cat-chips li a:hover { background: var(--wp--preset--color--accent-3); color: var(--wp--preset--color--base); }

/* ---------- หน้าแรก: แบนเนอร์ประกาศผลและสไลด์ข่าว ในโหมดความคมชัดสูง ---------- */

html.a11y-contrast .bn-grades { background: #000; color: #fff; border: 3px solid #ffff00; }
html.a11y-contrast .bn-grades__title, html.a11y-contrast .bn-grades__eyebrow { color: #fff; }
html.a11y-contrast .bn-grades__cta { background: #ffff00 !important; color: #000 !important; }
html.a11y-contrast .bn-slide__media::after { background: linear-gradient(to top, #000 0%, #000 42%, rgba(0, 0, 0, .7) 70%, rgba(0, 0, 0, 0) 90%); }
html.a11y-contrast .bn-slide__cat { background: #ffff00; color: #000; }
html.a11y-contrast .bn-slide__date { color: #fff; }
html.a11y-contrast .bn-slide__title a { color: #ffff00; }
html.a11y-contrast .bn-slider__controls button { background: #000 !important; color: #ffff00 !important; border-color: #ffff00 !important; }
html.a11y-contrast .bn-slider .bn-slider__dots button { background: transparent !important; border: 0 !important; } /* ชนะกฎปุ่มเหลืองของโหมดคมชัด */
html.a11y-contrast .bn-slider__dots button::after { border-color: #ffff00; }
html.a11y-contrast .bn-slider__dots button[aria-current="true"]::after { background: #ffff00; }
