/* ===========================================================
   星空博客 · 新海诚动漫风格样式
   =========================================================== */

:root {
    --sky-top: #1a2a6c;
    --sky-mid: #6a4e9c;
    --sky-warm: #e8a87c;
    --sky-bottom: #f9d5b5;
    --accent: #7c9ee0;
    --accent-warm: #f0a868;
    --text-dark: #2c3145;
    --text-soft: #5a6079;
    --glass: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 12px 40px rgba(60, 70, 120, 0.18);
    --radius: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    color: var(--text-dark);
    line-height: 1.7;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    background: #dfe9f3;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* =================== 动态天空背景 =================== */
.sky-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
}

.sky-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        #2b3a67 0%,
        #4a5a9c 22%,
        #8a7bb8 45%,
        #d99f8e 70%,
        #f6d6b8 88%,
        #fbe8d3 100%);
    animation: skyShift 30s ease-in-out infinite alternate;
}

@keyframes skyShift {
    0%   { filter: hue-rotate(0deg) brightness(1); }
    50%  { filter: hue-rotate(-12deg) brightness(1.08); }
    100% { filter: hue-rotate(6deg) brightness(0.98); }
}

/* 太阳/月亮光晕 */
.sun-glow {
    position: absolute;
    top: 12%;
    right: 14%;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255, 246, 214, 0.95) 0%,
        rgba(255, 224, 178, 0.55) 30%,
        rgba(255, 200, 150, 0.15) 55%,
        transparent 72%);
    filter: blur(4px);
    animation: sunPulse 8s ease-in-out infinite;
}

@keyframes sunPulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50%      { transform: scale(1.08); opacity: 1; }
}

/* 云彩 */
.clouds { position: absolute; inset: 0; }
.cloud {
    position: absolute;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.85), rgba(255,255,255,0.35) 60%, transparent 75%);
    border-radius: 50%;
    filter: blur(6px);
    opacity: 0.7;
}
.cloud-1 { top: 18%; left: -20%; width: 340px; height: 90px; animation: drift 55s linear infinite; }
.cloud-2 { top: 32%; left: -30%; width: 240px; height: 70px; animation: drift 75s linear infinite; animation-delay: -10s; opacity: 0.55; }
.cloud-3 { top: 55%; left: -25%; width: 420px; height: 110px; animation: drift 90s linear infinite; animation-delay: -30s; opacity: 0.5; }
.cloud-4 { top: 8%;  left: -15%; width: 200px; height: 60px; animation: drift 65s linear infinite; animation-delay: -45s; opacity: 0.6; }

@keyframes drift {
    from { transform: translateX(0); }
    to   { transform: translateX(150vw); }
}

/* 星星 */
.stars { position: absolute; inset: 0; }
.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50%      { opacity: 1; transform: scale(1.3); }
}

/* 光线 */
.light-rays {
    position: absolute;
    top: 0; right: 10%;
    width: 500px; height: 100%;
    background: linear-gradient(115deg, transparent 40%, rgba(255,245,220,0.12) 50%, transparent 60%);
    transform: skewX(-8deg);
    animation: rayMove 12s ease-in-out infinite;
    pointer-events: none;
}
@keyframes rayMove {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 0.8; }
}

/* =================== 顶部导航 =================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: flex; align-items: center; gap: 8px;
    font-size: 22px; font-weight: 700; color: #fff;
    text-shadow: 0 2px 10px rgba(60,70,120,0.4);
}
.logo-icon { color: #ffe9b0; animation: sunPulse 4s ease-in-out infinite; }
.main-nav { display: flex; gap: 8px; }
.main-nav a {
    color: #fff; font-size: 15px; font-weight: 500;
    padding: 8px 18px; border-radius: 20px;
    text-shadow: 0 1px 6px rgba(60,70,120,0.35);
    transition: all 0.25s;
}
.main-nav a:hover, .main-nav a.active {
    background: rgba(255,255,255,0.32);
    backdrop-filter: blur(6px);
}
.nav-toggle {
    display: none; background: none; border: none;
    color: #fff; font-size: 24px; cursor: pointer;
}

/* =================== 主体 =================== */
.site-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px 60px;
    min-height: 60vh;
}

