/**
 * Gongtham Core — baseline block styles (BLK-03).
 *
 * The plugin's blocks previously shipped NO CSS: every grid/widget relied
 * entirely on gongtham-theme, so on any other theme the grids collapsed to an
 * unstyled stack — violating the "เปลี่ยนธีมไม่กระทบ" 2-layer principle.
 *
 * This is a MINIMAL fallback, not a full skin. Every rule is wrapped in
 * :where() so it has ZERO specificity — the active theme's own block rules
 * always override it. Its only job is to guarantee responsive, wrapping grids
 * (and legible widget chrome) when the theme is absent.
 */

:where(
	.department-grid,
	.leadership-grid,
	.value-cards,
	.stats-grid,
	.regional-offices,
	.social-channels__grid,
	.post-grid-block__grid,
	.archive-grid
) {
	display: grid;
	gap: 1rem;
	/* min(100%, 240px) → single column on narrow screens, multi-column when
	   there's room. Wraps without any media query. */
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

/* Honour the admin's column choice once there's horizontal room. */
@media (min-width: 640px) {
	:where([class*="--cols-2"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	:where([class*="--cols-3"]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	:where([class*="--cols-4"]) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Sidebar widget chrome — enough structure to be legible theme-less. */
:where(.widget-header) {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}
:where(.widget-title) {
	margin: 0;
	font-size: 1.05rem;
}
:where(.widget-body--flush) { padding: 0; }

/* List widgets — strip default list chrome. */
:where(.popular-posts, .widget-recent) {
	margin: 0;
	padding: 0;
	list-style: none;
}
:where(.popular-posts__link, .widget-recent__link, .key-units-widget__item) {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	text-decoration: none;
}

/* Touch-target floor for block links/buttons (WCAG 2.5.8). */
:where(.social-channels__grid a, .key-units-widget__item) {
	min-height: 44px;
}
