/* Blog page styling - follows the design system from offers.css */

/* Hero section - consistent with offers page */
.blog-hero {
    padding-top: 120px;
    padding-bottom: 60px;
    min-height: auto;
}

.blog-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 60px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.blog-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-bottom: 48px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

/* Blog grid layout */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 32px;
    padding-bottom: 60px;
}

/* Blog card component */
.blog-card {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    cursor: pointer;
    height: 100%;
}

.blog-card-inner {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    border: 1px solid rgba(66, 133, 244, 0.18);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.4s ease, 
                border-color 0.3s ease, 
                opacity 0.4s ease;
    position: relative;
    height: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

[data-color-scheme="dark"] .blog-card-inner {
    background: linear-gradient(145deg, rgba(17, 25, 40, 0.9), rgba(17, 25, 40, 0.7));
    border-color: rgba(66, 133, 244, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.blog-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.blog-card:hover .blog-card-inner {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(66, 133, 244, 0.2), 
                0 8px 16px rgba(0, 0, 0, 0.1), 
                inset 0 1px 0 rgba(255, 255, 255, 0.6), 
                0 0 0 1px rgba(66, 133, 244, 0.1), 
                0 0 40px rgba(66, 133, 244, 0.1);
    border-color: rgba(66, 133, 244, 0.5);
}

[data-color-scheme="dark"] .blog-card:hover .blog-card-inner {
    background: linear-gradient(145deg, rgba(17, 25, 40, 0.95), rgba(17, 25, 40, 0.8));
    box-shadow: 0 20px 40px rgba(50, 184, 198, 0.3), 
                0 8px 16px rgba(0, 0, 0, 0.2), 
                0 0 0 1px rgba(50, 184, 198, 0.15), 
                0 0 40px rgba(50, 184, 198, 0.15);
    border-color: rgba(50, 184, 198, 0.4);
}

/* Cover image with gradient overlay */
.blog-cover {
    width: 100%;
    height: calc(100% + 2px);
    object-fit: cover;
    position: relative;
    display: block;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.1), rgba(52, 168, 83, 0.1));
    transform: translateY(-1px) translateZ(0) scale(1.002);
    transform-origin: center;
    transition: transform 0.5s ease;
    backface-visibility: hidden;
}

.blog-cover-wrapper {
    position: relative;
    overflow: hidden;
    height: 200px;
    isolation: isolate;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.1), rgba(52, 168, 83, 0.1));
}

.blog-cover-wrapper::after {
    content: '';
    position: absolute;
    inset: 0 0 -1px;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.6));
    pointer-events: none;
    z-index: 1;
}

.blog-card:hover .blog-cover {
    transform: translateY(-1px) translateZ(0) scale(1.05);
}

/* Blog content area */
.blog-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

/* Category badge on card */
.blog-category {
    display: inline-block;
    align-self: flex-start;
    padding: 6px 14px;
    border-radius: 100px;
    background: rgba(var(--offer-color-primary-rgb), 0.1);
    color: var(--offer-color-primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(var(--offer-color-primary-rgb), 0.2);
    transition: all 0.3s ease;
}

.blog-card:hover .blog-category {
    background: rgba(var(--offer-color-primary-rgb), 0.15);
    transform: scale(1.05);
}

/* Blog title */
.blog-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--offer-color-text);
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin: 0;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card:hover .blog-title {
    color: var(--offer-color-primary);
}

/* Blog excerpt */
.blog-excerpt {
    font-size: 15px;
    color: var(--offer-color-text-secondary);
    line-height: 1.6;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Blog metadata (author, date, read time) */
.blog-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--offer-color-text-secondary);
    padding-top: 12px;
    border-top: 1px solid rgba(var(--offer-color-gray-400-rgb), 0.15);
}

.blog-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.blog-meta-item .material-symbols-outlined {
    font-size: 16px;
    opacity: 0.7;
}

/* Blog tags on card */
.blog-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.blog-tag {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(var(--offer-color-gray-400-rgb), 0.08);
    color: var(--offer-color-text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
}

.blog-card:hover .blog-tag {
    background: rgba(var(--offer-color-primary-rgb), 0.1);
    color: var(--offer-color-primary);
}

/* Read button */
.btn-read {
    margin-top: auto;
    padding: 10px 24px;
    font-size: 14px;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.btn-read .material-symbols-outlined {
    font-size: 18px;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-card:hover .btn-read .material-symbols-outlined {
    transform: translateX(4px);
}

/* Blog detail modal */
.blog-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.blog-modal-container {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(24px);
    border: 1px solid rgba(66, 133, 244, 0.2);
    border-radius: 32px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.15), 
                0 20px 40px rgba(66, 133, 244, 0.1), 
                inset 0 1px 0 rgba(255, 255, 255, 0.9), 
                0 0 0 1px rgba(66, 133, 244, 0.05);
    transform: scale(0.8) translateY(40px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.blog-modal-overlay.active .blog-modal-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

[data-color-scheme="dark"] .blog-modal-container {
    background: linear-gradient(145deg, rgba(17, 25, 40, 0.95), rgba(17, 25, 40, 0.9));
    border-color: rgba(66, 133, 244, 0.3);
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 
                0 16px 32px rgba(66, 133, 244, 0.2), 
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.blog-modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: inherit;
    clip-path: inset(0 round 32px);
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--offer-color-primary-rgb), 0.3) transparent;
}

.blog-modal-content::-webkit-scrollbar {
    width: 8px;
}

.blog-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.blog-modal-content::-webkit-scrollbar-thumb {
    background: rgba(var(--offer-color-primary-rgb), 0.3);
    border-radius: 4px;
}

.blog-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--offer-color-primary-rgb), 0.5);
}

