@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');

/*
 * Use a more-intuitive box-sizing model.
*/
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
}

:root {
  --clr-linear-gradient: linear-gradient(135deg, hsl(236, 72%, 79%), hsl(237, 63%, 64%));
  --clr-very-light-grayish-blue: hsl(240, 78%, 98%);
  --clr-light-grayish-blue: hsl(234, 14%, 74%);
  --clr-grayish-blue: hsl(233, 13%, 49%);
  --clr-dark-grayish-blue: hsl(232, 13%, 33%);
  --clr-dark-purple: hsl(237, 63%, 64%);
  --clr-brandeis-blue: hsl(212, 95%, 48%);
  --ff-primary: "Montserrat", monospace;
}

body {
  min-height: 100vh;
  background-color: var(--clr-very-light-grayish-blue);
  background-image: url(./images/bg-top.svg), url(./images/bg-bottom.svg);
  background-position: top 0 right -12rem, bottom 0 left;
  background-repeat: no-repeat, no-repeat;
  font-family: var(--ff-primary);
  font-weight: 700;
  color: var(--clr-dark-grayish-blue);
  display: flex;
  flex-direction: column;
}

.main {
  margin: auto;
}

.main__title {
  color: var(--clr-grayish-blue);
  font-size: 2rem;
  line-height: 2.4375rem;
  margin-top: 4rem;
  text-align: center;
}

.main__toggle {
  max-width: 239px;
  color: var(--clr-light-grayish-blue);
  margin: 2.5rem auto 5rem;
  display: flex;
  flex-direction: row;
  align-items: center;
}

/* 
 * Simple toggle switch design.
 * Credit to Alvaro Montoro:
 * https://alvaromontoro.com/blog/68017/creating-a-css-only-toggle-switch
*/

#main__toggle--switch {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  position: relative;
  width: 3.5em;
  height: 2em;
  background: var(--clr-linear-gradient);
  border-radius: 1em;
  box-sizing: content-box;
  font-size: inherit;
  vertical-align: text-bottom;
  margin: auto;
}

#main__toggle--switch::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(0, -50%);
  width: 1.5em;
  height: 1.5em;
  background-color: white;
  border-radius: 50%;
  box-sizing: border-box;
  margin: 0 0.25em;
}

#main__toggle--switch:checked::before {
  left: 1.5em;
}

#main__toggle--switch:hover {
  cursor: pointer;
  opacity: 0.5;
}

.main__card {
  max-width: 327px;
  width: 327px;
  background-color: white;
  border-radius: 0.625rem;
  box-shadow: 0px 20px 40px rgba(212, 210, 244, 0.5);
  padding: 1.9375rem 1.8125rem;
}

.main__card--title {
  color: var(--clr-grayish-blue);
  font-size: 1.125rem;
  line-height: 1.75rem;
  text-align: center;
}

.main__card--price {
  font-size: 2.5rem;
  line-height: 3.0625rem;
  margin: 1.5rem 0 2rem;
  text-align: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  column-gap: 7px;
}

.main__card--price-cost {
  color: var(--clr-dark-grayish-blue);
  font-size: 4.5rem;
  line-height: 4.4375rem;
}

.main__card--info {
  border-top: 1px solid var(--clr-light-grayish-blue);
  color: var(--clr-grayish-blue);
  font-size: 0.9375rem;
  padding: 1rem;
  text-align: center;
}

.main__card--info:last-of-type {
  border-bottom: 1px solid var(--clr-light-grayish-blue);
  margin-bottom: 2rem;
}

.main__card--more {
  background: var(--clr-linear-gradient);
  border-radius: 0.375rem;
  color: white;
  font-family: var(--ff-primary);
  font-weight: 700;
  letter-spacing: 1.39286px;
  line-height: 1rem;
  padding: 0.875rem;
  text-align: center;
  text-transform: uppercase;
  width: 100%;
}

.main__card--more:hover {
  background: transparent;
  border: 1px solid var(--clr-dark-purple);
  color: var(--clr-dark-purple);
  cursor: pointer;
  padding: 0.8125rem;
}

.main__card--more:active {
  transform: translateY(2px);
}

.main__card--recommended {
  margin-top: 2rem;
  margin-bottom: 2rem;
  background: var(--clr-linear-gradient);
}

.main__card--recommended>.main__card--title {
  color: white;
}

.main__card--recommended>.main__card--price {
  color: white;
}

/* 
 * Great example between the '>' and space ( ) CSS selector:
 * A>B will only select B that are direct children to A 
 * (that is, there are no other elements inbetween).
 * A B will select any B that are inside A,
 * even if there are other elements between them.
 * In this case, using '>' won't work because 
 * is between another element (.main__card--price paragraph).
 * So we use space ( ) to select the element.
 * Reference:
 * https: //stackoverflow.com/questions/2636379/what-is-the-difference-between-and-a-space-in-css-selectors
*/
.main__card--recommended .main__card--price-cost {
  color: white;
}

.main__card--recommended>.main__card--info {
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
}

.main__card--recommended>.main__card--info:last-of-type {
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
}

.main__card--recommended>.main__card--more {
  background: white;
  color: var(--clr-dark-purple);
}

.main__card--recommended>.main__card--more:hover {
  background: transparent;
  border: 1px solid white;
  color: white;
}

.footer {
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--clr-dark-grayish-blue);
  margin-top: 4rem;
  margin-bottom: 1rem;
  text-align: center;
}

.footer a {
  color: var(--clr-dark-purple);
}

.footer a:hover {
  color: var(--clr-brandeis-blue);
}

@media screen and (min-width: 1110px) {
  body {
    background-position: top 0 right -5rem, bottom 0 left;
  }

  .main__title {
    margin-top: 0;
  }

  .main__cards {
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  .main__card {
    max-width: 350px;
    width: 350px;
  }

  .main__card--recommended {
    min-height: 501px;
    margin-top: 0;
    margin-bottom: 0;
    padding: 57px 31px;
  }
}