/* ============================================================
 * sp.css — SolarPress 移植版补充样式
 * 仅包含原版 main.css 未覆盖的部分：
 *   1. Alpine 初始化前隐藏 x-cloak 元素
 *   2. 文章页双栏布局
 *   3. 评论组件细节
 *   4. 微信二维码弹层
 *   5. 移动端抽屉暗色兜底
 * ============================================================ */

/* 1. Alpine x-cloak 兜底，防止加载前闪烁 */
[x-cloak] {
  display: none !important;
}

/* 2. 文章页双栏布局（正文 + 目录） */
.sp-post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 0.5rem;
  align-items: start;
}
@media (max-width: 767.98px) {
  .sp-post-layout {
    display: block;
  }
}

/* 3. 评论 */
.sp-comment img {
  max-width: 100%;
  height: auto;
}
.sp-comment-form input:focus,
.sp-comment-form textarea {
  outline: none;
}
.sp-comment-form input,
.sp-comment-form textarea {
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.sp-comment-form input:focus,
.sp-comment-form textarea:focus {
  border-color: #3b82f6 !important;
}
.sp-msg-ok {
  color: #16a34a;
}
.sp-msg-error {
  color: #dc2626;
}

/* 4. 微信二维码弹层 */
.sp-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 1rem;
}
.sp-modal-mask[hidden] {
  display: none;
}
.sp-modal-box {
  position: relative;
  width: 100%;
  max-width: 20rem;
  border-radius: 0.75rem;
  background: #ffffff;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
html.dark .sp-modal-box {
  background: #1a1d23;
  color: #e5e7eb;
}
.sp-wechat-qr {
  width: 14rem;
  height: 14rem;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 0.5rem;
  object-fit: cover;
}
.sp-wechat-text {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  word-break: break-all;
  opacity: 0.75;
}
.sp-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 1.5rem;
  line-height: 1;
  color: #9ca3af;
  transition: color 0.2s ease;
}
.sp-modal-close:hover {
  color: #374151;
}
html.dark .sp-modal-close:hover {
  color: #f3f4f6;
}

/* 5. 移动端抽屉暗色兜底（内联浅色背景的覆盖） */
html.dark .mobile-drawer {
  background: #1a1d23 !important;
  color: #e5e7eb !important;
}
html.dark .mobile-drawer .border-b {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* ============================================================
 * 6. 文章列表卡片尺寸统一
 *   宽度由 post-list 网格的 1fr 列统一（天然等宽）；
 *   高度参差的根因是标题 1/2 行、摘要 1~3 行、底部元信息 1/2 行
 *   随内容浮动。此处把三个区块的占位行数固定，卡片整体即严格等高，
 *   超出部分沿用原 line-clamp / overflow-hidden 截断，不丢内容。
 *   行高基准（Tailwind）：标题 text-lg 行高 28px；
 *   摘要 text-sm/leading-6 行高 24px；元信息 text-xs 行高 16px、
 *   换行 gap-y-2 为 8px、pt-3 为 12px（2 行 = 52px）。
 * ============================================================ */

/* 卡片容器类名取值：sp-card-default / sp-card-left-img / sp-card-top-img */

/* —— 左图右文（left-img）—— */
.sp-card-left-img h1 { min-height: 3.5rem; }          /* 标题恒定 2 行：28×2 */
.sp-card-left-img h1 + span { min-height: 3rem; }     /* 摘要恒定 2 行：24×2 */
.sp-card-left-img .border-t { min-height: 52px; }     /* 元信息恒定 2 行：12 + 16 + 8 + 16 */
@media (max-width: 639.98px) {
  /* 对齐模板 max-sm 设计：pt-2 + 2 行（gap-y-1）≈ 45px */
  .sp-card-left-img .border-t { min-height: 45px; max-height: 45px; }
}

/* —— 默认样式（摘要 + 右缩略图）—— */
.sp-card-default span.line-clamp-3 { min-height: 4.5rem; }  /* 摘要恒定 3 行：24×3，无封面时也等高 */
.sp-card-default .border-t {
  min-height: 52px;
  max-height: 52px;
  overflow: hidden;                                   /* 标签再多也只保留 2 行 */
}

/* —— 顶部大图（top-img）—— */
.sp-card-top-img h1 { min-height: 3.5rem; }           /* 标题恒定 2 行 */
.sp-card-top-img h1 + span { min-height: 3rem; }      /* 摘要恒定 2 行（line-clamp 的 -webkit-box 保持不变） */
.sp-card-top-img .border-t { min-height: 52px; }      /* 元信息恒定 2 行（原有 max-h-52 + overflow-hidden） */

/* ============================================================
 * 7. 首页全屏简介打字机光标
 * ============================================================ */
.sp-typewriter-typed::after {
  content: " ";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  vertical-align: -0.12em;
  background: currentColor;
  opacity: 0;
  animation: sp-tw-blink 0.8s infinite;
  animation-delay: 0.2s;
}
.sp-typewriter-done .sp-typewriter-typed::after {
  display: none;
}
@keyframes sp-tw-blink {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ============================================================
 * 8. 首页分类条子分类下拉（暗色兜底；亮式样式沿用原版编译产物）
 * ============================================================ */
html.dark .category-submenu {
  background-color: #1a1d23 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}
html.dark .category-submenu li:hover,
html.dark .category-submenu li a:hover {
  background-color: rgba(255, 255, 255, 0.06) !important;
}

/* ============================================================
 * 9. 首页全屏信息区（hero）
 *   - 上移到透明头部之下（main.css 未编译 -mt-[68px] 任意值类）
 *   - 向下箭头使用自定义定位与动画（原 bottom-[30px]/h-10/animate-bounce
 *     等任意值类均未编译，定位失效后箭头退到静态位置，遮挡右侧悬浮控件）
 * ============================================================ */
.sp-hero-fullscreen {
  margin-top: -68px;
  padding-top: 80px;
  padding-bottom: 96px;
  box-sizing: border-box;
}
@media (max-width: 767.98px) {
  .sp-hero-fullscreen {
    margin-top: -56px;
    padding-top: 72px;
    padding-bottom: 80px;
  }
}
.sp-scroll-arrow {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
  text-decoration: none;
}
.sp-scroll-arrow svg {
  width: 40px;
  height: 40px;
  display: block;
  animation: sp-arrow-bounce 1.6s ease-in-out infinite;
}
@media (max-width: 767.98px) {
  .sp-scroll-arrow {
    bottom: 16px;
    width: 32px;
    height: 32px;
  }
  .sp-scroll-arrow svg {
    width: 32px;
    height: 32px;
  }
}
@keyframes sp-arrow-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(10px); }
}
@media (prefers-reduced-motion: reduce) {
  .sp-scroll-arrow svg { animation: none; }
}
