:root {
    --rp-bg: #f5f7fb;
    --rp-card: #ffffff;
    --rp-text: #172033;
    --rp-muted: #667085;
    --rp-border: #e6eaf0;
    --rp-primary: #344a7d;
    --rp-primary-hover: #273a67;
    --rp-soft: #eef2f8;
    --rp-today: #fff8dc;
    --rp-shadow: 0 18px 50px rgba(16, 24, 40, 0.08);
    --rp-radius: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--rp-bg);
    color: var(--rp-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.modal-open {
    overflow: hidden;
}

.calendar-page {
    min-height: 100vh;
    padding: 36px 20px 56px;
}

.calendar-shell {
    width: min(1260px, 100%);
    margin: 0 auto;
}

.calendar-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.calendar-eyebrow {
    margin-bottom: 7px;
    color: var(--rp-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.calendar-heading h1 {
    margin: 0;
    font-size: clamp(26px, 3vw, 40px);
    line-height: 1.12;
    letter-spacing: -0.035em;
}

.calendar-heading p {
    margin: 8px 0 0;
    color: var(--rp-muted);
    font-size: 15px;
}

.calendar-card {
    position: relative;
    padding: 22px;
    background: var(--rp-card);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    box-shadow: var(--rp-shadow);
}

.calendar-loading {
    position: absolute;
    z-index: 20;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 7px 12px;
    border: 1px solid var(--rp-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--rp-muted);
    font-size: 13px;
    box-shadow: 0 6px 20px rgba(16, 24, 40, 0.08);
}

.calendar-error {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff1f0;
    color: #9f2d2d;
    font-size: 14px;
}

/* FullCalendar */

.fc {
    --fc-border-color: var(--rp-border);
    --fc-page-bg-color: #fff;
    --fc-neutral-bg-color: #f8fafc;
    --fc-list-event-hover-bg-color: #f8fafc;
    --fc-today-bg-color: var(--rp-today);
    color: var(--rp-text);
    font-size: 14px;
}

.fc .fc-toolbar.fc-header-toolbar {
    margin-bottom: 18px;
}

.fc .fc-toolbar-title {
    font-size: clamp(21px, 2.3vw, 29px);
    font-weight: 750;
    letter-spacing: -0.025em;
}

.fc .fc-button {
    border-radius: 9px;
    box-shadow: none !important;
    font-weight: 650;
    text-transform: none;
}

.fc .fc-button-primary {
    border-color: var(--rp-border);
    background: #fff;
    color: #344054;
}

.fc .fc-button-primary:hover,
.fc .fc-button-primary:focus {
    border-color: #cfd6e2;
    background: #f8fafc;
    color: #1d2939;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    border-color: var(--rp-primary);
    background: var(--rp-primary);
    color: #fff;
}

.fc .fc-backToWebsite-button {
    margin-right: 10px !important;
    border-color: var(--rp-primary) !important;
    background: #ffffff !important;
    color: var(--rp-primary) !important;
}

.fc .fc-backToWebsite-button:hover,
.fc .fc-backToWebsite-button:focus {
    background: var(--rp-soft) !important;
}

.fc .fc-col-header-cell {
    background: #fafbfc;
}

.fc .fc-col-header-cell-cushion {
    padding: 12px 8px;
    color: #475467;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    text-decoration: none;
}

.fc .fc-daygrid-day-number {
    padding: 9px 10px;
    color: #475467;
    font-weight: 650;
    text-decoration: none;
}

.fc .fc-day-other .fc-daygrid-day-number {
    color: #b1bac8;
}

.fc .fc-day-today .fc-daygrid-day-number {
    margin: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--rp-primary);
    color: #fff;
}

.fc .fc-daygrid-day-frame {
    min-height: 116px;
}

.fc .fc-daygrid-event {
    margin: 2px 5px;
    padding: 4px 7px;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
}

.fc .fc-daygrid-event:hover {
    filter: brightness(0.96);
}

.fc .fc-event-time {
    font-weight: 800;
}

.fc .fc-more-link {
    margin-left: 6px;
    color: var(--rp-primary);
    font-weight: 750;
}

.fc .fc-list {
    border-radius: 12px;
    overflow: hidden;
}

.fc .fc-list-day-cushion {
    background: #f7f9fc;
}

.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
    color: #344054;
    font-weight: 800;
    text-decoration: none;
}

.fc .fc-list-event {
    cursor: pointer;
}

.fc .fc-list-event-title a {
    color: #1d2939;
    font-weight: 700;
    text-decoration: none;
}

/* Event modal */

.event-modal[hidden] {
    display: none;
}

.event-modal {
    position: fixed;
    z-index: 9999;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
}

.event-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.event-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: min(80vh, 700px);
    overflow: auto;
    padding: 28px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.event-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: #f2f4f7;
    color: #475467;
    cursor: pointer;
    font-size: 25px;
    line-height: 34px;
}

.event-modal-close:hover {
    background: #e9edf3;
}

.event-modal-date {
    margin-bottom: 8px;
    padding-right: 42px;
    color: var(--rp-primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.event-modal-dialog h2 {
    margin: 0;
    padding-right: 35px;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.event-modal-time {
    margin-top: 10px;
    color: #475467;
    font-weight: 700;
}

.event-modal-description {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--rp-border);
    color: #475467;
    line-height: 1.65;
    white-space: pre-line;
}

.event-modal-link {
    display: inline-flex;
    margin-top: 22px;
    padding: 10px 14px;
    border-radius: 9px;
    background: var(--rp-primary);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.event-modal-link:hover {
    background: var(--rp-primary-hover);
}

.event-modal-link[hidden] {
    display: none !important;
}

.event-modal-description[hidden] {
    display: none !important;
}

@media (max-width: 900px) {
    .calendar-page {
        padding: 24px 14px 40px;
    }

    .calendar-card {
        padding: 14px;
        border-radius: 14px;
    }

    .fc .fc-toolbar {
        align-items: flex-start;
        gap: 10px;
    }

    .fc .fc-toolbar.fc-header-toolbar {
        flex-wrap: wrap;
    }

    .fc .fc-toolbar-title {
        font-size: 22px;
    }
}

@media (max-width: 720px) {
    .calendar-page {
        padding-top: 20px;
    }

    .calendar-heading {
        margin-bottom: 14px;
    }

    .calendar-heading p {
        font-size: 14px;
    }

    .calendar-card {
        padding: 10px;
    }

    .fc .fc-toolbar.fc-header-toolbar {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .fc .fc-toolbar-chunk:nth-child(1) {
        grid-column: 1 / 2;
        grid-row: 2;
    }

    .fc .fc-toolbar-chunk:nth-child(2) {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    .fc .fc-toolbar-chunk:nth-child(3) {
        grid-column: 2 / 3;
        grid-row: 2;
    }

    .fc .fc-toolbar-title {
        margin-bottom: 4px;
        text-align: left;
    }

    .fc .fc-button {
        padding: 0.38em 0.55em;
        font-size: 0.88em;
    }

    .fc .fc-backToWebsite-button {
        margin-right: 6px !important;
    }

    .event-modal-dialog {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .event-modal-dialog h2 {
        font-size: 24px;
    }
}
