/*
Theme Name: NovaFlow
Theme URI: https://example.com/novaflow
Author: Moiseenko Maksim
Author URI: https://github.com/maksim-moiseenko
Description: Современная, быстрая и адаптивная тема для блога с бесконечной прокруткой, продвинутым управлением рекламой и SEO-оптимизацией.
Version: 1.4.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: novaflow
Tags: blog, infinite-scroll, ads-optimized, russian, modern, clean
*/

/* ==========================================================================
   CSS Variables & Reset
   ========================================================================== */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --text-color: #334155;
    --text-light: #64748b;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --container-width: 1200px;
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --text-color: #cbd5e1;
    --text-light: #94a3b8;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --border-color: #334155;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

body.dark-mode h1, 
body.dark-mode h2, 
body.dark-mode h3, 
body.dark-mode h4, 
body.dark-mode h5, 
body.dark-mode h6,
body.dark-mode .site-branding .site-title a {
    color: #f1f5f9;
}

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

body {
    font-family: var(--font-main);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

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

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 0.75em;
    font-weight: 700;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

p { margin-bottom: 1.5rem; }

/* ==========================================================================
   Layout Structure
   ========================================================================== */
.site-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.site-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 40px 0;
}

@media (min-width: 992px) {
    .site-content {
        grid-template-columns: 2fr 1fr;
    }
}

/* Scroll Progress Bar */
.scroll-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 1001;
}

.scroll-progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.1s ease;
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-hover);
    transform: translateY(-5px);
}

/* Breadcrumbs */
.breadcrumbs-container {
    padding-top: 20px;
}

.breadcrumbs {
    font-size: 0.85rem;
    color: var(--text-light);
}

.breadcrumbs a {
    color: var(--text-light);
}

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

