/*
Theme Name: Nexa Grid
Author:
Description: Nexa 系列的圖牆風主題。首頁方形圖牆（標題疊圖）與分類快速切換，頁首左上角收合選單或固定側欄二選一，固定 CTA（底部橫條／浮動按鈕、手機也固定），文章頁含目錄、作者、上一篇／下一篇，提供全寬／無側欄／著陸頁範本；所有文字、顏色、區塊都能在自訂器調整。
Version: 1.0.4
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nexa-grid
Tags: news, blog, custom-menu, custom-logo, featured-images, threaded-comments, translation-ready, grid-layout, two-columns
*/

/* ========== 基礎 ========== */
:root {
	--nexa-primary: #263445;
	--nexa-on-primary: #ffffff;
	--nexa-accent: #2563eb;
	--nexa-on-accent: #ffffff;
	--nexa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Roboto, Helvetica, Arial, sans-serif;
	--nexa-bg: #f3f4f6;
	--nexa-surface: #ffffff;
	--nexa-text: #1f2937;
	--nexa-muted: #5b657a;
	--nexa-border: #d9dee8;
	--nexa-radius: 8px;
	--nexa-gap: 18px;
	--nexa-shadow: 0 1px 3px rgba(20, 30, 55, .08);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--nexa-bg);
	color: var(--nexa-text);
	font-family: var(--nexa-font);
	font-size: 16px;
	line-height: 1.7;
	overflow-wrap: anywhere;
}

img, svg, video { max-width: 100%; height: auto; }
a { color: var(--nexa-primary); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }
[hidden] { display: none !important; }

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal;
}
.screen-reader-text:focus {
	background: #fff;
	clip: auto;
	clip-path: none;
	color: #000;
	display: block;
	height: auto;
	left: 8px;
	top: 8px;
	padding: 10px 16px;
	width: auto;
	z-index: 100000;
}

:focus-visible { outline: 3px solid var(--nexa-accent); outline-offset: 2px; }

.nexa-container {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
}

.nexa-main { padding: 24px 0 48px; }

.nexa-section-title {
	margin: 0;
	font-size: 22px;
	line-height: 1.3;
	color: var(--nexa-primary);
}
.nexa-section-title a { color: inherit; }

