/* ============================================================
   LK AUTO BLOG — PUBLIC STYLESHEET
   Matches the existing site's design language from cssv2.css:
   - Colors: --brand (#2f4f4f), --ink (#111), --bg (#fff), etc.
   - Typography: Playfair Display headings, Inter body
   - Foundation 6 grid, --radius, --shadow variables
   ============================================================ */

/* ----------------------------------------------------------
   CATEGORY FILTER PILL TABS
   ---------------------------------------------------------- */
.blog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-s);
    margin-bottom: var(--space-xl);
    justify-content: center;
}

.blog-filter-pill {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid var(--border);
    color: var(--muted);
    background: var(--bg);
    transition: all 0.2s ease;
    text-decoration: none;
}

.blog-filter-pill:hover {
    border-color: var(--brand);
    color: var(--brand);
    text-decoration: none;
}

.blog-filter-pill.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.blog-filter-pill.active:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

/* ----------------------------------------------------------
   POST CARDS (Listing Page)
   ---------------------------------------------------------- */
.blog-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.blog-card-link:hover {
    text-decoration: none;
    color: inherit;
}

.blog-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: #d0d5da;
}

/* Image container with fixed aspect ratio to prevent CLS */
.blog-card-image {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: var(--bg-alt);
}

.blog-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.03);
}

/* No-image placeholder */
.blog-card-image .no-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alt);
    color: var(--muted);
    font-size: 0.85rem;
}

/* Category badge overlay on image */
.blog-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    z-index: 2;
    color: #fff;
}

.blog-card-badge.cat-project {
    background: #3a7bd5; /* Blue for project showcases */
}

.blog-card-badge.cat-educational {
    background: #27ae60; /* Green for educational content */
}

.blog-card-body {
    padding: var(--space-m);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-body h2 {
    font-size: 1.15rem;
    font-family: "Playfair Display", Georgia, serif;
    margin-bottom: var(--space-xs);
    color: var(--ink);
    line-height: 1.35;
}

.blog-card-date {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: var(--space-s);
}

.blog-card-excerpt {
    font-size: 0.9rem;
    color: var(--ink-muted);
    line-height: 1.6;
    flex: 1;
    margin: 0;
}

/* ----------------------------------------------------------
   PAGINATION
   ---------------------------------------------------------- */
.blog-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-m);
    margin-top: var(--space-xl);
    padding-top: var(--space-l);
    border-top: 1px solid var(--border);
}

.blog-pagination a {
    display: inline-block;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--brand);
    transition: all 0.2s ease;
}

.blog-pagination a:hover {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    text-decoration: none;
}

.blog-pagination .page-info {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

/* ----------------------------------------------------------
   EMPTY STATE (no posts)
   ---------------------------------------------------------- */
.blog-empty {
    text-align: center;
    padding: var(--space-xxl) var(--space-l);
    color: var(--muted);
}

.blog-empty h2 {
    font-size: var(--h2);
    color: var(--ink);
    margin-bottom: var(--space-s);
}

.blog-empty p {
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ----------------------------------------------------------
   BREADCRUMBS (Single Post Page)
   Using the existing .breadcrumbs class from cssv2.css
   with minor blog-specific overrides if needed.
   ---------------------------------------------------------- */
.blog-breadcrumbs {
    margin-bottom: var(--space-m);
}

/* ----------------------------------------------------------
   SINGLE POST — Layout
   ---------------------------------------------------------- */
.blog-post-header {
    margin-bottom: var(--space-l);
}

.blog-post-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    margin-bottom: var(--space-m);
}

.blog-post-badge.cat-project {
    background: #3a7bd5;
}

.blog-post-badge.cat-educational {
    background: #27ae60;
}

.blog-post-header h1 {
    font-size: var(--h1);
    margin-bottom: var(--space-s);
    line-height: 1.2;
}

.blog-post-meta {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: var(--space-l);
}

.blog-post-meta .updated {
    margin-left: var(--space-m);
    font-style: italic;
}

/* Featured image */
.blog-featured-image {
    margin-bottom: var(--space-xl);
    border-radius: var(--radius);
    overflow: hidden;
}

.blog-featured-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius);
}

/* ----------------------------------------------------------
   BLOG CONTENT — Typography for TinyMCE output
   Clean reading experience with proper spacing
   ---------------------------------------------------------- */
.blog-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--ink-muted);
    margin-bottom: var(--space-xl);
}

.blog-content h2 {
    font-size: var(--h2);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-m);
    color: var(--ink);
}

.blog-content h3 {
    font-size: var(--h3);
    margin-top: var(--space-l);
    margin-bottom: var(--space-s);
    color: var(--ink);
}

.blog-content h4 {
    font-size: var(--h4);
    margin-top: var(--space-l);
    margin-bottom: var(--space-s);
    color: var(--ink);
}

.blog-content p {
    margin-bottom: var(--space-m);
    color: var(--ink-muted);
}

.blog-content ul,
.blog-content ol {
    margin-bottom: var(--space-m);
    padding-left: 1.5em;
}

.blog-content li {
    margin-bottom: var(--space-xs);
    line-height: 1.7;
}

.blog-content a {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-content a:hover {
    color: var(--brand-dark);
}

.blog-content img {
    border-radius: var(--radius-sm);
    margin: var(--space-l) 0;
    max-width: 100%;
    height: auto;
}

.blog-content blockquote {
    border-left: 4px solid var(--brand);
    margin: var(--space-l) 0;
    padding: var(--space-m) var(--space-l);
    background: var(--bg-alt);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
}

.blog-content blockquote p {
    margin-bottom: 0;
    color: var(--ink);
}

.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-l) 0;
}

