/* ========================================
   首页专属样式 - 浅云小站
   包含：夜空首屏、导航卡片、公告横条、
         关于区、轮播、预告区、回到顶部
   ======================================== */

/* ========== CSS 变量 ========== */
:root {
    --color-card-bg: rgba(255, 255, 255, 0.08);
    --color-card-border: rgba(255, 255, 255, 0.1);
    --color-accent: #4da6ff;
    --color-text: #fff;
    --color-text-muted: rgba(255, 255, 255, 0.6);
}

/* ========== 屏幕阅读器专用 ========== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ========== 首屏：夜空 + 欢迎语 ========== */
.hero {
    position: relative;
    width: 100%;
    height: 420px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.night-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* 月亮 —— 恢复原版位置 */
.moon {
    position: absolute;
    width: 80px;
    height: 80px;
    background: url('../images/backgrounds/moon.png') no-repeat center center;
    background-size: contain;
    top: 40%;
    left: 30%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* 云 —— 恢复原版位置 */
.cloud {
    position: absolute;
    background: url('../images/backgrounds/cloud.png') no-repeat center center;
    background-size: contain;
    opacity: 0.8;
    z-index: 20;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.cloud1 {
    width: 120px;
    height: 60px;
    top: 30%;
    animation-name: moveCloud1;
    animation-duration: 30s;
    right: -150px;
    left: auto;
}

.cloud2 {
    width: 180px;
    height: 90px;
    top: 35%;
    animation-name: moveCloud2;
    animation-duration: 40s;
    animation-delay: 5s;
    right: -180px;
    left: auto;
}

.cloud3 {
    width: 100px;
    height: 50px;
    top: 40%;
    animation-name: moveCloud3;
    animation-duration: 35s;
    animation-delay: 10s;
    right: -100px;
    left: auto;
}

.star {
    position: absolute;
    background-color: #fff;
    border-radius: 50%;
    animation: twinkle var(--duration) ease-in-out infinite;
    opacity: 0;
    z-index: 1;
}

/* 欢迎文字 */
.hero__text {
    position: relative;
    z-index: 50;
    text-align: center;
    animation: fadeInUp 1s ease;
}

.hero__title {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    margin-bottom: 12px;
    letter-spacing: 0.06em;
}

.hero__subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
    margin-bottom: 32px;
}

/* 向下滚动提示 */
.hero__scroll-hint {
    display: inline-block;
    text-decoration: none;
}

.hero__arrow {
    display: inline-block;
    font-size: 1.8rem;
    color: rgba(255, 255, 255, 0.7);
    animation: bounce 2s ease-in-out infinite;
    cursor: pointer;
    transition: color 0.3s ease;
}

.hero__arrow:hover {
    color: #fff;
}

/* ========== 导航卡片 ========== */
.nav-cards {
    width: 85%;
    max-width: 1000px;
    margin: -40px auto 32px;
    position: relative;
    z-index: 200;
}

.nav-cards__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.nav-card {
    background-color: var(--color-card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-card-border);
    border-radius: 16px;
    padding: 28px 16px;
    text-align: center;
    text-decoration: none;
    color: var(--color-text);
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.nav-card:hover,
.nav-card:focus-visible {
    transform: translateY(-6px);
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    outline: none;
}

.nav-card:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.nav-card__icon {
    font-size: 2.2rem;
}

.nav-card__title {
    font-size: 1.1rem;
    font-weight: 600;
}

.nav-card__desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* 更多卡片（不可用） */
.nav-card--more {
    opacity: 0.6;
    cursor: default;
}

.nav-card--more:hover {
    transform: none;
    background-color: var(--color-card-bg);
    box-shadow: none;
}

/* ========== 公告横条 ========== */
.notice-bar {
    width: 85%;
    max-width: 1000px;
    margin: 0 auto 32px;
    padding: 12px 24px;
    background-color: var(--color-card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-card-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

.notice-bar__icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* ========== 区块标题通用 ========== */
.section-heading {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 20px;
}

/* ========== 关于这里 ========== */
.about-section {
    width: 85%;
    max-width: 700px;
    margin: 0 auto 40px;
}

.about-section__content {
    background-color: var(--color-card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-card-border);
    border-radius: 16px;
    padding: 28px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
}

.about-section__content p {
    margin-bottom: 10px;
}

.about-section__content p:last-child {
    margin-bottom: 0;
}

.about-section__update {
    margin-top: 16px !important;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ========== 轮播 ========== */
.carousel-section {
    width: 85%;
    max-width: 1000px;
    margin: 0 auto 40px;
}

.carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 16px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-card-border);
}

.carousel__track {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel__slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    pointer-events: none;
}

.carousel__slide.active {
    opacity: 1;
    pointer-events: auto;
}

.carousel__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 左右箭头 */
.carousel__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
    font-family: inherit;
    line-height: 1;
}

.carousel:hover .carousel__btn,
.carousel__btn:focus-visible {
    opacity: 1;
}

.carousel__btn:hover,
.carousel__btn:focus-visible {
    background: rgba(0, 0, 0, 0.7);
    outline: none;
}

.carousel__btn--prev {
    left: 12px;
}

.carousel__btn--next {
    right: 12px;
}

/* 暂停按钮 */
.carousel__pause {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.carousel:hover .carousel__pause,
.carousel__pause:focus-visible {
    opacity: 1;
}

.carousel__pause:hover,
.carousel__pause:focus-visible {
    background: rgba(0, 0, 0, 0.7);
    outline: none;
}

/* 指示器 */
.carousel__dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 8px;
}

.carousel__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.carousel__dot.active {
    background-color: #fff;
    transform: scale(1.3);
}

.carousel__dot:hover {
    background-color: rgba(255, 255, 255, 0.8);
}

/* ========== 即将上线 ========== */
.preview-section {
    width: 85%;
    max-width: 1000px;
    margin: 0 auto 40px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.preview-item {
    background-color: var(--color-card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-card-border);
    border-radius: 14px;
    padding: 24px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.preview-item:hover {
    background-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.preview-item__icon {
    font-size: 2rem;
}

.preview-item__name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
}

.preview-item__tag {
    font-size: 0.7rem;
    color: var(--color-accent);
    background-color: rgba(77, 166, 255, 0.15);
    padding: 2px 10px;
    border-radius: 10px;
}

/* ========== 回到顶部 ========== */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
    font-family: inherit;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
    outline: none;
}

/* ========== 动画关键帧 ========== */
@keyframes moveCloud1 {
    0% { right: -150px; }
    100% { right: 100%; }
}

@keyframes moveCloud2 {
    0% { right: -180px; }
    100% { right: 100%; }
}

@keyframes moveCloud3 {
    0% { right: -100px; }
    100% { right: 100%; }
}

@keyframes twinkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: var(--opacity); transform: scale(1); }
}

@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .hero {
        height: 350px;
    }

    .hero__title {
        font-size: 2rem;
    }

    .hero__subtitle {
        font-size: 0.95rem;
    }

    .nav-cards {
        margin-top: -30px;
    }

    .nav-cards__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .carousel__btn {
        opacity: 1;
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .carousel__pause {
        opacity: 1;
        font-size: 0.75rem;
        padding: 3px 8px;
    }

    .moon {
        width: 55px;
        height: 55px;
    }

    .cloud1 { width: 80px; height: 40px; }
    .cloud2 { width: 120px; height: 60px; }
    .cloud3 { width: 70px; height: 35px; }
}

@media (max-width: 480px) {
    .hero {
        height: 300px;
    }

    .nav-cards__grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .preview-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .about-section__content {
        padding: 20px;
    }
}

/* ========== 减少动画 ========== */
@media (prefers-reduced-motion: reduce) {
    .cloud,
    .star {
        animation: none;
    }

    .carousel__slide {
        transition: none;
    }

    .hero__arrow {
        animation: none;
    }

    .hero__text {
        animation: none;
    }

    .top-menu {
        transition: none;
    }
}

/* ========== 打印样式 ========== */
@media print {
    .night-sky,
    .hero,
    .back-to-top,
    .carousel {
        display: none;
    }

    .nav-cards__grid {
        display: block;
    }

    .about-section__content {
        background: #fff;
        border: 1px solid #ccc;
        color: #000;
    }
}