/* postcards.css
   Base styles for the Postcard Prototype.
   Updated and cleaned for consistent spacing and responsive behavior.
*/

/* ===== Base Styles ===== */
#postcard-prototype {
    font-family: 'Inter', sans-serif;
    color: #333;
    background: #FAE6EB;
    margin: 0;
    padding: 0;
    z-index: 100;
}

#postcard-prototype header {
    text-align: center;
    padding-bottom: 20px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #9C9093;
}

/* ===== Gallery (Grid) View ===== */
#postcard-prototype #galleryView {
    padding-bottom: 50px;
}

#postcard-prototype .gallery-container {
    display: grid;
    grid-template-columns: repeat(3, 200px);
    gap: 50px;
    justify-content: center;
    padding: 50px 0;
}

#postcard-prototype .card {
    position: relative;
    perspective: 1000px;
}

#postcard-prototype .grid-card {
    width: 200px;
    height: 307px;
    cursor: pointer;
    padding: 0;
}

/* ===== Enlarged Card (Clone) ===== */
#postcard-prototype .enlarged-card {
    width: 400px;
    height: 614px; /* 1px reduced to fix rogue line */
    cursor: pointer;
    position: fixed;
    transform-style: preserve-3d;
    transition: left 0.4s ease, top 0.4s ease, width 0.4s ease, height 0.4s ease, transform 0.4s ease;
    z-index: 11;
}

#postcard-prototype .enlarged-card.flip-in {
    animation: flipInFocus 0.4s ease-out both;
}

@keyframes flipInFocus {
    0%   { transform: scale(0.8) rotateY(90deg); opacity: 0; }
    50%  { transform: scale(1.05) rotateY(-10deg); opacity: 1; }
    100% { transform: scale(1) rotateY(0deg); opacity: 1; }
}

/* ===== Card Sides ===== */
#postcard-prototype .card-side {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    backface-visibility: hidden;
    border: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 7px;
    box-sizing: border-box;
    padding: 10px;
}

#postcard-prototype .card-front,
#postcard-prototype .card-back {
    height: 100%;
}

#postcard-prototype .card-front {
    background: #ffe4e1;
    font-size: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    overflow: hidden;
}

#postcard-prototype .card-front img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    padding: 0;
    border-radius: 7px;
}

#postcard-prototype .card-back {
    background: white;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

#postcard-prototype .is-flipped {
    transform: rotateY(180deg);
}

#postcard-prototype .message-container {
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#postcard-prototype .message-box {
    width: 80%;
    height: 75%;
    margin-bottom: 10px;
    font-family: "Courier Prime", serif;
    font-weight: 400;
    font-size: 23px;
    text-align: center;
    padding: 5px;
    border: 1px solid #E5E5E5;
    border-radius: 4px;
    box-sizing: border-box;
    resize: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

#postcard-prototype .rendered-message {
    font-family: "Courier Prime", serif;
    font-weight: 400;
    font-size: 23px;
    color: #333;
    text-align: center;
    display: none;
    width: 90%;
    word-wrap: break-word;
}

#postcard-prototype .button-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

#postcard-prototype .button-container button {
    padding: 7px 15px;
    background: #007acc;
    color: white;
    border: none;
    border-radius: 5px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    cursor: pointer;
}

#postcard-prototype .button-container button:disabled {
    background: #ccc;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    cursor: not-allowed;
}

/* ===== Modal Overlay ===== */
#postcard-prototype .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    z-index: 70;
}

#postcard-prototype .modal-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    transition: opacity 0.5s ease;
    opacity: 1;
}

#postcard-prototype .modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ===== CLOCK-SPECIFIC STYLES ===== */
#postcard-prototype .clock-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#postcard-prototype .clock-background {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#postcard-prototype .clock-hand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: 50% 100%;
}

#postcard-prototype .hour-hand {
    width: 2.5%;
    height: 12%;
    background: #232323;
    border-radius: 1px;
    transform: translate(-50%, -100%) rotate(0deg);
}

#postcard-prototype .minute-hand {
    width: 1.5%;
    height: 18%;
    background: #232323;
    transform: translate(-50%, -100%) rotate(0deg);
}

#postcard-prototype .second-hand {
    width: 0.5%;
    height: 20%;
    background: red;
    transform: translate(-50%, -100%) rotate(0deg);
}

/* Hide timer controls in grid view */
#postcard-prototype .grid-card #timerControls {
    display: none;
}

#postcard-prototype .card.is-flipped .card-front #timerControls {
    display: none !important;
}

/* Character count margin fix */
.charCount {
    margin-bottom: 20px;
}
.styled-btn {
  padding: 7px 15px;
  background: #007acc;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
}

/* ===== Mobile Styles (<= 600px) ===== */
@media (max-width: 600px) {
    #postcard-prototype .gallery-container {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 20px;
        row-gap: 40px;
        padding: 20px;
    }

    #postcard-prototype .grid-card {
        width: 90%;
        height: auto;
        aspect-ratio: 1000 / 1538;
        margin: 0 auto;
    }

    #postcard-prototype .enlarged-card {
        width: 90%;
        height: auto;
        aspect-ratio: 1000 / 1538;
        margin: 0 auto;
    }

    #postcard-prototype .card-side {
        position: absolute;
        height: 100%;
    }

    #postcard-prototype .card-front {
        padding: 0 !important;
    }

    /* Reduce the font size in the message box */
    #postcard-prototype .message-box {
        font-size: 20px;
    }

    /* Reduce the font size of the rendered message */
    #postcard-prototype .rendered-message {
        font-size: 20px;
    }
}

/* ===== Link Styling for Rendered Message ===== */
#postcard-prototype .rendered-message,
#postcard-prototype .rendered-message a {
    font-family: "Courier Prime", serif;
    font-weight: 400;
    font-size: 23px;
    color: #333;
    text-align: center;
    text-decoration: none !important;
    word-wrap: break-word;
}

#postcard-prototype .rendered-message a:hover {
    text-decoration: underline !important;
    color: #007ACC;
}
