/* 
    * ==========================================
    * --- style.css ---
    * ==========================================
    */
/*


/* 
* --- Envelope Animation Styles ---
*/

.envelope-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: #1A3C40;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease-in-out, visibility 1s ease-in-out;
}

.envelope {
    width: 320px;
    height: 220px;
    position: relative;
    perspective: 1000px;
    /* Drop shadow for elegance */
    filter: drop-shadow(0 20px 25px rgba(0, 0, 0, 0.4));
}

.envelope-back {
    position: absolute; 
    inset: 0; 
    background-color: #EBE8DF; 
    z-index: 1; 
    border-radius: 4px;
}

.envelope-letter {
    position: absolute; 
    bottom: 5px; 
    left: 10px; 
    right: 10px; 
    top: 10px; 
    background-color: #FFFFFF; 
    z-index: 2;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    border: 1px solid #E5E5E5;
    padding: 1rem;
    text-align: center;
}

.envelope-front {
    position: absolute; 
    inset: 0; 
    z-index: 3; 
    pointer-events: none;
    /* Create envelope folds using borders */
    border-left: 160px solid #F2F0E9;
    border-right: 160px solid #F2F0E9;
    border-bottom: 110px solid #EBE8DF;
    border-top: 110px solid transparent;
    border-radius: 4px;
}

.envelope-flap {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 0; 
    height: 0; 
    z-index: 4;
    /* The top flap */
    border-left: 160px solid transparent;
    border-right: 160px solid transparent;
    border-top: 130px solid #DFDCD3; 
    transform-origin: top;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1), z-index 0s 0.4s;
    /* Add slight shadow under flap */
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.05));
}

/* Envelope Open States */
.envelope.is-open .envelope-flap,
.envelope.open .envelope-flap {
    transform: rotateX(180deg);
    z-index: 1; /* drops behind the letter as it opens */
}

.envelope.is-open .envelope-letter,
.envelope.open .envelope-letter {
    transform: translateY(-90px);
    transition-delay: 1s; /* Wait for flap to open */
}

/* Overlay Hide State */
.envelope-overlay.is-hidden,
.envelope-overlay.open {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Button Base Styles */
.btn { 
    background: #C87D55; 
    color: #ffffff; 
    border: none; 
    padding: 12px 28px; 
    font-size: 1.1rem; 
    border-radius: 30px; 
    cursor: pointer; 
    transition: background 0.3s, transform 0.2s; 
    font-weight: 600;
}

.open-btn {
    position: absolute;
    z-index: 1001; 
    bottom: 80px; /* Locks the button neatly near the bottom on all screen sizes */
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.open-btn:hover { 
    background: #B36A45; 
    transform: translateX(-50%) scale(1.05); 
}

/* 
* --- Scroll Snapping Layout ---
*/

.scroll-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scroll-container::-webkit-scrollbar {
    display: none;
}

.snap-section {
    scroll-snap-align: start;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    
    /* 1. Reserve top space for fixed header (approx 80px) */
    padding-top: 5rem;
    padding-bottom: 3rem;
    box-sizing: border-box;

    /* 2. Prevent vertical centering on mobile so content doesn't push up into the header */
    justify-content: flex-start; 
}

/* Re-apply centering on larger screens where vertical space is abundant */
@media (min-width: 768px) {
    .snap-section {
        justify-content: center;
    }
}


/* 
    * --- Ken Burns Background Animation ---
    */
@keyframes kenburns {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.15) translate(-1%, -1%); }
}
.bg-kenburns {
    animation: kenburns 25s ease-in-out infinite alternate;
    transform-origin: center center;
}

/* Glassmorphism Header */
.glass-header {
    background: rgba(249, 248, 246, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(138, 154, 134, 0.2);
}

/* Fade-in Animations for Scroll */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }

/* RTL Specifics */
[dir="rtl"] .glass-header { flex-direction: row-reverse; }
[dir="rtl"] select { background-position: left 1rem center; }
[dir="rtl"] .input-field { text-align: right; }