/*
    blog.css — Componentes de la home del blog
    Hero destacado, grilla de posts, tarjetas y microinteracciones.
*/

/* 1) Hero */
.hero { margin-bottom: clamp(28px, 5vw, 56px); }

.hero-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e0e0e0;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    isolation: isolate;
    transition: all 0.3s ease;
}

.hero-card:hover {
    transform: translateY(-2px);
    border-color: #d0d0d0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.hero-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f5f5f5;
    margin: 0; /* eliminar margen por defecto del elemento figure */
}

.hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.hero-card:hover .hero-media img {
    transform: scale(1.02);
}

.hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.2));
}

.hero-content {
    position: relative;
    margin-top: 0;
    padding: clamp(20px, 3vw, 32px);
    border-bottom: 1px solid #f0f0f0;
    background: white;
}

.hero-title {
    font-size: var(--fs-1);
    letter-spacing: -0.02em;
    margin: 0 0 8px 0;
    color: var(--accent);
    line-height: 1.2;
}

.hero-excerpt {
    color: var(--muted);
    font-size: var(--fs-3);
    max-width: 68ch;
    margin-top: 8px;
}

.hero-content .chip {
    margin-bottom: 8px;
}

/* 2) Grilla de posts */
.posts { margin-top: clamp(10px, 3vw, 16px); }

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(16px, 2vw, 24px);
    padding-top: 12px;
}

.archive-header {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: clamp(24px, 4vw, 40px);
}

.archive-header h1 {
    margin: 0;
    font-size: var(--fs-2);
    color: var(--accent);
}

.archive-description {
    color: var(--muted);
    max-width: 70ch;
    margin: 0;
    font-size: var(--fs-4);
}

/* 3) Tarjetas de posts */
.post-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    padding: 22px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-3);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.post-card:hover {
    transform: translateY(-4px);
    border-color: #d0d0d0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.post-card:hover::before {
    transform: scaleX(1);
}

.post-card__meta { margin-bottom: 10px; }

.post-card__title {
    margin: 8px 0 8px 0;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    color: var(--accent);
    transition: transform 0.3s ease;
}

.post-card:hover .post-card__title {
    transform: translateX(2px);
}

.post-card__excerpt {
    color: var(--muted);
    font-size: var(--fs-4);
    line-height: 1.6;
}

.post-single {
    display: grid;
    gap: clamp(12px, 2.5vw, 28px);
}

.post-single__header {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.2vw, 16px); /* separar un poco más la fecha/categoría del título */
}