.nexa-btn,
.nexa-search__btn {
	display: inline-block;
	padding: 8px 18px;
	background: var(--nexa-accent);
	color: var(--nexa-on-accent);
	border: 0;
	border-radius: 6px;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
.nexa-btn:hover, .nexa-search__btn:hover { text-decoration: none; filter: brightness(.95); }

/* ========== 頁首 ========== */
.nexa-header {
	background: var(--nexa-primary);
	color: var(--nexa-on-primary);
	position: sticky;
	top: 0;
	z-index: 50;
}
body.admin-bar .nexa-header { top: 32px; }
@media (max-width: 782px) { body.admin-bar .nexa-header { top: 46px; } }

.nexa-header__inner {
	display: flex;
	align-items: center;
	gap: 24px;
	min-height: 70px;
}
.nexa-header__brand { flex: 0 0 auto; }
.nexa-header__inner > .nexa-drawer-toggle { margin-right: -8px; }
.nexa-header__name {
	color: var(--nexa-on-primary);
	font-size: 24px;
	font-weight: 800;
	letter-spacing: .04em;
}
.nexa-header__name:hover { text-decoration: none; }
.nexa-header__brand .custom-logo { max-height: 48px; width: auto; display: block; }

.nexa-nav { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nexa-nav::-webkit-scrollbar { display: none; }
.nexa-nav ul {
	display: flex;
	flex-wrap: nowrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.nexa-nav li { flex: 0 0 auto; }
.nexa-nav a {
	display: block;
	padding: 8px 12px;
	color: var(--nexa-on-primary);
	font-size: 18px;
	font-weight: 700;
	white-space: nowrap;
	border-radius: 6px;
}
.nexa-nav a:hover,
.nexa-nav .current-menu-item > a,
.nexa-nav .current-cat > a { background: rgba(255, 255, 255, .14); text-decoration: none; }

.nexa-header__search { flex: 0 0 auto; }
.nexa-search { display: flex; gap: 6px; }
.nexa-search__input {
	width: 210px;
	max-width: 100%;
	padding: 7px 10px;
	border: 1px solid var(--nexa-border);
	border-radius: 6px;
	font: inherit;
	font-size: 15px;
	background: #fff;
	color: var(--nexa-text);
}
.nexa-header .nexa-search__btn { padding: 7px 12px; }

@media (max-width: 767px) {
	.nexa-header__inner { flex-wrap: wrap; gap: 6px 12px; padding-top: 8px; padding-bottom: 8px; min-height: 0; }
	.nexa-header__inner > .nexa-drawer-toggle { order: 0; margin-right: 0; }
	.nexa-header__brand { order: 1; }
	.nexa-header__search { order: 2; margin-left: auto; }
	.nexa-nav { order: 3; flex: 1 1 100%; }
	.nexa-search__input { width: 150px; }
	.nexa-nav a { font-size: 16px; padding: 6px 10px; }
}

/* ========== 文章卡片 ========== */
.nexa-card {
	display: flex;
	flex-direction: column;
	background: var(--nexa-surface);
	border: 1px solid var(--nexa-border);
	border-radius: var(--nexa-radius);
	overflow: hidden;
	color: var(--nexa-text);
	box-shadow: var(--nexa-shadow);
	transition: transform .2s ease, box-shadow .2s ease;
}
.nexa-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(20, 30, 55, .12); }
.nexa-card__media { display: block; aspect-ratio: 16 / 10; background: #dfe4ee; overflow: hidden; }
.nexa-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nexa-card__body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; flex: 1; }
.nexa-card__cat { font-size: 12px; font-weight: 700; color: var(--nexa-accent); }
.nexa-card__title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.45;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.nexa-card__date { margin-top: auto; padding-top: 4px; font-size: 13px; color: var(--nexa-muted); }


/* ========== 文章頁 ========== */
.nexa-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 14px; font-size: 14px; color: var(--nexa-muted); }
.nexa-breadcrumb a { color: var(--nexa-primary); }
.nexa-breadcrumb__sep { color: #9aa3b5; }


.nexa-article {
	background: var(--nexa-surface);
	border: 1px solid var(--nexa-border);
	border-radius: var(--nexa-radius);
	padding: 28px 32px;
	min-width: 0;
}
.nexa-article--page { max-width: 860px; margin: 0 auto; }
.nexa-article__cat {
	display: inline-block;
	padding: 1px 10px;
	background: var(--nexa-accent);
	color: var(--nexa-on-accent);
	font-size: 13px;
	font-weight: 700;
	border-radius: 4px;
}
.nexa-article__cat:hover { text-decoration: none; filter: brightness(.95); }
.nexa-article__title { margin: 10px 0 8px; font-size: 32px; line-height: 1.35; color: var(--nexa-primary); }
.nexa-article__meta { font-size: 14px; color: var(--nexa-muted); }
.nexa-article__thumb { margin: 18px 0; }
.nexa-article__thumb img { width: 100%; border-radius: var(--nexa-radius); display: block; }
.nexa-article__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.nexa-article__tags a { padding: 2px 10px; background: var(--nexa-bg); border-radius: 999px; font-size: 14px; }

@media (max-width: 767px) {
	.nexa-article { padding: 20px 16px; }
	.nexa-article__title { font-size: 26px; }
	.nexa-container { padding: 0 14px; }
}

/* 內文：相容 CTA 外掛插入的內容與其他外掛的資料區塊（表格、圖片、嵌入內容不可撐破版面） */
.entry-content { font-size: 17px; line-height: 1.85; min-width: 0; }
.entry-content > * { max-width: 100%; }
.entry-content h2 { margin: 1.6em 0 .6em; font-size: 24px; line-height: 1.4; color: var(--nexa-primary); }
.entry-content h3 { margin: 1.4em 0 .5em; font-size: 20px; line-height: 1.4; }
.entry-content p { margin: 0 0 1.1em; }
.entry-content img { max-width: 100%; height: auto; }
.entry-content figure { margin: 1.2em 0; max-width: 100%; }
.entry-content table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1.2em 0; font-size: 15px; }
.entry-content th, .entry-content td { overflow-wrap: normal; word-break: keep-all; white-space: nowrap; padding: 6px 10px; border: 1px solid var(--nexa-border); text-align: left; }
.entry-content th { background: var(--nexa-bg); }
.entry-content iframe, .entry-content video, .entry-content embed, .entry-content object { max-width: 100%; }
.entry-content pre { overflow-x: auto; padding: 12px; background: #1e2433; color: #f3f5f8; border-radius: 6px; }
.entry-content blockquote { margin: 1.2em 0; padding: 4px 16px; border-left: 4px solid var(--nexa-accent); color: var(--nexa-muted); }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content .alignwide, .entry-content .alignfull { max-width: 100%; }
.entry-content .alignleft { float: left; margin: 0 1.2em .6em 0; }
.entry-content .alignright { float: right; margin: 0 0 .6em 1.2em; }
.entry-content .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.entry-content::after { content: ""; display: block; clear: both; }
.page-links { margin: 1em 0; }

/* 相關文章 */
.nexa-related { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--nexa-border); }
.nexa-related .nexa-section-title { margin-bottom: 14px; font-size: 20px; }
.nexa-related__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--nexa-gap); }

