/* Blog Page Styles - Refactored for better organization */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500;600;700;800&display=swap');

/* CSS Custom Properties - Centralized theme variables */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #161616;
    --border-primary: #2a2a2a;
    --border-secondary: #333333;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #666666;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --mac-titlebar-height: 28px;
    --mac-button-size: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --primary-color: #1a1a1a;
    --secondary-color: #2d2d2d;
    --accent-color: #4a9eff;
    --text-color: #ffffff;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 30px rgba(0, 0, 0, 0.3);
    --border-radius: 8px;
}

/* Base Reset */
* {
    box-sizing: border-box;
}

/* Cross-browser compatibility fixes */
.articles-grid {
    /* Standard properties for compatibility */
    column-gap: 2rem;
    row-gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    /* Firefox grid support */
    -moz-column-gap: 2rem;
    -moz-row-gap: 2rem;
    /* Webkit grid support */
    -webkit-grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    /* IE11 fallback */
    display: -ms-grid;
    -ms-grid-columns: 1fr 2rem 1fr;
}

/* Safari specific fixes */
@supports (-webkit-appearance: none) {
    .post {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #1e1e1e;
    padding: 20px;
    margin: 0;
    line-height: 1.6;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.main-header {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    position: sticky;
    top: var(--mac-titlebar-height);
    z-index: 1000;
    box-shadow: var(--shadow-light);
    height: 72px;
    transition: var(--transition);
}


.nav-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 1;
    gap: 2rem;
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-left {
    justify-content: flex-end;
}

.nav-right {
    justify-content: flex-start;
}

.logo-link {
    display: inline-block;
    text-decoration: none;
    position: relative;
    z-index: 1;
}

.logo {
    height: 40px;
    width: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
}

.logo-link:hover .logo {
    transform: scale(1.1);
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    background: linear-gradient(135deg, var(--accent-color), #64b5f6);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.main-header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.container {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    background: transparent;
    border-radius: var(--radius-md);
    margin-top: 0;
    margin-bottom: 2rem;
    box-shadow: none;
}

/* Mac Window Container */
.mac-window {
    width: 100%;
    max-width: 1400px;
    background: #2a2a2a;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: visible;
    position: relative;
    margin: 0 auto;
}

/* Mac Titlebar */
.mac-titlebar {
    height: var(--mac-titlebar-height);
    background: linear-gradient(180deg, #3c3c3c 0%, #2a2a2a 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 1001;
    -webkit-user-select: none;
    user-select: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px 12px 0 0;
}

/* Mac Buttons Container */
.mac-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Mac Action Buttons */
.mac-button {
    width: var(--mac-button-size);
    height: var(--mac-button-size);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    border: 0.5px solid rgba(0, 0, 0, 0.2);
}

.mac-button.close {
    background: linear-gradient(135deg, #ff5f57 0%, #ff4444 100%);
}

.mac-button.minimize {
    background: linear-gradient(135deg, #ffbd2e 0%, #ffaa00 100%);
}

.mac-button.maximize {
    background: linear-gradient(135deg, #28ca42 0%, #20a034 100%);
}

/* Mac Button Hover Effects */
.mac-button:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mac-button.close:hover::after {
    content: '×';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #8b0000;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
}

.mac-button.minimize:hover::after {
    content: '−';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #8b4500;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
}

.mac-button.maximize:hover::after {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #0f5132;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
}

/* Mac Title */
.mac-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 200px);
}

/* Mac Content Area */
.mac-content {
    background: #2a2a2a;
    min-height: calc(100vh - 80px);
    position: relative;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    padding: 1.5rem 0;
    margin: 0 0 2rem 0;
    color: var(--text-primary);
    text-align: center;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 2rem;
    right: 2rem;
    height: 2px;
    background: #1793D1;
    border-radius: 1px;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    padding: 0 2rem 6rem 2rem;
    margin-bottom: 4rem;
}

.blog-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    transition: all 0.3s ease;
}

.blog-section:hover {
    border-color: var(--border-secondary);
    box-shadow: var(--shadow-lg);
}

.blog-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    padding: 1.5rem 2rem;
    margin: 0;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    color: var(--text-primary);
    position: relative;
}

.blog-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 2rem;
    right: 2rem;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 1px;
}

.content {
    overflow-y: auto;
    padding: 2rem;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--border-secondary) var(--bg-tertiary);
}

.content::-webkit-scrollbar {
    width: 6px;
}
.content::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}
.content::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 3px;
    transition: background 0.2s ease;
}
.content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}


.content .post {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.post {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.content .post::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.content .post:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--border-secondary);
}

.post:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: var(--border-secondary);
}

.content .post:hover::before {
    opacity: 0.02;
}

.post-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-primary);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.content .post:hover .post-image {
    transform: scale(1.02);
}