.breadcrumbs .sep {
    margin: 0 8px;
    opacity: 0.5;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.site-header .site-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.site-branding .site-title {
    font-size: 1.5rem;
    margin: 0;
}

.site-branding .site-title a {
    color: #0f172a;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.theme-toggle:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: rotate(15deg);
}

.site-branding .site-description {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 5px;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 24px;
}

.main-navigation a {
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.main-navigation a:hover {
    color: var(--primary-color);
}

/* ==========================================================================
   Main Content Area (Grid)
   ========================================================================== */
.content-area {
    min-width: 0;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Article Cards */
.post {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.post:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.post-thumbnail {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.post:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-content-wrapper {
    padding: 40px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

@media (max-width: 768px) {
    .post-content-wrapper {
        padding: 25px;
    }
}

/* Featured Post Styling */
.featured-post {
    grid-column: 1 / -1;
    flex-direction: row;
}

@media (max-width: 768px) {
    .featured-post {
        flex-direction: column;
    }
}

.featured-post .post-thumbnail {
    flex: 1.2;
    aspect-ratio: 16 / 9;
}

.featured-post .post-content-wrapper {
    flex: 1;
    justify-content: center;
    padding: 50px;
}

@media (max-width: 768px) {
    .featured-post .post-content-wrapper {
        padding: 30px;
    }
}

.featured-post .entry-title {
    font-size: 2.2rem;
}

/* Metadata */
.entry-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.entry-meta i {
    color: var(--primary-color);
    opacity: 0.7;
}

.entry-title {
    margin-bottom: 20px;
    font-size: 1.6rem;
    line-height: 1.3;
}

.entry-title a {
    color: inherit;
}

.entry-summary {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.entry-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.entry-content p {
    margin-bottom: 1.8rem;
}

/* Lists Styling */
.entry-content ul,
.entry-content ol {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    padding-left: 0;
}

.entry-content ul {
    list-style: none !important;
}

.entry-content ul li {
    position: relative;
    padding-left: 1.8rem;
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.entry-content ul li::before {
    content: "\f058"; /* Font Awesome circle-check */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--primary-color);
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1rem;
}

.entry-content ol {
    counter-reset: custom-counter;
    list-style: none !important;
}

.entry-content ol li {
    counter-increment: custom-counter;
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 1rem;
}

.entry-content ol li::before {
    content: counter(custom-counter);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 0;
    top: 0.1rem;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* Blockquote Styling */
.entry-content blockquote {
    margin: 3rem 0;
    padding: 2.5rem 2rem 2.5rem 3.5rem;
    background-color: var(--surface-color);
    border-left: 5px solid var(--primary-color);
    border-radius: 0 16px 16px 0;
    position: relative;
    box-shadow: var(--card-shadow);
}

.entry-content blockquote::before {
    content: "\f10d"; /* Font Awesome quote-left */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 1.5rem;
    left: 1rem;
    font-size: 1.5rem;
    color: var(--primary-color);
    opacity: 0.2;
}

.entry-content blockquote p {
    font-size: 1.25rem;
    line-height: 1.7;
    font-style: italic;
    color: var(--text-color);
    margin-bottom: 0;
}

.entry-content blockquote cite {
    display: block;
    margin-top: 1.2rem;
    font-size: 1rem;
    font-style: normal;
    font-weight: 700;
    color: var(--text-light);
    text-align: right;
}

.entry-content blockquote cite::before {
    content: "— ";
}

/* Code Styling */
.entry-content code {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-family: "Fira Code", "JetBrains Mono", source-code-pro, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    font-weight: 500;
}

body.dark-mode .entry-content code {
    background-color: rgba(255, 255, 255, 0.1);
    color: #93c5fd;
}

.entry-content pre {
    background-color: #0f172a;
    color: #e2e8f0;
    padding: 2rem;
    border-radius: 16px;
    overflow-x: auto;
    margin: 2rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    position: relative;
}

.entry-content pre::before {
    content: "CODE";
    position: absolute;
    top: 0;
    right: 1.5rem;
    font-size: 0.7rem;
    background: var(--primary-color);
    color: #fff;
    padding: 2px 8px;
    border-radius: 0 0 6px 6px;
    font-weight: 800;
    letter-spacing: 1px;
}

.entry-content pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border: none;
    font-size: 0.95rem;
    display: block;
}

.entry-content h2, 
.entry-content h3 {
    margin-top: 2.5rem;
    margin-bottom: 1.2rem;
}

/* Ad Slots Styling */
.ad-slot {
    margin: 2.5rem 0;
    text-align: center;
    background-color: rgba(0,0,0,0.02);
    border: 1px dashed var(--border-color);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-light);
    position: relative;
}

body.dark-mode .ad-slot {
    background-color: rgba(255,255,255,0.02);
}

.ad-slot::before {
    content: "Реклама";
    position: absolute;
    top: -10px;
    left: 10px;
    background: var(--bg-color);
    padding: 0 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.ad-sidebar-sticky {
    position: sticky;
    top: 100px;
    z-index: 10;
}

/* Post Tags Styling */
.post-tags {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.tags-label {
    display: block;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1rem;
}

.tags-label i {
    color: var(--primary-color);
    margin-right: 5px;
}

.tags-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tags-links a {
    display: inline-block;
    padding: 6px 16px;
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.tags-links a:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

body.dark-mode .tags-links a {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .tags-links a:hover {
    background-color: var(--primary-color);
}

/* Social Subscription Box */
.social-subscription-box {
    margin: 3rem 0;
    padding: 2.5rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--card-shadow);
}

.social-subscription-box h4 {
    margin-bottom: 10px;
    font-size: 1.4rem;
}

.social-subscription-box p {
    color: var(--text-light);
    margin-bottom: 25px;
    font-size: 1rem;
}

.social-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.social-buttons a {
    padding: 12px 25px;
    border-radius: 12px;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.social-buttons .btn-tg {
    background-color: #0088cc;
}

.social-buttons .btn-vk {
    background-color: #4c75a3;
}

.social-buttons a:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

/* Infinite Scroll Loader */
.infinite-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    width: 100%;
    grid-column: 1 / -1;
    color: var(--text-light);
    font-weight: 600;
    gap: 15px;
}

.infinite-loader .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.read-more-link {
    margin-top: auto;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.read-more-link i {
    transition: transform 0.2s ease;
}

.read-more-link:hover i {
    transform: translateX(5px);
}

/* Share Buttons */
.share-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 30px 0;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.share-label {
    font-weight: 700;
    margin-right: 5px;
}

.share-buttons a, 
.share-buttons button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.share-tg { background-color: #0088cc; }
.share-vk { background-color: #4c75a3; }
.share-wa { background-color: #25d366; }
.share-copy { background-color: var(--text-light); }

.share-buttons a:hover, 
.share-buttons button:hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* Author Bio */
.author-bio {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    margin: 40px 0;
    display: flex;
    gap: 25px;
    align-items: center;
    box-shadow: var(--card-shadow);
}

.author-avatar img {
    border-radius: 50%;
}

.author-info h3 {
    margin-bottom: 10px;
    font-size: 1.25rem;
}

.author-info p {
    font-size: 0.95rem;
    margin-bottom: 15px;
    color: var(--text-light);
}

.author-link {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

@media (max-width: 600px) {
    .author-bio {
        flex-direction: column;
        text-align: center;
    }
}

/* Related Posts */
.related-posts {
    margin: 40px 0;
}

.related-title {
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.related-item h4 {
    font-size: 1.1rem;
    margin-top: 15px;
    line-height: 1.4;
}

.related-item h4 a {
    color: inherit;
}

.related-thumb {
    border-radius: 8px;
    overflow: hidden;
    display: block;
    aspect-ratio: 16 / 10;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.related-item:hover .related-thumb img {
    transform: scale(1.05);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination .page-numbers {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-weight: 600;
}

.pagination .page-numbers.current,
.pagination .page-numbers:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Table of Contents Styling */
.post-toc {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
}

.post-toc h4 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.post-toc ul {
    list-style: none;
    padding-left: 0;
}

.post-toc li {
    margin-bottom: 10px;
}

.post-toc .toc-level-3 {
    padding-left: 20px;
}

.post-toc a {
    color: var(--text-color);
    font-size: 0.95rem;
}

.post-toc a:hover {
    color: var(--primary-color);
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.widget-area .widget {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
}

.widget-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    color: #0f172a;
}

.widget ul {
    list-style: none;
}

.widget li {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.widget a {
    color: var(--text-color);
    font-weight: 500;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background-color: #0f172a;
    color: #f8fafc;
    padding: 60px 0;
    text-align: center;
    margin-top: 60px;
}

.site-footer a {
    color: #cbd5e1;
}

.site-footer a:hover {
    color: #fff;
}

/* Responsive Menu Simple (Mobile) */
@media (max-width: 768px) {
    .site-header .site-container {
        flex-direction: column;
        text-align: center;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
        margin-top: 20px;
    }
    
    .main-navigation ul {
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
    }
}
