/* ============================================================
   PRODUCT REFERENCES · Shortcodes [wa_product_ref]
   Tabellen-aehnliche Liste fuer Produkt-Verweise innerhalb der
   WC-Long-Description. Mehrere .wa-product-ref-Bloecke nacheinander
   ergeben eine zusammenhaengende Tabelle (Border ueber :first-of-type
   und :last-of-type gesetzt).
============================================================ */

.wa-product-ref {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: clamp(1rem, 2.5vw, 1.75rem);
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--color-bg-mid);
    color: var(--color-accent);
}

.wa-product-ref:first-of-type {
    border-top: 1px solid var(--color-bg-mid);
}

.wa-product-ref:last-of-type {
    margin-bottom: 1em;
}

/* Manuelle Variante (kein Produkt verlinkt) -> kein CTA-Cell. */
.wa-product-ref--no-cta {
    grid-template-columns: 140px 1fr;
}

/* Manuelle Variante ohne Bild -> body nimmt volle Breite. */
.wa-product-ref--no-image {
    grid-template-columns: 1fr auto;
}

.wa-product-ref--no-image.wa-product-ref--no-cta {
    grid-template-columns: 1fr;
}

/* ----- Image cell ----- */
.wa-product-ref__image {
    display: block;
    width: 140px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-bg-soft);
    transition: opacity 220ms ease;
}

.wa-product-ref__image:hover {
    opacity: 0.92;
}

.wa-product-ref__image img,
.wa-product-ref__image .wa-product-ref__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* ----- Body cell ----- */
.wa-product-ref__body {
    min-width: 0;
}

.wa-product-ref__name {
    margin: 0 0 0.5rem;
    font-size: var(--fs-card-title);
    line-height: 1.3;
    font-weight: 600;
    color: var(--color-accent);
}

.wa-product-ref__name a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 220ms ease;
}

.wa-product-ref__name a:hover {
    border-bottom-color: var(--color-accent);
}

.wa-product-ref__text {
    font-size: var(--fs-body);
    line-height: 1.6;
    color: var(--color-accent);
}

.wa-product-ref__text p {
    margin: 0 0 0.5rem;
}

.wa-product-ref__text p:last-child {
    margin-bottom: 0;
}

/* ----- CTA cell ----- */
.wa-product-ref__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    color: var(--color-accent);
    font-weight: 500;
    font-size: var(--fs-small);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: border-color 220ms ease, gap 220ms ease;
}

.wa-product-ref__cta:hover,
.wa-product-ref__cta:focus-visible {
    border-bottom-color: var(--color-accent);
    gap: 0.6em;
    outline: none;
}

.wa-product-ref__cta-arrow {
    font-weight: 600;
    transition: transform 220ms ease;
}

.wa-product-ref__cta:hover .wa-product-ref__cta-arrow {
    transform: translateX(2px);
}

/* ============================================================
   Responsive · Mobile stack: image links + body/cta rechts
============================================================ */
@media (max-width: 767px) {
    .wa-product-ref {
        grid-template-columns: 88px 1fr;
        grid-template-areas:
            "image body"
            "image cta";
        gap: 0.5rem 1rem;
        align-items: start;
        padding: 1rem 0;
    }
    .wa-product-ref__image { grid-area: image; width: 88px; }
    .wa-product-ref__body  { grid-area: body; }
    .wa-product-ref__cta   { grid-area: cta; justify-self: start; }

    .wa-product-ref--no-cta {
        grid-template-columns: 88px 1fr;
        grid-template-areas: "image body";
    }

    .wa-product-ref--no-image {
        grid-template-columns: 1fr;
        grid-template-areas:
            "body"
            "cta";
    }

    .wa-product-ref--no-image.wa-product-ref--no-cta {
        grid-template-columns: 1fr;
        grid-template-areas: "body";
    }

    .wa-product-ref__name {
        font-size: var(--fs-card-title);
        margin-bottom: 0.25rem;
    }

    .wa-product-ref__text {
        font-size: var(--fs-small);
    }
}
