:root {
    --bg-color: #FDF6EC;
    --text-color: #3E2723;
    --red-primary: #9B2C2C;
    --red-dark: #742A2A;
    --green-primary: #2F5233;
    --green-dark: #1A3C20;
    --beige: #E6D2B5;
    --white: #FFFFFF;
    --accent-gold: #F1C40F;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    word-wrap: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphenate-limit-chars: 3 4 3;
    text-wrap: balance;
}

body {
    font-family: 'Quicksand', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden; /* Prevent scrolling for the single page app feel */
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    grid-template-rows: auto 1fr auto;
    padding: 2rem;
    position: relative;
    justify-content: center;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--red-primary);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--red-primary);
}

.btn-cta {
    padding: 0.5rem 1.5rem;
    border: 2px solid var(--text-color);
    border-radius: 50px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-cta:hover {
    background-color: var(--text-color);
    color: var(--white);
}

/* Main Content */
main {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    align-items: center;
}

/* Hero Section */
.hero-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    position: relative;
    max-width: 400px;
}

h1 {
    font-size: 4rem;
    line-height: 1.1;
    font-weight: 700;
    color: #222;
    margin-bottom: 2rem;
    z-index: 2;
}

.santa-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    z-index: 1;
}

.santa-container img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.1));
    border-radius: 12px;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 1rem;
    height: 100%;
    max-height: 600px;
    perspective: 1000px; /* Essential for 3D effect */
}

.span-col-2 {
    grid-column: span 2;
}

.span-row-2 {
    grid-row: span 2;
}

.span-2x2 {
    grid-column: span 2;
    grid-row: span 2;
}



/* 3D Door Styles - Realistic Open Effect */
.day-box-container {
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    background: transparent !important; /* Force transparent to avoid pattern bleed */
    perspective: 1500px;
    z-index: 1;
    transition: z-index 0s linear 0.3s;
}

.day-box-container.open {
    z-index: 100;
    transition: z-index 0s linear 0s;
}

.door-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

/* The Content (Hidden behind the door initially) */
.door-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: radial-gradient(circle at center, #fff, #fff8e1);
    color: var(--text-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: inset 0 0 15px rgba(139, 69, 19, 0.15);
    
    /* Initial state for reveal animation */
    opacity: 0;
    transform: scale(0.8) translateZ(-20px);
    transition: all 0.4s ease-out;
}

.day-box-container.open .door-back {
    opacity: 1;
    transform: scale(1) translateZ(0);
    transition-delay: 0.2s;
}

/* The Door (Front Panel) */
.door-front {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    
    /* Hinge mechanics */
    transform-origin: left center;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.5s;
    transform-style: preserve-3d;
    
    /* Visuals */
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Back of the door front (the cardboard look) */
.door-front::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #d7ccc8;
    border-radius: 12px;
    transform: rotateY(180deg) translateZ(1px);
    backface-visibility: hidden;
}

.day-box-container.open .door-front {
    transform: rotateY(-115deg);
    box-shadow: -5px 5px 15px rgba(0,0,0,0.1);
}

/* Content Styling */
.content-wrapper h3 {
    font-size: 0.9rem;
    color: var(--red-primary);
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease-out 0.3s;
}

.content-wrapper p {
    font-size: 0.8rem;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease-out 0.4s;
}

.day-box-container.open .content-wrapper h3,
.day-box-container.open .content-wrapper p {
    opacity: 1;
    transform: translateY(0);
}

/* Magical Glow Burst on Open */
.day-box-container.open::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,215,0,0.6) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    animation: burst 0.6s ease-out forwards;
    z-index: 3;
    pointer-events: none;
}

@keyframes burst {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

/* Hover Effects */
.day-box-container:not(.locked):not(.open):hover .door-front {
    transform: rotateY(-15deg);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Locked State */
.day-box-container.locked {
    cursor: not-allowed;
}

.lock-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1rem;
    opacity: 0.7;
    color: rgba(255,255,255,0.8);
    z-index: 5;
}

/* Shake Animation */
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-5deg); }
    50% { transform: translateX(5px) rotate(5deg); }
    75% { transform: translateX(-5px) rotate(-5deg); }
    100% { transform: translateX(0); }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    /* Transition handled by GSAP */
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--red-primary);
    background-image: radial-gradient(rgba(255,255,255,0.2) 1px, transparent 1px);
    background-size: 20px 20px;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    padding: 3rem 2rem 2rem;
    text-align: center;
    position: relative;
    /* Transform handled by GSAP */
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 0 10px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: rgba(255,255,255,0.8);
    transition: color 0.3s;
    z-index: 10;
}

.close-btn:hover {
    color: var(--white);
}

.modal-decoration-top {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    color: var(--white);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    z-index: 5;
    display: none;
}

.modal-header h2 {
    color: var(--white);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-family: 'Quicksand', sans-serif;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.modal-body p {
    font-size: 1.3rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: var(--white);
    font-weight: 600;
}

.modal-gift-icon {
    font-size: 5rem;
    color: var(--accent-gold);
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.2));
}

/* Snow Effect in Modal */
.snow-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    color: #b0d4ff;
    font-size: 1.5rem;
    opacity: 0.8;
    pointer-events: none;
}

/* Hover Effects */
.day-box-container:hover .door-inner {
    /* Slight tilt on hover if not open */
    /* transform: rotateY(10deg);  - Optional, maybe too much */
}

.day-box-container:not(.locked):hover .door-front {
    box-shadow: 0 10px 15px rgba(0,0,0,0.15);
}

/* Adjust special box content layout */
.door-front.red-special {
    flex-direction: column;
}

/* Re-apply patterns to front faces only */
.green-dark { background-color: var(--green-dark); }
.red-dark { background-color: var(--red-dark); }
.beige { background-color: var(--beige); color: var(--white); }

.green-pattern {
    background-color: var(--green-primary);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}

.red-pattern {
    background-color: var(--red-primary);
    background-image: radial-gradient(
        circle,
        rgba(255,255,255,0.1) 2px,
        transparent 2.5px
    );
    background-size: 15px 15px;
}

.red-special {
    background-color: var(--red-primary);
    background-image: linear-gradient(135deg, var(--red-primary), var(--red-dark));
}

.merry-christmas {
    font-size: 0.6rem;
    line-height: 1.2;
    margin-top: 0.2rem;
    transform: rotate(-5deg);
}

/* Icons */
.icon-decoration {
    position: absolute;
    font-size: 2rem;
    opacity: 0.8;
}

.day-box .icon-decoration {
    bottom: 5px;
    right: 5px;
    font-size: 1.2rem;
}

.rotate {
    transform: rotate(45deg);
}

.big-gift {
    font-size: 2.5rem;
    bottom: 10px;
    right: 10px;
}

/* Footer */
footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
}

.social-icons {
    display: flex;
    gap: 1rem;
}

.social-icons a {
    color: var(--red-primary);
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.social-icons a:hover {
    transform: scale(1.2);
}

/* Responsive */
@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-content {
        align-items: center;
        text-align: center;
    }

    .santa-container {
        max-width: 200px;
    }
    
    .app-container {
        height: auto;
        overflow-y: auto;
    }
}
