/* Blog Global Component - Modern UX/UI Design */
/* Enhanced with glassmorphism, micro-interactions, and accessibility */

/* CSS Custom Properties for theming */
:root {
    --blog-primary-color: #3E7B51;
    --blog-secondary-color: #333231;
    --blog-accent-color: #EFEEE5;
    --blog-text-primary: #333231;
    --blog-text-secondary: #6E6C6A;
    --blog-text-muted: #9E9C9A;
    --blog-background: #FFFFFF;
    --blog-surface: #F9F8EF;
    --blog-border: rgba(51, 50, 49, 0.1);
    --blog-shadow-light: 0 2px 8px rgba(0, 0, 0, 0.04);
    --blog-shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.08);
    --blog-shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.12);
    --blog-radius-small: 8px;
    --blog-radius-medium: 12px;
    --blog-radius-large: 16px;
    --blog-transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --blog-transition-medium: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --blog-transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fallbacks for older browsers */
.blog-global-section {
    background: #ffffff;
    /* Fallback */
    background: var(--blog-background, #ffffff);
}

.blog-heading {
    color: #111827;
    /* Fallback */
    color: var(--blog-text-primary, #111827);
}

.blog-card {
    background: #fff;
    /* Fallback */
    background: var(--blog-background, #fff);
    transition: all 0.3s ease;
    /* Fallback */
    transition: var(--blog-transition-medium, all 0.3s ease);
}

/* Screen reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Blog Global Section */
.blog-global-section {
    padding: 40px 0;
    background: #ffffff;
    position: relative;
    width: 100%;
    margin: 0;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: hidden;
}

/* Main Container */
.blog-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex !important;
    flex-direction: column;
    gap: 40px;
    position: relative;
    z-index: 1;
    overflow: visible;
    visibility: visible !important;
    opacity: 1 !important;
    box-sizing: border-box;
}

/* Blog Header */
.blog-header {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: flex-end;
    gap: 40px;
    flex-wrap: wrap;
}

.blog-header-content {
    flex: 1;
    min-width: 300px;
}

/* Blog Heading */
.blog-heading {
    font-family: 'Fira Sans', sans-serif;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0 0 16px 0;
    color: #111827;
    position: relative;
}

.blog-heading-accent {
    position: relative;
    display: inline-block;
    color: #3E7B51;
}

.blog-heading-accent::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--blog-primary-color), transparent);
    border-radius: 2px;
    animation: underlineGrow 1s ease-out 0.5s both;
}

.blog-heading-main {
    color: var(--blog-text-primary);
    -webkit-text-fill-color: var(--blog-text-primary);
}

/* Blog Subtitle */
.blog-subtitle {
    font-family: 'Fira Sans', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: #6b7280;
    margin: 0;
    max-width: 500px;
}

/* Blog Controls */
.blog-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Navigation Buttons */
.blog-navigation-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.blog-nav-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #EFEEE5;
    border: none;
    border-radius: 12px;
    color: #333231;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.blog-nav-button:hover {
    background: #3E7B51;
    color: #ffffff;
    transform: translateY(-1px);
}

.blog-nav-button:focus {
    outline: none;
}

.blog-nav-button:active {
    transform: translateY(0);
}

.blog-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.blog-nav-button:disabled:hover {
    background: #EFEEE5;
    color: #333231;
    transform: none;
}

.blog-nav-button svg {
    transition: transform 0.2s ease;
}

.blog-nav-button:hover svg {
    transform: scale(1.1);
}

/* View All Button */
.blog-view-all-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: #EFEEE5;
    color: #333231;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.28px;
}

.blog-view-all-button:hover {
    background: #3E7B51;
    transform: translateY(-2px);
    color: #EFEEE5;
}

.blog-view-all-button:focus {
    outline: none;
}

.blog-view-all-button:active {
    transform: translateY(0);
}

.blog-view-all-text {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.blog-view-all-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    transition: transform var(--blog-transition-fast);
}

.blog-view-all-button:hover .blog-view-all-icon {
    transform: translateX(4px);
}

/* Ripple Effect */
.blog-view-all-ripple,
.blog-card-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(62, 123, 81, 0.2);
    transform: scale(0);
    pointer-events: none;
    z-index: 1;
}

.blog-ripple-active {
    animation: ripple 0.6s ease-out;
}

