/**
 * Современный дизайн для постов блога
 * 2donow-custom theme
 */

/* ========================================
   ACCESSIBILITY STYLES
======================================== */

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--blog-primary-color, #2563eb);
    color: #ffffff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100000;
    border-radius: 0 0 4px 0;
    font-weight: 600;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* Screen reader only text */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.screen-reader-text:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 8px 16px;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: #f9fafb;
    color: #1f2937;
    border: 2px solid #2563eb;
    border-radius: 4px;
    z-index: 100000;
}

/* Focus visible styles for better keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.post-category:focus-visible,
.post-tag:focus-visible,
.card-read-more:focus-visible,
.nav-previous a:focus-visible,
.nav-next a:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Enhanced focus for card links */
.blog-card:focus-within {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3), var(--blog-shadow-lg);
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Focus for navigation cards */
.nav-previous:focus-within,
.nav-next:focus-within {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3), var(--blog-shadow-lg);
}

/* Ensure focus is visible on all interactive elements */
.blog-breadcrumbs a:focus-visible,
.card-category a:focus-visible,
.card-title a:focus-visible,
.author-box:focus-within {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

/* Remove default focus outline and use custom */
a:focus,
button:focus {
    outline: none;
}

/* But keep it for focus-visible (keyboard navigation) */
a:focus-visible,
button:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

/* Keyboard navigation mode - enhanced focus indicators */
.keyboard-navigation-mode *:focus {
    outline: 3px solid #2563eb !important;
    outline-offset: 2px !important;
}

/* Visual indicator for keyboard-focused cards */
.blog-card.keyboard-focused {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3), var(--blog-shadow-lg);
    transform: translateY(-4px);
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* ========================================
   ОБЩИЕ СТИЛИ
======================================== */

:root {
    /* Colors */
    --blog-primary-color: #2563eb;
    --blog-text-color: #1f2937;
    --blog-text-light: #6b7280;
    --blog-border-color: #e5e7eb;
    --blog-bg-light: #f9fafb;
    --blog-white: #ffffff;
    
    /* Shadows */
    --blog-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --blog-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --blog-radius: 12px;
    
    /* Transitions */
    --blog-transition: all 0.3s ease;
    
    /* Typography Scale - Desktop */
    --blog-font-h1: 48px;
    --blog-font-h2: 32px;
    --blog-font-h3: 24px;
    --blog-font-h4: 20px;
    --blog-font-h5: 18px;
    --blog-font-h6: 16px;
    --blog-font-body: 18px;
    --blog-line-height: 1.8;
    
    /* Content Width */
    --blog-max-width: 800px;
    
    /* Spacing Variables */
    --blog-spacing-xs: 0.5rem;   /* 8px */
    --blog-spacing-sm: 0.75rem;  /* 12px */
    --blog-spacing-md: 1rem;     /* 16px */
    --blog-spacing-lg: 1.5rem;   /* 24px */
    --blog-spacing-xl: 2rem;     /* 32px */
    --blog-spacing-2xl: 2.5rem;  /* 40px */
    --blog-spacing-3xl: 3.75rem; /* 60px */
    
    /* Paragraph and Element Spacing */
    --blog-paragraph-margin: 1.5rem;
    --blog-heading-margin-top: 2.5rem;
    --blog-heading-margin-bottom: 1.25rem;
    --blog-element-margin: 1.875rem; /* 30px */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   ХЛЕБНЫЕ КРОШКИ (BREADCRUMBS)
======================================== */

.blog-breadcrumbs {
    padding: 16px 0;
    background: var(--blog-bg-light);
    font-size: 14px;
    border-bottom: 1px solid var(--blog-border-color);
}

.blog-breadcrumbs .breadcrumb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    line-height: 1.6;
}

.blog-breadcrumbs .breadcrumb-list li {
    display: inline-flex;
    align-items: center;
}

/* Breadcrumb links styling */
.blog-breadcrumbs a {
    color: var(--blog-text-light);
    text-decoration: none;
    transition: all 0.25s ease;
    padding: 6px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
}

/* Hover effect on breadcrumb links */
.blog-breadcrumbs a:hover {
    color: var(--blog-primary-color);
    background: rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

/* Active/focus state for keyboard navigation */
.blog-breadcrumbs a:active {
    transform: translateY(0);
}

/* Separator styling between breadcrumb items */
.blog-breadcrumbs .separator {
    margin: 0 4px;
    color: var(--blog-text-light);
    opacity: 0.5;
    font-weight: 400;
    user-select: none;
}

/* Current page (last breadcrumb item) */
.blog-breadcrumbs .breadcrumb-list li[aria-current="page"] {
    color: var(--blog-text-color);
    font-weight: 600;
}

.blog-breadcrumbs .breadcrumb-list li[aria-current="page"] span {
    color: var(--blog-text-color);
    padding: 6px 8px;
}

/* Ensure breadcrumbs wrap properly on small screens */
.blog-breadcrumbs .breadcrumb-list {
    word-break: break-word;
}

/* Responsive breadcrumb adjustments */
@media (max-width: 768px) {
    .blog-breadcrumbs {
        padding: 12px 0;
        font-size: 13px;
    }
    
    .blog-breadcrumbs a {
        padding: 4px 6px;
    }
    
    .blog-breadcrumbs .separator {
        margin: 0 2px;
    }
    
    .blog-breadcrumbs .breadcrumb-list li[aria-current="page"] span {
        padding: 4px 6px;
    }
}

/* ========================================
   ЗАГОЛОВОК ПОСТА
======================================== */

.blog-post-header {
    padding: 60px 0 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--blog-white);
}

.post-meta-top {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.post-date,
.post-reading-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    opacity: 0.95;
    font-weight: 500;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    transition: var(--blog-transition);
}

.post-date:hover,
.post-reading-time:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Add icons using pseudo-elements */
.post-date::before {
    content: "📅";
    font-size: 14px;
    display: inline-block;
}

.post-reading-time::before {
    content: "⏱️";
    font-size: 14px;
    display: inline-block;
}

.post-categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.post-category {
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--blog-white);
    text-decoration: none;
    transition: var(--blog-transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
    letter-spacing: 0.3px;
}

.post-category:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.post-title {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 20px;
}

.post-excerpt {
    font-size: 20px;
    line-height: 1.6;
    opacity: 0.95;
    max-width: 800px;
}

/* ========================================
   ИЗОБРАЖЕНИЕ ПОСТА
======================================== */

.blog-post-featured-image {
    margin: -60px 0 60px;
    position: relative;
}

.blog-post-featured-image .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.featured-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--blog-radius);
    box-shadow: var(--blog-shadow-lg);
    background: var(--blog-bg-light);
}

