/* ===== 1. 基礎設定 ===== */

/* 顏色設定 */
:root {
    --text-main: rgb(47, 79, 79);
    --text-poem: rgb(68, 68, 68);
}

/* 全局樣式 */
body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
    overflow-x: hidden;

    background-color: #f4f7f6;
    /* 加入背景點點 */
    background-image: radial-gradient(var(--text-main) 0.4px, transparent 0.8px);
    background-size: 30px 30px;
    background-attachment: fixed;
    
    font-size: 16px;
    color: rgb(51, 51, 51);
    font-family: 'Noto Serif TC', "PMingLiU", "標楷體", cursive;
}


/* ===== 2. 佈局與元件 ====== */

/* 標題樣式 */
h1 {
    display: inline-block;  /* 讓底線寬度符合文字寬度 */
    padding-bottom: 0.3rem;
    margin: 5rem;

    font-size: 4rem;
    font-weight: 1000;
    letter-spacing: 0.5rem;
    color: var(--text-main);
    border-bottom: 0.25rem solid var(--text-main);
}

/* 返回主頁連結樣式 */
.back-link {
    margin-bottom: 5rem;
    font-size: 1rem;
    text-decoration: none;  /* 移除下劃線 */
    color: #708090;
    transition: color 0.5s ease;
}

/* 返回主頁連結懸停效果 */
.back-link:hover {
    color: var(--text-main);
    text-decoration: underline;
}

/* 詩詞卡片樣式 */
.poem-card {
    position: relative;
    padding: 5rem;
    margin-bottom: 5rem;

    width: 40vw;
    border-radius: 8px;

    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    border-left: 5px solid var(--text-main);
    border-right: 5px solid var(--text-main);
    text-align: center;

    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    animation: fadeInUp 1s ease-out forwards;
}

/* 詩詞卡片懸停效果 */
.poem-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(47, 79, 79, 0.7);
}

/* 詩詞卡片裝飾符號 */
.poem-card::after {
    content: "◈";
    display: block;
    margin-top: 2rem;
    color: var(--text-main);
    opacity: 0.5;
    font-size: 1.5em;
} 

/* 詩詞標題樣式 */
.poem-card h2 {
    margin-bottom: 2rem;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-poem);
}

/* 詩詞標題佈局 */
.poem-title {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    letter-spacing: 0.5rem;
}

.poem-title span:not(.divider) {
    flex: 1;    /* 平分空間 */
}

.poem-title .title-text {
    text-align: right;  /* 文字向右對齊 */
}

.poem-title .author {
    text-align: left;   /* 文字向左對齊 */
    font-size: 0.9em;
    opacity: 0.8;
}

.poem-title .divider {
    flex: 0 0 45px; /* 固定寬度 */
    height: 1px;    /* 高度1px -> 劃一條線 */
    background-color: var(--text-main);
}

/* 詩詞內容樣式 */
.poem-card p {
    margin-top: 1.5rem;
    font-size: 1.3rem;
    font-weight: 400;
    letter-spacing: 0.3rem;
    line-height: 4rem;
}


/* ===== 3. 動畫定義 ====== */

/* 詩詞卡片上升動畫 */
@keyframes fadeInUp {
    /* 從透明到不透明，從下到上 */
    from {
        opacity: 0;
        transform: translateY(1.5rem);;
    }
    to {
        opacity: 1;
        transform: translateY(0);;
    }
}