/* =============================================================
 *  tops.css — Styles for /tops/ hub & category archive pages
 *  Loaded conditionally on is_page('tops') || is_category()
 * ============================================================= */

/* ─── 1. HERO — /tops/ page ─── */
.mch-tops-hero {
    position: relative;
    left: 50%; right: 50%;
    margin-left: -50vw; margin-right: -50vw;
    width: 100vw; max-width: 100vw;
    background: linear-gradient(160deg, #0a1628 0%, #0d3b66 50%, #1a6fb5 100%);
    color: #fff;
    text-align: center;
    padding: 56px 24px 48px;
    overflow: hidden;
}
/* Dot-pattern texture */
.mch-tops-hero::before {
    content: '';
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
    z-index: 0;
}
.mch-tops-hero__inner {
    position: relative; z-index: 1;
    max-width: 720px;
    margin: 0 auto;
}
.mch-tops-hero h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 12px;
}
.mch-tops-hero p {
    color: rgba(255,255,255,0.75);
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    line-height: 1.6;
    margin: 0 0 24px;
}
/* Search bar inside hero */
.mch-tops-hero__search {
    display: flex;
    max-width: 520px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.15);
}
.mch-tops-hero__search input[type="search"] {
    flex: 1;
    border: none;
    background: transparent;
    color: #fff;
    padding: 12px 16px;
    font-size: 0.95rem;
    outline: none;
}
.mch-tops-hero__search input[type="search"]::placeholder {
    color: rgba(255,255,255,0.5);
}
.mch-tops-hero__search button {
    background: var(--ast-global-color-0);
    color: #fff;
    border: none;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}
.mch-tops-hero__search button:hover {
    filter: brightness(1.1);
}

/* ─── 2. CATEGORY SECTIONS — /tops/ hub ─── */
.mch-tops-hub {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}
.mch-tops-hub__header {
    text-align: center;
    margin-bottom: 40px;
}
.mch-tops-hub__header h2 {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: 800;
    margin: 0 0 8px;
}
.mch-tops-hub__header p {
    color: #6b7280;
    font-size: 1rem;
    margin: 0;
}

/* Section per category */
.mch-tops-section {
    margin-bottom: 48px;
    background: #fff;
    border: 1px solid #e8ecf0;
    border-radius: 16px;
    overflow: hidden;
}
.mch-tops-section__head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid #e8ecf0;
    flex-wrap: wrap;
}
.mch-tops-section__avatar {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.mch-tops-section__info {
    flex: 1;
    min-width: 0;
}
.mch-tops-section__name {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: #1e293b;
}
.mch-tops-section__count {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 2px 0 0;
}
.mch-tops-section__viewall {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ast-global-color-0);
    text-decoration: none;
    padding: 6px 16px;
    border: 1px solid var(--ast-global-color-0);
    border-radius: 20px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.mch-tops-section__viewall:hover {
    background: var(--ast-global-color-0);
    color: #fff;
}

/* ─── 3. POST CARDS — grid inside each section ─── */
.mch-tops-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}
.mch-tops-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #f1f3f5;
    border-right: 1px solid #f1f3f5;
    text-decoration: none;
    color: #1e293b;
    transition: background 0.15s, transform 0.15s;
}
.mch-tops-card:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}
.mch-tops-card:last-child {
    border-bottom: none;
}
.mch-tops-card__thumb {
    width: 48px; height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e8ecf0;
}
.mch-tops-card__thumb--placeholder {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px;
    border-radius: 8px;
    background: #e8ecf0;
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 1.1rem;
}
.mch-tops-card__title {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Section footer — "Ver más" pill */
.mch-tops-section__foot {
    padding: 16px 24px;
    border-top: 1px solid #e8ecf0;
    text-align: center;
}
.mch-tops-section__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ast-global-color-0);
    text-decoration: none;
    padding: 8px 24px;
    border: 1px solid var(--ast-global-color-0);
    border-radius: 24px;
    transition: background 0.2s, color 0.2s;
}
.mch-tops-section__more:hover {
    background: var(--ast-global-color-0);
    color: #fff;
}

