.events-page {
    --bs-gutter-x: 2rem;

    padding-top: 2.5rem;
    padding-bottom: 4rem;
}

.events-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.events-toolbar h1 {
    flex: 1 1 100%;
    margin: 0;
    font-size: clamp(2rem, 6vw, 2.75rem);
    line-height: 1.1;
}

.events-months,
.events-actions {
    display: flex;
    gap: 0.4rem;
}

.events-actions {
    margin-left: auto;
}

@media (min-width: 768px) {
    .events-toolbar h1 {
        flex: 0 1 auto;
        margin-right: 0.5rem;
    }
}

.events-empty {
    margin: 0;
    padding: 1.5rem 0;
    color: var(--bs-secondary-color);
}

.event-menu {
    min-width: 17rem;
}

.event-menu-note {
    margin: 0;
    padding: 0.25rem 1rem 0.6rem;
    color: var(--bs-secondary-color);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.45;
    white-space: normal;
}

/* =========================================================
   Month grid. Hidden on phones, where the list under it does the job.
   ========================================================= */

.calendar {
    display: none;
    width: 100%;
    margin-bottom: 3rem;
    table-layout: fixed;
    border-collapse: collapse;
}

@media (min-width: 768px) {
    .calendar {
        display: table;
    }
}

.calendar th {
    padding: 0.5rem;
    color: var(--bs-secondary-color);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
}

.calendar td {
    height: 7.5rem;
    padding: 0.4rem;
    border: 1px solid var(--bs-border-color);
    vertical-align: top;
}

.calendar-day {
    display: flex;
    min-height: 1.75rem;
    align-items: center;
    justify-content: space-between;
}

.calendar-date {
    display: inline-flex;
    min-width: 1.75rem;
    height: 1.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
}

.calendar td.is-outside > * {
    opacity: 0.45;
}

.calendar td.is-today {
    background-color: rgba(var(--bs-primary-rgb), 0.08);
}

.calendar td.is-today .calendar-date {
    background-color: var(--bs-primary);
    color: var(--bs-body-bg);
}

.calendar-add {
    display: inline-flex;
    width: 1.5rem;
    height: 1.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--bs-success);
    color: #fff;
    font-size: 0.7rem;
    text-decoration: none;
    opacity: 0;
}

.calendar td:hover .calendar-add,
.calendar-add:focus-visible {
    opacity: 1;
}

.calendar-event {
    display: block;
    margin-top: 0.25rem;
    padding: 0.15rem 0.4rem;
    overflow: hidden;
    border-left: 3px solid var(--bs-primary);
    border-radius: 2px;
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    font-size: 0.78rem;
    line-height: 1.4;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event-time {
    color: var(--bs-secondary-color);
}

.calendar-event:hover,
.calendar-event.is-featured {
    background-color: var(--bs-primary);
    color: var(--bs-body-bg);
}

.calendar-event:hover .calendar-event-time,
.calendar-event.is-featured .calendar-event-time {
    color: inherit;
}

.events-month-list h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* =========================================================
   Lists of events: the calendar page and the home page
   ========================================================= */

.event-list {
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--bs-border-color);
    list-style: none;
}

.event-row {
    position: relative;
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr);
    gap: 0.5rem 1rem;
    align-items: center;
    padding: 1.1rem 0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.event-row:hover {
    background-color: var(--bs-tertiary-bg);
}

