/* ======================================
  EVENT CARD VARIABLES
====================================== */
.content-pages-show-calendar-wide {
  max-width: 1400px;
}

/* ======================================
   EVENTS LISTING BACKGROUND
   (events grid on the calendar pages)
====================================== */
[data-event-grid] .row {
  align-items: stretch;
}

@media (400px <=width <=767.98px) {
  [data-event-grid] .event-col {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

/* ======================================
   EVENT CARD
====================================== */
.event-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  height: 100%;
  padding: 16px;
  background: #ffffff;
  color: inherit;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgb(var(--secondary-rgb) / 8%);
  font-family: "Manrope", sans-serif;
  text-align: left;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.event-card:hover,
.event-card:focus {
  color: inherit;
  text-decoration: none;
}

.event-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 24px rgb(var(--secondary-rgb) / 14%);
}

.event-card:focus-visible {
  outline: 3px solid var(--brand-purple);
  outline-offset: 4px;
}

/* ======================================
   FEATURED IMAGE
====================================== */
.event-card__media {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--brand-teal-legacy);
}

.event-card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--brand-teal-legacy);
}

.event-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.event-card__image--placeholder {
  background-color: var(--brand-teal-legacy);
  background-repeat: repeat;
  background-size: 90px 90px;
}

/* ======================================
   SHARED BODY LAYOUT
====================================== */
.event-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding: 0.25rem;
}

.event-card__meta {
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  width: 100%;
  min-width: 0;
  margin-top: auto;
  padding-top: 1.25rem;
}

/* ======================================
   DATE TAG
====================================== */
.event-card__date-tag {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  align-self: flex-end;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 5rem;
  min-height: 5rem;
  padding: 0.65rem 0.75rem;
  background: var(--brand-teal-legacy);
  color: #ffffff;
  text-align: center;
}

.event-card__date-day {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  margin: 0;
}

.event-card__date-month {
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  margin: 0;
}

/* ======================================
   TITLE
====================================== */
.event-card__title {
  margin: 0;
  color: var(--brand-purple);
  font-family: "Manrope", sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: break-word;
}

/* ======================================
   PILLS
====================================== */
.event-card__pill-wrapper {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
}

