/* Blog Engine Styles - Stable v4.2 (Animations Guaranteed) */

/* --- ADVANCED MATRIX HERO (Dark/Animated) --- */
.matrix-hero {
    position: relative;
    padding: 200px 0 60px;
    text-align: center;
    background-color: #020c1b;
    border-bottom: 2px solid #64ffda;
    color: white;
    /* Default Cyber Background (Animated) */
    background-image:
        radial-gradient(circle at 50% 50%, rgba(29, 78, 216, 0.4) 0%, transparent 60%),
        url("data:image/svg+xml,%3Csvg width='200' height='200' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='10' y='20' fill='%2300f2ff' fill-opacity='0.1' font-family='monospace' font-size='14'%3E10100101%3C/text%3E%3Ctext x='50' y='120' fill='%2300f2ff' fill-opacity='0.1' font-family='monospace' font-size='14'%3E01011010%3C/text%3E%3Ctext x='120' y='60' fill='%2300f2ff' fill-opacity='0.1' font-family='monospace' font-size='14'%3E11001001%3C/text%3E%3Ctext x='160' y='180' fill='%2300f2ff' fill-opacity='0.05' font-family='monospace' font-size='14'%3E00101110%3C/text%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M25 0 L75 0 L100 43.3 L75 86.6 L25 86.6 L0 43.3 Z' fill='none' stroke='%2300f2ff' stroke-opacity='0.05' stroke-width='1'/%3E%3C/svg%3E"),
        linear-gradient(90deg, #020c1b 0%, rgba(2, 12, 27, 0.8) 50%, #020c1b 100%);
    background-repeat: no-repeat, repeat-y, repeat, no-repeat;
    background-position: center center, 0 0, center, center;
    background-size: 100% 100%, 200px 200px, 100px 100px, 100%;
    animation: cyber-rain 20s linear infinite, border-pulse 4s infinite alternate;
}

/* Circuit/Grid Overlay (Right Side) */
.matrix-hero::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    height: 300px;
    background-image: url("data:image/svg+xml,%3Csvg width='300' height='300' viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 150 L100 150 L150 100 L250 100' fill='none' stroke='%2300f2ff' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='250' cy='100' r='4' fill='%2300f2ff'/%3E%3Cpath d='M0 200 L50 200 L100 250 L200 250' fill='none' stroke='%2300f2ff' stroke-width='2' stroke-opacity='0.5' stroke-linecap='round'/%3E%3Ccircle cx='200' cy='250' r='3' fill='%2300f2ff' fill-opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0.6;
}

/* Lock/Shield & Circuit Overlay (Left Side) */
.matrix-hero::after {
    content: '';
    position: absolute;
    left: 5%;
    top: 60%;
    transform: translateY(-50%);
    width: 200px;
    height: 200px;
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='100' cy='100' r='90' fill='none' stroke='%2300f2ff' stroke-width='1' stroke-dasharray='20 10' opacity='0.3'/%3E%3Cpath d='M100 20 A80 80 0 0 1 180 100' fill='none' stroke='%2300f2ff' stroke-width='4' stroke-opacity='0.2' /%3E%3Cpath d='M100 180 A80 80 0 0 1 20 100' fill='none' stroke='%2300f2ff' stroke-width='4' stroke-opacity='0.2' /%3E%3Ccircle cx='100' cy='100' r='60' fill='none' stroke='%2300f2ff' stroke-width='0.5' opacity='0.2'/%3E%3Cg transform='translate(60, 50)'%3E%3Cpath d='M20 30 V15 A20 20 0 0 1 60 15 V30' fill='none' stroke='%23ffffff' stroke-width='5' stroke-linecap='round' /%3E%3Crect x='5' y='30' width='70' height='60' rx='5' fill='rgba(0, 242, 255, 0.15)' stroke='%2300f2ff' stroke-width='2' /%3E%3Ccircle cx='40' cy='55' r='6' fill='%23ffffff' /%3E%3Crect x='37' y='55' width='6' height='15' fill='%23ffffff' /%3E%3Cpath d='M15 40 H65 M15 70 H65 M15 80 H65' stroke='%2300f2ff' stroke-width='1' stroke-opacity='0.3' /%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 100% 100%;
    pointer-events: none;
    opacity: 0.9;
}

h1.matrix-title {
    color: #e6f1ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 15px;
    line-height: 1.3;
    text-shadow: 0 0 20px rgba(100, 255, 218, 0.5);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 1.2s ease-out 0.2s both;
    /* Slightly slower */
}

/* Category Pill (Shared) */
.cat-pill {
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 20px;
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: inline-block;
    margin-bottom: 20px;
    background: rgba(13, 71, 161, 0.2);
    /* Default no animation for generated buttons to avoid flicker */
}

/* Specific Hero Category Animation (New Request) */
#blog-category {
    animation: cyber-slide-glow 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
    /* Initial Glow */
}

/* New "Cyber Pulse" Animation */
@keyframes cyber-slide-glow {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
        box-shadow: 0 0 0 rgba(0, 242, 255, 0);
        border-color: rgba(255, 255, 255, 0.1);
    }

    60% {
        opacity: 1;
        transform: translateY(10px) scale(1.05);
        box-shadow: 0 0 25px rgba(0, 242, 255, 0.6);
        border-color: #00f2ff;
        color: #00f2ff;
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        box-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
        border-color: rgba(255, 255, 255, 0.6);
        color: white;
    }
}

