/* ============================================================
   YAGARO · Tienda (archive-product) — layout del mockup.
   Se carga solo en is_shop()/categoría/etiqueta (ver functions.php).
   Las tarjetas de producto (.yg-card*) se estilan en style.css.
   ============================================================ */

:root {
    --yg-ink: #1a1a1a;
    --yg-muted: #888;
    --yg-cream: #f6f1ea;
    --yg-line: #e7e0d6;
    --yg-gradient: linear-gradient(155deg, #cfe0d8 0%, #8fb3ad 45%, #3f6f6a 100%);
}

/* Full-bleed: rompe el contenedor estrecho de .content_inner */
.yagaro-shop {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    overflow-x: hidden;
    background: #fff;
    color: var(--yg-ink);
    -webkit-font-smoothing: antialiased;
}

.yagaro-shop *,
.yagaro-shop *::before,
.yagaro-shop *::after { box-sizing: border-box; }

/* Eyebrow compartido */
.yagaro-shop .yg-eyebrow {
    margin: 0 0 14px;
    font-size: 11px;
    color: var(--yg-muted);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 600;
}
.yagaro-shop .yg-eyebrow--light { color: rgba(255, 255, 255, 0.8); }

/* ============================ HERO ============================ */
.yg-shop-hero {
    position: relative;
    min-height: 280px;
    display: flex;
    align-items: center;
    padding: 56px clamp(20px, 5vw, 80px);
    background-size: cover;
    background-position: center;
    color: #fff;
}
.yg-shop-hero--gradient { background-image: var(--yg-gradient); }
.yg-shop-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.04));
    z-index: 1;
}
.yg-shop-hero__inner { position: relative; z-index: 2; max-width: 640px; }
.yg-shop-hero__title {
    margin: 0;
    font-size: clamp(34px, 4.6vw, 60px);
    line-height: 1.04;
    font-weight: 400;
    color: #fff;
    letter-spacing: 0;
}
.yg-shop-hero__title em { font-style: italic; font-weight: 400; }
.yg-shop-hero__sub {
    margin: 16px 0 0;
    max-width: 420px;
    font-size: 15px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

/* ====================== BARRA SUPERIOR ======================= */
.yg-shop-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px clamp(20px, 5vw, 80px);
    border-bottom: 1px solid var(--yg-line);
}
.yg-shop-bar__crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--yg-muted);
}
.yg-shop-bar__crumbs a { color: var(--yg-muted); text-decoration: none; }
.yg-shop-bar__crumbs a:hover { color: var(--yg-ink); }
.yg-shop-bar__tools { display: flex; align-items: center; gap: 22px; }
.yg-shop-bar__count { font-size: 13px; color: var(--yg-muted); }
.yg-shop-bar__sort { display: flex; align-items: center; gap: 8px; }
.yg-shop-bar__sort > span { font-size: 13px; color: var(--yg-muted); }
.yg-shop-bar__sort select {
    border: 1px solid var(--yg-line);
    border-radius: 999px;
    padding: 8px 30px 8px 14px;
    font-size: 13px;
    color: var(--yg-ink);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231a1a1a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* =================== CONTROLES MÓVIL =================== */
.yg-shop-mobilebar { display: none; }

/* =========================== LAYOUT =========================== */
.yg-shop-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: clamp(24px, 4vw, 56px);
    align-items: start;
    padding: 32px clamp(20px, 5vw, 80px) 80px;
}

/* ---------- SIDEBAR ---------- */
.yg-shop-side__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.yg-shop-side__title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--yg-ink);
    flex: 1;
}
.yg-shop-side__clear {
    border: 0;
    background: none;
    color: var(--yg-muted);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.yg-shop-side__clear:hover { color: var(--yg-ink); }
.yg-shop-side__close { display: none; }
.yg-shop-side__foot { display: none; }

/* Fieldsets de filtro */
.yg-fset {
    border: 0;
    border-top: 1px solid var(--yg-line);
    margin: 0;
    padding: 22px 0;
}
.yg-fset__legend {
    padding: 0;
    margin: 0 0 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--yg-ink);
    width: 100%;
}
.yg-fset__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    cursor: pointer;
}
.yg-fset__sign { font-size: 16px; font-weight: 400; line-height: 1; }

/* Checkboxes de categoría */
.yg-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    cursor: pointer;
    font-size: 14px;
}
.yg-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.yg-check__box {
    width: 18px;
    height: 18px;
    border: 1.5px solid #c9c1b4;
    border-radius: 5px;
    flex-shrink: 0;
    position: relative;
    transition: background .15s ease, border-color .15s ease;
}
.yg-check input:checked + .yg-check__box {
    background: var(--yg-ink);
    border-color: var(--yg-ink);
}
.yg-check input:checked + .yg-check__box::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1.5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.yg-check input:focus-visible + .yg-check__box { outline: 2px solid var(--yg-ink); outline-offset: 2px; }
.yg-check__label { flex: 1; color: var(--yg-ink); }
.yg-check__count { color: var(--yg-muted); font-size: 13px; }

/* Subcategorías: sangradas bajo su categoría madre */
.yg-check--child {
    padding-left: 18px;
    font-size: 13px;
}
.yg-check--child .yg-check__label { color: var(--yg-muted); }

