/* =============================================
   科技风博客 - 自定义样式
   设计风格：极简 · 科技 · 未来感
   ============================================= */

/* 全局样式重置 */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: #060911;
  overflow-x: hidden;
}

/* 选中文本样式 */
::selection {
  background-color: rgba(6, 182, 212, 0.3);
  color: #ffffff;
}

::-moz-selection {
  background-color: rgba(6, 182, 212, 0.3);
  color: #ffffff;
}

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

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.5);
  border-radius: 4px;
  transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.8);
}

/* 代码块样式增强 */
pre {
  position: relative;
  padding: 1.5rem !important;
  margin: 1.5rem 0;
  overflow-x: auto;
  border-radius: 1rem !important;
  background: linear-gradient(135deg, rgba(10, 14, 23, 0.95) 0%, rgba(6, 9, 17, 0.95) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

pre code {
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  font-size: 0.875rem;
  line-height: 1.7;
  color: #e5e7eb;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* 行内代码 */
code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875em;
}

/* 引用块样式 */
blockquote {
  position: relative;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
}

blockquote::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, #06b6d4, #8b5cf6);
  border-radius: 2px;
}

/* 确保 Markdown 内容正确渲染 */
.prose > * + * {
  margin-top: 1rem;
}

.prose > h1 + *,
.prose > h2 + *,
.prose > h3 + *,
.prose > h4 + *,
.prose > h5 + *,
.prose > h6 + * {
  margin-top: 0.5rem;
}

/* 表格样式 */
table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

thead {
  background: rgba(255, 255, 255, 0.05);
}

th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

td {
  padding: 1rem;
  color: #d1d5db;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(6, 182, 212, 0.05);
}

/* 链接悬停效果 */
a {
  position: relative;
  transition: all 0.3s ease;
}

/* 图片样式 */
img {
  max-width: 100%;
  height: auto;
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

img:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 48px rgba(6, 182, 212, 0.2);
}

/* 列表样式 */
ul, ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}

ul {
  list-style-type: disc;
  list-style-position: outside;
}

ol {
  list-style-type: decimal;
  list-style-position: outside;
}

li {
  margin: 0.5rem 0;
  line-height: 1.8;
  display: list-item;
}

/* prose 类中的列表样式 */
.prose ul {
  list-style-type: disc;
  list-style-position: outside;
  padding-left: 1.5rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.prose ol {
  list-style-type: decimal;
  list-style-position: outside;
  padding-left: 1.5rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.prose li {
  display: list-item;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.8;
  color: #d1d5db;
}

.prose li::marker {
  color: #06b6d4;
}

/* 嵌套列表 */
.prose ul ul,
.prose ul ol,
.prose ol ul,
.prose ol ol {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.prose ul > li > ul {
  list-style-type: circle;
}

.prose ul > li > ul > li > ul {
  list-style-type: square;
}

/* 水平分割线 */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
  margin: 2rem 0;
}

/* 标题锚点悬停效果 */
h1, h2, h3, h4, h5, h6 {
  scroll-margin-top: 100px;
  position: relative;
}

/* 文章内容区域的标题样式 */
.prose h1 {
  font-size: 2.25rem;
  line-height: 2.5rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.prose h2 {
  font-size: 1.875rem;
  line-height: 2.25rem;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 700;
}

.prose h3 {
  font-size: 1.5rem;
  line-height: 2rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.prose h4 {
  font-size: 1.25rem;
  line-height: 1.75rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.prose h5 {
  font-size: 1.125rem;
  line-height: 1.75rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.prose h6 {
  font-size: 1rem;
  line-height: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

/* 标题左侧装饰线 */
.prose h2::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: linear-gradient(to bottom, #06b6d4, #8b5cf6);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.prose h2:hover::before {
  opacity: 1;
}

/* 确保段落间距 */
.prose p {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

/* 加载动画 */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  animation: shimmer 2s infinite linear;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.05) 8%, rgba(255, 255, 255, 0.1) 18%, rgba(255, 255, 255, 0.05) 33%);
  background-size: 1000px 100%;
}

/* 霓虹光效 */
.neon-text {
  text-shadow: 
    0 0 10px rgba(6, 182, 212, 0.5),
    0 0 20px rgba(6, 182, 212, 0.3),
    0 0 30px rgba(6, 182, 212, 0.2);
}

/* 卡片悬停光效 */
.card-glow {
  position: relative;
  overflow: hidden;
}

.card-glow::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.card-glow:hover::before {
  opacity: 1;
}

/* 文本渐变动画 */
@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.gradient-text {
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
}

/* 响应式优化 */
@media (max-width: 768px) {
  pre {
    padding: 1rem !important;
    font-size: 0.75rem;
  }
  
  h2::before {
    display: none;
  }
}

/* 打印样式 */
@media print {
  body {
    background: white;
    color: black;
  }
  
  nav, footer, button {
    display: none;
  }
}

/* 无障碍优化 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus 样式 */
*:focus-visible {
  outline: 2px solid #06b6d4;
  outline-offset: 2px;
}

/* Line clamp utility for older browsers */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* TOC 样式 */
#toc-sidebar {
  transition: opacity 0.3s ease-out, 
              transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, opacity;
  transform: scale(0.95);
  opacity: 0;
  pointer-events: none;
  transform-origin: top left;
}

/* TOC 切换按钮 */
#toc-toggle-btn {
  cursor: pointer;
}

#toc-toggle-btn:active {
  transform: scale(0.95);
}

/* TOC 内容区域 */
.toc-content {
  position: relative;
}

/* TOC 链接活跃状态 */
.toc-link.active {
  color: #06b6d4;
  background-color: rgba(6, 182, 212, 0.1);
  border-left: 2px solid #06b6d4;
  padding-left: calc(0.75rem - 2px);
}

/* TOC 滚动条样式 */
.toc-content::-webkit-scrollbar {
  width: 4px;
}

.toc-content::-webkit-scrollbar-track {
  background: transparent;
}

.toc-content::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.3);
  border-radius: 2px;
}

.toc-content::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.5);
}
