/* 晶体矿物学习平台 - 首页样式 */

/* 富文本样式支持 */
.post-content {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 14px;
  color: #666;
  margin-top: 8px;
  line-height: 1.5;
}

.post-content img {
  display: none; /* 在摘要中隐藏图片 */
}

.post-content p {
  margin: 0;
  display: inline;
}

/* 图片占位符样式 */
.img-placeholder {
  background-color: #f0f0f0;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 0;
  padding-top: 56.25%; /* 16:9的宽高比 */
}

.img-placeholder img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.img-placeholder:hover img {
  transform: scale(1.05);
}

/* 卡片样式 */
.experiment-preview, .resource-preview {
  position: relative;
  margin-bottom: 12px;
  overflow: hidden;
  border-radius: 8px;
}

.experiment-card, .resource-card {
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-radius: 8px;
  overflow: hidden;
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.experiment-card:hover, .resource-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.experiment-info, .resource-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.experiment-info h3, .resource-info h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.experiment-info p, .resource-info p {
  margin-bottom: 12px;
}

.experiment-meta, .resource-meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 用户头像样式 */
.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-container {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background-color: #f0f0f0;
  flex-shrink: 0;
}

/* 页面过渡动画 */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 离线提示样式 */
.offline-message {
  display: none;
  background-color: #f8d7da;
  color: #721c24;
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 4px;
  text-align: center;
}
