/* PyClaw 文档自定义样式 - 2026 美化版 */

/* ============================================
   CSS 变量定义
   ============================================ */
:root {
  --pyclaw-primary: #7c4dff;
  --pyclaw-secondary: #18ffff;
  --pyclaw-accent: #ff4081;
  --pyclaw-gradient: linear-gradient(135deg, #7c4dff 0%, #18ffff 100%);
  --pyclaw-gradient-hover: linear-gradient(135deg, #651fff 0%, #00e5ff 100%);
  --pyclaw-shadow: 0 8px 32px rgba(124, 77, 255, 0.2);
  --pyclaw-shadow-lg: 0 16px 48px rgba(124, 77, 255, 0.3);
  --pyclaw-radius: 1rem;
  --pyclaw-radius-lg: 1.5rem;
}

/* ============================================
   页面布局
   ============================================ */
.md-content__inner {
  max-width: 1100px;
}

/* ============================================
   Hero 区域 - 全面升级
   ============================================ */
.md-typeset .hero,
article .hero {
  margin: -1.5rem -1.5rem 2rem -1.5rem !important;
  padding: 4rem 2rem !important;
  background: var(--pyclaw-gradient) !important;
  color: white !important;
  text-align: center !important;
  border-radius: 0 0 var(--pyclaw-radius-lg) var(--pyclaw-radius-lg) !important;
  position: relative !important;
  overflow: hidden !important;
  box-shadow: var(--pyclaw-shadow-lg) !important;
}

/* Hero 背景装饰 */
.md-typeset .hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
  pointer-events: none;
}

/* Hero 动态光效 */
.md-typeset .hero::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: heroPulse 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes heroPulse {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.5; }
  50% { transform: translate(10%, 10%) scale(1.1); opacity: 0.3; }
}

.md-typeset .hero h1,
.hero h1 {
  margin: 0 0 0.75rem 0 !important;
  font-size: 3.5rem !important;
  font-weight: 800 !important;
  color: white !important;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
  letter-spacing: -0.02em;
}

.md-typeset .hero p {
  margin: 0 0 2rem 0;
  font-size: 1.35rem;
  opacity: 0.95;
  font-weight: 400;
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Hero 按钮 */
.md-typeset .hero .md-button {
  margin: 0.5rem;
  padding: 0.8rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 50px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}

.md-typeset .hero .md-button--primary {
  background: white;
  color: var(--pyclaw-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.md-typeset .hero .md-button--primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  background: white;
  color: var(--pyclaw-primary);
}

.md-typeset .hero .md-button:not(.md-button--primary) {
  background: transparent;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

.md-typeset .hero .md-button:not(.md-button--primary):hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: white;
  transform: translateY(-3px);
}

/* ============================================
   特性卡片网格 - 全新设计
   ============================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.grid.cards > * {
  background: linear-gradient(145deg,
    var(--md-code-bg-color) 0%,
    rgba(124, 77, 255, 0.05) 100%);
  border: 1px solid rgba(124, 77, 255, 0.15);
  border-radius: var(--pyclaw-radius);
  padding: 1.75rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* 卡片光效 */
.grid.cards > *::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--pyclaw-gradient);
  opacity: 0;
  transition: opacity 0.3s;
}

.grid.cards > *:hover {
  transform: translateY(-8px);
  box-shadow:
    0 20px 40px rgba(124, 77, 255, 0.15),
    0 0 0 1px rgba(124, 77, 255, 0.3);
  border-color: rgba(124, 77, 255, 0.3);
}

.grid.cards > *:hover::before {
  opacity: 1;
}

.grid.cards > * h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
  color: var(--pyclaw-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.grid.cards > * p {
  margin: 0;
  opacity: 0.85;
  line-height: 1.6;
}

/* 卡片图标动画 */
.grid.cards > * h3 .twemoji {
  font-size: 1.5rem;
  transition: transform 0.3s;
}

.grid.cards > *:hover h3 .twemoji {
  transform: scale(1.2) rotate(5deg);
}

/* ============================================
   统计数据 - 全新设计
   ============================================ */
.stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin: 3rem 0;
  flex-wrap: wrap;
  padding: 2rem;
  background: linear-gradient(135deg,
    rgba(124, 77, 255, 0.05) 0%,
    rgba(24, 255, 255, 0.05) 100%);
  border-radius: var(--pyclaw-radius-lg);
  border: 1px solid rgba(124, 77, 255, 0.1);
}

.stat {
  text-align: center;
  padding: 1rem;
  min-width: 100px;
  transition: transform 0.3s;
}

.stat:hover {
  transform: scale(1.05);
}

.stat-number {
  font-size: 3rem;
  font-weight: 800;
  background: var(--pyclaw-gradient) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.95rem;
  opacity: 0.8;
  font-weight: 500;
  color: var(--md-default-fg-color);
}

