/*
 * calendar_day_timeline.css
 *
 * The 24-hour day timeline (calendar_day_timeline.js), shared by the Calendar
 * page's Day view and the Calendar tab in the shared right rail (owner, 2026-11-09).
 * base.html loads this file on every page, because the rail tab is on every page.
 *
 * Sections:
 *   1. Timeline frame and header
 *   2. All-day row
 *   3. Hours
 *   4. Items
 *   5. Current-time line
 *   6. Calendar page (Day view)
 *   7. Dark theme (Calendar page and right rail)
 */


/* ---------------------------------------------------------------------
 * 1. Timeline frame and header
 * --------------------------------------------------------------------- */

/* The hour height and the label column width can be changed per place (see section 6). */
.calendar-timeline {
    --calendar-timeline-hour-height: 48px;
    --calendar-timeline-gutter: 52px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    color: #172033;
}

.calendar-timeline-head {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    padding-bottom: 6px;
}

/* "GMT-7", above the hour labels. */
.calendar-timeline-timezone {
    flex: 0 0 var(--calendar-timeline-gutter);
    color: #475467;
    font-size: .72rem;
    line-height: 1.2;
}

/* "MON" over a round "9" (filled when the day is today). */
.calendar-timeline-day-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.calendar-timeline-day-badge-weekday {
    color: #536176;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.calendar-timeline-day-badge-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #172033;
    font-size: 1.45rem;
    line-height: 1;
}

.calendar-timeline-day-badge.is-today .calendar-timeline-day-badge-weekday {
    color: #087f73;
}

.calendar-timeline-day-badge.is-today .calendar-timeline-day-badge-number {
    background: #087f73;
    color: #ffffff;
}


/* ---------------------------------------------------------------------
 * 2. All-day row
 * --------------------------------------------------------------------- */

.calendar-timeline-all-day {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 0 0 auto;
    padding: 4px 0 6px;
    border-top: 1px solid #e3e9f2;
}

.calendar-timeline-all-day-label {
    flex: 0 0 var(--calendar-timeline-gutter);
    padding-top: 3px;
    color: #475467;
    font-size: .72rem;
}

.calendar-timeline-all-day-list {
    display: grid;
    flex: 1 1 auto;
    gap: 3px;
    min-width: 0;
}


/* ---------------------------------------------------------------------
 * 3. Hours
 * --------------------------------------------------------------------- */

/* Only the hours scroll; the header and the all-day row stay in place.
   The top padding keeps the "12 AM" label (drawn half above its line) from being cut off. */
.calendar-timeline-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-top: 8px;
    border-top: 1px solid #e3e9f2;
}

.calendar-timeline-grid {
    position: relative;
    height: calc(var(--calendar-timeline-hour-height) * 24);
}

.calendar-timeline-hour {
    position: relative;
    box-sizing: border-box;
    height: var(--calendar-timeline-hour-height);
    margin-left: var(--calendar-timeline-gutter);
    border-top: 1px solid #e3e9f2;
}

/* The hour sits on its line, in the column to the left of the hours. */
.calendar-timeline-hour-label {
    position: absolute;
    top: 0;
    right: calc(100% + 8px);
    transform: translateY(-50%);
    color: #475467;
    font-size: .74rem;
    white-space: nowrap;
}

/* Clicking empty space in an hour starts a new item (Calendar page only). */
.calendar-timeline-grid.is-creatable .calendar-timeline-hour {
    cursor: pointer;
}

.calendar-timeline-grid.is-creatable .calendar-timeline-hour:hover {
    background: #f4fbfa;
}


/* ---------------------------------------------------------------------
 * 4. Items
 * --------------------------------------------------------------------- */

/* The layer over the hours lets clicks through to the hours; the items themselves take clicks. */
.calendar-timeline-items {
    position: absolute;
    top: 0;
    right: 6px;
    bottom: 0;
    left: calc(var(--calendar-timeline-gutter) + 2px);
    pointer-events: none;
}

