/* ==========================================================================
   IBRA events
   Upcoming events are a call to action and carry weight. Past events are
   reference, and are set back so the two never compete.
   ========================================================================== */

.ibra-events__inner {
  max-width: var(--ibra-max, 1240px);
  margin-inline: auto;
}

.ibra-events__heading {
  margin: 0 0 12px;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.ibra-events__intro {
  max-width: 78ch;
  margin: 0 0 8px;
  line-height: 1.65;
}

.ibra-events__block { margin-top: 34px; }

/* The heading row ------------------------------------------------------- */

.ibra-events__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, .12);
}

.ibra-events__subhead {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.005em;
}

.ibra-events__all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  font-size: .84rem;
  font-weight: 700;
  color: var(--accent, #7E1220) !important;
  text-decoration: none !important;
  white-space: nowrap;
}

.ibra-events__all svg {
  width: 18px;
  height: 8px;
  transition: transform .24s cubic-bezier(.4, 0, .2, 1);
}

.ibra-events__all:hover svg { transform: translateX(4px); }

/* An underline that grows from the left, rather than a link that simply
   changes colour. */
.ibra-events__all span {
  position: relative;
  padding-bottom: 2px;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: background-size .28s ease;
}

.ibra-events__all:hover span { background-size: 0 1px; }

/* The grid -------------------------------------------------------------- */

.ibra-events__grid {
  display: grid;
  gap: 26px;
}

.ibra-events__grid--upcoming { grid-template-columns: repeat(var(--up-cols, 3), minmax(0, 1fr)); }
.ibra-events__grid--past { grid-template-columns: repeat(var(--past-cols, 4), minmax(0, 1fr)); gap: 22px; }

/* Nothing to show ------------------------------------------------------- */

.ibra-events__empty {
  margin: 0;
  padding: 26px 0 4px;
  font-size: .92rem;
  line-height: 1.6;
  color: #5B6770;
}

/* An empty grid would still take its gap, and the fallback line would sit
   under a full grid. :has() settles both without counting in the template. */
.ibra-events__grid:empty { display: none; }
.ibra-events__block:has(.ibra-events__card) .ibra-events__empty { display: none; }
.ibra-events__block--past:not(:has(.ibra-events__card)) { display: none; }

/* The card -------------------------------------------------------------- */

.ibra-events__card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 8px;
  background: #fff;
  color: inherit !important;
  text-decoration: none !important;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(16, 38, 48, .1),
    0 1px 2px rgba(16, 38, 48, .04);
}

.ibra-events__card.is-link {
  transition: transform .28s cubic-bezier(.2, .7, .3, 1), box-shadow .28s ease;
}

.ibra-events__card.is-link:hover {
  transform: translateY(-4px);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent, #7E1220) 30%, transparent),
    0 2px 4px rgba(16, 38, 48, .06),
    0 22px 40px -22px rgba(16, 38, 48, .5);
}

@supports not (color: color-mix(in srgb, red 50%, transparent)) {
  .ibra-events__card.is-link:hover {
    box-shadow:
      inset 0 0 0 1px rgba(126, 18, 32, .3),
      0 2px 4px rgba(16, 38, 48, .06),
      0 22px 40px -22px rgba(16, 38, 48, .5);
  }
}

.ibra-events__card.is-link:focus-visible {
  outline: 2px solid var(--accent, #7E1220);
  outline-offset: 3px;
}

/* Media ----------------------------------------------------------------- */

.ibra-events__media {
  position: relative;
  aspect-ratio: 3 / 2;
  background: #EDF1F4;
  overflow: hidden;
}

.ibra-events--16-9 .ibra-events__media { aspect-ratio: 16 / 9; }
.ibra-events--4-3 .ibra-events__media { aspect-ratio: 4 / 3; }
.ibra-events--1-1 .ibra-events__media { aspect-ratio: 1 / 1; }

.ibra-events__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}

/* The image is cropped by its frame, so it can scale without clipping
   anything that matters. */
.ibra-events__card.is-link:hover .ibra-events__media img { transform: scale(1.04); }

.ibra-events__kind {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: var(--accent, #7E1220);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(16, 38, 48, .16);
}

/* Body ------------------------------------------------------------------ */

.ibra-events__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 22px;
}

.ibra-events__meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #5B6770;
}

.ibra-events__dot {
  flex: none;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: .6;
}

.ibra-events__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.005em;
  color: #22333F;
}

.ibra-events__card.is-link:hover .ibra-events__title { color: var(--accent, #7E1220); }

.ibra-events__summary {
  font-size: .89rem;
  line-height: 1.6;
  color: #4A5862;
}

.ibra-events__summary p { margin: 0 0 .6em; }
.ibra-events__summary p:last-child { margin-bottom: 0; }

/* Past events ------------------------------------------------------------
   Same card, quieter: no lift, smaller type, and the image muted until
   hovered so the row reads as an archive rather than a second offer. */

.ibra-events__block.is-compact .ibra-events__body { padding: 14px 16px 18px; gap: 6px; }
.ibra-events__block.is-compact .ibra-events__title { font-size: .92rem; }
.ibra-events__block.is-compact .ibra-events__meta { font-size: .72rem; }
.ibra-events__block.is-compact .ibra-events__summary { display: none; }

.ibra-events__block.is-compact .ibra-events__media img {
  filter: saturate(.72);
  opacity: .92;
  transition: filter .35s ease, opacity .35s ease, transform .5s cubic-bezier(.2, .7, .3, 1);
}

.ibra-events__block.is-compact .ibra-events__card.is-link:hover .ibra-events__media img {
  filter: none;
  opacity: 1;
}

.ibra-events__block.is-compact .ibra-events__card.is-link:hover { transform: translateY(-2px); }

/* Responsive ------------------------------------------------------------ */

@media (max-width: 1023px) {
  .ibra-events__grid--upcoming { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ibra-events__grid--past { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .ibra-events__grid--past { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ibra-events__bar { flex-wrap: wrap; gap: 8px 16px; }
}

@media (max-width: 520px) {
  .ibra-events__grid--upcoming,
  .ibra-events__grid--past { grid-template-columns: 1fr; gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .ibra-events__card.is-link,
  .ibra-events__media img,
  .ibra-events__all svg,
  .ibra-events__all span { transition: none !important; transform: none !important; }
}