/* Modal header */
.blog-modal-header {
    padding: 48px 48px 32px;
    border-bottom: 1px solid rgba(var(--offer-color-gray-400-rgb), 0.1);
    background: linear-gradient(to bottom, rgba(var(--offer-color-primary-rgb), 0.05), transparent);
}

.blog-modal-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
    color: var(--offer-color-text);
    line-height: 1.2;
}

.blog-modal-meta {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 14px;
    color: var(--offer-color-text-secondary);
    margin-top: 16px;
}

.blog-modal-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.blog-modal-meta-item .material-symbols-outlined {
    font-size: 18px;
    color: var(--offer-color-primary);
}

/* Modal body with blog content */
.blog-modal-body {
    padding: 40px 48px;
}

.blog-full-content {
    font-size: 18px;
    line-height: 1.8;
    color: var(--offer-color-text);
}

.blog-full-content h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 32px 0 16px;
    color: var(--offer-color-text);
}

.blog-full-content p {
    margin-bottom: 20px;
}

.blog-full-content ul,
.blog-full-content ol {
    margin: 20px 0;
    padding-left: 24px;
}

.blog-full-content li {
    margin-bottom: 12px;
    line-height: 1.7;
}

.blog-full-content code {
    background: rgba(var(--offer-color-primary-rgb), 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: var(--offer-color-primary);
}

.blog-full-content strong {
    font-weight: 700;
    color: var(--offer-color-text);
}

/* Modal footer */
.blog-modal-footer {
    padding: 32px 48px 48px;
    border-top: 1px solid rgba(var(--offer-color-gray-400-rgb), 0.1);
    background: var(--offer-color-surface);
    display: flex;
    gap: 16px;
}

/* Share buttons in footer */
.blog-share-section {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.blog-share-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--offer-color-text-secondary);
}

.blog-share-buttons {
    display: flex;
    gap: 8px;
}

.btn-share {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(var(--offer-color-gray-400-rgb), 0.2);
    background: rgba(255, 255, 255, 0.5);
    color: var(--offer-color-text);
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-share .share-icon,
.btn-share .material-symbols-outlined {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.btn-share .share-icon {
    fill: currentColor;
}

.btn-share .material-symbols-outlined {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

[data-color-scheme="dark"] .btn-share {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #c9d7ee;
}

.btn-share:hover {
    transform: translateY(-2px);
    background: var(--offer-color-primary);
    color: white;
    border-color: var(--offer-color-primary);
}

[data-color-scheme="dark"] .btn-share:hover {
    color: #141218;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .blog-hero {
        padding-top: 76px;
        padding-bottom: 44px;
    }

    .blog-hero .hero-background {
        inset: 0 0 auto;
        height: min(560px, 72vh);
        overflow: hidden;
        mask-image: linear-gradient(to bottom, black 0%, black 78%, transparent 100%);
    }

    .blog-hero>.container {
        position: relative;
        z-index: 1;
    }

    .blog-hero .orb-1 {
        top: -58px;
        left: -64px;
    }

    .blog-hero .orb-3 {
        top: 230px;
        right: -76px;
        bottom: auto;
    }

    .blog-header {
        margin-bottom: 34px;
    }

    .blog-controls {
        gap: 18px;
        margin-bottom: 34px;
        width: 100%;
        max-width: 660px;
        margin-left: auto;
        margin-right: auto;
    }

    .blog-controls .search-bar,
    .blog-controls .filter-tags {
        width: 100%;
    }

    .blog-controls .filter-tags {
        justify-content: center;
        gap: 10px;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        padding-bottom: 36px;
    }

    .blog-card-inner {
        border-radius: 20px;
    }

    .blog-content {
        padding: 20px;
        gap: 14px;
    }

    .blog-title {
        font-size: 20px;
    }

    .blog-meta {
        flex-wrap: wrap;
        gap: 8px 14px;
    }

    .blog-modal-header {
        padding: 32px 24px;
    }

    .blog-modal-body {
        padding: 24px;
    }

    .blog-modal-footer {
        padding: 24px;
        flex-direction: column;
    }

    .blog-modal-title {
        font-size: 28px;
    }

    .blog-full-content {
        font-size: 16px;
    }

    .blog-full-content h3 {
        font-size: 20px;
    }

    .blog-modal-container {
        width: 95%;
        max-height: 95vh;
    }

    .blog-cover-wrapper {
        height: 180px;
    }

    .blog-cover {
        height: calc(100% + 2px);
    }

}

@media (max-width: 480px) {
    .blog-hero {
        padding-top: 58px;
        padding-bottom: 38px;
    }

    .blog-hero .hero-background {
        height: 520px;
    }

    .blog-hero .orb-3 {
        top: 250px;
    }

    .blog-content {
        padding: 18px;
    }

    .blog-title {
        font-size: 19px;
    }

    .blog-controls .filter-tag {
        padding: 9px 18px;
    }
}

/* Reduced motion preference for accessibility and performance */
@media (prefers-reduced-motion: reduce) {
    .blog-header,
    .blog-controls,
    .blog-card {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .blog-card.is-visible {
        opacity: 1;
        transform: none;
    }
    
    .blog-card:hover .blog-card-inner,
    .blog-card:hover .blog-cover {
        transform: none;
    }
    
    .blog-modal-container {
        animation: none;
    }
}