/* Скрыть пустой блок, если нет изображения */
.featured-image-wrapper:empty,
.featured-image-wrapper:not(:has(img)) {
    display: none;
}

/* Скрыть весь блок figure, если внутри нет изображения */
.blog-post-featured-image:not(:has(img)) {
    display: none;
}

.blog-post-featured-image .featured-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: var(--blog-radius);
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .featured-image-wrapper {
        position: relative;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
        height: 0;
    }
    
    .featured-image-wrapper .featured-img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* ========================================
   СОДЕРЖИМОЕ ПОСТА
======================================== */

.blog-post-content {
    padding: 40px 0;
}

.content-wrapper {
    max-width: var(--blog-max-width);
    margin: 0 auto;
    font-size: var(--blog-font-body);
    line-height: var(--blog-line-height);
    color: var(--blog-text-color);
}

.content-wrapper h1 {
    font-size: var(--blog-font-h1);
    font-weight: 700;
    margin: var(--blog-heading-margin-top) 0 var(--blog-heading-margin-bottom);
    color: var(--blog-text-color);
    line-height: 1.2;
}

.content-wrapper h2 {
    font-size: var(--blog-font-h2);
    font-weight: 700;
    margin: var(--blog-heading-margin-top) 0 var(--blog-heading-margin-bottom);
    color: var(--blog-text-color);
    line-height: 1.3;
}

.content-wrapper h3 {
    font-size: var(--blog-font-h3);
    font-weight: 600;
    margin: var(--blog-heading-margin-top) 0 var(--blog-heading-margin-bottom);
    color: var(--blog-text-color);
    line-height: 1.4;
}

.content-wrapper h4 {
    font-size: var(--blog-font-h4);
    font-weight: 600;
    margin: var(--blog-heading-margin-top) 0 var(--blog-heading-margin-bottom);
    color: var(--blog-text-color);
    line-height: 1.4;
}