.event-card__pill-wrapper p {
  width: fit-content;
  margin: 0;
  padding: 0.5rem 0.6rem;
  background: var(--brand-pale);
  color: var(--brand-purple);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.event-card__location {
  overflow-wrap: break-word;
}

.event-card__time {
  white-space: nowrap;
}

/* ======================================
   EVENT STATUS
====================================== */
.event-card__status {
  display: inline-block;
  width: fit-content;
  padding: 0.5rem 0.65rem;
  margin: 0 0 1rem;
  background: var(--brand-purple);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

/* ======================================
   FEATURED EXCERPT
====================================== */
.event-card__excerpt {
  display: -webkit-box;
  padding: 0 0.25rem;
  margin: 0 0 0.5rem;
  overflow: hidden;
  color: var(--brand-purple);
  font-family: "Manrope", sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.event-card--compact {
  height: auto;
  min-height: auto;
  padding: 16px;
}

@media (width >=768px) {
  .event-card__title {
    font-size: 28px;
    line-height: 1.2;
  }
}

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

  .event-card:hover {
    transform: none;
  }
}

/* Event header */
.event-header-container {
  margin-top: 0px;
}

body.page-type-event #page-features.carousel {
  margin-bottom: 0;
}

/* !important is used due to vendor overrides in vcs */
body.page-type-event main {
  top: 0 !important;
  margin-bottom: 0 !important;
}

body > section:first-of-type .site-header__inner {
  margin-bottom: 0 !important;
}

body.page-type-event .page-shell:has(#page-features) .event-header-container {
  margin-top: 0;
}

.event-feature-image {
  overflow: hidden;
  border-radius: 0.5rem 0.5rem 0 0;
}

.event-feature-image img {
  display: block;
  width: 100%;
  height: auto;
}

.event-header {
  background-color: var(--brand-purple);
  border-radius: 0 0 0.5rem 0.5rem;
  margin-bottom: 40px;
}

.event-header .event-header-column-headline {
  border-color: rgb(255 255 255 / 75%);
}

.event-header a {
  color: #fff;
}

.event-header a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ======================================
   SHARED UPCOMING EVENTS SECTION
   (migrated from site-upcoming-events.css;
   rendered by theme/_shared_section_upcoming_events.html on the
   homepage (page-shell) and candidate profiles (candidate-shell))

   Layout is structural: one ruleset serves both variants and every
   event count. The layout state is read from the rendered DOM via
   :has() — how many cards sit in .upcoming-events__cards next to
   the see-more button decides the arrangement:
   - button only                → 1 event  (centered card, button under)
   - one card + button          → 2 events (both cards have images,
   - two cards + button         → 3 events (featured col + thirds col)
   - three or more cards        → 4+       (classic split layout)
====================================== */
.upcoming-events {
  position: relative;
  overflow: hidden;
  padding-top: 5rem;
  padding-bottom: 0rem;
  background: var(--brand-pale);
}

/* Candidate profiles use tighter section padding than the homepage */
.upcoming-events--candidate {
  padding-block: clamp(2.5rem, 4vw, 4rem);
}

/* ======================================
   HEADER
====================================== */
.upcoming-events__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.upcoming-events__heading {
  text-align: center;
  width: 100%;
  margin-bottom: 3rem;
}

.upcoming-events__headline {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-right: auto;
  margin-top: 2rem;
  margin-bottom: 3rem;
  margin-left: auto;
  font-size: 3rem;
  font-weight: 700;
  line-height: 0.82;
  letter-spacing: 0;
}

@media (width >=576px) {
  .upcoming-events__headline {
    margin-bottom: 4rem;
    font-size: 4rem;
  }
}

@media (width >=992px) {
  .upcoming-events__headline {
    flex-direction: row;
    margin-bottom: 5rem;
    font-size: 5rem;
  }
}

.upcoming-events__headline-main {
  display: flex;
  align-items: center;
  margin: 0 auto;
  text-transform: uppercase;
  color: var(--brand-teal);
}

@media (width >=992px) {
  .upcoming-events__headline-main {
    margin: 0;
    padding-right: 0.8rem;
  }
}

.upcoming-events__headline-emphasis {
  display: block;
  width: fit-content;
  margin: 0.5rem auto 0;
  padding: 0.6rem 0.8rem;
  text-transform: uppercase;
  background-color: var(--brand-teal);
  color: #fff;
}

@media (width >=992px) {
  .upcoming-events__headline-emphasis {
    margin: 0;
  }
}

/* ======================================
   FEATURED CARD PLACEMENT + LIST
====================================== */
.upcoming-events__featured {
  margin-bottom: 2rem;
}

.upcoming-events__featured .event-card {
  margin-right: auto;
  margin-bottom: 2rem;
  margin-left: auto;
}

.upcoming-events__featured .event-card__excerpt {
  display: none;
}

@media (width >=768px) {
  .upcoming-events__featured .event-card__excerpt {
    display: -webkit-box;
  }
}

/* Desktop (>= 992px) placement for the featured column and cards is
   owned entirely by the structural ruleset at the bottom of this file. */

.upcoming-events__list {
  display: flex;
  flex-wrap: wrap;
  margin-inline: -0.9375rem;
}

.upcoming-events__featured,
.upcoming-events__cards {
  flex: 0 0 100%;
  padding-inline: 0.9375rem;
}

.upcoming-events__cards {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ======================================
   SEE MORE BUTTON
   Purple default / white on hover, matching the site CTA treatment.
====================================== */
.upcoming-events__link-btn {
  margin-top: auto;
  padding: 2.4rem 1.5rem;
  border: none;
  background-color: var(--brand-purple);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.upcoming-events__link-btn path {
  fill: #ffffff;
}

.upcoming-events__link-btn:hover,
.upcoming-events__link-btn:focus {
  background-color: #ffffff;
  color: var(--brand-purple);
}

.upcoming-events__link-btn:hover path,
.upcoming-events__link-btn:focus path {
  fill: var(--brand-purple);
}

@media (width >=768px) {
  .upcoming-events__link-btn {
    font-size: 28px;
    line-height: 1;
  }
}

/* ======================================
   DESKTOP LAYOUT (>= 992px) — structural
   Variant-agnostic (homepage + candidate) and count-agnostic.
====================================== */
@media (width >=992px) {

  /* DEFAULT (4+ events): split columns, button pinned to bottom */
  .upcoming-events .upcoming-events__list {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: clamp(1.5rem, 2.5vw, 2.5rem);
    margin-inline: 0;
  }

  .upcoming-events .upcoming-events__featured {
    flex: 0 0 42%;
    max-width: 42%;
    padding-inline: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
  }

  .upcoming-events .upcoming-events__featured .event-card {
    flex: 1 1 auto;
    max-width: none;
    margin: 0;
  }

  .upcoming-events .upcoming-events__cards {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    padding-inline: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 1.5vw, 2rem);
  }

  .upcoming-events .upcoming-events__link-btn {
    display: flex;
    flex-grow: 0;
    width: 100%;
    margin-top: auto;
  }

  /* ONE EVENT — cards column holds only the button */
  .upcoming-events:has(.upcoming-events__cards > .upcoming-events__link-btn:only-child) .upcoming-events__list {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }

  .upcoming-events:has(.upcoming-events__cards > .upcoming-events__link-btn:only-child) .upcoming-events__featured {
    flex: none;
    width: min(100%, 38rem);
    max-width: none;
  }

  .upcoming-events:has(.upcoming-events__cards > .upcoming-events__link-btn:only-child) .upcoming-events__cards {
    display: contents;
  }

  .upcoming-events:has(.upcoming-events__cards > .upcoming-events__link-btn:only-child) .upcoming-events__link-btn {
    width: min(100%, 38rem);
    margin-top: 0;
    justify-content: center;
  }

  /* TWO EVENTS — cards column is one card + button: both columns
     collapse so the two image cards and the button flex as siblings */
  .upcoming-events:has(.upcoming-events__cards > :nth-child(2):last-child) .upcoming-events__featured,
  .upcoming-events:has(.upcoming-events__cards > :nth-child(2):last-child) .upcoming-events__cards {
    display: contents;
  }

  .upcoming-events:has(.upcoming-events__cards > :nth-child(2):last-child) .event-card {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    margin: 0;
  }

  .upcoming-events:has(.upcoming-events__cards > :nth-child(2):last-child) .upcoming-events__link-btn {
    flex: 1 1 100%;
    margin-top: 0;
    justify-content: center;
  }

  /* THREE EVENTS — narrower featured col, right col as 4/11 4/11 3/11
     ratios (button a tad smaller than the cards, mirroring 4+).
     No min-height:0 — cards must never compress below their content. */
  .upcoming-events:has(.upcoming-events__cards > :nth-child(3):last-child) .upcoming-events__featured {
    flex-basis: 36%;
    max-width: 36%;
  }

  .upcoming-events:has(.upcoming-events__cards > :nth-child(3):last-child) .upcoming-events__cards>.event-card {
    flex: 0 1 auto;
    padding: 40px;
    
  }

  .upcoming-events:has(.upcoming-events__cards > :nth-child(3):last-child) .upcoming-events__link-btn {
    flex: 0 1 auto;
    width: 100%;
    margin-top: 30px;
    align-items: center;
    justify-content: center;
  }

  /* FOUR OR MORE EVENTS — right column as 3/11 3/11 3/11 2/11 ratios
     (three cards + the button). Ratios distribute surplus height only;
     without min-height:0 content can never overflow its card. The
     featured image keeps the strict 1/1 treatment shared by all cards. */
  .upcoming-events:has(.upcoming-events__cards > :nth-child(4):last-child) .upcoming-events__cards>.event-card {
    flex: 0 1 auto;
  }

  .upcoming-events:has(.upcoming-events__cards > :nth-child(4):last-child) .upcoming-events__link-btn {
    flex: 0 1 auto;
    width: 100%;
    margin-top: 0;
    align-items: center;
    justify-content: center;
  }
}
