/* style.css - Antique Filipino Letter Theme - Fixed (No panel movement) */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=Inter:wght@300;400;500&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #130b06;
    background-image: 
        linear-gradient(rgba(160, 100, 60, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(160, 100, 60, 0.05) 1px, transparent 1px);
    background-size: 32px 32px;
    font-family: 'Inter', sans-serif;
    color: #2a1a0e;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 30% 40%, rgba(100, 55, 30, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.container {
    max-width: 580px;
    width: 100%;
    margin: 0 auto;
    background: #faf1e2;
    background: linear-gradient(135deg, #fcf5e8 0%, #f8ecdb 100%);
    border-radius: 2px;
    box-shadow: 
        0 30px 45px -18px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,250,235,0.9),
        0 0 0 1px #c4a07a,
        0 0 0 6px #e8d8c4,
        0 0 0 7px #b89068;
    padding: 42px 34px 48px;
    position: relative;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 30%, rgba(160, 110, 70, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 85% 70%, rgba(120, 75, 45, 0.05) 0%, transparent 55%);
    pointer-events: none;
    border-radius: 2px;
}

.container::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 1px solid rgba(150, 95, 55, 0.25);
    pointer-events: none;
}

h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.4rem;
    font-weight: 500;
    letter-spacing: 2px;
    color: #3b2214;
    text-align: center;
    margin-bottom: 8px;
    text-transform: uppercase;
    word-spacing: 4px;
}

.vintage-sep {
    width: 70px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #b89068, #8a6040, #b89068, transparent);
    margin: 16px auto 12px;
}

.vintage-sep-long {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #c4a07a, #8a6040, #c4a07a, transparent);
    margin: 20px 0;
}

.vintage-line {
    border-top: 1px solid #e0d6c8;
    margin: 24px 0;
}

.subtitle {
    text-align: center;
    font-size: 0.72rem;
    color: #8a6040;
    margin-bottom: 28px;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 1.2px;
    font-family: 'Cormorant Garamond', serif;
    text-transform: none;
}

.btn, button, .button-link {
    display: inline-block;
    background: #3b2214;
    border: none;
    color: #f2e2ce;
    font-size: 0.78rem;
    font-weight: 450;
    font-family: 'Inter', sans-serif;
    padding: 14px 24px;
    min-height: 52px;
    border-radius: 0;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    width: 100%;
    margin: 8px 0;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    position: relative;
}

.btn::before, button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(200, 160, 120, 0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn:hover::before, button:hover::before {
    opacity: 1;
}

.btn-secondary {
    background: #c4a07a;
    color: #2a1a0e;
    border: 1px solid #8a6040;
}

.btn-secondary:hover {
    background: #d4b890;
    color: #1a0e06;
}

/* FIXED: Walang scale sa active state */
.btn:active, button:active {
    /* walang transform */
}

input, textarea {
    width: 100%;
    padding: 14px 18px;
    margin: 8px 0 14px;
    border: 1px solid #d4bea0;
    background: #fffcf5;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    transition: all 0.2s;
    color: #2a1a0e;
    border-radius: 0;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #a07048;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #f0e0cc;
}

label {
    font-weight: 500;
    color: #5a3520;
    margin-left: 6px;
    font-size: 0.7rem;
    letter-spacing: 1px;
    display: block;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
}

.form-group {
    margin-bottom: 24px;
}

.error-msg {
    background: #f5e4d8;
    color: #a04a20;
    padding: 12px 20px;
    margin: 15px 0;
    border-left: 4px solid #a04a20;
    font-size: 0.8rem;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
}

.success-box {
    background: #e6e0d0;
    color: #4a5a2a;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    border: 1px solid #c4bc9c;
    font-family: 'Cormorant Garamond', serif;
}

.button-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 32px;
}

.envelope-stage {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 75vh;
    flex-direction: column;
    padding: 20px;
    margin: -20px;
    background: radial-gradient(ellipse at center, rgba(20, 12, 8, 0.5) 0%, transparent 70%);
}

.envelope-wrapper {
    perspective: 1500px;
    width: 340px;
    height: 240px;
    position: relative;
    margin: 30px auto;
    cursor: pointer;
}

/* FIXED: Walang scale sa hover at active */
.envelope-wrapper:hover {
    /* walang transform */
}

.envelope-wrapper:active {
    /* walang transform */
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.envelope-body {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #ecd8be, #dcc4a4);
    border-radius: 1px 1px 6px 6px;
    box-shadow: 0 20px 32px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,245,225,0.7);
    bottom: 0;
    z-index: 1;
    border: 1px solid #b89068;
}

.envelope-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(45deg, rgba(100, 65, 40, 0.08) 0px, rgba(100, 65, 40, 0.08) 2px, transparent 2px, transparent 16px);
}

.envelope-body::after {
    content: '';
    position: absolute;
    top: 44%;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(100, 65, 40, 0.4), rgba(80, 50, 30, 0.6), rgba(100, 65, 40, 0.4), transparent);
}

.envelope-flap {
    position: absolute;
    width: 100%;
    height: 120px;
    background: linear-gradient(145deg, #f0e0cc, #e4caac);
    top: 0;
    transform-origin: top;
    transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 1px 1px 0 0;
    border-bottom: 1px solid #c49a6c;
    z-index: 3;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.03);
}