.content-wrapper h5 {
    font-size: var(--blog-font-h5);
    font-weight: 600;
    margin: var(--blog-heading-margin-top) 0 var(--blog-heading-margin-bottom);
    color: var(--blog-text-color);
    line-height: 1.5;
}

.content-wrapper h6 {
    font-size: var(--blog-font-h6);
    font-weight: 600;
    margin: var(--blog-heading-margin-top) 0 var(--blog-heading-margin-bottom);
    color: var(--blog-text-color);
    line-height: 1.5;
}

.content-wrapper p {
    margin-bottom: var(--blog-paragraph-margin);
}

.content-wrapper a {
    color: var(--blog-primary-color);
    text-decoration: underline;
    transition: var(--blog-transition);
}

.content-wrapper a:hover {
    color: #1d4ed8;
}

/* Content Images - Enhanced styling for rich content */
.content-wrapper img {
    max-width: 100%;
    height: auto;
    border-radius: var(--blog-radius); /* 12px border-radius */
    margin: var(--blog-element-margin) 0; /* 30px vertical margin */
    box-shadow: var(--blog-shadow); /* Subtle shadow for visual separation */
    display: block;
}

/* Ensure images don't break layout on small screens */
.content-wrapper img {
    width: auto;
    max-width: 100%;
}

/* WordPress alignment classes support */
.content-wrapper .alignleft {
    float: left;
    margin: var(--blog-element-margin) var(--blog-element-margin) var(--blog-element-margin) 0;
}

.content-wrapper .alignright {
    float: right;
    margin: var(--blog-element-margin) 0 var(--blog-element-margin) var(--blog-element-margin);
}

.content-wrapper .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* WordPress figure element (images with captions) */
.content-wrapper figure {
    margin: var(--blog-element-margin) 0;
    max-width: 100%;
}

.content-wrapper figure img {
    margin: 0;
    display: block;
}

.content-wrapper figcaption {
    margin-top: var(--blog-spacing-sm);
    font-size: 0.9em;
    color: var(--blog-text-light);
    font-style: italic;
    text-align: center;
    line-height: 1.5;
}

/* Ensure images in links don't have extra spacing */
.content-wrapper a img {
    margin: 0;
}

/* Image hover effect for linked images */
.content-wrapper a:hover img {
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

/* ========================================
   VIDEO EMBEDS - Responsive 16:9 Aspect Ratio
======================================== */

/* Responsive video container using padding-bottom technique */
.content-wrapper .video-container,
.content-wrapper .wp-block-embed,
.content-wrapper .wp-block-embed__wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio (9/16 = 0.5625) */
    height: 0;
    overflow: hidden;
    margin: var(--blog-element-margin) 0;
    border-radius: var(--blog-radius);
    box-shadow: var(--blog-shadow);
    background: #000;
}

/* Video and iframe elements inside container */
.content-wrapper .video-container iframe,
.content-wrapper .video-container video,
.content-wrapper .video-container embed,
.content-wrapper .video-container object,
.content-wrapper .wp-block-embed iframe,
.content-wrapper .wp-block-embed video,
.content-wrapper .wp-block-embed embed,
.content-wrapper .wp-block-embed object {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--blog-radius);
}

/* Direct iframe/video elements (not in container) */
.content-wrapper > iframe,
.content-wrapper > video {
    max-width: 100%;
    height: auto;
    margin: var(--blog-element-margin) 0;
    border-radius: var(--blog-radius);
    box-shadow: var(--blog-shadow);
    display: block;
}

/* Specific styling for YouTube/Vimeo embeds */
.content-wrapper iframe[src*="youtube.com"],
.content-wrapper iframe[src*="youtu.be"],
.content-wrapper iframe[src*="vimeo.com"] {
    aspect-ratio: 16 / 9;
    width: 100%;
    height: auto;
    border-radius: var(--blog-radius);
    box-shadow: var(--blog-shadow);
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .content-wrapper iframe[src*="youtube.com"],
    .content-wrapper iframe[src*="youtu.be"],
    .content-wrapper iframe[src*="vimeo.com"] {
        height: auto;
        min-height: 400px;
    }
}

/* WordPress video block */
.content-wrapper .wp-block-video {
    margin: var(--blog-element-margin) 0;
}

.content-wrapper .wp-block-video video {
    max-width: 100%;
    height: auto;
    border-radius: var(--blog-radius);
    box-shadow: var(--blog-shadow);
}

