/* ========================================
   AI学习笔记 - Apple Style Design System
   ======================================== */

:root,
[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8ed;
    --bg-glass: rgba(255, 255, 255, 0.72);
    --bg-glass-hover: rgba(255, 255, 255, 0.85);
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --accent: #007AFF;
    --accent-hover: #0066d6;
    --accent-light: rgba(0, 122, 255, 0.1);
    --border: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04), 0 0 1px rgba(0, 0, 0, 0.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --header-bg: rgba(251, 251, 253, 0.8);
    --hero-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #007AFF 100%);
    --tag-bg: rgba(0, 122, 255, 0.08);
    --code-bg: #f4f4f8;
    --overlay: rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --bg-glass: rgba(28, 28, 30, 0.72);
    --bg-glass-hover: rgba(44, 44, 46, 0.85);
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #6e6e73;
    --accent: #0A84FF;
    --accent-hover: #409cff;
    --accent-light: rgba(10, 132, 255, 0.15);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.06);
    --header-bg: rgba(28, 28, 30, 0.8);
    --hero-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --tag-bg: rgba(10, 132, 255, 0.15);
    --code-bg: #2c2c2e;
    --overlay: rgba(0, 0, 0, 0.6);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
                 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    transition: background-color 0.35s ease, color 0.35s ease;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    display: block;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== Header ========== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    transition: background 0.35s ease;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.logo:hover {
    color: var(--text-primary);
}

.logo-icon {
    display: flex;
    align-items: center;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-light);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.theme-toggle:hover {
    background: var(--border-strong);
    color: var(--text-primary);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-theme="light"] .icon-sun {
    opacity: 1;
    transform: rotate(0);
}

[data-theme="light"] .icon-moon {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="dark"] .icon-sun {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .icon-moon {
    opacity: 1;
    transform: rotate(0);
}

.menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========== Main ========== */
.site-main {
    flex: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ========== Hero ========== */
.hero {
    padding: 80px 24px 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: var(--hero-gradient);
    opacity: 0.08;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
}

.hero h1 {
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 32px;
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 980px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: scale(1.02);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-strong);
    color: var(--text-primary);
    transform: scale(1.02);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* ========== Section ========== */
.section {
    padding: 60px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.section-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== Stats ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 60px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--accent);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========== Cards ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.card-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.note-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.note-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--cat-color, var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.note-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    color: inherit;
}

.note-card:hover::before {
    opacity: 1;
}

.note-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    background: var(--cat-bg, var(--accent-light));
    color: var(--cat-color, var(--accent));
}

.note-date {
    font-size: 12px;
    color: var(--text-tertiary);
}

.note-card h3 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
    line-height: 1.4;
}

.note-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 16px;
}

.note-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.read-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    padding: 2px 8px;
    background: var(--tag-bg);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

/* ========== Categories ========== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.category-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    color: inherit;
}

.category-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 20px;
}

.category-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.category-card span {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ========== Page Header ========== */
.page-header {
    padding: 48px 0 32px;
    text-align: center;
}

.page-header h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.page-header p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto;
}

/* ========== Filter Bar ========== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 32px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    width: fit-content;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.filter-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.filter-btn.active {
    color: var(--accent);
    background: var(--accent-light);
}

/* ========== Article ========== */
.article-header {
    padding: 48px 0 32px;
}

.article-header .category-badge {
    margin-bottom: 16px;
}

.article-header h1 {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 16px;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-tertiary);
    font-size: 14px;
    flex-wrap: wrap;
}

.article-body {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 40px 48px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    margin-bottom: 48px;
}

.article-body h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 32px 0 12px;
    padding-top: 8px;
}

.article-body h2:first-child {
    margin-top: 0;
}

.article-body h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 8px;
}

.article-body p {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.article-body ol,
.article-body ul {
    padding-left: 24px;
    margin-bottom: 16px;
}

.article-body li {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.article-body pre {
    background: var(--code-bg);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border);
}

.article-body code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.article-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 48px;
}

.article-nav a {
    flex: 1;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    text-decoration: none;
}

.article-nav a:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.article-nav .nav-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.article-nav .nav-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ========== About ========== */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 48px;
}

.about-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 32px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

.about-card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.about-card p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.about-card ul {
    list-style: none;
    padding: 0;
}

.about-card li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.about-card li:last-child {
    border-bottom: none;
}

.about-card li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.info-table {
    width: 100%;
}

.info-table tr {
    border-bottom: 1px solid var(--border);
}

.info-table tr:last-child {
    border-bottom: none;
}

.info-table td {
    padding: 12px 0;
    font-size: 15px;
}

.info-table td:first-child {
    color: var(--text-tertiary);
    width: 100px;
    font-weight: 500;
}

.info-table td:last-child {
    color: var(--text-primary);
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}

.empty-state svg {
    margin: 0 auto 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ========== Footer ========== */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 32px;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 48px;
}

.footer-logo {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.footer-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    gap: 48px;
}

.footer-col h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.footer-col a {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 4px 0;
    transition: color 0.2s ease;
}

.footer-col a:hover {
    color: var(--accent);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-bottom p {
    font-size: 12px;
    color: var(--text-tertiary);
}

.footer-bottom a {
    color: var(--text-tertiary);
}

.footer-bottom a:hover {
    color: var(--accent);
}

/* ========== Animations ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-delay-1 { animation-delay: 0.1s; opacity: 0; }
.animate-delay-2 { animation-delay: 0.2s; opacity: 0; }
.animate-delay-3 { animation-delay: 0.3s; opacity: 0; }

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 52px;
        left: 0;
        right: 0;
        background: var(--header-bg);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 12px;
        gap: 2px;
    }

    .main-nav.open {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 12px 16px;
    }

    .menu-toggle {
        display: flex;
    }

    .hero {
        padding: 60px 24px 40px;
    }

    .card-grid,
    .card-grid-2 {
        grid-template-columns: 1fr;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .footer-links {
        gap: 32px;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .article-body {
        padding: 24px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .filter-bar {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

@media (max-width: 480px) {
    .category-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .hero-actions .btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}
