.CardBase {
  display: grid;
  position: relative;
  
  .CardBaseText, .CardBaseImage {
    grid-row: 1;
    grid-column: 1;
    transition: transform 0.2s ease-in;

    img {
      transition: all 0.2s;

      &.loading {
        opacity: 0;
        transform: scale(0.95);
      }
    }
  }

  &.-flipped {
    .CardBaseText, .CardBaseImage {
      -webkit-transform: rotate(180deg);
      -moz-transform: rotate(180deg);
      -o-transform: rotate(180deg);
      -ms-transform: rotate(180deg);
      transform: rotate(180deg);
    }
  }

  &.-foil:before {
    content: '';

    display: block;
    position: absolute;

    top: 0;
    bottom: 0;
    left: 0;
    right: 0;

    background-size: var(--card-width) var(--card-height);

    background-image: repeating-linear-gradient(45deg, blue, green, yellow, orange, red, violet, indigo, blue );

    background-size: 300% 300%;
    animation: rainbow 3s ease-in-out infinite;
    // animation-iteration-count: 3;
    // background-blend-mode: color-burn;
    mix-blend-mode: overlay;
    opacity: 0.4;
  }
}
@keyframes rainbow { 
  0% { background-position: 0% 50% }
  50% { background-position: 100% 25% }
  100% { background-position:0% 50% }
}

.CardBaseText {
  --W: #e0dbbe;
  --U: #2ba7d7;
  --B: #323c39;
  --R: #c14242;
  --G: #568561;

  --gold: #dcca98;

  --colorless: #bfbbbb;

  --padding:10px;
  --border: 0px;
  --border-color: #010101;

  z-index: -1;
  // z-index needed otherwise CardBaseText overflow text appears on top of image in Chrome!

  width: calc(var(--card-width) - 2 * calc(var(--padding) + var(--border)));
  height: calc(var(--card-height) - 2 * calc(var(--padding) + var(--border)));
  // 10px = 2* (padding + border)

  background: #fff;
  font-size: 16px;
  padding: var(--padding);
  border: var(--border) solid var(--border-color);
  border-radius: 10px;

  display: grid;
  grid-template-rows: auto auto 1fr;
  grid-gap: 4px;

  align-content: start;

  .header, .sub-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .header, .sub-header, .body {
    padding: 0 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.95);
  }

  .header {
    line-height: 1.3rem;
    .name {
      color: #000;
      font-weight: bold;
    }
    .cost {}
  }

  .sub-header {
    font-size: 0.9rem;
    border-radius: 4px;
    padding: 0.2rem;

    .type {}
    .rarity {
      color: #777;
    }
  }

  .body {
    font-size: 0.9rem;
    line-height: 1.2rem;

    .text {
      padding-top: 5px;
      display: grid;
      grid-gap: 0.5rem;

      .line {
        .bracket {
          font-size: 0.8rem;
          font-style: italic;
          opacity: 0.6;
        }
      }
    }
    overflow-y: auto;
  }

  .footer {
    display: grid;
    justify-content: end;

    .power-toughness, .loyalty {
      padding: 1px 4px;
      background: #eee;
      border: 1px solid #ddd;
      border-radius: 6px;
    }
  }
}

.CardBaseImage {
  width: var(--card-width);
  height: var(--card-height);

  img {
    width: var(--card-width);
    height: var(--card-height);
    max-width: var(--card-width);
    max-height: var(--card-height);
    border-radius: 10px;
  }
}