/* WordPress embed block variations */
.content-wrapper .wp-block-embed.is-type-video {
    margin: var(--blog-element-margin) 0;
}

/* Ensure embeds scale responsively on mobile */
@media (max-width: 768px) {
    .content-wrapper .video-container,
    .content-wrapper .wp-block-embed,
    .content-wrapper .wp-block-embed__wrapper {
        margin: var(--blog-spacing-lg) 0;
    }
    
    @supports not (aspect-ratio: 16 / 9) {
        .content-wrapper iframe[src*="youtube.com"],
        .content-wrapper iframe[src*="youtu.be"],
        .content-wrapper iframe[src*="vimeo.com"] {
            min-height: 250px;
        }
    }
}

/* Lists - Ordered and Unordered */
.content-wrapper ul,
.content-wrapper ol {
    margin: var(--blog-paragraph-margin) 0;
    padding-left: 30px;
    line-height: var(--blog-line-height);
}

.content-wrapper li {
    margin-bottom: var(--blog-spacing-sm);
    padding-left: var(--blog-spacing-xs);
}

.content-wrapper li:last-child {
    margin-bottom: 0;
}

.content-wrapper ul li {
    list-style-type: disc;
}

.content-wrapper ol li {
    list-style-type: decimal;
}

.content-wrapper ul ul,
.content-wrapper ol ul {
    margin-top: var(--blog-spacing-sm);
    margin-bottom: var(--blog-spacing-sm);
}

.content-wrapper ul ol,
.content-wrapper ol ol {
    margin-top: var(--blog-spacing-sm);
    margin-bottom: var(--blog-spacing-sm);
}

/* Blockquotes */
.content-wrapper blockquote {
    margin: var(--blog-element-margin) 0;
    padding: var(--blog-spacing-lg) var(--blog-spacing-xl);
    background: var(--blog-bg-light);
    border-left: 4px solid var(--blog-primary-color);
    font-style: italic;
    border-radius: 0 var(--blog-radius) var(--blog-radius) 0;
    color: var(--blog-text-color);
    font-size: 1.05em;
    line-height: 1.7;
}

.content-wrapper blockquote p {
    margin-bottom: var(--blog-spacing-md);
}

.content-wrapper blockquote p:last-child {
    margin-bottom: 0;
}

.content-wrapper blockquote cite {
    display: block;
    margin-top: var(--blog-spacing-md);
    font-size: 0.9em;
    color: var(--blog-text-light);
    font-style: normal;
}

/* Inline Code */
.content-wrapper code {
    padding: 3px 8px;
    background: var(--blog-bg-light);
    border-radius: 4px;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 0.9em;
    color: #e11d48;
    border: 1px solid var(--blog-border-color);
}

/* Code Blocks */
.content-wrapper pre {
    padding: var(--blog-spacing-lg);
    background: #1f2937;
    color: #f9fafb;
    border-radius: var(--blog-radius);
    overflow-x: auto;
    margin: var(--blog-element-margin) 0;
    line-height: 1.6;
    box-shadow: var(--blog-shadow);
}

.content-wrapper pre code {
    background: none;
    padding: 0;
    color: inherit;
    border: none;
    font-size: 0.95em;
    display: block;
}

/* ========================================
   ТЕГИ
======================================== */

.blog-post-footer {
    padding: 50px 0;
    border-top: 2px solid var(--blog-border-color);
    background: var(--blog-white);
}

.post-tags {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    max-width: 800px;
    margin: 0 auto;
}

.tags-label {
    font-weight: 700;
    font-size: 16px;
    color: var(--blog-text-color);
    margin-right: 4px;
    flex-shrink: 0;
}

.post-tag {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--blog-bg-light);
    border: 1px solid var(--blog-border-color);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--blog-text-light);
    text-decoration: none;
    transition: all 0.25s ease;
    letter-spacing: 0.2px;
}

.post-tag:hover {
    background: var(--blog-primary-color);
    color: var(--blog-white);
    border-color: var(--blog-primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.post-tag:active {
    transform: translateY(0);
}

/* ========================================
   АВТОР ПОСТА
======================================== */

.blog-post-author {
    padding: 30px 0;
    background: var(--blog-bg-light);
}

.author-box {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 20px;
    background: var(--blog-white);
    border-radius: var(--blog-radius);
    box-shadow: var(--blog-shadow);
    transition: var(--blog-transition);
}

.author-box:hover {
    box-shadow: var(--blog-shadow-lg);
}

.author-avatar {
    flex-shrink: 0;
}

.author-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--blog-primary-color);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
    object-fit: cover;
    display: block;
}

