/*
Theme Name: 宁德画廊 (Ningde Gallery)
Theme URI: https://example.com/ningde-gallery
Author: Ningde
Author URI: https://example.com
Description: 白色主调、蓝色按钮与导航的风景画廊主题。列表缩略图优先调用特色图片，未设置时自动使用文章媒体图片；文章页支持大图轮换浏览、缩略图列表切换与全屏灯箱，内置评论功能。支持自定义 LOGO，未设置时自动显示站点名称徽标。
Version: 1.0.0
Requires at least: 5.9
Tested up to: 6.6
Requires PHP: 7.2
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ningde-gallery
Tags: gallery, photography, landscape, blue, white, one-column, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* =========================================================
   基础
   ========================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

:root {
	--blue: #2563eb;
	--blue-dark: #1e40af;
	--blue-light: #3b82f6;
	--blue-50: #eff6ff;
	--ink: #1e293b;
	--muted: #64748b;
	--border: #e2e8f0;
	--bg: #f5f7fb;
	--card: #ffffff;
	--navy: #0f2a63;
	--radius: 12px;
	--shadow: 0 2px 10px rgba(15, 42, 90, .08);
	--shadow-lg: 0 14px 32px rgba(15, 42, 90, .16);
}

html { scroll-behavior: smooth; }

body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
		"Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
	color: var(--ink);
	background: var(--bg);
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; transition: color .2s ease, background .2s ease; }
a:hover { color: var(--blue-dark); }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; }
p { margin: 0 0 1em; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; width: 1px; margin: -1px; overflow: hidden;
	padding: 0; position: absolute; word-wrap: normal !important;
}
.screen-reader-text:focus {
	background: var(--blue); color: #fff; clip: auto !important; clip-path: none;
	display: block; height: auto; left: 8px; top: 8px; width: auto;
	padding: 10px 18px; z-index: 100000; border-radius: 6px;
}

/* 蓝色按钮 */
.btn,
button,
input[type="submit"] {
	display: inline-block;
	background: var(--blue);
	color: #fff;
	border: 0;
	border-radius: 8px;
	padding: 10px 22px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
}
.btn:hover, button:hover, input[type="submit"]:hover { background: var(--blue-dark); color: #fff; }
.btn:active, button:active, input[type="submit"]:active { transform: translateY(1px); }

/* =========================================================
   页头
   ========================================================= */
.site-header {
	position: sticky; top: 0; z-index: 60;
	background: var(--card);
	border-bottom: 1px solid var(--border);
	box-shadow: 0 1px 6px rgba(15, 42, 90, .05);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 72px; }

.site-branding { display: flex; align-items: center; gap: 12px; min-width: 0; }
.site-logo-text { display: flex; align-items: center; gap: 12px; }
.site-logo-mark { display: inline-flex; flex: none; }
.site-logo-mark svg { width: 42px; height: 42px; border-radius: 12px; box-shadow: var(--shadow); }
.site-title { font-size: 22px; font-weight: 800; color: var(--ink); letter-spacing: .5px; white-space: nowrap; }
.site-logo-text:hover .site-title { color: var(--blue); }
.site-description { margin: 0; font-size: 13px; color: var(--muted); }
.custom-logo { max-height: 52px; width: auto; }

.main-nav { display: flex; align-items: center; }
.main-nav ul { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; }
.main-nav a {
	display: block; padding: 9px 16px; border-radius: 8px;
	color: var(--ink); font-weight: 600; font-size: 15px;
}
.main-nav a:hover, .main-nav .current-menu-item > a,
.main-nav .current_page_item > a, .main-nav .current-menu-ancestor > a {
	color: var(--blue); background: var(--blue-50);
}
.nav-toggle {
	display: none; background: var(--blue-50); color: var(--blue);
	padding: 8px 14px; font-size: 15px;
}
.nav-toggle:hover { background: var(--blue); color: #fff; }

/* =========================================================
   首页 Hero
   ========================================================= */
.hero {
	background: linear-gradient(180deg, var(--blue-50) 0%, var(--bg) 100%);
	text-align: center; padding: 64px 20px 56px;
}
.hero h1 { font-size: clamp(28px, 5vw, 44px); font-weight: 800; margin-bottom: 12px; color: var(--ink); }
.hero h1 span { color: var(--blue); }
.hero p { color: var(--muted); max-width: 620px; margin: 0 auto 26px; font-size: 17px; }
.hero .search-form { display: flex; justify-content: center; gap: 8px; max-width: 460px; margin: 0 auto; }
.hero .search-form input[type="search"] {
	flex: 1; min-width: 0; border: 2px solid var(--border); border-radius: 8px;
	padding: 11px 16px; font-size: 15px; background: #fff; color: var(--ink);
	transition: border-color .2s;
}
.hero .search-form input[type="search"]:focus { outline: none; border-color: var(--blue); }
.hero .search-form button { background: var(--blue); border: 0; border-radius: 8px; color: #fff; padding: 11px 22px; cursor: pointer; font-weight: 600; }
.hero .search-form button:hover { background: var(--blue-dark); }

/* =========================================================
   页面标题
   ========================================================= */
.page-head { padding: 36px 20px 8px; text-align: center; }
.page-title { font-size: clamp(22px, 4vw, 30px); font-weight: 800; color: var(--ink); margin: 0; }
.archive-desc { color: var(--muted); margin-top: 8px; }

/* =========================================================
   画廊网格
   ========================================================= */
.gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 24px;
	padding: 28px 20px 12px;
}
.gallery-card {
	background: var(--card); border-radius: var(--radius); overflow: hidden;
	box-shadow: var(--shadow); border: 1px solid var(--border);
	display: flex; flex-direction: column;
	transition: transform .25s ease, box-shadow .25s ease;
}
.gallery-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.card-media { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 3; background: #e8edf5; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.gallery-card:hover .card-media img { transform: scale(1.06); }
.card-noimage {
	position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
	color: #94a3b8; font-size: 14px; letter-spacing: 2px; background: #e8edf5;
}
.card-count {
	position: absolute; right: 10px; bottom: 10px;
	background: rgba(15, 42, 99, .72); color: #fff;
	font-size: 12px; padding: 3px 10px; border-radius: 999px; backdrop-filter: blur(2px);
}
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 17px; font-weight: 700; margin: 0; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--blue); }
.card-meta { display: flex; align-items: center; gap: 14px; margin-top: auto; color: var(--muted); font-size: 13px; }
.card-meta a { color: var(--muted); }
.card-meta a:hover { color: var(--blue); }
.card-meta .meta-comments { margin-left: auto; }

/* 分页 */
.pagination-wrap { padding: 30px 20px 50px; display: flex; justify-content: center; }
.pagination .nav-links,
.pagination-wrap .nav-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pagination .page-numbers,
.pagination-wrap .page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 40px; height: 40px; padding: 0 12px;
	background: #fff; border: 1px solid var(--border); border-radius: 8px;
	color: var(--ink); font-weight: 600; font-size: 14px;
}
.pagination .page-numbers:hover,
.pagination-wrap .page-numbers:hover { border-color: var(--blue); color: var(--blue); }
.pagination .page-numbers.current,
.pagination-wrap .page-numbers.current { background: var(--blue); border-color: var(--blue); color: #fff; }

/* =========================================================
   文章页
   ========================================================= */
.single-article { padding: 36px 0 10px; }
.single-head { text-align: center; max-width: 860px; }
.single-title { font-size: clamp(24px, 4vw, 34px); font-weight: 800; color: var(--ink); }
.single-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; color: var(--muted); font-size: 14px; margin-top: 10px; }
.single-meta a { color: var(--muted); }
.single-meta a:hover { color: var(--blue); }

