/*
Theme Name: Cyber Deep Space
Theme URI: https://localhost:8080/
Author: Nalin Utsahachant
Description: ธีม WordPress แบบ classic เน้นอ่านง่าย รองรับภาษาไทย ปรับแต่งสี ฟอนต์ และระยะทั้งธีมได้จาก CSS custom properties ในบล็อก :root ด้านล่าง
Version: 1.2.5
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cyber-deep-space
Tags: classic, blog, custom-menu, featured-images, threaded-comments, translation-ready, right-sidebar
*/

/* ==========================================================================
   1. Design tokens
   ปรับแบรนด์ทั้งธีมได้จากบล็อกนี้บล็อกเดียว
   ========================================================================== */

:root {
	/* ธีมนี้เป็นโหมดมืดเป็นค่าปริยาย ต้องประกาศให้เบราว์เซอร์รู้ด้วย ไม่งั้นส่วนที่
	   ระบบปฏิบัติการเป็นคนวาด (เมนูของ select, สกรอลบาร์, ตัวเลือกวันที่) จะออกมาเป็น
	   โหมดสว่าง ขาวโพลนบนหน้าพื้นเข้ม — เมนู option ของช่อง OECD คือเคสที่เจอ */
	color-scheme: dark;

	/* พื้นหลัง — ไล่จากมืดสุดไปสว่างสุด */
	--cds-bg: #10162e;
	--cds-bg-alt: #141b38;
	--cds-surface: #1a2347;
	--cds-surface-2: #212b55;
	--cds-bg-subtle: #212b55;
	--cds-border: #2c3765;
	/* ขอบช่องกรอกข้อมูล — ต้องต่างจากพื้นอย่างน้อย 3:1 (WCAG 1.4.11) · --cds-border เดิมได้แค่ 1.3–1.6 */
	--cds-field-border: #7480b0;

	/* ตัวอักษร */
	--cds-text: #f5f3ee;
	--cds-text-muted: #b3b8d0;
	--cds-text-invert: #10162e;

	/* สีหลัก */
	--cds-accent: #ffc857;
	--cds-accent-hover: #ffd98a;
	--cds-accent-contrast: #1b1530;
	--cds-highlight: #8ecbff;
	--cds-danger: #e23636;

	/* ปุ่มค้นหา/ตัวเลือกประเภทในหน้าผลการค้นหา — ฟ้าตามแบบ ไม่ตามสีเน้นของธีม */
	--cds-search-btn: #2390FF;

	/* แถบแบรนด์ด้านบน และตัวอักษรไล่สี */
	/* WCAG 2.1 AA: ตัวอักษรขาวบนแถบนี้ต้องได้ 4.5:1 ทุกช่วงสี — ปลายชมพู/ส้มจึงเข้มกว่าเดิม
	   (เดิม #e0245e / #f07a1c ได้แค่ 4.3 / 2.8) */
	--cds-brand-gradient: linear-gradient(90deg, #8e2de2, #d81f58 55%, #b84f08);
	--cds-text-gradient: linear-gradient(90deg, #c13cff, #ff3d7f 50%, #ff9a2e);

	/* สีย่อยของธีม Orbital — เส้นกรอบ แผง และตัวอักษรระดับรอง */
	--orb-line: #2c3765;
	--orb-line-soft: #252f5a;
	--orb-line-strong: #3a4677;
	--orb-panel: rgba(26, 35, 71, 0.85);
	--orb-text-soft: #cfd3e6;
	--orb-text-nav: #dfe2f0;
	--orb-text-dim: #8a90b3;
	--orb-violet: #c77dff;
	--orb-hatch: repeating-linear-gradient(135deg, #1a2347 0 10px, #1e284f 10px 20px);
	--orb-gutter: clamp(16px, 4vw, 48px);
	/* ความกว้างกล่องเนื้อหาทั้งเว็บ (header / เนื้อหา / footer ใช้ร่วมกัน) — ขยายจาก 1440px ตามที่ผู้ใช้สั่ง 2026-10-28 */
	--orb-max: 1680px;

	/* ตัวอักษร */
	--cds-font-body: "Prompt", "Noto Sans Thai", "Leelawadee UI", "Thonburi", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--cds-font-heading: var(--cds-font-body);
	--cds-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	--cds-text-base: 1rem;
	--cds-leading: 1.75;
	--cds-leading-tight: 1.3;

	/* ระยะและกรอบ */
	--cds-content-width: 46rem;
	--cds-wide-width: 75rem;
	--cds-gutter: 1.25rem;
	--cds-radius: 8px;
	--cds-radius-sm: 6px;
	--cds-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);

	/* ความสูงของ header เวลา sticky (ใช้กับ scroll-margin) */
	--cds-header-height: 6.5rem;

}

/* ปรับขนาดตัวอักษรจากเมนูการเข้าถึง */

/* --------------------------------------------------------------------------
   โหมดสว่าง — dual strategy ตาม playbook ข้อ 2
   ธีมนี้ตั้งโหมดมืดเป็นค่าเริ่มต้นเพราะเป็นอัตลักษณ์ของแบรนด์
   จึงสลับด้านกับตัวอย่างใน playbook: ค่าปริยายคือมืด แล้วสว่างเป็นทางเลือก
   ลำดับ: ระบบตั้งสว่าง (และยังไม่ได้เลือกเอง) → ผู้ใช้เลือกสว่างเอง
   -------------------------------------------------------------------------- */

/* เดิมมีบล็อก @media (prefers-color-scheme: light) สลับตัวแปรสีเป็นโหมดสว่างตามระบบของผู้ใช้ — เอาออก (2026-11-13 ผู้ใช้ทัก "ธีมเปลี่ยนสีตามธีมของเบราว์เซอร์ ยิ่งเปลี่ยนยิ่งแปลก")
   เว็บนี้ออกแบบเป็นโหมดมืดอย่างเดียว ส่วนประกอบจำนวนมากใช้สีมืดตายตัว สลับตัวแปรบางตัวเป็นสว่างจึงออกมาครึ่งสว่างครึ่งมืด
   โหมดสว่างยังเปิดเองได้ด้วย data-theme="light" (ไม่มีปุ่มสลับในหน้าเว็บตอนนี้) */

:root[data-theme="light"] {
	color-scheme: light;

	--cds-bg: #ffffff;
	--cds-bg-alt: #f4f6fa;
	--cds-surface: #ffffff;
	--cds-surface-2: #eef1f6;
	--cds-bg-subtle: #eef1f6;
	--cds-border: #dde2ea;
	--cds-field-border: #767676;

	--cds-text: #12161f;
	--cds-text-muted: #59637a;
	--cds-text-invert: #ffffff;

	--cds-accent: #0b5cad;
	--cds-accent-hover: #063f7a;
	--cds-accent-contrast: #ffffff;
	--cds-highlight: #c2560a;

	--cds-shadow: 0 1px 2px rgba(18, 22, 28, 0.06), 0 8px 24px rgba(18, 22, 28, 0.08);
}

/* แถบเมนูและส่วนท้ายกำหนดสีพื้นไว้ตรง ๆ จึงต้องสลับตามโหมดด้วย */
:root[data-theme="light"] .site-navbar { background: #ffffff; }
:root[data-theme="light"] .site-title a { color: var(--cds-text); }
:root[data-theme="light"] .site-footer { background: #f4f6fa; }
:root[data-theme="light"] .footer-bottom { background: #eaeef4; }

}
html[data-cds-font="lg"]  { font-size: 112.5%; }
html[data-cds-font="xl"]  { font-size: 125%; }

/* โหมดคอนทราสต์สูง */
html[data-cds-contrast="high"] {
	--cds-bg: #000000;
	--cds-bg-alt: #000000;
	--cds-surface: #0a0a0a;
	--cds-surface-2: #141414;
	--cds-border: #6b7690;
	--cds-field-border: #9aa3bd;
	--cds-text: #ffffff;
	--cds-text-muted: #d8dde8;
	--cds-accent: #5aa9ff;
}

/* ลดการเคลื่อนไหว — ทั้งจากระบบและจากเมนูการเข้าถึง */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

html[data-cds-motion="reduce"] *,
html[data-cds-motion="reduce"] *::before,
html[data-cds-motion="reduce"] *::after {
	animation-duration: 0.01ms !important;
	transition-duration: 0.01ms !important;
}

/* ==========================================================================
   2. Reset / พื้นฐาน
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--cds-bg);
	color: var(--cds-text);
	font-family: var(--cds-font-body);
	font-size: var(--cds-text-base);
	line-height: var(--cds-leading);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

img,
video,
iframe,
embed,
object {
	max-width: 100%;
	height: auto;
}

img {
	display: block;
}

a {
	color: var(--cds-accent);
	text-underline-offset: 0.2em;
}

a:hover,
a:focus {
	color: var(--cds-accent-hover);
}

:focus-visible {
	outline: 2px solid var(--cds-accent);
	outline-offset: 2px;
	border-radius: 2px;
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--cds-font-heading);
	line-height: var(--cds-leading-tight);
	margin: 2em 0 0.6em;
	font-weight: 700;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

h1 { font-size: clamp(1.85rem, 1.4rem + 2vw, 2.6rem); }
h2 { font-size: clamp(1.5rem, 1.25rem + 1.2vw, 1.95rem); }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }
h5, h6 { font-size: 1rem; }

p, ul, ol, dl, table, pre, blockquote, figure {
	margin: 0 0 1.25em;
}

ul, ol {
	padding-inline-start: 1.35em;
}

blockquote {
	margin-inline: 0;
	padding: 0.25em 0 0.25em 1.25em;
	border-inline-start: 3px solid var(--cds-accent);
	color: var(--cds-text-muted);
	font-style: normal;
}

code, kbd, pre, samp {
	font-family: var(--cds-font-mono);
	font-size: 0.9em;
}

code {
	background: var(--cds-bg-subtle);
	padding: 0.15em 0.4em;
	border-radius: 4px;
}

pre {
	background: var(--cds-bg-subtle);
	padding: 1rem 1.25rem;
	border-radius: var(--cds-radius);
	overflow-x: auto;
}

pre code {
	background: none;
	padding: 0;
}

hr {
	border: 0;
	border-top: 1px solid var(--cds-border);
	margin: 2.5rem 0;
}

table {
	width: 100%;
	border-collapse: collapse;
}

th, td {
	padding: 0.6em 0.75em;
	border-bottom: 1px solid var(--cds-border);
	text-align: start;
}

th {
	font-weight: 700;
}

/* ==========================================================================
   3. เลย์เอาต์
   ========================================================================== */

.cds-container {
	width: 100%;
	max-width: var(--cds-wide-width);
	margin-inline: auto;
	padding-inline: var(--cds-gutter);
}

.site-content {
	display: flex;
	flex-direction: column;
}

/* ตัวห่อเนื้อหาของหน้าทั่วไป — มีระยะขอบและจำกัดความกว้าง */
.site-content__inner {
	width: 100%;
	max-width: var(--cds-wide-width);
	margin-inline: auto;
	padding-inline: var(--cds-gutter);
	padding-block: 2.5rem 4rem;
	display: grid;
	gap: 3rem;
	align-items: start;
}

/* ตัวห่อของหน้าแรก — ปล่อยให้แต่ละ section คุมความกว้างเอง */
.site-content__full {
	width: 100%;
}

body.has-sidebar .site-content__inner {
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 60rem) {
	body.has-sidebar .site-content__inner {
		grid-template-columns: minmax(0, 1fr) 18rem;
	}
}

/* คอลัมน์เนื้อหาเดี่ยว: จำกัดความกว้างบรรทัดเพื่อการอ่าน */
body:not(.has-sidebar) .site-main:not(.site-main--home) {
	max-width: var(--cds-content-width);
	margin-inline: auto;
}

.entry-content > * {
	max-width: var(--cds-content-width);
	margin-inline: auto;
}

.entry-content > .alignwide {
	max-width: var(--cds-wide-width);
}

.entry-content > .alignfull {
	max-width: none;
	width: 100%;
}

/* ==========================================================================
   4. Accessibility helpers
   ========================================================================== */

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

.skip-link {
	position: absolute;
	inset-block-start: 0.5rem;
	inset-inline-start: 0.5rem;
	z-index: 100;
	padding: 0.6rem 1rem;
	background: var(--cds-accent);
	color: var(--cds-accent-contrast);
	border-radius: var(--cds-radius);
	text-decoration: none;
	transform: translateY(-200%);
}

.skip-link:focus {
	transform: none;
	color: var(--cds-accent-contrast);
}
/* ==========================================================================
   6. หัวข้อหน้า / archive
   ========================================================================== */

.page-header {
	margin-block-end: 2.5rem;
	padding-block-end: 1.5rem;
	border-bottom: 1px solid var(--cds-border);
}

.page-title {
	margin-block: 0 0.35em;
}

.archive-description {
	margin: 0;
	color: var(--cds-text-muted);
}

/* ==========================================================================
   7. รายการโพสต์
   ========================================================================== */

.post-list {
	display: grid;
	gap: 2.5rem;
}

.entry-summary-item {
	padding-block-end: 2.5rem;
	border-bottom: 1px solid var(--cds-border);
}

.entry-summary-item:last-child {
	border-bottom: 0;
	padding-block-end: 0;
}

.entry-thumbnail {
	margin-block-end: 1.25rem;
	border-radius: var(--cds-radius);
	overflow: hidden;
}

.entry-thumbnail img {
	width: 100%;
}

.entry-title {
	margin-block: 0 0.5rem;
}

.entry-summary-item .entry-title {
	font-size: 1.5rem;
}

.entry-title a {
	color: inherit;
	text-decoration: none;
}

.entry-title a:hover {
	color: var(--cds-accent);
	text-decoration: underline;
}

.entry-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1rem;
	margin-block-end: 1rem;
	font-size: 0.875rem;
	color: var(--cds-text-muted);
}

.entry-meta a {
	color: inherit;
}

.entry-meta a:hover {
	color: var(--cds-accent);
}

.entry-footer {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1rem;
	margin-block-start: 2rem;
	padding-block-start: 1.25rem;
	border-top: 1px solid var(--cds-border);
	font-size: 0.875rem;
	color: var(--cds-text-muted);
}

.more-link {
	display: inline-block;
	font-weight: 600;
	text-decoration: none;
}

.more-link:hover {
	text-decoration: underline;
}

.sticky .entry-title::before {
	content: "★";
	color: var(--cds-accent);
	margin-inline-end: 0.4em;
}

/* ==========================================================================
   8. โพสต์เดี่ยว / หน้า
   ========================================================================== */

.entry-single .entry-header {
	margin-block-end: 2rem;
}

.entry-single .entry-thumbnail {
	margin-block-end: 2rem;
}

.post-navigation {
	margin-block-start: 3rem;
	padding-block-start: 1.5rem;
	border-top: 1px solid var(--cds-border);
	display: grid;
	gap: 1rem;
}

@media (min-width: 40rem) {
	.post-navigation {
		grid-template-columns: 1fr 1fr;
	}

	.post-navigation .nav-next {
		text-align: end;
	}
}

.post-navigation .nav-label {
	display: block;
	font-size: 0.8125rem;
	color: var(--cds-text-muted);
	margin-block-end: 0.15rem;
}

.post-navigation a {
	text-decoration: none;
	font-weight: 600;
}

.post-navigation a:hover {
	text-decoration: underline;
}

/* ==========================================================================
   9. Pagination
   ========================================================================== */

.pagination {
	margin-block-start: 3rem;
	padding-block-start: 1.5rem;
	border-top: 1px solid var(--cds-border);
}

.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.4rem;
	height: 2.4rem;
	padding-inline: 0.6rem;
	border: 1px solid var(--cds-border);
	border-radius: var(--cds-radius);
	text-decoration: none;
	color: var(--cds-text);
}

.pagination .page-numbers:hover {
	border-color: var(--cds-accent);
	color: var(--cds-accent);
}

.pagination .page-numbers.current {
	background: var(--cds-accent);
	border-color: var(--cds-accent);
	color: var(--cds-accent-contrast);
}

.pagination .page-numbers.dots {
	border-color: transparent;
}

/* ==========================================================================
   10. Sidebar / widgets
   ========================================================================== */

.widget-area .widget {
	margin-block-end: 2.25rem;
	font-size: 0.9375rem;
}

.widget-area .widget:last-child {
	margin-block-end: 0;
}

.widget-title {
	margin-block: 0 0.75rem;
	font-size: 0.8125rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--cds-text-muted);
}

.widget ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.widget li {
	padding-block: 0.35rem;
	border-bottom: 1px solid var(--cds-border);
}

.widget li:last-child {
	border-bottom: 0;
}

.widget a {
	text-decoration: none;
}

.widget a:hover {
	text-decoration: underline;
}

/* ==========================================================================
   11. ฟอร์ม
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea,
select {
	width: 100%;
	max-width: 100%;
	padding: 0.6rem 0.75rem;
	font: inherit;
	font-size: 0.9375rem;
	color: var(--cds-text);
	background: var(--cds-surface);
	border: 1px solid var(--cds-field-border);
	border-radius: var(--cds-radius);
}

textarea {
	min-height: 9rem;
	resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
	border-color: var(--cds-accent);
	outline: 1px solid var(--cds-accent);
}

label {
	display: inline-block;
	margin-block-end: 0.3rem;
	font-size: 0.9375rem;
	font-weight: 600;
}

button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.wp-block-button__link {
	display: inline-block;
	width: auto;
	padding: 0.65rem 1.4rem;
	font: inherit;
	font-weight: 600;
	color: var(--cds-accent-contrast);
	background: var(--cds-accent);
	border: 1px solid var(--cds-accent);
	border-radius: var(--cds-radius);
	cursor: pointer;
	text-decoration: none;
}

button:hover,
input[type="submit"]:hover,
.wp-block-button__link:hover {
	background: var(--cds-accent-hover);
	border-color: var(--cds-accent-hover);
	color: var(--cds-accent-contrast);
}

.search-form {
	display: flex;
	gap: 0.5rem;
}

.search-form label {
	flex: 1;
	margin: 0;
}

/* ==========================================================================
   12. ความคิดเห็น
   ========================================================================== */

.comments-area {
	margin-block-start: 3.5rem;
	padding-block-start: 2rem;
	border-top: 1px solid var(--cds-border);
}

.comments-title,
.comment-reply-title {
	margin-block-start: 0;
	font-size: 1.35rem;
}

.comment-list {
	list-style: none;
	margin: 0 0 2.5rem;
	padding: 0;
}

.comment-list .children {
	list-style: none;
	margin: 0;
	padding-inline-start: 1.5rem;
	border-inline-start: 1px solid var(--cds-border);
}

.comment-body {
	padding-block: 1.25rem;
	border-bottom: 1px solid var(--cds-border);
}

.comment-meta {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-block-end: 0.6rem;
	font-size: 0.875rem;
	color: var(--cds-text-muted);
}

.comment-meta .avatar {
	border-radius: 50%;
}

.comment-author .fn {
	font-style: normal;
	font-weight: 700;
	color: var(--cds-text);
}

.bypostauthor > .comment-body .comment-author .fn::after {
	content: "ผู้เขียน";
	margin-inline-start: 0.5em;
	padding: 0.1em 0.5em;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--cds-accent);
	background: var(--cds-bg-subtle);
	border-radius: 999px;
}

