/* ==================== */
/* 全局樣式 */
/* ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #0F4C28;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
    font-size: 16px;
    line-height: 1.65;
}

.container {
    margin: 0 auto;
    width: 100%;
}

/* ==================== */
/* 動畫效果 */
/* ==================== */
/* 雪花飄落動畫 */
.snowflake {
    position: fixed;
    top: -10px;
    color: white;
    font-size: 1em;
    font-family: Arial, sans-serif;
    text-shadow: 0 0 5px #fff;
    pointer-events: none;
    z-index: 1;
    animation: fall linear infinite;
}

@keyframes fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0.3;
    }
}

/* ==================== */
/* 頭頂招牌 */
/* ==================== */
.header {
    text-align: center;
    background: #8B0000;
    padding: 30px 15px;
    color: #FFFFF0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    overflow: hidden;
    position: relative;
    font-weight: bold;
}

.header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            45deg,
            rgba(139, 94, 60, 0.1) 0px,
            rgba(139, 94, 60, 0.1) 2px,
            transparent 2px,
            transparent 4px
        ),
        repeating-linear-gradient(
            -45deg,
            rgba(166, 124, 82, 0.1) 0px,
            rgba(166, 124, 82, 0.1) 2px,
            transparent 2px,
            transparent 4px
        );
}

.header h1 {
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-size: 2.5rem;
    z-index: 2;
    position: relative;
}

.welcome-text {
    font-size: 1.1rem;
    color: #FFFFF0;
    margin: 10px 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    z-index: 2;
    position: relative;
}

/* ==================== */
/* 選單列 */
/* ==================== */
.menu {
    background-color: #165B33;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.menu a {
    color: #FFFFF0;
    text-decoration: none;
    padding: 5px 10px;
    transition: all 0.3s ease;
    font-weight: bold;
    z-index: 2;
}

.menu a:hover, 
.menu a.active {
    color: #FFFFF0;
    background-color: #0F4C28;
    border-radius: 3px;
}

/* ==================== */
/* 文章列表 */
/* ==================== */
.content {
    max-width: 815px;
    padding: 0 15px;
    margin: 40px auto 0 auto;
    position: relative;
    z-index: 2;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-card {
    padding: 20px;
    background: white;
    border-radius: 10px;
    transition: transform 0.2s ease;
}

.post-title {
    color: #C41E3A;
    font-size: clamp(1.4rem, 3vw, 1.5rem);
    margin-bottom: 10px;
    padding-right: 44px; /* 預留右側空間給節慶圖示 */
    border-bottom: 2px solid #165B33;
    border-image: repeating-linear-gradient(
        90deg,
        #ff4d4d 0 10px,
        transparent 10px 14px,
        #ffd54f 14px 24px,
        transparent 24px 28px,
        #4caf50 28px 38px,
        transparent 38px 42px
    ) 1;
    padding-bottom: 5px;
    font-weight: bold;
    position: relative;
}

.post-title::after {
    content: "⛄";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.post-title a {
    color: inherit;
    text-decoration: none;
}

.post-title a:hover {
    color: inherit;
    text-decoration: underline;
}

.post-meta {
    font-size: 0.9rem;
    color: #8b5e3c;
    margin-bottom: 16px;
    font-weight: bold;
}

.post-content p {
    color: black;
    margin-top: 16px;
    line-height: 1.8;
}

.post-content a {
    color: blue;
    text-decoration: none;
}

.post-content a:focus,
.post-content a:hover {
    text-decoration: underline;
}

.post-content ul, 
.post-content ol {
    margin-top: 10px;
    padding-left: 30px;
    list-style-position: outside;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.post-content ul > li > ul, 
.post-content ol > li > ul {
    margin: 8px 0;
}

.post-content ul > li > p, 
.post-content ol > li > p {
    margin: 8px 0;
}

.blog-list li {
    margin-top: 10px;
}

.post-content img {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    padding: 6px;
    margin-top: 14px;
}

.post-content figure {
    margin: 1rem auto;
    text-align: center;
}

/* 標題樣式 */
.post-content h3 {
    margin: 1.2em 0 0.5em 0;
    color: #155a15;
    font-size: 1.3rem;
}

.post-content h4 {
    margin: 1.2em 0 0.4em 0;
    color: #155a15;
    font-size: 1.1rem;
}

/* 程式碼區塊 */
.post-content code {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 3px 5px;
    font-family: monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.post-content pre code {
    background-color: #fafafa;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 16px 0;
    font-family: "Fira Code", Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    display: block;
    overflow-x: auto;
}

/* 引用區塊 */
.post-content blockquote {
    border-left: 4px solid #d4a276;
    padding-left: 1em;
    margin-left: 0;
}

/* 表格 */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.95rem;
    background-color: #fffef9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #d4a276;
    border-radius: 6px;
    overflow: hidden;
}

.post-content thead {
    background-color: #f7e7d3;
    color: #5B3C1E;
}

.post-content thead th {
    text-align: left;
    padding: 12px 16px;
    font-weight: bold;
    border-bottom: 1px solid #d4a276;
}

.post-content tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0e0cb;
    color: #333;
}

.post-content tbody tr:nth-child(even) {
    background-color: #fdf6ef;
}

.post-content tbody tr:hover {
    background-color: #f3e7d9;
}

/* 分隔線 */
.post-content hr {
    border: 0;
    height: 0;
    border-top: 2px dashed #d4a276;
    margin: 18px 0;
    opacity: 0.9;
}

/* ==================== */
/* 底部資訊 */
/* ==================== */
.footer {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
    background: linear-gradient(180deg, transparent 0%, rgba(15, 76, 40, 0.3) 100%);
    position: relative;
}

/* ==================== */
/* 響應式設計 */
/* ==================== */
@media (max-width: 600px) {
    .content {
        max-width: unset;
        margin: 0;
        padding: 0 8px;
        position: relative;
        z-index: 2;
    }

    .post-card {
        padding: 15px;
    }
}
