:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    /* Winter Blue */
    --gold: #f1c40f;
    --text-light: #ecf0f1;
    --card-bg: rgba(255, 255, 255, 0.15);
    --card-hover: rgba(255, 255, 255, 0.25);
    --modal-bg: rgba(255, 255, 255, 0.95);
    --font-main: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: url('assets/background.png') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

/* Animated Gradient Background */
@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

#app {
    width: 100%;
    max-width: 1200px;
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    background-color: rgba(0, 0, 0, 0.6);
    padding: 1.5rem 3rem;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    display: inline-block;
    max-width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
    color: #fff;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* Grid Layout */
#calendar-grid {
    display: grid;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
    padding: 1rem;
    z-index: 10;
    transition: opacity 0.3s ease;
}

/* Modal Styles */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#modal-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.3s ease, visibility 0s;
}

#modal-content {
    background: var(--modal-bg);
    color: var(--primary-color);
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
}

#modal-overlay.visible #modal-content {
    transform: scale(1);
}

#close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--primary-color);
    line-height: 1;
}

#modal-day {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.category-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: #fff;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#modal-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

#modal-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #34495e;
}

#modal-image-container img {
    max-height: 150px;
    width: auto;
    object-fit: contain;
    margin-top: 1rem;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    #calendar-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    header {
        padding: 1rem 1.5rem;
        margin-bottom: 1rem;
    }

    header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    #calendar-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    header {
        padding: 0.75rem 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    header p {
        font-size: 0.9rem;
    }
}

/* Day Card - Wrapped Present Design */
.day-card {
    background-color: #2980b9;
    /* Deep Blue */
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.1) 75%, transparent 75%, transparent);
    background-size: 20px 20px;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    text-align: center;
    padding: 1rem;
}

.day-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.4);
}

/* Ribbons */
.day-card::before,
.day-card::after {
    content: '';
    position: absolute;
    background-color: var(--gold);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

/* Vertical Ribbon */
.day-card::before {
    width: 20px;
    height: 100%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Horizontal Ribbon */
.day-card::after {
    width: 100%;
    height: 20px;
    cursor: default;
    transform: none;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.day-card.opened::before,
.day-card.opened::after {
    display: none;
}

/* Wrapped State: Show Date and Day in a badge */
.card-date,
.card-day {
    z-index: 2;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.card-date {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-serif);
}

.card-day {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.25rem;
}

.card-category {
    display: none;
    /* Hidden when wrapped */
}

/* Wrapped "Badge" container simulation using the elements */
.day-card:not(.opened) .card-date,
.day-card:not(.opened) .card-day {
    background: rgba(0, 0, 0, 0.5);
    /* Darker background for better readability */
    padding: 0 0.5rem;
    border-radius: 4px;
}

.day-card:not(.opened) .card-date {
    padding-top: 0.5rem;
    border-top-left-radius: 50%;
    border-top-right-radius: 50%;
    border: 2px solid var(--gold);
    border-bottom: none;
    width: 100px;
    /* Increased width to prevent wrapping */
    height: 40px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.day-card:not(.opened) .card-day {
    padding-bottom: 0.5rem;
    border-bottom-left-radius: 50%;
    border-bottom-right-radius: 50%;
    border: 2px solid var(--gold);
    border-top: none;
    width: 100px;
    /* Increased width to prevent wrapping */
    height: 40px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-top: 0;
}

/* Opened State: Spaced out info */
.day-card.opened {
    background: rgba(44, 62, 80, 0.95);
    /* Dark blue-grey background */
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    cursor: default;
    transform: none;
    justify-content: space-between;
    padding: 1.5rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.day-card.opened .card-date {
    font-size: 1rem;
    color: var(--gold);
    text-shadow: none;
    background: none;
    border: none;
    width: auto;
    height: auto;
    border-radius: 0;
}

.day-card.opened .card-category {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.day-card.opened .card-day {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: none;
    background: none;
    border: none;
    width: auto;
    height: auto;
    border-radius: 0;
}

/* Unwrap Animation */
@keyframes unwrap {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* Accessibility Improvements */

/* Focus Indicators */
.day-card:focus-visible,
#close-modal:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 4px;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .day-card:hover {
        transform: none;
    }
}

/* Reset Button */
#reset-calendar {
    margin-top: 2rem;
    padding: 0.75rem 1.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-light);
    font-family: var(--font-main);
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    backdrop-filter: blur(5px);
}

#reset-calendar:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#reset-calendar:active {
    transform: translateY(0);
}