@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=Noto+Serif+SC:wght@300;400;700&display=swap');

:root {
    --primary-color: #2F4F4F;
    --accent-color: #4A766E;
    --text-color: #2F4F4F;
    --paper-color: rgba(250, 252, 250, 0.92);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Serif SC', serif;
    background-image: url('./background_elegant.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    color: var(--text-color);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(2px);
    z-index: 0;
}

.card {
    position: relative;
    z-index: 10;
    background: var(--paper-color);
    padding: 60px 80px;
    border-radius: 4px;
    box-shadow: 0 15px 35px rgba(47, 79, 79, 0.1),
        inset 0 0 60px rgba(255, 255, 255, 0.6);
    max-width: 900px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateY(20px);
    opacity: 0;
    animation: floatIn 1.5s ease-out forwards;
    position: relative;
}

/* Decorative borders */
.card::before,
.card::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-color);
    transition: all 0.5s ease;
}

.card::before {
    top: 20px;
    left: 20px;
    border-right: none;
    border-bottom: none;
}

.card::after {
    bottom: 20px;
    right: 20px;
    border-left: none;
    border-top: none;
}

.title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 3.5rem;
    margin-bottom: 2rem;
    color: var(--accent-color);
    border-bottom: 2px solid rgba(74, 118, 110, 0.3);
    padding-bottom: 10px;
    letter-spacing: 4px;
}

.content {
    display: flex;
    /* Traditional vertical writing mode */
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 1.5rem;
    line-height: 2.2;
    height: 300px;
    /* Fixed height to force wrap into columns */
    flex-wrap: wrap;
    /* Essential for forming columns */
    align-content: center;
    /* Center the columns horizontally */
    letter-spacing: 0.5rem;
    gap: 1.5rem;
}

.verse {
    opacity: 0;
    animation: fadeIn 1s ease-out forwards;
}

/* Stagger animations - sequential right-to-left appearance */
.verse:nth-child(1) {
    animation-delay: 0.5s;
}

.verse:nth-child(2) {
    animation-delay: 1.0s;
}

.verse:nth-child(3) {
    animation-delay: 1.5s;
}

.verse:nth-child(4) {
    animation-delay: 2.0s;
}

.verse:nth-child(5) {
    animation-delay: 2.5s;
}

.verse:nth-child(6) {
    animation-delay: 3.0s;
}

.verse:nth-child(7) {
    animation-delay: 3.5s;
}

.verse:nth-child(8) {
    animation-delay: 4.0s;
}

.seal {
    margin-top: 30px;
    width: 60px;
    height: 60px;
    border: 3px solid #b71c1c;
    color: #b71c1c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.2rem;
    border-radius: 4px;
    writing-mode: horizontal-tb;
    /* Reset for seal */
    opacity: 0;
    animation: sealStamp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 4s;
    transform: rotate(-5deg);
}

.footer {
    position: absolute;
    bottom: 20px;
    font-size: 0.8rem;
    color: rgba(62, 39, 35, 0.6);
    writing-mode: horizontal-tb;
}

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

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

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

@keyframes sealStamp {
    from {
        transform: scale(3) rotate(10deg);
        opacity: 0;
    }

    to {
        transform: scale(1) rotate(-5deg);
        opacity: 0.8;
    }
}

/* Responsiveness for mobile */
@media (max-width: 768px) {
    .content {
        writing-mode: horizontal-tb;
        height: auto;
        text-align: center;
        flex-direction: column;
        gap: 1rem;
        line-height: 1.8;
    }

    .card {
        padding: 40px 20px;
        width: 90%;
    }

    .title {
        font-size: 2.5rem;
    }
}