/*
Theme Name: Astra CES
Template: astra
Description: Child theme of Astra holding the CES design, header and page templates.
Version: 1.1.0
*/

/* Tokens (see DESIGN-PLAN.md). Ochre is only for the archive and sponsored labels. */
:root {
	--ink: #0B1F4B;
	--blue: #1F4FA3;
	--paper: #FFFFFF;
	--mist: #EEF2F8;
	--ochre: #B8860B;
	--body: #2A2F3A;
	--meta: #5B6473;
	--display: 'Pridi', serif;
	--text: 'Sarabun', sans-serif;
}

/* Base */
html body,
body button,
body input,
body select,
body textarea {
	font-family: var(--text);
}
body {
	background: var(--paper);
	color: var(--body);
	font-size: 18px;
	line-height: 1.75;
}
a { color: var(--blue); }
a:hover { color: var(--ink); }

h1, h2, h3, h4, h5, h6,
.entry-content :where(h1, h2, h3, h4, h5, h6) { color: var(--ink); }
h1, h2,
.entry-content h1,
.entry-content h2 {
	font-family: var(--display);
	font-weight: 500;
	line-height: 1.3;
}
h1, .entry-content h1 { font-weight: 600; }
h3, .entry-content h3 {
	font-family: var(--text);
	font-weight: 600;
	font-size: 20px;
	line-height: 1.5;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
	outline: 2px solid var(--blue);
	outline-offset: 2px;
}

/* Second skip link, added by ces-customizations.php; Astra's own uses .screen-reader-text. */
.skip-link:not(.screen-reader-text) {
	position: absolute;
	top: -60px;
	left: 0;
	z-index: 100000;
	padding: 8px 16px;
	background: var(--ink);
	color: #fff;
}
.skip-link:not(.screen-reader-text):focus { top: 0; color: #fff; }

.entry-content img,
.wp-block-image img { max-width: 100%; height: auto; }
.entry-content p { margin: 0 0 1.2em; }
.entry-content table {
	display: block;
	width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: 16px;
}
.entry-content th,
.entry-content td {
	padding: 8px 12px;
	border: 1px solid var(--mist);
	text-align: left;
}
.entry-content th { background: var(--mist); color: var(--ink); font-weight: 600; }

.ces-wrap {
	box-sizing: border-box;
	max-width: 1140px;
	margin: 0 auto;
	padding: 0 24px;
}

/* Astra's container becomes a plain full-width box; each template sets its own width. */
#page #content > .ast-container {
	display: block;
	max-width: none;
	padding: 0;
}
body.ast-separate-container { background: var(--paper); }
/* Our templates use main#primary too; drop Astra's #primary margins there. */
#page #primary.ces-home { margin: 0; }