/* site.css sets every link's size and weight from --site-fs and --site-fw (!important). */
.calendar-timeline-event {
    --site-fs: .75rem;
    --site-fw: 600;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
    border: 0;
    border-left: 3px solid #087f73;
    border-radius: 4px;
    padding: 2px 6px;
    background: #e8f7f4;
    color: #075e55;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    text-decoration: none;
    pointer-events: auto;
}

.calendar-timeline-event:hover,
.calendar-timeline-event:focus-visible {
    background: #d6f1ec;
    color: #075e55;
}

.calendar-timeline-event:focus-visible {
    outline: 3px solid #f1b54a;
    outline-offset: 1px;
}

.calendar-timeline-event--timed {
    position: absolute;
    box-shadow: 0 0 0 1px #ffffff;
}

.calendar-timeline-event-title,
.calendar-timeline-event-time {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-timeline-event-time {
    font-weight: 400;
}

/* Items under an hour long: title and time on one line. */
.calendar-timeline-event.is-short {
    flex-direction: row;
    gap: 6px;
}

.calendar-timeline-event.is-saving {
    opacity: .6;
}


/* ---------------------------------------------------------------------
 * 5. Current-time line
 * --------------------------------------------------------------------- */

.calendar-timeline-now {
    position: absolute;
    right: 0;
    left: var(--calendar-timeline-gutter);
    z-index: 2;
    height: 2px;
    margin-top: -1px;
    background: #d93025;
    pointer-events: none;
}

.calendar-timeline-now::before {
    content: "";
    position: absolute;
    top: -4px;
    left: -5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d93025;
}


/* ---------------------------------------------------------------------
 * 6. Calendar page (Day view)
 * --------------------------------------------------------------------- */

/* The hours scroll inside the card, like the week grid of other calendars. */
.calendar-timeline--page {
    --calendar-timeline-gutter: 60px;
    height: 70vh;
    min-height: 360px;
    padding: 14px 14px 0;
}

/* The Day view's "+" button sits at the end of the header and always shows. */
.calendar-timeline--page .calendar-timeline-head .calendar-day-add-button {
    position: static;
    margin-left: auto;
    align-self: center;
    opacity: 1;
}


/* ---------------------------------------------------------------------
 * 7. Dark theme (Calendar page and right rail)
 *    These used to apply only to the Calendar page, so the right rail's hours kept
 *    their light lines and labels (owner, 2026-11-17).
 * --------------------------------------------------------------------- */

[data-theme="dark"] .calendar-timeline {
    color: #eef5ff;
}

/* The hours' scrollbar uses the site's dark scrollbar colours (static/css/site_dark_scrollbars.css). */

[data-theme="dark"] .calendar-timeline .calendar-timeline-scroll,
[data-theme="dark"] .calendar-timeline .calendar-timeline-all-day,
[data-theme="dark"] .calendar-timeline .calendar-timeline-hour {
    border-color: #29405b;
}

[data-theme="dark"] .calendar-timeline .calendar-timeline-timezone,
[data-theme="dark"] .calendar-timeline .calendar-timeline-all-day-label,
[data-theme="dark"] .calendar-timeline .calendar-timeline-hour-label,
[data-theme="dark"] .calendar-timeline .calendar-timeline-day-badge-weekday {
    color: #b3c3d8;
}

[data-theme="dark"] .calendar-timeline .calendar-timeline-day-badge-number {
    color: #eef5ff;
}

[data-theme="dark"] .calendar-timeline .calendar-timeline-day-badge.is-today .calendar-timeline-day-badge-weekday {
    color: #73e3d9;
}

[data-theme="dark"] .calendar-timeline .calendar-timeline-day-badge.is-today .calendar-timeline-day-badge-number {
    background: #238b83;
    color: #ffffff;
}

[data-theme="dark"] .calendar-timeline .calendar-timeline-grid.is-creatable .calendar-timeline-hour:hover {
    background: #142d39;
}

[data-theme="dark"] .calendar-timeline .calendar-timeline-event {
    background: #173e49;
    border-color: #238b83;
    color: #8cefe7;
    box-shadow: 0 0 0 1px #101a2d;
}
