/* 基礎設定 */
/* 讓中文呼吸感更好，不那麼擁擠 */
body {
    background-color: #050505;
    color: #E2E8F0;
    overflow-x: hidden;
    
    /* 新增這兩行 */
    letter-spacing: 0.025em; /* 字距微寬 */
    line-height: 1.7;        /* 行高拉開 */
    
    /* 讓字體渲染更清晰 (抗鋸齒) */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 導覽列磨砂玻璃效果 */
.glass {
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}


.bento-item, .project-card-vertical {
    position: relative;
    /* 1. 關鍵：背景設為透明，直接看見網頁底部的點點矩陣 */
    background: transparent !important;
    /* 2. 徹底移除任何邊框 */
    border: none !important;
    /* 3. 移除陰影（只在懸停時出現） */
    box-shadow: none !important;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 愛心噴發特效 --- */
.heart-particle {
    position: fixed; /* 固定在視窗上，不受父容器 overflow 限制 */
    pointer-events: none; /* 讓滑鼠可以穿透，不會擋到點擊 */
    z-index: 9999;
    font-size: 20px;
    line-height: 1;
    user-select: none;
    /* 初始狀態：在中心 */
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
    animation: heart-explode 1s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes heart-explode {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        /* var(--tx) 和 var(--ty) 由 JS 隨機產生 */
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.5) rotate(var(--rot));
        opacity: 0;
    }
}

/* 聯繫卡片專用懸停 */
.contact-card-bento {
    background: #0A0A0A;
    border: 1.5px solid rgba(191, 148, 255, 0); 
    transition: all 0.5s ease;
}

.contact-card-bento:hover {
    border-color: rgba(191, 148, 255, 0.6) !important;
    box-shadow: 0 0 30px 4px rgba(191, 148, 255, 0.25);
}

/* 垂直專案卡片樣式 */
.project-card-vertical {
    background: #0A0A0A !important;
    border: none;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
    border-radius: 1.5rem;
    overflow: visible;
}

.project-card-vertical:hover {
    transform: translateY(-8px);
    box-shadow: 0 0 40px 6px rgba(191, 148, 255, 0.2);
    background: #0A0A0A;
}

/* 漸層文字效果 */
.text-gradient {
    background: linear-gradient(135deg, #FFFFFF 0%, #BF94FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 背景裝飾點點 */
.dot-pattern {
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* 滾動條美化 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #050505; }
::-webkit-scrollbar-thumb { background: #222; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #333; }


/* --- 打字機游標動畫 (控制透明度) --- */
@keyframes blink-cursor {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* --- 打字機容器設定 (預設：手機版) --- */
.animate-typewriter {
    display: inline;       /* 手機版：讓文字自然流動 */
    white-space: pre-wrap; /* 手機版：允許自動換行 */
    overflow: visible;     /* 允許內容顯示 */
    border-right: none;    /* 移除舊版邊框游標 */
    position: relative;
    word-break: break-word; /* 確保長單字換行 */
}

/* --- 游標設定 (使用偽元素，手機電腦通用) --- */
.animate-typewriter::after {
    content: '';
    display: inline-block;
    width: 3px;            /* 游標寬度 */
    height: 1.2em;         /* 游標高度 */
    background-color: #BF94FF; /* 紫色 */
    margin-left: 4px;      /* 距離文字 */
    vertical-align: sub;   /* 對齊微調 */
    animation: blink-cursor 0.9s step-end infinite;
}

/* --- 電腦版覆寫 (螢幕大於 768px 時) --- */
@media (min-width: 768px) {
    .animate-typewriter {
        white-space: nowrap; /* 電腦版：強制不換行 */
    }
}


/* --- 標題閃爍特效 --- */
@keyframes title-flash {
    0% {
        color: inherit;
        text-shadow: none;
    }
    20% {
        color: #BF94FF; /* 變成亮紫色 */
        text-shadow: 0 0 15px rgba(191, 148, 255, 0.6); /* 發光 */
    }
    100% {
        color: inherit;
        text-shadow: none;
    }
}

.flash-active {
    /* 1秒內執行完畢，easeInOut讓效果柔和 */
    animation: title-flash 1s cubic-bezier(0.4, 0, 0.2, 1); 
}

.number-particle {
    position: fixed;
    pointer-events: none;
    z-index: 10000; /* 比愛心層級更高，確保在最上面 */
    font-family: 'Fredoka', sans-serif; 
    font-weight: 600;
    font-size: 10px; /* 字體變小 (原本 24px -> 改成 16px) */
    color: #BF94FF; /* 使用你的主題紫色 */
    text-shadow: 0 0 10px rgba(191, 148, 255, 0.8); /* 發光 + 黑描邊確保清晰 */
    
    /* 初始置中 */
    transform: translate(-50%, -50%);
    
    /* 執行動畫 */
    animation: number-float-up 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes number-float-up {
    0% {
        transform: translate(-50%, -50%) scale(0.5); /* 一開始很小 */
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -25px) scale(1.5); /* 瞬間變大並往上衝 */
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -100px) scale(1); /* 慢慢繼續往上並消失 */
        opacity: 0;
    }
}

/* --- 無障礙：焦點樣式 --- */
button:focus-visible,
a:focus-visible {
    outline: 2px solid #BF94FF;
    outline-offset: 2px;
}

/* --- 動畫減少偏好 --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
