/*
Theme Name: Nexa Sports
Author:
Description: Nexa 系列的賽事資訊主題。簡潔的入口型版面：今日焦點條、頭條、分類輪播、球隊入口與文章頁側欄；選用外掛時自動串接比分、開獎與球隊資料，不依賴任何外掛。
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-sports
Tags: news, blog, custom-menu, custom-logo, featured-images, threaded-comments, translation-ready, grid-layout, two-columns
*/

/* ========== 基礎 ========== */
:root {
	--nexa-primary: #1e2a47;
	--nexa-accent: #f0b429;
	--nexa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Roboto, Helvetica, Arial, sans-serif;
	--nexa-bg: #f3f5f8;
	--nexa-surface: #ffffff;
	--nexa-text: #1a2133;
	--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: #1a2133;
	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: #fff;
	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: #fff;
	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: #fff;
	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; }

/* ========== 頭條 1 大 4 小 ========== */
.nexa-headline {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr;
	grid-template-rows: repeat(2, minmax(190px, 1fr));
	gap: var(--nexa-gap);
	margin-bottom: 34px;
}
.nexa-hl {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--nexa-radius);
	background: #cdd5e4;
	color: #fff;
	min-height: 190px;
}
.nexa-hl:hover { text-decoration: none; }
.nexa-hl--big { grid-row: 1 / span 2; }
.nexa-hl__media, .nexa-hl__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.nexa-hl__media img { transition: transform .3s ease; }
.nexa-hl:hover .nexa-hl__media img { transform: scale(1.03); }
.nexa-hl__body {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 40px 16px 14px;
	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: #1a2133;
	font-size: 12px;
	font-weight: 700;
	border-radius: 4px;
}
.nexa-hl__title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.nexa-hl--big .nexa-hl__title { font-size: 28px; -webkit-line-clamp: 3; }
.nexa-hl--big .nexa-hl__body { padding: 60px 24px 22px; }

@media (max-width: 1023px) {
	.nexa-headline { grid-template-columns: 1fr 1fr; grid-template-rows: 340px repeat(2, 200px); }
	.nexa-hl--big { grid-column: 1 / span 2; grid-row: auto; }
	.nexa-hl--big .nexa-hl__title { font-size: 24px; }
}
@media (max-width: 639px) {
	.nexa-headline { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-rows: 190px; }
	.nexa-hl--big { grid-column: auto; grid-row: auto; min-height: 260px; }
	.nexa-headline > .nexa-hl--big { height: 260px; }
	.nexa-hl--big .nexa-hl__title { font-size: 22px; }
}

/* ========== 分類輪播 ========== */
.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: #fff; 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: 100%; }
}

.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: #8a5d00; }
.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-teams { margin-bottom: 30px; }
.nexa-teams .nexa-section-title { margin-bottom: 12px; }
.nexa-teams__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.nexa-team { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--nexa-text); text-align: center; }
.nexa-team:hover { text-decoration: none; }
.nexa-team:hover .nexa-team__badge { border-color: var(--nexa-primary); }
.nexa-team__badge {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	background: #dfe4ee;
	border: 2px solid transparent;
	border-radius: 50%;
	overflow: hidden;
}
.nexa-team__badge img { width: 100%; height: 100%; object-fit: contain; padding: 8px; display: block; }
.nexa-team__initial { font-size: 24px; font-weight: 800; color: var(--nexa-primary); }
.nexa-team__name { font-size: 13px; line-height: 1.3; font-weight: 700; }

/* ========== 文章頁 ========== */
.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-single__layout { display: block; }
.nexa-single__layout:not(.has-sidebar) .nexa-article { max-width: 860px; margin-left: auto; margin-right: auto; }
.nexa-aside { margin-top: 28px; display: flex; flex-direction: column; gap: 18px; }

@media (min-width: 1024px) {
	.nexa-single__layout.has-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
	.nexa-single__layout.has-sidebar .nexa-aside { margin-top: 0; position: sticky; top: 90px; }
	body.admin-bar .nexa-single__layout.has-sidebar .nexa-aside { top: 122px; }
}

.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: #1a2133;
	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: #fff; 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: #fff; }
.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: #e8ecf5; padding: 28px 0 18px; margin-top: 20px; }
.nexa-footer a { color: #e8ecf5; }

.nexa-footer-cta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding: 18px 22px;
	margin-bottom: 28px;
	background: rgba(255, 255, 255, .12);
	border-radius: var(--nexa-radius);
}
.nexa-footer-cta__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nexa-footer-cta__title { font-size: 20px; color: #fff; }
.nexa-footer-cta__desc { font-size: 15px; }
.nexa-footer-cta__btn {
	padding: 10px 24px;
	background: var(--nexa-accent);
	color: #1a2133 !important;
	border-radius: 6px;
	font-weight: 800;
}
.nexa-footer-cta__btn:hover { text-decoration: none; filter: brightness(.95); }

.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: #fff; }
.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: #e8ecf5; 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; }
}
