/* ============================================
   fin-agent-skills — Glassmorphism Dark Theme
   ============================================ */

/* --- CSS Variables --- */
:root {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --accent: #3B82F6;
    --accent-hover: #60A5FA;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --gold: #F59E0B;
    --gold-hover: #FBBF24;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(148, 163, 184, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --sidebar-width: 260px;
    --right-sidebar-width: 300px;
    --navbar-height: 64px;
    --transition: 0.2s ease;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'DM Sans', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* --- Animated Background --- */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: float 20s ease-in-out infinite;
}

.bg-orb:nth-child(1) {
    width: 600px;
    height: 600px;
    background: var(--accent);
    top: -200px;
    left: -100px;
    animation-delay: 0s;
}

.bg-orb:nth-child(2) {
    width: 400px;
    height: 400px;
    background: #8B5CF6;
    top: 50%;
    right: -100px;
    animation-delay: -7s;
}

.bg-orb:nth-child(3) {
    width: 500px;
    height: 500px;
    background: var(--gold);
    bottom: -200px;
    left: 30%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, -30px) scale(1.05); }
    50% { transform: translate(-30px, 50px) scale(0.95); }
    75% { transform: translate(30px, 30px) scale(1.02); }
}

/* --- Glass Effects --- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.glass-light {
    background: rgba(30, 41, 59, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 1400px;
    height: var(--navbar-height);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-radius: var(--radius-lg);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    cursor: pointer;
}

.navbar-brand img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.navbar-nav a,
.navbar-nav button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.navbar-nav a:hover,
.navbar-nav button:hover {
    color: var(--text-primary);
    background: rgba(148, 163, 184, 0.1);
}

/* --- Language Switcher --- */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: var(--radius-sm);
    background: rgba(148, 163, 184, 0.08);
}

.lang-btn {
    padding: 4px 10px !important;
    font-size: 0.8rem !important;
    border-radius: 6px !important;
    transition: all var(--transition);
}

.lang-btn.active {
    background: var(--accent) !important;
    color: white !important;
}

/* --- Skills Dropdown --- */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 260px;
    padding: 8px;
    border-radius: var(--radius);
    z-index: 1001;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition);
}

.dropdown-item:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-primary);
}

.dropdown-item .skill-name {
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.dropdown-item .skill-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Hamburger Menu --- */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.hamburger span {
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all var(--transition);
}

/* --- Mobile Menu --- */
.mobile-menu {
    display: none;
    position: fixed;
    top: calc(var(--navbar-height) + 24px);
    left: 24px;
    right: 24px;
    padding: 16px;
    border-radius: var(--radius);
    z-index: 999;
}

.mobile-menu.open {
    display: block;
}

.mobile-menu a {
    display: block;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.mobile-menu a:hover,
.mobile-menu a.active {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-primary);
}

/* --- Layout --- */
.layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding-top: calc(var(--navbar-height) + 36px);
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Left Sidebar --- */
.sidebar-left {
    position: sticky;
    top: calc(var(--navbar-height) + 36px);
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height) - 36px);
    flex-shrink: 0;
    padding: 24px 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) transparent;
}

.sidebar-section {
    margin-bottom: 28px;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.skill-list {
    list-style: none;
}

.skill-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.skill-list li a:hover {
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-primary);
}

.skill-list li a.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent);
}

.skill-list li a .skill-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* --- TOC (Left Sidebar) --- */
.toc-container {
    margin-top: 8px;
}

.js-toc {
    list-style: none;
}

.js-toc .toc-link {
    display: block;
    padding: 4px 12px;
    border-left: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
    transition: all var(--transition);
}

.js-toc .toc-link:hover {
    color: var(--text-secondary);
    border-left-color: var(--bg-tertiary);
}

.js-toc .is-active-link {
    color: var(--accent) !important;
    border-left-color: var(--accent) !important;
}

.js-toc .toc-list-item {
    list-style: none;
}

.js-toc .toc-list .toc-list {
    padding-left: 12px;
}

/* --- Main Content --- */
.content-main {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    padding: 0 40px;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* --- Loading Spinner --- */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Marketing Section --- */
.marketing-header {
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--glass-border);
}

