/* Produktkachel (seit 2026-10-02): das Foto IST die Karte.
 *
 * Vorbild sind grosse Modeshops: Hochformat 3:4, randlos, Mensch statt Packshot, darunter nur
 * Preis, Staffel, Name, Eckdaten und Farbpunkte. Modelfotos kommen aus product_model_photos
 * (Stanley/Stella), Artikel ohne solche Fotos zeigen ihren Packshot eingepasst statt
 * beschnitten — ein Kugelschreiber im 3:4-Ausschnitt waere nur noch ein Strich.
 *
 * Farben ueber die Variablen aus shop-overrides.css, damit die Kachel einen spaeteren
 * Markenwechsel ohne Umbau mitmacht. Markup: templates/storefront/_theme_product_card.php,
 * Verhalten: public/assets/js/storefront/product-card.js. */

.gb-card {
    --gb-tile: #ececea;
    --gb-ink: var(--shop-ink, #222);
    --gb-muted: var(--shop-muted, #6b6863);
    --gb-hot: #d9420c;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    margin: 0 0 34px;
}

.gb-card__media { position: relative; }
.gb-card__tile {
    position: relative;
    display: block;
    aspect-ratio: 3 / 4;
    background: var(--gb-tile);
    overflow: hidden;
}
.gb-card__tile picture,
.gb-card__tile img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.gb-card__tile img {
    object-fit: cover;
    object-position: 50% 30%;
    transition: opacity .35s ease, transform .6s ease;
}
/* Packshot auf hellem Grund: einpassen, Weiss mit dem Kachelgrund verschmelzen lassen. */
.gb-card__tile.is-packshot { background: #f4f4f2; }
.gb-card__tile.is-packshot img {
    object-fit: contain;
    padding: 9%;
    mix-blend-mode: multiply;
}
.gb-card__back { opacity: 0; }
.gb-card__placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 48px;
    font-weight: 700;
    color: var(--gb-muted);
}

@media (hover: hover) {
    .gb-card:hover .gb-card__tile img { transform: scale(1.025); }
    .gb-card.has-back:hover .gb-card__front { opacity: 0; }
    .gb-card.has-back:hover .gb-card__back { opacity: 1; }
}

.gb-card__pill {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 2;
    padding: 3px 10px;
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--gb-ink);
}
.gb-card__pill.is-hot { color: var(--gb-hot); }
.gb-card__flag {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(20, 20, 26, .82);
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
    transition: opacity .2s;
}
.gb-card__quick {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    height: 42px;
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--gb-ink);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
}
.gb-card__quick::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--shop-brand, #309bd9);
}
@media (hover: hover) {
    .gb-card:hover .gb-card__quick,
    .gb-card__tile:focus-visible .gb-card__quick { opacity: 1; transform: none; }
    .gb-card:hover .gb-card__flag { opacity: 0; }
}

/* Merken/Vergleichen: dieselben Formulare wie bisher (favorites.js/compare.js haengen an den
   Klassen), nur oben rechts gestapelt und immer sichtbar. */
.gb-card__actions {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 3;
    display: grid;
    gap: 6px;
}
.gb-card__actions .shop-action-form { margin: 0; padding: 0; }
.gb-card__actions .shop-action-btn {
    transform: none;
    margin: 0;
    width: 36px;
    height: 36px;
    line-height: 36px;
    background: rgba(255, 255, 255, .92);
}
.gb-card__actions .sf-compare-btn { opacity: 0; transition: opacity .2s; }
.gb-card:hover .gb-card__actions .sf-compare-btn,
.gb-card__actions .sf-compare-btn[data-compared="1"],
.gb-card__actions .sf-compare-btn:focus-visible { opacity: 1; }
@media (hover: none) { .gb-card__actions .sf-compare-btn:not([data-compared="1"]) { display: none; } }

.gb-card__info {
    display: grid;
    gap: 3px;
    padding-top: 10px;
    min-width: 0;
}
.gb-card__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    font-variant-numeric: tabular-nums;
    color: var(--gb-ink);
}
.gb-card__price strong { font-size: 16px; font-weight: 700; }
.gb-card__price small { font-size: 13px; color: var(--gb-muted); }
.gb-card__price del { font-size: 13px; color: var(--gb-muted); }
.gb-card__price.is-sale strong { color: var(--gb-hot); }
.gb-card__tier {
    font-size: 13px;
    color: var(--shop-brand-dark, #1f78ab);
    font-variant-numeric: tabular-nums;
}
.gb-card__name {
    display: block;
    font-size: 14px;
    line-height: 1.4;
    color: var(--gb-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gb-card__name:hover { text-decoration: underline; color: var(--gb-ink); }
.gb-card__meta { font-size: 12.5px; color: var(--gb-muted); }
.gb-card__stars { font-size: 12px; color: var(--gb-muted); }

.gb-card__swatches {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 7px;
    flex-wrap: wrap;
}
.gb-swatch {
    position: relative;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14);
}
.gb-swatch::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid transparent;
    transition: border-color .15s;
}
.gb-swatch[aria-pressed="true"]::after { border-color: var(--gb-ink); }
.gb-swatch:hover::after { border-color: rgba(20, 20, 26, .4); }
.gb-swatch:focus-visible { outline: 2px solid var(--shop-brand, #309bd9); outline-offset: 4px; }
.gb-swatch.no-hex { background: repeating-linear-gradient(45deg, #ddd 0 4px, #f4f4f4 4px 8px); }
.gb-card__more {
    height: 24px;
    min-width: 30px;
    padding: 0 6px;
    border-radius: 12px;
    border: 1px solid rgba(20, 20, 26, .14);
    font-size: 11.5px;
    line-height: 22px;
    text-align: center;
    color: var(--gb-muted);
}

/* Handy: Halara-Prinzip, zwei Spalten mit schmaler Fuge, damit die Fotos gross bleiben. */
@media (max-width: 575.98px) {
    .grid-style .product-item.col-6 { padding-left: 4px; padding-right: 4px; }
    .gb-card { margin-bottom: 26px; }
    .gb-card__pill { left: 6px; top: 6px; font-size: 11px; padding: 2px 8px; }
    .gb-card__flag { left: 6px; bottom: 6px; font-size: 11px; }
    .gb-card__actions { right: 6px; top: 6px; }
    .gb-card__actions .shop-action-btn { width: 32px; height: 32px; line-height: 32px; }
    .gb-card__tier { font-size: 12px; }
    .gb-card__swatches { gap: 7px; }
    .gb-swatch { width: 22px; height: 22px; }
}

/* Listenansicht der Kategorieseite: Foto links, Angaben rechts. */
.list-style .gb-card { flex-direction: row; gap: 20px; align-items: center; }
.list-style .gb-card__media { flex: 0 0 200px; }
.list-style .gb-card__info { flex: 1 1 auto; padding-top: 0; }

@media (prefers-reduced-motion: reduce) {
    .gb-card *, .gb-card *::before, .gb-card *::after { transition: none !important; }
}