/* Header */
.ces-header {
	position: relative;
	z-index: 50;
	background: var(--paper);
	border-bottom: 1px solid var(--mist);
}
.ces-header-in {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	min-height: 64px;
}
.ces-header .ces-site-name {
	font-family: var(--display);
	font-weight: 600;
	font-size: 22px;
	line-height: 1.3;
	color: var(--ink);
	text-decoration: none;
}
.ces-nav { display: flex; align-items: center; }
.ces-nav ul {
	display: flex;
	gap: 28px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.ces-nav a {
	display: inline-block;
	padding: 10px 0;
	color: var(--ink);
	font-size: 16px;
	font-weight: 600;
	text-decoration: none;
}
.ces-nav a:hover,
.ces-nav a[aria-current] { text-decoration: underline; text-underline-offset: 6px; }
.ces-lang {
	margin: 0 0 0 40px;
	color: var(--meta);
	font-size: 16px;
}
.ces-nav .ces-lang a { color: var(--meta); font-weight: 400; }
.ces-nav .ces-lang a[aria-current] { color: var(--ink); font-weight: 600; }
.ces-header .ces-menu-btn { display: none; }

@media (min-width: 801px) {
	.ces-header { position: sticky; top: 0; }
	.admin-bar .ces-header { top: 32px; }
}

/* Buttons */
.ces-btn,
.ces-btn:hover {
	display: inline-block;
	margin: 0 12px 12px 0;
	padding: 12px 22px;
	border: 1px solid var(--ink);
	color: var(--ink);
	font-weight: 600;
	font-size: 16px;
	line-height: 1.5;
	text-decoration: none;
}
.ces-btn:hover { text-decoration: underline; }
.ces-btn-primary,
.ces-btn-primary:hover { background: var(--ink); color: #fff; }

/* Shared bits: topic label, meta line, cards */
.ces-topic {
	display: block;
	margin: 14px 0 6px;
	color: var(--blue);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	text-decoration: none;
}
a.ces-topic:hover { text-decoration: underline; color: var(--blue); }
.ces-meta {
	margin: 8px 0 0;
	color: var(--meta);
	font-size: 14px;
	line-height: 1.6;
}

.ces-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 40px 28px;
}
.ces-card { display: flex; flex-direction: column; }
.ces-card-img { display: block; }
.ces-feature img,
.ces-card-img img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: 4px;
}
.ces-card-img-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 10;
	padding: 0 16px;
	border-radius: 4px;
	background: var(--ink);
	color: #fff;
	font-family: var(--display);
	font-size: 20px;
	text-align: center;
	text-decoration: none;
}
.ces-card .ces-card-topic {
	display: block;
	margin: 14px 0 6px;
	color: var(--blue);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
}
.ces-card .ces-card-title,
.ces-feature .ces-feature-title {
	margin: 0;
	font-family: var(--display);
	font-weight: 500;
	font-size: 22px;
	line-height: 1.3;
}
.ces-feature .ces-feature-title { font-size: 26px; }
.ces-card-title a,
.ces-feature-title a { color: var(--ink); text-decoration: none; }
.ces-card-title a:hover,
.ces-feature-title a:hover { color: var(--ink); text-decoration: underline; }
.ces-card-date { display: block; margin-top: 8px; color: var(--meta); font-size: 14px; }
.ces-card-excerpt {
	display: -webkit-box;
	margin: 8px 0 0;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	color: var(--body);
	font-size: 16px;
	line-height: 1.65;
}

