/**
 * OUTSTANDING BLOG ENHANCEMENTS
 * Premium minimal design with exceptional readability
 * Version: 2.1 - Fixed Conflicts
 *
 * This file ENHANCES the base theme, it does NOT replace it.
 * All CSS conflicts have been resolved to work with style.css
 */

/* ========================================
   ARTICLE HERO - Fixed to match theme
   ======================================== */

.article-page {
    font-feature-settings: 'kern' 1, 'liga' 1;
    -webkit-font-feature-settings: 'kern' 1, 'liga' 1;
}

/* Article Hero Enhancement - Matches existing theme */
.article-hero {
    background: linear-gradient(135deg, var(--bg-gray) 0%, var(--bg-surface) 100%);
    border-bottom: 1px solid var(--border-light);
}

/* Article Hero Content Enhancement */
.article-hero__inner {
    display: flex;
    align-items: center;
    gap: var(--space-xxl);
}

.article-hero__content {
    flex: 1;
    z-index: 2;
}

/* Featured Image Enhancement */
.article-hero__image-wrapper {
    flex: 1;
    position: relative;
    border-radius: 32px;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    aspect-ratio: 1200 / 630;
}

.article-hero__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-hero:hover .article-hero__image {
    transform: scale(1.03);
}

/* ========================================
   ARTICLE LAYOUT - Critical Fixes
   ======================================== */

.v2-article-container {
    display: flex !important; /* CRITICAL: This was missing */
    gap: var(--space-xl);
    position: relative;
}

.v2-sidebar-left {
    flex: 0 0 48px;
}

.v2-article-body {
    flex: 1;
    max-width: var(--max-content-width);
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: 24px;
    box-shadow: var(--shadow-premium);
    padding: var(--space-xl);
    margin-top: -60px;
    position: relative;
    z-index: 10;
}

.v2-content {
    color: var(--text-primary);
    font-size: 1.125rem;
    line-height: 1.75;
}

/* ========================================
   ENHANCED TYPOGRAPHY
   ======================================== */

.v2-content h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    letter-spacing: -0.015em;
}

.v2-content h3 {
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 600;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.v2-content p {
    margin-bottom: var(--space-md);
}

.v2-content a {
    color: var(--google-blue);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.v2-content a:hover {
    border-bottom-color: var(--google-blue);
    color: var(--google-blue-hover);
}

.v2-content ul,
.v2-content ol {
    margin: var(--space-md) 0;
    padding-left: 2rem;
}

.v2-content li {
    margin-bottom: 0.75rem;
}

.v2-content blockquote {
    border-left: 4px solid var(--google-blue);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-xl) 0;
    background: var(--bg-gray);
    border-radius: 0 16px 16px 0;
    font-style: italic;
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.v2-content code {
    background: var(--bg-gray);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: #d73a49;
}

.v2-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: var(--space-lg);
    border-radius: 12px;
    overflow-x: auto;
    margin: var(--space-xl) 0;
}

.v2-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* ========================================
   SOCIAL SHARE BUTTONS - Enhanced
   ======================================== */

.v2-social-sticky {
    position: sticky;
    top: 120px;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    z-index: 10;
}

.v2-social-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-tertiary);
    padding: 0;
}

.v2-social-btn:hover {
    background: var(--bg-accent);
    color: var(--google-blue);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: var(--google-blue);
}

.v2-social-btn svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   SCROLL INDICATOR - Preserved
   ======================================== */

.scroll-indicator {
    position: absolute;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.scroll-indicator__mouse {
    width: 26px;
    height: 42px;
    border: 2px solid var(--text-tertiary);
    border-radius: 100px;
    position: relative;
    opacity: 0.6;
}

.scroll-indicator__wheel {
    width: 4px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 100px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll-wheel 1.6s infinite;
}

@keyframes scroll-wheel {
    0% { top: 8px; opacity: 1; }
    100% { top: 24px; opacity: 0; }
}

/* ========================================
   RELATED STORIES - Enhanced
   ======================================== */

.related-stories-section {
    background: var(--bg-gray);
    padding: var(--space-xxl) 0;
    border-top: 1px solid var(--border-light);
}

.related-stories-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--space-xl);
    text-align: center;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 40px;
    max-width: var(--max-container-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.post-card {
    background: var(--bg-white);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 16px;
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
    background: var(--bg-gray);
}

.post-card__image {
    display: block;
    aspect-ratio: 16 / 10;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.post-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.post-card__content {
    padding: var(--space-md);
}

.post-card__title {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

.post-card__title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-card__title a:hover {
    color: var(--google-blue);
}

.post-card__meta {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

/* ========================================
   ANIMATIONS - Preserved
   ======================================== */

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   CODE BLOCK ENHANCEMENTS
   ======================================== */

.v2-content pre {
    position: relative;
}

.v2-content pre::before {
    content: 'Code';
    position: absolute;
    top: 0;
    right: 0;
    background: var(--google-blue);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 0 12px 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   TABLE ENHANCEMENTS
   ======================================== */

.v2-content table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-xl) 0;
    box-shadow: var(--shadow-sm);
    border-radius: 12px;
    overflow: hidden;
}

.v2-content table thead {
    background: var(--bg-gray);
    color: var(--text-primary);
}

.v2-content table th {
    padding: var(--space-md);
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--border-medium);
}

.v2-content table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.v2-content table tr:last-child td {
    border-bottom: none;
}

.v2-content table tbody tr:hover {
    background: var(--bg-accent);
}

/* ========================================
   IMAGE ENHANCEMENTS
   ======================================== */

.v2-content img {
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    max-width: 100%;
    height: auto;
}

/* ========================================
   SHOWCASE PLUGIN ENHANCEMENT
   ======================================== */

.ccs-showcase {
    margin: var(--space-xl) 0;
}

.claude-hero-section {
    background: linear-gradient(135deg, var(--bg-gray) 0%, var(--bg-surface) 100%) !important;
    border-radius: 24px;
    padding: var(--space-xl) !important;
    margin: var(--space-xl) 0 !important;
    border: 1px solid var(--border-light);
}

/* ========================================
   RESPONSIVE DESIGN - Critical Fixes
   ======================================== */

@media (max-width: 991px) {
    .article-hero {
        padding: var(--space-xl) 0;
        min-height: auto;
    }

    .article-hero__inner {
        flex-direction: column;
        gap: var(--space-xl);
    }

    .article-hero__image-wrapper {
        width: 100%;
    }

    .article-hero__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .v2-article-body {
        padding: var(--space-lg);
        border-radius: 16px;
        margin-top: -30px;
    }

    .v2-sidebar-left,
    .v2-sidebar-right {
        display: none;
    }

    .post-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .article-hero__title {
        font-size: clamp(2rem, 5vw, 2.5rem);
    }

    .v2-content {
        font-size: 1rem;
    }
}

/* ========================================
   ACCESSIBILITY ENHANCEMENTS
   ======================================== */

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Better focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--google-blue);
    outline-offset: 2px;
}

/* Improve readability on selection */
::selection {
    background: rgba(52, 94, 157, 0.3);
    color: inherit;
}

/* Performance: Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .v2-article-body {
        border: 2px solid currentColor;
    }

    .article-tag {
        border: 2px solid var(--text-primary);
    }
}

/* Loading state animations */
.v2-article-body {
    animation: fadeIn 0.6s ease-out;
}

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

/* ========================================
   CUSTOM SCROLLBAR - Optional Enhancement
   ======================================== */

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 12px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--google-blue);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--google-blue-hover);
}
