/*
Theme Name: Twenty Twelve Child
Theme URI: https://wordpress.org/themes/twentytwelve/
Description: Child theme of Twenty Twelve carrying all of this site's custom layout, color, menu, and content styling -- kept separate so the original Twenty Twelve theme can receive its official updates safely.
Author: Custom
Template: twentytwelve
Version: 1.0.0
Text Domain: twentytwelve-child
*/

/* Single-property override of the parent's .site-content article rule
   (padding-bottom: 10px instead of the theme's default 24px). */
.site-content article {
	padding-bottom: 0.714286rem;
}

/* =Custom Beautification
-------------------------------------------------------------- */

body {
	background-color: #eef1f4;
}

.site {
	border-radius: 10px;
	box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

/* Header image, now positioned above the menu (see header.php).
   The "header-image" class lives on the <img> itself (see
   twentytwelve_header_image()), so the wrapper around it gets its own class. */
.header-image-wrap {
	position: relative;
	margin: 0 0 24px;
	margin: 0 0 1.714285714rem;
	text-align: center;
}
/* The theme's default .site-header padding-bottom (24px) stacked with
   .site-content's margin-top (24px) below it, doubling the gap under the
   nav menu vs. the gap above it. Drop the header's own bottom padding so
   .site-content's margin-top is the only thing creating that gap, matching
   the ~24px gap between the header image and the nav menu above it. */
.site-header {
	padding-bottom: 0;
}
img.header-image {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

/* Site title/tagline overlaid on top of the header image (Customizer >
   Header Image > "ตำแหน่งชื่อเว็บไซต์และคำโปรย" = overlay) */
.header-image-overlay {
	position: absolute;
	inset: 0;
	border-radius: 8px;
	background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.5));
}
/* Horizontally always centered; vertical position (0% top - 100% bottom) is
   set inline, independently for the title and the tagline, from the
   Customizer's Y sliders (Header Image > "ตำแหน่งแนวตั้ง..."), or by
   dragging the text directly in the live preview (customizer edit context
   only -- see js/customize-preview-drag.js). The translate() half matching
   the top percentage is what keeps the box centered on that point at any Y,
   instead of overflowing past the image edge at 0% or 100%. */
.header-image-overlay-inner {
	position: absolute;
	left: 50%;
	max-width: 90%;
	text-align: center;
}

/* Drag affordance -- only shown while editing in the Customizer preview
   (body.wp-customizer-drag-ready, added by js/customize-preview-drag.js).
   Regular site visitors never see or trigger any of this. */
