/* ============================================================
   Portfolio Hierarchy Filter – Styles
   Compatible con tema Hub / Liquid
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ── Variables ────────────────────────────────────────────── */
.phf-wrapper {
    --phf-accent:      #1D3A5C;
    --phf-accent-2:    #e63946;
    --phf-bg-btn:      #ffffff;
    --phf-border-btn:  #E0E6EB;
    --phf-text-btn:    #1D3A5C;
    --phf-text-btn-h:  #ffffff;
    --phf-muted:       #5C728A;
    --phf-radius:      6px;
    --phf-radius-pill: 999px;
    --phf-gap:         20px;
    --phf-transition:  0.2s ease;
    --phf-font-body:   'Inter', sans-serif;
    --phf-font-title:  'Space Grotesk', sans-serif;
    font-family: var(--phf-font-body);
    width: 100%;

    background: #f7f8fa;
    border-radius: 16px;
    padding: 22px 24px;
    box-sizing: border-box;
}

.phf-wrapper * { box-sizing: border-box; font-family: inherit; }

/* ── Navegación categorías padre ──────────────────────────── */
.phf-parent-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 0;
}

.phf-parent-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 1px 15px;
    background: transparent;
    color: var(--phf-text-btn);
    border: 1px solid #E0E6EB;
    border-radius: var(--phf-radius-pill);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    transition: background var(--phf-transition),
                color var(--phf-transition),
                border-color var(--phf-transition);
}

.phf-parent-btn:hover {
   background: #28588A;
    border-color: #28588A;
    color: #FFF;
}

.phf-parent-btn.phf-active {
    background: #28588A;
    border-color: #28588A;
    color: #FFF;

}

.phf-parent-btn .phf-count {
    display: none; /* oculto por defecto para parecerse al mockup; quita esta línea para mostrarlo */
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(0,0,0,.08);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 400;
}

.phf-parent-btn.phf-active .phf-count {
    background:#28588A;
}

/* ── Fila de filtro secundario (subcategorías) ────────────── */
.phf-filter-row {
    display: none;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    border-top: 1px solid #e4e7ec;
    margin-top: 18px;
    padding-top: 16px;
}

.phf-filter-row.phf-filter-row--visible {
    display: flex;
}

.phf-filter-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #5C728A;
    white-space: nowrap;
}

.phf-child-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
}

.phf-child-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    background: transparent;
    color: var(--phf-muted);
    border: none;
    border-radius: var(--phf-radius-pill);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: background var(--phf-transition),
                color var(--phf-transition),
                padding var(--phf-transition);
}

.phf-child-btn:hover {
    color: var(--phf-accent);
}

.phf-child-btn.phf-child-btn--active {
    background: var(--phf-accent-2);
    color: #fff;
    padding: 7px 18px;
}

.phf-child-btn.phf-child-btn--active:hover {
    color: #fff;
}

.phf-child-btn .phf-count {
    font-size: 11px;
    font-weight: 400;
    opacity: .8;
}

/* ── Grid de proyectos ────────────────────────────────────── */
.phf-grid {
    display: grid;
    gap: var(--phf-gap);
    margin-top: 24px;
}

.phf-grid--1 { grid-template-columns: 1fr; }
.phf-grid--2 { grid-template-columns: repeat(2, 1fr); }
.phf-grid--3 { grid-template-columns: repeat(3, 1fr); }
.phf-grid--4 { grid-template-columns: repeat(4, 1fr); }

/* ── Placeholder ──────────────────────────────────────────── */
.phf-placeholder {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    background: #fafafa;
    border: 2px dashed #ddd;
    border-radius: var(--phf-radius);
    color: #999;
    font-size: 15px;
    font-style: italic;
}

/* ── Loading ──────────────────────────────────────────────── */
.phf-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 0;
    color: #888;
    font-size: 14px;
}

.phf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e4e4e7;
    border-top-color: var(--phf-accent);
    border-radius: 50%;
    animation: phf-spin .7s linear infinite;
}

@keyframes phf-spin {
    to { transform: rotate(360deg); }
}

/* ── Item de portfolio ────────────────────────────────────── */
.phf-item {
    background: transparent;
    border: 1px solid #E0E6EB;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: none;
    transition: transform var(--phf-transition), border-color var(--phf-transition);

    /* entrada animada */
    opacity: 0;
    transform: translateY(16px);
    animation: phf-fadeup .4s ease forwards;
}

