/*
 * ACF Block: Last Recent Events
 * Author: Greta Eline Poclen
 * Description: Styles for the last/recent events grid block.
 */


/* =========================================================
   SHARED BG UTILITY
   Reusable absolute-fill pattern for background images
   and overlays inside any .egloo-block
   ========================================================= */

.egloo-block .bg,
.egloo-block .bg img,
.egloo-block .bg .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.egloo-block .bg img {
  object-fit: cover;
  object-position: center;
}


/* =========================================================
   BLOCK WRAPPER
   ========================================================= */

.egloo-block.last-recent-events {
  padding-top: 4rem;
  padding-bottom: 4rem;
  background-color: #fff;

  /* Force DM Sans on all text elements within the block,
     bypassing any theme-level font overrides */
  font-family: 'DM Sans', sans-serif;
}

.egloo-block.last-recent-events * {
  /* Ensure no child element inherits a different font
     from higher-specificity theme rules */
  font-family: 'DM Sans', sans-serif;
}

/* Container restored to original width.
   Card size is now controlled via the PHP col_min_width scale factor,
   not by constraining the container here. */
.egloo-block.last-recent-events .container {
  max-width: calc(var(--site-width) + 4rem);
}


/* =========================================================
   SECTION TITLE
   ========================================================= */

.egloo-block.last-recent-events .section-title-wrap {
  text-align: center;
  margin-bottom: 3rem;
}

.egloo-block.last-recent-events .section-title {
  /* Graphico is used only for the section heading, not body text */
  font-family: var(--graphico);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
}


/* =========================================================
   EVENTS GRID
   ========================================================= */

.egloo-block.last-recent-events .events-grid {
  display: grid;
  grid-template-columns: var(--grid);
  /* gap replaces the deprecated grid-gap shorthand */
  gap: 1.5rem;
}


/* =========================================================
   SINGLE EVENT CARD
   aspect-ratio: 1/1 enforces square cards.
   min-height is a fallback for browsers without aspect-ratio support.
   ========================================================= */

.egloo-block.last-recent-events .single-event {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 240px;
}

/* Both the card and its anchor child use column flex
   so the content stretches to fill available height */
.egloo-block.last-recent-events .single-event,
.egloo-block.last-recent-events .single-event > a {
  display: flex;
  flex-direction: column;
}

.egloo-block.last-recent-events .single-event > a {
  flex: 1;
}


/* =========================================================
   OVERLAYS
   color  = accent-colored tint, revealed on hover
   grade  = dark gradient for text legibility, hidden on hover
   ========================================================= */

.egloo-block.last-recent-events .single-event .bg .overlay.color {
  background-color: var(--accent);
  opacity: 0;
  /* Shorthand replaces separate transition-duration / transition-property */
  transition: opacity 0.3s;
}

.egloo-block.last-recent-events .single-event .bg .overlay.grade {
  background-image: linear-gradient(to bottom, rgb(0 0 0 / 0.6), rgb(0 0 0 / 0.3));
  transition: opacity 0.3s;
}

/* On hover: show accent tint, hide gradient */
.egloo-block.last-recent-events .single-event:hover .bg .overlay.color {
  opacity: 0.7;
}

.egloo-block.last-recent-events .single-event:hover .bg .overlay.grade {
  opacity: 0;
}


/* =========================================================
   EVENT CONTENT AREA
   ========================================================= */

.egloo-block.last-recent-events .single-event .event-content {
  flex: 1;
  position: relative;
  padding: 1.5rem;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: space-between;
}

.egloo-block.last-recent-events .single-event .main-info {
  padding-bottom: 0.6rem;
  border-bottom: 2px solid white;
  /* Removed margin-bottom: 2rem — the parent gap handles vertical spacing */
}

.egloo-block.last-recent-events .single-event .title-wrap {
  margin-bottom: 0.4rem;
}

.egloo-block.last-recent-events .single-event .title {
  font-size: 1.1rem;
  line-height: 1.3;
  font-weight: 600;
}

.egloo-block.last-recent-events .single-event .dates {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  text-transform: uppercase;
}

.egloo-block.last-recent-events .single-event .where {
  font-size: 1rem;
  font-weight: 600;
}

.egloo-block.last-recent-events .single-event .event-arrow-wrap {
  display: flex;
  justify-content: flex-end;
}

/* Simple arrow: subtle rightward nudge on hover for tactile feedback */
.egloo-block.last-recent-events .single-event .event-arrow {
  transition: transform 0.3s;
}

.egloo-block.last-recent-events .single-event:hover .event-arrow {
  transform: translateX(5px);
}


/* =========================================================
   RESPONSIVE: mobile (max 767px)
   ========================================================= */

@media only screen and (max-width: 767px) {

  .egloo-block.last-recent-events {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  .egloo-block.last-recent-events .section-title-wrap {
    margin-bottom: 2rem;
  }

  .egloo-block.last-recent-events .section-title {
    font-size: 2rem;
    line-height: 1.1;
  }

  /* Hide accent overlay on mobile: hover states are not available
     on touch devices, so the tint would be permanently invisible anyway.
     Fixed bug: added .bg to match the correct selector depth */
  .egloo-block.last-recent-events .single-event .bg .overlay.color {
    display: none;
  }

  /* Relax aspect ratio on mobile for better readability */
  .egloo-block.last-recent-events .single-event {
    aspect-ratio: 4 / 3;
  }

  .egloo-block.last-recent-events .single-event .title,
  .egloo-block.last-recent-events .single-event .where {
    font-size: 1rem;
  }

  .egloo-block.last-recent-events .single-event .event-content {
    padding: 1.25rem 1rem;
  }

  /* On mobile, keep the gradient visible even on :hover / :focus
     since there is no true hover on touch screens */
  .egloo-block.last-recent-events .single-event:hover .bg .overlay.grade {
    opacity: 1;
  }

  /* Disable arrow nudge on touch devices */
  .egloo-block.last-recent-events .single-event:hover .event-arrow {
    transform: none;
  }
}
