:root {
    --deep-blue: #0F1F38;
    --velvet-red: #8A0303;
    --aged-gold: #D4AF37;
    --paper-cream: #F5E6CA;
    --text-dark: #2c241b;

    --font-heading: 'Cinzel Decorative', cursive;
    --font-script: 'Great Vibes', cursive;
    --font-body: 'Lato', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #1a1a1a url('https://www.transparenttextures.com/patterns/dark-wood.png');
    /* Textura de mesa de madeira escura */
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    /* Controlado pelo livro */
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1500px;
}

/* --- Livro 3D --- */
.book-scene {
    width: 90vw;
    height: 85vh;
    max-width: 450px;
    /* Formato retrato móvel padrão */
    max-height: 800px;
    position: relative;
    transform-style: preserve-3d;
    perspective: 1500px;
    /* Perspective moved here for better context */
}

.book {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.645, 0.045, 0.355, 1);
    /* Removed global rotation that was flipping text */
}

.book.open {
    /* No mobile, "abrir" pode ser apenas sumir a capa ou deslizar. Vamos fazer estilo flip. */
}

/* --- Capa --- */
.cover {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--deep-blue), #050b14);
    border: 2px solid var(--aged-gold);
    border-radius: 5px 15px 15px 5px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8), 5px 5px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    /* Higher z-index to stay on top */
    transform-origin: left;
    transition: transform 1.5s cubic-bezier(0.25, 1, 0.5, 1);
    backface-visibility: hidden;
}

.book.open .cover {
    transform: rotateY(-130deg);
    /* Opens the cover like a door */
}

.cover-content {
    text-align: center;
    color: var(--aged-gold);
    border: 2px solid var(--aged-gold);
    padding: 20px;
    margin: 15px;
    height: 90%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.cover-photo-frame {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 5px solid var(--aged-gold);
    overflow: hidden;
    margin: 15px 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.cover-photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.main-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    margin: 10px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}


.sub-title {
    font-family: var(--font-script);
    font-size: 2rem;
    color: white;
}

.click-instruction {
    margin-top: auto;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: pulse 2s infinite;
}

.cover-illustration {
    max-width: 95%;
    max-height: 60%;
    object-fit: contain;
    margin: 20px 0;
    border-radius: 5px;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.4));
    flex-grow: 1;
    /* Permite que ocupe o espaço disponível */
}

/* --- Páginas Internas --- */

.page {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--paper-cream);
    background-image: url('https://www.transparenttextures.com/patterns/cream-paper.png');
    border-radius: 5px 15px 15px 5px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
    padding: 30px 20px;
    display: none;
    /* JS controla qual aparece */
    flex-direction: column;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.5s;
    overflow-y: auto;
}

.page.active {
    display: flex;
    opacity: 1;
}

/* Page 1: Espelho */
.mirror-frame {
    margin: 20px auto;
    width: 200px;
    height: 300px;
    background: var(--deep-blue);
    border: 8px solid var(--aged-gold);
    border-radius: 50%;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.mirror-surface {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0.1));
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.mirror-text {
    font-family: var(--font-script);
    font-size: 1.5rem;
    color: var(--aged-gold);
    opacity: 0;
    animation: fadeInMirror 3s 1s forwards;
}

@keyframes fadeInMirror {
    to {
        opacity: 1;
    }
}

.story-text {
    font-family: var(--font-heading);
    color: var(--deep-blue);
    text-align: center;
    margin-top: 20px;
    line-height: 1.6;
    font-size: 1.1rem;
}

.next-page-hint {
    margin-top: auto;
    text-align: right;
    font-size: 0.9rem;
    color: var(--velvet-red);
    cursor: pointer;
    font-weight: bold;
}

/* Page 2: Galeria */
.section-title {
    font-family: var(--font-heading);
    color: var(--velvet-red);
    text-align: center;
    font-size: 2rem;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--aged-gold);
    display: inline-block;
    align-self: center;
}

.royal-gallery {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.gallery-scroll {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.gallery-frame {
    width: 80%;
    height: 250px;
    border: 10px solid transparent;
    border-image: url('https://www.transparenttextures.com/patterns/gold-scale.png') 30 round;
    /* Fallback simples */
    border: 5px solid var(--aged-gold);
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    border-radius: 5px;
}

.gallery-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 5s ease;
}

.gallery-frame:hover img {
    transform: scale(1.1);
}

/* Navigation Hints */
.nav-hint-container {
    text-align: center;
    margin-top: 15px;
    padding-bottom: 20px;
}

.btn-next-page {
    background: transparent;
    border: 2px solid var(--velvet-red);
    color: var(--velvet-red);
    padding: 10px 20px;
    font-family: var(--font-heading);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.3s;
    animation: bounceRight 2s infinite;
}

.btn-next-page:hover {
    background: var(--velvet-red);
    color: var(--paper-cream);
}

@keyframes bounceRight {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateX(0);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(3px);
    }
}


