/**
 * ru-openrouter.ru - Homepage Remastered Styles
 * Улучшенный дизайн главной страницы
 */

/* ===== 1. CSS Variables Overrides ===== */
:root {
    --hero-gradient-1: #1e40af;
    --hero-gradient-2: #7c3aed;
    --hero-gradient-3: #db2777;
    --card-hover-shadow: 0 25px 50px rgba(37, 99, 235, 0.15);
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 2. Scroll Animations (IntersectionObserver) ===== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s var(--transition-smooth), transform 0.7s var(--transition-smooth);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

.animate-on-scroll.visible-delay-1 { transition-delay: 0.1s; }
.animate-on-scroll.visible-delay-2 { transition-delay: 0.2s; }
.animate-on-scroll.visible-delay-3 { transition-delay: 0.3s; }
.animate-on-scroll.visible-delay-4 { transition-delay: 0.4s; }

/* ===== 3. Hero Section — Enhanced ===== */
.hero-section {
    position: relative;
    overflow: hidden;
    /* Гарантируем, что WebGL-канвас не перекрывает контент */
}

.hero-section h1,
.hero-section p,
.hero-buttons {
    position: relative;
    z-index: 1;
}

/* Hero gradient overlay enhancement */
.hero-section::before {
    z-index: 0;
}

/* Floating particles enhancement */
.hero-section::after {
    animation: particleFloat 8s ease-in-out infinite alternate;
}

@keyframes particleFloat {
    0% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.6; transform: scale(1); }
}

/* Hero entrance animation */
.hero-section .animate-hero {
    opacity: 0;
    animation: heroFadeIn 0.8s var(--transition-smooth) forwards;
}

.hero-section h1.animate-hero { animation-delay: 0.1s; }
.hero-section p.animate-hero { animation-delay: 0.3s; }
.hero-section .hero-buttons.animate-hero { animation-delay: 0.5s; }

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Gradient text for hero H1 (fallback if no custom) */
.hero-section h1 {
    background: linear-gradient(135deg, #ffffff 30%, #9f9f9f 50%, #ffffff 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hero button glow effect */
.hero-section .btn-primary {
    position: relative;
}

.hero-section .btn-primary::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), transparent, rgba(255,255,255,0.2));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hero-section .btn-primary:hover::after {
    opacity: 1;
}

/* ===== 4. Stats Bar — Enhanced with Icon ===== */
.stats-bar {
    position: relative;
}

.stat-item {
    position: relative;
}

/* Stat icon styling */
.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
    margin-bottom: 12px;
    transition: transform 0.3s var(--transition-smooth), box-shadow 0.3s var(--transition-smooth);
}

.stat-item:hover .stat-icon {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

.stat-icon .svg-icon {
    width: 24px;
    height: 24px;
    stroke: var(--primary-color, #2563eb);
    stroke-width: 1.5;
}

/* Animated stat value */
.stat-value {
    position: relative;
    display: inline-block;
}


/* ===== 5. Features Section — Enhanced ===== */
.features-section {
    position: relative;
}

.feature-card {
    cursor: default;
}

/* Gradient accent line enhancement */
.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2563eb 0%, #7c3aed 50%, #db2777 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s var(--transition-smooth);
}

.feature-card:hover::before {
    transform: scaleX(1);
}

/* Icon container in feature cards */
.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
    margin-bottom: 20px;
    transition: all 0.4s var(--transition-smooth);
}

.feature-card:hover .feature-icon {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

.feature-icon .svg-icon {
    width: 28px;
    height: 28px;
    stroke: var(--primary-color, #2563eb);
    stroke-width: 1.5;
}

/* ===== 6. Partners — Infinite Marquee ===== */
.partners-section {
    overflow: hidden;
}

.partners-marquee-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 3%,
        black 97%,
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 3%,
        black 97%,
        transparent 100%
    );
}

.partners-marquee {
    display: flex;
    gap: 16px;
    width: max-content;
    animation: marqueeScroll 40s linear infinite;
}

.partners-marquee:hover {
    animation-play-state: paused;
}

@keyframes marqueeScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.partner-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: white;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color, #1e293b);
    white-space: nowrap;
    transition: all 0.3s var(--transition-smooth);
    cursor: default;
    user-select: none;
}

.partner-badge:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color, #2563eb);
}

.partner-badge img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    transition: transform 0.3s var(--transition-smooth);
}

.partner-badge:hover img {
    transform: scale(1.2);
}

/* ===== 7. Code Example — Language Tabs ===== */
.code-section {
    position: relative;
}

/* Terminal window chrome */
.code-section .code-window {
    background: #0d1117;
    border-radius: 12px;
    border: 1px solid #30363d;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Traffic light dots */
.code-section .code-window-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
}