.matrix-breadcrumb {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: fadeInUp 1.2s ease-out 0.5s both;
}

.matrix-breadcrumb a {
    color: #fff;
    text-decoration: none;
}

.matrix-breadcrumb a:hover {
    color: #64ffda;
}

/* Animations - Ensure visibility */
@keyframes cyber-rain {
    from {
        background-position: center center, 0 0, center, center;
    }

    to {
        background-position: center center, 0 400px, center, center;
    }
}

@keyframes border-pulse {
    0% {
        border-bottom-color: rgba(0, 242, 255, 0.1);
    }

    100% {
        border-bottom-color: rgba(0, 242, 255, 0.5);
    }
}

@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- MAIN CONTENT & LAYOUT --- */
.blog-master-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 50px;
    position: relative;
}

/* --- TOC WIDGET --- */
.blog-sidebar {
    position: relative;
}

.toc-widget {
    position: -webkit-sticky;
    position: sticky;
    top: 120px;
    background: #ffffff;
    padding: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.toc-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #0d47a1;
    display: block;
    text-align: center;
    padding-bottom: 10px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: toc-counter;
}

.toc-list>li {
    margin-bottom: 15px;
    font-size: 0.95rem;
    color: #333;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    padding-left: 5px;
}

.toc-list>li::before {
    counter-increment: toc-counter;
    content: counter(toc-counter) ".";
    font-weight: 800;
    color: #0d47a1;
    margin-right: 12px;
    flex-shrink: 0;
}

.toc-list>li>a {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    transition: color 0.2s;
    flex: 1;
}

.toc-list>li>a:hover,
.toc-list>li>a.active {
    color: #0d47a1;
    font-weight: 700;
}

.toc-sublist {
    width: 100%;
    list-style: none;
    padding-left: 28px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.toc-sublist li {
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #555;
    display: flex;
    align-items: baseline;
}

.toc-sublist li::before {
    content: "•";
    color: #00c853;
    font-weight: bold;
    margin-right: 10px;
    font-size: 1.2em;
    line-height: 1;
}

.toc-sublist li a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.toc-sublist li a:hover,
.toc-sublist li a.active {
    color: #00c853;
}

/* --- ARTICLE CONTENT --- */
.blog-article {
    min-width: 0;
}

.featured-image-wrapper {
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-height: 450px;
    display: block;
    /* Background removed */
}

.featured-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.article-body img {
    /* Full Width & Smart Crop as per User Request */
    width: 100%;
    max-height: 450px;
    object-fit: cover;
    display: block;
    margin: 25px 0;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.article-body {
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    text-align: left;
}

.article-body h2 {
    font-size: 1.8rem;
    margin: 40px 0 20px;
    color: #111;
    scroll-margin-top: 100px;
    font-weight: 700;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    padding-left: 10px;
    border-left: 5px solid transparent;
    /* Highlight Prep */
    transition: all 0.3s ease;
    /* Ensure wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.3;
}

.article-body h3 {
    font-size: 1.4rem;
    margin: 30px 0 15px;
    color: #222;
    scroll-margin-top: 100px;
    font-weight: 600;
    padding-left: 10px;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
    /* Ensure wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

/* Active Highlight Properties */
.article-body h2.active-section {
    color: #0d47a1;
    border-left-color: #0d47a1;
    background: linear-gradient(90deg, rgba(13, 71, 161, 0.05) 0%, transparent 100%);
}

.article-body h3.active-section {
    color: #00c853;
    border-left-color: #00c853;
    background: linear-gradient(90deg, rgba(0, 200, 83, 0.05) 0%, transparent 100%);
}

.article-body p {
    margin-bottom: 20px;
}

.article-body ul {
    list-style-type: disc;
    margin-bottom: 25px;
    padding-left: 25px;
}

.article-body ol {
    list-style-type: decimal;
    margin-bottom: 25px;
    padding-left: 25px;
}

.article-body li {
    margin-bottom: 10px;
    padding-left: 5px;
}

.article-body * {
    max-width: 100%;
}

/* Action Buttons (Contact, Website, Phone) */
.action-buttons {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    font-weight: bold;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.action-btn i {
    font-size: 1.1rem;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-contact {
    background: linear-gradient(135deg, #0d47a1, #1976d2);
}

.btn-website {
    background: linear-gradient(135deg, #00695c, #00897b);
}

.btn-phone {
    background: linear-gradient(135deg, #c62828, #e53935);
}

.service-btn {
  display: inline-block;
  padding: 12px 20px;
  background: #007bff;
  color: #fff;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 600;
}
.service-btn:hover {
  background: #0056b3;
}


/* Mobile Adjustments for Buttons */
@media (max-width: 600px) {
    .action-buttons {
        flex-direction: column;
        gap: 15px;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .blog-master-container {
        grid-template-columns: 1fr;
        /* Single column */
    }

    .blog-sidebar {
        display: none;
        /* Hide TOC on Mobile/Tablet */
    }

    .matrix-title {
        font-size: 2rem;
    }

    .article-body {
        padding: 0;
        /* Remove extra padding on mobile */
    }
}

/* Mobile */
@media (max-width: 900px) {
    .blog-master-container {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        order: -1;
        border-right: none;
        margin-bottom: 30px;
    }

    .toc-widget {
        position: static;
        max-height: 300px;
        border-right: none;
        border: 1px solid #eee;
    }

    h1.matrix-title {
        font-size: 1.8rem;
    }
}