﻿

/* ===== 公告跑馬燈 ===== */
.announcement-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: linear-gradient(90deg, var(--warm-accent), var(--warm-accent-hover));
    color: white;
    height: 52px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.announcement-container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: relative;
}

.announcement-icon {
    flex-shrink: 0;
    font-size: 1.2rem;
    margin-right: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* 跑馬燈容器 */
.announcement-marquee {
    flex: 1;
    overflow: hidden;
    position: relative;
/*    mask-image: linear-gradient( to right, transparent, black 2%, black 98%, transparent );
    -webkit-mask-image: linear-gradient( to right, transparent, black 2%, black 98%, transparent );*/
}

/* 跑馬燈軌道 */
.announcement-track {
    display: flex;
    width: fit-content;
    animation: marquee 20s linear infinite;
}

/* 滑鼠放在上面ㄉ暫停動畫 */
.announcement-marquee:hover .announcement-track {
    animation-play-state: paused;
}

/* 跑馬燈內容 */
.announcement-content {
    display: flex;
    padding-right: 3rem;
    white-space: nowrap;
}

.announcement-item {
    font-size: var(--font-sm);
    font-weight: 500;
}

.announcement-separator {
    margin: 0 1.5rem;
    opacity: 0.5;
}

/* 跑馬燈動畫 */
@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* 關閉按鈕 */
.announcement-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 1rem;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
    border-radius: 4px;
}

    .announcement-close:hover {
        opacity: 1;
        background-color: rgba(255, 255, 255, 0.1);
    }

/* 有公告時，調整導航列和內容的位置 */
body.has-announcement .blog-navbar {
    top: 52px;
}

body.has-announcement .main {
    padding-top: 137px; /* 85px + 52px */
}

/* 響應式設計 */
@media (max-width: 768px) {
    .announcement-marquee {
        mask-image: none;
        -webkit-mask-image: none;
    }

    .announcement-track {
        animation-duration: 20s;
    }

    .announcement-separator {
        margin: 0 1rem;
    }
}

/*  prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .announcement-track {
        animation-duration: 15s;
    }

    .announcement-banner {
        animation: none;
    }

    .announcement-icon {
        animation: none;
    }
}
