@import "src/styles/variables";

.cell {
  padding: $gap / 4;
  box-sizing: border-box;
  display: flex;
  flex: 0 0;
  background: $cell_bg;
  border-radius: $cell_radius;
  position: relative;
  cursor: pointer;
  color: white;
  background: 50% 50% no-repeat $content_bg;
  background-size: cover;
  overflow: hidden;

  .is_hero {
    .title {
      font: $font_hero_title;
    }
  }

  .is_text {
    .title {
      display: none;
    }
  }

  &:hover {
    .thumbnail {
      transform: scale(1.1);
    }
  }
  @include outer_shadow();
}

.text {
  font: $font_18_regular;
  line-height: 23px;
  background: transparentize($color: $content_bg, $amount: 0.3) url('../../../sprites/stripes.svg');
  padding: $gap;
  box-sizing: border-box;
  border-radius: $radius;
  overflow: hidden;
  position: relative;
  word-break: break-word;

  width: 100%;
  height: 100%;

  p {
    margin-bottom: $gap;
  }

  &::after {
    content: ' ';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 160px;
    pointer-events: none;
    touch-action: none;
    background: linear-gradient(transparentize($content_bg, 1), $content_bg 95%);
    z-index: 1;
    border-radius: 0 0 $radius $radius;
  }

  @media (max-width: $cell * 2 + $grid_line) {
    display: none;
  }
}

.title,
.text_title {
  font: $font_18_semibold;
  line-height: 1.25em;

  text-transform: uppercase;
  overflow: hidden;

  box-sizing: border-box;
  word-break: break-word;

  @media (max-width: $cell * 2) {
    font: $font_16_semibold;
  }
}

.title {
  padding: $gap / 2;
  opacity: 1;
  transform: translate(0, 0);
  transition: opacity 0.5s, transform 1s;

  &.small {
    @include clamp(8, 1.25em);
    font: $font_16_semibold;
  }

  &.medium{
    @include clamp(6, 1.25em);
    font: $font_18_semibold;
  }
}

.text_title {
  @include clamp(3, 1.25em);
  margin-bottom: $gap / 2;
}

.horizontal,
.quadro {
  grid-column-end: span 2;

  .text {
    width: 50%;
    height: 100%;
  }
}

.vertical,
.quadro {
  grid-row-end: span 2;

  .text {
    width: 100%;
    height: 50%;
  }

  .face_content {
    align-items: flex-end;
  }
}

.quadro {
  .text {
    width: 50%;
  }
}
@media (max-width: $cell * 2) {
  .horizontal,
  .quadro,
  .vertical,
  .quadro {
    grid-row-end: span 1;
    grid-column-end: span 1;
  }
}

.is_text {
  background: none;
  padding: 10px;
  box-shadow: inset $cell_shade 0 0 0 1px;
}

.thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 50% 50% no-repeat;
  background-size: cover;
  z-index: 1;
  border-radius: $cell_radius + 2px;
  opacity: 0;
  transition: opacity 0.5s, transform 1s;
  will-change: transform;

  & > img {
    opacity: 0;
    width: 0;
    height: 0;
  }
}

@keyframes appear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.face {
  @include outer_shadow();

  display: flex;
  overflow: hidden;
  box-sizing: border-box;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  border-radius: $cell_radius;
  padding: $gap / 2;
  animation: appear 1s forwards;
  color: white;
  text-decoration: none;
}

.menu {
  position: absolute;
  top: -$gap;
  right: -$gap;
  z-index: 4;
  border-radius: $radius;
  pointer-events: none;
  touch-action: none;
  transition: opacity 0.5s;
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: $gap;

  &:hover {
    opacity: 1;
    pointer-events: all;
    touch-action: auto;

    .menu_content {
      opacity: 1;
    }
  }

  @media (max-width: $cell * 2 + $grid_line) {
    right: 0;
    top: 0;
    display: none;
  }
}

.menu_button {
  pointer-events: all;
  touch-action: auto;
  position: absolute;
  z-index: 4;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  right: $gap;

  &::after {
    @include inner_shadow();

    content: ' ';
    width: 20px;
    height: 20px;
    background: $content_bg;
    border-radius: 100%;
    transform: scale(0.5);
    transition: transform 0.25s;
  }

  &:hover {
    &::after {
      transform: scale(1);
    }
  }
}

.menu_content {
  flex: 1;
  opacity: 0;
  background: $red_gradient;
  padding: (32px + $gap * 2) $gap $gap $gap;
  border-radius: $radius;
  display: flex;
  align-items: center;
  justify-content: center;
  display: flex;
  flex-direction: column;
  transition: opacity 0.5s;
  will-change: opacity;

  & > * {
    margin-top: $gap;
    opacity: 0.5;
    transition: opacity 0.25s;

    &:hover {
      opacity: 1;
    }
  }

  svg {
    fill: #222222;
    width: 30px;
    height: 30px;
  }
}

.menu_sep {
  width: 20px;
  height: 2px;
  flex: 0 0 4px;
  background-color: #222222;
  opacity: 0.2;
  border-radius: 2px;
}

.face_content {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  width: 100%;
}

.text_only {
  width: 100%;
  height: 100%;
  padding: $gap / 2;
  overflow: hidden;
  box-sizing: border-box;
  position: relative;

  &::after {
    content: ' ';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 160px;
    pointer-events: none;
    touch-action: none;
    background: linear-gradient(transparentize($content_bg, 1), $content_bg 95%);
    z-index: 1;
    border-radius: 0 0 $radius $radius;
  }
}