/* Reducir márgenes por defecto del H1 para compactar el bloque del título */
.post-single__title {
    margin: 0;
    line-height: 1.15;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.post-single__media {
    width: min(100%, 960px); /* permitir que la imagen aproveche más el ancho del contenedor */
    margin: 0 auto clamp(12px, 3vw, 24px);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.post-single__media img {
    width: 100%;
    height: auto;
    display: block;
}
.post-meta__categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-meta__categories a {
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 16px;
    background: #f5f5f5;
    color: var(--accent);
    border: 1px solid #e0e0e0;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.25s ease;
}

.post-meta__categories a:hover {
    border-color: var(--accent-3);
    background: #f0f4f8;
}

.post-single__media {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    width: min(100%, 960px);
    /* altura controlada para que no tape el texto por encima del pliegue */
    height: clamp(220px, 40vw, 420px);
    margin-left: auto;
    margin-right: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-single__media img {
    width: 100%;
    height: 100%; /* llenar el contenedor controlado y evitar altura excesiva */
    object-fit: cover; /* puede recortar ligeramente para priorizar legibilidad */
    object-position: center;
    display: block;
}

.post-single__content {
    display: grid;
    gap: 16px;
    font-size: var(--fs-3);
    color: var(--fg);
    margin-bottom: clamp(12px, 3vw, 24px);
}

.post-single__content p {
    margin: 0;
}

.post-single__content p + p {
    margin-top: 12px;
}

.post-single__content h2,
.post-single__content h3,
.post-single__content h4 {
    color: var(--accent);
    margin: 24px 0 12px;
    line-height: 1.2;
}

.post-single__content a {
    color: var(--accent-3);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: rgba(52, 152, 219, 0.5);
}

.post-single__content a:hover {
    color: var(--accent-5);
}

.post-single__pagination {
    margin-top: 24px;
}

.post-navigation {
    border-top: 1px solid #e0e0e0;
    padding-top: clamp(16px, 3vw, 28px);
}

.post-navigation .nav-links {
    display: grid;
    gap: 16px;
}

.post-navigation a {
    display: block;
    text-decoration: none;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    transition: all 0.3s ease;
}

.post-navigation a:hover {
    border-color: var(--accent-3);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.post-navigation .nav-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 6px;
}

.post-navigation .nav-title {
    font-weight: 600;
    color: var(--accent);
    line-height: 1.4;
}

.comments-area {
    margin-top: clamp(16px, 4vw, 40px);
    border-top: 1px solid #e0e0e0;
    padding-top: clamp(12px, 2.5vw, 24px);
    display: grid;
    gap: clamp(16px, 3vw, 28px);
}

.post-navigation + .comments-area {
    margin-top: clamp(12px, 2.5vw, 24px);
}

.comments-area > * {
    margin: 0;
}

.comments-area .comments-title,
.comments-area .comment-reply-title {
    font-size: var(--fs-2);
    color: var(--accent);
    margin: 0 0 16px;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 24px;
}

.comment-list .children {
    list-style: none;
    margin: 20px 0 0 40px;
    padding: 0;
    border-left: 2px solid rgba(52, 152, 219, 0.2);
}

.comment-list .children > li {
    margin-left: 24px;
    padding-left: 16px;
}

.comment-body {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    background: #fff;
    box-shadow: var(--shadow);
    display: grid;
    gap: 12px;
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-size: 0.85rem;
    color: var(--muted);
}

.comment-author {
    font-weight: 600;
    color: var(--accent);
}

.comment-metadata a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.comment-metadata a:hover {
    color: var(--accent-3);
}

.comment-content p {
    margin: 0 0 12px;
    font-size: var(--fs-4);
    color: var(--fg);
}

.comment-content p:last-child {
    margin-bottom: 0;
}

.comment-reply-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--accent-3);
    text-decoration: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.comment-reply-link:hover {
    color: var(--accent-5);
    transform: translateX(2px);
}

.no-comments {
    font-size: var(--fs-4);
    color: var(--muted);
}

.comment-respond {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: clamp(20px, 4vw, 32px);
    background: #fff;
    box-shadow: var(--shadow);
    max-width: 680px;
}

.single .site-main {
    width: min(100% - 2rem, 960px);
    margin-inline: auto;
    padding-top: clamp(12px, 3vw, 24px);
    padding-bottom: clamp(24px, 4vw, 48px);
}

.page .site-main {
    width: min(100% - 2rem, 960px);
    margin-inline: auto;
    padding-top: clamp(12px, 3vw, 28px);
    padding-bottom: clamp(24px, 4vw, 48px);
}

.comment-form {
    display: grid;
    gap: clamp(14px, 2.5vw, 20px);
}

.comment-form textarea {
    max-width: 100%;
}

.comment-form p {
    margin: 0;
}

.comment-form label {
    display: block;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d5d5d5;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fdfdfd;
}

.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus,
.comment-form input[type="url"]:focus,
.comment-form textarea:focus {
    border-color: var(--accent-3);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
    outline: none;
}

.comment-form textarea {
    min-height: 160px;
    resize: vertical;
}

.comment-form .comment-notes,
.comment-form .logged-in-as {
    color: var(--muted);
    font-size: 0.9rem;
}

.comment-form .comment-form-cookies-consent {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-form .comment-form-cookies-consent label {
    margin: 0;
    font-weight: 500;
    color: var(--muted);
}

.comment-form .submit {
    justify-self: flex-start;
    padding: 12px 28px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    background: var(--accent-3);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.comment-form .submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(52, 152, 219, 0.3);
}

.comment-form .submit:active {
    transform: translateY(0);
}

@media (max-width: 640px) {
    /* Reducir separación bajo la hero en móviles */
    .hero { margin-bottom: 12px; }
    .post-single__media {
        width: 100%;
        height: clamp(180px, 50vw, 260px); /* un poco más compacta en móvil */
    }

    .comment-list .children {
        margin-left: 18px;
        padding-left: 12px;
    }

    .comment-form {
        gap: 16px;
    }
}

/* 4) Animaciones sutiles */
@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-card {
    animation: rise 0.6s ease-out;
}

.posts-grid > * {
    animation: rise 0.5s ease-out backwards;
}

.posts-grid > *:nth-child(1) { animation-delay: 0.1s; }
.posts-grid > *:nth-child(2) { animation-delay: 0.15s; }
.posts-grid > *:nth-child(3) { animation-delay: 0.2s; }
.posts-grid > *:nth-child(4) { animation-delay: 0.25s; }
.posts-grid > *:nth-child(5) { animation-delay: 0.3s; }
.posts-grid > *:nth-child(n+6) { animation-delay: 0.35s; }

@media (prefers-reduced-motion: reduce) {
    .hero-card,
    .posts-grid > * {
        animation: none !important;
    }
    .hero-card:hover,
    .post-card:hover {
        transform: none;
    }
}

/* 7) Layout mejorado en pantallas anchas: texto a la izquierda, imagen contenida a la derecha */
@media (min-width: 980px) {
    .hero-card {
        grid-template-columns: 1.2fr 1fr;
        align-items: stretch;
    }
    .hero-content {
        border-bottom: 0;
        border-right: 1px solid #f0f0f0;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .hero-media {
        aspect-ratio: auto;
        height: 100%;
    }
    .hero-media img {
        height: 100%;
        object-position: center;
        width: 100%;
    }

    .post-navigation .nav-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 8) Responsive optimizado */
@media (max-width: 768px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hero-content {
        padding: clamp(16px, 3vw, 24px);
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .post-card {
        padding: 16px;
    }

    .tags-list {
        gap: 8px;
    }

    .tag {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}
.categories {
    margin-top: clamp(40px, 6vw, 80px);
    padding-top: clamp(32px, 5vw, 56px);
    border-top: 1px solid #e0e0e0;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    display: inline-block;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    background: #f5f5f5;
    color: var(--accent);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tag:hover {
    border-color: var(--accent-3);
    background: #f0f4f8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

