:root {
    --card-bg: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-blur: 14px;
    --title-size: 1.8rem;
    --text-size: 1.3rem;
}

.course-card {
    /* Slightly wider so promotional creatives show full artwork */
    max-width: 420px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: #ffffff;
    border-radius: 1.8rem;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 24px #00000014;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: auto;
    transition: all .3s ease;
}

.like-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: white;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 3;
    transition: transform .3s ease;
    padding: 8px;
    font-size: 12px;
    border-radius: 25px;
}

.like-btn svg {
    fill: #cacaca;
    transition: fill .3s ease;
}

.like-btn.liked svg {
    fill: var(--theme-secondary-dark);
}

.like-btn:hover {
    transform: scale(1.18);
}

.like-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.image-wrapper {
    position: relative;
    height: auto;
    /* max-height lives on .image-inner-wrapper so badges can hang into the content seam */
    overflow: visible;
}

.course-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center top;
    transition: transform .5s ease;
}

.course-card:hover .course-img {
    transform: scale(1.02);
}

.ribbon {
    display: none !important; /* Reemplazado por .zp-sale-seal--card */
}

/* Descuento en cards — intersección imagen/contenido */
.course-card .zp-sale-seal--card {
    --seal: var(--theme-secondary-dark, #d4789a);
    position: absolute;
    top: auto;
    bottom: 0;
    left: 2rem;
    right: auto;
    z-index: 5;
    width: 4.85rem;
    height: 4.85rem;
    margin-top: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    transform: translateY(calc(50% + 4px));
    filter: none;
    background: none;
    border-radius: 0;
}

.course-card .zp-sale-seal--card .zp-sale-seal__svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    transform-origin: 50% 50%;
    animation: none;
}

.course-card:hover .zp-sale-seal--card .zp-sale-seal__svg {
    animation: zpCardSealSvgPulse 1.4s ease-in-out infinite;
}

.course-card .zp-sale-seal--card .zp-sale-seal__shape {
    fill: var(--seal);
    stroke: #fff;
    stroke-width: 8;
    stroke-linejoin: round;
    stroke-linecap: round;
    paint-order: stroke fill;
}

.course-card .zp-sale-seal--card .zp-sale-seal__pct {
    position: relative;
    z-index: 1;
    display: block;
    color: #fff;
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 1;
    transform: rotate(-14deg);
    animation: none;
}

.course-card:hover .zp-sale-seal--card .zp-sale-seal__pct {
    animation: zpCardSealPct 1.4s ease-in-out infinite;
}

@keyframes zpCardSealPct {
    0%, 100% { transform: rotate(-14deg) scale(1); }
    50% { transform: rotate(-14deg) scale(1.08); }
}

@keyframes zpCardSealSvgPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
    .course-card:hover .zp-sale-seal--card .zp-sale-seal__pct,
    .course-card:hover .zp-sale-seal--card .zp-sale-seal__svg {
        animation: none;
    }
    .course-card .zp-sale-seal--card .zp-sale-seal__pct {
        transform: rotate(-14deg);
    }
}

/* Espacio para sello/badge en la intersección imagen ↔ contenido */
.course-card:has(.zp-sale-seal--card) .card-content,
.course-card:has(.z-badge--tiny) .card-content,
.course-card:has(.zp-owned-seal) .card-content {
    padding-top: 2.5rem;
}

.card-content {
    position: relative;
    z-index: 1;
    padding: 1.25rem 2rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
}

.course-title {
    font-size: var(--title-size);
    color: var(--theme-primary);
    margin: 0 0 .6rem;
    line-height: 1.3;
    position: relative;
    z-index: 1;
    /* Reserva 2 líneas para alinear precios entre cards */
    min-height: calc(var(--title-size) * 1.3 * 2);
}

.course-desc {
    font-size: var(--text-size);
    color: #000;
    line-height: 1.45;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    font-weight: 400;
    /* Reserva 3 líneas fijas */
    min-height: calc(var(--text-size) * 1.45 * 3);
}

.course-price {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--theme-secondary-dark);
    margin-top: auto;
    padding-top: 1rem;
    margin-bottom: 1.3rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-start;
    gap: .1rem .55rem;
}

