/**
 * 築心資訊中心 - 樣式表
 * Content Discovery & Traffic Hub
 */

/* ============================================
   CSS Custom Properties (極簡牛皮紙文藝風)
   ============================================ */
:root {
    --color-bg: #f5f2ec;
    --color-bg-subtle: #ede8df;
    --color-surface: #ffffff;
    --color-surface-warm: #faf8f4;
    --color-text: #231f1c;
    --color-text-secondary: #4e4740;
    --color-text-muted: #786f66;
    --color-text-light: #a3998e;
    --color-border: #e3dcd1;
    --color-border-light: #ece6dc;
    --color-primary: #d49424;
    --color-primary-hover: #be821a;
    --color-primary-soft: #faf1de;
    --color-amber: #e5a638;
    --color-amber-hover: #d49424;
    --color-amber-soft: #fdf4e2;
    --color-ribbon: #dc3e2e;
    --color-ribbon-hover: #c42d1e;
    --color-ribbon-soft: #fdedea;
    --color-accent-home: #860f0b;
    --color-accent-church: #cb376d;
    --color-shadow: rgba(45, 35, 25, 0.05);
    --color-shadow-hover: rgba(45, 35, 25, 0.09);
    --color-shadow-card: 0 2px 8px rgba(45, 35, 25, 0.04), 0 1px 2px rgba(45, 35, 25, 0.02);
    --color-shadow-hover-card: 0 8px 24px rgba(45, 35, 25, 0.08), 0 2px 6px rgba(45, 35, 25, 0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --font-sans: 'Noto Sans TC', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Base & Reset
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Header
   ============================================ */
.site-header {
    background: linear-gradient(135deg, #2b2520 0%, #383029 50%, #463c33 100%);
    color: #faf8f5;
    padding: 2.5rem 0 2rem;
    position: relative;
    overflow: hidden;
}

.site-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(229, 166, 56, 0.12) 0%, transparent 70%);
    border-radius: 50%;
}

.site-header::after {
    content: '';
    position: absolute;
    bottom: -60%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(220, 62, 46, 0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.site-header .container {
    position: relative;
    z-index: 1;
}

.site-title {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.85rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
    color: #faf8f5;
}

.site-title .title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.site-title .title-logo-img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.22));
    transition: transform var(--transition-fast);
}

.site-title:hover .title-icon {
    transform: translateY(-1px) scale(1.06);
}

.site-subtitle {
    font-size: 1.02rem;
    color: rgba(250, 248, 245, 0.82);
    font-weight: 400;
    margin: 0;
}

/* ============================================
   Toolbar (Filters + Search)
   ============================================ */
.toolbar {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px var(--color-shadow);
}

.toolbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.toolbar-main-row {
    display: contents;
}

/* Source Filter Tabs (極簡牛皮紙分段膠囊) */
.source-filters {
    display: inline-flex;
    align-items: center;
    background: #eae4d9;
    padding: 3px;
    border-radius: 100px;
    gap: 2px;
    flex-wrap: wrap;
    min-width: 0;
    order: 1;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 1.05rem;
    border: none;
    border-radius: 100px;
    background: transparent;
    color: #635b52;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-family: var(--font-sans);
    line-height: 1.2;
}

.filter-btn:hover {
    color: #231f1c;
    background: rgba(255, 255, 255, 0.65);
}

.filter-btn.active {
    background: #ffffff;
    color: #231f1c;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(45, 35, 25, 0.08), 0 1px 2px rgba(45, 35, 25, 0.04);
}

.filter-btn .filter-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.filter-btn.active .filter-dot {
    transform: scale(1.15);
}

.filter-btn .filter-count {
    font-size: 0.82em;
    font-weight: 500;
    color: #786f66;
}

.filter-btn.active .filter-count {
    color: #231f1c;
    font-weight: 600;
}

/* Search Box */
.search-box {
    position: relative;
    width: 260px;
    flex-shrink: 0;
}

.search-box input {
    width: 100%;
    padding: 0.48rem 0.95rem 0.48rem 2.35rem;
    border: 1.5px solid var(--color-border);
    border-radius: 100px;
    font-size: 0.92rem;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    transition: all var(--transition-fast);
    outline: none;
}

