/* CSS Variables for consistent theming */
:root {
    --max-width: 1440px;
    --content-width: 50rem;
    --container-width: 67.5rem;
    --base-color: #000000;
    --primary-color: #ec4899; /* Pink for author name */
    --link-color: #1E76E9; /* Blue for links */
    --text-color: #0B0B0B;
    --text-light: #858585;
    --text-content: #242424;
    --text-highlight: #0B0B0B;
    --highlight-neutral: rgba(67,152,249,.15);
    --text-inverse: #ffffff;
    --border-color: #EDEDED;
    --bg-color: #ffffff;
    --bg-light: #FAFAFA;
    --surface-color: #F2F3F5;
    --surface-invesrse: #131415;
    --surface-blue: #CBEAFE;
    --btn-border: #D9D9D9;
    --bottom-cta-text: #1E3847; 
    --radius: 0.375rem;
    --transition: all 0.3s ease;
}

/* Dark theme variables - updated to dark gray palette */
[data-theme="dark"] {
    --bg-color: #121212; /* Main dark background */
    --bg-light: #21232B; /* Light elements on dark background */
    --surface-color: #2b2b2b;
    --surface-invesrse: #ffffff;
    --btn-border: transparent;
    --text-color: #ffffff; /* Primary text color */
    --text-light: #999999; /* Secondary text color */
    --text-content: #B6BDC9;
    --text-highlight: #BDD7FF;
    --highlight-neutral: rgba(67,152,249,.25);
    --text-inverse: #131415;
    --surface-blue: #63C2FF;
    --border-color: #242424; /* Border color */
    --link-color: #1E76E9;
    --base-color: #ffffff; /* Link color */
    --primary-color: #E91E63; /* Pink for author name in dark mode */
    --bottom-cta-text: #0B0B0B;
}


/* Base styles and reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Zalando Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: var(--transition);
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header with fixed positioning */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--bg-color);
    z-index: 1000;
    transition: box-shadow 0.3s ease;
}

.header.scrolled {
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    position: relative; /* Added for mobile menu positioning */
}

.nav_logo {
    width: 120px;
    height: 27px;
}

.nav_logo a {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-buttons {
    display: flex;
    gap: 0.6rem;
}

.post-btn {
    display: flex;
    align-items: center;
    color: var(--surface-invesrse);
    gap: 0.3rem;
    font-weight: 400;
    height: 38px;
    padding: 0 20px 0 12px;
    font-size: 15px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    border-radius: 40px;
}

.post-btn:hover {
    background-color: var(--surface-color);
}

.post-btn:active {
    background-color: var(--surface-blue);
    color: #1774FF;
    border: 1px solid rgba(23, 116, 255, 0.3);
}

.btn--contact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #ffffff;
    border: 1px solid var(--btn-border);
    color: #000000;
    font-weight: 400;
    height: 38px;
    padding: 0 16px 0 12px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    border-radius: 40px;
}

.btn--contact:hover {
    background-color: #EDEDED;
    border: 1px solid transparent;
    transition: transform 0.2s ease;
}

/* Theme toggle in header */
.theme-toggle {
    display: flex;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-color);
    transition: var(--transition);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--bg-color);
    transition: var(--transition);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

input:checked + .toggle-slider {
    background-color: var(--surface-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    transition: var(--transition);
}

.sun-icon {
    left: 6px;
    opacity: 1;
}

.moon-icon {
    right: 6px;
    opacity: 0;
}

input:checked + .toggle-slider .sun-icon {
    opacity: 0;
}

input:checked + .toggle-slider .moon-icon {
    opacity: 1;
}

/* Mobile menu styles */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
    z-index: 1002; /* Increased z-index to stay above menu */
    position: relative; /* Ensure it stays above menu */
}

.mobile-menu-toggle:hover {
    background-color: var(--bg-light);
}

.burger-line {
    display: block;
    width: 16px;
    height: 2px;
    background-color: var(--text-color);
    transition: var(--transition);
    transform-origin: center;
}

.burger-line:first-child {
    margin-bottom: 2px;
}

.burger-line:last-child {
    margin-top: 2px;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001; /* Below toggle button */
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background-color: var(--bg-color);
    padding: 5rem 1.5rem 2rem; /* Increased top padding to avoid toggle */
    overflow-y: auto;
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateX(0);
}

.mobile-nav {
    display: flex;
    flex-direction: column;
}

.mobile-nav-link {
    padding: 0.75rem 0;
    color: var(--text-light);
    font-weight: 400;
    font-size: 1rem;
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}