.author-info {
    flex: 1;
    min-width: 0; /* Allows text to wrap properly */
}

.author-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--blog-text-color);
    line-height: 1.3;
}

.author-bio {
    font-size: 14px;
    line-height: 1.5;
    color: var(--blog-text-light);
    margin: 0;
}

/* ========================================
   НАВИГАЦИЯ МЕЖДУ ПОСТАМИ
======================================== */

.blog-post-navigation {
    padding: 60px 0;
    background: var(--blog-bg-light);
    border-top: 2px solid var(--blog-border-color);
    border-bottom: 2px solid var(--blog-border-color);
}

.nav-links {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

/* Handle single navigation item (only prev or only next) */
.nav-links:has(.nav-previous):not(:has(.nav-next)) {
    grid-template-columns: 1fr;
}

.nav-links:has(.nav-next):not(:has(.nav-previous)) {
    grid-template-columns: 1fr;
}

.nav-previous,
.nav-next {
    padding: 28px 32px;
    background: var(--blog-white);
    border: 2px solid var(--blog-border-color);
    border-radius: var(--blog-radius);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

/* Hover effects - lift and shadow enhancement */
.nav-previous:hover,
.nav-next:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
    border-color: var(--blog-primary-color);
}

/* Subtle background effect on hover */
.nav-previous::before,
.nav-next::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nav-previous:hover::before,
.nav-next:hover::before {
    opacity: 1;
}

.nav-previous a,
.nav-next a {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.nav-subtitle {
    font-size: 14px;
    color: var(--blog-primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: gap 0.3s ease;
}

/* Arrow animation on hover */
.nav-previous:hover .nav-subtitle {
    gap: 12px;
}

.nav-next:hover .nav-subtitle {
    gap: 12px;
}

.nav-title {
    font-size: 18px;
    color: var(--blog-text-color);
    font-weight: 700;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.nav-previous:hover .nav-title,
.nav-next:hover .nav-title {
    color: var(--blog-primary-color);
}

/* Align next post to the right */
.nav-next {
    text-align: right;
}

.nav-next a {
    align-items: flex-end;
}

/* Active state */
.nav-previous:active,
.nav-next:active {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* ========================================
   КОММЕНТАРИИ
======================================== */

.blog-post-comments {
    padding: 60px 0;
    background: var(--blog-bg-light);
}

.blog-post-comments .container > * {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Comment Form Styles */
.comment-respond {
    margin-top: 40px;
}

.comment-reply-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--blog-text-color);
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-form-comment,
.comment-form-author,
.comment-form-email,
.comment-form-url {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-form label {
    font-weight: 600;
    font-size: 16px;
    color: var(--blog-text-color);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--blog-border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: var(--blog-white);
    color: var(--blog-text-color);
    transition: var(--blog-transition);
    box-sizing: border-box;
}

.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus,
.comment-form input[type="url"]:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--blog-primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.comment-form textarea {
    min-height: 150px;
    resize: vertical;
}

.comment-form-cookies-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.comment-form-cookies-consent input[type="checkbox"] {
    margin-top: 4px;
    width: auto;
}

.comment-form-cookies-consent label {
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
}

.form-submit {
    margin-top: 10px;
}

.comment-form input[type="submit"],
.comment-form button[type="submit"] {
    padding: 14px 32px;
    background: var(--blog-primary-color);
    color: var(--blog-white);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--blog-transition);
    display: inline-block;
}

.comment-form input[type="submit"]:hover,
.comment-form button[type="submit"]:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

.comment-form input[type="submit"]:active,
.comment-form button[type="submit"]:active {
    transform: translateY(0);
}

/* Required field indicator */
.required {
    color: #dc2626;
    margin-left: 2px;
}

/* ========================================
   АРХИВ БЛОГА
======================================== */

.blog-archive-header {
    padding: 80px 0 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--blog-white);
    text-align: center;
}

.archive-title {
    font-size: 48px;
    font-weight: 700;
    margin: 0 0 20px;
}

.archive-description {
    font-size: 18px;
    line-height: 1.6;
    opacity: 0.95;
    max-width: 700px;
    margin: 0 auto;
}

.blog-archive-content {
    padding: 80px 0;
}

/* ========================================
   СЕТКА ПОСТОВ
======================================== */

.blog-posts-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile first: 1 column */
    gap: 30px; /* Mobile gap: 30px */
    margin-bottom: 60px;
}

/* Tablet: 2 columns (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .blog-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }
}

/* Desktop: 3 columns (>1024px) */
@media (min-width: 1024px) {
    .blog-posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 40px;
    }
}

.blog-card {
    background: var(--blog-white);
    border-radius: var(--blog-radius);
    overflow: hidden;
    box-shadow: var(--blog-shadow);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    will-change: transform, box-shadow;
}

/* Card lift effect on hover */
.blog-card:hover {
    box-shadow: var(--blog-shadow-lg);
    transform: translateY(-4px);
}

/* Ensure hover effects work on touch devices */
@media (hover: hover) and (pointer: fine) {
    .blog-card:hover {
        box-shadow: var(--blog-shadow-lg);
        transform: translateY(-4px);
    }
}

/* Touch device support - use active state */
@media (hover: none) {
    .blog-card:active {
        box-shadow: var(--blog-shadow-lg);
        transform: translateY(-2px);
    }
}

.blog-card-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--blog-bg-light);
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .blog-card-image {
        position: relative;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
        height: 0;
    }
    
    .blog-card-image .card-img {
        position: absolute;
        top: 0;
        left: 0;
    }
}

