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

body {
  background: hsl(210, 46%, 95%);
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  color: hsl(217, 19%, 35%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.card {
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 10px 40px hsl(217, 19%, 35%, 0.15);
  max-width: 730px;
  display: flex;
  overflow: hidden;
  margin: 40px 16px;
}

.card__image {
  width: 285px;
  object-fit: cover;
  display: block;
}

.card__content {
  /* Styles the main content area of the card */
  padding: 32px 40px 32px 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: hsl(217, 19%, 35%);
}

.card__text {
  /* Styles the main paragraph text inside the card */
  color: hsl(214, 17%, 51%);
  margin-bottom: 24px;
  line-height: 1.5;
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__author {
  display: flex;
  align-items: center;
}

.author__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 16px;
}

.author__info {
  display: flex;
  flex-direction: column;
}

.author__name {
  font-weight: 700;
  color: hsl(217, 19%, 35%);
}

.author__date {
  color: hsl(212, 23%, 69%);
  font-size: 13px;
}

.card__share {
  position: relative;
}

.share-btn {
  background: hsl(210, 46%, 95%);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  margin-left: 16px;
}

.share-btn:hover {
  background: hsl(214, 17%, 51%);
}

.share-btn img {
  width: 15px;
  height: 15px;
  filter: brightness(0.5);
}

.share-popup {
  display: none;
  position: absolute;
  bottom: 48px;
  right: 0;
  background: hsl(217, 19%, 35%);
  color: #fff;
  border-radius: 10px;
  padding: 16px 24px;
  box-shadow: 0 8px 24px hsl(217, 19%, 35%, 0.15);
  align-items: center;
  gap: 16px;
  z-index: 10;
  font-size: 13px;
  letter-spacing: 4px;
}

.share-popup span {
  text-transform: uppercase;
  color: hsl(212, 23%, 69%);
  font-weight: 500;
  margin-right: 16px;
  letter-spacing: 4px;
}

.share-popup a {
  margin-left: 8px;
  display: inline-block;
}

.share-popup img {
  width: 20px;
  height: 20px;
}

.share-popup.active {
  display: flex;
}

@media (max-width: 600px) {
  .card {
    flex-direction: column;
    max-width: 350px;
    padding: 0;
  }
  .card__image {
    width: 100%;
    height: 200px;
  }
  .card__content {
    padding: 24px 20px 20px 20px;
  }
  .card__footer {
    flex-direction: row;
    align-items: center;
    margin-top: 16px;
    position: relative;
    min-height: 72px; /* increase to fit share bar and icons */
    z-index: 1;
    padding: 0;
    overflow: visible; /* allow share bar to overflow if needed */
  }
  .share-popup {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: 72px; /* increase height for icons */
    border-radius: 0 0 15px 15px;
    padding: 0 20px;
    background: hsl(217, 19%, 35%);
    box-shadow: none;
    display: none;
    gap: 22px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    z-index: 10;
    overflow: visible; /* ensure icons are not clipped */
  }
  .share-popup.active {
    display: flex;
  }
  .share-popup span {
    color: hsl(212, 23%, 69%);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-size: 13px;
    margin-right: 18px;
    margin-left: 0;
  }
  .share-popup a {
    margin-left: 0;
    margin-right: 18px;
    display: inline-block;
  }
  .share-popup a:last-child {
    margin-right: 0;
  }
  .share-popup img {
    width: 28px;
    height: 28px;
    vertical-align: middle;
  }
  .card__footer.share-active .card__author {
    display: none;
  }
  .share-btn.active,
  .share-btn:active {
    background: hsl(214, 17%, 51%);
  }
  .share-btn.active img,
  .share-btn:active img {
    filter: brightness(10) invert(1);
  }
  .share-btn {
    z-index: 11;
  }
}
