@import "~include-media/dist/_include-media.scss";

$breakpoints: (x-small: 430px, small: 660px, medium: 900px, large: 1300px, x-large: 1560px);

// Override Sass min()
@function min($numbers...) {
  @return m#{i}n(#{$numbers});
}

// Override Sass max()
@function max($numbers...) {
  @return m#{a}x(#{$numbers});
}

#project-grid-parent {
  margin: 10px;
  background: var(--grid-background);
  border-radius: 5px;

  & > #project-header {
    background: var(--grid-header-background);
    border-radius: 5px 5px 0 0;
    margin-bottom: 2px;


    padding: 5px;

    * {
      color: var(--grid-header-text);
    }

    h2 {
      margin-bottom: 0;
      font-family: "Fira Code", monospace;
      font-size: 24px;
    }

    p {
      margin: 0 0 3px;
      font-family: "Montserrat", sans-serif;
      font-size: 18px;
    }

  }
}


#project-grid {

  //padding: 10px;

  @include media("<=x-small") {
    .GridSizer, .OneWide, .FourByOne .Medium {
      width: 100%;
    }
  }

  @include media(">x-small", "<small") {
    .GridSizer, .OneWide .Medium {
      width: 49%;
    }
    .FourByOne {
      width: 100%;
    }
  }

  @include media(">=small", "<medium") {
    .GridSizer, .OneWide .Medium {
      width: 33%;
    }
    .FourByOne {
      width: 99%;
    }
  }

  @include media(">=medium", "<large") {
    .GridSizer, .OneWide {
      width: 24.9%;
    }
    .Medium {
      width: 49.8%;
    }
    .FourByOne {
      width: 74.6%;
    }
  }

  @include media(">=large", "<x-large") {
    .GridSizer, .OneWide {
      max-width: 300px;
      width: 19.9%;
    }
    .Medium {
      max-width: 600px;
      width: 39.8%;
    }
    .FourByOne {
      width: 59.5%;
      max-width: 900px;
    }
  }

  @include media(">=x-large") {
    .GridSizer, .OneWide {
      width: 300px;
    }
    .Medium {
      width: 600px;
    }
    .FourByOne {
      width: 900px;
    }
  }
}

.GridElement {
  padding: 5px;

  .GridElementInternal {
    padding: 9px;
    border-radius: 5px;
    background: var(--grid-element-background);

    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.3s ease-in-out;
  }

  .GridElementInternal:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  }

  h2 {
    font-family: "Fira Code", monospace;
    font-weight: 400;
    margin-bottom: 0px;
    line-height: normal;
  }

  h3 {
    line-height: normal;
    color: var(--grid-element-subheader);
    margin-bottom: 3px;
  }

  p {
    font-family: "Montserrat", sans-serif;
    font-size: 16px;
    color: black;
    margin-bottom: 0;
  }
}

.OneWide {
  display: flex;
  flex-direction: column;
  width: available;

  img {
    width: 100%;
    margin-bottom: 5px;
  }
}

.Medium {
  img {
    width: 100%;
    margin-bottom: 5px;
  }

  @include media("<medium") {
    display: flex;
    flex-direction: column;
    width: available;

    img {
      width: 100%;
      margin-bottom: 5px;
    }
  }

  @include media(">=medium") {
    // Two column sort of layout
    .image {
      float: left;
      width: 50%;
      shape-outside: inset(0);

      img {
        margin-bottom: 0;
      }
    }

    .description {
      display: inline;

      p {
        text-align: justify;
      }

      h2 h3 {
        display: inline;
      }
    }
  }

  @include media(">x-large") {
    .image {
      width: 40%;
    }
  }
}

.FourByOne {
  .GridElementInternal {
    display: flex;
    align-items: center;

    .image {
      flex: 1;

      img {
        width: 100%;
        max-width: 100%;
      }
    }

    .description {
      min-width: 20ch;
      width: 30ch;
    }

    @include media(">small") {
      flex-direction: row;

    }
    @include media("<=small") {
      flex-direction: column;
      .description {
        width: 95%;
      }
    }
  }
}

.LinkIcon {
  position: absolute;
  right: 12px;
  top: 12px;
  font-size: 24px;
  color: black;

  background: var(--chainlink-icon-background);
  border-radius: 5px;
}