/* Home */
.ces-hero-bg {
	background-color: var(--mist);
	background-image:
		repeating-linear-gradient(0deg, transparent 0 79px, rgba(11, 31, 75, .07) 79px 80px),
		repeating-linear-gradient(90deg, transparent 0 79px, rgba(11, 31, 75, .07) 79px 80px);
}
.ces-home .ces-hero {
	display: grid;
	grid-template-columns: 1.2fr 1fr;
	gap: 64px;
	align-items: center;
	padding: 96px 24px 64px;
}
.ces-hero h1 {
	margin: 0;
	font-size: 56px;
	line-height: 1.15;
}
.ces-hero-lead {
	max-width: 36em;
	margin: 24px 0 32px;
	font-size: 20px;
}
.ces-home h2.ces-section-title {
	margin: 0 0 24px;
	font-size: 28px;
	font-weight: 500;
}
.ces-home-topics { padding-top: 48px; padding-bottom: 8px; }
.ces-home-topics .ces-section-title { margin-bottom: 16px; }
.ces-home-topics ul {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.ces-home-topics li a {
	font-family: var(--display);
	font-size: 20px;
	line-height: 1.4;
	color: var(--ink);
	text-decoration: none;
}
.ces-home-topics li a:hover { text-decoration: underline; }
.ces-home-topics li span {
	display: block;
	margin-top: 4px;
	color: var(--meta);
	font-size: 15px;
	line-height: 1.6;
}
.ces-latest { padding-top: 64px; padding-bottom: 64px; }
.ces-home-about { padding-bottom: 96px; }
.ces-home-about > div { max-width: 700px; }
.ces-home-about .ces-section-title { margin-bottom: 12px; }
.ces-home-about p { margin: 0 0 16px; }

/* Blog index */
#page #primary.ces-blog {
	box-sizing: border-box;
	max-width: 1140px;
	margin: 0 auto;
	padding: 64px 24px 96px;
}
.ces-blog-head h1 {
	margin: 0 0 8px;
	font-size: 40px;
	line-height: 1.2;
}
.ces-blog-head p { max-width: 62ch; margin: 0 0 24px; }
.ces-blog .ces-topics {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 40px;
	padding: 0;
	list-style: none;
}
.ces-blog .ces-topics a {
	display: inline-block;
	padding: 9px 16px;
	border: 1px solid var(--ink);
	border-radius: 4px;
	color: var(--ink);
	font-size: 15px;
	line-height: 1.6;
	text-decoration: none;
}
.ces-blog .ces-topics a:hover { text-decoration: underline; }
.ces-blog .ces-topics a[aria-current="page"] { background: var(--ink); color: #fff; }
.ces-pages {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: 64px;
}
.ces-pages .page-numbers {
	display: inline-block;
	min-width: 44px;
	padding: 8px 12px;
	border: 1px solid var(--ink);
	color: var(--ink);
	text-align: center;
	text-decoration: none;
}
.ces-pages .page-numbers.current { background: var(--ink); color: #fff; }
.ces-pages .page-numbers.dots { border-color: transparent; }
.ces-empty { padding: 40px 0; }

/* Article, About, Contact, archive pages: one 700px column on Astra's markup */
body.ast-no-sidebar #primary.content-area {
	box-sizing: border-box;
	max-width: 748px;
	margin: 64px auto 96px;
	padding: 0 24px;
}
body.ast-separate-container .ast-article-single:not(.ast-related-post),
body.ast-plain-container .ast-article-single {
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
}
#primary .entry-header { margin: 0 0 12px; padding: 0; text-align: left; }
#primary .entry-header .entry-title {
	margin: 0;
	font-family: var(--display);
	font-weight: 600;
	font-size: 40px;
	line-height: 1.2;
	color: var(--ink);
}
#primary .entry-header .ces-topic { margin: 0 0 8px; }
.single-post #primary .entry-header .entry-meta,
.single-post .post-navigation,
.single-post .ast-author-meta { display: none; }
#primary .entry-content { font-size: 18px; line-height: 1.75; }
#primary .entry-content > h2,
#primary .entry-content > .ces-section > h2 {
	margin: 40px 0 12px;
	font-size: 28px;
	font-weight: 500;
}
#primary .entry-content > h3,
#primary .entry-content > .ces-section > h3 { margin: 32px 0 8px; }
#primary .entry-content ul,
#primary .entry-content ol { margin: 0 0 1.2em; padding-left: 24px; }
#primary .entry-content li { margin-bottom: 6px; }
#primary .entry-content > :first-child { margin-top: 0; }

/* Featured image on pages (About) and lead image on articles */
#primary .ast-single-post-featured-section {
	margin: 0 0 32px;
	max-width: none;
	width: auto;
}
#primary .ast-single-post-featured-section img,
.ces-lead img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: 4px;
}
/* Astra adds a soft shadow to article figures and images; the design has none. */
#primary .ast-article-single figure,
#primary .ast-article-single img {
	-webkit-box-shadow: none;
	box-shadow: none;
}
.ces-archive-page #primary .ast-single-post-featured-section { display: none; }
.ces-lead { margin: 24px 0 32px; }
.ces-lead figcaption { margin-top: 8px; color: var(--meta); font-size: 14px; }

.ces-byline {
	margin: 0;
	color: var(--meta);
	font-size: 14px;
	line-height: 1.6;
}

#primary .ces-takeaways {
	margin: 0 0 32px;
	padding: 20px 24px;
	background: var(--mist);
	border-left: 4px solid var(--ink);
}
#primary .entry-content .ces-takeaways h2,
#primary .entry-content .ces-toc h2 {
	margin: 0 0 8px;
	font-size: 20px;
	line-height: 1.4;
}
#primary .entry-content .ces-takeaways h2 { font-weight: 600; }
#primary .entry-content .ces-takeaways ul { margin: 0; padding-left: 20px; }
#primary .entry-content .ces-takeaways li:last-child { margin-bottom: 0; }
.ces-toc { margin: 0 0 40px; }
#primary .entry-content .ces-toc ol { margin: 0; padding-left: 20px; }
#primary .entry-content .ces-toc li { margin-bottom: 2px; }
.ces-toc a { color: var(--ink); }

