/* CSS 變數定義 - 配色方案 */
:root {
    --color-primary: #0f172a;
    --color-secondary-1: #212a37;
    --color-secondary-2: #222222;
    --color-secondary-3: #152030;
    --color-border: #4f5b62;
    --color-accent-1: #0084ff;
    --color-accent-2: #0177e3;
    --color-accent-3: #fb923c;
    --color-text-primary: #ffffff;
    --color-text-secondary: #a1a1aa;
}

/* 全域樣式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--color-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary-3) 100%);
    padding: 4rem 0;
}

.hero-content {
    text-align: center;
    animation: fadeInUp 1s ease-out;
}

.license-badge {
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease-out;
}

.license-badge span {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background-color: rgba(33, 42, 55, 0.6);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: default;
}

.license-badge span:hover {
    background-color: var(--color-secondary-1);
    border-color: var(--color-accent-1);
    color: var(--color-accent-1);
    transform: translateY(-2px);
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--color-accent-1), var(--color-accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-title-sub {
    font-size: 0.5em;
    font-weight: 400;
    display: block;
}

.hero-subtitle {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--color-text-primary);
}

.hero-description {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    margin-bottom: 2.5rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.875rem 2rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--color-accent-1);
    color: white;
    border: 2px solid var(--color-accent-1);
}

.btn-primary:hover {
    background-color: var(--color-accent-2);
    border-color: var(--color-accent-2);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 132, 255, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text-primary);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-secondary-1);
    border-color: var(--color-accent-1);
    transform: translateY(-2px);
}

/* Stats Section */
.stats {
    padding: 4rem 0;
    background-color: var(--color-secondary-2);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.stat-card {
    text-align: center;
    padding: 2rem;
    background-color: var(--color-secondary-1);
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent-1);
    box-shadow: 0 10px 30px rgba(0, 132, 255, 0.2);
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-accent-1);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    color: var(--color-text-secondary);
}

/* Clickable stat card */
.stat-card-clickable {
    cursor: pointer;
    position: relative;
}

.stat-card-clickable:hover {
    border-color: var(--color-accent-3);
}

.stat-expand-hint {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    opacity: 0.7;
    margin-top: 0.5rem;
    transition: opacity 0.3s ease;
}

.stat-card-clickable:hover .stat-expand-hint {
    opacity: 1;
    color: var(--color-accent-3);
}

/* Community Packages Section */
.community-packages-section {
    margin-top: 2rem;
    border-radius: 1rem;
    background-color: var(--color-secondary-1);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.community-packages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.community-packages-header:hover {
    background-color: rgba(0, 132, 255, 0.1);
}

.community-packages-title {
    font-size: 1.25rem;
    color: var(--color-text-primary);
    margin: 0;
}

.community-packages-toggle-icon {
    color: var(--color-accent-1);
    transition: transform 0.3s ease;
}

.community-packages-section.expanded .community-packages-toggle-icon {
    transform: rotate(180deg);
}

.community-packages-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.community-packages-section.expanded .community-packages-content {
    max-height: 3000px;
}

/* Package Cards Grid */
.community-packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    padding: 0 2rem 2rem;
}

.community-package-card {
    background-color: var(--color-secondary-2);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.community-package-card:hover {
    border-color: var(--color-accent-1);
    transform: translateY(-2px);
}

.package-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.package-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-accent-1);
    word-break: break-word;
}

.package-category {
    flex-shrink: 0;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    background-color: var(--color-primary);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Category Colors */
.package-category[data-category="communication"] {
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.package-category[data-category="ai-tools"] {
    background-color: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.package-category[data-category="web-scraping"] {
    background-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.package-category[data-category="document"] {
    background-color: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.package-category[data-category="data-processing"] {
    background-color: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

.package-category[data-category="utilities"] {
    background-color: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.package-description {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.package-npm-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.package-npm-link:hover {
    color: #cb3837;
    border-color: #cb3837;
}

.npm-icon {
    width: 14px;
    height: 14px;
}

/* Features Section */
.features {
    padding: 6rem 0;
    background-color: var(--color-primary);
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--color-text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2rem;
    background-color: var(--color-secondary-1);
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent-1);
    box-shadow: 0 10px 30px rgba(0, 132, 255, 0.2);
}

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

.feature-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-text-primary);
}

.feature-description {
    color: var(--color-text-secondary);
    line-height: 1.7;
}

/* How It Works Section */
.how-it-works {
    padding: 6rem 0;
    background-color: var(--color-secondary-2);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.step-card {
    padding: 2rem;
    background-color: var(--color-secondary-1);
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    text-align: center;
    transition: all 0.3s ease;
}

.step-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent-3);
}

.step-number {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--color-accent-1), var(--color-accent-3));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 1.5rem;
}

.step-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-text-primary);
}

.step-description {
    color: var(--color-text-secondary);
    line-height: 1.7;
}

/* Installation Section */
.installation {
    padding: 6rem 0;
    background-color: var(--color-primary);
}

.section-subtitle {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    margin-top: -1rem;
    margin-bottom: 3rem;
}