/* Hero 区 */
.hero {
    text-align: center;
    padding: 50px 20px 60px;
    color: #fff;
}
.hero h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 14px;
    text-shadow: 0 4px 20px rgba(50,60,110,0.5);
    letter-spacing: 2px;
}
.hero p {
    font-size: 17px;
    opacity: 0.95;
    text-shadow: 0 2px 10px rgba(50,60,110,0.4);
}

/* 区块标题 */
.section-title {
    color: #fff;
    font-size: 26px;
    margin-bottom: 26px;
    text-shadow: 0 2px 12px rgba(50,60,110,0.4);
    display: flex; align-items: center; gap: 10px;
}
.section-title::before { content: '✦'; color: #ffe9b0; }

/* =================== 卡片通用 =================== */
.card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(60,70,120,0.28);
}

/* =================== 文章列表 =================== */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 26px;
}
.article-card { display: flex; flex-direction: column; }
.article-cover {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: #cdd9ec;
    position: relative;
}
.article-cover.no-img {
    background: linear-gradient(135deg, #7c9ee0, #e8a87c);
    display: flex; align-items: center; justify-content: center;
}
.article-cover.no-img::after { content: '✦'; font-size: 40px; color: rgba(255,255,255,0.7); }
.article-body { padding: 20px 22px 22px; flex: 1; display: flex; flex-direction: column; }
.article-cat {
    display: inline-block;
    font-size: 12px;
    color: var(--accent);
    background: rgba(124,158,224,0.14);
    padding: 3px 12px;
    border-radius: 12px;
    align-self: flex-start;
    margin-bottom: 12px;
}
.article-title {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-dark);
    line-height: 1.4;
}
.article-title:hover { color: var(--accent); }
.article-excerpt {
    color: var(--text-soft);
    font-size: 14px;
    flex: 1;
    margin-bottom: 16px;
}
.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #9099b0;
    border-top: 1px solid rgba(120,130,160,0.12);
    padding-top: 14px;
}
.read-more { color: var(--accent); font-weight: 600; }