.search-box input:focus {
    border-color: var(--color-amber);
    background: var(--color-surface);
    box-shadow: 0 0 0 3px rgba(229, 166, 56, 0.18);
}

.search-box input::placeholder {
    color: var(--color-text-light);
}

.search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-light);
    font-size: 0.85rem;
    pointer-events: none;
}

.search-box .search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.8rem;
    line-height: 1;
    display: none;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.search-box .search-clear:hover {
    color: var(--color-text);
    background: var(--color-border-light);
}

.search-box.has-value .search-clear {
    display: flex;
}

/* Search & Date Filter Group */
.search-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    order: 2;
    margin-left: auto;
}

/* Date Filters (年份／月份篩選) */
.date-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.date-select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.date-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--color-bg);
    border: 1.5px solid var(--color-border);
    border-radius: 100px;
    padding: 0.45rem 1.7rem 0.45rem 0.82rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-muted);
    font-family: var(--font-sans);
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
    line-height: 1.3;
}

.date-select:hover {
    border-color: var(--color-amber);
    color: var(--color-text);
    background: var(--color-primary-soft);
}

.date-select:focus {
    border-color: var(--color-amber);
    background: var(--color-surface);
    box-shadow: 0 0 0 3px rgba(229, 166, 56, 0.18);
    color: var(--color-text);
}

.date-select.is-active {
    background: var(--color-primary-soft);
    border-color: var(--color-amber);
    color: #231f1c;
    font-weight: 600;
}

.date-select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--color-bg);
    border-color: var(--color-border);
    color: var(--color-text-light);
    pointer-events: none;
}

.date-select-wrapper:has(.date-select:disabled) {
    cursor: not-allowed;
}

.date-select-wrapper .select-arrow {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.date-select:disabled~.select-arrow {
    opacity: 0.35;
}

.date-select:not(:disabled):hover~.select-arrow,
.date-select:not(:disabled):focus~.select-arrow,
.date-select:not(:disabled).is-active~.select-arrow {
    color: var(--color-amber-hover);
}

.date-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.date-reset-btn:hover {
    background: var(--color-ribbon-soft);
    border-color: #fca5a5;
    color: var(--color-ribbon);
    transform: rotate(90deg);
}

/* Toolbar Actions & Buttons */
.toolbar-actions {
    display: none;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    order: 3;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.8rem;
    border-radius: 100px;
    border: 1.5px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    font-family: var(--font-sans);
    line-height: 1.2;
}

.toolbar-btn:hover {
    border-color: var(--color-amber);
    color: var(--color-text);
    background: var(--color-surface);
    box-shadow: 0 2px 8px var(--color-shadow);
}

.toolbar-btn.is-active {
    border-color: var(--color-amber);
    color: #231f1c;
    background: var(--color-primary-soft);
    font-weight: 600;
}

/* 桌面版隱藏搜尋切換按鈕 */
.search-toggle-btn {
    display: none;
    position: relative;
}

.filter-active-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-ribbon);
    margin-left: 2px;
}

.sync-btn.is-syncing {
    pointer-events: none;
    border-color: var(--color-amber);
    color: var(--color-amber-hover);
    background: var(--color-surface);
}

.sync-btn.is-syncing .sync-icon {
    animation: sync-spin 1s linear infinite;
}

@keyframes sync-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    padding: 1.5rem 0 3rem;
    min-height: 60vh;
}

/* Date Group Header */
.date-group {
    margin-bottom: 1.75rem;
}

.date-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
}

.date-header .date-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.date-header .date-line {
    flex: 1;
    height: 1px;
    background: var(--color-border-light);
}

/* ============================================
   Article Card (極簡牛皮紙文藝風，卡片超連結)
   ============================================ */
.article-card {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 0.85rem;
    border: 1px solid var(--color-border);
    box-shadow: var(--color-shadow-card);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    position: relative;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.article-card:hover {
    border-color: #d1c8b8;
    box-shadow: var(--color-shadow-hover-card);
    transform: translateY(-2px);
}

/* Card Main (上半部：左圖＋右內容) */
.card-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    min-width: 0;
    padding: 0.85rem 1rem 0.75rem;
    gap: 1rem;
}