/* Blog Posts Container */
.blog-posts-container {
    display: flex !important;
    gap: 20px;
    width: 100%;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    margin: 0;
    box-sizing: border-box;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.blog-posts-container::-webkit-scrollbar {
    display: none;
}

/* Blog Card */
.blog-card {
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    transition: var(--blog-transition-medium);
    display: flex;
    flex-direction: column;
    width: 300px;
    min-width: 300px;
    height: auto;
    max-height: none;
    flex-shrink: 0;
    margin: 0;
    position: relative;
    box-sizing: border-box;
    contain: layout style paint;
    /* Improve performance and contain layout */
    cursor: pointer;
}

.blog-card-image {
    width: 100%;
    height: 250px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: var(--blog-transition-medium);
    flex-shrink: 0;
    display: block;
    position: relative;
}

/* Blog card specific images */
.blog-card-image-1 {
    background-image: url('../../assets/images/blog/blog-global/blog-global-1.png');
}

.blog-card-image-2 {
    background-image: url('../../assets/images/blog/blog-global/blog-global-2.png');
}

.blog-card-image-3 {
    background-image: url('../../assets/images/blog/blog-global/blog-global-3.png');
}

.blog-card-image-4 {
    background-image: url('../../assets/images/blog/blog-global/blog-global-4.png');
}

.blog-card-image-5 {
    background-image: url('../../assets/images/blog/blog-global/blog-global-5.png');
}

.blog-card-content {
    padding-top: 20px;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 8px;
    min-height: 0;
    box-sizing: border-box;
    height: auto;
    position: relative;
    contain: content;
}

.blog-card-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    flex-shrink: 0;
    /* Prevents header from shrinking */
}

.blog-card-title {
    font-family: 'Fira Sans', sans-serif;
    font-size: 24px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--blog-text-primary);
    margin: 0;
    letter-spacing: -0.24px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.8em;
    min-height: 1.4em;
    flex-shrink: 0;
}

.blog-card-accent {
    width: 40px;
    height: 3px;
    border-radius: 2px;
    transition: width var(--blog-transition-medium);
}

.blog-card:hover .blog-card-accent {
    width: 60px;
}

.blog-card-description {
    font-family: 'Fira Sans', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: #6E6C6A;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 0;
    margin-bottom: 0;
    max-height: 4.5em;
    flex: 0 0 auto;
    contain: content;
}

/* Blog Card Footer */
.blog-card-footer {
    margin-top: 0;
    padding-top: 0;
    flex-shrink: 0;
    position: relative;
    bottom: 0;
    right: 0;
    margin: 0;
}

.blog-card-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: #F9F8EF;
    color: #333231;
    border: none;
    border-radius: 12px;
    font-family: 'Fira Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    width: auto;
    justify-content: center;
    box-sizing: border-box;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.28px;
}



.blog-card-button:focus {
    outline: none;
}

