/*
 * Styling for the kzu/agenda block: month calendar + list of events for the
 * displayed month. Uses the active theme's design tokens (--color-*,
 * --font-display) as the integration point instead of hardcoding
 * colors/fonts here, so the block stays on-brand if the theme's palette
 * changes -- falls back to sensible plain values if a theme without those
 * tokens is ever active.
 */

.kzu-agenda__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.kzu-agenda__title {
    flex: 1 0 auto;
    margin: 0;
    font-size: 20px;
    text-align: center;
}

.kzu-agenda__nav {
    font-family: var(--font-display, inherit);
    font-weight: 900;
    font-size: 13px;
    background: var(--color-white, #fff);
    border: 1px solid var(--color-black, #000);
    color: var(--color-black, #000);
    cursor: pointer;
    padding: 8px 12px;
    line-height: 1;
}

.kzu-agenda__nav:hover,
.kzu-agenda__nav:focus {
    background: var(--color-black, #000);
    color: var(--color-white, #fff);
}

.kzu-agenda__nav--prev,
.kzu-agenda__nav--next {
    font-size: 16px;
    padding: 6px 14px;
}

.kzu-agenda__nav--today {
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.kzu-agenda__grid {
    display: flex;
    flex-direction: column;
    /* Keeps the grid from reading as a flat, squashed strip on wide pages --
       the weekday-label row is fixed-height, every week row then shares the
       rest of this 4:3 box equally (see .kzu-agenda__week flex below). */
    aspect-ratio: 16 / 9;
    border: 1px solid var(--color-grey-light, #b3b3b3);
    border-bottom: 0;
}

.kzu-agenda__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex: 0 0 auto;
    background: var(--color-black, #000);
}

.kzu-agenda__weekday {
    padding: 6px 8px;
    color: var(--color-white, #fff);
    font-family: var(--font-display, inherit);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-align: right;
}

.kzu-agenda__week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    /* Every week row gets an equal share of the grid's remaining height
       (flex-basis 0, grown equally), regardless of whether the month needs
       4, 5 or 6 rows -- that's what keeps the overall box at a steady 4:3
       instead of only being as tall as the shortest week needs. */
    flex: 1 1 0;
    min-height: 0;
    grid-auto-rows: 1fr;
    border-bottom: 1px solid var(--color-grey-light, #b3b3b3);
}

.kzu-agenda__day {
    padding: 4px 8px 2px;
    align-self: start;
    text-align: right;
    font-size: 12px;
    color: var(--color-black, #000);
    border-left: 1px solid var(--color-grey-light, #b3b3b3);
}

.kzu-agenda__day--outside {
    color: var(--color-grey-light, #b3b3b3);
}

.kzu-agenda__day--today {
    background: rgba(226, 0, 121, 0.08);
    font-weight: 700;
}

.kzu-agenda__event {
    display: block;
    width: 100%;
    align-self: start;
    margin: 1px 2px;
    padding: 2px 6px;
    background: var(--color-accent, #e20079);
    color: var(--color-white, #fff);
    font-family: inherit;
    font-size: 11px;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: break-word;
    border: 0;
    cursor: pointer;
}

.kzu-agenda__event:hover,
.kzu-agenda__event:focus {
    background: var(--color-black, #000);
    color: var(--color-white, #fff);
}

.kzu-agenda__list-wrap {
    margin-top: 28px;
}

.kzu-agenda__list-heading {
    font-size: 15px;
    margin: 0 0 12px;
}

.kzu-agenda__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kzu-agenda__list-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    padding: 10px 14px;
    border-left: 4px solid var(--color-accent, #e20079);
    background: #f7f7f7;
    transition: background-color 0.3s ease;
}

/* Briefly flashed after a tap/click on the matching calendar bar scrolls
   this entry into view, so it's obvious which one just got jumped to. */
.kzu-agenda__list-item--highlight {
    background: rgba(226, 0, 121, 0.15);
}

.kzu-agenda__list-date {
    font-family: var(--font-display, inherit);
    font-size: 12px;
    white-space: nowrap;
    color: var(--color-black, #000);
}

.kzu-agenda__list-title {
    color: var(--color-black, #000);
}

.kzu-agenda__list-details {
    color: var(--color-grey-light, #b3b3b3);
    font-size: 12px;
}

a.kzu-agenda__list-title {
    text-decoration: underline;
}

a.kzu-agenda__list-title:hover,
a.kzu-agenda__list-title:focus {
    color: var(--color-accent, #e20079);
}

.kzu-agenda__empty,
.kzu-agenda__empty-message {
    color: var(--color-grey-light, #b3b3b3);
}

@media screen and (max-width: 740px) {
    .kzu-agenda__grid {
        /* 4:3 gets cramped once the width (and so the height) drops this
           far -- a taller ratio buys the day numbers and event bars more
           room without changing how many weeks/columns are shown. */
        aspect-ratio: 3 / 4;
    }

    .kzu-agenda__title {
        font-size: 16px;
    }

    .kzu-agenda__weekday {
        font-size: 10px;
        padding: 4px;
    }

    .kzu-agenda__day {
        font-size: 10px;
        padding: 2px 3px 1px;
    }

    .kzu-agenda__event {
        /* Full titles don't fit this narrow -- wrapping them pushed whole
           weeks tall and distorted the grid, so on mobile an event is just
           a small colour bar across the days it covers; the title is still
           there for screen readers/long-press, and the full text is always
           available in the month list below the grid. */
        height: 6px;
        min-height: 6px;
        margin: 2px 1px 0;
        padding: 0;
        border-radius: 2px;
        font-size: 0;
        line-height: 0;
        color: transparent;
        overflow: hidden;
    }

    .kzu-agenda__list-item {
        flex-direction: column;
        gap: 2px;
    }
}
