/*
 * Plan tile (from the plan grid block, wpta/plan-grid), as in the Home wireframe: the plan's banner art fills the
 * tile, with a darkest-teal panel at the bottom holding its name and team size, which rises on hover to show its
 * description and "View plan".
 *
 * The art is anchored to alternate sides, so neighbouring tiles show different parts of their images.
 */

.plan-tile {
  min-width: 0;
  overflow: hidden;
  border-radius: 16px;
  background: #124f4c;
}

.plan-tile__link {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  min-height: 380px;
  overflow: hidden;
  color: #ffffff;
  text-decoration: none;
  isolation: isolate;
}

.plan-tile__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.plan-tile__image {
  z-index: -1;
  object-fit: cover;
  object-position: left top;
  transition: transform 0.45s ease;
}

.plan-tile:nth-child(even) .plan-tile__image {
  object-position: right top;
}

/*
 * The panel at the bottom: only the name and team size at first. On hover or keyboard focus it rises to the same
 * height on every tile, whatever the length of its description, and the description and "View plan" come into
 * view below the name. The panel sits over the art, so the tile itself never changes size.
 */

.plan-tile__content {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 24px;
  background: rgba(13, 61, 57, 0.9);
  transition: min-height 0.4s ease;
}

.plan-tile__title {
  color: #ffffff;
  font-family: "DM Serif Display", Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1;
}

.plan-tile__size {
  color: var(--teal);
  font-size: 14px;
  font-weight: 600;
}

/* The part that opens: rows of 0fr to 1fr let it grow from nothing to its own height */

.plan-tile__more {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.4s ease, opacity 0.3s ease;
}

.plan-tile__more-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.plan-tile__excerpt {
  padding-top: 8px;
  color: var(--teal-light);
  font-size: 15px;
  line-height: 1.5;
}

.plan-tile__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  font-weight: 600;
}

/* Raised: the same share of the tile on every plan, with "View plan" at the bottom */

.plan-tile__link:hover .plan-tile__content,
.plan-tile__link:focus-visible .plan-tile__content {
  min-height: 70%;
}

.plan-tile__link:hover .plan-tile__more,
.plan-tile__link:focus-visible .plan-tile__more {
  grid-template-rows: 1fr;
  opacity: 1;
}

/* Touch screens can't hover, so their panels start raised and the description is always there */

@media (hover: none) {
  .plan-tile__content {
    min-height: 70%;
  }

  .plan-tile__more {
    grid-template-rows: 1fr;
    opacity: 1;
  }
}

.plan-tile__link:hover .plan-tile__image,
.plan-tile__link:focus-visible .plan-tile__image {
  transform: scale(1.04);
}

.plan-tile__link:hover .plan-tile__cta,
.plan-tile__link:focus-visible .plan-tile__cta {
  text-decoration: underline;
}

.plan-tile__link:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: -6px;
}

@media (prefers-reduced-motion: reduce) {
  .plan-tile__image,
  .plan-tile__content,
  .plan-tile__more {
    transition: none;
  }
}