/* 右側欄 */
.nexa-box {
	background: var(--nexa-surface);
	border: 1px solid var(--nexa-border);
	border-radius: var(--nexa-radius);
	padding: 16px 18px;
}
.nexa-box__title { margin: 0 0 10px; font-size: 18px; color: var(--nexa-primary); }
.nexa-rank { counter-reset: nexa-rank; }
.nexa-rank li { counter-increment: nexa-rank; display: flex; gap: 10px; padding: 7px 0; }
.nexa-rank li + li { border-top: 1px solid var(--nexa-border); }
.nexa-rank li::before { content: counter(nexa-rank); flex: 0 0 22px; height: 22px; line-height: 22px; text-align: center; font-size: 12px; font-weight: 700; color: var(--nexa-on-primary); background: var(--nexa-primary); border-radius: 4px; }
.nexa-rank a { font-size: 14px; line-height: 1.5; color: var(--nexa-text); }

/* ========== 清單頁、搜尋、404 ========== */
.nexa-archive__header { margin-bottom: 20px; }
.nexa-archive__title { margin: 0; font-size: 28px; color: var(--nexa-primary); }
.nexa-archive__desc { color: var(--nexa-muted); }
.nexa-none { padding: 40px 20px; text-align: center; background: var(--nexa-surface); border: 1px solid var(--nexa-border); border-radius: var(--nexa-radius); }
.nexa-none .nexa-search { justify-content: center; margin: 12px 0; }
.nexa-none .nexa-search__input { border-color: var(--nexa-border); }
.navigation.pagination { margin-top: 26px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.page-numbers { padding: 6px 12px; background: var(--nexa-surface); border: 1px solid var(--nexa-border); border-radius: 6px; }
.page-numbers.current { background: var(--nexa-primary); border-color: var(--nexa-primary); color: var(--nexa-on-primary); }
.page-numbers:hover { text-decoration: none; border-color: var(--nexa-primary); }

/* 留言 */
.nexa-comments { margin-top: 36px; }
.nexa-comments__list { padding-left: 0; list-style: none; }
.nexa-comments .comment-body { padding: 12px 0; border-bottom: 1px solid var(--nexa-border); }
.nexa-comments textarea, .nexa-comments input[type="text"], .nexa-comments input[type="email"], .nexa-comments input[type="url"] { width: 100%; padding: 8px; border: 1px solid var(--nexa-border); border-radius: 6px; font: inherit; }

/* ========== 頁尾 ========== */
.nexa-footer { background: var(--nexa-primary); color: var(--nexa-on-primary); padding: 28px 0 18px; margin-top: 20px; }
.nexa-footer a { color: var(--nexa-on-primary); }


.nexa-footer-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-bottom: 24px; }
.nexa-footer-trio--1 { grid-template-columns: minmax(0, 1fr); }
.nexa-footer-trio--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nexa-footer-col__title { margin: 0 0 12px; font-size: 20px; color: var(--nexa-on-primary); }
.nexa-footer-col ul, .nexa-footer-col ol { margin: 0; padding: 0; list-style: none; }
.nexa-footer-col li { padding: 4px 0; }
.nexa-footer .nexa-rank li { padding: 4px 0; border-top: 0; }
.nexa-footer .nexa-rank li::before { background: rgba(255, 255, 255, .22); }
.nexa-footer .nexa-rank a { color: var(--nexa-on-primary); font-size: 15px; }
.nexa-tagcloud { display: flex; flex-wrap: wrap; gap: 8px; }
.nexa-tagcloud a { padding: 2px 12px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; font-size: 14px; }
.nexa-tagcloud a:hover { background: rgba(255, 255, 255, .14); text-decoration: none; }
@media (max-width: 767px) { .nexa-footer-trio, .nexa-footer-trio--1, .nexa-footer-trio--2 { grid-template-columns: 1fr; gap: 22px; } }

.nexa-footer__bottom {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	justify-content: space-between;
	padding-top: 16px;
	border-top: 1px solid rgba(255, 255, 255, .2);
	font-size: 14px;
}
.nexa-footer__menu { display: flex; flex-wrap: wrap; gap: 14px; margin: 0; padding: 0; list-style: none; }

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ========== 卡片網格（首頁各區、清單頁共用；欄數由 --nexa-cols／-t／-m 帶入） ========== */
.nexa-grid {
	display: grid;
	grid-template-columns: repeat(var(--nexa-cols, 3), minmax(0, 1fr));
	gap: var(--nexa-gap);
}
@media (max-width: 1023px) {
	.nexa-grid { grid-template-columns: repeat(var(--nexa-cols-t, 2), minmax(0, 1fr)); }
}
@media (max-width: 639px) {
	.nexa-grid { grid-template-columns: repeat(var(--nexa-cols-m, 1), minmax(0, 1fr)); }
}

