/* CSS Reset & Base Styles */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  font-size: 62.5%; /* 使 1rem = 10px */
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 2rem; /* 13px，根据你的设计稿 */
  line-height: 1.5;
  color: var(--very-dark-grayish-blue);
  background-color: var(--light-grayish-blue);
  min-height: 100vh;
}
img {
  max-width: 100%;
  height: auto;
  object-fit: cover; /* 确保图片填充固定尺寸且不变形 */
  display: block;
}
:root {
  --very-dark-grayish-blue: hsl(217, 19%, 35%);
  --desaturated-dark-blue: hsl(214, 17%, 51%);
  --grayish-blue: hsl(212, 23%, 69%);
  --light-grayish-blue: hsl(210, 46%, 95%);
}

.header {
  width: min(90%, 120rem);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  /* background-color: red; */
  padding: 1.6rem; /* 减少手机端的padding */
}

.card__content__container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* background-color: black; */
  height: 90%; /* 改为使用百分比宽度 */
  max-width: 100%;
}
@media screen and (min-width: 768px) {
  .card__content__container {
    position: relative;
  }
}
.card__container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 90%; /* 改为使用百分比宽度 */
  max-width: 100%;
  min-height: 50rem; /* 设置最小高度，确保卡片有基本高度 */
  height: 80%; /* 高度也建议改为自适应 */
  background-color: white;
  border-radius: 1rem;
  overflow: hidden;
}

/* 媒体查询 */
@media screen and (min-width: 768px) {
  .card__container {
    flex-direction: row;
    width: 100rem; /* 桌面端使用固定宽度 */
    height: 40rem;
    min-height: 20rem;
  }
}

.card__img {
  /* object-fit: cover; */
  height: 40%;
}

@media screen and (min-width: 768px) {
  .card__img {
    width: 40rem;
    height: 100%;
    max-width: 40%;
    max-height: 100%;
  }
}

.card__content {
  /* background-color: gray; */
  padding: 1rem;
}
.card__content__header {
  font-size: 1.6rem;
  margin: 1rem;
}

.card__content__body {
  font-size: 1.7rem;
  margin: 1rem;
}

@media screen and (min-width: 768px) {
  .card__content {
    /* background-color: gray; */
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    height: 60%;
  }
  .card__content__header {
    font-size: 1.8rem;
    margin: 1rem;
  }
}
.card__footer {
  height: 8rem; /* 使用固定高度替代百分比 */
  position: relative;
}
.card__author,
.card__share {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  padding: 1rem;
}

.card__author {
  background-color: white;
}
.card__author__avatar {
  width: 4rem; /* 固定宽度 */
  height: 4rem; /* 固定高度 */
  border-radius: 100%;
  margin: 1rem;
}
.card__author__content {
  width: 60%;
  /* background-color: white; */
  font-size: 1rem;
}
.card__author__content p {
  font-size: 1.2rem;
}

/* 按钮的样式 */
.share__btn {
  background-color: var(--light-grayish-blue);
  padding: 1rem;
  border-radius: 100%;
  border: none;
  cursor: pointer;
}

/* 只控制图标的颜色，不要加其他样式 */
.share__btn img {
  filter: brightness(0) invert(0.5);
}

/* 激活状态 */
.share-active .share__btn {
  background-color: var(--grayish-blue);
}

.share-active .share__btn img {
  filter: brightness(0) invert(1);
}

.card__share {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  background-color: var(--very-dark-grayish-blue);
  color: var(--light-grayish-blue);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  font-size: 1.2rem;
  letter-spacing: 0.5rem;
}
.card__share span {
  margin-left: 1.6rem; /* SHARE 和图标组之间的间距 */
}

.card__share__platform__imgs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 40%;
  margin-right: auto;
}
.share__btn-inside {
  background-color: var(--very-dark-grayish-blue);
  margin-right: 1.6rem; /* SHARE 和图标组之间的间距 */
}

.share-active .card__share {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}
@media screen and (min-width: 768px) {
  .card__author,
  .card__share {
    padding: 1.4rem;
  }
  .card__author__content {
    width: 60%;
  }
  .card__share {
    align-items: center;
    background-color: var(--very-dark-grayish-blue);
    border: 1px black solid;
    position: absolute;
    top: -40px;
    left: 55%;
    width: 20rem;
    height: 4rem;
    color: var(--grayish-blue);
  }
  /* 使用 ::after 伪元素创建向下的箭头 */
  .card__share::after {
    content: "";
    position: absolute;
    bottom: -20px; /* 箭头紧贴在 .card__share 底部外侧 */
    left: 50%; /* 水平居中 */
    transform: translateX(-50%);
    border-width: 10px; /* 箭头的尺寸，可根据需求调整 */
    border-style: solid;
    /* 只显示上边框颜色，其他透明，从而形成一个向下的三角形 */
    border-color: var(--very-dark-grayish-blue) transparent transparent
      transparent;
  }
  .share__btn-inside {
    display: none;
  }
}
