/* تنظیمات اولیه */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: #e8d8bd;
    font-family: Georgia, serif;
   

    display: flex;
    justify-content: center;
    align-items: center;

    overflow-x: hidden;
}

.container {
    width: 100%;
    text-align: center;
    padding: 30px 15px;
}

h1 {
    color: #70452f;
    font-size: 30px;
    margin-bottom: 12px;
}

.subtitle {
    color: #96765a;
    margin-bottom: 75px;
}

/* مخفی کردن چک باکس */
#open {
    display: none;
}

/* محفظه پاکت */
.envelope {
    position: relative;
    width: 320px;
    height: 210px;
    margin: 0 auto;
    perspective: 1000px;
}

/* پشت پاکت */
.envelope-back {
    position: absolute;
    inset: 0;
    background: #9c6845;
    border-radius: 4px;
    z-index: 1;
}

/* کاغذ نامه */
.letter {
    position: absolute;

    width: 285px;
    height: 190px;

    left: 17px;
    top: 10px;

    background: #fff5df;
    border: 1px solid #c5a77d;

    padding: 25px 20px;

    color: #63452e;
    text-align: right;
    line-height: 1.9;
    font-size: 13px;

    overflow: hidden;

    z-index: 2;

    transform: translateY(0);

    transition:
        transform 1s ease,
        height 1s ease;
}

/* عنوان نامه */
.letter h2 {
    text-align: center;
    color: #8d4b3b;
    font-size: 19px;
    margin-bottom: 15px;
}

/* متن نامه */
.letter p {
    margin-bottom: 12px;
}

/* امضا */
.end {
    text-align: left;
    color: #9a5142;
    font-weight: bold;
    margin-top: 20px;
}

/* جلوی پاکت */
.envelope-front {
    position: absolute;
    inset: 0;

    background: #b47c51;

    clip-path: polygon(
        0 0,
        50% 55%,
        100% 0,
        100% 100%,
        0 100%
    );

    z-index: 3;
}

/* در پاکت */
.flap {
    position: absolute;
    inset: 0;

    background: #c28c60;

    clip-path: polygon(
        0 0,
        100% 0,
        50% 65%
    );

    transform-origin: top;
    transition: transform 0.8s ease;

    z-index: 5;
}

/* مهر مومی */
.seal {
    position: absolute;

    left: 50%;
    top: 50%;

    transform: translate(-50%, -50%);

    width: 45px;
    height: 45px;

    border-radius: 50%;

    background: #823d37;
    color: #f5d6ad;

    display: flex;
    justify-content: center;
    align-items: center;

    font-size: 30px;

    z-index: 6;

    transition: opacity 0.4s;
}

/* دکمه باز کردن */
.open-button {
    display: inline-block;

    margin-top: 55px;

    background: #75472f;
    color: white;

    padding: 12px 30px;

    border-radius: 25px;

    cursor: pointer;

    font-size: 14px;

    transition: background 0.3s;
}

.open-button:hover {
    background: #9b6244;
}

/* انیمیشن باز شدن در پاکت */
#open:checked ~ .envelope .flap {
    transform: rotateX(180deg);
    z-index: 2;
}

/* بیرون آمدن نامه */
#open:checked ~ .envelope .letter {
    height: 360px;
    transform: translateY(-170px);

    transition-delay: 0.6s;

    z-index: 4;

    overflow-y: auto;
}

/* ناپدید شدن مهر */
#open:checked ~ .envelope .seal {
    opacity: 0;
}

/* تغییر دکمه بعد از کلیک */
#open:checked ~ .open-button {
    opacity: 0.5;
    pointer-events: none;
}

/* نوشته پایین صفحه */
.footer {
    margin-top: 35px;
    color: #997354;
    font-style: italic;
    font-size: 13px;
}

/* موبایل */
@media (max-width: 400px) {

    .envelope {
        transform: scale(0.9);
    }

    h1 {
        font-size: 25px;
    }

}