/* ====================================================
   ELEGANT ENVELOPE - Luxury 4-Flap Design
   All tips converge at center under the seal
   ==================================================== */

/* Оверлей на весь экран */
.envelope-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--main-font);
    color: var(--accent-gold);
    opacity: 1;
}

/* --- ОБЩИЕ СТИЛИ КЛАПАНОВ --- */
.flap {
    position: absolute;
    transition: transform 1.2s cubic-bezier(0.65, 0, 0.35, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- ВЕРХНИЙ КЛАПАН (треугольник вниз) --- */
.top-flap {
    top: 0;
    left: 0;
    width: 100%;
    height: 55%;
    /* Slightly larger to ensure overlap */
    z-index: 5;
    transform-origin: top center;
    pointer-events: none;
    /* Let clicks pass through to seal if needed */
}

.flap-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8vh;
    width: 100%;
    position: relative;
    z-index: 2;
}

/* Монограмма */
.monogram-box {
    width: 80px;
    height: 100px;
    border: 1px solid var(--accent-gold);
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    opacity: 0.9;
}

.monogram-text {
    font-family: var(--decorative-font);
    font-size: 1.5rem;
    color: var(--accent-gold);
    line-height: 1.2;
    text-align: center;
}

/* Заголовки */
.title-script {
    font-family: var(--decorative-font);
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 400;
    margin: 0;
    line-height: 1;
    color: var(--white);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.subtitle-serif {
    font-family: var(--main-font);
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    font-weight: 300;
    text-transform: lowercase;
    margin-top: 5px;
    letter-spacing: 0.15em;
    color: var(--accent-gold);
    opacity: 0.9;
}

/* --- НИЖНИЙ КЛАПАН (треугольник вверх) --- */
.bottom-flap {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 55%;
    z-index: 4;
    transform-origin: bottom center;
    pointer-events: none;
}

.bottom-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 8vh;
    text-align: center;
    width: 100%;
    height: 100%;
}

.info-block {
    text-align: center;
}

.info-block p {
    margin: 6px 0;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-weight: 300;
    letter-spacing: 0.08em;
    color: var(--accent-gold);
}

.info-block .date {
    font-style: italic;
}

.star-deco {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 1rem;
    color: var(--accent-gold);
    opacity: 0.5;
}

/* --- ЛЕВЫЙ КЛАПАН --- */
.left-flap {
    left: 0;
    top: 0;
    width: 55%;
    height: 100%;
    z-index: 3;
    transform-origin: left center;
    pointer-events: none;
}

.left-content {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding-left: 6vw;
    height: 100%;
}

/* --- ПРАВЫЙ КЛАПАН --- */
.right-flap {
    right: 0;
    top: 0;
    width: 55%;
    height: 100%;
    z-index: 3;
    transform-origin: right center;
    pointer-events: none;
}

.right-content {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 6vw;
    height: 100%;
}

/* --- SVG STYLES --- */
.flap-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Drop shadow applied to the SVG shape */
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.4));
    overflow: visible;
    /* Allow stroke to be fully visible */
}

.flap-svg path {
    fill: var(--primary-green);
    stroke: var(--accent-gold);
    stroke-width: 2px;
    /* Increased for visibility */
    stroke-linejoin: round;
    /* Rounded corners at path joins */
    stroke-linecap: round;
    /* Rounded line endings */
    vector-effect: non-scaling-stroke;
    /* Keep stroke width constant */
    transition: fill 0.3s ease;
}

/* Content positioning */
.flap-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Default for top */
}

.top-flap .flap-content {
    padding-top: 8vh;
    justify-content: flex-start;
}

.bottom-flap .flap-content {
    justify-content: flex-end;
    padding-bottom: 8vh;
}

.left-flap .flap-content {
    justify-content: flex-start;
    padding-left: 6vw;
    align-items: flex-start;
    /* Align text left */
}

.right-flap .flap-content {
    justify-content: flex-end;
    padding-right: 6vw;
    align-items: flex-end;
    /* Align text right */
}

/* --- СУРГУЧНАЯ ПЕЧАТЬ (Центр) --- */
.wax-seal-btn {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.wax-seal-btn:hover {
    transform: translate(-50%, -50%) scale(1.08);
}

.wax-seal-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Круг печати - uses project's light color */
.seal-inner {
    width: 110px;
    height: 110px;
    background: linear-gradient(145deg,
            var(--bg-light) 0%,
            #f5f3ef 50%,
            #e8e4dc 100%);
    border-radius: 50%;
    box-shadow:
        inset 0 -4px 12px rgba(0, 0, 0, 0.08),
        inset 0 4px 8px rgba(255, 255, 255, 0.9),
        0 8px 25px rgba(0, 0, 0, 0.35),
        0 0 0 5px color-mix(in srgb, var(--primary-green) 30%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Рисунок внутри печати */
.seal-icon {
    width: 55%;
    height: 55%;
    opacity: 0.7;
}

.seal-icon path,
.seal-icon ellipse {
    stroke: var(--accent-gold);
}

/* Текст подсказки */
.click-hint {
    position: absolute;
    bottom: -55px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--accent-gold);
    opacity: 0.8;
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    pointer-events: none;
}

.click-hint span:first-child {
    font-size: 1.2rem;
    margin-bottom: 4px;
    animation: bounceArrow 1.5s ease-in-out infinite;
}

@keyframes bounceArrow {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* --- АНИМАЦИЯ ОТКРЫТИЯ --- */
/* --- АНИМАЦИЯ ОТКРЫТИЯ (Без исчезновения прозрачности) --- */
.animate-open .top-flap {
    transform: translateY(-110%);
    /* Opacity removed */
}

.animate-open .bottom-flap {
    transform: translateY(110%);
}

.animate-open .left-flap {
    transform: translateX(-110%);
}

.animate-open .right-flap {
    transform: translateX(110%);
}

.animate-open .wax-seal-btn {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
    transition: all 0.4s ease;
}

/* Final fade out of the entire overlay */
.envelope-overlay.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* --- АДАПТИВНОСТЬ --- */
@media (max-width: 600px) {
    .flap-content {
        padding-top: 8vh;
    }

    .monogram-box {
        width: 70px;
        height: 95px;
    }

    .monogram-text {
        font-size: 1.4rem;
    }

    .seal-inner {
        width: 90px;
        height: 90px;
    }



    .bottom-content {
        padding-bottom: 10vh;
    }
}