/**
 * ycl-wp 自定义链接样式
 * 统一管理全站超链接的颜色和交互效果
 * 使用 CSS 变量自动跟随主题颜色变化
 *
 * 主题色变量定义来源（优先级从低到高）：
 * 1. PHP 动态注入（functions.php 头部）：根据 Customizer 当前主题色生成
 * 2. color-*.css（仅当非 color-red 时加载）：作为可能的后备
 *
 * 重要：本文件依赖更早加载的 :root 变量！（不再重复定义）
 */


/* ============================================
   基础链接样式（跟随主题色）
   ============================================ */

/* 全局链接样式 */
a {
    color: var(--theme-primary);
    text-decoration: none;
    transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

/* 悬停状态 */
a:hover {
    color: var(--theme-primary-hover);
}

/* 已访问链接 - 跟随主题色（不写死深红） */
a:visited {
    color: var(--theme-primary);
}

/* 链接焦点状态（键盘导航） */
a:focus {
    outline: 2px solid var(--theme-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* 链接激活状态 */
a:active {
    color: var(--theme-primary-hover);
}

/* ============================================
   段落内容中的链接
   ============================================ */

.article-body a,
.entry-content a,
.post-content a {
    color: var(--theme-primary);
    text-decoration: underline;
    text-decoration-color: var(--theme-border-medium);
    text-underline-offset: 3px;
    transition: all 0.3s ease;
}

.article-body a:hover,
.entry-content a:hover,
.post-content a:hover {
    color: var(--theme-primary-hover);
    text-decoration-color: var(--theme-primary-hover);
    background-color: var(--theme-bg-light);
    padding: 0 2px;
    border-radius: 2px;
}

/* ============================================
   卡片链接（整体可点击卡片）
   ============================================ */

.post-card > a,
.portfolio-item > a,
.category-card > a {
    color: inherit;
    text-decoration: none;
}

.post-card > a:hover,
.portfolio-item > a:hover,
.category-card > a:hover {
    color: inherit;
    background: none;
    padding: 0;
}

/* 卡片标题链接 */
.post-card h2 a,
.portfolio-item h2 a,
.category-card h2 a {
    color: #fff;
    transition: color 0.3s ease;
}

.post-card h2 a:hover,
.portfolio-item h2 a:hover,
.category-card h2 a:hover {
    color: var(--theme-primary);
}

/* 卡片摘要链接 */
.post-card p a,
.portfolio-item p a {
    color: var(--theme-primary);
}

.post-card p a:hover,
.portfolio-item p a:hover {
    color: var(--theme-primary-hover);
}

/* ============================================
   导航链接
   ============================================ */

.navigation a,
.nav-menu a,
.site-nav a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.navigation a:hover,
.nav-menu a:hover,
.site-nav a:hover {
    color: var(--theme-primary);
}

/* 当前页面链接 */
.navigation .current-menu-item a,
.nav-menu .current-menu-item a,
.navigation .active a {
    color: var(--theme-primary);
}

/* ============================================
   按钮样式链接（跟随主题色）
   ============================================ */

.btn,
.button,
.button-link {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-primary-hover) 100%);
    color: #fff !important;
    border: none;
    border-radius: 50px;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px var(--theme-shadow);
}

.btn:hover,
.button:hover,
.button-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--theme-shadow-hover);
    color: #fff !important;
}

.btn-outline,
.button-outline {
    background: transparent;
    color: var(--theme-primary);
    border: 1px solid var(--theme-primary);
    box-shadow: none;
}

.btn-outline:hover,
.button-outline:hover {
    background: var(--theme-primary);
    color: #fff !important;
}

/* ============================================
   社交媒体链接
   ============================================ */

.social-link,
.social-links a {
    color: #888;
    transition: all 0.3s ease;
}

.social-link:hover,
.social-links a:hover {
    color: var(--theme-primary);
    transform: translateY(-2px);
}

/* ============================================
   分页链接
   ============================================ */

