/**
 * Blog Showcase Widget Styles
 * Two-column layout with sticky left + scrollable right
 * Framer-style scroll reveal animations
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --bs-primary-dark: #1C1C1C;
    --bs-text-gray: #666666;
    --bs-text-light: #999999;
    --bs-border-gray: #e5e5e5;
    --bs-accent-blue: #17468A;
    --bs-white: #FFFFFF;
    --bs-card-bg: #f9f9f9;
    --bs-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --bs-shadow:
        0px 2px 4px rgba(0, 0, 0, 0.04),
        0px 4px 8px rgba(0, 0, 0, 0.04),
        0px 8px 16px rgba(0, 0, 0, 0.04);
}

/* ============================================
   Section & Container
   ============================================ */
.bs-section {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: var(--bs-white);
}

.bs-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   Two-Column Layout with Sticky Left
   ============================================ */
.bs-wrapper {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

/* Left layout: sticky header, scrollable grid */
.bs-section[data-header-layout="left"] .bs-wrapper {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 48px;
    align-items: start;
}

/* Sticky Left Column */
.bs-section[data-header-layout="left"] .bs-header {
    position: sticky;
    top: 120px;
    align-self: start;
    max-height: calc(100vh - 140px);
}

/* Scrollable Right Column */
.bs-section[data-header-layout="left"] .bs-grid {
    min-height: 100%;
}

/* ============================================
   Header Styles
   ============================================ */
.bs-header {
    position: relative;
}

.bs-section[data-header-layout="top"] .bs-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.bs-decoration {
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #17468A 0%, #1E5AAD 50%, #2A7BD8 100%);
    border-radius: 2px;
    margin-bottom: 20px;
}

.bs-section[data-header-layout="top"] .bs-decoration {
    margin: 0 auto 20px;
}

.bs-header-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bs-section[data-header-layout="top"] .bs-header-content {
    align-items: center;
}

/* Tag Badge - Hero Eyebrow Style */
.bs-tag-wrapper {
    display: flex;
}

.bs-section[data-header-layout="top"] .bs-tag-wrapper {
    justify-content: center;
}

.bs-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #17468A;
    background: linear-gradient(135deg,
        rgba(23, 70, 138, 0.08) 0%,
        rgba(30, 90, 173, 0.08) 100%);
    border: 1px solid rgba(23, 70, 138, 0.2);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Shimmer effect */
.bs-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(23, 70, 138, 0.15),
        transparent);
    animation: bs-shimmer 3s infinite;
}

@keyframes bs-shimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Title */
.bs-title {
    font-size: 36px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--bs-primary-dark);
    letter-spacing: -0.02em;
    margin: 0;
}

/* Description */
.bs-description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--bs-text-gray);
    margin: 0;
}

/* Button */
.bs-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background-color: var(--bs-primary-dark);
    color: var(--bs-white);
    text-decoration: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    transition: var(--bs-transition);
    margin-top: 8px;
}

.bs-button:hover {
    background-color: #333333;
    transform: translateY(-2px);
    color: var(--bs-white);
    text-decoration: none;
}

.bs-button svg {
    transition: transform 0.3s ease;
}

.bs-button:hover svg {
    transform: translateX(4px);
}

/* ============================================
   Grid Layout
   ============================================ */
.bs-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 2), 1fr);
    gap: 24px;
}

/* Single column in left layout for better scroll effect */
.bs-section[data-header-layout="left"] .bs-grid {
    grid-template-columns: repeat(var(--columns, 1), 1fr);
}

/* ============================================
   Card Styles
   ============================================ */
.bs-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    overflow: hidden;
    transition: var(--bs-transition);
}

.bs-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--bs-shadow);
}

.bs-card-inner {
    background-color: var(--bs-card-bg);
    height: 100%;
}

.bs-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

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

.bs-card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Scrollable content */
.bs-card-content.has-scroll {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.bs-card-content.has-scroll::-webkit-scrollbar {
    width: 6px;
}

.bs-card-content.has-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.bs-card-content.has-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* ============================================
   Featured Image
   ============================================ */
.bs-post-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    border-radius: 16px;
    margin: 16px 16px 0;
}

.bs-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

/* Category Badge */
.bs-post-category {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 14px;
    background-color: var(--bs-accent-blue);
    color: var(--bs-white);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
    z-index: 2;
}

/* ============================================
   Text Content
   ============================================ */
.bs-text-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

/* Meta Info */
.bs-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--bs-text-light);
}

.bs-post-date,
.bs-post-author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bs-post-meta svg {
    opacity: 0.7;
}

/* Post Title */
.bs-post-title {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--bs-primary-dark);
    margin: 0;
    transition: color 0.3s ease;
}

.bs-card:hover .bs-post-title {
    color: var(--bs-accent-blue);
}

/* Excerpt */
.bs-post-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: var(--bs-text-gray);
    margin: 0;
}

/* Read More */
.bs-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--bs-accent-blue);
    margin-top: auto;
    padding-top: 8px;
    transition: var(--bs-transition);
}

.bs-read-more svg {
    transition: transform 0.3s ease;
}

.bs-card:hover .bs-read-more svg {
    transform: translateX(4px);
}

/* No Posts Message */
.bs-no-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--bs-text-gray);
    font-size: 16px;
}