.course-price__current {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.course-price del {
    color: #888;
    font-weight: 700;
    margin-right: .5rem;
    font-size: 0.86em;
    line-height: 1;
    margin-top: 0.34em;
}

.course-price del .amount,
.course-price del .woocommerce-Price-amount,
.course-price del bdi {
    font-size: inherit !important;
    font-weight: 700;
}

.course-price ins {
    text-decoration: none;
    font-size: 1em;
    line-height: 1;
}

.course-price ins .amount,
.course-price ins .woocommerce-Price-amount,
.course-price ins bdi {
    font-size: inherit !important;
}

.course-price__save {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: var(--theme-primary-dark, #4a8f85);
    background: none;
    border: 0;
    padding: 0;
    border-radius: 0;
    display: block;
    width: auto;
    line-height: 1.2;
    text-align: right;
    white-space: nowrap;
}

.course-price__save .amount,
.course-price__save .woocommerce-Price-amount,
.course-price__save bdi {
    font-size: .95rem !important;
    font-weight: 800;
    color: var(--theme-primary-dark, #4a8f85);
}

.course-price__save-pct {
    font-weight: 700;
    color: var(--theme-primary, #6fb3a9);
}

.course-price ins,
.course-price ins .amount,
.course-price ins .woocommerce-Price-amount {
    color: var(--theme-secondary-dark, #d4789a);
}

.course-actions {
    margin-top: 0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    align-items: stretch;
    align-self: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.course-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    font-size: 1.3rem;
    padding: .9rem 2rem;
    border-radius: 1.2rem;
    transition: background .3s ease, transform .3s ease;
    background: var(--theme-primary);
    color: #fff;
    flex: 0 1 auto;
    min-width: 0;
    box-sizing: border-box;
    white-space: nowrap;
}

.course-btn:hover {
    transform: translateY(-2px);
    background: var(--theme-primary-dark);
}

.course-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
}

.course-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.cart-btn {
    background: var(--theme-secondary-dark);
    border: none;
    border-radius: 1.2rem;
    padding: .6rem .9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .3s ease, background .3s ease;
    flex: 0 0 auto;
}

.cart-btn svg {
    fill: #fff;
}

.cart-btn:hover:not([disabled]) {
    transform: translateY(-2px);
    background: var(--theme-secondary-dark);
}

.cart-btn[disabled] {
    background: #bbb;
    cursor: not-allowed;
}

.cart-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.heart {
    position: fixed;
    font-size: 1.6rem;
    pointer-events: none;
    color: var(--theme-secondary);
    z-index: 999;
    will-change: transform, opacity;
}

.splide__slide {
    padding: 25px 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.splide__slide > .course-card {
    width: 100%;
    max-width: 420px;
    height: auto;
    min-width: 0;
}

/* Shop loop — mismo marco que .splide__slide en el home */
.products {
    display: grid;
    gap: 0;
    list-style: none;
    padding: 0;
    margin-bottom: 40px;
}

.products > li.product {
    padding: 25px 15px;
    margin: 0 !important;
    float: none !important;
    width: 100% !important;
    max-width: none !important;
    clear: none !important;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-sizing: border-box;
}

.products > li.product > .course-card {
    width: 100%;
    height: auto;
    max-width: 420px;
    min-width: 0;
}

.products > li.product .course-card a img,
.products > li.product .course-card .course-img {
    margin: 0 !important;
    width: 100% !important;
    height: auto;
    box-shadow: none !important;
}

.products > li.product .course-title,
.products > li.product .course-title a {
    font-family: var(--font-heading-family, "DM Serif Text", serif) !important;
    font-size: var(--title-size, 1.8rem) !important;
    font-weight: var(--font-heading-weight, 400) !important;
    padding: 0 !important;
    margin: 0 0 .6rem !important;
    line-height: 1.3 !important;
    color: var(--theme-primary) !important;
    min-height: calc(var(--title-size, 1.8rem) * 1.3 * 2);
    text-decoration: none !important;
}

.products > li.product .course-title a:hover {
    color: var(--theme-primary-dark, #4a8f85) !important;
}

.columns-1 {
    grid-template-columns: 1fr;
}

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

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

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

.woocommerce-result-count {
    display: none;
}

@media (max-width: 768px) {

    .course-title,
    .products > li.product .course-title,
    .products > li.product .course-title a {
        font-size: 2.05rem !important;
    }

    .course-desc {
        font-size: 1.4rem;
    }

    .course-price {
        font-size: 2.05rem;
    }

    .course-btn {
        font-size: 1.6rem;
        padding: 1.05rem 2.15rem;
    }

    .cart-btn {
        padding: 0.85rem 1.15rem;
    }

    .cart-btn svg {
        width: 1.35em;
        height: 1.35em;
    }

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

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

    .splide__slide,
    .products > li.product {
        padding: 1.25rem 1rem 2.35rem !important;
    }
}

@media (max-width: 576px) {

    .course-title,
    .products > li.product .course-title,
    .products > li.product .course-title a {
        font-size: 2.05rem !important;
    }

    .course-desc {
        font-size: 1.4rem;
    }

    .course-price {
        font-size: 2.05rem;
    }

    .course-btn {
        font-size: 1.6rem;
        padding: 1.05rem 2.15rem;
    }

    .cart-btn {
        padding: 0.85rem 1.15rem;
    }

    .cart-btn svg {
        width: 1.35em;
        height: 1.35em;
    }

    .columns-2,
    .columns-3,
    .columns-4 {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .splide__slide,
    .products > li.product {
        padding: 1.15rem 0.85rem 2.5rem !important;
    }
}

/* Small "Nuevo" badge — centrado en la intersección imagen / contenido */
.course-card .image-wrapper {
    position: relative;
    overflow: visible;
    z-index: 2; /* por encima del glass para que el badge/sello se vean en la costura */
}

.course-card .z-badge {
    display: inline-flex;
    align-items: center;
    padding: .22rem .5rem;
    border-radius: 999px;
    font-weight: 700;
    line-height: 1;
    z-index: 3;
}

.course-card .z-badge--new {
    background: linear-gradient(135deg, #ffe252 0%, #e4c67b 100%);
    color: #5d5200;
}

.course-card .z-badge--tiny {
    position: absolute;
    top: auto;
    bottom: 0;
    left: auto;
    right: 2.75rem;
    z-index: 5;
    font-size: .72rem;
    padding: .22rem .5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    /* 50% baja el centro del badge justo a la línea imagen↔contenido (+ mitad del gap) */
    transform: translateY(calc(50% + 4px)) scale(2);
    transform-origin: center center;
    animation: zpNuevoPulse 2s ease-in-out infinite;
}

/* Owned marker — cinta rectangular con dos puntas a la izquierda */
.course-card .zp-owned-seal {
    --seal: var(--theme-primary, #3fa290);
    position: absolute;
    top: auto;
    right: 0;
    bottom: 0;
    left: auto;
    z-index: 5;
    width: auto;
    min-width: 7.6rem;
    height: 2.55rem;
    display: inline-grid;
    place-items: center end;
    padding: 0 0.9rem 0 1.85rem;
    pointer-events: none;
    transform: translateY(calc(50% + 4px));
    transform-origin: center center;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .18));
    overflow: visible;
}

.course-card .zp-owned-seal__svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    transform-origin: 50% 50%;
}

.course-card .zp-owned-seal__shape {
    fill: var(--seal);
    stroke: #fff;
    stroke-width: 5;
    stroke-linejoin: miter;
    stroke-linecap: butt;
    paint-order: stroke fill;
    vector-effect: non-scaling-stroke;
}

.course-card .zp-owned-seal__label {
    position: relative;
    z-index: 1;
    display: block;
    width: max-content;
    max-width: none;
    color: #fff;
    font-size: 1.12rem;
    font-weight: 900;
    letter-spacing: 0.01em;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    transform: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}

@keyframes zpNuevoPulse {
    0%, 100% { transform: translateY(calc(50% + 4px)) scale(2); }
    50% { transform: translateY(calc(50% + 4px)) scale(2.1); }
}

@media (prefers-reduced-motion: reduce) {
    .course-card .z-badge--tiny {
        animation: none;
        transform: translateY(calc(50% + 4px)) scale(2);
    }
}


/* ===== Hover swap styles ===== */
.course-card .image-inner-wrapper {
    position: relative;
    overflow: hidden;
    /* No max-height crop — show the full promotional image */
    max-height: none;
    background: #f4fbfa;
}

.course-card .course-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    object-position: center top;
    transition: opacity .28s ease, transform .28s ease;
    will-change: opacity, transform;
    backface-visibility: hidden;
}

.course-card .img-primary {
    opacity: 1;
}

.course-card .img-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Never letterbox the swap/gallery photo — fill the frame */
    object-fit: cover !important;
    object-position: center center !important;
    opacity: 0;
    pointer-events: none;
    background: transparent;
}

@media (max-width: 480px) {
    .course-card,
    .splide__slide > .course-card,
    .products > li.product > .course-card {
        max-width: min(100%, 420px);
    }
}

.course-card:hover .img-primary,
.course-card:focus-within .img-primary {
    opacity: 0;
    transform: scale(1.02);
}

.course-card:hover .img-hover,
.course-card:focus-within .img-hover {
    opacity: 1;
    transform: scale(1.0);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .course-card .course-img {
        transition: none;
    }
}