/* --- Global Resets & Background --- */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 25px 20px;

    /*background-color: #2c241b; !* Dark wooden table vibe *!*/
    /* Subtle texture for the background */
    /*background-image: repeating-linear-gradient(45deg, #332a20 0px, #332a20 2px, #2c241b 2px, #2c241b 4px);*/
    background-color: #f4c089;

    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.postcard-container {
    display: flex;
    flex-direction: column;
    gap: 30px; /* Space between front and back cards */
    /*max-width: 700px;*/
    max-width: 555px;
    width: 100%;
}

/* --- Shared Card Styles --- */
.card {
    width: 100%;
    /* Typical Postcard Ratio approx 3:2 */
    aspect-ratio: 3 / 2;
    background-color: #f4ecd8; /* Aged cream paper color */
    border-radius: 4px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    /* Giving the paper a slight aged texture look */
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"/></filter><rect width="100%" height="100%" filter="url(%23noise)"/></svg>');
}

/* =========================================
   TOP CARD: The Front (Image Upload Area)
========================================= */
.card-front {
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The frame around the image area */
.vintage-frame {
    width: 100%;
    height: 100%;
    border: 8px solid #4a3b2a; /* Dark, sepia-toned frame */
    /* Inner shadow to make the frame look layered */
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
    background-color: #e3d5b8; /* Slightly darker inner matte */
    padding: 4px; /* Small gap between frame and image */
}

/* The "Pale Image" Placeholder area */
.image-upload-placeholder {
    width: 100%;
    height: 100%;
    background-color: #d9cebb; /* Pale, desaturated color */
    /* Recessed look */
    box-shadow: inset 3px 3px 10px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #8a7b6a;
    border: 1px dashed #a39585;
    text-align: center;
}

.upload-icon {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 10px;
}

.image-upload-placeholder p {
    font-size: 1.2rem;
    margin: 0;
    font-style: italic;
    opacity: 0.7;
}

/* Hiding the actual file input, styling the label instead */
.hidden-file-input {
    display: none;
}

.fake-upload-button {
    margin-top: 15px;
    padding: 8px 20px;
    background-color: #4a3b2a;
    color: #f4ecd8;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: background-color 0.2s;
}
.fake-upload-button:hover {
    background-color: #6b553e;
}


/* =========================================
   BOTTOM CARD: The Back (Writing Area)
========================================= */
.card-back {
    padding: 30px;
    display: flex;
}

/* Use a handwritten-style font if available on system, fall back to cursive */
.handwritten {
    font-family: "Brush Script MT", "Comic Sans MS", cursive;
    color: #3d3228; /* Ink color */
}

/* Left Side - Message Area */
.message-area {
    flex: 3; /* Takes up 60% space */
    padding-right: 30px;
    display: flex;
    flex-direction: column;
}

/* Styling the textarea to look like ruled paper */
.message-textarea {
    width: 100%;
    flex-grow: 1;
    border: none;
    resize: none;
    background: transparent;
    font-size: 1.3rem;
    line-height: 2rem;
    outline: none;
    /* CSS trick to create ruled lines */
    background-image: repeating-linear-gradient(transparent, transparent 31px, #ccc1a7 31px, #ccc1a7 32px);
    padding-top: 5px;
}
.message-textarea::placeholder {
    color: #b0a48f;
    font-family: Georgia, serif;
    font-style: italic;
}

/* Center divider line */
.divider {
    width: 2px;
    background-color: #d1c6b1;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Right Side - Address & Stamp */
.address-area {
    flex: 2; /* Takes up 40% space */
    padding-left: 30px;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align stamp to right */
}

.stamp-box {
    width: 80px;
    height: 90px;
    border: 2px dashed #b0a48f;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 0.8rem;
    color: #b0a48f;
    margin-bottom: 40px;
    transform: rotate(2deg); /* Slight tilt for realism */
}

.postcard-header {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: bold;
    color: #5e4f3e;
    margin-top: -20px; /* Pull it up between the two columns */
    position: absolute;
    width: 100%;
    left: 0;
    top: 25px;
    pointer-events: none;
}

.address-lines-container {
    width: 100%;
    padding-top: 20px;
}

/* Styling inputs to look like address lines */
.address-line {
    width: 100%;
    border: none;
    border-bottom: 2px solid #d1c6b1;
    background: transparent;
    margin-bottom: 25px;
    font-size: 1.2rem;
    outline: none;
    padding-bottom: 5px;
}
.address-line::placeholder {
    color: #b0a48f;
    font-family: Georgia, serif;
}