/* 只有文字的卡片（「圖片數」之外的文章） */
.nexa-card--text .nexa-card__body { padding: 16px 16px 14px; justify-content: center; border-left: 4px solid var(--nexa-accent); }
.nexa-card--text { min-height: 100px; }

/* ========== 首頁分類區（卡片網格＋左右欄） ========== */
.nexa-area { margin-bottom: 36px; }
.nexa-area__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--nexa-primary);
}
.nexa-area__more { font-size: 14px; font-weight: 700; white-space: nowrap; }
.nexa-area__main { min-width: 0; }
.nexa-area__side { margin-top: 20px; min-width: 0; }
.nexa-area__band { margin-top: 20px; }
@media (min-width: 1024px) {
	.nexa-area.has-side .nexa-area__body { display: grid; gap: 24px; align-items: stretch; }
	.nexa-area.has-side.side-right .nexa-area__body { grid-template-columns: minmax(0, 1fr) 280px; }
	.nexa-area.has-side.side-left .nexa-area__body { grid-template-columns: 280px minmax(0, 1fr); }
	.nexa-area.has-side.side-left .nexa-area__main { order: 2; }
	.nexa-area.has-side.side-left .nexa-area__side { order: 1; }
	.nexa-area__side { margin-top: 0; }
}

/* ========== 清單頁／文章頁左右側欄 ========== */
.nexa-layout { display: block; }
.nexa-layout__main { min-width: 0; }
.nexa-aside { margin-top: 28px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.nexa-single .nexa-layout:not(.has-side) .nexa-article { max-width: 860px; margin-left: auto; margin-right: auto; }
@media (min-width: 1024px) {
	.nexa-layout.has-side { display: grid; gap: 32px; align-items: stretch; }
	.nexa-layout.has-side.side-right { grid-template-columns: minmax(0, 1fr) var(--nexa-side-w, 300px); }
	.nexa-layout.has-side.side-left { grid-template-columns: var(--nexa-side-w, 300px) minmax(0, 1fr); }
	.nexa-layout.has-side.side-left > .nexa-layout__main { order: 2; }
	.nexa-layout.has-side.side-left > .nexa-aside { order: 1; }
	.nexa-layout.has-side > .nexa-aside { margin-top: 0; }
}

/* ========== CTA（分類區左右欄、清單頁／文章頁側欄、頁尾） ========== */
.nexa-cta {
	--cta-bg: var(--nexa-surface);
	--cta-text: var(--nexa-text);
	--cta-btn: var(--nexa-accent);
	--cta-btn-text: var(--nexa-on-accent);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding: 18px 22px;
	background: var(--cta-bg);
	color: var(--cta-text);
	border: 1px solid var(--nexa-border);
	border-radius: var(--nexa-radius);
}
.nexa-cta__media { flex: 0 0 auto; max-width: 160px; }
.nexa-cta__img { display: block; width: 100%; height: auto; border-radius: 6px; }
.nexa-cta__text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 200px; min-width: 0; }
.nexa-cta__title { font-size: 20px; line-height: 1.4; color: inherit; }
.nexa-cta__desc { font-size: 15px; color: inherit; }
.nexa-cta__btn {
	flex: 0 0 auto;
	padding: 10px 24px;
	background: var(--cta-btn);
	color: var(--cta-btn-text) !important;
	border-radius: 6px;
	font-weight: 800;
	text-align: center;
}
.nexa-cta__btn:hover { text-decoration: none; filter: brightness(.95); }
.nexa-cta--side { flex-direction: column; align-items: stretch; text-align: center; }
.nexa-cta--side .nexa-cta__media { max-width: none; }
.nexa-footer .nexa-cta { --cta-bg: rgba(255, 255, 255, .12); --cta-text: var(--nexa-on-primary); border-color: transparent; margin-bottom: 28px; }
/* 固定跟隨捲動：只在桌機左右欄時生效，平板與手機不固定 */
@media (min-width: 1024px) {
	.nexa-cta.is-sticky { position: sticky; top: 90px; align-self: flex-start; width: 100%; }
	body.admin-bar .nexa-cta.is-sticky { top: 122px; }
}
.nexa-rank { margin: 0; padding: 0; list-style: none; }
.nexa-cta--side .nexa-cta__text { flex: 0 1 auto; }