/* Pills de talla */
.yg-sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.yg-size {
    min-width: 42px;
    padding: 9px 12px;
    border: 1px solid var(--yg-line);
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: var(--yg-ink);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.yg-size:hover { border-color: var(--yg-ink); }
.yg-size.is-active { background: var(--yg-ink); border-color: var(--yg-ink); color: #fff; }

/* Precio */
.yg-price__inputs { display: flex; align-items: flex-end; gap: 10px; }
.yg-price__inputs label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--yg-muted); }
.yg-price__inputs input {
    width: 80px;
    padding: 8px 10px;
    border: 1px solid var(--yg-line);
    border-radius: 8px;
    font-size: 14px;
    color: var(--yg-ink);
}
.yg-price__sep { padding-bottom: 9px; color: var(--yg-muted); }
.yg-price__apply {
    margin-top: 12px;
    padding: 9px 16px;
    border: 1px solid var(--yg-ink);
    border-radius: 999px;
    background: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}
.yg-price__apply:hover { background: var(--yg-ink); color: #fff; }

/* ---------- MAIN ---------- */
.yg-shop-main { min-width: 0; }

/* Chips de filtros activos */
.yg-shop-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}
.yg-shop-chips:empty { display: none; }
.yg-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border: 1px solid var(--yg-line);
    border-radius: 999px;
    background: var(--yg-cream);
    font-size: 12px;
    color: var(--yg-ink);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.yg-chip:hover { border-color: var(--yg-ink); }
.yg-chip span { font-size: 14px; line-height: 1; color: var(--yg-muted); }
.yg-chip--clear {
    background: none;
    border-color: transparent;
    color: var(--yg-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Grid de productos */
.yg-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(18px, 2.4vw, 34px) clamp(14px, 1.8vw, 26px);
}
.yg-grid::before, .yg-grid::after { display: none !important; }
.yg-grid > li {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    float: none !important;
    clear: none !important;
}
.yg-grid > li::before { display: none !important; }
.yg-grid__empty {
    grid-column: 1 / -1;
    padding: 60px 0;
    text-align: center;
    color: var(--yg-muted);
    font-size: 15px;
}

/* Estado de carga */
.yagaro-shop.is-loading .yg-grid { opacity: .55; transition: opacity .2s ease; pointer-events: none; }

/* Cargar más */
.yg-shop-more { display: flex; justify-content: center; margin-top: 48px; }
.yg-loadmore { padding: 14px 40px; }
/* El atributo [hidden] debe ganar a .yagaro-btn-outline { display:inline-block },
   si no, "Cargar más" sigue visible cuando ya no hay más páginas / no hay resultados. */
.yg-loadmore[hidden] { display: none !important; }
.yg-shop-more:not(:has(.yg-loadmore:not([hidden]))) { margin-top: 0; }

/* =================== DRAWER / BACKDROP / SORT SHEET =================== */
.yg-shop-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
}
body.yg-shop-noscroll { overflow: hidden; }

.yg-shop-sort-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: #fff;
    border-radius: 18px 18px 0 0;
    padding: 8px 0 24px;
    transform: translateY(100%);
    transition: transform .25s ease;
}
.yg-shop-sort-sheet.is-open { transform: none; }
.yg-shop-sort-sheet__head {
    padding: 16px 22px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--yg-muted);
    border-bottom: 1px solid var(--yg-line);
}
.yg-shop-sort-sheet__opt {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: none;
    padding: 15px 22px;
    font-size: 15px;
    color: var(--yg-ink);
    cursor: pointer;
}
.yg-shop-sort-sheet__opt.is-active { font-weight: 700; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1024px) {
    .yg-shop-layout { grid-template-columns: 200px 1fr; }
    .yg-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    /* Oculta barra desktop, muestra controles móvil */
    .yg-shop-bar { display: none; }
    .yg-shop-mobilebar { display: block; padding: 14px 16px 0; }
    .yg-shop-mobilebar__btns { display: flex; gap: 12px; }
    .yg-mbtn {
        flex: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 14px;
        border: 1px solid var(--yg-line);
        border-radius: 999px;
        background: #fff;
        font-size: 13px;
        font-weight: 600;
        color: var(--yg-ink);
        cursor: pointer;
    }
    .yg-mbtn svg { width: 16px; height: 16px; }
    .yg-mbtn__count {
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        background: var(--yg-ink);
        color: #fff;
        font-size: 11px;
    }
    .yg-mbtn__count[hidden] { display: none; }

    /* Tabs de categoría */
    .yg-shop-tabs {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 16px 0 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .yg-shop-tabs::-webkit-scrollbar { display: none; }
    .yg-tab {
        white-space: nowrap;
        padding: 9px 16px;
        border: 1px solid var(--yg-line);
        border-radius: 999px;
        background: #fff;
        font-size: 13px;
        color: var(--yg-ink);
        cursor: pointer;
        flex-shrink: 0;
    }
    .yg-tab.is-active { background: var(--yg-ink); border-color: var(--yg-ink); color: #fff; }

    /* Layout a una columna, sidebar como drawer */
    .yg-shop-layout { display: block; padding: 16px 16px 64px; }

    .yg-shop-side {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(86vw, 360px);
        z-index: 9999;
        background: #fff;
        padding: 20px 20px 0;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform .28s ease;
        display: flex;
        flex-direction: column;
    }
    .yg-shop-side.is-open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, 0.18); }
    .yg-shop-side__close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        border: 0;
        background: none;
        font-size: 26px;
        line-height: 1;
        color: var(--yg-ink);
        cursor: pointer;
    }
    .yg-shop-side > form { flex: 1; }
    .yg-shop-side__foot {
        display: block;
        position: sticky;
        bottom: 0;
        margin: 0 -20px;
        padding: 14px 20px;
        background: #fff;
        border-top: 1px solid var(--yg-line);
    }
    .yg-shop-side__see { width: 100%; padding: 14px; }

    .yg-grid { gap: 22px 14px; }
    .yg-shop-chips { margin: 18px 0; }
}

@media (max-width: 380px) {
    .yg-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 10px; }
}
