/* ================================================
   MOSAIC LAYOUT SYSTEM
   Supports 2–9 images (Type 1–8)
   Each .mosaic--X class defines one layout pattern
   ================================================ */

/* Base mosaic setup */
.mosaic {
  display: block;
  width: 100%;
  aspect-ratio: 16/6; /* optional: maintain proportional height */
  overflow: hidden;
}

.mosaic.mosaic--3,
.mosaic.mosaic--4 {
  aspect-ratio: 16/7;
}
.mosaic.mosaic--5,
.mosaic.mosaic--6,
.mosaic.mosaic--7,
.mosaic.mosaic--8 {
  aspect-ratio: 16/8.3;
}
.content-over-mosaic .fcc-children,
.content-over-mosaic .description p {
  margin-bottom: 0;
}
.mosaic .tile {
  position: relative;
  overflow: hidden;
  background: #ccc; /* fallback for testing */
}

.solution-mosaic .tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;

  background: linear-gradient(
    to left,
    rgba(0, 0, 0, 0.65) 0%,
    /* darkest at the right edge */ rgba(0, 0, 0, 0.35) 30%,
    /* mid-fade zone */ rgba(0, 0, 0, 0.15) 55%,
    /* softer */ rgba(0, 0, 0, 0) 100% /* fully clear at the left */
  );
}

.mosaic .tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: all 500ms ease;
}
.mosaic .tile a:hover img {
  transform: scale(1.05);
}
/* -------------------------
   TYPE 1 – 2 Images
   Two equal halves, 50% width each
--------------------------*/
.mosaic.mosaic--2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  max-height: 50vh;
}

/* -------------------------
   TYPE 2 – 3 Images
   Left: 1 tall image (50%)
   Right: two stacked (25% + 25%)
--------------------------*/
.mosaic.mosaic--3 {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  grid-template-rows: 1fr;
  gap: 0;
}

.mosaic.mosaic--3 .left {
  grid-column: 1;
  display: flex;
  flex-direction: column;
}

.mosaic.mosaic--3 .left .tile {
  flex: 1 1 100%;
}

.mosaic.mosaic--3 .right {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mosaic.mosaic--3 .right .tile {
  flex: 1 1 50%;
}

/* -------------------------
   TYPE 3 – 4 Images
   Left: 25% width, 2 stacked
   Right: 75% width, 2 side by side
--------------------------*/
.mosaic.mosaic--4 {
  display: grid;
  grid-template-columns: 2.5fr 1.5fr;
  gap: 0;
}

.mosaic.mosaic--4 .col-left {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mosaic.mosaic--4 .col-left .tile {
  flex: 1 1 50%;
}

.mosaic.mosaic--4 .col-right {
  display: flex;
  flex-direction: row;
  gap: 0;
}

.mosaic.mosaic--4 .col-right .tile {
  flex: 1 1 50%;
}

/* -------------------------
   TYPE 4 – 5 Images
   Row-based layout:
   Top row: 2 × 50%
   Bottom row: 3 × 33.33%
--------------------------*/
.mosaic.mosaic--5 {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
}

.mosaic.mosaic--5 .row-top,
.mosaic.mosaic--5 .row-bottom {
  display: flex;
  gap: 0;
  height: 100%;
}

.mosaic.mosaic--5 .row-top .tile {
  flex: 1 1 50%;
}

.mosaic.mosaic--5 .row-bottom .tile {
  flex: 1 1 33.333%;
}

/* -------------------------
   TYPE 5 – 6 Images
   Two columns, mirrored
   Left: 2 small + 1 tall
   Right: 1 tall + 2 small
--------------------------*/
.mosaic.mosaic--6 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: 100%;
}

.mosaic.mosaic--6 .col-left,
.mosaic.mosaic--6 .col-right {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Left column: 2 small top + 1 large bottom */
.mosaic.mosaic--6 .col-left .small-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  height: 45%;
}

.mosaic.mosaic--6 .col-left .small-group .tile {
  flex: 1 1 50%;
}

.mosaic.mosaic--6 .col-left .tile.large {
  height: 55%;
}

/* Right column: large first, then 2 small */
.mosaic.mosaic--6 .col-right .tile.large {
  height: 50%;
}

.mosaic.mosaic--6 .col-right .small-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  height: 50%;
}

.mosaic.mosaic--6 .col-right .small-group .tile {
  flex: 1 1 50%;
}

/* -------------------------
   TYPE 6 – 7 Images
   3 Columns (25% | 50% | 25%)
   Col1 + Col3: 2 stacked
   Col2: 1 large top + 2 small bottom
--------------------------*/
.mosaic.mosaic--7 {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 0;
}