.envelope-flap::before {
    content: '';
    position: absolute;
    bottom: -34px;
    left: 0;
    width: 100%;
    height: 68px;
    background: linear-gradient(135deg, #e4caac 50%, transparent 50%);
    clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
}

.envelope.open .envelope-flap {
    transform: rotateX(180deg);
}

.heart-seal {
    position: absolute;
    bottom: 28px;
    right: 28px;
    width: 58px;
    height: 58px;
    background: radial-gradient(circle at 35% 32%, #b83818, #6a2008);
    clip-path: path("M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5 2,5.41 4.42,3 7.5,3c1.74,0 3.41.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.41 22,8.5c0,3.77-3.4,6.86-8.55,11.54L12,21.35Z");
    transform-origin: center;
    z-index: 4;
    pointer-events: none;
    box-shadow: 0 3px 12px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,210,160,0.5);
}

.heart-seal::before {
    content: '';
    position: absolute;
    top: -12px;
    left: -10px;
    right: -10px;
    bottom: -12px;
    background: radial-gradient(ellipse at 30% 35%, rgba(160, 55, 25, 0.35), transparent 70%);
    border-radius: 50%;
}

.heartbeat {
    animation: pulseWax 1.6s infinite ease-in-out;
}

@keyframes pulseWax {
    0% { transform: scale(1); filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));}
    45% { transform: scale(1.07); filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));}
    100% { transform: scale(1); filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));}
}

.letter-inside {
    position: absolute;
    background: #fff5e8;
    background-image: linear-gradient(#f0dfcc 1px, transparent 1px);
    background-size: 100% 28px;
    width: 86%;
    height: 69%;
    bottom: 12px;
    left: 7%;
    border-radius: 1px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.18);
    transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1) 0.08s;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #b08058;
    transform: translateY(18px);
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    letter-spacing: 2px;
}

.envelope.open .letter-inside {
    transform: translateY(-105px);
}

.floating-animation {
    animation: floatEnvelope 4.5s infinite ease-in-out;
}

@keyframes floatEnvelope {
    0% { transform: translateY(0px);}
    45% { transform: translateY(-7px);}
    100% { transform: translateY(0px);}
}

.envelope-wrapper::after {
    content: '';
    position: absolute;
    bottom: -24px;
    left: 10%;
    width: 80%;
    height: 22px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.25), transparent);
    border-radius: 50%;
    z-index: -1;
}

.letter-paper {
    background: #fdf5e6;
    background-image: 
        repeating-linear-gradient(0deg, rgba(220, 190, 150, 0.1) 0px, rgba(220, 190, 150, 0.1) 1px, transparent 1px, transparent 28px),
        radial-gradient(circle at 15% 30%, rgba(180, 130, 80, 0.05) 0%, transparent 40%);
    padding: 38px 30px;
    position: relative;
}

.letter-paper::before {
    content: '\2020';
    position: absolute;
    top: 14px;
    left: 20px;
    font-size: 0.9rem;
    color: #b89068;
    opacity: 0.5;
    font-family: serif;
}

.letter-paper::after {
    content: '\2020';
    position: absolute;
    bottom: 14px;
    right: 20px;
    font-size: 0.9rem;
    color: #b89068;
    opacity: 0.5;
    font-family: serif;
}

.letter-content p {
    font-size: 1rem;
    line-height: 1.7;
    font-family: 'Cormorant Garamond', serif;
    color: #2e1c10;
    white-space: pre-wrap;
    font-weight: 400;
}

.typing-cursor {
    display: inline-block;
    width: 1px;
    background: #8a6040;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.back-link {
    text-align: center;
    margin-top: 36px;
}

.back-link a {
    color: #8a6040;
    text-decoration: none;
    font-size: 0.68rem;
    font-family: 'Inter', sans-serif;
    border-bottom: 1px dotted #c4a07a;
    padding-bottom: 4px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.slug-status {
    margin-top: 5px;
    margin-left: 8px;
    font-size: 0.7rem;
    padding: 4px 0;
    display: none;
    font-style: italic;
    color: #8a6040;
}

.slug-status span {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

.btn:disabled, button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.instruction-text {
    text-align: center;
    margin-top: 32px;
    font-size: 0.68rem;
    color: #b89068;
    letter-spacing: 2.5px;
    font-style: italic;
    font-family: 'Cormorant Garamond', serif;
    text-transform: uppercase;
}

.return-link {
    text-align: center;
    margin-top: 28px;
}

.return-link a {
    color: #b89068;
    text-decoration: none;
    font-size: 0.68rem;
    font-family: 'Inter', sans-serif;
    border-bottom: 1px dotted rgba(150, 95, 55, 0.4);
    padding-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.vintage-small {
    font-size: 0.6rem;
    color: #b0a080;
    text-align: center;
    letter-spacing: 1px;
    margin-top: 24px;
}

@media (min-width: 600px) {
    .container { padding: 48px 42px; }
    .btn, button { min-height: 52px; font-size: 0.78rem; }
    .envelope-wrapper { width: 380px; height: 260px; }
    h1 { font-size: 2.8rem; }
}