/* ========================================
   FunnyLink Portal — 极简现代暗色主题
   Apple 官网感：大留白、微交互、毛玻璃
   ======================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text: #f5f5f7;
    --text-secondary: #86868b;
    --text-muted: #6e6e73;
    --accent: #2997ff;
    --accent-hover: #64b5f6;
    --gradient-1: #2997ff;
    --gradient-2: #bf5af2;
    --gradient-3: #30d158;
    --radius: 16px;
    --radius-sm: 10px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    --nav-height: 64px;
    --max-width: 1200px;
    --content-width: 800px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ---------- 鼠标光晕 ---------- */
.cursor-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(41, 151, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    opacity: 0;
}

body:hover .cursor-glow {
    opacity: 1;
}

/* ---------- 导航栏 ---------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-height);
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 100%;
    padding: 0 2rem;
    display: flex;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.logo-icon {
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    margin-left: 2.5rem;
}

.nav-auth {
    margin-left: auto;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    letter-spacing: -0.01em;
}

.nav-link:hover {
    color: var(--text);
}

.nav-link--accent {
    color: var(--accent);
}

.nav-link--muted {
    color: var(--text-muted);
}

/* 移动端汉堡菜单 */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: var(--text-secondary);
    transition: all 0.3s ease;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--nav-height) + 4rem) 2rem 4rem;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-gradient {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 600px;
    background: radial-gradient(ellipse at center,
        rgba(41, 151, 255, 0.12) 0%,
        rgba(191, 90, 242, 0.06) 40%,
        transparent 70%);
    filter: blur(60px);
    animation: pulse 8s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% { transform: translateX(-50%) scale(1); opacity: 0.6; }
    100% { transform: translateX(-50%) scale(1.15); opacity: 1; }
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 700px;
}

.hero-eyebrow {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
}

.hero-title-line {
    display: block;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-title-line:nth-child(2) {
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* ---------- 模块卡片网格 ---------- */
.modules {
    padding: 0 2rem 8rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 960px) {
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .modules-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- 毛玻璃卡片 ---------- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ---------- 模块卡片 ---------- */
.module-card {
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.card-recent {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 1rem;
}

.card-recent-item {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    background: rgba(41, 151, 255, 0.1);
    color: var(--accent);
    border: 1px solid rgba(41, 151, 255, 0.2);
    margin-bottom: 1rem;
    width: fit-content;
}

.card-badge--locked {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border-color: var(--border);
}

.card-badge--soon {
    background: rgba(48, 209, 88, 0.1);
    color: var(--gradient-3);
    border-color: rgba(48, 209, 88, 0.2);
}

.card-arrow {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.glass-card:hover .card-arrow {
    color: var(--accent);
    transform: translateX(4px);
}

/* ---------- 内容区通用 ---------- */
.content-section {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: calc(var(--nav-height) + 4rem) 2rem 6rem;
}

.content-header {
    margin-bottom: 3rem;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

/* ---------- 文章列表 ---------- */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.article-card {
    display: block;
    padding: 2rem;
    position: relative;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.article-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.article-category {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-title {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.article-summary {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---------- 文章详情 ---------- */
.article-detail {
    max-width: var(--content-width);
}

.article-detail-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.back-link {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 2rem;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 0.7;
}

.article-detail-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-top: 0.75rem;
}

/* ---------- Prose (文章正文) ---------- */
.prose {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.prose h1, .prose h2, .prose h3, .prose h4 {
    color: var(--text);
    margin-top: 2em;
    margin-bottom: 0.5em;
    letter-spacing: -0.02em;
}

.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }

.prose p {
    margin-bottom: 1.25em;
}

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prose code {
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.prose pre {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5em 0;
}

.prose pre code {
    background: none;
    padding: 0;
}

.prose blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1.25rem;
    margin: 1.5em 0;
    color: var(--text-muted);
    font-style: italic;
}

.prose ul, .prose ol {
    margin: 1em 0;
    padding-left: 1.5em;
}

.prose li {
    margin-bottom: 0.4em;
}

.prose img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 1.5em 0;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}

.prose th, .prose td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    text-align: left;
}

.prose th {
    background: rgba(255, 255, 255, 0.04);
    font-weight: 600;
    color: var(--text);
}

/* ---------- 登录页 ---------- */
.login-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 3rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.login-error {
    background: rgba(255, 69, 58, 0.1);
    border: 1px solid rgba(255, 69, 58, 0.3);
    color: #ff453a;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s ease;
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(41, 151, 255, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.btn-login {
    width: 100%;
    padding: 0.85rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.btn-login:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* ---------- 空状态 ---------- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-hint {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* ---------- 页脚 ---------- */
.footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---------- Fade-in 动画 ---------- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(20px);
        padding: 2rem;
        flex-direction: column;
        gap: 1.5rem;
        border-bottom: 1px solid var(--border);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: flex;
    }

    .hero-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }

    .modules-grid {
        grid-template-columns: 1fr;
    }

    .article-detail-title {
        font-size: 1.8rem;
    }

    .login-card {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 1rem;
    }

    .hero {
        padding: calc(var(--nav-height) + 2rem) 1rem 2rem;
        min-height: 70vh;
    }

    .modules {
        padding: 0 1rem 4rem;
    }

    .content-section {
        padding: calc(var(--nav-height) + 2rem) 1rem 4rem;
    }
}