.mosaic.mosaic--7 .col-1,
.mosaic.mosaic--7 .col-3 {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mosaic.mosaic--7 .col-1 .tile,
.mosaic.mosaic--7 .col-3 .tile {
  flex: 1 1 50%;
}

.mosaic.mosaic--7 .col-2 {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mosaic.mosaic--7 .col-2 .tile.full {
  flex: 1 1 33%;
}

.mosaic.mosaic--7 .col-2 .row-bottom {
  display: flex;
  gap: 0;
  flex: 1 1 33%;
}

.mosaic.mosaic--7 .col-2 .row-bottom .tile {
  flex: 1 1 50%;
}

/* -------------------------
   TYPE 7 – 8 Images
   Left: 3 stacked (25%)
   Right: 2 rows (2 top, 3 bottom)
--------------------------*/
.mosaic.mosaic--8 {
  display: grid;
  grid-template-columns: 1fr 3fr; /* 25% | 75% */
  grid-template-rows: repeat(3, 1fr); /* 3 equal vertical segments */
  gap: 8px;
}

/* LEFT COLUMN (three stacked) */
.mosaic.mosaic--8 .tile:nth-child(1) {
  grid-column: 1;
  grid-row: 1;
}
.mosaic.mosaic--8 .tile:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}
.mosaic.mosaic--8 .tile:nth-child(3) {
  grid-column: 1;
  grid-row: 3;
}

/* RIGHT COLUMN (we'll create a nested flex layout for internal rows) */
.mosaic.mosaic--8 .right-column {
  grid-column: 2;
  grid-row: 1 / span 3; /* span full height */
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Top row: 2 images 50% each */
.mosaic.mosaic--8 .right-column .row-top {
  flex: 1;
  display: flex;
  gap: 8px;
}
.mosaic.mosaic--8 .right-column .row-top .tile {
  flex: 1 1 50%;
}

/* Bottom row: 3 images 33.333% each */
.mosaic.mosaic--8 .right-column .row-bottom {
  flex: 1;
  display: flex;
  gap: 8px;
}
.mosaic.mosaic--8 .right-column .row-bottom .tile {
  flex: 1 1 33.333%;
}

/* -------------------------
   TYPE 8 – 9 Images
   4 Columns (25% each)
   Col1: 3 stacked
   Col2–4: 2 stacked
--------------------------*/
.mosaic.mosaic--9 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  height: 100%;
}

.mosaic.mosaic--9 .col-1,
.mosaic.mosaic--9 .col-2,
.mosaic.mosaic--9 .col-3,
.mosaic.mosaic--9 .col-4 {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mosaic.mosaic--9 .col-1 .tile {
  flex: 1 1 33.333%;
}

.mosaic.mosaic--9 .col-2 .tile,
.mosaic.mosaic--9 .col-3 .tile,
.mosaic.mosaic--9 .col-4 .tile {
  flex: 1 1 50%;
}

.content-over-mosaic {
  position: absolute;
  z-index: 1;
  left: 24px;
  bottom: 24px;
}
.content-over-mosaic h3 {
  color: #fff;
  text-transform: capitalize;
  font-family: Oxanium;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0;
  font-weight: 500;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 6px;
}
.content-over-mosaic h3::after {
  content: "";
  width: 18px;
  height: 18px;
  display: inline-block;
  background-repeat: no-repeat;
  background-size: contain;

  background-image: url("../images/chevron-right.svg");
}
.content-over-mosaic .description {
  color: #fff;
  max-width: 75%;
  line-height: 1.4;
}

/* Initial collapsed state */
.content-over-mosaic {
  position: absolute;
  z-index: 2;
  left: 24px;
  bottom: 24px;
  transition: all 0.35s ease;
}

/* Title starts lower so it can animate upward */
.content-over-mosaic h3 {
  transform: translateY(20px);
  transition: transform 0.35s ease;
}

/* Hide description + button initially */
.content-over-mosaic .fcc-children,
.content-over-mosaic .description,
.content-over-mosaic .site-link {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Hover on tile shows full content */
.tile:hover .content-over-mosaic h3 {
  transform: translateY(0);
}
/* Hide description + button initially (no height taken) */
.content-over-mosaic .fcc-children,
.content-over-mosaic .description,
.content-over-mosaic .site-link {
  opacity: 0;
  line-height: 1.6;
  color: #fff;
  transform: translateY(10px);
  max-height: 0; /* collapse height */
  overflow: hidden; /* prevent layout spill */
  transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease; /* animate height */
}

.content-over-mosaic .site-link::after {
  content: "";
  width: 18px;
  height: 18px;
  display: inline-block;
  background-repeat: no-repeat;
  background-size: contain;
  background: url(../images/chevron-right.svg) center center / contain no-repeat;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.content-over-mosaic .site-link:hover::after {
  transform: translateX(4px);
  opacity: 1;
}

.tile:hover .content-over-mosaic .fcc-children,
.tile:hover .content-over-mosaic .description,
.tile:hover .content-over-mosaic .site-link {
  opacity: 1;
  transform: translateY(0);
  max-height: 200px; /* allow enough space for text */
  transition-delay: 0.05s;
}

@media (max-width: 768px) {
  /* 1. Force all mosaics into vertical stack */
  .mosaic,
  .mosaic[class*="mosaic--"] {
    display: block !important;
    aspect-ratio: auto !important;
    height: auto !important;
  }

  /* 2. Remove all layout wrappers */
  .mosaic .left,
  .mosaic .right,
  .mosaic .col-left,
  .mosaic .col-right,
  .mosaic .col-1,
  .mosaic .col-2,
  .mosaic .col-3,
  .mosaic .col-4,
  .mosaic .row-top,
  .mosaic .row-bottom,
  .mosaic .small-group,
  .mosaic .right-column {
    display: contents !important;
  }

  /* 3. One image per row */
  .mosaic .tile {
    width: 100%;
    display: block;
    position: relative;
    height: 50vw !important;
    max-height: 70vh;
    object-fit: fill !important;
  }

  /* 4. Image fills tile */
  .mosaic .tile img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .content-over-mosaic {
    position: relative;
    z-index: 2;
    left: 10px;
    transition: all 0.35s ease;
    top: 10px;
    bottom: auto;
  }
  /* 5. Disable hover-only behavior */
  .content-over-mosaic .description,
  .content-over-mosaic .site-link,
  .content-over-mosaic .fcc-children {
    opacity: 1;
    max-height: none;
    transform: none;
    font-size: 65%;
  }
  .content-over-mosaic .fcc-children {
    display: none;
  }
  .content-over-mosaic h3 {
    transform: none;
    font-size: 1.4rem;
  }
}
