/* style.css - Common styles for TingNotes */

/* 1. Theme Variables (Light & Dark) */
:root {
    /* Light Mode */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --text-muted: #94a3b8;
    --accent-primary: #3498db;
    --accent-secondary: #2980b9;
    --border-color: #e9ecef;
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(52, 152, 219, 0.1);
    --gradient-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --code-bg: #f6f8fa;
    --code-text: #24292e;
    --theme-btn-bg: #f0f0f0;
    --theme-btn-border: #d1d5db;
    --theme-btn-icon: #6b7280;

    /* Topic Colors (Light) */
    --learning-color: #3498db;
    --learning-color-dark: #2574a9;
    --career-color: #27ae60;
    --career-color-dark: #1e8449;
    --travel-color: #e67e22;
    --travel-color-dark: #ba6516;
    --others-color: #8e44ad;
    --others-color-dark: #6c3483;
}

[data-theme="dark"] {
    /* Dark Mode */
    --bg-primary: #1a1a1a;
    --bg-secondary: #252a33;
    --bg-card: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --accent-primary: #4299e1;
    --accent-secondary: #3182ce;
    --border-color: #4a5568;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(66, 153, 225, 0.15);
    --gradient-bg: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
    --theme-btn-bg: rgba(255, 255, 255, 0.1);
    --theme-btn-border: rgba(255, 255, 255, 0.3);
    --theme-btn-icon: rgba(255, 255, 255, 0.8);

    /* Topic Colors (Dark) */
    --learning-color: #4299e1;
    --learning-color-dark: #2b6cb0;
    --career-color: #48bb78;
    --career-color-dark: #2f855a;
    --travel-color: #f39c12;
    --travel-color-dark: #d68910;
    --others-color: #b794f6;
    --others-color-dark: #9f7aea;
}

/* 2. Basic Reset & Body Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.gradient-background {
     background: var(--gradient-bg);
}

/* 3. Layout: Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.container-with-sidebar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

/* 4. Common Components */

.header {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 6px 20px var(--shadow-light);
    border: 1px solid var(--border-color);
    position: relative;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--theme-btn-bg);
    border: 2px solid var(--theme-btn-border);
    color: var(--theme-btn-icon);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: white;
    transform: scale(1.1);
}

.theme-icon {
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: transform 0.3s ease;
}

/* Breadcrumbs */
.breadcrumb {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-bottom: 15px;
}

.breadcrumb a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    text-decoration: underline;
    color: var(--accent-secondary);
}

/* Page Titles */
.page-title {
    font-size: 2.2em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.2;
}

.chapter-title {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle, .chapter-subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Main Content Area (Cards) */
.main-content {
    background: var(--bg-card);
    border-radius: 15px;
    box-shadow: 0 6px 20px var(--shadow-light);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 25px;
}

/* Content Sections */
.content-section {
    padding: 30px;
    border-bottom: 1px solid var(--border-color);
}

.main-content .content-section:last-child {
    border-bottom: none;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.section-number, .section-icon {
    background: var(--accent-primary);
    color: white;
    min-width: 35px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

.section-title {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
}

.content-text {
    color: var(--text-secondary);
    font-size: 1em;
    line-height: 1.7;
    margin-bottom: 15px;
}

.content-text p:last-child {
     margin-bottom: 0;
}

/* Stat Cards */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 35px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 22px;
    text-align: center;
    box-shadow: 0 4px 12px var(--shadow-light);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-medium);
    border-color: var(--accent-primary);
}

.stat-number {
    font-size: 2.2em;
    font-weight: 700;
    color: var(--accent-primary);
    display: block;
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 500;
}

/* Category Selector */
.category-selector {
    background: var(--bg-card);
    border-radius: 15px;
    box-shadow: 0 8px 32px var(--shadow-light);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 35px;
}

.selector-header {
    padding: 25px 30px 15px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.selector-title {
    font-size: 1.4em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.selector-subtitle {
    color: var(--text-secondary);
    font-size: 0.95em;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    background: var(--bg-secondary);
    margin: 0;
    padding: 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tab {
    flex: 1 0 auto;
    min-width: 120px;
    padding: 15px 20px;
    text-align: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    white-space: normal;
}

.category-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.category-tab.active {
    background: var(--bg-card);
    color: var(--accent-primary);
    font-weight: 600;
}

.category-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-primary);
}

.tab-icon {
    display: block;
    font-size: 1.2em;
    margin-bottom: 5px;
}

/* Tab Panel Content Area */
.category-content {
    padding: 30px;
    min-height: 300px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Project Cards Grid - 通用佈局 */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    min-height: 200px;
    padding-bottom: 10px;
}

/* Project Card - 基礎樣式（適用所有主題） */
.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-card:hover:not(.disabled):not(.tearing) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--shadow-medium);
    text-decoration: none;
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* 通用卡片內部結構 */
.project-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.project-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: white;
    flex-shrink: 0;
}