.post-content {
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.post-content h3 {
    font-size: 1.25rem;
    margin: 0 0 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.post-date {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: block;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-preview {
    font-size: 0.9375rem;
    text-align: justify;
    line-height: 1.6;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1.5rem;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background:  #1793D1;
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.read-more::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.read-more:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.read-more:hover::before {
    left: 100%;
}

.read-more:active {
    transform: translateY(0);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.post-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Mobile Responsive Design for Mac Window */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .mac-window {
        border-radius: 8px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    
    .mac-titlebar {
        height: 32px;
        padding: 0 12px;
        border-radius: 8px 8px 0 0;
    }
    
    .mac-button {
        width: 14px;
        height: 14px;
    }
    
    .mac-title {
        font-size: 12px;
        max-width: calc(100% - 120px);
    }
    
    .mac-content {
        min-height: calc(100vh - 60px);
        border-radius: 0 0 8px 8px;
    }
    
    .main-header {
        padding: 0.5rem 1rem;
    }
    
    .nav-container {
        max-width: 100%;
        gap: 1rem;
    }
    
    .nav-left,
    .nav-right {
        gap: 0.5rem;
    }
    
    .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
    
    .logo {
        height: 50px;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1.5rem 4rem 1.5rem;
        margin-bottom: 3rem;
    }
    
    h2 {
        font-size: 1.25rem;
        padding: 1rem 0;
        margin-bottom: 1.5rem;
    }
    
    h2::after {
        left: 1.5rem;
        right: 1.5rem;
    }
    
    .post {
        margin-bottom: 1.5rem;
    }
    
    footer {
        margin-top: 0rem;
        padding: 1rem;
    }
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .mac-window {
        border-radius: 6px;
    }
    
    .mac-titlebar {
        height: 28px;
        padding: 0 8px;
    }
    
    .mac-buttons {
        gap: 6px;
    }
    
    .mac-button {
        width: 12px;
        height: 12px;
    }
    
    .mac-title {
        font-size: 11px;
        max-width: calc(100% - 100px);
    }
    
    .main-header {
        padding: 0.8rem;
    }
    
    .container {
        padding: 0.8rem;
    }
    
    .articles-grid {
        padding: 0 1rem 3rem 1rem;
        gap: 1rem;
        margin-bottom: 2rem;
    }
    
    h2::after {
        left: 1rem;
        right: 1rem;
    }
    
    .post {
        margin-bottom: 1rem;
    }
    
    .post-image {
        height: 160px;
    }
    
    .post-content {
        padding: 1.25rem;
    }
    
    .post-content h3 {
        font-size: 1.125rem;
    }
    
    .post-preview {
        -webkit-line-clamp: 2;
        line-clamp: 2;
        margin-bottom: 1rem;
    }
    
    .read-more {
        padding: 0.625rem 1.25rem;
        font-size: 0.8125rem;
    }
    
    footer {
        margin-top: 2rem;
        padding: 0.8rem;
    }
}

/* Modal Styles */
.hidden {
    display: none !important;
}

#modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#modal-backdrop:not(.hidden) {
    opacity: 1;
}

#article-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-xl);
    z-index: 1001;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    box-shadow: var(--shadow-xl);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#article-modal:not(.hidden) {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-content {
    padding: 2.5rem 3rem;
    text-align: justify;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-secondary) var(--bg-tertiary);
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 3px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.close-button:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-color: var(--border-secondary);
    transform: scale(1.1);
}

#modal-title {
    font-size: 2rem;
    margin: 0 0 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

#modal-date {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 1.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#modal-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-primary);
}

#modal-text {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

#modal-text p {
    margin-bottom: 1.5rem;
}

#modal-text p:last-child {
    margin-bottom: 0;
}

.error {
    color: #ef4444;
    text-align: center;
    padding: 2rem;
    font-weight: 500;
}

footer {
    color: var(--text-secondary);
    margin-top: 4rem;
    padding: 1rem;
    text-align: center;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
    clear: both;
}

/* Tablet and medium screen optimizations */
@media (min-width: 769px) and (max-width: 1199px) {
    .articles-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
        padding: 0 1.5rem 5rem 1.5rem;
        margin-bottom: 3rem;
    }
    
    .post {
        margin-bottom: 1.5rem;
    }
    
    footer {
        margin-top: 3rem;
    }
}

/* Large screen optimizations */
@media (min-width: 1200px) {
    .articles-grid {
        padding: 0 3rem 6rem 3rem;
        margin-bottom: 4rem;
    }
    
    .post {
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    #article-modal {
        width: 95%;
        max-width: 95vw;
        max-height: 90vh;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.9);
        margin: 0;
    }
    
    #article-modal:not(.hidden) {
        transform: translate(-50%, -50%) scale(1);
    }
    
    .modal-content {
        padding: 2rem 1.5rem 1.5rem;
        overflow-y: auto;
        max-height: calc(90vh - 2rem);
    }
    
    #modal-title {
        font-size: 1.5rem;
    }
    
    .close-button {
        top: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
        z-index: 20;
    }
}

.logo-link {
    display: inline-block;
    text-decoration: none;
    margin: 0.2rem 0 0 0;
    position: relative;
    z-index: 1;
}