/* 图片轮换舞台 */
.gallery-stage-wrap { padding: 28px 20px 0; }
.gallery-stage { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.stage-main { position: relative; background: #eef2f8; }
.stage-main img {
	width: 100%; height: min(68vh, 640px); object-fit: contain; cursor: zoom-in;
	background: #eef2f8; user-select: none;
}
.stage-arrow {
	position: absolute; top: 50%; transform: translateY(-50%);
	width: 46px; height: 46px; border-radius: 50%;
	background: rgba(37, 99, 235, .92); color: #fff;
	border: 0; font-size: 26px; line-height: 1; cursor: pointer;
	display: flex; align-items: center; justify-content: center; padding: 0;
	box-shadow: 0 4px 12px rgba(15, 42, 90, .3); z-index: 5;
	transition: background .2s, transform .15s;
}
.stage-arrow:hover { background: var(--blue-dark); }
.stage-arrow.prev { left: 14px; }
.stage-arrow.next { right: 14px; }
.stage-counter {
	position: absolute; right: 14px; bottom: 12px; z-index: 5;
	background: rgba(15, 42, 99, .72); color: #fff; font-size: 13px;
	padding: 3px 12px; border-radius: 999px; backdrop-filter: blur(2px);
}
.stage-caption { text-align: center; padding: 12px 18px; color: var(--ink); font-size: 15px; background: #fff; }

/* 缩略图条 */
.stage-thumbs {
	display: flex; gap: 10px; overflow-x: auto; padding: 14px 16px;
	background: #fff; border-top: 1px solid var(--border);
	scrollbar-width: thin; scrollbar-color: var(--blue-light) transparent;
}
.stage-thumbs::-webkit-scrollbar { height: 6px; }
.stage-thumbs::-webkit-scrollbar-thumb { background: var(--blue-light); border-radius: 3px; }
.thumb {
	flex: none; width: 96px; height: 72px; padding: 0; overflow: hidden;
	background: #e8edf5; border: 3px solid transparent; border-radius: 8px;
	opacity: .75; transition: opacity .2s, border-color .2s, transform .2s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { opacity: 1; transform: translateY(-2px); }
.thumb.active { border-color: var(--blue); opacity: 1; }

/* 文章正文 */
.single-content { max-width: 860px; }
.entry-content { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 32px; margin-top: 28px; font-size: 16px; }
.entry-content img { border-radius: 8px; margin: 14px 0; }
.entry-content a { text-decoration: underline; text-underline-offset: 3px; }
.entry-content .wp-caption { max-width: 100%; }
.entry-content .wp-caption-text { color: var(--muted); font-size: 13px; text-align: center; }
.single-tags { margin-top: 18px; color: var(--muted); font-size: 14px; }
.tag-label { font-weight: 600; color: var(--ink); }
.single-tags a { display: inline-block; background: var(--blue-50); color: var(--blue); border-radius: 999px; padding: 3px 12px; margin: 0 4px 6px 0; font-size: 13px; }
.single-tags a:hover { background: var(--blue); color: #fff; }

/* 上下篇 */
.single-nav {
	display: flex; justify-content: space-between; gap: 20px;
	max-width: 860px; padding: 22px 20px 0; margin: 0 auto; font-weight: 600;
}
.single-nav a { color: var(--ink); }
.single-nav a:hover { color: var(--blue); }
.single-nav .next-post { text-align: right; }

/* =========================================================
   评论
   ========================================================= */
.comments-area { max-width: 860px; padding: 30px 20px 60px; margin: 0 auto; }
.comments-title { font-size: 22px; font-weight: 800; color: var(--ink); }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .comment { margin: 0 0 18px; }
.comment-body {
	background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: var(--shadow); padding: 20px 22px;
}
.comment-author { display: flex; align-items: center; gap: 12px; }
.comment-author .avatar { border-radius: 50%; width: 44px; height: 44px; }
.comment-author .fn { font-weight: 700; font-style: normal; font-size: 15px; color: var(--ink); }
.comment-author .says { color: var(--muted); font-size: 13px; }
.comment-metadata { margin: 4px 0 12px 56px; font-size: 13px; color: var(--muted); }
.comment-metadata a { color: var(--muted); }
.comment-content { font-size: 15px; }
.comment-content p { margin-bottom: .8em; }
.reply { margin-top: 8px; text-align: right; }
.reply a { color: var(--blue); font-size: 13px; font-weight: 600; }
.comment-list .children { list-style: none; margin: 16px 0 0 40px; padding: 0; }
.comment-respond {
	background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: var(--shadow); padding: 26px 28px; margin-top: 26px;
}
.comment-reply-title { font-size: 20px; font-weight: 800; color: var(--ink); }
.comment-reply-title small { font-size: 13px; font-weight: 400; margin-left: 10px; }
.comment-form label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin: 12px 0 6px; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%; border: 2px solid var(--border); border-radius: 8px;
	padding: 11px 14px; font-size: 15px; font-family: inherit; color: var(--ink);
	background: #fff; transition: border-color .2s;
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--blue); }
.comment-form textarea { min-height: 130px; resize: vertical; }
.comment-form .submit { margin-top: 14px; }
.comment-notes, .logged-in-as { color: var(--muted); font-size: 13px; }
.comment-notes a, .logged-in-as a { color: var(--blue); }
.form-submit { margin: 0; }
.no-comments { color: var(--muted); }

/* =========================================================
   页脚
   ========================================================= */
.site-footer { background: var(--navy); color: #dbe4f5; margin-top: 40px; }
.footer-top { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; padding: 44px 20px 30px; }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 30px; }
.footer-widgets .widget { margin: 0; }
.footer-widgets .widget-title { color: #fff; font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.footer-widgets a { color: #bcd0f5; }
.footer-widgets a:hover { color: #fff; }
.footer-menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.footer-menu a { color: #bcd0f5; font-size: 14px; }
.footer-menu a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .12); padding: 18px 0; }
.footer-bottom .container { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: #9fb3da; }
.footer-bottom a { color: #c9d8f5; }
.footer-bottom a:hover { color: #fff; }
.footer-bottom p { margin: 0; }

/* =========================================================
   灯箱
   ========================================================= */
.lightbox {
	position: fixed; inset: 0; z-index: 200; display: none;
	background: rgba(8, 15, 35, .94); align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
body.lightbox-open { overflow: hidden; }
.lightbox-img { max-width: 92vw; max-height: 86vh; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lightbox .stage-arrow { position: fixed; top: 50%; background: rgba(37, 99, 235, .85); }
.lightbox .lb-prev { left: 22px; }
.lightbox .lb-next { right: 22px; }
.lightbox-close {
	position: fixed; top: 18px; right: 22px; z-index: 5;
	background: rgba(255, 255, 255, .12); color: #fff;
	width: 44px; height: 44px; border-radius: 50%; font-size: 24px; padding: 0;
	display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .25); color: #fff; }
.lightbox-counter { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); color: #fff; background: rgba(255, 255, 255, .14); padding: 5px 16px; border-radius: 999px; font-size: 14px; }

/* =========================================================
   页面模板
   ========================================================= */
.page-content { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px 36px; max-width: 860px; margin: 30px auto 0; }

.no-results { text-align: center; padding: 60px 20px; color: var(--muted); }

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 900px) {
	.nav-toggle { display: inline-flex; align-items: center; gap: 6px; }
	.main-nav { position: relative; }
	.main-nav ul {
		display: none; position: absolute; right: 0; top: calc(100% + 10px);
		background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
		box-shadow: var(--shadow-lg); padding: 10px; flex-direction: column;
		align-items: stretch; min-width: 200px; z-index: 70;
	}
	.main-nav.open ul { display: flex; }
	.footer-top { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
	.gallery-grid { grid-template-columns: 1fr; gap: 18px; }
	.stage-main img { height: 52vh; }
	.entry-content { padding: 22px 18px; }
	.footer-bottom .container { flex-direction: column; text-align: center; }
}