.project-card[data-topic="learning"] .project-icon { 
    background: linear-gradient(135deg, var(--learning-color), var(--learning-color-dark)); 
}
.project-card[data-topic="career"] .project-icon { 
    background: linear-gradient(135deg, var(--career-color), var(--career-color-dark)); 
}
.project-card[data-topic="travel"] .project-icon { 
    background: linear-gradient(135deg, var(--travel-color), var(--travel-color-dark)); 
}
.project-card[data-topic="others"] .project-icon { 
    background: linear-gradient(135deg, var(--others-color), var(--others-color-dark)); 
}

.project-info {
    flex: 1;
    min-width: 0;
}

.project-title {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.project-subtitle {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: calc(1.4em * 2);
}

.project-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    font-size: 0.8em;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 0.75em;
    font-weight: 600;
}

.status-completed { background: rgba(39, 174, 96, 0.1); color: #27ae60; }
[data-theme="dark"] .status-completed { color: #48bb78; }
.status-progress { background: rgba(243, 156, 18, 0.1); color: #f39c12; }
[data-theme="dark"] .status-progress { color: #f6ad55; }
.status-planned { background: rgba(231, 76, 60, 0.1); color: #e74c3c; }
[data-theme="dark"] .status-planned { color: #fc8181; }

.project-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.view-count {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 0.9em;
}

.difficulty-badge {
    background: var(--bg-card);
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.75em;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ==================== 撕開卡片效果（可為任何主題啟用）==================== */

/* 啟用撕開效果的卡片：添加 .tear-card class */
.project-card.tear-card {
    border-radius: 16px;
    padding: 0;
    overflow: visible;
    position: relative;
}

/* 卡片背景圖片層 */
.project-card.tear-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--card-image);
    background-size: cover;
    background-position: center;
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.project-card.tear-card:hover::before {
    opacity: 1;
}

/* 卡片正面遮罩層 */
.project-card.tear-card .card-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    border-radius: 16px;
    transition: clip-path 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    min-height: 200px; 
}

/* Hover 時右上角撕開效果 */
.project-card.tear-card:hover .card-mask {
    clip-path: polygon(
        0 0, 
        55% 0,
        100% 45%,
        100% 100%, 
        0 100%
    );
}

/* 點擊時完整撕開動畫 */
.project-card.tear-card.tearing .card-mask {
    animation: tearAway 0.6s cubic-bezier(0.6, 0, 0.4, 1) forwards;
}

@keyframes tearAway {
    0% {
        clip-path: polygon(0 0, 55% 0, 100% 45%, 100% 100%, 0 100%);
        opacity: 1;
    }
    50% {
        clip-path: polygon(0 0, 70% 0, 100% 30%, 100% 100%, 0 100%);
        transform: translateX(-5px) rotate(-2deg);
        opacity: 0.8;
    }
    100% {
        clip-path: polygon(0 0, 0 0, 0 100%, 0 100%, 0 100%);
        transform: translateX(-100%) rotate(-15deg);
        opacity: 0;
    }
}

/* 調整撕開卡片內容佈局 */
.project-card.tear-card .card-mask .project-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
}

.project-card.tear-card .project-icon {
    width: 45px;
    height: 45px;
    font-size: 1.3em;
}

.project-card.tear-card .project-title {
    font-size: 1.05em;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-card.tear-card .project-subtitle {
    font-size: 0.8em;
    -webkit-line-clamp: 2;
    min-height: auto;
}

.project-card.tear-card .card-mask > div:last-child {
    position: relative;
    z-index: 2;
}

.project-card.tear-card .project-meta {
    margin: 10px 0;
    gap: 8px;
    font-size: 0.75em;
}

.project-card.tear-card .project-stats {
    padding-top: 12px;
    margin-top: 0;
}

/* 撕開邊緣的紙張質感 */
.project-card.tear-card:hover .card-mask::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 80px;
    height: 80px;
    background: linear-gradient(
        135deg,
        transparent 40%,
        rgba(0, 0, 0, 0.1) 40%,
        rgba(0, 0, 0, 0.05) 50%,
        transparent 50%
    );
    clip-path: polygon(55% 0, 100% 0, 100% 45%);
    pointer-events: none;
    z-index: 3;
}

/* 調整撕開卡片 hover 效果 */
.project-card.tear-card:hover:not(.tearing) {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 30px var(--shadow-medium);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card.tear-card:active:not(.tearing) {
    transform: translateY(-2px) scale(1.01);
}

/* ==================== 撕開卡片效果結束 ==================== */

/* Code Blocks */
.code-container {
    position: relative;
    margin: 25px 0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #333;
    color: #ccc;
    padding: 10px 18px;
    border-radius: 10px 10px 0 0;
    border-bottom: 1px solid #555;
}

[data-theme="dark"] .code-header {
    background: #1a1a1a;
    border-bottom: 1px solid var(--border-color);
}

.code-label {
    font-size: 0.85em;
    color: #aaa;
}

[data-theme="dark"] .code-label { 
    color: #888; 
}

.copy-btn {
    background: #444;
    border: 1px solid #666;
    color: #ccc;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.3s ease;
}

[data-theme="dark"] .copy-btn {
     background: var(--bg-secondary);
     border: 1px solid var(--border-color);
     color: var(--text-secondary);
}

.copy-btn:hover {
    background: #555;
    color: #fff;
    border-color: #777;
}

[data-theme="dark"] .copy-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.copy-btn.copied {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

.code-block {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 18px;
    border-radius: 0 0 10px 10px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.5;
    border: 1px solid #555;
    border-top: none;
}

[data-theme="dark"] .code-block {
     border: 1px solid var(--border-color);
     border-top: none;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Syntax Highlighting */
.keyword { color: #ff79c6; font-weight: bold; }
.string { color: #f1fa8c; }
.comment { color: #6272a4; font-style: italic; }
.number { color: #bd93f9; }
.function { color: #50fa7b; }
.type { color: #8be9fd; }

/* Inline Code */
code {
    background: #f0f0f0;
    color: #c7254e;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875em;
    border: 1px solid #e0e0e0;
}

[data-theme="dark"] code {
    background: #2d3748;
    color: #9cdcfe;
    border: 1px solid var(--border-color);
}

/* Highlight/Note Boxes */
.highlight-box, .warning-box, .success-box, .danger-box, .note-box {
    border-left-width: 4px;
    border-left-style: solid;
    border-radius: 8px;
    padding: 18px;
    margin: 20px 0;
    background-color: var(--bg-secondary);
}

.highlight-box { border-left-color: var(--accent-primary); }
.warning-box { border-left-color: #f39c12; background-color: rgba(243, 156, 18, 0.05);}
[data-theme="dark"] .warning-box { background-color: rgba(246, 173, 85, 0.08); }
.success-box { border-left-color: #27ae60; background-color: rgba(39, 174, 96, 0.05); }
[data-theme="dark"] .success-box { background-color: rgba(72, 187, 120, 0.08); }
.danger-box { border-left-color: #e74c3c; background-color: rgba(231, 76, 60, 0.05); }
[data-theme="dark"] .danger-box { background-color: rgba(252, 129, 129, 0.08); }
.note-box { border-left-color: #95a5a6; background-color: rgba(149, 165, 166, 0.05); }
[data-theme="dark"] .note-box { background-color: rgba(113, 128, 150, 0.08); }

.highlight-title, .warning-title, .success-title, .danger-title, .note-title {
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1em;
}

.highlight-title { color: var(--accent-primary); }
.warning-title { color: #f39c12; }
.success-title { color: #27ae60; }
.danger-title { color: #e74c3c; }
.note-title { color: #7f8c8d; }
[data-theme="dark"] .note-title { color: #a0aec0; }

.highlight-title::before { content: '💡'; }
.warning-title::before { content: '⚠️'; }
.success-title::before { content: '✅'; }
.danger-title::before { content: '❌'; }
.note-title::before { content: 'ℹ️'; }

/* Lists */
.bullet-list {
    list-style: none;
    margin: 15px 0;
}

.bullet-list li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.bullet-list li::before {
    content: '•';
    color: var(--accent-primary);
    font-weight: bold;
    position: absolute;
    left: 5px;
    font-size: 1.2em;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0.8;
}

.empty-icon {
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.6;
    animation: float 3s ease-in-out infinite alternate;
}

.empty-title {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.empty-desc {
    font-size: 0.95em;
    max-width: 380px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

.update-hint {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.8em;
    color: var(--accent-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@keyframes float {
    0% { transform: translateY(-5px); }
    100% { transform: translateY(5px); }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    border-top-color: transparent;
    border-right-color: transparent;
    animation: spin 0.8s linear infinite;
}

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

/* Header & Navigation (Root index.html) */
header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px var(--shadow-light);
    margin-bottom: 0;
    border-radius: 0;
}

header .container {
    padding-top: 0;
    padding-bottom: 0;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 32px;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    position: relative;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: width 0.2s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Main Content Padding */
main {
     padding: 40px 0;
}

main .container {
     padding-left: 20px;
     padding-right: 20px;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 50px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

/* About Section */
.about-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
}

.about-section h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

.about-content {
    max-width: 600px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.about-content p {
    margin-bottom: 16px;
}

/* Categories Grid */
.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.category-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px var(--shadow-medium);
    transform: translateY(-2px);
}

.category-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 16px;
    color: white;
}

a[href*="Learning"] .category-icon { 
    background: linear-gradient(135deg, var(--learning-color), var(--learning-color-dark)); 
}
a[href*="Career"] .category-icon { 
    background: linear-gradient(135deg, var(--career-color), var(--career-color-dark)); 
}
a[href*="Travel"] .category-icon { 
    background: linear-gradient(135deg, var(--travel-color), var(--travel-color-dark)); 
}
a[href*="Others"] .category-icon { 
    background: linear-gradient(135deg, var(--others-color), var(--others-color-dark)); 
}

.category-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.category-card p {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.category-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Hot Projects Section */
.projects-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 35px;
    margin-bottom: 40px;
}

.projects-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.projects-section h2::before {
    content: "🔥";
    font-size: 1.1em;
}

.projects-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 25px;
    line-height: 1.5;
}

.project-list {
    display: grid;
    gap: 16px;
}

/* Hot Project Item */
.project-item {
    display: flex;
    align-items: center;
    padding: 22px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.project-item:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 6px 20px var(--shadow-medium);
    transform: translateY(-3px);
    text-decoration: none;
    color: var(--text-primary);
}

.project-rank {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    margin-right: 18px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.project-rank.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.project-rank.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #8c8c8c);
    color: #fff;
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.4);
}

.project-rank.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    color: #fff;
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.4);
}

.project-item .project-info { 
    flex: 1; 
    min-width: 0; 
}

.project-item .project-name { 
    font-weight: 600; 
    color: var(--text-primary); 
    margin-bottom: 6px; 
    font-size: 1.1rem; 
    line-height: 1.3; 
}

.project-item .project-desc { 
    color: var(--text-secondary); 
    font-size: 0.9rem; 
    margin-bottom: 8px; 
    line-height: 1.4; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
}

.project-item .project-meta { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    font-size: 0.8rem; 
    color: var(--text-muted); 
    flex-wrap: wrap; 
}

/* Category Badges */
.category-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-badge.learning { 
    background: rgba(52, 152, 219, 0.15); 
    color: var(--learning-color); 
}
.category-badge.career { 
    background: rgba(39, 174, 96, 0.15); 
    color: var(--career-color); 
}
.category-badge.travel { 
    background: rgba(230, 126, 34, 0.15); 
    color: var(--travel-color); 
}
.category-badge.others { 
    background: rgba(142, 68, 173, 0.15); 
    color: var(--others-color); 
}

.project-item .project-stats { 
    text-align: right; 
    flex-shrink: 0; 
    margin-left: 20px; 
}

.project-item .project-views { 
    font-size: 1.1rem; 
    font-weight: 700; 
    color: var(--accent-primary); 
    margin-bottom: 2px; 
}

.project-item .project-status { 
    font-size: 0.75rem; 
    color: var(--text-muted); 
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    text-align: center;
    background: var(--bg-secondary);
}

footer .container {
     padding-left: 20px;
     padding-right: 20px;
}

.footer-content {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.contact-info {
    margin-top: 15px;
}

.contact-info a {
    color: var(--accent-primary);
    text-decoration: none;
}

.contact-info a:hover {
    text-decoration: underline;
}

/* Mobile Navigation Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px;
    z-index: 110;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) { 
    transform: translateY(6px) rotate(45deg); 
}
.mobile-menu-btn.active span:nth-child(2) { 
    opacity: 0; 
}
.mobile-menu-btn.active span:nth-child(3) { 
    transform: translateY(-6px) rotate(-45deg); 
}

/* Fade-in Animation */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    header .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    main .container {
         padding-left: 15px;
         padding-right: 15px;
    }
    
    footer .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 4px 6px var(--shadow-light);
        border-top: 1px solid var(--border-color);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        gap: 0;
        z-index: 105;
    }

    .nav-links.mobile-active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-links li {
        margin-bottom: 15px;
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-color);
        text-align: center;
    }
    
    .nav-links li:last-child a { 
        border-bottom: none; 
    }

    .nav-links a::after {
        display: none;
    }

    .nav-links li:last-child { 
        margin-bottom: 0; 
    }

    .hero h1 { 
        font-size: 2rem; 
    }
    
    .hero-subtitle { 
        font-size: 1.1rem; 
    }

    .about-section,
    .projects-section { 
        padding: 25px 20px; 
    }

    .category-card { 
        padding: 25px; 
    }
    
    .categories { 
        grid-template-columns: 1fr; 
        gap: 20px; 
    }

    .project-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 20px;
    }

    .project-rank {
        align-self: flex-start;
        margin-right: 0;
        margin-bottom: 5px;
    }

    .project-item .project-stats {
        align-self: stretch;
        text-align: left;
        margin-left: 0;
        margin-top: 10px;
    }

    .project-item .project-meta { 
        gap: 8px; 
    }
    
    /* 撕開卡片響應式 */
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 18px;
    }
    
    .project-card.tear-card .card-mask {
        padding: 16px;
        min-height: 180px; 
    }
    
    .project-card.tear-card .project-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
    
    .project-card.tear-card .project-title {
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
    .hero h1 { 
        font-size: 1.8rem; 
    }
    
    .page-title { 
        font-size: 1.6em; 
    }
    
    .chapter-title { 
        font-size: 1.4em; 
    }

    .category-card, 
    .project-card:not(.tear-card), 
    .project-item { 
        padding: 15px; 
    }
    
    .category-icon, 
    .project-card:not(.tear-card) .project-icon { 
        width: 40px; 
        height: 40px; 
        font-size: 1.2rem; 
    }
    
    /* 撕開卡片響應式 */
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .project-card.tear-card .card-mask {
        padding: 14px;
        min-height: 160px;
    }


}