/* ─── 4. HERO — category archive ─── */
.mch-cat-hero {
    position: relative;
    left: 50%; right: 50%;
    margin-left: -50vw; margin-right: -50vw;
    width: 100vw; max-width: 100vw;
    background: linear-gradient(160deg, #0a1628 0%, #0d3b66 50%, #1a6fb5 100%);
    color: #fff;
    text-align: center;
    padding: 56px 24px 48px;
    overflow: hidden;
}
.mch-cat-hero::before {
    content: '';
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
    z-index: 0;
}
.mch-cat-hero__inner {
    position: relative; z-index: 1;
    max-width: 720px;
    margin: 0 auto;
}
.mch-cat-hero__avatar {
    width: 80px; height: 80px;
    border-radius: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
    border: 3px solid rgba(255,255,255,0.2);
}
.mch-cat-hero h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 12px;
}
.mch-cat-hero p {
    color: rgba(255,255,255,0.75);
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    line-height: 1.6;
    margin: 0 0 16px;
}
.mch-cat-hero__badge {
    display: inline-block;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    margin-bottom: 24px;
}
/* Search bar inside category hero */
.mch-cat-hero__search {
    display: flex;
    max-width: 520px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.15);
}
.mch-cat-hero__search input[type="search"] {
    flex: 1;
    border: none;
    background: transparent;
    color: #fff;
    padding: 12px 16px;
    font-size: 0.95rem;
    outline: none;
}
.mch-cat-hero__search input[type="search"]::placeholder {
    color: rgba(255,255,255,0.5);
}
.mch-cat-hero__search button {
    background: var(--ast-global-color-0);
    color: #fff;
    border: none;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}
.mch-cat-hero__search button:hover {
    filter: brightness(1.1);
}

/* ─── 5. CATEGORY POST GRID ─── */
.mch-cat-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}
.mch-cat-card {
    display: block;
    text-decoration: none;
    color: #1e293b;
    background: #fff;
    border: 1px solid #e8ecf0;
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.mch-cat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.mch-cat-card__thumb {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: center;
    display: block;
    background: #e8ecf0;
}
.mch-cat-card__thumb--placeholder {
    width: 100%;
    aspect-ratio: 16 / 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8ecf0 0%, #f1f5f9 100%);
    color: #94a3b8;
    font-size: 2rem;
}
.mch-cat-card__body {
    padding: 16px;
}
.mch-cat-card__title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── 6. PAGINATION ─── */
.mch-cat-pagination {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px 60px;
    text-align: center;
}
.mch-cat-pagination .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.mch-cat-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px; height: 40px;
    padding: 0 12px;
    border: 1px solid #e8ecf0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    background: #fff;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mch-cat-pagination .page-numbers:hover {
    border-color: var(--ast-global-color-0);
    color: var(--ast-global-color-0);
}
.mch-cat-pagination .page-numbers.current {
    background: var(--ast-global-color-0);
    border-color: var(--ast-global-color-0);
    color: #fff;
}
.mch-cat-pagination .page-numbers.dots {
    border: none;
    background: none;
    cursor: default;
}
.mch-cat-pagination .page-numbers.prev,
.mch-cat-pagination .page-numbers.next {
    font-size: 0.85rem;
    gap: 4px;
}

/* No-posts message */
.mch-no-posts {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
    text-align: center;
    color: #6b7280;
    font-size: 1.1rem;
}

/* ─── 7. SEARCH PAGE ─── */

/* Search hero — same gradient as tops/category */
.mch-search-hero {
    position: relative;
    left: 50%; right: 50%;
    margin-left: -50vw; margin-right: -50vw;
    width: 100vw; max-width: 100vw;
    background: linear-gradient(160deg, #0a1628 0%, #0d3b66 50%, #1a6fb5 100%);
    color: #fff;
    text-align: center;
    padding: 56px 24px 48px;
    overflow: hidden;
}
.mch-search-hero::before {
    content: '';
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
    z-index: 0;
}
.mch-search-hero__inner {
    position: relative; z-index: 1;
    max-width: 720px;
    margin: 0 auto;
}
.mch-search-hero h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 12px;
}
.mch-search-hero p {
    color: rgba(255,255,255,0.75);
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    line-height: 1.6;
    margin: 0 0 24px;
}
/* Search bar inside search hero */
.mch-search-hero__search {
    display: flex;
    max-width: 520px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.15);
}
.mch-search-hero__search input[type="search"] {
    flex: 1;
    border: none;
    background: transparent;
    color: #fff;
    padding: 12px 16px;
    font-size: 0.95rem;
    outline: none;
}
.mch-search-hero__search input[type="search"]::placeholder {
    color: rgba(255,255,255,0.5);
}
.mch-search-hero__search button {
    background: var(--ast-global-color-0);
    color: #fff;
    border: none;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}
.mch-search-hero__search button:hover {
    filter: brightness(1.1);
}