/* Editorial note and archive notice: the same "read the label" box */
#primary .ces-editorial-note,
#primary .ces-archive-notice {
	margin: 48px 0 32px;
	padding: 16px 20px;
	background: var(--mist);
	border-left: 4px solid var(--ochre);
	color: var(--body);
	font-size: 15px;
	line-height: 1.7;
}
#primary .ces-archive-notice { margin: 0 0 32px; }
.ces-editorial-note strong,
.ces-archive-notice .ces-archive-label {
	display: block;
	margin-bottom: 4px;
	font-family: var(--display);
	font-weight: 600;
	font-size: 17px;
	color: var(--ink);
}

#primary .ces-related { margin-top: 48px; }
#primary .entry-content .ces-related h2 { margin: 0 0 12px; font-size: 28px; }
#primary .entry-content .ces-related ul { padding-left: 20px; }
.ces-related a { color: var(--ink); }

/* Footer */
.ces-footer {
	padding: 48px 0 24px;
	background: var(--ink);
	color: #fff;
	font-size: 15px;
	line-height: 1.75;
}
.ces-footer-cols {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 40px;
}
.ces-footer-name {
	display: block;
	margin-bottom: 8px;
	font-family: var(--display);
	font-weight: 600;
	font-size: 22px;
	line-height: 1.3;
	color: #fff;
}
.ces-footer p { max-width: 52ch; margin: 0 0 8px; color: #C9D2E3; }
.ces-footer ul { margin: 0; padding: 0; list-style: none; }
.ces-footer li a { color: #fff; line-height: 2; text-decoration: none; }
.ces-footer li a:hover { color: #fff; text-decoration: underline; }
.ces-footer a:focus-visible { outline-color: #fff; }
.ces-footer .ces-footer-copy { margin: 32px 0 0; font-size: 14px; }

/* Mobile */
@media (max-width: 800px) {
	body { font-size: 17px; }
	h3, .entry-content h3 { font-size: 18px; }

	.ces-header .ces-site-name { font-size: 18px; }
	.ces-header .ces-menu-btn {
		display: inline-block;
		min-height: 44px;
		margin: 0;
		padding: 0 16px;
		border: 1px solid var(--ink);
		border-radius: 0;
		background: var(--paper);
		color: var(--ink);
		font-family: var(--text);
		font-size: 16px;
		font-weight: 600;
		line-height: 42px;
	}
	.ces-header .ces-menu-btn[aria-expanded="true"] { background: var(--ink); color: #fff; }
	.ces-nav {
		flex-basis: 100%;
		flex-direction: column;
		align-items: stretch;
		padding: 0 0 16px;
	}
	.ces-js .ces-nav { display: none; }
	.ces-js.is-open .ces-nav {
		display: flex;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		padding: 8px 24px 16px;
		background: var(--paper);
		border-bottom: 1px solid var(--mist);
	}
	.ces-nav ul { flex-direction: column; gap: 0; }
	.ces-nav a { display: block; padding: 10px 0; }
	.ces-lang { margin: 8px 0 0; }
	.ces-nav .ces-lang a { display: inline-block; padding: 10px 8px; }
	.ces-nav .ces-lang a:first-child { padding-left: 0; }

	.ces-home .ces-hero {
		grid-template-columns: 1fr;
		gap: 32px;
		padding: 48px 24px 40px;
	}
	.ces-hero h1 { font-size: 36px; }
	.ces-hero-lead { font-size: 18px; }
	.ces-home h2.ces-section-title { font-size: 24px; }
	.ces-home-topics ul { grid-template-columns: 1fr; }
	.ces-latest { padding-top: 48px; padding-bottom: 48px; }
	.ces-home-about { padding-bottom: 64px; }
	.ces-grid { grid-template-columns: 1fr; }

	#page #primary.ces-blog { padding: 40px 24px 64px; }
	.ces-blog-head h1 { font-size: 30px; }

	body.ast-no-sidebar #primary.content-area { margin: 40px auto 64px; }
	#primary .entry-header .entry-title { font-size: 30px; }
	#primary .entry-content { font-size: 17px; }
	#primary .entry-content > h2,
	#primary .entry-content > .ces-section > h2,
	#primary .entry-content .ces-related h2 { font-size: 24px; }
	#primary .ces-takeaways { padding: 16px 20px; }

	.ces-footer-cols { grid-template-columns: 1fr; gap: 24px; }
	.ces-footer li a { display: inline-block; padding: 7px 0; line-height: 1.75; }
}