/* ========== 首頁預設版型：分類快速切換標籤＋方形卡片網格＋載入更多 ========== */
.nexa-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 18px;
	padding: 10px 12px;
	background: var(--nexa-surface);
	border: 1px solid var(--nexa-border);
	border-radius: var(--nexa-radius);
}
.nexa-tabs__tab {
	padding: 6px 16px;
	border-radius: 999px;
	color: var(--nexa-primary);
	font-weight: 700;
	line-height: 1.5;
}
.nexa-tabs__tab:hover { background: var(--nexa-bg); text-decoration: none; }
.nexa-tabs__tab.is-active { background: var(--nexa-primary); color: var(--nexa-on-primary); }
@media (max-width: 639px) {
	.nexa-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
	.nexa-tabs::-webkit-scrollbar { display: none; }
	.nexa-tabs__tab { flex: 0 0 auto; white-space: nowrap; }
}

.nexa-tabs-home__main { min-width: 0; }
.nexa-tabs-home.is-loading .nexa-grid { opacity: .55; transition: opacity .15s ease; }
.nexa-tabs__status { margin: 14px 0 0; text-align: center; color: var(--nexa-muted); font-weight: 700; }

/* 方形圖牆卡片：1:1，標題疊在圖上（底部漸層遮罩）；沒有圖片的卡片維持文字卡 */
.nexa-card--tile { position: relative; aspect-ratio: 1 / 1; }
.nexa-card--tile:not(.nexa-card--text) { background: #1f2937; }
.nexa-card--tile:not(.nexa-card--text) .nexa-card__media { position: absolute; inset: 0; aspect-ratio: auto; }
.nexa-card--tile:not(.nexa-card--text) .nexa-card__media img { transition: transform .35s ease; }
.nexa-card--tile:not(.nexa-card--text):hover .nexa-card__media img,
.nexa-card--tile:not(.nexa-card--text):focus-visible .nexa-card__media img { transform: scale(1.05); }
.nexa-card--tile:not(.nexa-card--text) .nexa-card__body {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	flex: 0 0 auto;
	padding: 44px 14px 14px;
	background: linear-gradient(to top, rgba(0, 0, 0, .82) 0%, rgba(0, 0, 0, .55) 55%, rgba(0, 0, 0, 0) 100%);
}
.nexa-card--tile:not(.nexa-card--text) .nexa-card__title { color: #fff; font-size: 16px; -webkit-line-clamp: 3; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.nexa-card--tile.nexa-card--text { min-height: 0; }
.nexa-card--tile.nexa-card--text .nexa-card__body { flex: 1 1 auto; justify-content: center; }
.nexa-card--tile.nexa-card--text .nexa-card__title { font-size: 15px; -webkit-line-clamp: 5; }
.nexa-loadmore { margin-top: 22px; }
.nexa-loadmore__btn {
	display: block;
	width: 100%;
	padding: 10px 16px;
	background: var(--nexa-surface);
	color: var(--nexa-primary);
	border: 1px solid var(--nexa-border);
	border-radius: var(--nexa-radius);
	font-weight: 800;
	text-align: center;
}
.nexa-loadmore__btn:hover { background: var(--nexa-primary); color: var(--nexa-on-primary); text-decoration: none; }

/* 首頁側欄（選用，預設不放）：桌機左右，平板／手機排在網格下方 */
.nexa-tabs-home__side { margin-top: 22px; min-width: 0; }
@media (min-width: 1024px) {
	.nexa-tabs-home.has-side .nexa-tabs-home__body { display: grid; gap: 24px; align-items: stretch; }
	.nexa-tabs-home.has-side.side-right .nexa-tabs-home__body { grid-template-columns: minmax(0, 1fr) 280px; }
	.nexa-tabs-home.has-side.side-left .nexa-tabs-home__body { grid-template-columns: 280px minmax(0, 1fr); }
	.nexa-tabs-home.has-side.side-left .nexa-tabs-home__main { order: 2; }
	.nexa-tabs-home.has-side.side-left .nexa-tabs-home__side { order: 1; }
	.nexa-tabs-home__side { margin-top: 0; }
}

/* ========== 頁首滑出選單（☰ 分類）：顏色字型沿用主題變數 ========== */
.nexa-drawer-toggle {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	color: var(--nexa-on-primary);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	border-radius: 6px;
}
.nexa-drawer-toggle:hover,
.nexa-drawer-toggle:focus { background: rgba(255, 255, 255, .14); text-decoration: none; }
.nexa-drawer-toggle__icon { font-size: 22px; line-height: 1; }

/* 平常收起（visibility 讓收起時裡面的連結不會被 Tab 到）；無 JS 時用 :target 展開，有 JS 時用 .is-open */
.nexa-drawer {
	position: fixed;
	inset: 0;
	z-index: 100000;
	visibility: hidden;
	pointer-events: none;
	transition: visibility 0s linear .25s;
}
.nexa-drawer:target,
.nexa-drawer.is-open { visibility: visible; pointer-events: auto; transition-delay: 0s; }
.nexa-js .nexa-drawer:target:not(.is-open) { visibility: hidden; pointer-events: none; }
.nexa-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, .55);
	opacity: 0;
	transition: opacity .25s ease;
}
.nexa-drawer:target .nexa-drawer__overlay,
.nexa-drawer.is-open .nexa-drawer__overlay { opacity: 1; }
.nexa-drawer__panel {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	width: 320px;
	max-width: 88vw;
	background: var(--nexa-surface);
	color: var(--nexa-text);
	font-family: var(--nexa-font);
	box-shadow: 4px 0 24px rgba(15, 23, 42, .25);
	transform: translateX(-100%);
	transition: transform .25s ease;
}
.nexa-drawer:target .nexa-drawer__panel,
.nexa-drawer.is-open .nexa-drawer__panel { transform: translateX(0); }
.nexa-js .nexa-drawer:target:not(.is-open) .nexa-drawer__panel { transform: translateX(-100%); }
.nexa-js .nexa-drawer:target:not(.is-open) .nexa-drawer__overlay { opacity: 0; }
.nexa-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 18px;
	background: var(--nexa-primary);
	color: var(--nexa-on-primary);
}
.nexa-drawer__title { margin: 0; font-size: 20px; color: inherit; }
.nexa-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	color: var(--nexa-on-primary);
	font-size: 28px;
	line-height: 1;
	border-radius: 6px;
}
.nexa-drawer__close:hover,
.nexa-drawer__close:focus { background: rgba(255, 255, 255, .18); text-decoration: none; }
.nexa-drawer__body { flex: 1 1 auto; padding: 8px 18px 24px; overflow-y: auto; overscroll-behavior: contain; }
.nexa-drawer__heading { margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--nexa-primary); font-size: 17px; color: var(--nexa-primary); }
.nexa-drawer__body ul,
.nexa-drawer__body ol { margin: 0; padding: 0; list-style: none; }
.nexa-drawer__body li { padding: 0; }
.nexa-drawer__section--cats li a { display: block; padding: 7px 0; font-weight: 700; color: var(--nexa-text); }
.nexa-drawer__section--popular .nexa-rank li { padding: 7px 0; }
.nexa-drawer .nexa-tagcloud a { padding: 2px 12px; border: 1px solid var(--nexa-border); border-radius: 999px; font-size: 14px; color: var(--nexa-primary); }
.nexa-drawer .nexa-tagcloud a:hover { background: var(--nexa-bg); text-decoration: none; }
html.nexa-drawer-open { overflow: hidden; }
@media (max-width: 767px) {
	.nexa-drawer-toggle { padding: 6px 8px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
	.nexa-drawer, .nexa-drawer__overlay, .nexa-drawer__panel { transition: none !important; }
}

/* ========== 1.0.3：Nexa 統一標準補齊 ========== */

/* 觸控目標至少 44px */
.nexa-drawer-toggle,
.nexa-drawer__close { min-height: 44px; min-width: 44px; }
.nexa-search__btn,
.nexa-search__input { min-height: 44px; }
.nexa-nav a { min-height: 44px; display: flex; align-items: center; }
.nexa-loadmore__btn { min-height: 44px; display: flex; align-items: center; justify-content: center; }
.nexa-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.nexa-tabs__tab { min-height: 44px; display: inline-flex; align-items: center; }
.nexa-drawer__body li a { display: flex; align-items: center; min-height: 44px; }
.nexa-drawer__body .nexa-rank li { align-items: center; padding: 0; }
.nexa-footer-col li a { display: inline-block; padding: 6px 0; }

/* 滑出選單內的選單與搜尋 */
.nexa-drawer__menu { margin: 0; padding: 0; list-style: none; }
.nexa-drawer__menu a { font-weight: 700; color: var(--nexa-text); }
.nexa-drawer__section--search { padding-top: 14px; }
.nexa-drawer__section--search .nexa-search { width: 100%; }
.nexa-drawer__section--search .nexa-search__input { flex: 1 1 auto; min-width: 0; width: auto; }
.nexa-drawer__section--menu .nexa-drawer__heading:first-child { margin-top: 8px; }

/* 首頁圖牆標題與固定側欄 */
.nexa-tabs-home__title { margin: 0 0 14px; }
.nexa-box__content { overflow-wrap: anywhere; }
.nexa-box__content > :first-child { margin-top: 0; }
.nexa-box__content > :last-child { margin-bottom: 0; }
.nexa-box--tags .nexa-tagcloud a { border-color: var(--nexa-border); color: var(--nexa-primary); }
.nexa-box--tags .nexa-tagcloud a:hover { background: var(--nexa-bg); }

/* 分類區輪播 */
.nexa-carousel { position: relative; }
.nexa-carousel__nav {
	display: none;
	position: absolute;
	top: 50%;
	z-index: 2;
	width: 44px;
	height: 44px;
	margin-top: -22px;
	padding: 0;
	background: var(--nexa-primary);
	color: var(--nexa-on-primary);
	border: 2px solid var(--nexa-surface);
	border-radius: 50%;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	box-shadow: var(--nexa-shadow);
}
.nexa-js .nexa-carousel__nav { display: flex; align-items: center; justify-content: center; }
.nexa-carousel__prev { left: -10px; }
.nexa-carousel__next { right: -10px; }
.nexa-carousel__nav:hover { filter: brightness(1.15); }
.nexa-grid.nexa-grid--carousel {
	display: flex;
	gap: var(--nexa-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	padding-bottom: 2px;
}
.nexa-grid--carousel::-webkit-scrollbar { display: none; }
.nexa-grid--carousel > * {
	flex: 0 0 calc( ( 100% - var(--nexa-gap) * ( var(--nexa-cols, 3) - 1 ) ) / var(--nexa-cols, 3) );
	scroll-snap-align: start;
}
@media (max-width: 1023px) {
	.nexa-grid--carousel > * { flex-basis: calc( ( 100% - var(--nexa-gap) * ( var(--nexa-cols-t, 2) - 1 ) ) / var(--nexa-cols-t, 2) ); }
}
@media (max-width: 639px) {
	.nexa-grid--carousel > * { flex-basis: calc( ( 100% - var(--nexa-gap) * ( var(--nexa-cols-m, 1) - 1 ) ) / var(--nexa-cols-m, 1) ); }
	.nexa-carousel__prev { left: -4px; }
	.nexa-carousel__next { right: -4px; }
}

/* 文章資訊列、特色圖高度 */
.nexa-article__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.nexa-article__sep { color: #9aa3b5; }
.nexa-article__thumb img { max-height: var(--nexa-thumb-h, none); object-fit: cover; }
@media (max-width: 767px) {
	.nexa-article__thumb img { max-height: var(--nexa-thumb-h-m, var(--nexa-thumb-h, none)); }
}

/* 目錄 */
.nexa-toc { margin: 18px 0 24px; padding: 12px 16px; background: var(--nexa-bg); border: 1px solid var(--nexa-border); border-radius: var(--nexa-radius); }
.nexa-toc__title { cursor: pointer; font-weight: 800; color: var(--nexa-primary); min-height: 32px; }
.nexa-toc__list { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: nexa-toc; }
.nexa-toc__item { padding: 4px 0; }
.nexa-toc__item--h2 { counter-increment: nexa-toc; }
.nexa-toc__item--h2 > a::before { content: counter(nexa-toc) ". "; color: var(--nexa-muted); }
.nexa-toc__item--h3 { margin-left: 1.6em; font-size: .95em; }
.nexa-toc__item--h3 > a::before { content: "– "; color: var(--nexa-muted); }
.nexa-toc a { color: var(--nexa-text); }
.entry-content h2[id], .entry-content h3[id] { scroll-margin-top: 90px; }

/* 內文：按鈕跟輔色、引言樣式 */
.entry-content .wp-block-button__link,
.entry-content .wp-element-button { background: var(--nexa-accent); color: var(--nexa-on-accent); border-radius: 6px; }
.entry-content blockquote { background: var(--nexa-bg); border-radius: 0 var(--nexa-radius) var(--nexa-radius) 0; }
.entry-content blockquote cite { display: block; margin-top: 4px; font-size: 14px; }
.entry-content .nexa-cta { margin: 1.5em 0; }
.nexa-article > .nexa-cta { margin-top: 24px; }

/* 上一篇／下一篇 */
.nexa-postnav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; }
.nexa-postnav__item { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; background: var(--nexa-bg); border: 1px solid var(--nexa-border); border-radius: var(--nexa-radius); color: var(--nexa-text); min-height: 44px; }
.nexa-postnav__item:hover { text-decoration: none; border-color: var(--nexa-primary); }
.nexa-postnav__item--next { text-align: right; grid-column: 2; }
.nexa-postnav__item--prev:only-child { grid-column: 1; }
.nexa-postnav__label { font-size: 13px; font-weight: 700; color: var(--nexa-accent); }
.nexa-postnav__title { font-weight: 700; line-height: 1.45; }
@media (max-width: 639px) {
	.nexa-postnav { grid-template-columns: 1fr; }
	.nexa-postnav__item--next { grid-column: 1; }
}

/* 列表頁分類圖、分頁 */
.nexa-archive__banner { margin-bottom: 14px; border-radius: var(--nexa-radius); overflow: hidden; }
.nexa-archive__banner img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.post-navigation, .posts-navigation { margin-top: 26px; }
.posts-navigation .nav-links { justify-content: space-between; }
.posts-navigation a { padding: 8px 16px; background: var(--nexa-surface); border: 1px solid var(--nexa-border); border-radius: 6px; min-height: 44px; display: inline-flex; align-items: center; }
.page-numbers { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }

/* 404 最新文章 */
.nexa-404__latest { margin-top: 28px; }

/* 頁面範本 */
.nexa-page--full .nexa-container { max-width: none; }
.nexa-page--full .nexa-article--page { max-width: none; }
.nexa-page--nosidebar .nexa-article--page { max-width: 760px; }
.nexa-page--landing .nexa-article--page { max-width: 860px; }
.nexa-tpl-landing .nexa-header__inner { justify-content: center; min-height: 60px; }
.nexa-tpl-landing .nexa-footer { padding-top: 18px; margin-top: 0; }
.nexa-tpl-landing .nexa-footer__bottom { border-top: 0; padding-top: 0; justify-content: center; }
.nexa-tpl-landing .nexa-main { padding-top: 16px; }

/* 固定 CTA：底部橫條／浮動按鈕（手機也固定；頁面底部留白，不蓋住頁尾連結） */
.nexa-sticky {
	--cta-bg: var(--nexa-primary);
	--cta-text: var(--nexa-on-primary);
	--cta-btn: var(--nexa-accent);
	--cta-btn-text: var(--nexa-on-accent);
	position: fixed;
	z-index: 90;
	font-family: var(--nexa-font);
}
.nexa-sticky--bar {
	left: 0;
	right: 0;
	bottom: 0;
	padding: 8px 0 calc( 8px + env(safe-area-inset-bottom, 0px) );
	background: var(--cta-bg);
	color: var(--cta-text);
	box-shadow: 0 -2px 12px rgba(15, 23, 42, .25);
}
.nexa-sticky__inner { display: flex; align-items: center; justify-content: center; gap: 14px; padding-right: 54px; }
.nexa-sticky__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.nexa-sticky__title { font-size: 16px; }
.nexa-sticky__desc { font-size: 13px; opacity: .9; }
.nexa-sticky__btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 8px 22px;
	background: var(--cta-btn);
	color: var(--cta-btn-text) !important;
	border-radius: 999px;
	font-weight: 800;
	white-space: nowrap;
}
.nexa-sticky__btn:hover { text-decoration: none; filter: brightness(.95); }
.nexa-sticky--float { bottom: calc( 18px + env(safe-area-inset-bottom, 0px) ); }
.nexa-sticky--float.pos-right { right: 18px; }
.nexa-sticky--float.pos-left { left: 18px; }
.nexa-sticky--float .nexa-sticky__btn { box-shadow: 0 4px 14px rgba(15, 23, 42, .35); padding: 10px 26px; }
.nexa-sticky__close {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: transparent;
	color: inherit;
	border: 0;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}
.nexa-js .nexa-sticky__close { display: inline-flex; }
.nexa-sticky--bar .nexa-sticky__close { position: absolute; right: 6px; top: 50%; margin-top: -22px; color: var(--cta-text); }
.nexa-sticky--float .nexa-sticky__close { position: absolute; right: -14px; top: -22px; width: 30px; height: 30px; margin: 0; background: var(--nexa-primary); color: var(--nexa-on-primary); border-radius: 50%; font-size: 20px; }
.nexa-sticky-dismissed .nexa-sticky { display: none; }
@media (min-width: 768px) {
	.nexa-sticky.hide-desktop { display: none; }
	body.nexa-sticky-pad.nexa-sticky-d { padding-bottom: var(--nexa-sticky-h, 76px); }
	html.nexa-sticky-dismissed body.nexa-sticky-pad { padding-bottom: 0; }
}
@media (max-width: 767px) {
	.nexa-sticky.hide-mobile { display: none; }
	body.nexa-sticky-pad.nexa-sticky-m { padding-bottom: var(--nexa-sticky-h, 76px); }
	html.nexa-sticky-dismissed body.nexa-sticky-pad { padding-bottom: 0; }
	.nexa-sticky__inner { gap: 10px; padding-right: 50px; }
	.nexa-sticky__desc { display: none; }
	.nexa-sticky__btn { padding: 8px 16px; }
}
.nexa-footer .nexa-rank li { align-items: center; }
