/* ================================
   基础样式重置和根变量
   ================================ */

/* 保留这些主题特有的变量 */
:root {
  /* 这些变量在设计规范中没有，需要保留 */
  --radius-card: 6px;
  --radius-section: 12px;
  --bg-tertiary: #F1F5F9;
  --code-bg: #F7FAFC;
  --bg-warning: #FEF3C7;
}

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

/* 为固定导航栏添加页面内容的顶部间距 - 动态计算 */
body {
    /* 移除固定值，改为通过JavaScript动态设置 */
    transition: padding-top var(--transition-normal);
}

/* 全局长文本处理 */
h1, h2, h3, h4, h5, h6, p, a, span, div, li, td, th, blockquote, pre, code {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-lg);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ================================
   滚动进度条
   ================================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--primary-brand);
    z-index: 2000;
    transition: width var(--transition-fast);
}

/* ================================
   平滑滚动（已禁用）
   ================================ */
html {
    scroll-behavior: auto;
}

/* ================================
   无障碍支持
   ================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

*:focus-visible {
    outline: 2px solid var(--primary-brand);
    outline-offset: 2px;
}

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

.fade-in-up {
    /* 移除动画效果 */
    animation: none;
}

/* ================================
   回到顶部按钮
   ================================ */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-brand);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: #0d47a1;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.back-to-top svg {
    stroke: white;
    transition: transform 0.2s ease;
}

.back-to-top:hover svg {
    transform: translateY(-2px);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
    }
    
    .back-to-top svg {
        width: 20px;
        height: 20px;
    }
}

/* 现代按钮样式 - 覆盖WordPress古腾堡默认样式 */
.wp-block-button {
    display: inline-block;
    margin: 0;
}

.wp-block-button__link {
    /* 布局属性 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-break: break-word;
    box-sizing: border-box;
    margin-bottom: 0.75rem;
    
    /* 视觉样式 */
    background-color: var(--primary-brand) !important;
    color: white;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: none;
    text-decoration: none;
    
    /* 间距和字体 */
    padding: var(--space-2) var(--space-4) !important;
    font-size: var(--text-sm) !important;
    font-weight: 600;
    font-family: var(--font-primary);
    
    /* 过渡效果 */
    transition: all 0.2s ease;
    
    /* 图标位置 */
    position: relative;
    padding-left: 2.5rem !important;
}

/* 添加下载图标 */
.wp-block-button__link::before {
    content: "→";
    position: absolute;
    left: 1rem;
    font-size: var(--text-lg);
    transition: transform 0.2s ease;
}

/* 悬停效果 */
.wp-block-button__link:hover {
    background-color: var(--accent-cta) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
}

.wp-block-button__link:hover::before {
    transform: translateY(-2px);
}

/* 点击效果 */
.wp-block-button__link:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 焦点效果 - 可访问性优化 */
.wp-block-button__link:focus {
    outline: 2px solid rgba(var(--primary-brand-rgb), 0.4);
    outline-offset: 2px;
}

/* 响应式调整 - 移动设备 */
@media (max-width: 480px) {
    .wp-block-button__link {
        padding: 0.75rem 1rem;
        font-size: var(--text-sm);
        padding-left: 2rem;
    }
    
    .wp-block-button__link::before {
        left: 0.75rem;
    }
}

/* 确保按钮在按钮组中正确显示 */
.wp-block-buttons > .wp-block-button {
    display: inline-block;
    margin: 0;
}

.wp-block-buttons .wp-block-button__link {
    width: auto; /* 覆盖原有的100%宽度 */
}

/* 保持WordPress核心样式兼容性 */
.wp-element-button {
    cursor: pointer;
}
