:root {
    --bg-color: #f8f9fa;
    --primary-gradient: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    --env-bg: #4a90e2;
    --env-light: #d1e3fa;
    --env-mid: #adcff7;
    --env-lid-close: #7fb5f5;
    --env-lid-open: #4a90e2;
    --text-main: #2d3436;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--primary-gradient);
    background-attachment: fixed;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    color: var(--text-main);
    overflow-x: hidden;
}

/* --- HERO SECTION --- */
.hero { 
    text-align: center; 
    padding: 60px 20px 30px; 
    animation: fadeInDown 1s ease;
}

.hero h1 {
    font-family: 'Pacifico', cursive; 
    font-size: 3.5rem; 
    margin-bottom: 10px;
    font-weight: normal;
    background: linear-gradient(to right, #6a11cb 0%, #2575fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.1);
    animation: bounceIn 1.5s ease;
}

.hero p {
    font-size: 0.8rem;
    letter-spacing: 3px; 
    text-transform: uppercase;
    color: #636e72;
    font-weight: 600;
    opacity: 0.8;
}

.wrapper {
    height: 200px;
    width: 300px;
    background-color: var(--env-bg);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    margin-top: 40px;
    cursor: pointer;
}

.kertas {
    position: absolute;
    top: 5px;
    width: 270px;
    height: 170px;
    background-color: white;
    border-radius: 8px;
    z-index: 2; 
    /* Transisi saat KERTAS TURUN agar tidak bocor */
    transition: transform 0.4s ease, z-index 0.1s step-end;
    overflow-y: auto; 
    display: block; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    user-select: none;
    padding-bottom: 10px;
}

.kertas p {
    text-align: left;
    font-size: 1rem;
    color: #3b4049;
    padding: 20px;
    line-height: 1.6;
    font-family: 'Georgia', serif;
}

.amplop {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 4;
}

.amplop::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    border-top: 100px solid transparent;
    border-right: 150px solid var(--env-light);
    border-bottom: 100px solid var(--env-light);
    border-left: 150px solid var(--env-mid);
    border-radius: 0 0 15px 15px;
}

.lid {
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 0;
    border-right: 150px solid transparent;
    border-bottom: 100px solid transparent;
    border-left: 150px solid transparent;
    transform-origin: top;
    transition: transform 0.5s ease;
}

.lid.satu { border-top: 100px solid var(--env-lid-close); z-index: 5; }
.lid.dua { border-top: 100px solid var(--env-lid-open); z-index: 1; transform: rotateX(90deg); }

.wrapper.open .lid.satu { transform: rotateX(90deg); }
.wrapper.open .lid.dua { transform: rotateX(180deg); transition-delay: 0.2s; }

.wrapper.open .kertas { 
    transform: translateY(-130px) scale(1.05); 
    /* Transisi saat KERTAS NAIK */
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.4s, z-index 0.1s step-start 0.4s;
    z-index: 11; 
}

.gallery { 
    margin-top: 160px; 
    width: 100%; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    padding-bottom: 80px; 
}

.stack { 
    position: relative; 
    width: 300px; 
    height: 420px; 
    perspective: 1000px;
    margin: 0 auto;
}

.card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 2px;
    padding: 12px 12px 80px 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    cursor: grab;
    touch-action: none;
    border: 1px solid rgba(0,0,0,0.05);
    box-sizing: border-box;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.6s;
}

.card img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    border-radius: 2px; 
}

.card-info { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    width: 100%;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center; 
    font-size: 0.9rem; 
    color: #555;
}

.card::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 30px;
    background: #333;
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
    z-index: 10;
}

.card::after {
    content: "✨";
    position: absolute;
    bottom: 15px;
    right: 15px;
    opacity: 0.3;
}

.card:active { cursor: grabbing; }

.card:nth-child(odd) { transform: rotate(-2deg); }
.card:nth-child(even) { transform: rotate(2deg); }
.card:last-child { transform: rotate(0deg); }

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.5); }
    60% { opacity: 1; transform: scale(1.1); }
    100% { transform: scale(1); }
}

.gallery::after {
    content: "← Swipe right to see more →";
    display: block;
    margin-top: 25px;
    font-size: 0.75rem;
    color: #888;
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}