/* CTA section for businesses */
.mch-search-cta {
    position: relative;
    left: 50%; right: 50%;
    margin-left: -50vw; margin-right: -50vw;
    width: 100vw; max-width: 100vw;
    background: linear-gradient(160deg, #0a1628 0%, #0d3b66 60%, #1a6fb5 100%);
    color: #fff;
    text-align: center;
    padding: 60px 24px;
    overflow: hidden;
}
.mch-search-cta::before {
    content: '';
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
}
.mch-search-cta__inner {
    position: relative; z-index: 1;
    max-width: 640px;
    margin: 0 auto;
}
.mch-search-cta h2 {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 12px;
}
.mch-search-cta p {
    color: rgba(255,255,255,0.75);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 24px;
}
.mch-search-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ast-global-color-0);
    color: #fff;
    padding: 14px 32px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    transition: filter 0.2s, transform 0.2s;
}
.mch-search-cta__btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    color: #fff;
}

/* Empty state — no results */
.mch-search-empty {
    max-width: 640px;
    margin: 0 auto;
    padding: 60px 20px;
    text-align: center;
}
.mch-search-empty__icon {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 20px;
}
.mch-search-empty__title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
}
.mch-search-empty__desc {
    color: #6b7280;
    font-size: 1rem;
    margin: 0 0 24px;
}
.mch-search-empty__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border: 1px solid var(--ast-global-color-0);
    border-radius: 8px;
    color: var(--ast-global-color-0);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.mch-search-empty__btn:hover {
    background: var(--ast-global-color-0);
    color: #fff;
}

/* ─── 404 PAGE ─── */
.mch-404-code {
    font-size: clamp(5rem, 12vw, 8rem);
    font-weight: 900;
    color: rgba(255, 255, 255, 0.08);
    line-height: 1;
    margin: 0 0 8px;
    letter-spacing: -0.04em;
    user-select: none;
}

/* Section wrappers */
.mch-404-section {
    position: relative;
    left: 50%; right: 50%;
    margin-left: -50vw; margin-right: -50vw;
    width: 100vw; max-width: 100vw;
    padding: 3.5rem 24px 2.5rem;
    border-top: 1px solid #e8ecf0;
}
.mch-404-section--rankings {
    background: #f8fafc;
}
.mch-404-section--categories {
    background: #fff;
}
.mch-404-section__inner {
    max-width: 1200px;
    margin: 0 auto;
}
.mch-404-section-title {
    text-align: center;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.02em;
    margin: 0 0 0.4rem;
}
.mch-404-section-desc {
    text-align: center;
    color: #6b7280;
    font-size: 0.92rem;
    margin: 0 0 1.5rem;
}

/* Category pills inside 404 */
.mch-404 .taxonomy-grid {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    justify-content: center;
    grid-template-columns: none;
}
.mch-404 .tax-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 2rem;
    background: #f8fafc;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.82rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.mch-404 .tax-item:hover {
    background: var(--ast-global-color-0);
    color: #fff;
    border-color: var(--ast-global-color-0);
}
.mch-404 .tax-item:hover .tax-count {
    color: rgba(255, 255, 255, 0.7);
}
.mch-404 .tax-count {
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.75rem;
}

/* Rankings grid inside 404 — override padding */
.mch-404-section .mch-cat-grid {
    max-width: none;
    padding: 0;
}

/* ─── 8. RESPONSIVE ─── */
@media (max-width: 1024px) {
    .mch-tops-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .mch-cat-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .mch-tops-hero {
        padding: 40px 16px 36px;
    }
    .mch-cat-hero {
        padding: 40px 16px 36px;
    }
    .mch-search-hero {
        padding: 40px 16px 36px;
    }
    .mch-search-cta {
        padding: 40px 16px;
    }
    .mch-tops-grid {
        grid-template-columns: 1fr;
    }
    .mch-tops-card {
        border-right: none;
    }
    .mch-cat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .mch-tops-section__head {
        padding: 16px 18px;
    }
    .mch-tops-card {
        padding: 12px 14px;
    }
    .mch-cat-hero__avatar {
        width: 64px; height: 64px;
        font-size: 1.6rem;
        border-radius: 14px;
    }
}

@media (max-width: 480px) {
    .mch-cat-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .mch-tops-section__viewall {
        width: 100%;
        text-align: center;
        margin-top: 8px;
    }
    .mch-tops-hero__search,
    .mch-cat-hero__search,
    .mch-search-hero__search {
        flex-direction: column;
    }
    .mch-tops-hero__search button,
    .mch-cat-hero__search button,
    .mch-search-hero__search button {
        justify-content: center;
    }
}
