* {
    box-sizing: border-box;
}

:root {
    --bg: #f8f9fa;
    --panel: #ffffff;
    --text: #1c2636;
    --text-secondary: #64748b;
    --accent: #c63b36;
    --header-bg: #1c2636;
    --header-text: #ffffff;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    background: var(--bg);
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

img {
    max-width: 100%;
    display: block;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* --- HEADER --- */
header {
    position: sticky;
    top: 0;
    background: var(--header-bg);
    border-bottom: 4px solid var(--accent);
    padding: 0.8rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-logo {
    height: 50px;
    width: auto;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.2));
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--header-text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--header-text);
    position: relative;
    padding: 5px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--accent);
    transition: width 0.3s;
}

.nav-links a:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    margin-left: auto;
}

.hamburger span {
    display: block;
    width: 30px;
    height: 3px;
    background-color: var(--header-text);
    border-radius: 3px;
    transition: 0.3s;
}

.hamburger.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* --- PAGE CONTENT --- */
.page-header {
    text-align: center;
    padding: 4rem 5% 2rem 5%;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    z-index: 1;
}

.page-title {
    font-size: 3rem;
    font-weight: 900;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-secondary);
    margin-top: 10px;
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
}

/* BUSCADOR & FILTROS */
.search-wrapper {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.search-input {
    width: 100%;
    padding: 15px 50px 15px 25px;
    font-size: 1.1rem;
    border: 2px solid #cbd5e1;
    border-radius: 50px;
    outline: none;
    transition: all 0.3s ease;
    color: var(--text);
    background: #fff;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(198, 59, 54, 0.15);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: #94a3b8;
    pointer-events: none;
}

.filter-toggle-text {
    display: inline-block;
    margin-top: 15px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    border-bottom: 1px dashed transparent;
}

.filter-toggle-text:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.toggle-arrow {
    display: inline-block;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    margin-left: 5px;
}

.filter-toggle-text.active .toggle-arrow {
    transform: rotate(180deg);
}

.filters-wrapper {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
    width: 100%;
}

.filters-wrapper.open {
    max-height: 800px;
    opacity: 1;
}

.filters-container {
    max-width: 800px;
    margin: 20px auto 10px auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 5px;
}

.filter-tag {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-tag:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: white;
    transform: translateY(-1px);
}

.filter-tag.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* GRID */
.blog-container {
    padding: 3rem 5%;
    flex: 1;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.post-card {
    background: var(--panel);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 20px -5px rgba(0, 0, 0, 0.1);
    border-color: rgba(198, 59, 54, 0.3);
}

.card-img-container {
    height: 200px;
    overflow: hidden;
    background: #eee;
    position: relative;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .card-img {
    transform: scale(1.05);
}

.post-card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-meta {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text);
    line-height: 1.3;
}

.post-excerpt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    flex: 1;
    line-height: 1.6;
}

.read-btn {
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    color: var(--text);
    border: 1px solid #cbd5e1;
    display: block;
    transition: 0.2s;
    font-size: 0.9rem;
}

.read-btn:hover {
    background: var(--text);
    border-color: var(--text);
    color: white;
}

footer {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--header-bg);
    color: #94a3b8;
    font-size: 0.9rem;
    margin-top: auto;
}

/* --- RESPONSIVE FIXED --- */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .brand-logo {
        height: 40px;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--header-bg);

        flex-direction: column;
        align-items: flex-start;
        gap: 0;

        height: auto;
        max-height: 0;
        padding: 0;

        overflow: hidden;
        transition: max-height 0.5s ease-in-out;

        border-bottom: 0 solid var(--accent);
        box-shadow: none;
    }

    .nav-links.active {
        max-height: 500px;
        border-bottom: 4px solid var(--accent);
        box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: block;
        width: 100%;
        padding: 1.2rem 5%;
        text-align: center;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        position: relative;
    }

    .nav-links a:hover {
        background-color: transparent;
        color: var(--accent);
    }

    .nav-links a::after {
        bottom: 0;
        left: 0;
        width: 0;
        height: 2px;
        background-color: var(--accent);
        transition: width 0.3s;
    }

    .nav-links a:hover::after {
        width: 100%;
    }

    .page-title {
        font-size: 2rem;
    }

    .blog-container {
        padding: 2rem 5%;
    }
}