body.wp-customizer-drag-ready .header-image-overlay-inner {
	cursor: move;
	outline: 1px dashed transparent;
	transition: outline-color 0.15s ease;
}
body.wp-customizer-drag-ready .header-image-overlay-inner:hover,
body.wp-customizer-drag-ready .header-image-overlay-inner.is-dragging {
	outline-color: rgba(255, 255, 255, 0.8);
}
.header-image-overlay .site-title a {
	color: #fff !important;
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}
.header-image-overlay .site-title a:hover {
	color: #eaf6ff !important;
}
.header-image-overlay .site-description {
	color: rgba(255, 255, 255, 0.9) !important;
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

/* Site title/tagline shown below the header image */
.title-below .header-image-wrap {
	margin-bottom: 24px;
	margin-bottom: 1.714285714rem;
}

/* Tagline marquee (Customizer > Site Identity > "เลื่อนคำโปรยแบบ marquee") */
.site-description.marquee-tagline {
	display: block;
	overflow: hidden;
	white-space: nowrap;
	mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.site-description.marquee-tagline .marquee-track {
	display: inline-block;
	padding-left: 100%;
	animation: twentytwelve-marquee 16s linear infinite;
}
.site-description.marquee-tagline:hover .marquee-track {
	animation-play-state: paused;
}
@keyframes twentytwelve-marquee {
	0% {
		transform: translateX(0);
	}
	100% {
		transform: translateX(-100%);
	}
}
@media (prefers-reduced-motion: reduce) {
	.site-description.marquee-tagline .marquee-track {
		animation: none;
		padding-left: 0;
	}
}

/* Navigation menu polish */
.main-navigation {
	border-radius: 6px;
}
.main-navigation a {
	transition: color 0.2s ease;
}

/* Mobile menu toggle: a bold, full-width bar (matches the entry-title look).
   Scoped below the theme's 960px desktop breakpoint, where .menu-toggle
   is hidden again by the theme's own min-width: 960px rule. */
@media screen and (max-width: 959px) {
	.menu-toggle {
		display: block;
		width: 100%;
		margin: 0;
		padding: 16px 24px;
		font-size: 16px;
		font-weight: bold;
		text-align: center;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		color: #fff;
		background-color: #21759b;
		background-image: linear-gradient(135deg, #21759b, #2e93c4);
		border: 0;
		border-radius: 8px;
		box-shadow: 0 2px 10px rgba(33, 117, 155, 0.35);
		transition: box-shadow 0.2s ease;
	}
	.menu-toggle:hover,
	.menu-toggle:focus {
		color: #fff;
		background-color: #1c6288;
		background-image: linear-gradient(135deg, #1c6288, #257eab);
		box-shadow: 0 4px 14px rgba(33, 117, 155, 0.45);
	}
	.menu-toggle.toggled-on,
	.menu-toggle:active {
		color: #fff;
		background-color: #17516f;
		background-image: linear-gradient(135deg, #17516f, #1c6288);
	}

	/* Nav links: same block look as the menu button, in a lighter blue */
	.main-navigation ul.nav-menu,
	.main-navigation div.nav-menu > ul {
		display: none !important;
		width: 100%;
		margin: 12px 0 0;
		border: 0 !important;
		text-align: left;
	}
	body.nav-menu-open .main-navigation ul.nav-menu,
	body.nav-menu-open .main-navigation div.nav-menu > ul {
		display: block !important;
	}
	.main-navigation li {
		display: block;
		margin: 0 0 10px !important;
		font-size: 14px;
	}
	.main-navigation li a {
		display: block;
		padding: 14px 20px;
		color: #fff;
		background-color: #4a95bd;
		background-image: linear-gradient(135deg, #4a95bd, #6bb0d6);
		border: 0;
		border-radius: 8px;
		text-align: center;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		font-weight: bold;
		text-decoration: none;
		white-space: normal;
		box-shadow: 0 2px 8px rgba(74, 149, 189, 0.3);
		transition: background-color 0.2s ease, box-shadow 0.2s ease;
	}
	.main-navigation li a:hover,
	.main-navigation li a:focus {
		color: #fff;
		background-color: #3f84a8;
		background-image: linear-gradient(135deg, #3f84a8, #5aa0c8);
		box-shadow: 0 4px 12px rgba(74, 149, 189, 0.4);
	}
	.main-navigation .current-menu-item > a,
	.main-navigation .current_page_item > a,
	.main-navigation .current-menu-ancestor > a,
	.main-navigation .current_page_ancestor > a {
		color: #fff;
		background-color: #e07b30;
		background-image: linear-gradient(135deg, #e07b30, #f0a355);
		box-shadow: 0 2px 8px rgba(224, 123, 48, 0.4);
	}
}

/* Desktop nav: rounded blocks with a bit of breathing room between them */
@media screen and (min-width: 960px) {
	.main-navigation ul.nav-menu,
	.main-navigation div.nav-menu > ul {
		display: flex !important;
		flex-wrap: wrap;
		gap: 10px;
		border: 0 !important;
	}
	.main-navigation li {
		margin: 0;
	}
	.main-navigation li a {
		display: inline-block;
		padding: 10px 22px;
		line-height: 1.5;
		color: #fff;
		background-color: #21759b;
		background-image: linear-gradient(135deg, #21759b, #2e93c4);
		border-radius: 6px;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		font-weight: bold;
		box-shadow: 0 1px 4px rgba(33, 117, 155, 0.25);
		transition: background-color 0.2s ease, box-shadow 0.2s ease;
	}
	.main-navigation li a:hover,
	.main-navigation li a:focus {
		color: #fff;
		background-color: #1c6288;
		background-image: linear-gradient(135deg, #1c6288, #257eab);
		box-shadow: 0 3px 10px rgba(33, 117, 155, 0.4);
	}
	.main-navigation .current-menu-item > a,
	.main-navigation .current_page_item > a,
	.main-navigation .current-menu-ancestor > a,
	.main-navigation .current_page_ancestor > a {
		color: #fff;
		background-color: #e07b30;
		background-image: linear-gradient(135deg, #e07b30, #f0a355);
		box-shadow: 0 2px 8px rgba(224, 123, 48, 0.4);
	}
}

/* Mobile: sidebar widgets sit right after the menu, before the content --
   hidden by default like the nav links, revealed when the menu is toggled open.
   #tertiary (the second sidebar, three-column mode only) follows the same rules. */
@media screen and (max-width: 959px) {
	#main.wrapper {
		display: flex;
		flex-direction: column;
	}
	#secondary.widget-area,
	#tertiary.widget-area {
		order: 1;
		margin-top: 0;
	}
	#secondary.widget-area .widget:not(.widget_search),
	#tertiary.widget-area .widget:not(.widget_search) {
		display: none;
	}
	body.nav-menu-open #secondary.widget-area .widget:not(.widget_search),
	body.nav-menu-open #tertiary.widget-area .widget:not(.widget_search) {
		display: block;
	}
	#primary.site-content {
		order: 2;
	}
}

/* Desktop layout modes (Customizer > เค้าโครง (Layout) > เค้าโครงหน้าเว็บ).
   Default ("sidebar-right") is untouched -- it's exactly the theme's
   original float-based two-column layout, handled by twentytwelve_layout_custom_css(). */
@media screen and (min-width: 960px) {
	/* Sidebar on the left instead of the right: just flip which side each
	   column floats to. DOM order (#primary then #secondary) doesn't change --
	   float layout positions purely by float direction, not source order,
	   for two floated siblings like these. */
	body.tt-layout-sidebar-left .site-content {
		float: right;
	}
	body.tt-layout-sidebar-left .widget-area {
		float: left;
	}

	/* Three columns: sidebar-1 + content + sidebar-secondary. Flexbox with
	   `order` decouples visual left-to-right position from DOM order (which
	   is #primary, #secondary, #tertiary), the same trick used for the
	   mobile stacking order above. Fixed 23/48/23 split (instead of the
	   content-width slider, which only applies to the two-column modes). */
	body.tt-layout-three-column #main.wrapper {
		display: flex;
		align-items: flex-start;
		flex-wrap: wrap;
	}
	body.tt-layout-three-column .site-content {
		float: none;
		order: 2;
		width: 48%;
	}
	body.tt-layout-three-column #secondary.widget-area {
		float: none;
		order: 1;
		width: 23%;
	}
	body.tt-layout-three-column #tertiary.widget-area {
		float: none;
		order: 3;
		width: 23%;
	}
}

/* Sidebar widgets: framed titles that highlight on hover */
.widget-area .widget {
	background: #fff;
	border: 1px solid #e2e6e9;
	border-radius: 8px;
	padding: 0 20px 20px;
	overflow: hidden;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.widget-area .widget:hover {
	border-color: #b9d7e6;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}
.widget-area .widget .widget-title,
.widget-area .widget h2,
.widget-area .widget h3 {
	margin: 0 -20px 20px;
	padding: 14px 20px;
	background-color: #e9f2f7;
	background-image: linear-gradient(128deg, #005075, #97cbe5);
	border-bottom: 1px solid #cfe1ea;
	font-size: 15px;
	color: #ffffff;
	transition: background-color 0.2s ease, background-image 0.2s ease, color 0.2s ease;
}
.widget-area .widget:hover .widget-title,
.widget-area .widget:hover h2,
.widget-area .widget:hover h3 {
	background-color: #21759b;
	background-image: linear-gradient(135deg, #21759b, #2e93c4);
	color: #fff;
}

/* Content: framed post/page cards with a styled, rounded header */
#content article {
	background: #fff;
	border: 1px solid #e2e6e9;
	border-radius: 10px;
	margin-bottom: 32px;
	margin-bottom: 2.285714286rem;
	overflow: hidden;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
	transition: box-shadow 0.2s ease;
}
#content article:hover {
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}
#content article.sticky {
	background: #e9eff3;
}
#content article.sticky footer.entry-meta {
	background: #e2eaef;
}
#content article .entry-header {
	display: flex;
	flex-direction: column;
	margin-bottom: 0;
}
#content article .entry-header .entry-title {
	order: 1;
	margin: 0;
	padding: 18px 24px;
	background-image: linear-gradient(135deg, #21759b, #2e93c4);
	color: #fff;
}
#content article .entry-header .entry-title a {
	color: #fff;
}
#content article .entry-header .entry-title a:hover {
	color: #eaf6ff;
}
.sticky-pin-icon {
	display: inline-block;
	margin-right: 6px;
	font-size: 0.85em;
	transform: rotate(-15deg);
}
#content article .entry-header img.wp-post-image {
	order: 2;
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
}
#content article .entry-header .comments-link {
	order: 3;
	margin: 0;
	padding: 12px 24px 0;
}
#content article .entry-content,
#content article .entry-summary {
	padding: 20px 24px;
}
#content article footer.entry-meta {
	padding: 8px 24px;
	background: #fafbfb;
	border-top: 1px solid #ededed;
	font-size: 11px;
	font-size: 0.785714286rem;
	line-height: 1.5;
}
/* Entry-meta icons: category (tag), date (calendar), edit (pencil) */
.entry-meta a[rel~="category"]::before {
	content: "\1F3F7\FE0F ";
}
.entry-meta .entry-date::before {
	content: "\1F4C5 ";
}
.entry-meta .edit-link a::before {
	content: "\270F\FE0F ";
}

