/* SINGLE BACKGROUND */
.grid-wrapper {
  background: url("../images/gallery/front_side.webp") center / cover no-repeat;
  overflow: hidden;
}

/* GRID */
.grid1 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 240px);
  width: 100%;
  gap: 0; /* NO GAPS */
}

/* BASE CELL */
.cell {
  position: relative;
  overflow: hidden;
}

/* EMPTY + TITLE = TRANSPARENT */
.empty,
.title {
  background: transparent;
}

/* TITLE */
.title {
  display: flex;
  align-items: center;
}

.title h1 {
  color: white;
  font-size: calc(64 * var(--spacing));
  font-weight: 800;
  line-height: 1.05;
  padding-left: 32px; /* text only */
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

/* FEATURE CARDS */
.feature {
  background: var(--color-bg-light);
  cursor: pointer;
  padding: 32px;
}

/* TEXT */
.text {
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
}

/* PLUS */
.plus {
  position: absolute;
  bottom: 24px;
  right: 24px;
  font-size: 32px;
  font-weight: 300;
}

/* OVERLAY */
input {
  display: none;
}

.cell.feature {
  position: relative;
  cursor: pointer;
}

.overlay {
  position: absolute;
  inset: 0;
  background: white;
  color: #0e0d0d;
  padding: 2rem;
  pointer-events: none;
  clip-path: inset(12% 12% 12% 12%);
  display: grid;
  place-content: center;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.overlay h3,
.overlay p {
  opacity: 0;
  transform: translateY(8px);
}

input:checked ~ .overlay {
  opacity: 1;
}

/* GRID POSITIONS */
.r1c2 {
  grid-column: 5;
  grid-row: 2;
}
.r1c4 {
  grid-column: 2;
  grid-row: 3;
}

.r2c1-2 {
  grid-column: 1 / span 2;
  grid-row: 2;
}
.r2c3 {
  grid-column: 3;
  grid-row: 2;
}
.r2c5 {
  grid-column: 4;
  grid-row: 1;
}

.r3c1 {
  grid-column: 4;
  grid-row: 3;
}
.r3c3 {
  grid-column: 2;
  grid-row: 1;
}
.r3c5 {
  grid-column: 5;
  grid-row: 3;
}

/* TABLET */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(5, 220px);
  }
}

/* GRID LINES OVER BACKGROUND */
.grid-wrapper {
  position: relative;
}

.grid-wrapper::before,
.grid-wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

/* Vertical lines */
.grid-wrapper::before {
  background-image: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.25) 1px,
    transparent 1px
  );
  background-size: calc(100% / 5) 100%;
}

/* Horizontal lines */
.grid-wrapper::after {
  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.25) 1px,
    transparent 1px
  );
  background-size: 100% calc(100% / 3);
}
.cell.feature {
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* Other cells when one is active */
.cell.feature.is-muted {
  background-color: transparent !important;
}

/* Fade heading/text only */
.cell.feature.is-muted .text {
  color: #b5b5b5; /* ash */
}

/* Ensure active cell stays above */
.cell.feature.is-active {
  z-index: 5;
}
.text {
  font-size: calc(40 * var(--spacing));
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 768px) {
  /* GRID */
  .grid1 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(7, 180px);
    grid-auto-flow: row;
  }

  /* REMOVE ALL DESKTOP POSITIONING */
  .grid1 .cell {
    /* grid-column: auto !important; */
    /* grid-row: auto !important; */
  }

  /* ROW 1 — FEATURES */
  .r1c2 {
    grid-column: 2;
    grid-row: 5;
  }
  .r1c4 {
    grid-column: 1;
    grid-row: 6;
  }

  /* ROW 2 — TITLE (FULL WIDTH) ✅ */
  .r2c1-2 {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  /* ROW 3 */
  .r2c3 {
    grid-column: 1;
    grid-row: 4;
  }
  .r2c5 {
    grid-column: 2;
    grid-row: 3;
  }

  /* ROW 4 */
  .r3c1 {
    grid-column: 2;
    grid-row: 7;
  }
  .r3c3 {
    grid-column: 1;
    grid-row: 1;
  }
}

@media (max-width: 768px) {
  .feature {
    padding: 20px;
  }

  .text {
    font-size: 1.1rem;
  }

  .title h1 {
    font-size: 2.2rem;
    padding-left: 16px;
  }

  .overlay {
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  /* Vertical lines (2 columns) */
  .grid-wrapper::before {
    background-size: calc(100% / 2) 100%;
  }

  /* Horizontal lines (7 rows) */
  .grid-wrapper::after {
    background-size: 100% calc(100% / 7);
  }
}

@media (hover: none) {
  .cell.feature.is-muted {
    background-color: var(--color-bg-light) !important;
  }

  .cell.feature.is-muted .text {
    color: inherit;
  }
}

@media (max-width: 768px) {
  .cell.empty {
    display: none;
  }
}

@media (max-width: 768px) {
  .grid1 {
    grid-auto-flow: row;
  }
}