.blog-card-button-text {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.blog-card-button-icon {
    transition: transform var(--blog-transition-fast);
    opacity: 1;
    color: currentColor;
}

.blog-card-button:hover .blog-card-button-icon {
    transform: translateX(4px);
    opacity: 1;
}

/* Loading State - Hidden by default */
.blog-loading {
    display: none !important;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px;
}

.blog-loading.blog-loading-active {
    display: none !important;
}

.blog-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--blog-accent-color);
    border-top: 3px solid var(--blog-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.blog-loading-text {
    font-family: 'Fira Sans', sans-serif;
    font-size: 14px;
    color: var(--blog-text-secondary);
    font-weight: 500;
}

/* Animations */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes underlineGrow {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design - World-Class UX/UI Optimization */

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .blog-container {
        max-width: 1200px;
    }

    .blog-card {
        width: 300px;
        min-width: 300px;
    }
}

/* Desktop (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .blog-container {
        max-width: 1100px;
        padding: 0 30px;
    }

    .blog-card {
        width: 280px;
        min-width: 280px;
    }
}

/* Large Tablet (993px - 1199px) */
@media (min-width: 993px) and (max-width: 1199px) {
    .blog-container {
        padding: 0 24px;
        max-width: 950px;
    }

    .blog-posts-container {
        gap: 18px;
        padding: 0;
    }

    .blog-card {
        width: 270px;
        min-width: 270px;
        height: auto;
    }

    .blog-card-image {
        height: 220px;
    }

    .blog-card-content {
        padding-top: 16px;
    }
}

/* Medium Tablet (769px - 992px) */
@media (min-width: 769px) and (max-width: 992px) {
    .blog-global-section {
        padding: 36px 0;
    }

    .blog-container {
        padding: 0 20px;
        gap: 30px;
    }

    .blog-header {
        gap: 20px;
    }

    .blog-heading {
        font-size: clamp(26px, 4.5vw, 36px);
    }

    .blog-subtitle {
        font-size: 15px;
        max-width: 450px;
    }

    .blog-posts-container {
        gap: 16px;
        padding: 0;
    }

    .blog-card {
        width: 260px;
        min-width: 260px;
        height: auto;
    }

    .blog-card-image {
        height: 200px;
    }

    .blog-card-content {
        padding-top: 16px;
        padding-bottom: 0;
    }

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

    .blog-card-description {
        font-size: 13px;
    }

    .blog-view-all-button {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Small Tablet (601px - 768px) */
@media (min-width: 601px) and (max-width: 768px) {
    .blog-global-section {
        padding: 32px 0;
    }

    .blog-container {
        padding: 0 20px;
        gap: 24px;
    }

    .blog-header {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 16px;
    }

    .blog-header-content {
        width: 100%;
        min-width: auto;
    }

    .blog-controls {
        width: 100%;
        justify-content: space-between;
    }

    .blog-heading {
        font-size: clamp(24px, 5vw, 32px);
        margin-bottom: 10px;
    }

    .blog-subtitle {
        font-size: 14px;
        max-width: 100%;
    }

    .blog-posts-container {
        gap: 14px;
        padding: 0;
    }

    .blog-card {
        width: 240px;
        min-width: 240px;
        height: auto;
        border-radius: 0;
        box-shadow: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .blog-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    }

    .blog-card:hover .blog-card-button {
        background: #3E7B51;
        color: white;
        transform: translateY(-1px);
    }

    .blog-card-image {
        height: 180px;
        border-radius: 0;
    }

    .blog-card-content {
        padding-top: 14px;
        padding-bottom: 0;
    }

    .blog-card-title {
        font-size: 18px;
        line-height: 1.4;
    }

    .blog-card-description {
        font-size: 12px;
        line-height: 1.5;
        -webkit-line-clamp: 3;
    }

    .blog-card-button {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 10px;
        background: #F9F8EF;
        color: #333231;
        width: auto;
    }
}

/* Large Mobile (481px - 600px) */
@media (min-width: 481px) and (max-width: 600px) {
    .blog-global-section {
        padding: 28px 0;
        background: #ffffff;
    }

    .blog-container {
        padding: 0 16px;
        gap: 20px;
    }

    .blog-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 14px;
    }

    .blog-header-content {
        width: 100%;
        min-width: auto;
    }

    .blog-controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }

    .blog-navigation-buttons {
        order: 2;
    }

    .blog-view-all-button {
        order: 1;
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 12px;
    }

    .blog-heading {
        font-size: clamp(22px, 6vw, 28px);
        margin-bottom: 8px;
    }

    .blog-subtitle {
        font-size: 13px;
        line-height: 1.5;
        max-width: 100%;
    }

    .blog-posts-container {
        gap: 12px;
        padding: 0;
        scroll-snap-type: x mandatory;
    }

    .blog-card {
        width: 220px;
        min-width: 220px;
        height: auto;
        border-radius: 0;
        box-shadow: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        scroll-snap-align: start;
        background: #ffffff;
        cursor: pointer;
    }

    .blog-card:hover {
        transform: translateY(-4px);
    }

    .blog-card:hover .blog-card-button {
        background: #3E7B51;
        color: white;
    }

    .blog-card-image {
        height: 160px;
        border-radius: 0;
        background-size: cover;
        background-position: center;
    }

    .blog-card-content {
        padding-top: 12px;
        padding-bottom: 0;
        gap: 6px;
    }

    .blog-card-title {
        font-size: 16px;
        line-height: 1.4;
        font-weight: 500;
    }

    .blog-card-description {
        font-size: 12px;
        line-height: 1.5;
        -webkit-line-clamp: 3;
    }

    .blog-card-button {
        padding: 6px 10px;
        font-size: 12px;
        border-radius: 10px;
        font-weight: 500;
        background: #F9F8EF;
        color: #333231;
        width: auto;
    }
}

/* Small Mobile (320px - 480px) */
@media (max-width: 480px) {
    .blog-global-section {
        padding: 24px 0;
        background: #ffffff;
    }

    .blog-container {
        padding: 0 12px;
        gap: 18px;
    }

    .blog-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    .blog-header-content {
        width: 100%;
        min-width: auto;
    }

    .blog-controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .blog-navigation-buttons {
        order: 2;
        gap: 6px;
    }

    .blog-nav-button {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        background: #EFEEE5;
        border: none;
    }

    .blog-nav-button svg {
        width: 14px;
        height: 14px;
    }

    .blog-view-all-button {
        order: 1;
        padding: 8px 14px;
        font-size: 12px;
        border-radius: 10px;
        background: #EFEEE5;
    }

    .blog-heading {
        font-size: clamp(20px, 7vw, 26px);
        margin-bottom: 6px;
        font-weight: 600;
    }

    .blog-subtitle {
        font-size: 12px;
        line-height: 1.5;
        max-width: 100%;
    }

    .blog-posts-container {
        gap: 10px;
        padding: 0;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .blog-card {
        width: 200px;
        min-width: 200px;
        height: auto;
        border-radius: 0;
        box-shadow: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        scroll-snap-align: start;
        background: #ffffff;
        overflow: hidden;
        cursor: pointer;
    }

    .blog-card:hover {
        transform: translateY(-4px);
    }

    .blog-card:hover .blog-card-button {
        background: #3E7B51;
        color: white;
    }

    .blog-card-image {
        height: 130px;
        border-radius: 0;
        background-size: cover;
        background-position: center;
    }

    .blog-card-content {
        padding-top: 10px;
        padding-bottom: 0;
        gap: 6px;
    }

    .blog-card-header {
        gap: 6px;
    }

    .blog-card-title {
        font-size: 14px;
        line-height: 1.4;
        font-weight: 500;
    }

    .blog-card-accent {
        width: 24px;
        height: 2px;
    }

    .blog-card:hover .blog-card-accent {
        width: 36px;
    }

    .blog-card-description {
        font-size: 11px;
        line-height: 1.5;
        -webkit-line-clamp: 2;
        max-height: 3em;
    }

    .blog-card-footer {
        bottom: 0;
        left: 0;
        right: 0;
    }

    .blog-card-button {
        padding: 5px 8px;
        font-size: 11px;
        border-radius: 8px;
        font-weight: 500;
        background: #F9F8EF;
        color: #333231;
        width: auto;
    }
}

/* Extra Small Mobile (320px and below) */
@media (max-width: 320px) {
    .blog-container {
        padding: 0 8px;
    }

    .blog-card {
        width: 180px;
        min-width: 180px;
        height: auto;
    }

    .blog-card-image {
        height: 110px;
    }

    .blog-card-content {
        padding-top: 8px;
        padding-bottom: 0;
    }

    .blog-card-title {
        font-size: 13px;
    }

    .blog-card-description {
        font-size: 10px;
    }

    .blog-card-button {
        padding: 4px 8px;
        font-size: 10px;
        border-radius: 8px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .blog-card {
        box-shadow: none;
    }

    .blog-card:hover {
        box-shadow: none;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {

    .blog-card,
    .blog-card-button,
    .blog-nav-button,
    .blog-view-all-button {
        transition: none;
    }

    .blog-card:hover {
        transform: none;
    }

    .blog-heading-accent::after {
        animation: none;
        width: 100%;
    }
}

/* Focus Visible Support */
@supports selector(:focus-visible) {
    .blog-card-button:focus {
        outline: none;
    }

    .blog-nav-button:focus {
        outline: none;
    }
}

/* Dark mode için özel override: Blog Global daima beyaz zemin kullanacak */
@media (prefers-color-scheme: dark) {
    .blog-global-section {
        background: #ffffff !important;
    }

    .blog-card {
        background: #ffffff !important;
        border-color: rgba(0, 0, 0, 0.1) !important;
    }

    .blog-heading-main {
        color: #333231 !important;
        -webkit-text-fill-color: #333231 !important;
    }
}