/*
Theme Name: OneRuby
Description: A modern WordPress theme for Ruby programming and AI content with dark theme design
Version: 2.0
Author: Oleksandr Kholodniak
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #CC342D;
    --secondary-color: #8B2635;
    --accent-color: #FFD700;
    --bg-dark: #0D1117;
    --bg-darker: #010409;
    --text-light: #F0F6FC;
    --text-gray: #8B949E;
    --border-color: #21262D;
    --code-bg: #161B22;
    --gradient: linear-gradient(135deg, #CC342D 0%, #8B2635 100%);
    --ad-bg: #1C2128;
    --ad-border: #30363D;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navigation - улучшенная */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(15px);
    z-index: 1000;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

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

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* Site name styling (when no logo is uploaded) */
.logo .site-name {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.8rem;
    font-weight: 700;
}

/* Custom logo styling */
.logo .custom-logo {
    max-height: 50px;
    width: auto;
    transition: transform 0.3s ease;
    object-fit: contain;
}

.logo .custom-logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-links a:hover {
    color: var(--primary-color);
    background: rgba(204, 52, 45, 0.1);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section - компактнее */
.hero {
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, rgba(204, 52, 45, 0.3) 0%, transparent 50%),
               radial-gradient(circle at 70% 80%, rgba(139, 38, 53, 0.3) 0%, transparent 50%);
    position: relative;
    overflow: hidden;
    margin-top: 70px;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23ffffff" stroke-width="0.5" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.hero-content {
    text-align: center;
    max-width: 800px;
    padding: 0 2rem;
    z-index: 2;
    position: relative;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-gray);
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    background: var(--gradient);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 10px 30px rgba(204, 52, 45, 0.3);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(204, 52, 45, 0.4);
    color: white;
    text-decoration: none;
}

/* Main Layout с сайдбаром */
.main-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
}

.content-area {
    min-width: 0;
}

.sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

/* Container for pages without sidebar */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Рекламные блоки */
.ad-block, .ad-zone {
    background: var(--ad-bg);
    border: 1px solid var(--ad-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ad-block::before, .ad-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
}

.ad-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.ad-banner {
    width: 100%;
    height: 250px;
    background: linear-gradient(45deg, var(--code-bg), var(--ad-bg));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-gray);
    font-size: 0.9rem;
    border: 2px dashed var(--border-color);
}

.ad-square {
    width: 100%;
    height: 200px;
}

.ad-leaderboard {
    width: 100%;
    height: 90px;
    margin: 2rem auto;
}

.ad-mobile-banner {
    width: 100%;
    height: 50px;
    display: none;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Улучшенная сетка статей */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.article-card {
    background: var(--code-bg);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    height: fit-content;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    border-color: var(--primary-color);
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
}

.article-content {
    padding: 1.5rem;
}

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

.tag {
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background 0.3s ease;
    text-decoration: none;
}

.tag:hover {
    background: var(--secondary-color);
    color: white;
}

.article-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-light);
    line-height: 1.4;
}

.article-title a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

.article-title a:hover {
    color: var(--primary-color);
}

