/* Calendar event-details sheet (calendar-event-sheet.js, bead onfiremobile-4102f).

   Same family as the slide drawer (#slide-drawer in styles.css): a dimmed,
   blurred scrim and a dark glass sheet that slides up from the bottom edge.
   The display is dark-only (styles.css: "display-web has no light mode"), so
   there is one palette.

   Stacking: 118 sits under the slide drawer (120), so the Screens picker can
   still open over a sheet, and far under the call/talk interrupt layer
   (100000), so a ringing call always covers it.

   Motion: transform and opacity only, on the same decelerating curve as the
   drawer. The sheet is centred with translateX(-50%), so every transform in
   here (and the inline one the drag sets) keeps that term.

   Sizes are vmin with px clamps: read from across a room on a 55" panel and
   at arm's length on a 7" Pi screen. Touch targets are at least 56px. */

#cal-event-sheet {
    position: fixed;
    inset: 0;
    z-index: 118;
    overflow: hidden;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

#cal-event-sheet.ces-open {
    pointer-events: auto;
}

#cal-event-sheet .ces-scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.28s ease;
}

#cal-event-sheet.ces-open .ces-scrim {
    opacity: 1;
}

#cal-event-sheet .ces-sheet {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: min(100vw, 118vmin);
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    border-radius: clamp(18px, 2.8vmin, 38px) clamp(18px, 2.8vmin, 38px) 0 0;
    background: rgba(18, 18, 21, 0.95);
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    box-shadow: 0 -14px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    color: #fff;
    transform: translate(-50%, 100%);
    opacity: 0;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.22s ease;
    touch-action: pan-y;
}

#cal-event-sheet.ces-open .ces-sheet {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* Start-time popup: a line along the top edge that runs out as the popup's
   5 s (CAL_SHEET_ANNOUNCE_MS) pass. Hidden once someone touches the sheet. */
#cal-event-sheet .ces-countdown {
    position: absolute;
    top: 0;
    left: clamp(18px, 2.8vmin, 38px);
    right: clamp(18px, 2.8vmin, 38px);
    height: clamp(3px, 0.4vmin, 5px);
    border-radius: 999px;
    background: #FF6B1F;
    transform-origin: left center;
    transform: scaleX(0);
    opacity: 0;
    pointer-events: none;
}

#cal-event-sheet.ces-announce.ces-open .ces-countdown {
    opacity: 1;
    animation: ces-countdown 5s linear forwards;
}

@keyframes ces-countdown {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* Following a finger: no easing between pointer moves. */
#cal-event-sheet .ces-sheet.ces-dragging {
    transition: none;
}

.ces-grip-zone {
    flex: none;
    display: flex;
    justify-content: center;
    padding: clamp(10px, 1.3vmin, 18px) 0 clamp(4px, 0.6vmin, 8px);
    cursor: grab;
}

.ces-grip {
    width: clamp(40px, 6.5vmin, 80px);
    height: clamp(4px, 0.6vmin, 7px);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.3);
}

.ces-close {
    position: absolute;
    top: clamp(12px, 1.6vmin, 22px);
    right: clamp(12px, 1.8vmin, 26px);
    width: clamp(56px, 7vmin, 84px);
    height: clamp(56px, 7vmin, 84px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.ces-close svg {
    width: 44%;
    height: 44%;
}

.ces-close:hover,
.ces-close:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    outline: none;
}

.ces-close:active {
    transform: scale(0.92);
}

.ces-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0 clamp(20px, 3.4vmin, 56px) clamp(22px, 3.2vmin, 48px);
}

.ces-head {
    display: flex;
    align-items: stretch;
    gap: clamp(12px, 1.8vmin, 24px);
    /* Clear of the close button. */
    padding: clamp(4px, 0.6vmin, 10px) clamp(64px, 8.5vmin, 104px) clamp(14px, 2vmin, 28px) 0;
}

.ces-bar {
    flex: none;
    width: clamp(5px, 0.7vmin, 9px);
    border-radius: 999px;
    transition: background-color 0.3s ease;
}

.ces-head-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: clamp(6px, 0.9vmin, 12px);
}

