/*=============== GOOGLE FONTS ===============*/
@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@400;600&display=swap");

/*=============== VARIABLES CSS ===============*/
:root {
  /*========== Colors ==========*/
  /*Color mode HSL(hue, saturation, lightness)*/
  --gradient-color-red: linear-gradient(90deg, 
                          hsl(7, 89%, 46%) 15%,
                          hsl(11, 93%, 68%) 100%);
  --gradient-color-orange: linear-gradient(90deg, 
                           hsl(22, 89%, 46%) 15%,
                           hsl(54, 90%, 45%) 100%);
  --gradient-color-yellow: linear-gradient(90deg, 
                           hsl(54, 89%, 46%) 15%,
                           hsl(92, 90%, 45%) 100%);
  --gradient-color-green: linear-gradient(90deg, 
                          hsl(92, 89%, 46%) 15%,
                          hsl(92, 90%, 68%) 100%);
  --text-color: #fff;
  --body-color: hsl(0, 0%, 11%);
  --container-color: hsl(0, 0%, 9%);

  /*========== Font and typography ==========*/
  /*.5rem = 8px | 1rem = 16px ...*/
  --body-font: 'Rubik', sans-serif;

  --biggest-font-size: 2.5rem;
  --normal-font-size: .938rem;
  --smaller-font-size: .75rem;
}

/* Responsive typography */
@media screen and (min-width: 968px) {
  :root {
    --biggest-font-size: 2.75rem;
    --normal-font-size: 1rem;
    --smaller-font-size: .813rem;
  }
}

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

body {
  font-family: var(--body-font);
  font-size: var(--normal-font-size);
  background-color: var(--body-color);
  color: var(--text-color);
}

/*=============== BATTERY ===============*/
.battery {
  height: 100vh;
  display: grid;
  place-items: center;
  margin: 0 1.5rem;
}

.battery__card {
  position: relative;
  width: 100%;
  height: 240px;
  background-color: var(--container-color);
  padding: 1.5rem 2rem;
  border-radius: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: center;
}

.battery__text {
  margin-bottom: .5rem;
}

.battery__percentage {
  font-size: var(--biggest-font-size);
}

.battery__status {
  position: absolute;
  bottom: 1.5rem;
  display: flex;
  align-items: center;
  column-gap: .5rem;
  font-size: var(--smaller-font-size);
}

.battery__status i {
  font-size: 1.25rem;
}

.battery__pill {
  position: relative;
  width: 75px;
  height: 180px;
  background-color: var(--container-color);
  box-shadow: inset 20px 0 48px hsl(0, 0%, 16%), 
              inset -4px 12px 48px hsl(0, 0%, 56%);
  border-radius: 3rem;
  justify-self: flex-end;
}

.battery__level {
  position: absolute;
  inset: 2px;
  border-radius: 3rem;
  overflow: hidden;
}

.battery__liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: var(--gradient-color-red);
  box-shadow: inset -10px 0 12px hsla(0, 0%, 0%, .1), 
              inset 12px 0 12px hsla(0, 0%, 0%, .15);
  transition: .3s;
}

.battery__liquid::after {
  content: '';
  position: absolute;
  height: 8px;
  background: var(--gradient-color-red);
  box-shadow: inset 0px -3px 6px hsla(0, 0%, 0%, .2);
  left: 0;
  right: 0;
  margin: 0 auto;
  top: -4px;
  border-radius: 50%;
}

/* Full battery icon color */
.green-color {
  background: var(--gradient-color-green);
}

/* Battery charging animation */
.animated-green {
  background: var(--gradient-color-green);
  animation: animated-charging-battery 1.2s infinite alternate;
}

/* Low battery animation */
.animated-red {
  background: var(--gradient-color-red);
  animation: animated-low-battery 1.2s infinite alternate;
}

.animated-green,
.animated-red,
.green-color {
  -webkit-background-clip: text;
  color: transparent;
}

@keyframes animated-charging-battery {
  0% {
    text-shadow: none;
  }
  100% {
    text-shadow: 0 0 6px hsl(92, 90%, 68%);
  }
}

@keyframes animated-low-battery {
  0% {
    text-shadow: none;
  }
  100% {
    text-shadow: 0 0 8px hsl(7, 89%, 46%);
  }
}

/* Liquid battery with gradient color */
.gradient-color-red,
.gradient-color-red::after {
  background: var(--gradient-color-red);
}

.gradient-color-orange,
.gradient-color-orange::after {
  background: var(--gradient-color-orange);
}

.gradient-color-yellow,
.gradient-color-yellow::after {
  background: var(--gradient-color-yellow);
}

.gradient-color-green,
.gradient-color-green::after {
  background: var(--gradient-color-green);
}

/*=============== BREAKPOINTS ===============*/
/* For small devices */
@media screen and (max-width: 320px) {
  .battery__card {
    zoom: .8;
  }
}

/* For medium devices */
@media screen and (min-width: 430px) {
  .battery__card {
    width: 312px;
  }
}

/* For large devices */
@media screen and (min-width: 1024px) {
  .battery__card {
    zoom: 1.5;
  }
}