.marketing-header h1 {
    font-family: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.5;
    margin-bottom: 16px;
    color: var(--accent);
    overflow-wrap: break-word;
    word-break: break-word;
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
    .marketing-header h1 span {
        background: linear-gradient(135deg, var(--accent), var(--gold));
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        -webkit-box-decoration-break: clone;
        box-decoration-break: clone;
        padding: 0.15em 0;
    }
}

.marketing-header p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 640px;
}

.marketing-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.pain-points {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.pain-card {
    padding: 20px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.pain-card:hover {
    border-color: rgba(148, 163, 184, 0.2);
    transform: translateY(-2px);
}

.pain-card .icon {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.pain-card h3 {
    font-family: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.pain-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- Trigger Examples --- */
.trigger-section {
    margin-bottom: 40px;
}

.trigger-section h3 {
    font-family: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.trigger-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trigger-item {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: default;
    transition: all var(--transition);
}

.trigger-item:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
}

/* --- Right Sidebar --- */
.sidebar-right {
    position: sticky;
    top: calc(var(--navbar-height) + 36px);
    width: var(--right-sidebar-width);
    height: calc(100vh - var(--navbar-height) - 36px);
    flex-shrink: 0;
    padding: 24px 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) transparent;
}

.install-card {
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.install-card h3 {
    font-family: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.install-card .quote-block {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid var(--accent);
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.install-card .quote-block code {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
}

.install-code {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: pre;
}

.install-code .comment {
    color: var(--text-muted);
}

.install-code .command {
    color: var(--success);
}

/* --- Article Content (rendered Markdown) --- */
.article-content {
    font-size: 0.95rem;
    line-height: 1.8;
}

.article-content h1 {
    font-family: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.article-content h2 {
    font-family: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 40px;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.article-content h3 {
    font-family: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 32px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.article-content h4 {
    font-family: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.article-content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.article-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.article-content em {
    color: var(--text-secondary);
    font-style: italic;
}

.article-content ul, .article-content ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

.article-content li {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.article-content li::marker {
    color: var(--text-muted);
}

.article-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 12px 20px;
    margin: 16px 0;
    background: rgba(59, 130, 246, 0.06);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.article-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.1);
    color: var(--accent-hover);
}

.article-content pre {
    margin: 16px 0;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    border: 1px solid var(--glass-border);
}

.article-content pre code {
    display: block;
    padding: 16px;
    background: rgba(15, 23, 42, 0.8);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

/* --- Tables --- */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.9rem;
    overflow-x: auto;
    display: block;
}

.article-content thead th {
    background: rgba(30, 41, 59, 0.6);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--glass-border);
    font-size: 0.85rem;
    white-space: nowrap;
}

.article-content tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-secondary);
    vertical-align: top;
}

.article-content tbody tr:hover {
    background: rgba(148, 163, 184, 0.04);
}

/* --- Horizontal Rule --- */
.article-content hr {
    border: none;
    height: 1px;
    background: var(--glass-border);
    margin: 32px 0;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 32px 24px;
    color: var(--text-muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--glass-border);
    margin-top: 60px;
}

/* ============================
   Responsive Design
   ============================ */

@media (max-width: 1280px) {
    .sidebar-right {
        width: 260px;
    }
}

@media (max-width: 1024px) {
    .sidebar-right {
        display: none;
    }

    .content-main {
        padding: 0 32px;
    }
}

@media (max-width: 900px) {
    .sidebar-left {
        display: none;
    }

    .content-main {
        padding: 0 24px;
    }

    .hamburger {
        display: flex;
    }

    .navbar-nav {
        display: none;
    }

    .pain-points {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .navbar {
        width: calc(100% - 24px);
        top: 8px;
        padding: 0 16px;
    }

    .layout {
        padding-top: calc(var(--navbar-height) + 24px);
    }

    .content-main {
        padding: 0 16px;
    }

    .marketing-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .marketing-header h1 {
        font-size: 1.3rem;
    }

    .article-content h1 {
        font-size: 1.5rem;
    }

    .article-content h2 {
        font-size: 1.2rem;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Selection --- */
::selection {
    background: rgba(59, 130, 246, 0.3);
    color: var(--text-primary);
}