.blog-content th,
.blog-content td {
    padding: var(--space-s) var(--space-m);
    border: 1px solid var(--border);
    text-align: left;
}

.blog-content th {
    background: var(--bg-alt);
    font-weight: 600;
}

/* ----------------------------------------------------------
   RESPONSIVE YOUTUBE EMBED (16:9)
   ---------------------------------------------------------- */
.blog-youtube {
    margin: var(--space-xl) 0;
}

.blog-youtube h3 {
    margin-bottom: var(--space-m);
}

.youtube-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius);
    background: #000;
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ----------------------------------------------------------
   BEFORE / AFTER SLIDER
   ---------------------------------------------------------- */
.ba-sliders-section {
    margin: var(--space-xl) 0;
}

.ba-sliders-section h3 {
    margin-bottom: var(--space-l);
}

.ba-sliders-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-l);
}

@media (min-width: 768px) {
    .ba-sliders-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.before-after-slider {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none; /* Prevents scroll while dragging */
    aspect-ratio: 4 / 3;
    background: var(--bg-alt);
}

.before-after-slider img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* The "after" image is clipped from the right */
.ba-after-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* clip-path set by JS — initial: show right 50% */
    clip-path: inset(0 0 0 50%);
}

/* Divider line */
.ba-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background: #fff;
    z-index: 10;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

/* Drag handle circle on the divider */
.ba-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11;
}

/* Double arrow icon inside the handle */
.ba-handle::before {
    content: "\2194"; /* ↔ */
    font-size: 1.2rem;
    color: var(--brand);
    font-weight: 700;
}

/* Labels */
.ba-label-before,
.ba-label-after {
    position: absolute;
    top: 12px;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #fff;
    z-index: 5;
    pointer-events: none;
}

.ba-label-before {
    left: 12px;
    background: #dc3545;
}

.ba-label-after {
    right: 12px;
    background: #28a745;
}

/* ----------------------------------------------------------
   IMAGE GALLERY (Single Post)
   ---------------------------------------------------------- */
.blog-gallery {
    margin: var(--space-xl) 0;
}

.blog-gallery h3 {
    margin-bottom: var(--space-m);
}

.blog-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-s);
}

@media (min-width: 640px) {
    .blog-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .blog-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.blog-gallery-thumb {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4 / 3;
    background: var(--bg-alt);
}

.blog-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s ease, transform 0.3s ease;
}

.blog-gallery-thumb:hover img {
    opacity: 0.85;
    transform: scale(1.04);
}

/* ----------------------------------------------------------
   LIGHTBOX
   ---------------------------------------------------------- */
.blog-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.blog-lightbox.is-active {
    display: flex;
    opacity: 1;
}

.blog-lightbox-img-wrap {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-lightbox-img-wrap img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 6px;
    transition: opacity 0.2s ease;
    display: block;
}

/* Close button */
.blog-lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: background 0.2s ease;
    line-height: 1;
}

.blog-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Navigation arrows */
.blog-lightbox-prev,
.blog-lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.blog-lightbox-prev:hover,
.blog-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.blog-lightbox-prev {
    left: 16px;
}

.blog-lightbox-next {
    right: 16px;
}

/* Hide arrows if only one image */
.blog-lightbox.single-image .blog-lightbox-prev,
.blog-lightbox.single-image .blog-lightbox-next {
    display: none;
}

/* Counter */
.blog-lightbox-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    z-index: 10001;
}

/* ----------------------------------------------------------
   BACK TO BLOG LINK
   ---------------------------------------------------------- */
.blog-back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-m) 0;
    margin-top: var(--space-l);
    font-weight: 600;
    color: var(--brand);
    border-top: 1px solid var(--border);
    width: 100%;
}

.blog-back-link:hover {
    color: var(--brand-dark);
}

/* ----------------------------------------------------------
   404 / POST NOT FOUND
   ---------------------------------------------------------- */
.blog-not-found {
    text-align: center;
    padding: var(--space-xxl) var(--space-l);
}

.blog-not-found h1 {
    font-size: var(--h1);
    margin-bottom: var(--space-s);
}

.blog-not-found p {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: var(--space-l);
}

/* ----------------------------------------------------------
   RESPONSIVE ADJUSTMENTS
   ---------------------------------------------------------- */
@media (max-width: 639px) {
    .blog-card-body h2 {
        font-size: 1.05rem;
    }

    .blog-post-header h1 {
        font-size: clamp(22px, 5vw, 32px);
    }

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

    .ba-handle {
        width: 32px;
        height: 32px;
    }

    .ba-handle::before {
        font-size: 1rem;
    }

    .blog-lightbox-prev,
    .blog-lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .blog-lightbox-prev {
        left: 8px;
    }

    .blog-lightbox-next {
        right: 8px;
    }
}

/* ----------------------------------------------------------
   PRINT STYLES
   Hide interactive elements when printing the blog post
   ---------------------------------------------------------- */
@media print {
    .lk-header,
    .lk-menu-overlay,
    footer,
    .wa-chat-btn,
    .blog-lightbox,
    .blog-filters,
    .blog-pagination,
    .blog-back-link,
    .blog-gallery-thumb,
    .ba-divider,
    .ba-handle,
    .ba-label-before,
    .ba-label-after {
        display: none !important;
    }

    body {
        padding-top: 0;
    }

    .blog-content {
        font-size: 11pt;
        line-height: 1.6;
        color: #000;
    }

    .blog-content a {
        color: #000;
        text-decoration: underline;
    }

    .blog-content a::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #666;
    }
}