.blog-card-image .card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    will-change: transform;
}

/* Image zoom effect on hover */
.blog-card:hover .card-img {
    transform: scale(1.05);
}

/* Touch device support for image zoom */
@media (hover: hover) and (pointer: fine) {
    .blog-card:hover .card-img {
        transform: scale(1.05);
    }
}

@media (hover: none) {
    .blog-card:active .card-img {
        transform: scale(1.03);
    }
}

.card-category {
    position: absolute;
    top: 16px;
    left: 16px;
}

.card-category a {
    padding: 6px 14px;
    background: var(--blog-white);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--blog-primary-color);
    text-decoration: none;
    box-shadow: var(--blog-shadow);
}

.blog-card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--blog-text-light);
}

.card-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 12px;
    line-height: 1.3;
}

.card-title a {
    color: var(--blog-text-color);
    text-decoration: none;
    transition: var(--blog-transition);
}

.card-title a:hover {
    color: var(--blog-primary-color);
}

.card-excerpt {
    font-size: 16px;
    line-height: 1.6;
    color: var(--blog-text-light);
    margin-bottom: 20px;
    flex: 1;
}

.card-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--blog-primary-color);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.card-read-more:hover {
    gap: 10px;
    color: #1d4ed8;
}

.card-read-more svg {
    transition: transform 0.3s ease;
}

.card-read-more:hover svg {
    transform: translateX(2px);
}

/* ========================================
   ПАГИНАЦИЯ
======================================== */

.blog-pagination {
    display: flex;
    justify-content: center;
}

.blog-pagination .nav-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.blog-pagination a,
.blog-pagination span {
    padding: 10px 16px;
    background: var(--blog-white);
    border: 1px solid var(--blog-border-color);
    border-radius: 8px;
    color: var(--blog-text-color);
    text-decoration: none;
    transition: var(--blog-transition);
    font-weight: 500;
}

.blog-pagination a:hover {
    background: var(--blog-primary-color);
    color: var(--blog-white);
    border-color: var(--blog-primary-color);
}

.blog-pagination .current {
    background: var(--blog-primary-color);
    color: var(--blog-white);
    border-color: var(--blog-primary-color);
}

/* ========================================
   НЕТ ПОСТОВ
======================================== */

.no-posts {
    text-align: center;
    padding: 80px 20px;
}

.no-posts h2 {
    font-size: 32px;
    margin-bottom: 16px;
    color: var(--blog-text-color);
}

.no-posts p {
    font-size: 18px;
    color: var(--blog-text-light);
    margin-bottom: 30px;
}

.btn-primary {
    display: inline-block;
    padding: 14px 32px;
    background: var(--blog-primary-color);
    color: var(--blog-white);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--blog-transition);
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: var(--blog-shadow-lg);
}

/* ========================================
   АДАПТИВНОСТЬ
======================================== */

