/**
 * 关键CSS - CSS变量 + 首屏渲染基础样式
 * 通过 <link> 标签加载，作为所有主题样式的依赖项
 *
 * @package AI_Tools_Directory
 */

/**
 * CSS变量定义
 * 集中管理所有颜色、尺寸、间距等变量
 *
 * @package AI_Tools_Directory
 */

:root {
    /* ===================================
       颜色系统
       =================================== */

    /* 主色调 */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --primary-lighter: #c7d2fe;
    --primary-lightest: #e0e7ff;

    --secondary-color: #8b5cf6;
    --secondary-hover: #7c3aed;
    --secondary-light: #a78bfa;

    /* 功能色 */
    --success-color: #10b981;
    --success-hover: #059669;
    --success-light: #d1fae5;
    --success-dark: #065f46;

    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fee2e2;
    --danger-dark: #b91c1c;

    --warning-color: #f59e0b;
    --warning-light: #fef3c7;

    --info-color: #3b82f6;
    --info-light: #dbeafe;

    /* 热门/强调色 */
    --hot-color: #ff4757;
    --hot-light: #fee2e2;

    /* 文字颜色 */
    --text-color: #1f2937;
    --text-light: #4b5563;
    --text-lighter: #9ca3af;
    --text-lightest: #d1d5db;

    /* 背景颜色 */
    --bg-color: #ffffff;
    --bg-light: #f9fafb;
    --bg-lighter: #f3f4f6;
    --bg-dark: #1f2937;

    /* 边框颜色 */
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --border-dark: #d1d5db;

    /* 悬停颜色 */
    --hover-color: #f3f4f6;
    --hover-light: #f9fafb;

    /* ===================================
       阴影系统
       =================================== */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);

    /* ===================================
       尺寸系统
       =================================== */

    /* 间距 */
    --spacing-xs: 0.25rem;    /* 4px */
    --spacing-sm: 0.5rem;     /* 8px */
    --spacing-md: 1rem;       /* 16px */
    --spacing-lg: 1.5rem;     /* 24px */
    --spacing-xl: 2rem;       /* 32px */
    --spacing-2xl: 3rem;      /* 48px */
    --spacing-3xl: 4rem;      /* 64px */

    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-2xl: 12px;
    --radius-3xl: 16px;
    --radius-full: 9999px;

    /* 字体大小 */
    --text-xs: 0.75rem;       /* 12px */
    --text-sm: 0.875rem;      /* 14px */
    --text-base: 1rem;        /* 16px */
    --text-lg: 1.125rem;      /* 18px */
    --text-xl: 1.25rem;       /* 20px */
    --text-2xl: 1.5rem;       /* 24px */
    --text-3xl: 2rem;         /* 32px */
    --text-4xl: 2.5rem;       /* 40px */

    /* 字重 */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* 行高 */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.75;

    /* ===================================
       布局尺寸
       =================================== */
    --container-max: 1400px;
    --content-max: 800px;
    --sidebar-width: 350px;
    --header-height: 64px;

    /* ===================================
       过渡动画
       =================================== */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
    --transition-slower: 0.5s ease;

    /* ===================================
       Z-index层级
       =================================== */
    --z-dropdown: 100;
    --z-sticky: 1000;
    --z-modal: 9999;
    --z-tooltip: 10000;
}

/* ===================================
   暗色模式变量
   =================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #818cf8;
        --secondary-color: #a78bfa;
        --text-color: #f9fafb;
        --text-light: #d1d5db;
        --bg-color: #1f2937;
        --bg-light: #111827;
        --border-color: #374151;
        --hover-color: #374151;
    }
}

/* ===================================
   首屏渲染必需样式
   =================================== */

/* 无障碍：跳转链接 & 屏幕阅读器文本 */
.skip-link,
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}
.skip-link:focus,
.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    clip-path: none;
    color: #21759b;
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-light);
    line-height: 1.6;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-base);
}

img {
    max-width: 100%;
    height: auto;
}

/* 头部关键样式 */
.site-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
}

.site-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.name-primary {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-color);
}

/* 主导航 */
.main-navigation {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0 var(--spacing-xl);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-sm);
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-color);
    font-weight: var(--font-medium);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    text-transform: uppercase;
}

.nav-icon {
    flex-shrink: 0;
}

/* 主内容区域 */
.site-content {
    max-width: var(--container-max);
    margin: var(--spacing-xl) auto;
    padding: 0 var(--spacing-xl);
}

/* 移动端关键样式 */
@media (max-width: 768px) {
    .header-container {
        padding: 0 var(--spacing-md);
        height: 56px;
    }
    
    .main-navigation {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background: white;
        max-height: 0;
        overflow: hidden;
        transition: max-height var(--transition-slow);
    }
    
    .main-navigation.active {
        max-height: 400px;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0;
        padding: var(--spacing-sm);
    }
    
    .site-content {
        padding: 0 var(--spacing-md);
        margin: var(--spacing-md) auto;
    }
}

/* Newsletter 订阅组件 */
.newsletter-section {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-top: 1px solid #e5e7eb;
    padding: 48px 0;
}

.newsletter-inner {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 0 24px;
}

.newsletter-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
}

.newsletter-desc {
    font-size: 15px;
    color: #6b7280;
    margin: 0 0 28px;
}

.newsletter-form {
    display: flex;
    gap: 10px;
    max-width: 460px;
    margin: 0 auto;
}

.newsletter-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.newsletter-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.newsletter-btn {
    padding: 12px 28px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.newsletter-btn:hover {
    background: #2563eb;
}

.newsletter-btn:active {
    transform: scale(0.97);
}

.newsletter-msg {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
    min-height: 22px;
}

.newsletter-msg.success { color: #059669; }
.newsletter-msg.error   { color: #dc2626; }

/* 侧边栏订阅 widget（首页） */
.widget-newsletter {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 24px 20px;
}

.widget-newsletter .widget-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e40af;
    margin: 0 0 6px;
}

.widget-newsletter-desc {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 16px;
}

.widget-newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.newsletter-input-widget {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.newsletter-input-widget:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.newsletter-button-widget {
    width: 100%;
    padding: 10px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.newsletter-button-widget:hover {
    background: #2563eb;
}

/* Newsletter 响应式 */
@media (max-width: 640px) {
    .newsletter-form {
        flex-direction: column;
    }
    .newsletter-btn {
        width: 100%;
    }
    .newsletter-section {
        padding: 32px 0;
    }
}
