/* =================================================================
   BLOG POST ENHANCEMENTS - WIK Technologies
   ================================================================= */

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-red), var(--secondary-blue));
    z-index: 1001;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.1s linear;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* Blog Article Container */
article {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 5%;
}

/* Enhanced Blog Typography */
article h1 {
    font-size: 2.5rem;
    color: var(--dark);
    margin-bottom: 1rem;
    font-weight: 900;
    line-height: 1.2;
}

article h2 {
    font-size: 2rem;
    color: var(--dark);
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    font-weight: 800;
    position: relative;
    padding-left: 1.5rem;
}

article h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--accent-red), var(--secondary-blue));
    border-radius: 2px;
}

article h3 {
    font-size: 1.5rem;
    color: var(--primary-blue);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-align: left;
}

article p {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--dark);
    margin-bottom: 1.5rem;
}

article ul,
article ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

article li {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--dark);
    margin-bottom: 0.75rem;
}

/* Enhanced Quote Callouts */
article blockquote {
    margin: 2.5rem 0;
    padding: 1.5rem 2rem;
    background: oklch(99% 0.006 22);
    border: 1px solid oklch(88% 0.025 22);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

article blockquote::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-red);
    animation: quoteGrow 0.6s ease forwards;
}

@keyframes quoteGrow {
    from {
        height: 0;
    }
    to {
        height: 100%;
    }
}

article blockquote p {
    font-style: italic;
    color: var(--text-gray);
    margin: 0;
}

/* Code Blocks Enhancement */
article pre {
    background: #1E293B;
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 2rem 0;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

article code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #E5E7EB;
}

article pre code {
    display: block;
    line-height: 1.6;
}

/* Inline code */
article p code,
article li code {
    background: var(--light-gray);
    color: var(--accent-red);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Copy Code Button */
.copy-code-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--secondary-blue);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s;
}

article pre:hover .copy-code-btn {
    opacity: 1;
}

@media (max-width: 768px), (hover: none) {
    .copy-code-btn {
        opacity: 1;
    }
}

.copy-code-btn:hover {
    background: var(--primary-blue);
    transform: translateY(-2px);
}

/* Reading Time Badge */
.reading-time {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-gray);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.reading-time i {
    color: var(--secondary-blue);
}

/* Enhanced Links in Blog Posts (excluding button components) */
article a:not([class*="btn"]):not(.cta-button):not(.read-more):not(.share-btn) {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    position: relative;
    transition: color 0.3s;
}

article a:not([class*="btn"]):not(.cta-button):not(.read-more):not(.share-btn)::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-red);
    transition: width 0.3s;
}

article a:not([class*="btn"]):not(.cta-button):not(.read-more):not(.share-btn):hover {
    color: var(--accent-red);
}

article a:not([class*="btn"]):not(.cta-button):not(.read-more):not(.share-btn):hover::after {
    width: 100%;
}