@media (max-width: 768px) {
    :root {
        /* Typography Scale - Mobile */
        --blog-font-h1: 32px;
        --blog-font-h2: 24px;
        --blog-font-h3: 20px;
        --blog-font-h4: 18px;
        --blog-font-h5: 16px;
        --blog-font-h6: 15px;
        --blog-font-body: 16px;
        
        /* Spacing adjustments for mobile */
        --blog-spacing-xl: 1rem;     /* Reduced from 2rem (32px) to 1rem (16px) */
        --blog-spacing-2xl: 1.5rem;  /* Reduced from 2.5rem (40px) to 1.5rem (24px) */
        --blog-spacing-3xl: 2.5rem;  /* Reduced from 3.75rem (60px) to 2.5rem (40px) */
    }
    
    /* Container padding adjustment for mobile */
    .container {
        padding: 0 16px;
    }
    
    /* Post Title - Reduce from 48px to 32px */
    .post-title {
        font-size: 32px;
        line-height: 1.2;
        margin-bottom: 16px;
    }
    
    /* Post Excerpt */
    .post-excerpt {
        font-size: 16px;
        line-height: 1.5;
    }
    
    /* Header Padding - Reduce from 60px to 40px */
    .blog-post-header {
        padding: 40px 0 30px;
    }
    
    /* Post Metadata */
    .post-meta-top {
        gap: 12px;
        font-size: 13px;
    }
    
    .post-date,
    .post-reading-time {
        font-size: 13px;
        padding: 5px 10px;
    }
    
    .post-category {
        font-size: 12px;
        padding: 5px 12px;
    }
    
    /* Featured Image Margin - Adjust from -60px to -40px */
    .blog-post-featured-image {
        margin: -40px 0 40px;
    }
    
    .blog-post-featured-image .container {
        padding: 0 16px;
    }
    
    /* Content Wrapper - Body text from 18px to 16px */
    .content-wrapper {
        font-size: 16px;
        padding: 0 16px;
    }
    
    /* Content padding adjustments */
    .blog-post-content {
        padding: 32px 0;
    }
    
    /* Author Box - Keep horizontal layout but more compact */
    .author-box {
        padding: 16px;
        gap: 12px;
    }
    
    .author-avatar img {
        width: 44px;
        height: 44px;
        border-width: 2px;
    }
    
    .author-name {
        font-size: 15px;
        margin: 0 0 2px;
    }
    
    .author-bio {
        font-size: 13px;
        line-height: 1.4;
    }
    
    /* Archive Header */
    .archive-title {
        font-size: 32px;
    }
    
    .blog-archive-header {
        padding: 60px 0 40px;
    }
    
    .blog-archive-content {
        padding: 60px 0;
    }
    
    /* Blog Posts Grid */
    .blog-posts-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    /* Navigation Links - Stack to 1 column on mobile */
    .nav-links {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .blog-post-navigation {
        padding: 40px 0;
    }
    
    /* Reset text alignment for mobile */
    .nav-next {
        text-align: left;
    }
    
    .nav-next a {
        align-items: flex-start;
    }
    
    /* Adjust padding for mobile cards */
    .nav-previous,
    .nav-next {
        padding: 20px 20px;
    }
    
    /* Adjust subtitle font size */
    .nav-subtitle {
        font-size: 13px;
    }
    
    /* Adjust title font size */
    .nav-title {
        font-size: 16px;
    }
    
    /* Post Tags */
    .post-tags {
        gap: 10px;
        padding: 0 16px;
    }
    
    .tags-label {
        font-size: 15px;
        width: 100%;
        margin-bottom: 4px;
    }
    
    .post-tag {
        font-size: 13px;
        padding: 6px 14px;
    }
    
    /* Footer and Author sections padding */
    .blog-post-footer {
        padding: 40px 0;
    }
    
    .blog-post-author {
        padding: 24px 0;
    }
    
    /* Comments section */
    .blog-post-comments {
        padding: 40px 0;
    }
    
    /* Blockquotes mobile spacing */
    .content-wrapper blockquote {
        padding: var(--blog-spacing-md) var(--blog-spacing-lg);
        margin: var(--blog-spacing-lg) 0;
    }
    
    /* Code blocks mobile spacing */
    .content-wrapper pre {
        padding: var(--blog-spacing-md);
        margin: var(--blog-spacing-lg) 0;
        font-size: 14px;
    }
    
    /* ========================================
       TOUCH-FRIENDLY INTERACTIVE ELEMENTS
    ======================================== */
    
    /* Ensure minimum 44x44px touch targets for all interactive elements */
    
    /* Links in content */
    .content-wrapper a {
        padding: 4px 2px;
        margin: -4px -2px;
        display: inline-block;
        min-height: 44px;
        line-height: 1.8;
    }
    
    /* Post category pills */
    .post-category {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 10px 16px;
    }
    
    /* Post tags */
    .post-tag {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 10px 16px;
    }
    
    /* Navigation buttons */
    .nav-previous a,
    .nav-next a {
        min-height: 44px;
        padding: 16px 20px;
    }
    
    /* Card read more links */
    .card-read-more {
        min-height: 44px;
        padding: 12px 16px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Card title links */
    .card-title a {
        padding: 8px 0;
        display: inline-block;
        min-height: 44px;
        line-height: 1.4;
    }
    
    /* Pagination links */
    .blog-pagination a,
    .blog-pagination span {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Buttons */
    .btn-primary {
        min-height: 44px;
        padding: 14px 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Breadcrumb links */
    .blog-breadcrumbs a {
        padding: 8px 4px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Category badge on cards */
    .card-category a {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Skip link */
    .skip-link {
        min-height: 44px;
        padding: 12px 20px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Increase clickable area for navigation arrows */
    .nav-previous,
    .nav-next {
        padding: 20px;
    }
    
    /* Post metadata items */
    .post-date,
    .post-reading-time {
        min-height: 44px;
        padding: 10px 14px;
        display: inline-flex;
        align-items: center;
    }
    
    /* ========================================
       MOBILE SPACING OPTIMIZATIONS
    ======================================== */
    
    /* Optimize vertical spacing between sections */
    .blog-post-content,
    .blog-post-footer,
    .blog-post-author,
    .blog-post-navigation,
    .blog-post-comments {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    /* Reduce vertical spacing between major sections */
    .blog-post-content + .blog-post-footer {
        margin-top: -20px;
    }
    
    .blog-post-footer + .blog-post-author {
        margin-top: -20px;
    }
    
    .blog-post-author + .blog-post-navigation {
        margin-top: -20px;
    }
    
    /* Content wrapper padding for narrow screens */
    .content-wrapper {
        padding-left: 0;
        padding-right: 0;
    }
    
    /* Optimize paragraph spacing for mobile */
    .content-wrapper p {
        margin-bottom: 1.25rem;
    }
    
    /* Optimize heading spacing for mobile */
    .content-wrapper h1,
    .content-wrapper h2,
    .content-wrapper h3,
    .content-wrapper h4,
    .content-wrapper h5,
    .content-wrapper h6 {
        margin-top: 2rem;
        margin-bottom: 1rem;
    }
    
    /* First heading should not have top margin */
    .content-wrapper > h1:first-child,
    .content-wrapper > h2:first-child,
    .content-wrapper > h3:first-child,
    .content-wrapper > h4:first-child,
    .content-wrapper > h5:first-child,
    .content-wrapper > h6:first-child {
        margin-top: 0;
    }
    
    /* Optimize list spacing */
    .content-wrapper ul,
    .content-wrapper ol {
        margin: 1.25rem 0;
        padding-left: 24px;
    }
    
    .content-wrapper li {
        margin-bottom: 0.5rem;
    }
    
    /* Optimize image spacing */
    .content-wrapper img {
        margin: 1.5rem 0;
    }
    
    /* Ensure proper margin collapse behavior */
    .content-wrapper > *:first-child {
        margin-top: 0;
    }
    
    .content-wrapper > *:last-child {
        margin-bottom: 0;
    }
    
    /* Card content padding */
    .blog-card-content {
        padding: 20px 16px;
    }
    
    /* Navigation card padding */
    .nav-previous,
    .nav-next {
        padding: 16px;
    }
    
    /* Archive content spacing */
    .blog-archive-content {
        padding: 40px 0;
    }
    
    /* No posts section */
    .no-posts {
        padding: 60px 16px;
    }
}

@media (max-width: 480px) {
    .post-title {
        font-size: 24px;
    }
    
    .blog-post-header {
        padding: 40px 0 30px;
    }
    
    .blog-post-featured-image .container {
        padding: 0 12px;
    }
    
    .card-title {
        font-size: 18px;
    }
}
