/* ==========================================================================
   Why Somerset County — "World of Experiences" tile grid
   --------------------------------------------------------------------------
   Lifted out of the Home page when the revised 2026 comp dropped that section.
   Per the sitemap this grid belongs on  Set for Life > Culture, whose anchors
   are Key Demographics / Language Schools / Ethnic Grocers — the same three
   tiles this component was built for.

   To reuse:
     1. <link rel="stylesheet" href="css/components/experience-tiles.css">
        AFTER css/styles.css (it relies on the --ws-* tokens defined there).
     2. Paste the markup from snippets/experience-tiles.html
     3. Images live in img/exp-*.jpg

   Behaviour: each photo carries its brand colour as a multiply tint (sampled
   from the InDesign comp). On hover the tint fades to the full-colour photo,
   a vignette fades in to hold the label legible, and a "Learn more" pill grows
   in underneath the title.
   ========================================================================== */

.exp-grid {
  list-style: none;
  margin: clamp(28px, 3.6vw, 52px) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto auto;
  gap: clamp(18px, 2.36vw, 34px);
}
.exp-grid__tall { grid-row: span 2; }

.exp-card {
  position: relative;
  display: block;
  height: 100%;
  min-height: clamp(150px, 14.2vw, 204px);
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
  transition: transform .35s var(--ws-ease), box-shadow .35s var(--ws-ease);
}
.exp-grid__tall .exp-card { min-height: clamp(240px, 30.8vw, 444px); }

.exp-card:hover,
.exp-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, .25);
}

/* The scaling photo gets its own compositing layer on hover, which browsers
   then fail to clip to the card's rounded corners. Giving every layer the same
   radius makes the corners hold whether the clip applies or not. */
.exp-card__frame,
.exp-card__frame img,
.exp-card__tint,
.exp-card::after { border-radius: inherit; }

.exp-card__frame { position: absolute; inset: 0; overflow: hidden; }
.exp-card__frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  /* Multiply alone tints by however much the photo's own colours happen to
     disagree with the tint, so a blue photo under a blue tint barely moves.
     Draining the photo's colour first makes every tile land on one hue, so
     all four read as tinted by the same amount. Restored on hover with the
     tint, so the photo returns to full colour. */
  filter: saturate(var(--card-photo-desat));
  transition: transform .7s var(--ws-ease), filter .5s var(--ws-ease);
}
.exp-card:hover .exp-card__frame img,
.exp-card:focus-visible .exp-card__frame img {
  transform: scale(1.06);
  filter: saturate(1);
}

/* The artboard tints each photo with its brand colour set to Multiply.
   On hover the tint fades away and the photo returns to full colour. */
.exp-card__tint {
  position: absolute;
  inset: 0;
  mix-blend-mode: multiply;
  opacity: 1;
  transition: opacity .5s var(--ws-ease);
}
/* Tile blue is a more saturated take on the brand #85b5d9. The brand value is
   pale enough that multiplying with it barely registers, which left the blue
   tile looking untinted next to the other three. Same hue, more saturation. */
.exp-card { --tile-blue: #559ed6; }

.exp-card--blue  .exp-card__tint { background: var(--tile-blue); }
.exp-card--green .exp-card__tint { background: var(--ws-green-mid); }
.exp-card--amber .exp-card__tint { background: var(--ws-amber); }
.exp-card--teal  .exp-card__tint { background: var(--ws-teal); }

.exp-card:hover .exp-card__tint,
.exp-card:focus-visible .exp-card__tint { opacity: 0; }

/* Once the tint clears the photo is at full brightness, so a soft vignette
   fades in behind the label to hold the white type legible. */
.exp-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(62% 46% at 50% 50%, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, 0) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s var(--ws-ease);
}
.exp-card:hover::after,
.exp-card:focus-visible::after { opacity: 1; }

.exp-card__body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 100%;
  min-height: inherit;
  padding: 1rem;
  text-align: center;
}
.exp-card__title {
  font-size: var(--card-title-size);
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}

/* "Learn more" fades in and slides up under the title. It is taken out of
   flow so the reveal cannot change the card's layout; the title is lifted by
   its own transform instead, which keeps both movements smooth. */
