/**
 * Product card (tile) of the redesign: category grid, search, Hyvä product sliders
 * (home "Top-Artikel" / "Aktionen", cart cross-sells). Markup: Magento_Catalog::product/list/item.phtml.
 *
 * Plain CSS, loaded globally after styles.css (Magento_Theme/layout/default_head_blocks.xml),
 * because the compiled Tailwind bundle cannot be rebuilt reliably; see header-footer.css.
 * Uses the --srg-* tokens from header-footer.css (with fallbacks).
 * Mobile (< 768px): compact card, the whole card is the link, no button.
 */

.srg-card {
    --card-ink: var(--srg-ink, #0b1b2b);
    --card-navy: var(--srg-navy, #00366f);
    --card-muted: var(--srg-muted, #4a5b6e);
    --card-line: var(--srg-line, #d8e0e9);
    --card-pill: #e7eef6;
    --card-head: DDIN, "Helvetica Neue", Arial, sans-serif;
    --card-body: "DM Sans", "Helvetica Neue", Arial, sans-serif;

    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--card-line);
    border-radius: 12px;
    background: #fff;
    color: var(--card-ink);
    font-family: var(--card-body);
    text-align: left;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.srg-card:hover { border-color: #b9c7d6; box-shadow: 0 4px 14px rgba(0, 30, 60, .08); }

/* ---------- Image + badges ---------- */
.srg-card__media {
    position: relative;
    display: block;
    flex: 0 0 auto;
    height: 240px;
    margin: 0;
    overflow: hidden;
    background: #0b2440;
}
.srg-card__media img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}
.srg-card__badges {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: calc(100% - 24px);
    pointer-events: none;
}
.srg-card__badge {
    padding: 4px 8px;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 30, 60, .28);
    color: var(--card-navy);
    font: 700 12px/1.3 var(--card-body);
    white-space: nowrap;
}
.srg-card__badge--sale { background: var(--srg-yellow, #ffc20e); color: var(--card-ink); }

/* ---------- Text ---------- */
.srg-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 14px 16px 16px;
}
.srg-card__name {
    color: var(--card-ink);
    font: 600 17px/1.3 var(--card-body);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.srg-card__name:hover { color: var(--card-navy); text-decoration: underline; }
.srg-card__meta { color: var(--card-muted); font-size: 14px; line-height: 1.4; }

.srg-card__colors { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 20px; }
.srg-card__dot {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--dot-line, #9aabbb);
    border-radius: 50%;
    background: var(--dot, #eef2f5);
}
/* Colour without swatch colour or known name */
.srg-card__dot--unknown { background: repeating-linear-gradient(135deg, #eef3f8 0 3px, #c9d4df 3px 5px); }
.srg-card__colors-label { padding-left: 2px; color: var(--card-muted); font-size: 13px; line-height: 1.3; }

/* ---------- Price ---------- */
.srg-card__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 6px;
    margin-top: auto;
    padding-top: 4px;
}
.srg-card__amount { color: var(--card-navy); font: 700 22px/1.1 var(--card-head); white-space: nowrap; }
.srg-card__unit { color: var(--card-muted); font-size: 12px; line-height: 1.3; }

/* Netto / Brutto: the header switch toggles html.srg-vat-including (product/list/js/price-box.phtml) */
.srg-card .srg-vat-incl,
.srg-vat-including .srg-card .srg-vat-excl { display: none; }
.srg-vat-including .srg-card .srg-vat-incl { display: inline; }

/* ---------- Button (ghost) ---------- */
.srg-card__cta {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 0 22px;
    border: 1.5px solid var(--card-navy);
    border-radius: 8px;
    background: #fff;
    color: var(--card-navy);
    font: 600 15px/1 var(--card-body);
    text-decoration: none;
    cursor: pointer;
}
.srg-card__cta:hover { background: var(--card-pill); color: var(--card-navy); }
.srg-card__name:focus-visible,
.srg-card__cta:focus-visible { outline: 2px solid var(--card-navy); outline-offset: 2px; }

/* ---------- List mode (category list view) ---------- */
@media (min-width: 768px) {
    .srg-card--list { flex-direction: row; }
    .srg-card--list .srg-card__media { width: 280px; height: auto; min-height: 220px; }
    .srg-card--list .srg-card__cta { width: auto; align-self: flex-start; }
}

/* ---------- Mobile: compact card, the card is the link ---------- */
@media (max-width: 767px) {
    .srg-card:hover { box-shadow: none; }
    .srg-card__media { height: 160px; }
    .srg-card__badges { top: 8px; left: 8px; gap: 4px; max-width: calc(100% - 16px); }
    .srg-card__badge { padding: 3px 7px; font-size: 11px; }
    .srg-card__body { gap: 5px; padding: 10px 10px 12px; }
    .srg-card__name { font-size: 14px; line-height: 1.25; }
    .srg-card__name:hover { text-decoration: none; }
    /* Stretched link: the name link covers the whole card */
    .srg-card__name::after { content: ""; position: absolute; inset: 0; z-index: 3; }
    .srg-card__name:focus-visible { outline: 0; }
    .srg-card:has(.srg-card__name:focus-visible) { outline: 2px solid var(--card-navy); outline-offset: 2px; }
    .srg-card__meta { font-size: 12px; line-height: 1.3; }
    .srg-card__colors { gap: 4px; min-height: 14px; }
    .srg-card__dot { width: 12px; height: 12px; }
    .srg-card__colors-label { display: none; }
    .srg-card__price { flex-direction: column; align-items: flex-start; gap: 0; padding-top: 0; }
    .srg-card__amount { font-size: 18px; }
    .srg-card__unit { font-size: 11px; }
    .srg-card__cta { display: none; }

    /* Sliders: fixed-width cards that scroll sideways (design: 164px card, 12px gap) */
    .srg-card-slide { width: 176px; padding-right: 6px; padding-left: 6px; }
}

/* ---------- Home page sliders ----------
 * The home CMS content carries its own inline .hp-slider card styles: a forced body font
 * (!important) and a per-slider fake badge (.product-item-photo::before "Bestseller"/"Aktion").
 * Keep the price in the head font and drop the fake badge when the card has real badges,
 * so they do not overlap. */
.hp-slider .srg-card .srg-card__amount { font-family: var(--card-head) !important; }
.hp-slider .srg-card:has(.srg-card__badges) .product-item-photo::before { content: none; }

/* Category grid on tablets: two columns, slightly lower image */
@media (min-width: 768px) and (max-width: 1023px) {
    .products-grid .srg-card__media { height: 200px; }
}
