/* #/events — owned by views/events.js. Tokens and shared components only; layout scoped under .evpage. */

/* ---- header: live state + pause ------------------------------------------------------------------------------ */
.ev-live { display: flex; align-items: center; gap: var(--sp-2); }
.ev-live-state { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--ink-2); padding-right: var(--sp-1); }
.ev-live-state.paused { color: var(--caution-ink); font-weight: var(--fw-semibold); }
.ev-tabs { margin-bottom: var(--sp-3); }

/* ---- filters ------------------------------------------------------------------------------------------------- */
.ev-filters { margin-bottom: var(--sp-2); }
.ev-ftoggle { display: none; }
.ev-fgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) auto; gap: var(--sp-2) var(--sp-3); align-items: end; }
.ev-fgrid select { width: 100%; }
.ev-clear { align-self: end; }
.ev-count { font-size: var(--fs-sm); margin: var(--sp-2) 0 var(--sp-1); min-height: 1.4em; }
@media (max-width: 1200px) { .ev-fgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ev-clear { justify-self: start; } }
@media (max-width: 900px) {
  .ev-ftoggle { display: inline-flex; }
  .ev-fgrid { display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
  .ev-filters.open .ev-fgrid { display: grid; }
}

/* ---- hour groups --------------------------------------------------------------------------------------------- */
.ev-list[aria-busy="true"] { opacity: .55; transition: opacity var(--dur-2) var(--ease-out); }
.ev-group + .ev-group { margin-top: var(--sp-4); }
.ev-hour {
  position: sticky; top: calc(-1 * var(--sp-5)); z-index: var(--z-sticky);
  display: flex; align-items: baseline; gap: var(--sp-2); padding: var(--sp-2) 0; margin: 0;
  background: var(--bg); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--ink);
}
.ev-hour-range { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-2); font-weight: var(--fw-regular); }
.ev-hour-n { margin-left: auto; font: var(--fw-medium) var(--fs-xs)/1 var(--font-mono); color: var(--ink-2); }
@media (max-width: 900px) { .ev-hour { top: calc(-1 * var(--sp-3)); } }

/* ---- rows ---------------------------------------------------------------------------------------------------- */
.ev-rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.ev-row {
  position: relative; display: grid; align-items: center; gap: 0 var(--sp-3);
  grid-template-columns: 72px 64px minmax(0, 1.3fr) minmax(0, 1fr) minmax(160px, auto) 84px;
  grid-template-areas: "thumb time what where meta go";
  padding: 5px var(--sp-3) 5px 5px; border-bottom: 1px solid var(--line);
  transition: background-color var(--dur-1) var(--ease-out);
}
.ev-row:last-child { border-bottom: 0; }
.ev-row:hover { background: var(--surface-2); }
.ev-row > .ev-thumb { grid-area: thumb; }
.ev-time { grid-area: time; color: var(--ink-2); }
.ev-what { grid-area: what; display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-2); min-width: 0; }
.ev-type { font-weight: var(--fw-semibold); }
a.ev-type-link { color: var(--ink); }
a.ev-type-link:hover { color: var(--accent-ink); }
.ev-arrow { display: none; color: var(--accent-ink); }
.ev-where { grid-area: where; min-width: 0; color: var(--ink-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-sep { color: var(--ink-3); }
.ev-meta { grid-area: meta; display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); }
.ev-src { font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; }
.ev-go { grid-area: go; display: flex; justify-content: flex-end; }
.ev-why { font-size: var(--fs-xs); color: var(--ink-2); }

/* thumbnails: a real image opens the lightbox; "no image" is shown honestly, never an empty hole */
.ev-thumb {
  display: grid; place-items: center; width: 72px; aspect-ratio: 16 / 9; padding: 0; overflow: hidden;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--media-bg); color: inherit; text-decoration: none;
}
button.ev-thumb { cursor: zoom-in; transition: border-color var(--dur-2) var(--ease-out); }
button.ev-thumb:hover { border-color: var(--ink-3); }
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-noimg { background: var(--surface-2); border-style: dashed; border-color: var(--line-strong); }
.ev-noimg-t { font-size: var(--fs-2xs); color: var(--ink-2); text-align: center; line-height: 1.2; padding: 0 4px; }
a.ev-entry:hover { text-decoration: none; border-color: var(--accent); }
a.ev-entry:hover .ev-noimg-t { color: var(--accent-ink); }

/* raised an alarm: the time and type carry weight; unconfirmed (perimeter hit never seen again): quieted + dashed */
.ev-row.has-alarm .ev-time { color: var(--ink); }
.ev-unconf-chip { --chip-bg: transparent; --chip-ink: var(--ink-2); --chip-line: var(--line-strong); border-style: dashed; }
.ev-row.is-unconf { background: repeating-linear-gradient(135deg, transparent 0 10px, var(--neutral-soft) 10px 11px); }
.ev-row.is-unconf .ev-type { color: var(--ink-2); font-weight: var(--fw-medium); }
.ev-row.is-unconf .ev-thumb img { filter: grayscale(1); opacity: .7; }

/* new rows arrive with a brief amber wash (opacity only) */
.ev-row.is-fresh::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--accent-soft); animation: ev-fresh 2.4s var(--ease-out) forwards; }
@keyframes ev-fresh { 0%, 30% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ev-row.is-fresh::after { animation: none; opacity: 0; } }

/* mid widths: drop the source label, keep the chip */
@media (max-width: 1200px) and (min-width: 901px) {
  .ev-row { grid-template-columns: 72px 64px minmax(0, 1.2fr) minmax(0, 1fr) auto 84px; }
  .ev-src { display: none; }
}
/* phones: thumbnail on the left, three short lines on the right */
@media (max-width: 900px) {
  .ev-row {
    grid-template-columns: 88px auto minmax(0, 1fr); gap: 2px var(--sp-2); align-items: start; padding: var(--sp-2);
    grid-template-areas: "thumb what what" "thumb where where" "thumb time meta";
  }
  .ev-thumb { width: 88px; }
  .ev-time { align-self: center; }
  .ev-meta { justify-content: flex-start; }
  .ev-go { display: none; }            /* the type is the link to the alarm on phones */
  .ev-arrow { display: inline; }
  a.ev-type-link { color: var(--accent-ink); }
}

/* ---- closed alarms ------------------------------------------------------------------------------------------- */
.ev-closed { padding: var(--sp-2) var(--sp-3); }
.ev-closed td { vertical-align: middle; }
.ev-closed .row-link td:first-child a { color: inherit; }