.mobile-nav-link:hover {
    color: var(--link-color);
    text-decoration: none;
    border-bottom-color: var(--link-color);
}

.mobile-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

.mobile-theme-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}

.mobile-theme-text {
    color: var(--text-light);
    font-weight: 400;
    font-size: 1rem;
}

.mobile-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.mobile-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mobile-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: var(--transition);
    border-radius: 24px;
}

.mobile-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--bg-color);
    transition: var(--transition);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-toggle-switch input:checked + .mobile-toggle-slider {
    background-color: var(--surface-color);
}

.mobile-toggle-switch input:checked + .mobile-toggle-slider:before {
    transform: translateX(20px);
}

.mobile-toggle-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    transition: var(--transition);
}

.mobile-toggle-switch .sun-icon {
    left: 6px;
    opacity: 1;
}

.mobile-toggle-switch .moon-icon {
    right: 6px;
    opacity: 0;
}

.mobile-toggle-switch input:checked + .mobile-toggle-slider .sun-icon {
    opacity: 0;
}

.mobile-toggle-switch input:checked + .mobile-toggle-slider .moon-icon {
    opacity: 1;
}

.mobile-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

.mobile-btn {
    height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.mobile-btn a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.mobile-btn.primary {
    background-color: var(--surface-invesrse);
    color: var(--bg-color);
}

.mobile-btn.primary:hover {
    background-color: var(--text-light);
}

.mobile-btn.secondary {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.mobile-btn.secondary:hover {
    background-color: var(--bg-light);
}

/* Main content container */
.content {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2rem 1rem;
    margin-top: 80px;
    min-height: 880px;
}

/* Section Header */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 2.5rem;
    font-weight: 700;
}

.section-subtitle {
    font-size: 1.1rem;
    line-height: 1.5rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Post Card */
.post-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    overflow: hidden;
    height: 424px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--transition);
}

.post-card:active {
    transform: scale(0.95);
}

.card-link-wrapper {
    display: block;      
    width: 100%;        
    height: 100%;       
    text-decoration: none; 
    color: inherit;     
    cursor: pointer;   
}

/* Post Image */
.post-card-image {
    height: 200px;
    overflow: hidden;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
    transition: var(--transition);
}

/* Post Content */
.post-card-content {
    margin-top: 1rem;
    padding: 0.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-title {
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-subtitle {
    color: var(--text-light);
    line-height: 1.3;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.95rem;
}

/* Post Meta */
.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
    font-weight: 400;
    line-height: 1rem;
}

.author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.author-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--primary-color);
}

.post-topic {
    color: var(--text-light);
    font-size: 0.75rem;
    font-weight: 400;
    white-space: nowrap;
}

.read-time {
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

/* Scroll to top button - updated for light theme */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    z-index: 999;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background-color: var(--bg-light);
    transform: translateY(-2px);
}

.scroll-to-top svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Footer */
.footer {
    padding: 40px 0;
    text-align: center;
}

.footer_container{
    max-width: 100%;
    margin: 0 auto;
    padding: 0 60px;
}

.footer__copyright {
    font-size: 12px;
    font-weight: 300;
    line-height: 1;
    color: var(--text-color);
}

    /* Responsive Design */
@media (max-width: 1200px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    
    .nav-links {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
        
    .scroll-to-top {
        bottom: 1rem;
        right: 1rem;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .post-card {
        height: 480px;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }


    .footer {
        padding: 16px 0;
    }
}

@media (max-width: 640px) {


    .post-title {
        font-size: 1.5rem;
    }
    
    .nav-container {
        padding: 0.75rem 1rem;
    }
    
    .container {
        margin-top: 70px;
        padding: 1.5rem 1rem;
    }
        
    .mobile-menu-content {
        width: 100%;
        padding-top: 6rem; /* Even more space for toggle on small screens */
    }

    .footer{
        padding: 16px 0;
    }
}

@media (max-width: 480px) {

    .post-card {
        height: 450px;
    }
    
    .post-card-content {
        padding: 0.8rem;
    }
    
    .post-card-title {
        font-size: 1.1rem;
    }
    
    .post-meta {
        flex-wrap: wrap;
        gap: 1rem;
    }
}

/* Burger menu animation */
.mobile-menu-toggle.active .burger-line:first-child {
    transform: rotate(45deg) translate(2px, 2px);
}

.mobile-menu-toggle.active .burger-line:last-child {
    transform: rotate(-45deg) translate(2px, -2px);
}