.code-section .code-window-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.code-section .code-window-dot:nth-child(1) { background: #ff5f57; }
.code-section .code-window-dot:nth-child(2) { background: #ffbd2e; }
.code-section .code-window-dot:nth-child(3) { background: #28c840; }

/* Language tabs */
.code-tabs {
    display: flex;
    gap: 4px;
    margin-left: 20px;
    padding: 0;
    list-style: none;
}

.code-tab {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    color: #8b949e;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-tab:hover {
    color: #c9d1d9;
    background: rgba(255, 255, 255, 0.05);
}

.code-tab.active {
    color: #f0f6fc;
    background: rgba(255, 255, 255, 0.1);
}

/* Code block content */
.code-block {
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.code-block pre {
    margin: 0;
    padding: 24px;
    overflow-x: auto;
}

.code-block code {
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Copy button */
.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #8b949e;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    z-index: 2;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #c9d1d9;
    border-color: rgba(255, 255, 255, 0.3);
}

.copy-btn.copied {
    background: rgba(40, 200, 64, 0.15);
    color: #28c840;
    border-color: rgba(40, 200, 64, 0.3);
}

.copy-btn .svg-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* Code block tabs container */
.code-block-wrapper {
    position: relative;
}

/* Tab content panels */
.code-tab-content {
    display: none;
}

.code-tab-content.active {
    display: block;
}

/* ===== 8. Popular Models — Card Style ===== */
.popular-models-section .popular-models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.popular-models-section .model-card {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s var(--transition-smooth);
}

.popular-models-section .model-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
    border-color: rgba(37, 99, 235, 0.3);
}

.model-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.model-card-header img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.model-card-header .model-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color, #1e293b);
}

.model-card-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.model-card-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.model-card-stat-label {
    color: var(--text-muted, #64748b);
}

.model-card-stat-value {
    font-weight: 600;
    color: var(--text-color, #1e293b);
    font-family: 'JetBrains Mono', 'Consolas', monospace;
}

.model-card-stat-value.accent {
    color: var(--primary-color, #2563eb);
}

/* Usage bar */
.model-card-usage-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-color, #f1f5f9);
    border-radius: 3px;
    overflow: hidden;
}

.model-card-usage-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary-color, #2563eb), #7c3aed);
    transition: width 1s var(--transition-smooth);
}

.model-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, #f1f5f9);
    font-size: 0.85rem;
}

.model-card-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.model-card-price-label {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-card-price-value {
    font-weight: 600;
    color: var(--text-color, #1e293b);
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.9rem;
}

/* ===== 9. FAQ — Smooth Accordion ===== */
.faq-accordion .faq-item {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow 0.3s var(--transition-smooth);
}

.faq-accordion .faq-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.faq-accordion .faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 18px 22px;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color, #1e293b);
    text-align: left;
    transition: all 0.3s var(--transition-smooth);
    font-family: inherit;
}

.faq-accordion .faq-question:hover {
    background: var(--bg-color, #f8fafc);
}

.faq-accordion .faq-question-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-color, #f1f5f9);
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--text-muted, #64748b);
    transition: all 0.3s var(--transition-smooth);
    flex-shrink: 0;
}

.faq-accordion .faq-item.active .faq-question-icon {
    background: var(--primary-color, #2563eb);
    color: white;
    transform: rotate(45deg);
}

.faq-accordion .faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--transition-smooth);
}

.faq-accordion .faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-accordion .faq-answer-content {
    padding: 0 22px 18px;
    color: var(--text-muted, #64748b);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* ===== 10. Back to Top Button ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s var(--transition-smooth);
    cursor: pointer;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: white;
    border: 1px solid var(--border-color, #e2e8f0);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
}

.back-to-top-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
    border-color: var(--primary-color, #2563eb);
}

.back-to-top-button .svg-icon {
    width: 22px;
    height: 22px;
    stroke: var(--text-color, #1e293b);
    stroke-width: 2;
    transition: stroke 0.3s ease;
}

.back-to-top-button:hover .svg-icon {
    stroke: var(--primary-color, #2563eb);
}

/* Progress ring */
.back-to-top-progress {
    width: 48px;
    height: 48px;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.back-to-top-progress svg {
    transform: rotate(-90deg);
}

.back-to-top-progress circle {
    fill: none;
    stroke: var(--primary-color, #2563eb);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

/* ===== 11. News Section — Mini Cards ===== */
.news-homepage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.news-homepage-card {
    background: white;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s var(--transition-smooth);
}

.news-homepage-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
}

.news-card-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--transition-smooth);
}

.news-homepage-card:hover .news-card-image img {
    transform: scale(1.05);
}

.news-card-content {
    padding: 20px;
}

.news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.news-card-category {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
    color: var(--primary-color, #2563eb);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}

.news-card-date {
    font-size: 0.82rem;
    color: var(--text-muted, #94a3b8);
}

.news-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.4;
}

.news-card-title a {
    color: var(--text-color, #1e293b);
    text-decoration: none;
    transition: color 0.2s ease;
}

.news-card-title a:hover {
    color: var(--primary-color, #2563eb);
}

.news-card-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted, #64748b);
    line-height: 1.6;
    margin-bottom: 14px;
}

.news-card-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color, #2563eb);
    text-decoration: none;
    transition: gap 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.news-card-link:hover {
    gap: 8px;
    text-decoration: underline;
}

/* ===== 12. Responsive ===== */
@media (max-width: 768px) {
    .popular-models-section .popular-models-grid {
        grid-template-columns: 1fr;
    }

    .news-homepage-grid {
        grid-template-columns: 1fr;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
    }

    .back-to-top-button {
        width: 42px;
        height: 42px;
    }

    .back-to-top-progress {
        width: 42px;
        height: 42px;
    }

    .partners-marquee {
        animation-duration: 30s;
    }

    .code-tab {
        font-size: 0.72rem;
        padding: 4px 10px;
    }
}

@media (max-width: 480px) {
    .partners-marquee {
        animation-duration: 25s;
    }

    .code-tabs {
        margin-left: 12px;
    }

    .code-tab {
        font-size: 0.68rem;
        padding: 4px 8px;
    }

    .code-block pre {
        padding: 16px;
    }

    .model-card-stat {
        font-size: 0.8rem;
    }
}