.event-row:focus-within {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

.event-row-title a:focus-visible {
    outline: none;
}

.event-row.is-featured {
    box-shadow: inset 3px 0 0 var(--bs-primary);
}

.event-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.event-date-month {
    margin-bottom: 0.2rem;
    color: var(--bs-primary);
    font-size: 0.8rem;
    font-weight: 600;
}

.event-date-day {
    font-family: var(--primary-font);
    font-size: 2rem;
}

.event-row-title {
    margin: 0 0 0.2rem;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
}

.event-row-title a {
    color: var(--bs-body-color);
    text-decoration: none;
}

.event-row:hover .event-row-title a {
    color: var(--bs-primary);
}

.event-row-when .event-hours-after-day::before {
    content: ", ";
}

.event-row-when,
.event-row-where {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
}

/* An event's flyer, small, at the end of its row. */
.event-row.has-flyer {
    grid-template-columns: 3.5rem minmax(0, 1fr) auto;
}

/* The top of a flyer is where its title usually is. */
.event-row-flyer {
    width: 5.5rem;
    height: 4rem;
    border-radius: var(--bs-border-radius-sm);
    object-fit: cover;
    object-position: center top;
}

@media (min-width: 768px) {
    .event-row {
        grid-template-columns: 4.25rem minmax(0, 1fr);
        gap: 0 1.25rem;
    }

    .event-row.has-flyer {
        grid-template-columns: 4.25rem minmax(0, 1fr) auto;
    }

    .event-row-flyer {
        width: 7.5rem;
        height: 4.75rem;
    }
}

.event-featured {
    position: relative;
    margin-bottom: 1.5rem;
    padding: clamp(1.25rem, 4vw, 2rem);
    border: 1px solid var(--bs-border-color);
    border-top: 3px solid var(--bs-primary);
    border-radius: var(--bs-border-radius);
}

.event-featured h3 {
    margin: 0 0 0.5rem;
    font-family: var(--primary-font);
    font-size: clamp(1.5rem, 4vw, 2.1rem);
    font-weight: 400;
    line-height: 1.15;
    text-wrap: balance;
}

.event-featured h3 a {
    color: var(--bs-body-color);
    text-decoration: none;
}

.event-featured:hover h3 a {
    color: var(--bs-primary);
}

.event-featured:focus-within {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.event-featured h3 a:focus-visible {
    outline: none;
}

/* A featured event with a flyer: the flyer beside the words, whole. */
.event-featured.has-flyer {
    display: grid;
    gap: 1.25rem;
    align-items: center;
}

.event-featured-flyer {
    max-width: 100%;
    max-height: 16rem;
    border-radius: var(--bs-border-radius);
}

@media (min-width: 768px) {
    .event-featured.has-flyer {
        grid-template-columns: minmax(0, 1fr) minmax(0, 40%);
    }

    .event-featured-flyer {
        justify-self: end;
    }
}

.event-list-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1.5rem;
}

/* =========================================================
   One event's page
   ========================================================= */

.event-page {
    max-width: 52rem;
}

.event-page-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.event-page-nav > a {
    text-decoration: none;
    white-space: nowrap;
}

/* On a phone the admins' buttons go under the link, in a row of their own. */
.event-page-manage {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-left: auto;
}

.event-page-header h1 {
    margin: 0.75rem 0 1.5rem;
    font-size: clamp(2rem, 6vw, 3.25rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.event-page-summary {
    display: grid;
    gap: 1.5rem 2rem;
    padding: 1.5rem;
    border: 1px solid var(--bs-border-color);
    border-top: 3px solid var(--bs-primary);
    border-radius: var(--bs-border-radius);
}

@media (min-width: 768px) {
    .event-page-summary {
        grid-template-columns: minmax(0, 1fr) auto;
    }
}

.event-facts {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.75rem 1.25rem;
    margin: 0;
}

.event-facts dt {
    color: var(--bs-secondary-color);
    font-weight: 400;
}

.event-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.event-facts .event-hours {
    display: block;
    color: var(--bs-secondary-color);
}

.event-page-actions {
    display: flex;
    min-width: 13rem;
    flex-direction: column;
    gap: 0.6rem;
}

.event-page-actions .btn {
    width: 100%;
}

.event-page-full {
    margin: 0;
    font-weight: 600;
    text-align: center;
}

/* The flyer on the event's own page: whole, and it opens at full size. */
.event-flyer {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-top: 2rem;
}

.event-flyer img {
    display: block;
    max-width: 100%;
    max-height: 40rem;
    border-radius: var(--bs-border-radius);
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.2);
}

.event-description {
    max-width: 42rem;
    margin-top: 2rem;
    overflow-wrap: anywhere;
}

.event-description > :last-child {
    margin-bottom: 0;
}

/* The "I'm coming" form */

.event-coming {
    max-width: 42rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--bs-border-color);
}

.event-coming h2 {
    margin-bottom: 0.5rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.event-coming-intro {
    margin-bottom: 1.25rem;
    color: var(--bs-secondary-color);
}

.event-coming-note {
    margin: 1rem 0 0;
    color: var(--bs-secondary-color);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* =========================================================
   Admins' forms
   ========================================================= */

.event-form fieldset {
    margin-bottom: 0.75rem;
}

/* The description's editor: a few lines tall, where the one for page text is a page. */
.event-form .ck.ck-editor__editable {
    min-height: 8rem;
}

.event-form legend {
    float: none;
    margin-bottom: 0.9rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--bs-border-color);
    color: var(--bs-primary);
    font-family: var(--primary-font);
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.event-form-switch:not(:has(:checked)) + .event-form-more:not(:has(.is-invalid)) {
    display: none;
}

.event-form-more {
    padding-left: 1.5rem;
}

.event-scope {
    margin-top: 1rem;
    padding: 0.5rem 1rem 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.event-notify {
    margin-top: 1rem;
}

.event-scope legend {
    float: none;
    width: auto;
    margin: 0;
    padding: 0 0.4rem;
    font-size: 1rem;
}
