@import url("https://fonts.googleapis.com/css2?family=Young+Serif:wght@400&display=swap");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --box-shadow-color: rgba(0, 0, 0, 0.9);
  --main-font-color: #111;
  --main-bg-color: #fafafa;
}

html,
body {
  height: 100%;
  font-family: "Young Serif", Georgia, "Times New Roman", serif;
  color: var(--main-font-color);
}

body {
  background: var(--main-bg-color);
}

.grid {
  display: grid;
  gap: 4px;
  padding: 4px;
  height: 100vh;
  grid-template-columns: repeat(2, 1fr);
  position: relative;
}

.tile {
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  align-items: flex-end;
  display: flex;
  background-color: salmon;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center center;
  transform: scale(1);
  transition: transform 6s ease;
  will-change: transform;
}

.tile:hover::before {
  transform: scale(1.08) translateY(-3%);
}

.date {
  position: absolute;
  font-family: monospace;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  background: #fff;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  box-shadow: inset 0 0 0 1px var(--box-shadow-color);
  border: 2px solid #fff;
}

.label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 5%;
  z-index: 2;
  background: #fff;
  padding: 0.5rem 1rem;
  font-size: 1.9rem;
  font-weight: 300;
  box-shadow: inset 0 0 0 1px var(--box-shadow-color);
  border: 4px solid #fff;
  text-align: center;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  background: #fff;
  padding: 0.4rem 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px var(--box-shadow-color);
  border: 2px solid #fff;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tile:hover .action {
  opacity: 1;
  visibility: visible;
}

.action-icon {
  height: 1em;
  width: auto;
  display: block;
}

.bg-1::before {
  background-image: url("https://picsum.photos/id/1015/1600/1200");
}

.bg-2::before {
  background-image: url("https://picsum.photos/id/1005/1600/1200");
}

.bg-3::before {
  background-image: url("https://picsum.photos/id/1011/1600/1200");
}

.bg-4::before {
  background-image: url("https://picsum.photos/id/1003/1600/1200");
}

@media (min-width: 900px) {
  .label {
    font-size: 2.2rem;
    padding: 12px 22px;
  }
}

@media (min-width: 600px) {
  .grid {
    height: 100vh;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr;
  }

  .tile {
    min-height: 0;
  }
}

@media (max-width: 599px) {
  .grid {
    height: auto;
    grid-template-columns: 1fr;
  }

  .tile {
    height: 40vh;
  }

  .label {
    font-size: 1.6rem;
    padding: 8px 14px;
    bottom: 5%;
  }

  .date {
    font-size: 0.8rem;
    padding: 4px 8px;
  }
}
