/*
Theme Name: Nexa Magazine
Author: Nexa
Description: Nexa 系列的雜誌風主題。首頁由上而下是滿版大頭條、兩張並排大圖卡片、一區一區往下排的分類區（區標題加一排三張圖文卡，可輪播）；側邊可選固定側欄或收合選單；固定 CTA、文章目錄、頁面範本都在自訂器設定；所有文字、顏色、圖片、區塊與順序都能在自訂器調整，不寫死任何分類，也不依賴任何外掛。
Version: 1.0.2
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-magazine
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: 6px;
	--nexa-gap: 24px;
	--nexa-sticky-top: 90px;
}

*,
*::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: 28px 0 48px; }

.nexa-section-title {
	margin: 0;
	font-size: 26px;
	font-weight: 800;
	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__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: var(--nexa-surface);
	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__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-drawer-toggle { order: 0; }
	.nexa-nav a { font-size: 16px; padding: 6px 10px; }
}

/* ========== 輪播共用（大頭條、分類區） ========== */
.nexa-carousel__track {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.nexa-carousel__track::-webkit-scrollbar { display: none; }
.nexa-carousel__track > * { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; }

.nexa-carousel__arrows { display: flex; gap: 6px; }
.nexa-carousel__arrow {
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid var(--nexa-border);
	border-radius: 50%;
	background: var(--nexa-surface);
	color: var(--nexa-primary);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}
.nexa-carousel__arrow:hover { background: var(--nexa-primary); color: var(--nexa-on-primary); border-color: var(--nexa-primary); }

.nexa-carousel__dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.nexa-carousel__dot {
	width: 10px;
	height: 10px;
	padding: 0;
	border: 1px solid #8a93a8;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
}
.nexa-carousel__dot.is-active { background: var(--nexa-accent); border-color: var(--nexa-accent); }

/* ========== 大頭條主圖＋編輯精選 ========== */
.nexa-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--nexa-gap); margin-bottom: 40px; }
.nexa-hero.has-side.side-right { grid-template-columns: minmax(0, 1fr) 360px; }
.nexa-hero.has-side.side-left { grid-template-columns: 360px minmax(0, 1fr); }
.nexa-hero.has-side.side-left .nexa-hero__side { order: -1; }
.nexa-hero__side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.nexa-carousel--hero { position: relative; border-radius: var(--nexa-radius); overflow: hidden; background: var(--nexa-soft, #cdd5e4); min-width: 0; }
.nexa-carousel--hero .nexa-carousel__track { height: 100%; }
.nexa-slide { position: relative; display: block; aspect-ratio: 43 / 18; min-height: 300px; color: #fff; overflow: hidden; }
.nexa-slide:hover { text-decoration: none; }
.nexa-slide__media, .nexa-slide__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.nexa-slide__body {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 90px 64px 44px;
	background: linear-gradient(to top, rgba(10, 16, 32, .92), rgba(10, 16, 32, 0));
}
.nexa-hl__cat {
	align-self: flex-start;
	padding: 1px 10px;
	background: var(--nexa-accent);
	color: var(--nexa-on-accent);
	font-size: 13px;
	font-weight: 700;
	border-radius: 3px;
}
.nexa-slide__title {
	font-size: 34px;
	font-weight: 800;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.nexa-slide__excerpt {
	font-size: 16px;
	line-height: 1.6;
	color: rgba(255, 255, 255, .9);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.nexa-hero.has-side .nexa-carousel--hero { min-height: 360px; }
.nexa-hero.has-side .nexa-slide { height: 100%; aspect-ratio: auto; }
.nexa-carousel--hero .nexa-carousel__arrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, .9); z-index: 2; }
.nexa-carousel--hero .nexa-carousel__arrow--prev { left: 12px; }
.nexa-carousel--hero .nexa-carousel__arrow--next { right: 12px; }
.nexa-carousel--hero .nexa-carousel__dots { position: absolute; left: 0; right: 0; bottom: 14px; margin: 0; z-index: 2; }
.nexa-carousel--hero .nexa-carousel__dot { border-color: #fff; background: rgba(255, 255, 255, .35); }
.nexa-carousel--hero .nexa-carousel__dot.is-active { background: #fff; border-color: #fff; }

/* 編輯精選 */
.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;
	padding-bottom: 8px;
	font-size: 18px;
	color: var(--nexa-primary);
	border-bottom: 3px solid var(--nexa-accent);
}
.nexa-picks { flex: 1 1 auto; }
.nexa-picks__list { margin: 0; padding: 0; list-style: none; }
.nexa-picks__list li + li { border-top: 1px solid var(--nexa-border); }
.nexa-pick { display: flex; gap: 12px; align-items: center; padding: 10px 0; color: var(--nexa-text); }
.nexa-pick:hover { text-decoration: none; }
.nexa-pick:hover .nexa-pick__title { color: var(--nexa-accent); }
.nexa-pick__media { flex: 0 0 96px; aspect-ratio: 3 / 2; background: var(--nexa-soft, #dfe4ee); border-radius: 4px; overflow: hidden; }
.nexa-pick__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nexa-pick__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nexa-pick__cat { font-size: 12px; font-weight: 700; color: var(--nexa-accent); }
.nexa-pick__title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.45;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ========== 分類區（區標題列＋一排三張圖文卡，可輪播；有目錄或 CTA 時旁邊多一欄） ========== */
.nexa-area { margin-bottom: 40px; }
.nexa-carousel__head {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 14px;
	margin-bottom: 20px;
	padding: 12px 18px;
	background: var(--nexa-soft, #eceef2);
	border: 1px solid var(--nexa-border);
	border-radius: var(--nexa-radius);
}
.nexa-carousel__head .nexa-section-title { grid-column: 2; text-align: center; }
.nexa-carousel__head .nexa-carousel__arrows { grid-column: 3; justify-self: end; }
.nexa-carousel__more { grid-column: 1; grid-row: 1; justify-self: start; font-size: 14px; font-weight: 700; }
.nexa-area .nexa-carousel__track { gap: var(--nexa-gap); }
.nexa-area .nexa-carousel__track > .nexa-card { flex: 0 0 calc((100% - (var(--nexa-cols, 3) - 1) * var(--nexa-gap)) / var(--nexa-cols, 3)); }
@media (max-width: 1023px) {
	.nexa-area .nexa-carousel__track > .nexa-card { flex-basis: calc((100% - (var(--nexa-cols-t, 2) - 1) * var(--nexa-gap)) / var(--nexa-cols-t, 2)); }
}
@media (max-width: 639px) {
	.nexa-area .nexa-carousel__track > .nexa-card { flex-basis: calc((100% - (var(--nexa-cols-m, 1) - 1) * var(--nexa-gap)) / var(--nexa-cols-m, 1)); }
}

/* 大頭條下方兩張並排大圖卡片 */
.nexa-duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--nexa-gap); margin-bottom: 40px; }
.nexa-duo__item { position: relative; display: block; aspect-ratio: 21 / 13; border-radius: var(--nexa-radius); overflow: hidden; background: var(--nexa-soft, #cdd5e4); color: #fff; }
.nexa-duo__item:hover { text-decoration: none; }
.nexa-duo__media, .nexa-duo__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.nexa-duo__body { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 70px 24px 22px; background: linear-gradient(to top, rgba(10, 16, 32, .9), rgba(10, 16, 32, 0)); }
.nexa-duo__title { font-size: 24px; font-weight: 800; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nexa-card__excerpt { font-size: 14px; line-height: 1.6; color: var(--nexa-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nexa-area .nexa-card__media { aspect-ratio: 5 / 2; }
.nexa-area .nexa-card__excerpt { -webkit-line-clamp: 1; }
.nexa-area .nexa-card { height: 100%; }
.nexa-area__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--nexa-gap); align-items: stretch; }
.nexa-area.has-side.side-right .nexa-area__body { grid-template-columns: minmax(0, 1fr) 320px; }
.nexa-area.has-side.side-left .nexa-area__body { grid-template-columns: 320px minmax(0, 1fr); }
.nexa-area.has-side.side-left .nexa-area__side { order: -1; }
.nexa-area__main { min-width: 0; }
.nexa-area__side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.nexa-area .nexa-carousel__dots { margin-top: 14px; }

/* 本區目錄 */
.nexa-index__list { margin: 0; padding: 0; list-style: none; counter-reset: nexa-index; }
.nexa-index__list li { counter-increment: nexa-index; display: flex; gap: 10px; padding: 8px 8px 8px 10px; border-left: 4px solid transparent; }
.nexa-index__list li + li { border-top: 1px solid var(--nexa-border); }
.nexa-index__list li::before { content: counter(nexa-index, decimal-leading-zero); flex: 0 0 26px; font-size: 13px; font-weight: 800; line-height: 24px; color: var(--nexa-muted); }
.nexa-index__list li.is-current { border-left-color: var(--nexa-accent); background: var(--nexa-bg); }
.nexa-index__list li.is-current::before { color: var(--nexa-accent); }
.nexa-index__list a {
	font-size: 15px;
	line-height: 1.5;
	color: var(--nexa-text);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.nexa-index__list li.is-current a { font-weight: 700; color: var(--nexa-primary); }

/* ========== 文章卡片（清單頁、相關文章） ========== */
.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);
	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: var(--nexa-soft, #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-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-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }

/* ========== 文章頁 ========== */
.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: var(--nexa-muted); }

.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: 3px;
}
.nexa-article__cat:hover { text-decoration: none; filter: brightness(.95); }
.nexa-article__title { margin: 10px 0 8px; font-size: 34px; 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; }

/* 內文：相容 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: 4px solid var(--nexa-primary); }
.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: 18px; }

/* 側欄內的小區塊 */
.nexa-games, .nexa-rank { margin: 0; padding: 0; list-style: none; }
.nexa-games li + li { border-top: 1px solid var(--nexa-border); }
.nexa-games a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; color: var(--nexa-text); }
.nexa-games__title { font-size: 14px; line-height: 1.4; }
.nexa-games__score { flex: 0 0 auto; 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); }
.nexa-lotto { margin: 0; padding: 0; list-style: none; }
.nexa-lotto li { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 8px 0; }
.nexa-lotto li + li { border-top: 1px solid var(--nexa-border); }
.nexa-lotto__label { font-weight: 700; font-size: 14px; }
.nexa-lotto__period { font-size: 12px; color: var(--nexa-muted); text-align: right; }
.nexa-lotto__nums { grid-column: 1 / -1; font-size: 18px; color: var(--nexa-primary); letter-spacing: .04em; }
.nexa-chip__special { color: #b3261e; margin-left: 6px; }

/* ========== 清單頁左右側欄版面（清單頁、文章頁） ========== */
.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); grid-template-areas: "main side"; }
	.nexa-layout.has-side.side-left { grid-template-columns: var(--nexa-side-w, 300px) minmax(0, 1fr); grid-template-areas: "side main"; }
	.nexa-layout.has-side > .nexa-layout__main { grid-area: main; }
	.nexa-layout.has-side > .nexa-aside { grid-area: side; margin-top: 0; }
}

/* ========== 清單頁、搜尋、404 ========== */
.nexa-archive__header { margin-bottom: 20px; padding-top: 12px; border-top: 4px solid var(--nexa-primary); }
.nexa-archive__title { margin: 0; font-size: 30px; 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; }

/* ========== 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;
	margin: 0 0 26px;
	background: var(--cta-bg);
	color: var(--cta-text);
	border: 1px solid var(--nexa-border);
	border-top: 4px solid var(--cta-btn);
	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--article { margin: 1.6em 0; }
/* 旁邊欄位的 CTA：直向排列 */
.nexa-cta--col { margin: 0; flex-direction: column; align-items: stretch; flex-wrap: nowrap; text-align: center; }
.nexa-cta--col .nexa-cta__media { max-width: none; }
.nexa-cta--col .nexa-cta__text { flex: 0 0 auto; }
.nexa-cta--footer { --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: var(--nexa-sticky-top); }
	body.admin-bar .nexa-cta.is-sticky { top: calc(var(--nexa-sticky-top) + 32px); }
}

/* ========== 頁尾 ========== */
.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(auto-fit, minmax(220px, 1fr)); gap: 28px; margin-bottom: 24px; }
.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; }