.article-excerpt {
    color: var(--text-gray);
    margin-bottom: 1rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.read-more:hover {
    color: var(--accent-color);
}

.article-date {
    color: var(--text-gray);
    font-size: 0.85rem;
}

/* Sidebar компоненты */
.widget {
    background: var(--code-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-light);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.popular-posts {
    list-style: none;
}

.popular-posts li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.popular-posts li:last-child {
    border-bottom: none;
}

.popular-posts a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.popular-posts a:hover {
    color: var(--primary-color);
}

.categories-widget {
    display: grid;
    gap: 0.5rem;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(204, 52, 45, 0.1);
    border-radius: 8px;
    transition: background 0.3s ease;
    cursor: pointer;
}

.category-item:hover {
    background: rgba(204, 52, 45, 0.2);
}

.category-name {
    font-weight: 600;
    color: var(--text-light);
}

.category-count {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Newsletter подписка */
.newsletter {
    background: var(--gradient);
    color: white;
    text-align: center;
}

.newsletter-form {
    margin-top: 1rem;
}

.newsletter-input {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.newsletter-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.newsletter-btn {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.newsletter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Search */
.search-container {
    position: relative;
    margin-bottom: 2rem;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-light);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
}

/* Breadcrumbs */
.breadcrumbs, .breadcrumb {
    padding: 1rem 0;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.breadcrumbs a, .breadcrumb a {
    color: var(--text-gray);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumbs a:hover, .breadcrumb a:hover {
    color: var(--primary-color);
}

/* Categories Section */
.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.category-card {
    background: var(--code-bg);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.category-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.category-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.category-count {
    color: var(--text-gray);
    font-size: 0.9rem;
}

/* Single Article Layout */
.article-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    margin-top: 70px;
}

.article-header {
    margin-bottom: 2rem;
}

.single-article-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-light);
    line-height: 1.2;
}

.article-subtitle {
    font-size: 1.2rem;
    color: var(--text-gray);
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.article-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

.single-article-content {
    background: var(--code-bg);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    line-height: 1.8;
}

.single-article-content h1,
.single-article-content h2,
.single-article-content h3,
.single-article-content h4,
.single-article-content h5,
.single-article-content h6 {
    color: var(--text-light);
    margin: 2rem 0 1rem 0;
    font-weight: 700;
}

.single-article-content h1 { font-size: 2.2rem; }
.single-article-content h2 { font-size: 1.8rem; }
.single-article-content h3 { font-size: 1.5rem; }
.single-article-content h4 { font-size: 1.3rem; }

.single-article-content p {
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

.single-article-content ul,
.single-article-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
    color: var(--text-light);
}

.single-article-content li {
    margin-bottom: 0.5rem;
}

.single-article-content blockquote {
    background: var(--bg-darker);
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
    font-style: italic;
    color: var(--text-gray);
}

.single-article-content code {
    background: var(--bg-darker);
    color: var(--accent-color);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.single-article-content pre {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}

.single-article-content pre code {
    background: none;
    padding: 0;
    color: var(--text-light);
}

/* Footer улучшенный */
.footer {
    background: var(--bg-darker);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 2rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

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

.footer-section h4 {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-weight: 700;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--text-gray);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: var(--code-bg);
    border-radius: 50%;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    color: white;
}

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

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 3rem 0;
}

.pagination a,
.pagination span {
    padding: 0.75rem 1rem;
    background: var(--code-bg);
    color: var(--text-light);
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination .current {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* Кнопка "Наверх" */
.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    transform: translateY(-3px);
}

/* Sticky ads */
.sticky-ad {
    position: sticky;
    top: 100px;
    z-index: 100;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .main-layout, .article-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .sidebar {
        position: static;
        order: 2;
    }

    .ad-leaderboard {
        height: 100px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(13, 17, 23, 0.98);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links.active {
        display: flex;
    }
    
    .hero {
        height: 70vh;
        margin-top: 60px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }

    .main-layout, .container, .article-container {
        padding: 1rem;
    }

    .ad-mobile-banner {
        display: block;
    }

    .ad-leaderboard {
        display: none;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .logo .custom-logo {
        max-height: 40px;
    }

    .single-article-title {
        font-size: 2rem;
    }

    .article-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Анимации и эффекты */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.6s ease-out;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Улучшения для загрузки */
.loading-skeleton {
    background: linear-gradient(90deg, var(--code-bg) 25%, var(--border-color) 50%, var(--code-bg) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* WordPress specific classes */
.wp-caption {
    max-width: 100%;
    margin: 1rem 0;
}

.wp-caption img {
    width: 100%;
    height: auto;
}

.wp-caption-text {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    text-align: center;
    font-style: italic;
}

.aligncenter {
    display: block;
    margin: 1rem auto;
}

.alignleft {
    float: left;
    margin: 0 1rem 1rem 0;
}

.alignright {
    float: right;
    margin: 0 0 1rem 1rem;
}

/* Comments */
.comments-section {
    background: var(--code-bg);
    padding: 2rem;
    border-radius: 15px;
    margin-top: 2rem;
}

.comments-section h2, .comments-section h3 {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.comment-form input, .comment-form textarea {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 0.75rem;
    border-radius: 5px;
    width: 100%;
    margin-bottom: 1rem;
}

.comment-form input:focus, .comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.comment-form input[type="submit"] {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.comment-form input[type="submit"]:hover {
    transform: translateY(-2px);
}

.comment-list {
    list-style: none;
    padding: 0;
}

.comment-list .comment {
    background: var(--bg-dark);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
}

.comment-author {
    font-weight: 600;
    color: var(--text-light);
}

.comment-date {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.comment-content {
    margin-top: 0.5rem;
    color: var(--text-light);
}