/* =================== 文章详情 =================== */
.article-detail {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    padding: 40px 46px;
    max-width: 820px;
    margin: 0 auto;
}
.article-detail h1 { font-size: 32px; margin-bottom: 16px; line-height: 1.3; }
.detail-meta { color: #9099b0; font-size: 14px; margin-bottom: 28px; display: flex; gap: 18px; flex-wrap: wrap; }
.article-content { font-size: 16px; color: #3a4058; line-height: 2; }
.article-content p { margin-bottom: 18px; }
.article-content img { border-radius: 12px; margin: 20px 0; box-shadow: var(--shadow); }
.article-content h2, .article-content h3 { margin: 28px 0 14px; color: var(--text-dark); }
.article-content a { color: var(--accent); text-decoration: underline; }
.article-content blockquote {
    border-left: 4px solid var(--accent);
    background: rgba(124,158,224,0.08);
    padding: 12px 20px; margin: 18px 0; border-radius: 0 8px 8px 0; color: var(--text-soft);
}
.back-link { display: inline-block; margin-bottom: 22px; color: #fff; text-shadow: 0 1px 6px rgba(50,60,110,0.4); }

/* =================== 相册 =================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}
.gallery-item {
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow);
    aspect-ratio: 4 / 3;
    background: #cdd9ec;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.gallery-item:hover img { transform: scale(1.08); }
.gallery-caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 26px 16px 12px;
    background: linear-gradient(transparent, rgba(30,35,60,0.75));
    color: #fff; font-size: 14px;
    opacity: 0; transition: opacity 0.3s;
}
.gallery-item:hover .gallery-caption { opacity: 1; }

/* 灯箱 */
.lightbox {
    position: fixed; inset: 0; z-index: 999;
    background: rgba(20,24,45,0.9);
    display: none; align-items: center; justify-content: center;
    padding: 30px; backdrop-filter: blur(6px);
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 90%; max-height: 85vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.lightbox-close { position: absolute; top: 24px; right: 34px; color: #fff; font-size: 40px; cursor: pointer; }

/* =================== 留言板 =================== */
.guestbook-wrap { max-width: 760px; margin: 0 auto; }
.message-form {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    padding: 28px 30px;
    margin-bottom: 34px;
}
.message-form .form-row { display: flex; gap: 14px; margin-bottom: 14px; }
.message-form .form-row .field { flex: 1; }
.message-form input, .message-form textarea {
    width: 100%; padding: 12px 16px;
    border: 1px solid rgba(120,130,160,0.25);
    border-radius: 12px; font-size: 14px;
    font-family: inherit; background: rgba(255,255,255,0.7);
    transition: 0.2s;
}
.message-form input:focus, .message-form textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124,158,224,0.18);
}
.message-form textarea { min-height: 110px; resize: vertical; margin-bottom: 16px; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-warm));
    color: #fff; border: none; padding: 12px 32px;
    border-radius: 24px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: 0.25s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(124,158,224,0.4); }

.message-list { display: flex; flex-direction: column; gap: 16px; }
.message-item {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 18px 22px;
    box-shadow: 0 8px 24px rgba(60,70,120,0.12);
    backdrop-filter: blur(10px);
}
.message-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.message-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-warm));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 18px;
}
.message-name { font-weight: 600; color: var(--text-dark); }
.message-time { font-size: 12px; color: #9099b0; margin-left: auto; }
.message-content { color: var(--text-soft); font-size: 15px; }
.message-reply {
    margin-top: 12px; padding: 12px 16px;
    background: rgba(124,158,224,0.1);
    border-radius: 10px; font-size: 14px; color: var(--text-soft);
}
.message-reply b { color: var(--accent); }

/* =================== 友链 =================== */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}
.link-card {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 20px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(60,70,120,0.12);
    backdrop-filter: blur(10px);
    transition: transform 0.3s, box-shadow 0.3s;
}
.link-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.link-logo {
    width: 48px; height: 48px; border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-warm));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 20px; flex-shrink: 0;
    background-size: cover; background-position: center;
}
.link-info { overflow: hidden; }
.link-name { font-weight: 600; color: var(--text-dark); margin-bottom: 3px; }
.link-desc { font-size: 13px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =================== 分页 =================== */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.pagination a, .pagination span {
    min-width: 40px; height: 40px; padding: 0 12px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 20px; font-size: 14px;
    background: rgba(255,255,255,0.55); color: var(--text-dark);
    backdrop-filter: blur(8px); transition: 0.2s;
}
.pagination a:hover { background: rgba(255,255,255,0.85); }
.pagination .current { background: linear-gradient(135deg, var(--accent), var(--accent-warm)); color: #fff; }

/* =================== 提示 =================== */
.empty-tip { text-align: center; color: #fff; padding: 60px 20px; font-size: 16px; text-shadow: 0 1px 8px rgba(50,60,110,0.4); }
.flash {
    padding: 12px 18px; border-radius: 12px; margin-bottom: 20px; font-size: 14px;
    backdrop-filter: blur(8px);
}
.flash-success { background: rgba(46,204,113,0.2); color: #1e7d47; border: 1px solid rgba(46,204,113,0.35); }
.flash-error { background: rgba(231,76,60,0.18); color: #b03a2e; border: 1px solid rgba(231,76,60,0.3); }

/* =================== 页脚 =================== */
.site-footer {
    background: rgba(30, 35, 60, 0.55);
    backdrop-filter: blur(12px);
    color: #fff; text-align: center;
    padding: 36px 24px;
    margin-top: 40px;
}
.footer-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.footer-desc { opacity: 0.8; font-size: 14px; margin-bottom: 12px; }
.footer-copy { font-size: 13px; opacity: 0.7; }
.footer-copy a { text-decoration: underline; }
.footer-admin { margin-top: 10px; font-size: 13px; opacity: 0.6; }

/* =================== 响应式 =================== */
@media (max-width: 768px) {
    .header-inner { padding: 14px 18px; }
    .main-nav {
        position: absolute; top: 100%; right: 0; left: 0;
        flex-direction: column; gap: 0;
        background: rgba(40,48,80,0.92); backdrop-filter: blur(14px);
        max-height: 0; overflow: hidden; transition: max-height 0.3s;
    }
    .main-nav.open { max-height: 300px; }
    .main-nav a { padding: 14px 24px; border-radius: 0; }
    .nav-toggle { display: block; }
    .hero h1 { font-size: 30px; }
    .article-detail { padding: 28px 22px; }
    .message-form .form-row { flex-direction: column; }
    .site-main { padding: 28px 16px 40px; }
}