/* Page 3: Detalhes & RSVP */
.forest-decoration {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

.invitation-details {
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    padding: 20px;
    border-radius: 15px;
    border: 2px dashed var(--aged-gold);
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.date,
.time {
    font-size: 1.2rem;
    color: var(--deep-blue);
    margin: 10px 0;
    font-family: var(--font-heading);
}

.countdown-elegant {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.cd-item {
    background: var(--deep-blue);
    color: var(--aged-gold);
    padding: 10px 15px;
    border-radius: 5px;
    min-width: 60px;
}

.cd-item span {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
}

.rsvp-section {
    text-align: center;
    margin-top: auto;
    position: relative;
    z-index: 5;
}

.rsvp-call {
    font-family: var(--font-script);
    font-size: 1.5rem;
    color: var(--deep-blue);
    margin-bottom: 10px;
}

.magic-btn {
    background: linear-gradient(45deg, var(--velvet-red), #b30000);
    color: var(--paper-cream);
    padding: 15px 30px;
    border: 3px solid var(--aged-gold);
    border-radius: 50px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    position: relative;
}

.magic-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.6);
}

.magic-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0) 100%);
    transform: rotate(45deg);
    transition: all 0.5s;
    opacity: 0;
}

.magic-btn:hover::after {
    opacity: 1;
    transform: rotate(45deg) translate(50px, -50px);
}

.apple-decoration {
    font-size: 3rem;
    position: absolute;
    bottom: 20px;
    right: 20px;
    opacity: 0.2;
    transform: rotate(15deg);
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Wax Seal - Deprecated style override but keeping just in case */
.wax-seal-btn {
    display: none;
}


/* --- Modal RSVP Pergaminho --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.scroll-paper {
    background: #fdfbf7;
    width: 90%;
    max-width: 400px;
    height: auto;
    max-height: 90vh;
    padding: 40px 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    border-top: 10px solid var(--aged-gold);
    border-bottom: 10px solid var(--aged-gold);
    overflow-y: auto;
    animation: unroll 0.5s ease-out;
}

@keyframes unroll {
    from {
        height: 0;
        opacity: 0;
    }

    to {
        height: auto;
        opacity: 1;
    }
}

.scroll-title {
    font-family: var(--font-heading);
    color: var(--deep-blue);
    text-align: center;
    margin-bottom: 20px;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--velvet-red);
}

/* Form Styles */
.form-question {
    text-align: center;
    margin-bottom: 20px;
}

.choice-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.radio-label input {
    display: none;
}

.choice-design {
    display: block;
    padding: 10px;
    border: 1px solid var(--aged-gold);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.radio-label input:checked+.choice-design {
    background: var(--aged-gold);
    color: var(--deep-blue);
    font-weight: bold;
}

.input-group {
    margin-bottom: 15px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    background: transparent;
    border-bottom: 2px solid var(--aged-gold);
    font-family: var(--font-body);
}

.hidden {
    display: none;
}

.btn-royal {
    width: 100%;
    padding: 12px;
    background: var(--deep-blue);
    color: white;
    border: none;
    font-family: var(--font-heading);
    cursor: pointer;
    margin-top: 10px;
}

.row {
    display: flex;
    gap: 10px;
}

/* Decorations */
.page-deco-top {
    width: 60px;
    margin: 0 auto -20px auto;
    display: block;
    position: relative;
    z-index: 10;
}

.page-deco-right {
    position: absolute;
    bottom: 80px;
    right: 10px;
    width: 80px;
    z-index: 20;
    opacity: 0.9;
}

.deco-dwarfs {
    width: 150px;
    margin: -10px auto 10px auto;
    display: block;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.2));
}

/* --- Reveal / Celebration --- */
#celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    /* Slight dim */
}

.celebration-characters {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.char-dance {
    height: 300px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

.char-jump {
    height: 200px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

@keyframes popIn {
    from {
        transform: scale(0) translateY(100px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

#address-reveal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 31, 56, 0.9);
    z-index: 2001;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.reveal-content.parchment-bg {
    background: #fdfbf7;
    background-image: url('https://www.transparenttextures.com/patterns/cream-paper.png');
    padding: 40px 20px;
    /* Reduced padding for mobile fit */
    border-radius: 10px;
    border: 5px double var(--aged-gold);
    max-width: 90%;
    width: 400px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: unfold 1s ease-out forwards;
    transform-origin: top;
    display: flex;
    flex-direction: column;
    align-items: center;
}


@keyframes unfold {
    from {
        transform: rotateX(-90deg);
        opacity: 0;
    }

    to {
        transform: rotateX(0);
        opacity: 1;
    }
}

.deco-top-right {
    position: absolute;
    top: -30px;
    right: -30px;
    width: 80px;
    animation: float 4s infinite ease-in-out;
}

.deco-centered {
    width: 100px;
    margin-bottom: 10px;
}

.hidden-reveal {
    display: none !important;
}

.address-text {
    font-size: 1.4rem;
    margin: 20px 0;
    color: var(--deep-blue);
    font-family: var(--font-heading);
}

.links .btn-map {
    background: var(--velvet-red);
    color: white;
}

.links .btn-cal {
    background: var(--aged-gold);
    color: var(--deep-blue);
}

.links a {
    display: inline-block;
    padding: 12px 24px;
    margin: 10px 5px;
    text-decoration: none;
    font-weight: bold;
    border-radius: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.links a:hover {
    transform: translateY(-2px);
}

.btn-close-reveal {
    margin-top: 20px;
    background: transparent;
    border: none;
    color: var(--deep-blue);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}