/* ═══════════════════════════════════════════════════════════════════════
   Events page — filters, grouped event cards, event dialog, subscribe
   Each card/tile is tinted by its calendar's color (--cal).
   ═══════════════════════════════════════════════════════════════════════ */

@keyframes ev-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.9; } }
@keyframes ev-in { from { opacity: 0; } }

/* ── Top ──────────────────────────────────────────────────────────────── */
/* Uses the shared .page-hero (css/site.css), tinted with the calendar colors. */
.ev-hero:not(:has(.page-hero__img)) {
  background:
    radial-gradient(60% 120% at 0% 0%, rgba(202, 125, 214, 0.14), transparent 60%),
    radial-gradient(50% 100% at 100% 0%, rgba(71, 176, 232, 0.1), transparent 60%);
}
.page-hero:has(.page-hero__img) .ev-filter:not([aria-pressed='true']) {
  background: rgba(10, 10, 10, 0.45);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.ev-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.75rem; }
.ev-filter {
  --cal: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.ev-filter[data-cal]:not([data-cal='all'])::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cal, var(--gold));
}
.ev-filter:hover { color: var(--fg); border-color: var(--cal, var(--gold)); }
.ev-filter[aria-pressed='true'] {
  color: var(--fg);
  border-color: var(--cal, var(--gold));
  background: color-mix(in srgb, var(--cal, var(--gold)) 18%, transparent);
}
.ev-filter:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Groups and cards ─────────────────────────────────────────────────── */
.ev-list { display: flex; flex-direction: column; gap: clamp(1.75rem, 4vw, 2.75rem); padding-bottom: clamp(2.5rem, 6vw, 4rem); }
.ev-group[hidden] { display: none; }
.ev-group__title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.ev-grid {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr));
  gap: 10px 16px;
}
.ev-grid > li[hidden] { display: none; }
.ev-card {
  --cal: var(--gold);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(100deg, color-mix(in srgb, var(--cal, var(--gold)) 10%, transparent), transparent 55%),
    var(--bg-card);
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  animation: ev-in 0.4s var(--ease);
  transition: transform 0.3s var(--ease), border-color 0.25s var(--ease);
}
.ev-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--cal, var(--gold)) 55%, transparent); }
.ev-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ev-card__text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
/* Card with a picture (first image link in the event's description):
   the picture fills the card, darkened on the left so the words read. */
.ev-card.has-img {
  min-height: 112px;
  background:
    linear-gradient(90deg, rgba(20, 21, 20, 0.94) 0%, rgba(20, 21, 20, 0.82) 45%, rgba(20, 21, 20, 0.35) 100%),
    var(--img) center / cover no-repeat,
    var(--bg-card);
}
.ev-card.has-img .ev-date { background: color-mix(in srgb, var(--cal, var(--gold)) 22%, rgba(10, 10, 10, 0.55)); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ev-card.has-img .ev-card__meta { color: rgba(255, 255, 255, 0.78); }
.ev-card__title { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.ev-card__meta { font-size: 0.85rem; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

/* Date tile, in the calendar's color (same as the home page's Upcoming card). */
.ev-date {
  flex: 0 0 auto;
  width: 56px;
  height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--cal, var(--gold)) 18%, rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cal, var(--gold)) 45%, transparent);
}
.ev-date__mon { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cal, var(--gold)); }
.ev-date__day { font-family: var(--font-display); font-weight: 900; font-size: 1.6rem; line-height: 1; }
.ev-date--lg { width: 72px; height: 80px; border-radius: 18px; }
.ev-date--lg .ev-date__day { font-size: 2.1rem; }

.ev-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cal, var(--gold));
  background: color-mix(in srgb, var(--cal, var(--gold)) 14%, transparent);
}
.ev-tag--plain { color: var(--fg-muted); background: rgba(255, 255, 255, 0.06); }