/* ============================================
   Scroll Reveal System (Framer-style)
   Cards animate FROM BOTTOM-RIGHT to position
   ============================================ */

/* Base reveal class */
.reveal {
    will-change: opacity, transform;
}

/* Hidden state - FROM BOTTOM-RIGHT */
.reveal--hidden {
    opacity: 0;
    transform: translate(40px, 40px);
    pointer-events: none;
    transition: none;
}

/* Show state - Animate to original position */
.reveal--show {
    opacity: 1;
    transform: translate(0, 0);
    pointer-events: auto;
    transition:
        opacity 600ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--reveal-delay, 0ms);
}

/* Card specific reveal - enhanced bottom-right animation */
.bs-card.reveal--hidden {
    opacity: 0;
    transform: translate(50px, 50px) scale(0.96);
}

.bs-card.reveal--show {
    opacity: 1;
    transform: translate(0, 0) scale(1);
    transition:
        opacity 600ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--reveal-delay, 0ms);
}

/* Hover effect only after reveal */
.bs-card.reveal--show:hover {
    transform: translateY(-4px) scale(1);
}

/* Header reveal - more subtle */
.bs-header.reveal--hidden {
    opacity: 0;
    transform: translateY(30px);
}

.bs-header.reveal--show {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 500ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Animation variants */
.reveal--fade.reveal--hidden {
    transform: none;
}

.reveal--fade.reveal--show {
    transform: none;
}

.reveal--scale.reveal--hidden {
    opacity: 0;
    transform: scale(0.9);
}

.reveal--scale.reveal--show {
    opacity: 1;
    transform: scale(1);
}

.reveal--slide-left.reveal--hidden {
    opacity: 0;
    transform: translateX(-60px);
}

.reveal--slide-left.reveal--show {
    opacity: 1;
    transform: translateX(0);
}

.reveal--slide-right.reveal--hidden {
    opacity: 0;
    transform: translateX(60px);
}

.reveal--slide-right.reveal--show {
    opacity: 1;
    transform: translateX(0);
}

/* Bottom-right variant (default for cards) */
.reveal--bottom-right.reveal--hidden {
    opacity: 0;
    transform: translate(40px, 40px);
}

.reveal--bottom-right.reveal--show {
    opacity: 1;
    transform: translate(0, 0);
}

/* ============================================
   Reduced Motion - Instant visibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal--hidden,
    .reveal--show,
    .bs-card.reveal--hidden,
    .bs-card.reveal--show,
    .bs-header.reveal--hidden,
    .bs-header.reveal--show {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        pointer-events: auto !important;
    }

    .bs-card:hover {
        transform: none !important;
    }

    .bs-button,
    .bs-post-image img,
    .bs-read-more svg,
    .bs-tag::before {
        animation: none;
        transition: none;
    }
}

/* ============================================
   No-JS Fallback
   ============================================ */
.no-js .reveal--hidden {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* ============================================
   Responsive Styles
   ============================================ */
@media (max-width: 1024px) {
    /* Disable sticky on tablet */
    .bs-section[data-header-layout="left"] .bs-wrapper {
        display: flex;
        flex-direction: column;
        gap: 40px;
    }

    .bs-section[data-header-layout="left"] .bs-header {
        position: relative;
        top: 0;
        max-height: none;
        text-align: center;
    }

    .bs-section[data-header-layout="left"] .bs-decoration {
        margin: 0 auto 20px;
    }

    .bs-section[data-header-layout="left"] .bs-header-content {
        align-items: center;
    }

    .bs-section[data-header-layout="left"] .bs-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bs-title {
        font-size: 32px;
    }

    .bs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .bs-title {
        font-size: 28px;
    }

    .bs-description {
        font-size: 15px;
    }

    .bs-grid,
    .bs-section[data-header-layout="left"] .bs-grid {
        grid-template-columns: 1fr;
    }

    .bs-post-title {
        font-size: 18px;
    }

    .bs-post-image {
        height: 180px;
        margin: 12px 12px 0;
    }

    .bs-text-content {
        padding: 16px;
    }

    /* Reduce animation distance on mobile */
    .bs-card.reveal--hidden {
        transform: translate(30px, 30px) scale(0.98);
    }
}

@media (max-width: 480px) {
    .bs-title {
        font-size: 24px;
    }

    .bs-tag {
        padding: 10px 18px;
        font-size: 12px;
    }

    .bs-button {
        padding: 12px 24px;
        font-size: 14px;
    }

    .bs-post-image {
        height: 160px;
        border-radius: 12px;
    }

    .bs-card {
        border-radius: 20px;
    }

    .bs-post-meta {
        font-size: 12px;
        gap: 12px;
    }

    /* Minimal animation on small screens */
    .bs-card.reveal--hidden {
        transform: translate(20px, 20px);
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .bs-section[data-header-layout="left"] .bs-wrapper {
        display: block;
    }

    .bs-section[data-header-layout="left"] .bs-header {
        position: relative;
    }

    .bs-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .bs-card,
    .bs-card.reveal--hidden,
    .bs-card.reveal--show {
        opacity: 1 !important;
        transform: none !important;
    }

    .bs-post-image img {
        transform: none;
    }
}
