/* events: styles for this feature. Uses the tokens in /app.css. */

/* Live badge: a red dot that breathes, on cards, chips and the event page */
.live-badge { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 2px 9px 2px 8px; border-radius: 99px; background: #d93025; color: #fff; font: 700 11px/1.5 Lato, sans-serif; letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; }
.live-dot { position: relative; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.live-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: ev-pulse 1.6s var(--ease-out) infinite; }
@keyframes ev-pulse { from { transform: scale(1); opacity: .7; } to { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .live-dot::after { animation: none; } }

/* Event cards */
.ev-item { position: relative; list-style: none; }
.ev-item .event-card { min-height: 76px; }
.ev-title { display: flex; align-items: center; gap: 8px; min-width: 0; line-height: 1.4; }
.ev-title > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-time { font-variant-numeric: tabular-nums; }
.ev-item:not(.is-live) .ev-title .live-badge { display: none; }
.ev-item.is-live .event-card { box-shadow: inset 3px 0 0 #d93025, var(--shadow-1); }
.ev-thumb { flex: none; width: 112px; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: var(--sunken); }
.ev-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ev-item.has-join .event-card { padding-right: 148px; }
.ev-join { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); min-height: 38px; padding: 8px 14px; background: #d93025; }
.ev-join:hover:not(:disabled) { background: #b3261e; box-shadow: 0 4px 12px -2px rgba(217, 48, 37, .35); }
.ev-join:active:not(:disabled) { transform: translateY(-50%) scale(.97); }
.compact .ev-thumb, .rail-card .ev-thumb { display: none; }
.compact .ev-item.has-join .event-card, .rail-card .ev-item.has-join .event-card { padding-right: 8px; padding-bottom: 50px; }
.compact .ev-join, .rail-card .ev-join { top: auto; bottom: 8px; left: 66px; right: auto; transform: none; min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
.compact .ev-item.is-live .event-card, .rail-card .ev-item.is-live .event-card { box-shadow: none; }

/* Bar above the list: filters, month navigation, List | Calendar */
.ev-new { display: flex; justify-content: flex-end; margin: 0 0 18px; }
.ev-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 0 0 18px; }
.ev-bar .spacer { flex: 1; }
.ev-bar .kind-tabs button[hidden] { display: none; }
.ev-view button, .ev-mode button { display: inline-flex; align-items: center; gap: 7px; }
.ev-view button:focus-visible, .ev-mode button:focus-visible, .ev-nav:focus-visible, .cal-more:focus-visible { outline: none; box-shadow: var(--focus); }
.ev-month { display: flex; align-items: center; gap: 6px; }
.ev-month[hidden] { display: none; }
.ev-month-title { min-width: 168px; margin: 0 4px; text-align: center; font: 700 21px/1.3 'Playfair Display', Georgia, serif; font-variant-numeric: lining-nums; color: var(--deep); }
.ev-nav { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--sunken); color: var(--deep); cursor: pointer; transition: background-color var(--dur-1); }
.ev-nav:hover { background: var(--pale); }
.ev-today { margin-left: 6px; }
.ev-out.busy { opacity: .55; transition: opacity var(--dur-2); }
.event-list > .ev-item + .ev-item { margin-top: 0; }

/* Month grid, Monday first */
.cal { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); background: var(--line); }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; }
.cal-head span { padding: 10px 10px 8px; background: var(--sunken); font: 700 11.5px/1.4 Lato, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cal-grid { margin-top: 1px; }
.cal-cell { display: flex; flex-direction: column; gap: 4px; min-height: 118px; min-width: 0; padding: 8px 6px 8px; background: var(--card); }
.cal-cell.other { background: #fafbfd; }
.cal-cell.other .cal-num { color: var(--ink-4); }
.cal-num { align-self: flex-start; display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 99px; font: 700 13.5px/1 Lato, sans-serif; font-variant-numeric: tabular-nums lining-nums; color: var(--ink-2); }
.cal-cell.today { background: linear-gradient(var(--tint), var(--tint)), var(--card); }
.cal-cell.today .cal-num { background: var(--blue); color: #fff; }
.cal-chip { display: flex; align-items: baseline; gap: 5px; min-width: 0; padding: 4px 7px; border-radius: 7px; background: var(--sunken); color: var(--deep); font-size: 12.5px; line-height: 1.4; transition: background-color var(--dur-1), box-shadow var(--dur-1); }
.cal-chip:hover { background: var(--pale); text-decoration: none; }
.cal-chip:focus-visible { outline: none; box-shadow: var(--focus); }
.cal-chip.mine { background: var(--blue); color: #fff; }
.cal-chip.mine:hover { background: #00477e; }
.cal-chip.is-live { background: #fdecea; color: #a1231b; }
.cal-chip.mine.is-live { background: #d93025; color: #fff; }
.cal-time { display: inline-flex; align-items: center; gap: 4px; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-chip .live-dot { width: 6px; height: 6px; }
.cal-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip.extra { display: none; }
.cal-cell.open .cal-chip.extra { display: flex; }
.cal-more { align-self: flex-start; border: 0; background: none; padding: 2px 6px; border-radius: 6px; color: var(--blue); font: 700 12px/1.4 Lato, sans-serif; cursor: pointer; }
.cal-more:hover { background: var(--sunken); }

/* Agenda: the calendar on phones */
.agenda { display: none; }
.agenda-day + .agenda-day { margin-top: 22px; }
.agenda-day h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; font: 700 16px/1.35 Lato, sans-serif; color: var(--deep); }
.agenda-day h3 > span:last-child { display: grid; gap: 1px; }
.agenda-day h3 .muted { font-weight: 400; }
.agenda-num { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--sunken); font: 700 17px/1 Lato, sans-serif; font-variant-numeric: tabular-nums lining-nums; }
.agenda-day.today .agenda-num { background: var(--blue); color: #fff; }
.agenda-day .event-list { margin: 0; }
@media (max-width: 640px) {
  .cal { display: none; }
  .agenda { display: block; }
  .ev-bar { gap: 12px; }
  .ev-view { order: -1; width: 100%; }
  .ev-view button { flex: 1; justify-content: center; }
  .ev-bar .spacer { display: none; }
  .ev-month { width: 100%; }
  .ev-month-title { flex: 1; min-width: 0; font-size: 19px; }
  .ev-thumb { width: 64px; aspect-ratio: 1; }
  .ev-item.has-join .event-card { padding-right: 14px; padding-bottom: 60px; }
  .ev-item.has-join .ev-thumb { display: none; }
  .ev-join { top: auto; bottom: 12px; left: 80px; right: auto; transform: none; }
  .ev-join:active:not(:disabled) { transform: scale(.97); }
}

/* Event page */
.ev-hero { margin: -28px -28px 22px; aspect-ratio: 2.4; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; background: var(--sunken); }
.ev-hero .event-image { display: block; width: 100%; height: 100%; max-height: none; margin: 0; border-radius: 0; object-fit: cover; }
.event-page > .live-badge { margin: 0 0 10px; }
.event-page.is-live .ev-join-now { background: #d93025; min-height: 46px; padding: 11px 24px; font-size: 16px; }
.event-page.is-live .ev-join-now:hover:not(:disabled) { background: #b3261e; }
.ev-place-line { margin: 10px 0 0; line-height: 1.5; padding-left: 28px; }
.ev-locked { align-self: center; line-height: 1.45; }
.ev-closed { margin: 0 0 14px; line-height: 1.5; }
.ev-spots { margin: -4px 0 16px; font-size: 14px; font-weight: 700; line-height: 1.45; color: var(--ok); font-variant-numeric: tabular-nums; }
.ev-spots.full { color: var(--danger); }
@media (max-width: 640px) { .ev-hero { margin: -20px -16px 18px; } }

/* Event editor */
.event-studio [hidden] { display: none !important; }
.event-studio .ev-block { display: grid; gap: 14px; margin: 0 0 22px; padding: 20px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-1); }
.ev-block-h { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 12px/1.4 Lato, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ev-block-h svg { color: var(--sky); }
.ev-desc-h { margin: 8px 0 10px; }
.ev-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.event-studio .ev-block label { display: grid; gap: 6px; font-weight: 700; font-size: 14px; line-height: 1.4; color: var(--deep); }
.event-studio .ev-block label > span { display: inline-flex; align-items: center; gap: 6px; }
.event-studio .ev-block label svg { width: 15px; height: 15px; color: var(--sky); }
.event-studio input[type="datetime-local"], .event-studio input[type="date"] { font-variant-numeric: tabular-nums; }
.ev-zone-note { margin: -6px 0 0; line-height: 1.5; font-variant-numeric: tabular-nums; }
.ev-zone-note:empty { display: none; }
.ev-mode { justify-self: start; }
.ev-mode svg { width: 16px; height: 16px; }
.event-studio .studio-side input[type="number"] { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .ev-times { grid-template-columns: 1fr; }
  .event-studio .ev-block { padding: 16px; }
}
.ev-filters[hidden] { display: none; }
.agenda .date-badge { display: none; }
@media (max-width: 640px) {
  .ev-item .event-card { position: relative; align-items: flex-start; }
  .ev-item .event-card .rsvp-tag { position: absolute; left: 80px; bottom: 12px; }
  .ev-item .event-card:has(.rsvp-tag) { padding-bottom: 42px; }
  .ev-item.has-join .event-card:has(.rsvp-tag) { padding-bottom: 60px; }
  .ev-item.has-join .event-card .rsvp-tag { left: auto; right: 14px; bottom: 20px; }
  .ev-item .date-badge { margin-top: 2px; }
}
