/* ==========================================================================
   My Travel — featured experiences
   Save as assets/css/experiences.css, load after styles.css.
   Delete the old .experience-card rules (section 10) from styles.css.

   The layout is flex rather than Bootstrap's grid for one reason: with a
   count that does not divide evenly — 7 across 3 columns — a grid leaves a
   lone card hugging the left edge. Flex with justify-content: center puts
   the remainder in the middle, so 7, 8 and 11 all look deliberate.
   ========================================================================== */

.experiences {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--exp-gap);

  --exp-gap: 16px;
  --exp-cols: 2;
}

@media (min-width: 576px) { .experiences { --exp-cols: 2; --exp-gap: 20px; } }
@media (min-width: 768px) { .experiences { --exp-cols: 4; --exp-gap: 24px; } }
@media (min-width: 992px) { .experiences { --exp-cols: 4; --exp-gap: 28px; } }

.experiences__item {
  flex: 0 1 calc((100% - (var(--exp-cols) - 1) * var(--exp-gap)) / var(--exp-cols));
  min-width: 0;
}

/* --- Card ---------------------------------------------------------------- */

.exp-card {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--mt-radius-lg, 24px);
  background-color: #eceef3;
  text-decoration: none;
  isolation: isolate;
  box-shadow: 0 2px 8px rgba(31, 39, 72, .06);
  transition: transform .35s cubic-bezier(.2, .7, .3, 1),
              box-shadow .35s ease;
}

.exp-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.2, .7, .3, 1);
}

/* Two stops rather than one: a single linear fade greys the middle of the
   photo, which on a travel image is the part worth seeing. */
.exp-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to top,
    rgba(9, 20, 32, .78) 0%,
    rgba(9, 20, 32, .45) 22%,
    rgba(9, 20, 32, .06) 46%,
    rgba(9, 20, 32, 0) 62%
  );
  transition: opacity .35s ease;
}

.exp-card__body {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: var(--mt-s3, 1.5rem) var(--mt-s3, 1.5rem) calc(var(--mt-s3, 1.5rem) + 2px);
}

.exp-card__label {
  margin: 0;
  font-family: var(--mt-font-display, Georgia, serif);
  font-size: clamp(1rem, .9rem + .4vw, 1.3125rem);
  font-weight: 500;
  line-height: 1.25;
  color: #fff;
  text-wrap: balance;
  text-shadow: 0 1px 12px rgba(9, 20, 32, .4);
}

/* Only on linked cards — an arrow promising nothing is worse than none */
.exp-card__arrow {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: auto;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, .18);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: .8125rem;
  opacity: 0;
  translate: -6px 0;
  transition: opacity .3s ease, translate .3s ease, background-color .3s ease;
}

/* --- Interaction ---------------------------------------------------------
   Hover effects only where there is a real pointer. On touch they latch
   after a tap and stay stuck until something else is tapped.
   ------------------------------------------------------------------------ */

@media (hover: hover) {
  .exp-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(31, 39, 72, .18);
  }

  .exp-card:hover .exp-card__img { transform: scale(1.06); }
  .exp-card:hover::after { opacity: .92; }

  .exp-card:hover .exp-card__arrow {
    opacity: 1;
    translate: 0 0;
    background-color: var(--mt-brand, #ee4757);
  }
}

a.exp-card:focus-visible {
  outline: 3px solid var(--mt-brand, #ee4757);
  outline-offset: 4px;
}

a.exp-card:focus-visible .exp-card__arrow {
  opacity: 1;
  translate: 0 0;
}

/* Touch devices get the arrow permanently, since there is no hover to
   reveal it */
@media (hover: none) {
  .exp-card__arrow { opacity: 1; translate: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .exp-card,
  .exp-card__img,
  .exp-card__arrow,
  .exp-card::after { transition: none; }

  .exp-card:hover { transform: none; }
  .exp-card:hover .exp-card__img { transform: none; }
}