/* ============================================
   Hugo PaperMod 主题 - 主样式
   ============================================
   基于 PaperMod 主题，融合 hugo-book 三栏布局
============================================ */

/* ============================================
   CSS 变量定义
============================================ */
:root {
  /* 主色调 */
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-rgb: 59, 130, 246;

  /* 背景色 */
  --bg-page: #f8f9fa;
  --bg-card: #ffffff;
  --bg-code: #f3f4f6;

  /* 文字色 */
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  /* 边框 */
  --border-color: #e5e7eb;
  --border-radius: 12px;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* 间距 */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;

  /* 侧边栏宽度 */
  --sidebar-width: 280px;
  /* 把侧边栏稍微收窄到 260px，给中间文章腾出更多空间 */
  --content-max-width: 100%;
  /* ✨ 关键！改成 100%，彻底解除中间栏的最大宽度限制 */
}

/* ============================================
   基础样式重置
============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* ============================================
   主页专属全局背景
============================================ */
body.is-home {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  background-attachment: fixed;
  /* 固定背景，这样向下滑动时渐变不会断层 */
}

/* ============================================
   Profile Mode 主页样式
============================================ */
.profile-mode {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;

}

.profile-container {
  text-align: center;
  animation: fadeInUp 0.6s ease-out;
}

.profile-image {
  margin-bottom: 1.5rem;
}

.profile-image img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 4px solid white;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
}

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

.profile-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.profile-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 500px;
}

/* 社交图标 */
.social-icons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow-md);
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.social-icon:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

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

/* GitHub */
.social-icon[title="GitHub"]:hover {
  background: #333;
  color: white;
}

/* Bilibili */
.social-icon[title="Bilibili"]:hover {
  background: #00A1D6;
  color: white;
}

/* 小红书 */
.social-icon[title="小红书"]:hover {
  background: #FF2442;
  color: white;
}

/* Telegram */
.social-icon[title="Telegram"]:hover {
  background: #0088cc;
  color: white;
}

/* 淘宝 */
.social-icon[title="淘宝"]:hover {
  background: #FF5000;
  color: white;
}

/* 导航按钮 */
.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: white;
  border-radius: 9999px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: var(--primary);
  background: #eff6ff;
}

/* ============================================
   全局底部 Footer
============================================ */
.site-footer {
  padding: 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  /* 灰色的文字 */
  background: transparent;
  /* 背景完全透明，和网页原生背景融为一体 */
}

.site-footer .footer-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.site-footer a {
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: var(--text-secondary);
}



/* ============================================
   动画
============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   滚动条样式
============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   选中文字样式
============================================ */
::selection {
  background-color: rgba(var(--primary-rgb), 0.2);
}

/* ============================================
   响应式
============================================ */
@media (max-width: 1024px) {
  .profile-title {
    font-size: 2rem;
  }

  .profile-subtitle {
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  .profile-image img {
    width: 120px;
    height: 120px;
  }

  .profile-title {
    font-size: 1.75rem;
  }

  .buttons {
    flex-direction: column;
    align-items: center;
  }

  .button {
    width: 100%;
    max-width: 200px;
  }
}

/* ============================================
   单栏纯净布局 (如 About 页面)
============================================ */
.single-column {
  max-width: 800px;
  /* 限制最大宽度，阅读体验最佳 */
  margin: 0 auto;
  /* 让内容在页面中水平居中 */
  padding: 2rem;
  /* 四周留出呼吸空间 */
  min-height: 80vh;
  /* 保证哪怕内容很少，Footer也不会顶上来 */
}

/* ============================================
   About 页面头像及手指提示
============================================ */
.about-avatar {
  position: relative;
  display: flex;
  justify-content: center;
  /* 确保头像绝对居中 */
  align-items: center;
  margin-bottom: 2rem;
}

.about-avatar img {
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.about-avatar img:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* 手指和提示文字样式（使用绝对定位，不把头像挤偏） */
.back-home-hint {
  position: absolute;
  left: 50%;
  margin-left: 55px;
  /* 80px头像的一半(40px) + 15px的间距 */
  font-size: 0.95rem;
  color: var(--text-muted);
  white-space: nowrap;
  /* 强制文字不换行 */
  animation: pointLeft 1.5s infinite ease-in-out;
}

/* 定义手指戳向左边头像的动画 */
@keyframes pointLeft {

  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(-6px);
  }
}


/* ============================================
   面包屑导航样式
   ============================================ */
.breadcrumb-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.breadcrumb-link {
  color: var(--primary);
  text-decoration: none;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: all 0.2s;
  position: relative;
}

.breadcrumb-link:hover {
  background: var(--code-bg);
  text-decoration: underline;
  transform: translateY(-1px);
}

.breadcrumb-separator {
  color: var(--secondary);
  margin: 0 0.2rem;
  user-select: none;
}

.breadcrumb-current {
  color: var(--content);
  font-weight: 600;
  padding: 0.2rem 0.4rem;
}

/* ============================================
   翻转卡片基础框架 (防残留版本)
============================================ */
.flip-card-container {
  perspective: 1200px;
  /* 增加透视距离，让翻转更自然 */
  margin-bottom: 0;
}

.flip-card-inner {
  display: grid;
  width: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
  position: relative;
}

/* 【关键修改】使用全新的类名触发 180 度翻转 */
.flip-card-inner.do-flip {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* 兼容 Safari */
  background-color: var(--entry, #ffffff);
  border-radius: var(--radius, 8px);
  position: relative;
}

/* 正面 0 度，背面 180 度 */
.flip-card-front {
  transform: rotateY(0deg);
}

.flip-card-back {
  transform: rotateY(180deg);
}

/* ============================================
   终极修复版：“撕开小口子”（折耳）效果
============================================ */
.peel-corner {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 46px;
  height: 46px;
  cursor: pointer;
  z-index: 10;
  /* 【关键修复1】将透明与底色的交界线从50%改为49.5%，让底色往里多延伸一点点，消除抗锯齿漏光 */
  background: linear-gradient(135deg, transparent 49.5%, var(--theme, #f5f5f5) 49.5%);
  /* 【关键修复2】将动画加在容器本身的尺寸上，而不是子元素的形变上 */
  transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), height 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.peel-corner::before {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100%;
  /* 【关键修复3】将折纸层的透明分界线延后到 51%，使其与遮罩层产生物理重叠，彻底压死白边 */
  background: linear-gradient(135deg,
      var(--entry, #ffffff) 0%,
      rgba(150, 150, 150, 0.2) 46%,
      transparent 51%);
  filter: drop-shadow(-2px -2px 3px rgba(0, 0, 0, 0.15));
  border-bottom-right-radius: var(--radius, 8px);
}

/* 【关键修复4】悬停时，同步放大整个折角的尺寸。
   因为背景是百分比渐变，容器变大会让斜线完美平移，看起来就像口子被撕得更大，且严丝合缝 */
.peel-corner:hover {
  width: 50px;
  height: 50px;
}

/* 暗黑模式适配 */
@media (prefers-color-scheme: dark) {
  .peel-corner {
    background: linear-gradient(135deg, transparent 49.5%, var(--theme, #1d1e20) 49.5%);
  }

  .peel-corner::before {
    background: linear-gradient(135deg,
        var(--entry, #2e2e33) 0%,
        rgba(0, 0, 0, 0.6) 46%,
        transparent 51%);
    filter: drop-shadow(-2px -2px 3px rgba(0, 0, 0, 0.4));
  }
}