/* Card Image (左側：文章首圖 / Fallback Image 4:3 比例) */
.card-image {
    width: 160px;
    min-width: 160px;
    aspect-ratio: 4 / 3;
    height: auto;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    display: block;
    border-radius: var(--radius-md);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border-light);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-normal), filter var(--transition-normal);
}

.article-card:hover .card-image img {
    transform: scale(1.04);
}

/* Fallback 圖片灰階濾鏡 */
.card-image img.is-fallback {
    filter: grayscale(100%);
    opacity: 0.75;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.article-card:hover .card-image img.is-fallback {
    filter: grayscale(100%);
    opacity: 0.9;
}

/* Card Body (右側：文章標題＋文章摘要) */
.card-body {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    min-width: 0;
    justify-content: center;
}

/* Card Title */
.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.45;
    margin: 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.article-card:hover .card-title {
    color: var(--color-amber-hover);
}

/* Card Summary */
.card-summary {
    font-size: 1.02rem;
    line-height: 1.62;
    color: var(--color-text-secondary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card Footer (橫跨通欄) */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding: 0.48rem 1rem 0.58rem;
    border-top: 1px solid var(--color-border-light);
    gap: 0.75rem;
    min-width: 0;
    background: rgba(250, 248, 244, 0.45);
}

.card-meta {
    font-size: 0.84rem;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
    overflow: hidden;
}

.card-meta .meta-author {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.card-meta .meta-date {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-text-light);
    white-space: nowrap;
    flex-shrink: 0;
}

.card-action {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--color-amber-hover);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-sm);
}

.card-action:hover {
    background: var(--color-primary-soft);
    color: var(--color-amber-hover);
}

.card-action .action-arrow {
    font-size: 0.9rem;
    transition: transform var(--transition-fast);
}

.card-action:hover .action-arrow {
    transform: translateX(2px);
}

/* ============================================
   Loading & States
   ============================================ */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    gap: 1rem;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-amber);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state .empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.empty-state .empty-desc {
    font-size: 0.9rem;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--color-ribbon-soft);
    border-radius: var(--radius-lg);
    border: 1px solid #fecaca;
    color: var(--color-ribbon);
}

.error-state .error-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

/* ============================================
   Infinite Scroll
   ============================================ */
.infinite-scroll-container {
    padding: 1.5rem 0 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.scroll-sentinel {
    position: absolute;
    top: -200px;
    left: 0;
    width: 100%;
    height: 10px;
    pointer-events: none;
    visibility: hidden;
}

.infinite-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 100px;
    box-shadow: 0 2px 8px rgba(45, 35, 25, 0.05);
    animation: fadeIn 0.3s ease-out;
}

.infinite-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-amber);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.infinite-loading-text {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.infinite-end {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 320px;
    margin: 0.5rem auto 0;
    animation: fadeIn 0.4s ease-out;
}

.infinite-end-line {
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.infinite-end-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-text-light);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    background: #eae4d9;
    border-top: 1px solid var(--color-border);
    padding: 2.2rem 0;
    text-align: center;
    margin-top: auto;
}