.pagination a,
.page-numbers a,
.pagination a:visited {
    color: #aaa;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.pagination a:hover,
.page-numbers a:hover {
    color: var(--theme-primary);
    border-color: var(--theme-primary);
    background: var(--theme-bg-light);
    transform: translateY(-2px);
}

.pagination .current,
.pagination .current:visited,
.page-numbers.current {
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-primary-hover) 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px var(--theme-shadow);
}

/* ============================================
   标签云链接
   ============================================ */

.tagcloud a,
.tags a {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #999;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tagcloud a:hover,
.tags a:hover {
    color: #fff;
    border-color: var(--theme-primary);
    background: var(--theme-bg-medium);
}

/* 文章页标签链接 */
.tag-link {
    color: var(--theme-primary) !important;
    background: var(--theme-bg-light) !important;
    border: 1px solid var(--theme-border-light) !important;
    font-weight: 500;
}

.tag-link:hover {
    color: #fff !important;
    background: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--theme-shadow);
}

/* WordPress 后台标签链接 */
.row-actions .tag-link,
.wp-admin .tag-link {
    color: var(--theme-primary) !important;
}

/* ============================================
   分类/筛选按钮链接
   ============================================ */

.filter-btn,
.category-filter a {
    transition: all 0.3s ease;
}

.filter-btn:hover,
.category-filter a:hover {
    color: var(--theme-primary);
    border-color: var(--theme-primary);
}

/* ============================================
   文章元信息链接
   ============================================ */

.post-meta a,
.entry-meta a,
.byline a,
.author-name a,
.post-date a {
    color: #888;
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-meta a:hover,
.entry-meta a:hover,
.byline a:hover,
.author-name a:hover,
.post-date a:hover {
    color: var(--theme-primary);
}

/* ============================================
   评论区链接
   ============================================ */

.comment-content a,
.comment-reply-link,
.comment-permalink {
    color: var(--theme-primary);
    text-decoration: underline;
    text-decoration-color: var(--theme-border-medium);
}

.comment-content a:hover,
.comment-reply-link:hover,
.comment-permalink:hover {
    color: var(--theme-primary-hover);
    text-decoration-color: var(--theme-primary-hover);
}

/* ============================================
   页脚链接
   ============================================ */

.footer a,
.site-footer a {
    color: #888;
    transition: color 0.3s ease;
}

.footer a:hover,
.site-footer a:hover {
    color: var(--theme-primary);
}

/* ============================================
   辅助类
   ============================================ */

/* 链接无下划线 */
.link-no-underline a {
    text-decoration: none;
}

/* 链接带下划线 */
.link-underline a {
    text-decoration: underline;
}

/* 外链图标（可选） */
.external-link::after {
    content: ' ↗';
    font-size: 0.75em;
    opacity: 0.7;
}

/* ============================================
   主题色切换示例
   ============================================ */

/*
 * 切换主题色时，只需在 color-*.css 或 JS 中重写变量：
 *
 * .theme-blue {
 *     --theme-primary: #2c5aa0;
 *     --theme-primary-hover: #4a7bc8;
 *     --theme-primary-rgb: 44, 90, 160;
 * }
 *
 * .theme-green {
 *     --theme-primary: #2e7d32;
 *     --theme-primary-hover: #4caf50;
 *     --theme-primary-rgb: 46, 125, 50;
 * }
 *
 * .theme-orange {
 *     --theme-primary: #e65100;
 *     --theme-primary-hover: #ff8f00;
 *     --theme-primary-rgb: 230, 81, 0;
 * }
 *
 * .theme-purple {
 *     --theme-primary: #6a1b9a;
 *     --theme-primary-hover: #9c4dcc;
 *     --theme-primary-rgb: 106, 27, 154;
 * }
 *
 * .theme-malt {
 *     --theme-primary: #8d6e63;
 *     --theme-primary-hover: #bcaaa4;
 *     --theme-primary-rgb: 141, 110, 99;
 * }
 */

/* ============================================
   减少动画模式
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    a,
    .btn,
    .social-link,
    .pagination a {
        transition: none;
    }
}