.phf-item:hover {
    transform: translateY(-4px);
    border: 0.5px solid #EE363D5C;
}

@keyframes phf-fadeup {
    to { opacity: 1; transform: translateY(0); }
}

/* Retraso escalonado */
.phf-item:nth-child(1)  { animation-delay: .04s; }
.phf-item:nth-child(2)  { animation-delay: .08s; }
.phf-item:nth-child(3)  { animation-delay: .12s; }
.phf-item:nth-child(4)  { animation-delay: .16s; }
.phf-item:nth-child(5)  { animation-delay: .20s; }
.phf-item:nth-child(6)  { animation-delay: .24s; }
.phf-item:nth-child(7)  { animation-delay: .28s; }
.phf-item:nth-child(8)  { animation-delay: .32s; }
.phf-item:nth-child(9)  { animation-delay: .36s; }
.phf-item:nth-child(n+10) { animation-delay: .40s; }

.phf-item__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.phf-item__thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #f0f0f0;
}

.phf-item__thumb .phf-thumb,
.phf-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
}

.phf-item:hover .phf-item__thumb img,
.phf-item:hover .phf-item__thumb .phf-thumb {
    transform: scale(1.05);
}

.phf-item__no-thumb {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e4e4e7 0%, #d4d4d8 100%);
}

.phf-item__body {
    padding: 16px 18px 20px;
    border-top: solid 1px  #E0E6EB;
}

.phf-item__title {
    margin: 0 0 4px;
    font-family: var(--phf-font-title);
    font-size: 19.8px;
    font-weight: 600;
    letter-spacing: -0.8px;
    line-height: 1.3;
    color: var(--phf-accent);
}

.phf-item__meta {
    margin: 0 0 10px;
    font-size: 13px;
}

.phf-item__meta-label {
    color: #8a8f98;
}

.phf-item__meta-value {
    color: #1D3A5C;
    font-weight: 400;
}

.phf-item__excerpt {
    display: none;
}

/* Chips de material (categorías padre asignadas al post) */
.phf-item__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.phf-badge {
    position: static;
    display: inline-block;
    background: #ffffff;
    border: 1px solid #E0E6EB;
    color: #5C728A;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .4px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 100px;
    pointer-events: none;
}

/* ── Mensajes ─────────────────────────────────────────────── */
.phf-no-posts,
.phf-no-cats {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 32px 0;
}

/* ── Paginación ───────────────────────────────────────────── */
.phf-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 28px;
}

.phf-pagination:empty {
    display: none;
    margin-top: 0;
}

.phf-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: var(--phf-bg-btn);
    color: var(--phf-text-btn);
    border: 1px solid var(--phf-border-btn);
    border-radius: var(--phf-radius-pill);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--phf-transition),
                color var(--phf-transition),
                border-color var(--phf-transition);
}

.phf-page-btn:hover:not([disabled]):not(.phf-page-btn--active) {
    background: #28588A;
    border-color: #28588A;
    color: #FFF;
}

.phf-page-btn.phf-page-btn--active {
    background: var(--phf-accent-2);
    border-color: var(--phf-accent-2);
    color: #fff;
    cursor: default;
}

.phf-page-btn--prev,
.phf-page-btn--next {
    font-weight: 400;
    color: var(--phf-muted);
    padding: 0 16px;
}

.phf-page-btn[disabled] {
    opacity: .4;
    cursor: not-allowed;
}

.phf-page-btn[disabled]:hover {
    background: var(--phf-bg-btn);
    border-color: var(--phf-border-btn);
    color: var(--phf-text-btn);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .phf-grid--4 { grid-template-columns: repeat(2, 1fr); }
    .phf-grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .phf-grid--4,
    .phf-grid--3,
    .phf-grid--2 { grid-template-columns: 1fr; }

    .phf-wrapper { padding: 16px; }

    .phf-parent-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .phf-filter-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .phf-pagination {
        gap: 4px;
    }

    .phf-page-btn {
        min-width: 32px;
        height: 32px;
        padding: 0 10px;
        font-size: 13px;
    }

    .phf-page-btn--prev,
    .phf-page-btn--next {
        padding: 0 12px;
    }
}


@media (max-width: 767px) {
    .phf-item__badges{
display: none;
}}