/*
Theme Name: Nexa Portal
Author:
Description: Nexa 系列的入口網站風綜合型主題。今日焦點條、大頭條輪播、可自訂的多個分類輪播區、首頁／清單頁／文章頁可分開設定的左右側欄，以及五個位置的 CTA（可設定跟隨頁面捲動）；選用外掛時自動串接比分與開獎，不依賴任何外掛。
Version: 1.0.3
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-portal
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__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__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-ticker { margin-bottom: 22px; }
.nexa-ticker__title { margin: 0 0 8px; font-size: 15px; color: var(--nexa-muted); font-weight: 700; }
.nexa-ticker__track {
	display: flex;
	gap: 14px;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	padding-bottom: 6px;
	-webkit-overflow-scrolling: touch;
}
.nexa-chip {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	min-width: 220px;
	max-width: 260px;
	padding: 10px 14px;
	background: var(--nexa-surface);
	border: 1px solid var(--nexa-border);
	border-radius: 6px;
	color: var(--nexa-text);
	scroll-snap-align: start;
}
a.nexa-chip:hover { text-decoration: none; border-color: var(--nexa-primary); }
.nexa-chip__label { font-size: 12px; font-weight: 700; color: var(--nexa-muted); }
.nexa-chip__title {
	font-size: 14px;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.nexa-chip__value { font-size: 20px; color: var(--nexa-primary); line-height: 1.3; }
.nexa-chip__special { color: #b3261e; margin-left: 6px; }

/* ========== 分類輪播 ========== */
.nexa-carousel { margin-bottom: 30px; }
.nexa-carousel__head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 10px;
}
.nexa-carousel__arrows { display: flex; gap: 6px; }
.nexa-carousel__arrow {
	width: 30px;
	height: 30px;
	padding: 0;
	border: 1px solid var(--nexa-border);
	border-radius: 50%;
	background: var(--nexa-surface);
	color: var(--nexa-primary);
	font-size: 20px;
	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__more { margin-left: auto; font-size: 14px; font-weight: 700; }

.nexa-carousel__track {
	display: flex;
	gap: var(--nexa-gap);
	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 > .nexa-card {
	flex: 0 0 calc((100% - (var(--nexa-cols, 4) - 1) * var(--nexa-gap)) / var(--nexa-cols, 4));
	scroll-snap-align: start;
}
@media (max-width: 1023px) {
	.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-carousel__track > .nexa-card { flex-basis: calc((100% - (var(--nexa-cols-m, 1) - 1) * var(--nexa-gap)) / var(--nexa-cols-m, 1)); }
}

.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: #6b7488; border-color: #6b7488; }

/* ========== 文章卡片 ========== */
.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-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--nexa-gap); }

/* ========== 文章頁 ========== */
.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-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); }

/* ========== 清單頁、搜尋、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-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 { 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-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--nexa-gap); margin-bottom: 30px; }
.nexa-hero.has-side { grid-template-columns: minmax(0, 1fr) 320px; }
.nexa-hero__side { display: flex; flex-direction: column; gap: var(--nexa-gap); min-width: 0; }
.nexa-carousel--hero { position: relative; margin: 0; border-radius: var(--nexa-radius); overflow: hidden; background: #cdd5e4; }
.nexa-carousel--hero .nexa-carousel__track { gap: 0; }
.nexa-carousel--hero .nexa-carousel__track > .nexa-slide { flex: 0 0 100%; scroll-snap-align: start; }
.nexa-slide { position: relative; display: block; aspect-ratio: 21 / 9; min-height: 260px; 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: 70px 28px 40px;
	background: linear-gradient(to top, rgba(10, 16, 32, .88), rgba(10, 16, 32, 0));
}
.nexa-hl__cat {
	align-self: flex-start;
	padding: 1px 8px;
	background: var(--nexa-accent);
	color: var(--nexa-on-accent);
	font-size: 12px;
	font-weight: 700;
	border-radius: 4px;
}
.nexa-slide__title {
	font-size: 28px;
	font-weight: 800;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.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: 10px; }
.nexa-carousel--hero .nexa-carousel__arrow--next { right: 10px; }
.nexa-carousel--hero .nexa-carousel__dots { position: absolute; left: 0; right: 0; bottom: 10px; 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; }
@media (max-width: 1023px) {
	.nexa-slide { aspect-ratio: 16 / 9; }
	.nexa-hero.has-side { grid-template-columns: minmax(0, 1fr); }
	.nexa-slide__title { font-size: 24px; }
}
@media (max-width: 639px) {
	.nexa-slide { aspect-ratio: 4 / 3; }
	.nexa-slide__body { padding: 50px 16px 36px; }
	.nexa-slide__title { font-size: 20px; }
}

/* 只有文字的卡片（分類區「圖片數」之外的文章） */
.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-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: start; }
	.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; position: sticky; top: 90px; }
	body.admin-bar .nexa-layout.has-side > .nexa-aside { top: 122px; }
}

/* 側欄：開獎清單 */
.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; }

/* ========== 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-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-header-cta { padding-top: 16px; }
.nexa-header-cta .nexa-cta { margin-bottom: 0; }
.nexa-cta--article { margin: 1.6em 0; }
.nexa-cta--sidebar { margin: 0; flex-direction: column; align-items: stretch; text-align: center; }
.nexa-cta--sidebar .nexa-cta__media { max-width: none; }
.nexa-cta--sidebar .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; }
/* 大頭條：左右並排時圖片填滿與右側等高 */
.nexa-carousel--hero .nexa-carousel__track { height: 100%; }
.nexa-hero.has-side .nexa-carousel--hero { min-height: 300px; }
.nexa-hero.has-side .nexa-slide { height: 100%; aspect-ratio: auto; }
.nexa-slide__body { padding-left: 64px; padding-right: 64px; }
@media (max-width: 1023px) { .nexa-hero.has-side .nexa-slide { height: auto; aspect-ratio: 16 / 9; } }
@media (max-width: 639px) { .nexa-slide__body { padding-left: 52px; padding-right: 52px; } }