.ces-title {
    margin: 0;
    font-size: clamp(22px, 3.7vmin, 54px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.ces-title.ces-cancelled {
    text-decoration: line-through;
    text-decoration-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.7);
}

.ces-row {
    display: flex;
    align-items: flex-start;
    gap: clamp(12px, 1.8vmin, 24px);
    padding: clamp(12px, 1.7vmin, 22px) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ces-icon {
    flex: none;
    width: clamp(20px, 3vmin, 40px);
    height: clamp(20px, 3vmin, 40px);
    margin-top: 0.1em;
    color: rgba(255, 255, 255, 0.55);
}

.ces-row-body {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 0.5vmin, 7px);
}

.ces-primary {
    font-size: clamp(16px, 2.4vmin, 34px);
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.ces-secondary {
    font-size: clamp(13px, 1.9vmin, 26px);
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.62);
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

.ces-zone {
    color: rgba(255, 255, 255, 0.5);
}

/* Links are shown, never followed: a kiosk has no back button. */
.ces-link {
    color: #8fb6ff;
    text-decoration: underline;
    text-decoration-color: rgba(143, 182, 255, 0.4);
    text-underline-offset: 0.18em;
    overflow-wrap: anywhere;
}

.ces-notes {
    font-size: clamp(14px, 2vmin, 28px);
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.ces-dot {
    display: inline-block;
    width: 0.62em;
    height: 0.62em;
    margin-right: 0.5em;
    border-radius: 50%;
    vertical-align: 0.05em;
    transition: background-color 0.3s ease;
}

.ces-pill {
    display: inline-flex;
    align-items: center;
    height: clamp(22px, 2.8vmin, 36px);
    padding: 0 clamp(9px, 1.2vmin, 16px);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(11px, 1.45vmin, 19px);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
}

.ces-pill-cancelled { background: rgba(255, 59, 48, 0.22); color: #ff8a82; }
.ces-pill-confirmed,
.ces-pill-completed { background: rgba(52, 199, 89, 0.2); color: #7ee29a; }
.ces-pill-pending,
.ces-pill-tentative { background: rgba(255, 206, 84, 0.2); color: #ffd97a; }
.ces-pill-free { background: rgba(90, 200, 250, 0.18); color: #9adcff; }
.ces-pill-starting-now { background: rgba(255, 107, 31, 0.24); color: #ffa06b; }
.ces-pill-no_show { background: rgba(255, 149, 0, 0.2); color: #ffbd66; }

.ces-people {
    list-style: none;
    margin: clamp(4px, 0.7vmin, 10px) 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 30vmin, 420px), 1fr));
    gap: clamp(6px, 0.9vmin, 12px);
}

.ces-person {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8em;
    padding: clamp(8px, 1.1vmin, 14px) clamp(10px, 1.4vmin, 18px);
    border-radius: clamp(10px, 1.4vmin, 18px);
    background: rgba(255, 255, 255, 0.06);
    font-size: clamp(14px, 1.9vmin, 26px);
}

.ces-person-name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ces-person-name em {
    font-style: normal;
    color: rgba(255, 255, 255, 0.5);
}

.ces-rsvp {
    flex: none;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: rgba(255, 255, 255, 0.55);
}

.ces-rsvp-going .ces-rsvp { color: #7ee29a; }
.ces-rsvp-maybe .ces-rsvp { color: #ffd97a; }
.ces-rsvp-not_going .ces-rsvp { color: #ff8a82; }
.ces-rsvp-not_going .ces-person-name { color: rgba(255, 255, 255, 0.5); }

.ces-retry {
    align-self: flex-start;
    margin-top: clamp(6px, 0.9vmin, 12px);
    min-height: clamp(48px, 6vmin, 72px);
    padding: 0 clamp(20px, 2.8vmin, 36px);
    border: none;
    border-radius: 999px;
    background: #FF6B1F;
    color: #fff;
    font: inherit;
    font-size: clamp(14px, 1.9vmin, 26px);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.ces-retry:active {
    transform: scale(0.96);
}

/* Skeleton for the guests/booking row while get_display_event_detail is in
   flight. Held invisible for its first 180 ms, so the usual fast answer never
   flashes a placeholder. */
.ces-skel-row {
    animation: ces-skel-in 0.2s ease 0.18s both;
}

.ces-skel {
    display: block;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0%,
        rgba(255, 255, 255, 0.16) 50%, rgba(255, 255, 255, 0.07) 100%);
    background-size: 200% 100%;
    animation: ces-shimmer 1.3s ease-in-out infinite;
}

.ces-skel-icon {
    flex: none;
    width: clamp(20px, 3vmin, 40px);
    height: clamp(20px, 3vmin, 40px);
    border-radius: 50%;
}

.ces-skel-line {
    width: 62%;
    height: clamp(14px, 2vmin, 26px);
}

.ces-skel-short {
    width: 38%;
}

@keyframes ces-skel-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ces-shimmer {
    from { background-position: 100% 0; }
    to   { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
    #cal-event-sheet .ces-scrim,
    #cal-event-sheet .ces-sheet,
    .ces-close,
    .ces-retry {
        transition-duration: 0.01ms;
    }
    .ces-skel {
        animation: none;
    }
    #cal-event-sheet.ces-announce.ces-open .ces-countdown {
        animation: none;
        transform: scaleX(1);
    }
}