/* Footer polish */
footer[role="contentinfo"] {
	border-top-color: #dde2e5;
}

/* Utility classes: show/hide elements by screen size. "Mobile" is below
   960px and "desktop" is 960px and up, matching the breakpoint used
   everywhere else in this theme (nav menu, sidebar, layout controls, etc). */
.show_on_mobile,
.show_on_desktop {
	display: none !important;
}
@media screen and (max-width: 959px) {
	.hide_on_mobile {
		display: none !important;
	}
	.show_on_mobile {
		display: revert !important;
	}
}
@media screen and (min-width: 960px) {
	.hide_on_desktop {
		display: none !important;
	}
	.show_on_desktop {
		display: revert !important;
	}
}

/* =Bootstrap-like polish
-------------------------------------------------------------- */

/* Striped table rows in post/page content (like Bootstrap's .table-striped).
   Scoped to tbody so a <thead> header row is never striped. */
.entry-content table tbody tr:nth-child(even),
.comment-content table tbody tr:nth-child(even) {
	background-color: #f5f7fa;
}

/* Images in widgets: only ever shrink to fit the widget, never enlarge an
   image whose own width/height is already smaller than it (e.g. a small
   file-type icon next to a download link). max-width alone is a ceiling,
   never a floor, so it can't enlarge anything on its own -- deliberately
   NOT declaring width/height here, so the img's own HTML width/height
   attributes (or intrinsic size) keep governing its size. Explicitly
   setting width/height: auto was tried and reverted -- for an <img>
   pointing at an SVG with no intrinsic size of its own (like a file-type
   icon), CSS auto sizing ignores the HTML attributes entirely and falls
   back to filling all available width, which stretched a 32x32 icon
   across the whole widget instead of leaving it alone.

   inline-block (not block) so an icon sitting next to text inside the same
   link -- e.g. <a><img>ใบสมัครสมาชิกฯ</a> -- stays on the same line instead
   of forcing the text onto its own line below it; vertical-align: middle
   lines the icon up with the text's baseline. A standalone image with no
   inline sibling (e.g. a widget's own Image block) still renders exactly
   the same either way. */
