/* Upcoming events: ticket-stub cards (js/features/events.js) and the event editor in the Admin panel. */

.events {
  position: relative;
  z-index: 5;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding-block: clamp(56px,9vh,88px);
  padding-inline: var(--gutter);
  scroll-margin-top: 84px;
}

.events .inner {
  max-width: 1180px;
  margin: 0 auto;
}

.events h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(38px,5vw,64px);
  line-height: 1.02;
  letter-spacing: -.025em;
  margin: 0;
}

.ev-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 40px;
  flex-wrap: wrap;
}

.ev-head p {
  margin: 0;
  max-width: 30em;
  color: var(--fg-muted);
}

.ev-list {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(min(100%,360px),1fr));
  align-items: start;
  gap: 18px;
  margin-top: 30px;
}

/* ---------- ticket card ---------- */

.ev-card {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0,1fr);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color .2s ease,transform .25s ease;
}

@media (hover:hover) {
  .ev-card:hover {
    border-color: color-mix(in srgb,var(--fg) 20%,var(--line));
    transform: translateY(-2px);
  }
}

/* An open "Add to calendar" menu must sit above the cards around it. */
.ev-card:has(.ev-cal[open]) {
  z-index: 5;
}

/* Date stub, torn off along a dashed perforation with a notch top and bottom. */
.ev-stub {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 18px 8px;
  border-right: 2px dashed var(--line);
  border-radius: 15px 0 0 15px;
  background: color-mix(in srgb,var(--accent) 7%,var(--bg-raised));
  color: var(--fg);
}

.ev-stub::before,
.ev-stub::after {
  content: "";
  position: absolute;
  right: -10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
}

.ev-stub::before {
  top: -10px;
  clip-path: inset(50% 0 0 0);
}

.ev-stub::after {
  bottom: -10px;
  clip-path: inset(0 0 50% 0);
}

.ev-mon,
.ev-wd {
  font: 500 11px/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.ev-mon {
  color: var(--accent-ink);
}

.ev-wd {
  color: var(--fg-muted);
}

.ev-day {
  font: 400 44px/1 var(--display);
  letter-spacing: -.02em;
}

.ev-next .ev-stub {
  background: var(--accent);
  color: #FFF;
  border-right-color: rgba(255,255,255,.55);
}

.ev-next .ev-mon,
.ev-next .ev-wd {
  color: rgba(255,255,255,.85);
}

.ev-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 18px 22px;
  min-width: 0;
}

.ev-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb,var(--accent) 14%,transparent);
  color: var(--accent-ink);
  font: 500 11px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ev-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.ev-badge.live::before {
  animation: ev-pulse 1.3s ease-in-out infinite;
}

.ev-body h3 {
  margin: 0;
  font: 400 clamp(22px,2.2vw,27px)/1.12 var(--display);
  letter-spacing: -.01em;
  text-wrap: balance;
}

.ev-meta {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--fg);
}

.ev-meta svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ev-desc {
  margin: 2px 0 0;
  color: var(--fg-muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.ev-acts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
}

.ev-walkin {
  font-size: 13px;
  color: var(--fg-muted);
}

/* "Add to calendar" dropdown */
.ev-cal {
  position: relative;
  display: inline-block;
  flex: none;
}

.ev-cal summary {
  list-style: none;
  cursor: pointer;
}

.ev-cal summary::-webkit-details-marker {
  display: none;
}

.ev-cal summary svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.ev-cal-menu {
  position: absolute;
  z-index: 10;
  left: 0;
  top: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  min-width: 210px;
  padding: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 30px -12px rgba(20,20,19,.3);
}

.ev-cal-menu a,
.ev-cal-menu button {
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--fg);
  font: 400 14px var(--ui);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ev-cal-menu a:hover,
.ev-cal-menu button:hover {
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.ev-empty {
  grid-column: 1/-1;
  margin: 0;
  padding: 26px 24px;
  border: 1px dashed color-mix(in srgb,var(--fg) 22%,var(--line));
  border-radius: 16px;
  color: var(--fg-muted);
}

.ev-empty p {
  margin: 0;
}

.ev-empty p+p {
  margin-top: 4px;
}

.ev-empty b {
  color: var(--fg);
  font-weight: 500;
}

.ev-empty a {
  color: var(--accent-ink);
}

.ev-more {
  margin-top: 18px;
}

/* ---------- editor in the Admin panel ---------- */

.admin-ev {
  display: flex;
  flex-direction: column;
  margin: 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.admin-ev:has(> .admin-note) {
  border: 0;
}

.ae-row {
  display: grid;
  grid-template-columns: 56px minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  font-size: 14px;
}

.ae-row+.ae-row {
  border-top: 1px solid var(--line);
}

.ae-row.past {
  opacity: .55;
}

.ae-when {
  font: 500 11px/1.2 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.ae-what {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ae-what b {
  font-weight: 500;
}

.ae-what span {
  color: var(--fg-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ae-acts {
  display: flex;
  gap: 12px;
  font-size: 13.5px;
}

.linkish.danger {
  color: #B3261E;
}

.ev-form {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}

.ev-form-h {
  grid-column: 1/-1;
  margin: 0;
  font: 500 11px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.ev-form .f input[type=date],
.ev-form .f input[type=time] {
  width: 100%;
  min-width: 0;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--fg);
  font: 400 15px var(--ui);
  padding: 10px 12px;
}

.ev-form .f input[type=text],
.ev-form .f input[type=url],
.ev-form .f textarea {
  background: var(--bg-raised);
}

.ev-form .f textarea {
  min-height: 70px;
}

.ev-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-muted);
  font-size: 13px;
}

@keyframes ev-pulse {
  50% {
    opacity: .25;
  }
}

@media (max-width:720px) {
  .events {
    padding-block: 44px;
  }

  .ev-list {
    margin-top: 22px;
    gap: 14px;
  }

  .ev-card {
    grid-template-columns: 76px minmax(0,1fr);
  }

  .ev-day {
    font-size: 36px;
  }

  .ev-body {
    padding: 16px 16px 16px 18px;
  }

  .ae-row {
    grid-template-columns: 48px minmax(0,1fr);
  }

  .ae-acts {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ev-card {
    transition: none;
  }

  .ev-badge.live::before {
    animation: none;
  }
}
