/* Reset y base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #fdfdfd;
}

/* Contenedor principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 100px);
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    grid-template-areas: 
        "header header"
        "content sidebar";
    gap: 2rem;
    padding: 0 2rem;
}

/* Header del sitio */
.site-header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    border-bottom: 1px solid #ecf0f1;
    margin-bottom: 1rem;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 300;
    color: #2c3e50;
    text-decoration: none;
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.site-title:hover {
    color: #3498db;
}

.site-nav a {
    color: #7f8c8d;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    transition: color 0.3s ease;
}

.site-nav a:hover {
    color: #2c3e50;
}

/* Hamburger button */
.menu-toggle {
    display: none;
    background: none;
    border: 0;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}
.menu-toggle .bar {
    display: block;
    width: 24px;
    height: 2px;
    background: #2c3e50;
    margin: 5px 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Mobile/Tablet nav behavior */
@media (max-width: 1024px) {
    .site-header { 
        position: relative; 
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0.75rem;
    }
    .menu-toggle { order: 0; margin-right: 0.25rem; }
    .site-title { order: 1; }
    .site-nav { order: 2; }
    .menu-toggle { display: inline-block; }
    .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        background: #fff;
        border: 1px solid #ecf0f1;
        border-radius: 8px;
        padding: 0.5rem;
        min-width: 180px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.06);
        transform: translateY(10px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
        z-index: 10;
    }
    .site-nav a { display: block; padding: 0.6rem 0.75rem; }
    .site-header.nav-open .site-nav {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
    /* animate bars into X when open */
    .site-header.nav-open .menu-toggle .bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .site-header.nav-open .menu-toggle .bar:nth-child(2) {
        opacity: 0;
    }
    .site-header.nav-open .menu-toggle .bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}

/* Artículo principal */
.post {
    grid-area: content;
}

.post-header {
    margin-bottom: 2rem;
}

.post-title {
    font-size: 2.5rem;
    font-weight: 300;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    letter-spacing: -1px;
}

.post-meta {
    color: #95a5a6;
    font-size: 0.9rem;
    font-weight: 400;
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.7;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 400;
    line-height: 1.3;
}

.post-content h1 { font-size: 2rem; }
.post-content h2 { font-size: 1.5rem; }
.post-content h3 { font-size: 1.25rem; }

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content a {
    color: #3498db;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.post-content a:hover {
    border-bottom-color: #3498db;
}

.post-content blockquote {
    border-left: 4px solid #ecf0f1;
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #7f8c8d;
}

.post-content code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9rem;
    color: #e74c3c;
}

.post-content pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

/* Home layout */
.home-title {
    margin-bottom: 0.25rem;
}
.home-description {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}
.home-posts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
.post-card {
    background: #fff;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    padding: 1.25rem;
}
.post-card-title a {
    color: #2c3e50;
    text-decoration: none;
}
.post-card-title a:hover {
    color: #3498db;
}
.post-card-excerpt { color: #34495e; margin: 0.5rem 0 0.75rem; }
.post-card-readmore a { color: #3498db; text-decoration: none; }
.post-card-readmore a:hover { text-decoration: underline; }

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    padding-top: 1rem;
}

.widget {
    background-color: #ffffff;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.post-list {
    list-style: none;
}

.post-item {
    margin-bottom: 0.8rem;
}

.post-link {
    text-decoration: none;
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid #ecf0f1;
    transition: color 0.3s ease;
}

.post-link:hover {
    color: #3498db;
}

.post-title-mini {
    font-size: 0.9rem;
    line-height: 1.4;
    flex: 1;
}

.post-date-mini {
    font-size: 0.8rem;
    color: #95a5a6;
    white-space: nowrap;
    margin-left: 1rem;
}

/* Footer */
.site-footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "header"
            "content"
            "sidebar";
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .site-header {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        gap: 0.75rem;
        text-align: left;
    }
    
    .post-title {
        font-size: 2rem;
    }
    
    .sidebar {
        order: 3;
        padding-top: 0;
    }
    
    .post-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .post-date-mini {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .post-title {
        font-size: 1.75rem;
    }
    
    .post-content {
        font-size: 1rem;
    }
    
    .widget {
        padding: 1rem;
    }
}
img {
    width: 100%;
}