/* Month grid. Colours and sizes come from the tokens in style.css */
.days-title,
#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.days-title div {
    padding: 0 0.5rem 0.5rem;
    font-size: 0.75rem;
    color: var(--muted);
}

#calendar-grid {
    gap: 0.0625rem; /* the gap shows the border colour */
    background: var(--border);
    border: 0.0625rem solid var(--border);
    border-radius: 0.625rem;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    grid-auto-rows: minmax(0, 1fr); /* weeks share whatever height is left */
}

/* Blank cells before the 1st and after the last day */
#calendar-grid > div:not(.day) {
    background: var(--bg);
}

.day {
    min-height: 0;
    padding: 0.5rem;
    font-size: 0.75rem;
    background: var(--surface);
    overflow: hidden;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease);
}

/* Weekends (Sunday = 1st column, Saturday = 7th) */
.day:nth-child(7n + 1),
.day:nth-child(7n) {
    background: var(--surface-weekend);
}

.day:hover { background: var(--surface-2); }
.day.selected {
    background: var(--surface-2);
    box-shadow: inset 0 0 0 0.0625rem var(--border-strong);
}

.day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    margin-bottom: 0.25rem;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    border-radius: 0.75rem;
}

/* Today: the one teal ring on the screen */
.day.today .day-num {
    color: var(--text);
    font-weight: 500;
    box-shadow: inset 0 0 0 0.09375rem var(--accent);
}

/* Event lines */
.day-event {
    display: flex;
    align-items: center;
    padding: 0.125rem 0.25rem;
    margin: 0 -0.25rem 0.125rem;
    border-radius: 0.25rem;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.day-event:hover { background: var(--hover); color: var(--text); }

.day-more {
    padding: 0 0.25rem;
    color: var(--muted);
    font-size: 0.6875rem;
}

.dot {
    flex: none;
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-right: 0.5rem;
    border-radius: 0.25rem;
}

/* Today's events list */
.today-event {
    display: flex;
    align-items: baseline;
    gap: 0;
    padding: 0.5rem 0;
    border-bottom: 0.0625rem solid var(--border);
}
.today-event:last-child { border-bottom: none; }
.today-event .dot { transform: translateY(-0.0625rem); }
.today-event .event-time {
    flex: none;
    min-width: 4.5rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.today-event .event-owner { color: var(--muted); }

.calendar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.calendar-nav {
    display: flex;
    gap: 0.25rem;
}