.site-footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.footer-sources {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

.footer-source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all var(--transition-fast);
    padding: 0.28rem 0.75rem;
    border-radius: 100px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

.footer-source-link:hover {
    color: var(--color-text);
    background: #ffffff;
    border-color: #d1c8b8;
    box-shadow: 0 2px 6px var(--color-shadow);
}

.footer-source-link .footer-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.footer-text {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.5;
}

.footer-text a {
    color: var(--color-text);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-text a:hover {
    color: var(--color-amber-hover);
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton {
    background: linear-gradient(90deg,
            var(--color-bg-subtle) 25%,
            #f7f4ee 37%,
            var(--color-bg-subtle) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

.skeleton-card {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 0.85rem;
    border: 1px solid var(--color-border);
}

.skeleton-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    padding: 0.85rem 1rem 0.75rem;
    gap: 1rem;
}

.skeleton-image {
    width: 160px;
    min-width: 160px;
    aspect-ratio: 4 / 3;
    height: auto;
    flex-shrink: 0;
    border-radius: var(--radius-md);
}

.skeleton-body {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    justify-content: center;
    min-width: 0;
}

.skeleton-badge {
    width: 60px;
    height: 14px;
    border-radius: 4px;
}

.skeleton-title {
    width: 80%;
    height: 18px;
    border-radius: 4px;
}

.skeleton-text {
    width: 100%;
    height: 14px;
    border-radius: 4px;
}

.skeleton-text-short {
    width: 60%;
    height: 14px;
    border-radius: 4px;
}

.skeleton-footer {
    width: 100%;
    padding: 0.45rem 1rem 0.55rem;
    border-top: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.skeleton-meta {
    width: 130px;
    height: 14px;
    border-radius: 4px;
}

/* ============================================
   Scroll to Top
   ============================================ */
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2b2520;
    color: #faf8f5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 14px rgba(45, 35, 25, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-normal);
    z-index: 200;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background: var(--color-amber);
    color: #231f1c;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(229, 166, 56, 0.35);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .site-header {
        padding: 1.75rem 0 1.5rem;
    }

    .site-title {
        font-size: 1.45rem;
        gap: 0.5rem;
    }

    .site-subtitle {
        font-size: 0.95rem;
    }

    .site-title .title-icon {
        width: 30px;
        height: 30px;
    }

    .site-title .title-logo-img {
        width: 28px;
        height: 28px;
    }

    .toolbar-inner {
        flex-direction: column;
        gap: 0.5rem;
    }

    .toolbar-main-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 0.5rem;
    }

    .source-filters {
        flex: 1 1 auto;
        width: auto;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 4px;
        gap: 3px;
        min-width: 0;
    }

    .source-filters::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        font-size: 0.98rem;
        padding: 0.42rem 0.95rem;
        font-weight: 550;
    }

    .filter-btn .filter-dot {
        width: 9px;
        height: 9px;
    }

    .toolbar-actions {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        flex-shrink: 0;
    }

    .toolbar-actions .toolbar-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        position: relative;
    }

    .toolbar-actions .toolbar-btn .toggle-text,
    .toolbar-actions .toolbar-btn .sync-text {
        display: none;
    }

    .toolbar-actions .toolbar-btn svg {
        width: 15px;
        height: 15px;
    }

    .toolbar-actions .filter-active-dot {
        position: absolute;
        top: 3px;
        right: 3px;
        width: 6px;
        height: 6px;
        margin: 0;
        box-shadow: 0 0 0 1.5px #ffffff;
    }

    .search-toggle-btn {
        display: inline-flex;
    }

    /* 手機版：搜尋與過濾器預設收合，點擊展開 */
    .search-filter-group {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
        margin-left: 0;
        padding-top: 0.5rem;
        border-top: 1px dashed var(--color-border);
        animation: filterSlideDown 0.22s ease-out forwards;
    }

    .search-filter-group.is-open {
        display: flex;
    }

    @keyframes filterSlideDown {
        from {
            opacity: 0;
            transform: translateY(-6px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        font-size: 0.92rem;
    }

    .date-filters {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

    .date-select-wrapper {
        flex: 1;
    }

    .date-select {
        width: 100%;
        font-size: 0.9rem;
    }

    .date-header .date-text {
        font-size: 0.85rem;
    }

    .article-card {
        margin-bottom: 0.75rem;
    }

    /* 手機版：隱藏文章縮圖與 Fallback 圖片，保留文字與通欄底部 */
    .card-main {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        padding: 0.85rem 1rem 0.75rem;
        gap: 0;
        width: 100%;
        min-width: 0;
    }

    .card-image {
        display: none !important;
    }

    .card-body {
        flex: 1;
        min-width: 0;
        padding: 0;
        gap: 0.35rem;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .card-title {
        font-size: 1.32rem;
        line-height: 1.42;
        font-weight: 700;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        word-break: break-word;
        min-width: 0;
    }

    .card-summary {
        font-size: 0.96rem;
        line-height: 1.55;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .card-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.42rem 0.95rem 0.48rem;
        border-top: 1px solid var(--color-border-light);
        gap: 0.5rem;
        min-width: 0;
    }

    .card-meta {
        font-size: 0.82rem;
        gap: 0.6rem;
        min-width: 0;
        overflow: hidden;
        flex: 1;
    }

    .card-meta .meta-author {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .card-action {
        font-size: 0.82rem;
    }

    .skeleton-main {
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 0.85rem 1rem 0.75rem;
        gap: 0;
        width: 100%;
    }

    .skeleton-image {
        display: none !important;
    }

    .skeleton-body {
        flex: 1;
        min-width: 0;
        padding: 0;
        gap: 0.35rem;
    }

    .skeleton-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.42rem 0.95rem 0.48rem;
        border-top: 1px solid var(--color-border-light);
    }

    .footer-sources {
        gap: 0.65rem;
    }

    .footer-source-link {
        font-size: 0.88rem;
    }

    .footer-text {
        font-size: 0.82rem;
    }

    .scroll-top-btn {
        bottom: 1.25rem;
        right: 1.25rem;
    }
}

/* 手機版隱藏 TABS 文章數量（保留於平板及桌面電腦） */
@media (max-width: 640px) {
    .filter-btn .filter-count {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.35rem;
    }

    .article-card {
        margin-bottom: 0.65rem;
        border-radius: var(--radius-md);
    }

    .card-main {
        padding: 0.75rem 0.85rem 0.65rem;
        gap: 0;
        width: 100%;
        min-width: 0;
    }

    .card-body {
        flex: 1;
        min-width: 0;
        padding: 0;
        gap: 0.3rem;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .card-title {
        font-size: 1.25rem;
        line-height: 1.4;
        font-weight: 700;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        word-break: break-word;
        min-width: 0;
    }

    .card-summary {
        font-size: 0.92rem;
        line-height: 1.52;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .card-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.38rem 0.85rem 0.42rem;
        border-top: 1px solid var(--color-border-light);
        gap: 0.35rem;
        min-width: 0;
    }

    .card-meta {
        font-size: 0.8rem;
        gap: 0.45rem;
        min-width: 0;
        overflow: hidden;
        flex: 1;
    }

    .card-meta .meta-author {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .card-meta .meta-date {
        font-size: 0.8rem;
    }

    .card-action {
        font-size: 0.8rem;
    }

    .skeleton-main {
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 0.65rem 0.75rem;
        gap: 0.6rem;
        width: 100%;
    }

    .skeleton-image {
        width: 95px;
        min-width: 95px;
        aspect-ratio: 4 / 3;
        height: auto;
        border-radius: 6px;
        flex-shrink: 0;
    }

    .skeleton-body {
        flex: 1;
        min-width: 0;
        padding: 0;
        gap: 0.25rem;
    }

    .skeleton-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.38rem 0.85rem 0.42rem;
        border-top: 1px solid var(--color-border-light);
    }

    .filter-btn {
        padding: 0.4rem 0.88rem;
        font-size: 0.95rem;
        font-weight: 550;
    }
}

/* ============================================
   Animation: Scroll-triggered Reveal
   ============================================ */
.scroll-reveal {
    opacity: 0;
    transform: translateY(22px) scale(0.985);
    transition: opacity 0.52s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.52s cubic-bezier(0.16, 1, 0.3, 1),
                border-color var(--transition-fast),
                box-shadow var(--transition-fast);
    will-change: transform, opacity;
}

.scroll-reveal.is-revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.article-card.scroll-reveal.is-revealed:hover {
    transform: translateY(-1px) scale(1);
}

/* Date Group Scroll Reveal (淡入向上位移) */
.date-group.scroll-reveal {
    transform: translateY(12px);
    transition: opacity 0.4s ease-out,
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.date-group.scroll-reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .scroll-reveal,
    .scroll-reveal.is-revealed,
    .article-card.scroll-reveal.is-revealed:hover {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* Stagger animation delay via JS inline style */