.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 (max-width: 1023px) {
	.nexa-hero.has-side.side-right,
	.nexa-hero.has-side.side-left,
	.nexa-area.has-side.side-right .nexa-area__body,
	.nexa-area.has-side.side-left .nexa-area__body { grid-template-columns: minmax(0, 1fr); }
	.nexa-hero.has-side.side-left .nexa-hero__side,
	.nexa-area.has-side.side-left .nexa-area__side { order: 0; }
	.nexa-hero.has-side .nexa-slide { height: auto; aspect-ratio: 16 / 9; }
	.nexa-hero.has-side .nexa-carousel--hero { min-height: 0; }
	.nexa-slide__title { font-size: 28px; }
}
@media (max-width: 767px) {
	.nexa-container { padding: 0 14px; }
	.nexa-main { padding: 20px 0 36px; }
	.nexa-article { padding: 20px 16px; }
	.nexa-article__title { font-size: 26px; }
	.nexa-footer-trio { grid-template-columns: 1fr; gap: 22px; }
	.nexa-slide { aspect-ratio: 4 / 3; min-height: 0; }
	.nexa-hero.has-side .nexa-slide { aspect-ratio: 4 / 3; }
	.nexa-slide__body { padding: 60px 52px 38px; }
	.nexa-slide__title { font-size: 22px; }
	.nexa-slide__excerpt { display: none; }
	.nexa-section-title { font-size: 20px; }
	.nexa-duo { grid-template-columns: minmax(0, 1fr); }
	.nexa-duo__title { font-size: 20px; }
	.nexa-carousel__head { padding: 10px 12px; gap: 8px; }
	.nexa-area { margin-bottom: 34px; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ========== 1.0.2：收合選單、固定 CTA、文章目錄、作者日期、上下篇、頁面範本 ========== */
.nexa-drawer-toggle {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: transparent;
	color: var(--nexa-on-primary);
	border: 1px solid rgba(255, 255, 255, .4);
	border-radius: 6px;
	cursor: pointer;
}
.nexa-drawer-toggle:hover { background: rgba(255, 255, 255, .14); }
.nexa-drawer-toggle__bars,
.nexa-drawer-toggle__bars::before,
.nexa-drawer-toggle__bars::after { display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px; content: ""; position: relative; }
.nexa-drawer-toggle__bars::before { position: absolute; top: -6px; left: 0; }
.nexa-drawer-toggle__bars::after { position: absolute; top: 6px; left: 0; }

.nexa-drawer { position: fixed; inset: 0; z-index: 100000; visibility: hidden; pointer-events: none; transition: visibility 0s linear .25s; }
.nexa-drawer.is-open { visibility: visible; pointer-events: auto; transition-delay: 0s; }
.nexa-drawer__overlay { position: absolute; inset: 0; background: rgba(10, 16, 32, .55); opacity: 0; transition: opacity .25s ease; }
.nexa-drawer.is-open .nexa-drawer__overlay { opacity: 1; }
.nexa-drawer__panel {
	position: absolute;
	top: 0; bottom: 0; left: 0;
	width: min(320px, 86vw);
	padding: 16px 18px 24px;
	overflow-y: auto;
	background: var(--nexa-surface);
	color: var(--nexa-text);
	box-shadow: 4px 0 18px rgba(0, 0, 0, .25);
	transform: translateX(-100%);
	transition: transform .25s ease;
}
.nexa-drawer.is-open .nexa-drawer__panel { transform: translateX(0); }
.nexa-drawer__close { display: block; width: 100%; min-height: 44px; margin-bottom: 12px; padding: 8px 14px; background: var(--nexa-primary); color: var(--nexa-on-primary); border: 0; border-radius: 6px; font: inherit; font-weight: 700; cursor: pointer; }
.nexa-drawer__list, .nexa-drawer__list ul, .nexa-drawer__nav ul { margin: 0; padding: 0; list-style: none; }
.nexa-drawer__list a, .nexa-drawer__nav li a { display: block; min-height: 44px; padding: 10px 6px; color: var(--nexa-text); font-weight: 700; border-bottom: 1px solid var(--nexa-border); }
.nexa-drawer__list ul a { padding-left: 22px; font-weight: 400; }
.nexa-drawer__search { margin-top: 16px; }
.nexa-drawer__search .nexa-search { display: flex; }
.nexa-drawer__search .nexa-search__input { flex: 1 1 auto; width: auto; min-width: 0; }
html.nexa-drawer-open { overflow: hidden; }

/* 固定 CTA：底部橫條或浮動按鈕（桌機、手機都固定；頁面底部留空間，不蓋住頁尾連結） */
.nexa-fixedcta {
	--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;
}
.nexa-fixedcta--bar { left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 10px 16px; background: var(--cta-bg); color: var(--cta-text); box-shadow: 0 -2px 10px rgba(0, 0, 0, .2); }
.nexa-fixedcta--float { right: 16px; bottom: 16px; }
.nexa-fixedcta__text { display: flex; flex-direction: column; min-width: 0; }
.nexa-fixedcta__title { font-size: 16px; line-height: 1.4; }
.nexa-fixedcta__desc { font-size: 13px; opacity: .9; }
.nexa-fixedcta__btn { display: inline-block; min-height: 44px; padding: 10px 22px; background: var(--cta-btn); color: var(--cta-btn-text) !important; border-radius: 999px; font-weight: 800; line-height: 1.4; text-align: center; }
.nexa-fixedcta--bar .nexa-fixedcta__btn { flex: 0 0 auto; }
.nexa-fixedcta--float .nexa-fixedcta__btn { box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
.nexa-fixedcta__btn:hover { text-decoration: none; filter: brightness(.95); }
body.has-fixed-cta--bar { padding-bottom: 84px; }
body.has-fixed-cta--float { padding-bottom: 80px; }
@media (max-width: 767px) {
	.nexa-fixedcta--bar { justify-content: space-between; gap: 10px; padding: 8px 12px; }
	.nexa-fixedcta__title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.nexa-fixedcta__desc { display: none; }
	.nexa-fixedcta--float { right: 12px; bottom: 12px; }
}

/* 作者與日期、目錄、上一篇／下一篇 */
.nexa-article__meta { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.nexa-article__meta-label { margin-right: 2px; }
.nexa-toc { margin: 0 0 1.6em; padding: 14px 18px; background: var(--nexa-soft, #eceef2); border: 1px solid var(--nexa-border); border-radius: var(--nexa-radius); font-size: 15px; line-height: 1.6; }
.nexa-toc__title { margin-bottom: 6px; font-size: 17px; font-weight: 800; color: var(--nexa-primary); }
.nexa-toc__list { margin: 0; padding-left: 1.4em; }
.nexa-toc__item--h3 { margin-left: 1.2em; list-style: circle; }
.nexa-toc__list a { color: var(--nexa-text); }
.nexa-postnav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
.nexa-postnav__item { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--nexa-surface); border: 1px solid var(--nexa-border); border-radius: var(--nexa-radius); color: var(--nexa-text); min-width: 0; }
.nexa-postnav__item:hover { text-decoration: none; border-color: var(--nexa-accent); }
.nexa-postnav__item--next { grid-column: 2; text-align: right; }
.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-size: 15px; font-weight: 700; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 639px) {
	.nexa-postnav { grid-template-columns: minmax(0, 1fr); }
	.nexa-postnav__item--next { grid-column: 1; }
}

/* 頁面範本、首頁區塊標題、側欄標籤雲、404 */
.nexa-container--full { max-width: none; }
.nexa-page--fullwidth .nexa-article--page { max-width: none; }
.nexa-page--landing .nexa-article--page { max-width: 760px; }
.nexa-header--landing .nexa-header__inner { justify-content: center; }
.nexa-home-title { margin: 0 0 14px; }
.nexa-aside .nexa-tagcloud a { padding: 2px 12px; border: 1px solid var(--nexa-border); border-radius: 999px; font-size: 14px; color: var(--nexa-text); }
.nexa-aside .nexa-tagcloud a:hover { border-color: var(--nexa-accent); text-decoration: none; }
.nexa-404__latest { margin-top: 32px; }
.nexa-404__latest .nexa-section-title { margin-bottom: 14px; }
