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

:root {
  --clr-primary-200: hsl(6 100% 80% / 1);
  --clr-primary-600: hsl(335 100% 65% / 1);
  --clr-neutral-100: hsl(243 100% 93% / 1);
  --clr-neutral-200: hsl(229 7% 55% /1);
  --clr-neutral-400: hsl(228 56% 26% / 1);
  --clr-neutral-800: hsl(229 57% 11% / 1);

  --size-s: 0.6125rem;
  --size-sm: 0.875rem;
  --size-m: 1rem;
  --size-ml: 1.5rem;
  --size-l: 2rem;
  --size-xl: 2.5rem;
  --size-xxl: 3rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

body {
  --font-size-m: 0.875rem;
  --font-size-sm: 0.75rem;
  --font-size-large: 2.5rem;
  display: grid;
  place-content: center;
  min-height: 100vh;
  font-family: "Raleway", sans-serif;
  font-size: var(--font-size-m);
  color: var(--clr-neutral-100);
  background: url("./images/bg-mobile.png") no-repeat;
  background-size: cover;
}

.component {
  width: min(98vw, 64rem);
  display: grid;
  gap: var(--size-m);
  padding: var(--size-m);
}

.hero,
.details {
  background: var(--clr-neutral-400);
  border-radius: var(--size-s);
}

.hero {
  display: grid;
  gap: var(--size-l) 0;
  padding: var(--size-xl);
  border-radius: var(--size-s) 6rem var(--size-s) var(--size-s);
}
.icon-wrapper {
  display: flex;
  align-items: flex-start;
  gap: var(--size-m);
}
.icon {
  background: var(--clr-neutral-800);
  width: var(--size-xxl);
  aspect-ratio: 1 / 1;
  display: grid;
  place-content: center;
  border-radius: var(--size-s);
}
.details {
  display: flex;
  flex-direction: column;
  gap: var(--size-m);
  height: 9.5rem;
  text-align: center;
  position: relative;
  padding: var(--size-l);
}
.bubble {
  position: absolute;
  bottom: 0;
  background: white;
  color: var(--clr-neutral-800);
  line-height: 1;
  padding: var(--size-sm) var(--size-ml);
  transform: translateY(50%);
  border-radius: inherit;
  font-size: var(--font-size-large);
  text-transform: uppercase;
  align-self: center;
}
.bubble > span {
  font-size: var(--font-size-sm);
  color: var(--clr-neutral-200);
  vertical-align: middle;
  letter-spacing: 0.1rem;
}
.slider {
  width: 100%;
  height: 1.3rem;
  border-radius: inherit;
  padding: 0.15rem;
  background: hsl(229 57% 11% / 0.5);
  position: relative;
}
.progress {
  height: 100%;
  width: 81.5%;
  background: linear-gradient(
    90deg,
    var(--clr-primary-200),
    var(--clr-primary-600)
  );
  border-radius: inherit;
  padding: 0.15rem;
  display: flex;
  flex-direction: column;
}
.progress::before,
.progress::after {
  position: absolute;
  top: calc(100% + var(--size-s));
  font-size: var(--font-size-sm);
  font-weight: 800;
  text-transform: uppercase;
}
.progress::before {
  content: attr(data-min);
  left: 0;
}
.progress::after {
  content: attr(data-max);
  right: 0;
}
.head {
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: inherit;
  background: white;
  align-self: flex-end;
}

@media (min-width: 64rem) {
  body {
    background: url("./images/bg-desktop.png"), var(--clr-neutral-800);
    background-repeat: no-repeat;
    background-position: bottom;
    background-size: contain;
  }
  .component {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .hero {
    grid-column: 1 / 2;
  }
  .details {
    text-align: left;
    margin-top: auto;
    grid-column: 2 / 4;
  }

  .bubble {
    bottom: calc(100% + var(--size-s));
    align-self: end;
  }

  /* I needed a relative positioned div inside the buble
  to efficiently position the arrow 
  since I couldn't find a way to insert the buble in normal document flow
  If you read this and have some ideas feel free to make a PR :)
  */
  .bubble > .fake {
    display: block;
    margin-left: calc(-1 * var(--size-ml));
    position: relative;
  }

  /* arrow */
  .bubble::before {
    content: "";
    position: absolute;
    right: 0;
    top: calc(100% - var(--size-s));
    border: var(--size-sm) solid white;
    border-bottom-color: transparent;
    border-left-color: transparent;
  }
}