/* Article Images Responsiveness */
article img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Blog Article Button Isolation — ensure buttons in blog posts never suffer text invisibility */
article a.btn-primary,
article a.btn-secondary,
article a.btn-card-primary,
article a.btn-card-secondary-red,
article a.btn-card-secondary-blue,
article a.btn-whatsapp-ghost,
article a.cta-button {
    text-decoration: none !important;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

article a.btn-primary::after,
article a.btn-secondary::after,
article a.btn-card-primary::after,
article a.btn-card-secondary-red::after,
article a.btn-card-secondary-blue::after,
article a.btn-whatsapp-ghost::after,
article a.cta-button::after {
    display: none !important;
    content: none !important;
    width: 0 !important;
}

article a.btn-primary,
article a.btn-primary:focus {
    background: var(--accent-red);
    color: #ffffff !important;
}

article a.btn-primary:hover {
    background: var(--color-accent-dk) !important;
    color: #ffffff !important;
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(220, 38, 38, 0.4);
}

article a.btn-secondary {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

article a.btn-secondary:hover,
article a.btn-secondary:focus {
    background: var(--primary-blue) !important;
    color: #ffffff !important;
    border-color: var(--primary-blue) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(30, 64, 175, 0.25);
}

/* WhatsApp secondary button in articles */
article a.btn-secondary[style*="25D366"],
article a.btn-secondary[style*="green"] {
    background: #25D366 !important;
    color: #ffffff !important;
    border-color: #25D366 !important;
}

article a.btn-secondary[style*="25D366"]:hover,
article a.btn-secondary[style*="green"]:hover {
    background: #128C7E !important;
    color: #ffffff !important;
    border-color: #128C7E !important;
}

/* Inverted white primary buttons inside dark/blue cards — prevent white-on-white text on hover */
article a.btn-primary[style*="background: white"],
article a.btn-primary[style*="background:white"],
article a.btn-primary[style*="background: #fff"],
article a.btn-primary[style*="background:#fff"],
article a.btn-cta-light {
    background: #ffffff !important;
    color: var(--primary-blue) !important;
    border: 2px solid #ffffff !important;
}

article a.btn-primary[style*="background: white"]:hover,
article a.btn-primary[style*="background:white"]:hover,
article a.btn-primary[style*="background: #fff"]:hover,
article a.btn-primary[style*="background:#fff"]:hover,
article a.btn-primary[style*="background: white"]:focus,
article a.btn-primary[style*="background:white"]:focus,
article a.btn-primary[style*="background: #fff"]:focus,
article a.btn-primary[style*="background:#fff"]:focus,
article a.btn-cta-light:hover,
article a.btn-cta-light:focus {
    background: #f1f5f9 !important;
    color: var(--primary-blue) !important;
    border-color: #f1f5f9 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
    transform: translateY(-2px) !important;
}

/* Secondary buttons in dark / blue CTA banners — invert to solid white on hover rather than blending into blue */
.article-cta-dark a.btn-secondary,
article section[style*="linear-gradient"] a.btn-secondary,
article section[style*="1E40AF"] a.btn-secondary,
article section[style*="primary-blue"] a.btn-secondary,
article a.btn-secondary[style*="rgba(255,255,255"],
article a.btn-secondary[style*="rgba(255, 255, 255"] {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    border: 2px solid rgba(255, 255, 255, 0.75) !important;
}

.article-cta-dark a.btn-secondary:hover,
.article-cta-dark a.btn-secondary:focus,
article section[style*="linear-gradient"] a.btn-secondary:hover,
article section[style*="linear-gradient"] a.btn-secondary:focus,
article section[style*="1E40AF"] a.btn-secondary:hover,
article section[style*="1E40AF"] a.btn-secondary:focus,
article section[style*="primary-blue"] a.btn-secondary:hover,
article section[style*="primary-blue"] a.btn-secondary:focus,
article a.btn-secondary[style*="rgba(255,255,255"]:hover,
article a.btn-secondary[style*="rgba(255,255,255"]:focus,
article a.btn-secondary[style*="rgba(255, 255, 255"]:hover,
article a.btn-secondary[style*="rgba(255, 255, 255"]:focus {
    background: #ffffff !important;
    color: var(--primary-blue) !important;
    border-color: #ffffff !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
    transform: translateY(-2px) !important;
}

/* Image Captions */
article figure {
    margin: 2.5rem 0;
}

article figcaption {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-gray);
    font-style: italic;
    margin-top: 0.75rem;
}

/* Highlighted Text */
article mark {
    background: linear-gradient(to right, rgba(59, 130, 246, 0.2), rgba(220, 38, 38, 0.2));
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    color: var(--dark);
}

/* Drop Cap (First Letter) */
article p:first-of-type::first-letter {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--primary-blue);
    float: left;
    line-height: 1;
    margin-right: 0.5rem;
    margin-top: 0.1rem;
}

/* K-Track, blog captions and case-studies dark hero readability */
.ktrack-story-page article p:first-of-type::first-letter,
article p.blog-img-caption::first-letter,
article p.blog-img-caption:first-of-type::first-letter {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    float: none;
    line-height: inherit;
    margin-right: 0;
    margin-top: 0;
}

.article-hero-dark,
.article-hero-dark h1,
.article-hero-dark p,
.article-hero-dark div {
    color: white !important;
}

.ktrack-story-page article a.btn-primary,
.ktrack-story-page article a.btn-secondary {
    display: inline-block;
}

.ktrack-story-page article a.btn-primary::after,
.ktrack-story-page article a.btn-secondary::after {
    display: none;
}

/* Social Share Buttons */
.social-share {
    position: fixed;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s;
}

.social-share.visible {
    opacity: 1;
}

.share-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-decoration: none;
}

.share-btn:hover {
    transform: translateX(-5px) scale(1.1);
}

.share-twitter {
    background: #1DA1F2;
}

.share-facebook {
    background: #1877F2;
}

.share-linkedin {
    background: #0A66C2;
}

.share-copy {
    background: var(--text-gray);
}

/* Author Bio Section */
.author-bio {
    margin-top: 4rem;
    padding: 2.5rem;
    background: linear-gradient(135deg, var(--light-gray), var(--color-border));
    border-radius: 10px;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.author-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(30, 64, 175, 0.2);
}

.author-info h4 {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.author-info p {
    color: var(--text-gray);
    margin: 0;
    font-size: 1rem;
}

/* Responsive Blog Enhancements */
@media (max-width: 1100px) {
    .social-share {
        display: none;
    }
}

@media (max-width: 768px) {
    article h1 {
        font-size: 2rem;
    }
    
    article h2 {
        font-size: 1.5rem;
    }
    
    article p,
    article li {
        font-size: 1rem;
    }
    
    article p:first-of-type::first-letter {
        font-size: 2.5rem;
    }
    
    .author-bio {
        flex-direction: column;
        text-align: center;
    }
}