.reply a {
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
}

.comment-form .comment-form-cookies-consent label,
.comment-form .comment-notes {
	font-weight: 400;
	font-size: 0.875rem;
	color: var(--cds-text-muted);
}

.comment-form p {
	margin-block-end: 1rem;
}

/* ==========================================================================
   13. หน้า 404 / ไม่พบผลลัพธ์
   ========================================================================== */

.no-results,
.error-404 {
	max-width: var(--cds-content-width);
}

.error-404 .page-title {
	font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem);
}

/* ==========================================================================
   15. คลาสมาตรฐานของ WordPress
   ========================================================================== */

.alignleft {
	float: left;
	margin-inline-end: 1.5rem;
	margin-block-end: 1rem;
}

.alignright {
	float: right;
	margin-inline-start: 1.5rem;
	margin-block-end: 1rem;
}

.aligncenter {
	display: block;
	margin-inline: auto;
}

.wp-caption {
	max-width: 100%;
}

.wp-caption-text,
.wp-element-caption,
figcaption {
	margin-block-start: 0.5rem;
	font-size: 0.875rem;
	color: var(--cds-text-muted);
	text-align: center;
}

.gallery {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}

.gallery-item {
	margin: 0;
}

.gallery-caption {
	font-size: 0.8125rem;
}

.wp-block-image img {
	border-radius: var(--cds-radius);
}

/* ==========================================================================
   16. พิมพ์
   ========================================================================== */

@media print {
	.site-header,
	.site-footer,
	.widget-area,
	.comments-area,
	.post-navigation,
	.pagination {
		display: none !important;
	}

	body {
		color: #000;
		background: #fff;
	}
}
