/* --- BASE STYLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
}

html {
    scroll-behavior: smooth;
    overflow-y: scroll;
}

.header {
    text-align: center;
    margin-bottom: 60px;
    width: 100%;
    padding-top: 90px;
}

.header h1 { font-size: clamp(2rem, 5vw, 3rem); color: #3D3D3D; margin-bottom: 12px; }
.header p {     font-size: clamp(1rem, 3vw, 1.5rem); color: #7A7A7A; }

.page-wrapper {
    width: 1100px;
    margin: 0 auto;
    padding: 40px 0;
}

/* --- STABILIZED NAVIGATION --- */
.nav-header {
    display: grid;
    grid-template-columns: 100px 1fr 100px;
    align-items: center;
    margin-bottom: 32px;
    width: 100%;
}

.month-display {
    grid-column: 2;
    font-size: 2.25rem;
    font-weight: bold;
    color: #3D3D3D;
    text-align: center;
    white-space: nowrap;
}

.nav-button {
    padding: 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background-color: rgb(201, 169, 97);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    transition: background-color 0.2s, transform 0.1s;
}

.nav-button:hover { background-color: rgb(181, 149, 77); }
.nav-header .nav-button:first-child { justify-self: start; }
.nav-header .nav-button:last-child { justify-self: end; }

/* --- CALENDAR CONTAINER (1058px Total Width) --- */
.calendar-box {
    background-color: rgb(237, 231, 220);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    margin-bottom: 64px;
    border: 1px solid rgb(237, 231, 220);
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 1058px;
    margin-left: auto;
    margin-right: auto;
}

.weekday-header {
    display: grid;
    grid-template-columns: repeat(7, 150px);
    background-color: rgb(201, 169, 97);
    color: white;
    text-align: center;
    gap: 1px;
}

.weekday-cell { padding: 16px; font-weight: bold; }

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 150px);
    background-color: rgb(237, 231, 220);
    grid-auto-rows: minmax(150px, auto);
    gap: 1px;
}

.date-cell {
    background-color: rgb(255, 251, 245);
    padding: 8px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
    position: relative;
}

/* --- CONTENT STYLES --- */
.flex-spacer { flex-grow: 1; min-height: 0; }
.date-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.date-number { font-size: 1.15rem; font-weight: bold; color: #3D3D3D; }

.lunar-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.l-month, .l-day { font-size: 0.75rem; color: rgb(201, 169, 97); font-weight: bold; }

/* --- EVENT STYLES (Wrap without cutting words) --- */
.day-event-link { text-decoration: none; display: block; color: inherit; margin-bottom: 4px; }

.day-event-title {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.2;
    margin-top: 2px;
    white-space: normal;
    overflow-wrap: break-word; /* Allows long strings to wrap */
    word-break: normal;        /* Prevent splitting words mid-character */
    display: block;
}

.day-event-title.important { color: rgb(201, 169, 97) !important; font-weight: bold; }

.grid-event-time {
    display: block;
    color: #888;
    font-size: 0.75rem !important;
    margin-top: 1px;
}

.day-event-note {
    font-size: 0.8rem;
    color: #888;
    line-height: 1.1;
    overflow-wrap: break-word;
    word-break: normal;
    white-space: normal;
    display: block;
}

.mobile-event-badge { display: none !important; }

/* --- EVENT CARDS (Matches Calendar Width) --- */
.event-card {
    display: grid;
    grid-template-columns: 350px 1fr;
    background-color: rgb(240, 235, 227);
    border-radius: 20px;
    margin-bottom: 32px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    width: 1058px;
    margin-left: auto;
    margin-right: auto;
}

.event-img { width: 350px; height: 100%; object-fit: cover; }
.event-details { padding: 40px; display: flex; flex-direction: column; min-width: 0; }
.details-top-row { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 20px; }

.title-desc-group h3 { font-size: 1.8rem; font-weight: 600; color: #3D3D3D; margin: 0; }
.title-desc-group p { font-size: 1rem; color: #7A7A7A; line-height: 1.6; margin-top: 10px; overflow-wrap: break-word; }

.date-badge {
    background-color: rgb(201, 169, 97); color: white; padding: 16px;
    border-radius: 12px; text-align: center; min-width: 90px; flex-shrink: 0;
}
.date-badge .day-num { font-size: 1.6rem; font-weight: 500; display: block; }
.date-badge .month-name { font-size: 0.95rem; text-transform: uppercase; }

.icon-group-row {
    margin-top: auto; display: flex; align-items: center; gap: 32px;
    padding-top: 20px; border-top: 1px solid rgba(0,0,0,0.05);
}
.icon-group { display: flex; align-items: center; gap: 8px; color: rgb(61, 61, 61); }

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 1100px) {
    .page-wrapper { width: 100%; padding: 15px; }
    .nav-header { grid-template-columns: 60px 1fr 60px; }
    .month-display { font-size: 1.5rem; }

    .calendar-box, .event-card { width: 100%; }

    .weekday-header, .days-grid {
        grid-template-columns: repeat(7, 1fr);
        width: 100%;
    }

    .days-grid { grid-auto-rows: minmax(85px, auto); }
    .date-cell { min-height: 85px; padding: 4px; }
    .desktop-only { display: none !important; }

    .mobile-event-badge {
        display: block !important;
        background-color: rgb(201, 169, 97);
        color: white !important;
        font-size: 0.65rem;
        padding: 4px 2px;
        border-radius: 4px;
        text-align: center;
        margin-top: auto;
        text-decoration: none;
    }

    .event-card { grid-template-columns: 1fr; }
    .event-img { width: 100%; height: 220px; }
}