.installation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.install-card {
    position: relative;
    padding: 2.5rem 2rem;
    background-color: var(--color-secondary-1);
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    text-align: center;
    transition: all 0.3s ease;
}

.install-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent-3);
}

.install-card-primary {
    border-color: var(--color-accent-1);
    background: linear-gradient(135deg, rgba(1, 119, 227, 0.1), rgba(128, 90, 213, 0.1));
}

.install-card-primary:hover {
    border-color: var(--color-accent-2);
    box-shadow: 0 10px 30px rgba(1, 119, 227, 0.3);
}

.install-icon {
    color: var(--color-accent-1);
    margin-bottom: 1.5rem;
}

.install-title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-primary);
}

.install-description {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.install-command {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--color-secondary-2);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.install-command code {
    color: var(--color-accent-1);
    font-size: 0.9rem;
    word-break: break-all;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.copy-btn:hover {
    color: var(--color-accent-1);
}

.copy-btn.copied {
    color: var(--color-success);
}

.install-badge {
    position: absolute;
    top: -0.75rem;
    right: 1.5rem;
    background: linear-gradient(135deg, var(--color-accent-1), var(--color-accent-3));
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.install-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Categories Section */
.categories {
    padding: 6rem 0;
    background-color: var(--color-primary);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.category-card {
    padding: 2rem;
    background-color: var(--color-secondary-1);
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent-2);
    box-shadow: 0 10px 30px rgba(1, 119, 227, 0.2);
}

.category-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--color-accent-1);
}

.category-description {
    color: var(--color-text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Footer */
.footer {
    padding: 3rem 0 2rem;
    background-color: var(--color-secondary-2);
    border-top: 1px solid var(--color-border);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-brand-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
}

.footer-slogan {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

.footer-links-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-group-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 0.5rem 0;
}

.footer-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links-list li a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-links-list li a:hover {
    color: var(--color-accent-1);
}

.footer-bottom {
    border-top: 1px solid var(--color-border);
    padding-top: 1.5rem;
    text-align: center;
}

.footer-copyright {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    margin: 0;
}

/* 動畫 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .container {
        padding: 0 1rem;
    }

    .stats-grid,
    .features-grid,
    .steps-grid,
    .categories-grid,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        gap: 2rem;
        text-align: center;
    }

    .footer-brand {
        align-items: center;
    }

    .footer-brand-header {
        justify-content: center;
    }

    .footer-links-group {
        align-items: center;
    }

    .community-packages-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem 1.5rem;
    }

    .community-packages-header {
        padding: 1.25rem 1.5rem;
    }

    .package-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .package-category {
        align-self: flex-start;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .license-badge span {
        font-size: 0.75rem;
        padding: 0.3rem 0.75rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .feature-icon {
        font-size: 2.5rem;
    }

    .community-packages-grid {
        padding: 0 1rem 1rem;
    }

    .community-package-card {
        padding: 1rem;
    }
}

/* 滾動導航列 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(79, 91, 98, 0.3);
}

.navbar-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-accent-1), var(--color-accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-nav {
    padding: 0.625rem 1.5rem;
    font-size: 0.9rem;
}

/* Hero 元素淡出效果 */
.hero-title,
.hero-buttons {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.hero-hidden {
    opacity: 0;
    transform: translateY(-20px);
}

/* 響應式導航列 */
@media (max-width: 768px) {
    .navbar-container {
        padding: 0.875rem 1rem;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }

    .navbar-buttons {
        gap: 0.5rem;
    }

    .btn-nav {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .btn-nav svg {
        width: 16px;
        height: 16px;
    }
}

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

    .navbar-brand {
        font-size: 1.1rem;
    }

    .navbar-buttons {
        gap: 0.5rem;
    }

    .btn-nav {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
        gap: 0.25rem;
    }

    .btn-nav svg {
        width: 14px;
        height: 14px;
    }
}

/* Language Toggle Fixed Button */
.lang-toggle-fixed {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1001;

    /* Appearance */
    background: rgba(33, 42, 55, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(79, 91, 98, 0.5);
    border-radius: 2rem;

    /* Spacing & Layout */
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;

    /* Typography */
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;

    /* Interaction */
    cursor: pointer;
    transition: all 0.3s ease;

    /* Shadow */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.lang-toggle-fixed:hover {
    background: rgba(33, 42, 55, 0.95);
    border-color: var(--color-accent-1);
    color: var(--color-accent-1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 132, 255, 0.25);
}

.lang-toggle-fixed .lang-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.lang-toggle-fixed .lang-text {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Language Toggle Responsive */
@media (max-width: 768px) {
    .lang-toggle-fixed {
        top: 1rem;
        right: 1rem;
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }

    .lang-toggle-fixed .lang-icon {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .lang-toggle-fixed {
        top: 0.75rem;
        right: 0.75rem;
        padding: 0.45rem 0.75rem;
        font-size: 0.75rem;
        border-radius: 1.5rem;
    }

    .lang-toggle-fixed .lang-icon {
        font-size: 0.95rem;
    }
}
