/* ==========================================
   layout.css — 页面布局、响应式断点
   ========================================== */

/* ---------- 通用页面容器 ---------- */
.page-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 博主信息区（首页） ---------- */
.profile-section {
  text-align: center;
  padding: 60px 0 40px;
  animation: fadeInUp 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* 头像 */
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 16px;
  border: 2px solid var(--glass-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.profile-avatar:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 默认占位符（无头像时显示） */
.profile-avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 16px;
  background: var(--color-accent-cool);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-surface);
  font-size: 36px;
  font-weight: 600;
}

/* 博主昵称 */
.profile-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

/* 博主域名 */
.profile-domain {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}

/* 社交图标行 */
.social-icons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--color-text-secondary);
  opacity: 0.65;
}

.social-icon:hover {
  color: var(--color-accent);
  background: rgba(0, 0, 0, 0.03);
  transform: scale(1.15);
  opacity: 1;
}

.social-icon svg {
  width: 20px;
  height: 20px;
}

/* ---------- 文章列表容器 ---------- */
.article-list {
  display: grid;
  gap: 16px;
}

/* ---------- 联系页 ---------- */
.contact-section {
  text-align: center;
  padding: 60px 0;
}

.contact-title {
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.contact-email {
  display: inline-block;
  font-size: 1.2rem;
  color: var(--color-accent);
  font-weight: 500;
  margin-top: 8px;
  border-bottom: 1px dashed var(--color-accent);
  transition: opacity 0.2s ease;
}

.contact-email:hover {
  opacity: 0.75;
}

.contact-desc {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

/* ---------- 归档页 ---------- */
.archive-section {
  padding: 20px 0;
}

.archive-year {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.archive-month {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin: 16px 0 8px;
  padding-left: 8px;
}

.archive-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-left: 16px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.archive-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.archive-item-date {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  margin-left: 16px;
}

.archive-item-title {
  color: var(--color-text);
  font-weight: 500;
}

/* ---------- 最近文章区（首页） ---------- */
.recent-posts {
  padding: 0 0 40px;
}

.recent-posts-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text);
}

.recent-post-item {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  transition: padding-left 0.2s ease;
}

.recent-post-item:hover {
  padding-left: 8px;
}

.recent-post-date {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.recent-post-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
}

/* 文章摘要（首页最近文章下方） */
.recent-post-excerpt {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-top: 6px;
  /* 最多显示两行，超出省略 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 文章页（posts/*.html 与 post.html 共用） ---------- */
.article-page {
  max-width: 720px;
  margin: 120px auto 60px;
  padding: 0 24px;
}

/* ========== 响应式断点 ========== */

/* 平板：768px */
@media (max-width: 768px) {
  .page-container {
    padding: 0 16px;
  }

  .nav-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .article-list {
    grid-template-columns: 1fr 1fr;
  }

  /* 归档条目：标题可折行，日期不挤 */
  .archive-item {
    align-items: flex-start;
    gap: 8px;
    padding: 10px 8px;
    margin-left: 8px;
  }

  .archive-item-title {
    flex: 1;
    min-width: 0;
    line-height: 1.45;
  }

  .archive-item-date {
    margin-left: 8px;
    margin-top: 2px;
  }
}

/* 手机：480px */
@media (max-width: 480px) {
  body {
    padding-top: calc(76px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }

  html {
    scroll-padding-top: calc(88px + env(safe-area-inset-top, 0px));
  }

  h1, h2, h3, h4, h5, h6 {
    scroll-margin-top: calc(88px + env(safe-area-inset-top, 0px));
  }

  .article-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .profile-section {
    padding: 28px 0 20px;
  }

  .profile-avatar,
  .profile-avatar-placeholder {
    width: 72px;
    height: 72px;
  }

  .profile-name {
    font-size: 1.45rem;
  }

  .profile-domain {
    margin-bottom: 16px;
  }

  /* 社交图标：更大触控区域 */
  .social-icon {
    width: 44px;
    height: 44px;
  }

  .social-icons {
    gap: 12px;
  }

  /* 最近文章：整块更易点 */
  .recent-post-item {
    padding: 14px 0;
  }

  .recent-post-title {
    font-size: 1.02rem;
    line-height: 1.4;
  }

  .recent-post-excerpt {
    -webkit-line-clamp: 2;
    font-size: 0.84rem;
  }

  /* 归档：窄屏改为上下堆叠 */
  .archive-item {
    flex-direction: column;
    align-items: flex-start;
    margin-left: 0;
    padding: 12px 10px;
    border-radius: 10px;
  }

  .archive-item-date {
    margin-left: 0;
    order: -1;
    font-size: 0.78rem;
  }

  .archive-year {
    font-size: 1.25rem;
    margin: 24px 0 10px;
  }

  .archive-month {
    margin: 12px 0 6px;
  }

  .contact-section {
    padding: 40px 0;
  }

  .contact-title {
    font-size: 1.35rem;
  }

  .contact-email {
    font-size: 1.05rem;
    word-break: break-all;
  }

  .footer-container {
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    font-size: 0.72rem;
    padding: 6px 12px;
  }

  /* 文章页手机阅读优化（覆盖 posts 内联旧样式）
     body 已有 padding-top 给导航，这里只保留少量间距，避免顶部空一大截 */
  .article-page {
    margin-top: 12px !important;
    margin-bottom: 40px;
    padding: 0 14px !important;
  }

  .article-page .article-meta {
    margin-bottom: 28px;
    padding-bottom: 18px;
  }

  .article-page .article-meta h1 {
    font-size: 1.32rem !important;
    line-height: 1.35;
  }

  .article-body {
    font-size: 1.02rem !important;
    line-height: 1.85;
  }

  .article-body h2 { font-size: 1.2rem; }
  .article-body h3 { font-size: 1.08rem; }
  .article-body ul,
  .article-body ol { padding-left: 20px; }

  .code-block-wrapper pre { padding: 12px 14px; }
  .code-block-wrapper pre code { font-size: 0.8rem; }
}

/* 超小屏：再收紧导航字号，更多菜单已在 glass.css 中接管次要入口 */
@media (max-width: 380px) {
  .nav-btn {
    padding: 7px 8px;
    font-size: 0.78rem;
  }

  .page-container {
    padding: 0 14px;
  }
}