/* Loading */
.ghost-pill { display: inline-block; width: 7rem; height: 0.8em; border-radius: 6px; background: rgba(255, 255, 255, 0.08); animation: ev-pulse 1.6s ease-in-out infinite; }
.ev-ghost { height: 92px; border-radius: 18px; background: color-mix(in srgb, var(--gold) 9%, transparent); animation: ev-pulse 1.6s ease-in-out infinite; }
.ev-ghost:nth-child(2n) { animation-delay: 0.15s; }
.ev-ghost:nth-child(3n) { animation-delay: 0.3s; }
.ev-empty { padding-bottom: 3rem; color: var(--fg-muted); font-size: 1.05rem; }
.ev-empty[hidden] { display: none; }

/* ── Subscribe ────────────────────────────────────────────────────────── */
.ev-sub {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem 2rem;
  margin-bottom: clamp(3rem, 6vw, 5rem);
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}
.ev-sub__title { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
.ev-sub__lead { margin-top: 0.4rem; color: var(--fg-muted); max-width: 52ch; }
.ev-sub__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.ev-sub__list li { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.ev-sub__cal, .ev-sub__ical {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  transition: background-color 0.2s var(--ease);
}
.ev-sub__ical { border-left: 1px solid var(--line-strong); color: var(--fg-muted); font-size: 0.78rem; }
.ev-sub__cal:hover, .ev-sub__ical:hover { background: rgba(255, 255, 255, 0.07); color: var(--fg); }
.ev-sub__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cal, var(--gold)); }

/* ── Dialog ───────────────────────────────────────────────────────────── */
.ev-dlg {
  width: min(600px, calc(100% - 32px));
  max-height: min(88vh, 820px);
  margin: auto; /* the site's reset clears the browser's centering */
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--bg-card);
  color: var(--fg);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.ev-dlg[open] { display: flex; flex-direction: column; animation: ev-in 0.25s var(--ease); }
.ev-dlg::backdrop { background: rgba(5, 5, 5, 0.65); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ev-dlg__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.1rem;
  padding: 1.25rem 1.25rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.ev-dlg__title { font-size: 1.5rem; line-height: 1.12; margin-top: 0.4rem; text-wrap: balance; }
.ev-dlg__close {
  align-self: start;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
  cursor: pointer;
}
.ev-dlg__close:hover { background: var(--gold); color: #111; }
.ev-dlg__close svg { width: 18px; height: 18px; }
.ev-dlg__body { padding: 1.25rem; overflow-y: auto; overscroll-behavior: contain; }
.ev-facts { display: grid; gap: 0.85rem; margin: 0; }
.ev-facts > div { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: 0.75rem; }
.ev-facts > div[hidden] { display: none; }
.ev-facts dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-faint); padding-top: 0.2rem; }
.ev-facts dd { margin: 0; font-weight: 600; }
.ev-link { color: var(--gold); font-weight: 700; text-decoration: none; word-break: break-word; }
.ev-link:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.ev-desc {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--fg-muted);
  line-height: 1.6;
  white-space: pre-line;
}
.ev-desc[hidden] { display: none; }
.ev-desc__img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0.25rem 0 0.5rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}
.ev-desc strong { color: var(--fg); }
.ev-desc ul, .ev-desc ol { margin: 0.4rem 0; padding-left: 1.25rem; white-space: normal; }
.ev-dlg__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }
.ev-dlg__actions .btn { gap: 0.5rem; }
.ev-dlg__actions svg { width: 18px; height: 18px; }
.ev-dlg__actions [hidden] { display: none; }

/* ── Smaller screens ──────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .ev-sub { grid-template-columns: minmax(0, 1fr); }
  .ev-card.has-img {
    background:
      linear-gradient(90deg, rgba(20, 21, 20, 0.95) 0%, rgba(20, 21, 20, 0.9) 60%, rgba(20, 21, 20, 0.55) 100%),
      var(--img) center / cover no-repeat,
      var(--bg-card);
  }
}
@media (max-width: 600px) {
  .ev-dlg__actions .btn { flex: 1 1 auto; justify-content: center; }
  .ev-date--lg { width: 60px; height: 68px; }
  .ev-dlg__title { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ghost-pill, .ev-ghost { animation: none; opacity: 0.6; }
  .ev-card, .ev-dlg[open] { animation: none; }
  .ev-card { transition: none; }
  .ev-card:hover { transform: none; }
}