.widget-area .widget img {
	display: inline-block;
	vertical-align: middle;
	max-width: 100% !important;
}

/* Sidebar link lists (Recent Posts, Pages, Categories, Archives, nav menus,
   etc.): a clean white list-group -- thin row dividers, near-black-blue text.
   The padding lives on the <a> (not the <li>), and bleeds out to the
   widget's own edges via a negative margin matching its horizontal padding
   (20px, see .widget-area .widget below) -- so the whole row is one
   hoverable/clickable box edge-to-edge, not just the text inside it.

   Some widgets (e.g. a block-editor "Paragraph" block used to hand-type a
   URL) render a link as <p class="wp-block-paragraph"><a>...</a></p>
   instead of <ul><li><a>. :has(> a:only-child) picks out exactly those
   "the whole paragraph is just a link" cases, so a widget mixing hand-typed
   links with a real list (like a Latest Posts block) still reads as one
   consistent set of boxes -- while leaving ordinary paragraphs (with real
   sentences, or no link at all) untouched. */
.widget-area .widget ul li,
.widget-area .widget p.wp-block-paragraph:has(> a:only-child) {
	border-bottom: 1px solid #eef1f3;
	margin: 0;
}
.widget-area .widget ul li:last-child,
.widget-area .widget p.wp-block-paragraph:has(> a:only-child):last-child {
	border-bottom: 0;
}
.widget-area .widget ul li a,
.widget-area .widget p.wp-block-paragraph:has(> a:only-child) > a {
	display: block;
	margin: 0 -20px;
	padding: 10px 20px;
	color: #1b2a3a;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.widget-area .widget ul li a:hover,
.widget-area .widget p.wp-block-paragraph:has(> a:only-child) > a:hover {
	background-color: #f5f7fa;
	color: #21759b;
}
/* ...except inside a Text/Custom HTML widget, where a <ul> is prose content
   (a bullet list the author wrote), not a navigational link list -- leave
   the theme's original list styling alone there. */
.widget-area .widget .textwidget ul li {
	border-bottom: 0;
	padding: 0;
}
.widget-area .widget .textwidget ul li a {
	display: inline;
	margin: 0;
	padding: 0;
	color: #757575;
	background-color: transparent;
}

/* Font-size resizer (A-/A/A+), pinned to the top-right of the browser
   window. Desktop only -- the mobile header's menu button already occupies
   that corner, and pinch-zoom covers the same need there. */
.twentytwelve-font-resizer {
	display: none;
}
@media screen and (min-width: 960px) {
	.twentytwelve-font-resizer {
		position: fixed;
		top: 8px;
		right: 8px;
		z-index: 999998;
		display: flex;
		gap: 4px;
		background: rgba(255, 255, 255, 0.95);
		border: 1px solid #dfe3e6;
		border-radius: 6px;
		padding: 4px;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	}
}
.twentytwelve-font-resizer button {
	width: 30px;
	height: 30px;
	border: 1px solid #d2d2d2;
	border-radius: 4px;
	background: #f7f7f7;
	color: #333;
	font-weight: bold;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.twentytwelve-font-resizer button:hover,
.twentytwelve-font-resizer button:focus {
	background: #21759b;
	color: #fff;
	border-color: #21759b;
}
.twentytwelve-font-resizer .twentytwelve-font-decrease {
	font-size: 11px;
}
.twentytwelve-font-resizer .twentytwelve-font-reset {
	font-size: 13px;
}
.twentytwelve-font-resizer .twentytwelve-font-increase {
	font-size: 15px;
}

/* Front-end "click to edit" pencils (logged-in users only, see
   twentytwelve_child_edit_pencil() in functions.php) -- small circular
   button, positioned top-right of whichever section it's placed in.
   Each of these sections needs position: relative as its anchor. */
.site-header,
#site-navigation,
#secondary.widget-area,
#tertiary.widget-area {
	position: relative;
}
.tt-edit-pencil {
	position: absolute;
	top: 6px;
	right: 6px;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #21759b;
	color: #fff;
	font-size: 14px;
	line-height: 1;
	text-decoration: none;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
	transition: background-color 0.15s ease, transform 0.15s ease;
}
.tt-edit-pencil:hover,
.tt-edit-pencil:focus {
	background: #17516f;
	color: #fff;
	transform: scale(1.08);
}
/* Inside the header image (dark photo background), a plain white circle
   reads better than the theme-blue one used everywhere else. */
.header-image-wrap .tt-edit-pencil {
	background: rgba(255, 255, 255, 0.9);
	color: #21759b;
}
.header-image-wrap .tt-edit-pencil:hover,
.header-image-wrap .tt-edit-pencil:focus {
	background: #fff;
	color: #17516f;
}
/* The title/tagline pencil is a direct child of .site-header (not nested in
   .header-image-wrap like the header-image one) -- put it on the opposite
   corner so the two never sit on top of each other. */
.site-header > .tt-edit-pencil {
	left: 6px;
	right: auto;
}

/* Floating "+ เพิ่มบทความใหม่" button (logged-in users who can publish, see
   twentytwelve_child_render_add_post_button() in functions.php). */
.tt-add-post-button {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 999997;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	border-radius: 999px;
	background-color: #21759b;
	background-image: linear-gradient(135deg, #21759b, #2e93c4);
	color: #fff;
	font-size: 14px;
	font-weight: bold;
	text-decoration: none;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
	transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.tt-add-post-button:hover,
.tt-add-post-button:focus {
	color: #fff;
	background-color: #1c6288;
	background-image: linear-gradient(135deg, #1c6288, #257eab);
	box-shadow: 0 5px 16px rgba(0, 0, 0, 0.4);
	transform: translateY(-1px);
}
.tt-add-post-button-icon {
	font-size: 18px;
	line-height: 1;
}