/* ============================================
   代码块增强
   ============================================ */
.md-typeset pre > code {
  border-radius: var(--pyclaw-radius);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* 代码块复制按钮 */
.md-typeset .md-clipboard {
  color: var(--pyclaw-primary);
}

.md-typeset .md-clipboard:hover {
  color: var(--pyclaw-accent);
}

/* ============================================
   徽章样式
   ============================================ */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50px;
  background: var(--pyclaw-gradient);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(124, 77, 255, 0.3);
}

.badge.green {
  background: linear-gradient(135deg, #4caf50 0%, #81c784 100%);
}

.badge.blue {
  background: linear-gradient(135deg, #2196f3 0%, #64b5f6 100%);
}

.badge.orange {
  background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
}

/* ============================================
   提示卡片
   ============================================ */
.tip-card {
  background: var(--pyclaw-gradient);
  color: white;
  padding: 1.25rem 1.75rem;
  border-radius: var(--pyclaw-radius);
  margin: 1.5rem 0;
  box-shadow: var(--pyclaw-shadow);
  position: relative;
  overflow: hidden;
}

.tip-card::before {
  content: '💡';
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  font-size: 1.5rem;
}

.tip-card a {
  color: white;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tip-card a:hover {
  text-decoration-thickness: 2px;
}

/* ============================================
   导航增强
   ============================================ */
.md-nav__link--active {
  font-weight: 700;
  color: var(--pyclaw-primary);
  border-left: 3px solid var(--pyclaw-primary);
  margin-left: -0.75rem;
  padding-left: 0.75rem;
}

.md-nav__link:hover {
  color: var(--pyclaw-primary);
}

/* ============================================
   页脚增强
   ============================================ */
.md-footer-meta {
  background: linear-gradient(135deg,
    var(--pyclaw-primary) 0%,
    #651fff 100%);
}

.md-footer-meta__inner {
  color: white;
}

/* ============================================
   表格增强
   ============================================ */
.md-typeset table:not([class]) {
  border-radius: var(--pyclaw-radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.md-typeset table:not([class]) th {
  background: var(--pyclaw-gradient);
  color: white;
  font-weight: 700;
}

.md-typeset table:not([class]) tr:hover {
  background: rgba(124, 77, 255, 0.05);
}

/* ============================================
   链接列表增强
   ============================================ */
.md-typeset h2 + ul {
  background: var(--md-code-bg-color);
  border-radius: var(--pyclaw-radius);
  padding: 1rem 1rem 1rem 2rem;
  border: 1px solid rgba(124, 77, 255, 0.1);
}

.md-typeset h2 + ul li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(124, 77, 255, 0.08);
}

.md-typeset h2 + ul li:last-child {
  border-bottom: none;
}

.md-typeset h2 + ul li a {
  font-weight: 500;
}

/* ============================================
   分隔线美化
   ============================================ */
.md-typeset hr {
  height: 2px;
  background: var(--pyclaw-gradient);
  border: none;
  border-radius: 2px;
  margin: 2.5rem 0;
  opacity: 0.3;
}

/* ============================================
   响应式调整
   ============================================ */
@media screen and (max-width: 768px) {
  .md-typeset .hero {
    padding: 2.5rem 1rem;
  }

  .md-typeset .hero h1 {
    font-size: 2rem;
  }

  .md-typeset .hero p {
    font-size: 1rem;
  }

  .stats {
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .stat-number {
    font-size: 2.25rem;
  }

  .grid {
    gap: 1rem;
  }

  .grid.cards > * {
    padding: 1.25rem;
  }
}

@media screen and (max-width: 480px) {
  .md-typeset .hero h1 {
    font-size: 1.75rem;
  }

  .stats {
    gap: 1rem;
  }

  .stat {
    min-width: 80px;
    padding: 0.75rem;
  }

  .stat-number {
    font-size: 2rem;
  }
}

/* ============================================
   滚动动画支持
   ============================================ */
@media (prefers-reduced-motion: no-preference) {
  .grid.cards > *,
  .stat,
  .md-typeset h2 + ul {
    scroll-margin-top: 5rem;
  }
}

/* ============================================
   暗色模式适配
   ============================================ */
[data-md-color-scheme="slate"] {
  --pyclaw-gradient: linear-gradient(135deg, #b388ff 0%, #00e5ff 100%);
  --pyclaw-shadow: 0 8px 32px rgba(179, 136, 255, 0.2);
  --pyclaw-shadow-lg: 0 16px 48px rgba(179, 136, 255, 0.25);
}

[data-md-color-scheme="slate"] .grid.cards > * {
  background: linear-gradient(145deg,
    rgba(179, 136, 255, 0.08) 0%,
    rgba(0, 229, 255, 0.05) 100%);
  border-color: rgba(179, 136, 255, 0.2);
}

[data-md-color-scheme="slate"] .stat-number {
  background: var(--pyclaw-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