/* Hover layout. Title and pill each move half of (gap + the other's height),
   which centres the pair on the card. Their heights come from their own font
   sizes - title line-height is 1.25, and the pill is 1.45 line-height plus
   .42em padding top and bottom, so 2.29em - because the two sizes clamp on
   different curves and an em of one does not track the other. */
.exp-card {
  --card-title-size: clamp(.875rem, 1.25vw, 1.125rem);
  --card-pill-size:  clamp(.8125rem, 1vw, .9375rem);
  --card-gap:        clamp(8px, 1.11vw, 16px);
  --card-title-lift: calc((var(--card-gap) + 2.29 * var(--card-pill-size)) / 2);
  --card-pill-drop:  calc((var(--card-gap) + 1.25 * var(--card-title-size)) / 2);
  --card-pill-slide: 14px;
  --card-photo-desat: .15;
}

.exp-card__title { transition: transform .4s var(--ws-ease); }
.exp-card:hover .exp-card__title,
.exp-card:focus-visible .exp-card__title {
  transform: translateY(calc(-1 * var(--card-title-lift)));
}

.exp-card__reveal .btn-pill { font-size: var(--card-pill-size); }

.exp-card__reveal {
  position: absolute;
  left: 50%;
  top: 50%;
  /* matches the title's font-size so the em maths above resolve identically;
     the pill sets its own size, so this only drives the offsets */
  font-size: var(--card-title-size);
  transform: translate(-50%, calc(-50% + var(--card-pill-drop) + var(--card-pill-slide)));
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ws-ease), transform .42s var(--ws-ease);
}
.exp-card:hover .exp-card__reveal,
.exp-card:focus-visible .exp-card__reveal {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, calc(-50% + var(--card-pill-drop)));
}

.exp-grid__cta { margin: clamp(24px, 3vw, 44px) 0 0; text-align: center; }


/* --------------------------------------------------------------------------
   Alternating narrow / wide rows
   The Fun and Life landing comps both draw the same 2 x 2 of a narrow card and
   a wide one, mirrored on the second row. A grid cannot give two rows different
   track widths, so the cards carry their own flex ratios and wrap. The ratios
   are per-section measurements — each section stylesheet sets them, and nothing
   here rounds them to a common number.
   -------------------------------------------------------------------------- */
.exp-tiles,
.fun-tiles,
.life-tiles,
.work-tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--tile-gap-y) var(--tile-gap-x);
}
.exp-tiles > li,
.fun-tiles > li,
.life-tiles > li,
.work-tiles > li { min-width: 0; }

.exp-tiles__sm,
.fun-tiles__sm,
.life-tiles__sm,
.work-tiles__sm { flex: 0 0 calc((100% - var(--tile-gap-x)) * var(--tile-sm) / var(--tile-span)); }
.exp-tiles__lg,
.fun-tiles__lg,
.life-tiles__lg,
.work-tiles__lg { flex: 0 0 calc((100% - var(--tile-gap-x)) * var(--tile-lg) / var(--tile-span)); }

/* Work's second row is three equal tiles rather than a mirrored pair. */
.exp-tiles__third,
.work-tiles__third { flex: 0 0 calc((100% - 2 * var(--tile-gap-x)) / 3); }

@media (max-width: 767.98px) {
  .exp-tiles__sm, .exp-tiles__lg, .exp-tiles__third,
  .fun-tiles__sm, .fun-tiles__lg,
  .life-tiles__sm, .life-tiles__lg,
  .work-tiles__sm, .work-tiles__lg, .work-tiles__third { flex: 0 0 100%; }
}


/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .exp-grid { grid-template-columns: minmax(0, 1fr); }
  .exp-grid__tall { grid-row: auto; }
  .exp-grid__tall .exp-card { min-height: 260px; }
  .exp-card { min-height: 190px; }
}

/* Touch devices have no hover, so show a lighter tint and the CTA up front. */
@media (hover: none) {
  .exp-card__title { transform: translateY(calc(-1 * var(--card-title-lift))); }
  .exp-card__reveal {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, calc(-50% + var(--card-pill-drop)));
  }
  .exp-card__tint { opacity: .82; }
}