/* ========== 1.0.1：CTA 跟隨頁面捲動（手機不固定，以免擋住內容） ========== */
:root { --nexa-header-h: 72px; --nexa-footer-cta-h: 0px; --nexa-sticky-gap: 12px; }
.nexa-run { display: block; }
@media (min-width: 768px) {
	/* 頁首下方：固定在頁首下面 */
	.nexa-header-cta.is-sticky { position: sticky; top: calc(var(--nexa-header-h) - 1px); z-index: 40; background: var(--nexa-bg); }
	body.admin-bar .nexa-header-cta.is-sticky { top: calc(var(--nexa-header-h) + 31px); }
	/* 各區之間：CTA 和下一區包在同一個區塊裡，CTA 在下一區經過時固定 */
	.nexa-run > .nexa-cta--sticky { position: sticky; top: calc(var(--nexa-header-h) + var(--nexa-sticky-gap)); z-index: 30; }
	body.admin-bar .nexa-run > .nexa-cta--sticky { top: calc(var(--nexa-header-h) + var(--nexa-sticky-gap) + 32px); }
	/* 文章內文中：固定到文章結尾 */
	.nexa-cta--article.nexa-cta--sticky { position: sticky; top: calc(var(--nexa-header-h) + var(--nexa-sticky-gap)); z-index: 30; }
	body.admin-bar .nexa-cta--article.nexa-cta--sticky { top: calc(var(--nexa-header-h) + var(--nexa-sticky-gap) + 32px); }
	/* 頁尾：固定在畫面底部 */
	.nexa-cta--footer.nexa-cta--sticky {
		--cta-bg: var(--nexa-primary);
		--cta-text: var(--nexa-on-primary);
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 60;
		margin: 0;
		padding-left: max(20px, calc((100vw - 1160px) / 2));
		padding-right: max(20px, calc((100vw - 1160px) / 2));
		border: 0;
		border-top: 1px solid rgba(255, 255, 255, .35);
		border-radius: 0;
		box-shadow: 0 -4px 14px rgba(20, 30, 55, .22);
	}
	body.nexa-sticky-footer-cta { padding-bottom: var(--nexa-footer-cta-h); }
}
@media (min-width: 1024px) {
	/* 側欄：CTA 維持原本位置，捲動時固定在頁首下方；側欄不再整塊固定（改成拉到和內容一樣高，CTA 才能一路跟著捲），後面的區塊從 CTA 底下滑過 */
	.nexa-layout.has-side > .nexa-aside.has-sticky-cta { position: static; align-self: stretch; }
	body.admin-bar .nexa-layout.has-side > .nexa-aside.has-sticky-cta { top: auto; }
	.nexa-aside.has-sticky-cta > .nexa-cta--sticky { position: sticky; top: calc(var(--nexa-header-h) + var(--nexa-sticky-gap)); z-index: 30; }
	body.admin-bar .nexa-aside.has-sticky-cta > .nexa-cta--sticky { top: calc(var(--nexa-header-h) + var(--nexa-sticky-gap) + 32px); }
}

/* ========== 1.0.3：入口版型首頁（照草圖：大頭條＋右欄；分類清單欄＋右欄；更多分類區整排） ========== */
.nexa-home--portal .nexa-layout.has-side { gap: 24px; }
.nexa-listcols { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.nexa-listcol {
	min-width: 0;
	background: var(--nexa-surface);
	border: 1px solid var(--nexa-border);
	border-radius: var(--nexa-radius);
	padding: 14px 16px 16px;
}
.nexa-listcol__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; padding-bottom: 8px; border-bottom: 2px solid var(--nexa-primary); }
.nexa-listcol .nexa-section-title { font-size: 19px; }
.nexa-list { margin: 0; padding: 0; list-style: none; }
.nexa-list li + li { border-top: 1px solid var(--nexa-border); }
.nexa-li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; color: var(--nexa-text); }
.nexa-li:hover { text-decoration: none; }
.nexa-li:hover .nexa-li__title { color: var(--nexa-accent); }
.nexa-li__media { flex: 0 0 84px; width: 84px; height: 56px; border-radius: 4px; overflow: hidden; background: #dfe4ee; display: block; }
.nexa-li__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nexa-li__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.nexa-li__title { font-size: 15px; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nexa-li__date { font-size: 12px; color: var(--nexa-muted); }
.nexa-li--text .nexa-li__body { border-left: 3px solid var(--nexa-accent); padding-left: 10px; }
.nexa-listcol .nexa-cta { margin: 14px 0 0; flex-direction: column; align-items: stretch; text-align: center; padding: 14px; }
.nexa-listcol .nexa-cta__text { flex: 0 0 auto; }
.nexa-listcol .nexa-cta__media { max-width: none; }
.nexa-moreareas { margin-top: 30px; }
@media (min-width: 768px) {
	.nexa-listcols--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.nexa-listcols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
	/* 大頭條右欄與分類清單的右欄同寬（都用「側欄：首頁」的寬度），左右對齊 */
	.nexa-home--portal .nexa-hero.has-side { grid-template-columns: minmax(0, 1fr) var(--nexa-side-w, 340px); gap: 24px; }
}
