/*
 * Tiny Shop – Standard-Styles
 * Farben und Abstände lassen sich über die CSS-Variablen im Projekt anpassen, z. B.:
 *   .tiny-shop, .tiny-shop-order, .tiny-shop-toast { --tiny-shop-accent: #b01a4b; }
 */

:root {
    --tiny-shop-accent: #1d5fa0;
    --tiny-shop-accent-contrast: #fff;
    --tiny-shop-border: rgb(0 0 0 / 0.15);
    --tiny-shop-muted: rgb(0 0 0 / 0.6);
    --tiny-shop-surface: #fff;
    --tiny-shop-radius: 6px;
    --tiny-shop-gap: 1.5rem;
    --tiny-shop-min-width: 15rem;
    --tiny-shop-image-ratio: 3 / 4;
    --tiny-shop-image-background: rgb(0 0 0 / 0.03);
}

.tiny-shop [hidden],
.tiny-shop-order [hidden] {
    display: none !important;
}

/* Filter */

.tiny-shop-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: var(--tiny-shop-gap);
}

.tiny-shop-filter__item {
    padding: 0.35em 0.9em;
    border: 1px solid var(--tiny-shop-border);
    border-radius: 999px;
    color: inherit;
    text-decoration: none;
    line-height: 1.4;
}

.tiny-shop-filter__item:hover,
.tiny-shop-filter__item:focus-visible {
    border-color: var(--tiny-shop-accent);
}

.tiny-shop-filter__item[aria-current] {
    background: var(--tiny-shop-accent);
    border-color: var(--tiny-shop-accent);
    color: var(--tiny-shop-accent-contrast);
}

/* Liste */

.tiny-shop-group + .tiny-shop-group {
    margin-top: calc(var(--tiny-shop-gap) * 1.5);
}

.tiny-shop-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--tiny-shop-min-width)), 1fr));
    gap: var(--tiny-shop-gap);
}

.tiny-shop-product {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tiny-shop-product__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.25rem;
}

.tiny-shop-product__title,
.tiny-shop-product__subtitle,
.tiny-shop-product__price {
    margin: 0;
}

.tiny-shop-product__subtitle,
.tiny-shop-product__price-note {
    color: var(--tiny-shop-muted);
}

.tiny-shop-product__price {
    font-weight: 600;
}

.tiny-shop-product__price-note {
    font-weight: normal;
    font-size: 0.9em;
}

.tiny-shop-product__details summary {
    cursor: pointer;
}

.tiny-shop-product figure,
.tiny-shop-order figure {
    margin: 0;
}

.tiny-shop-product img,
.tiny-shop-order img {
    display: block;
    max-width: 100%;
    height: auto;
}

.tiny-shop-product__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.75rem;
}

/* Einheitlicher Bildbereich: Bilder werden vollständig im gleichen Seitenverhältnis gezeigt */

.tiny-shop-product__image,
.tiny-shop-slider__slide {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: var(--tiny-shop-image-ratio);
    background: var(--tiny-shop-image-background);
    border-radius: var(--tiny-shop-radius);
    overflow: hidden;
}

.tiny-shop-product__image figure,
.tiny-shop-slider__slide figure,
.tiny-shop-product__image a,
.tiny-shop-slider__slide a,
.tiny-shop-product__image picture,
.tiny-shop-slider__slide picture {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.tiny-shop-product__image img,
.tiny-shop-slider__slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Slider */

.tiny-shop-slider {
    position: relative;
}

.tiny-shop-slider__track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.tiny-shop-slider__track::-webkit-scrollbar {
    display: none;
}

.tiny-shop-slider__slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
}

.tiny-shop-slider__nav {
    position: absolute;
    top: 50%;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    margin-top: -1.125rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / 0.85);
    color: #222;
    box-shadow: 0 1px 4px rgb(0 0 0 / 0.25);
    cursor: pointer;
}

.tiny-shop-slider__nav:disabled {
    opacity: 0;
    pointer-events: none;
}

.tiny-shop-slider__nav--prev {
    left: 0.5rem;
}

.tiny-shop-slider__nav--next {
    right: 0.5rem;
}

.tiny-shop-slider__dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.tiny-shop-slider__dot {
    width: 0.6rem;
    height: 0.6rem;
    padding: 0;
    border: 1px solid var(--tiny-shop-accent);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.tiny-shop-slider__dot[aria-current] {
    background: var(--tiny-shop-accent);
}

/* Mengenauswahl */

.tiny-shop-qty {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--tiny-shop-border);
    border-radius: var(--tiny-shop-radius);
    overflow: hidden;
    background: var(--tiny-shop-surface);
}

.tiny-shop-qty__label {
    display: flex;
    align-items: center;
    margin: 0;
}

.tiny-shop-qty__text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.tiny-shop-qty__input {
    width: 3.5em;
    min-height: 2.5rem;
    margin: 0;
    padding: 0 0.25em;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}

.tiny-shop-qty__input::-webkit-inner-spin-button,
.tiny-shop-qty__input::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.tiny-shop-qty__arrows {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--tiny-shop-border);
}

.tiny-shop-qty__btn {
    display: grid;
    flex: 1;
    place-items: center;
    width: 2rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.tiny-shop-qty__btn + .tiny-shop-qty__btn {
    border-top: 1px solid var(--tiny-shop-border);
}

.tiny-shop-qty__btn:hover:not(:disabled),
.tiny-shop-qty__btn:focus-visible {
    background: rgb(0 0 0 / 0.06);
}

.tiny-shop-qty__btn:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Button „Auf die Bestellliste“ */

.tiny-shop-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    min-height: 2.5rem;
    padding: 0.4em 1em;
    border: 2px solid var(--tiny-shop-accent);
    border-radius: var(--tiny-shop-radius);
    background: var(--tiny-shop-accent);
    color: var(--tiny-shop-accent-contrast);
    font: inherit;
    cursor: pointer;
}

.tiny-shop-toggle__icon {
    display: none;
}

.tiny-shop-toggle[aria-pressed='true'] {
    background: transparent;
    color: var(--tiny-shop-accent);
}

.tiny-shop-toggle[aria-pressed='true'] .tiny-shop-toggle__icon {
    display: block;
}

.tiny-shop-toggle:disabled {
    opacity: 0.5;
    cursor: default;
}

.tiny-shop-product.is-in-cart {
    --tiny-shop-border: var(--tiny-shop-accent);
}

/* Hinweisleiste */

.tiny-shop:has(.tiny-shop-bar:not([hidden])) {
    padding-bottom: 4.5rem;
}

.tiny-shop-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--tiny-shop-accent);
    color: var(--tiny-shop-accent-contrast);
    box-shadow: 0 -2px 8px rgb(0 0 0 / 0.2);
}

.tiny-shop-bar__link {
    padding: 0.4em 1em;
    border-radius: var(--tiny-shop-radius);
    background: var(--tiny-shop-accent-contrast);
    color: var(--tiny-shop-accent);
    font-weight: 600;
    text-decoration: none;
}

/* Link zur Bestellliste */

.tiny-shop-cart-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}

.tiny-shop-cart-link__count {
    min-width: 1.5em;
    padding: 0 0.4em;
    border-radius: 999px;
    background: var(--tiny-shop-accent);
    color: var(--tiny-shop-accent-contrast);
    font-size: 0.8em;
    line-height: 1.5;
    text-align: center;
}

.tiny-shop-cart-link__count[hidden] {
    display: none;
}

/* Formularfeld „Bestellliste“ */

.tiny-shop-order__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tiny-shop-order__item {
    display: grid;
    grid-template-columns: 4rem 1fr auto auto 2.5rem;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--tiny-shop-border);
}

.tiny-shop-order__media img {
    width: 4rem;
    height: 4rem;
    object-fit: cover;
    border-radius: var(--tiny-shop-radius);
}

.tiny-shop-order__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tiny-shop-order__subtitle,
.tiny-shop-order__price {
    color: var(--tiny-shop-muted);
    font-size: 0.9em;
}

.tiny-shop-order__line-total {
    min-width: 5em;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.tiny-shop-order__remove {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--tiny-shop-muted);
    cursor: pointer;
}

.tiny-shop-order__remove:hover,
.tiny-shop-order__remove:focus-visible {
    background: rgb(0 0 0 / 0.06);
    color: inherit;
}

.tiny-shop-order__total {
    display: flex;
    justify-content: flex-end;
    gap: 0.5em;
    margin: 0.75rem 0 0;
}

.tiny-shop-order__notice,
.tiny-shop-order__empty {
    padding: 0.75rem 1rem;
    border-radius: var(--tiny-shop-radius);
    background: rgb(0 0 0 / 0.05);
}

@media (max-width: 560px) {
    .tiny-shop-order__item {
        grid-template-columns: 3.5rem 1fr 2.5rem;
    }

    .tiny-shop-order__media img {
        width: 3.5rem;
        height: 3.5rem;
    }

    .tiny-shop-order__item .tiny-shop-qty {
        grid-column: 2;
        justify-self: start;
    }

    .tiny-shop-order__remove {
        grid-row: 1;
        grid-column: 3;
    }

    .tiny-shop-order__line-total {
        grid-column: 2 / 4;
        text-align: left;
    }
}

/* Hinweis-Meldung */

.tiny-shop-toast {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    z-index: 110;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: calc(100vw - 2rem);
    padding: 0.75rem 1rem;
    border-radius: var(--tiny-shop-radius);
    background: #222;
    color: #fff;
    box-shadow: 0 4px 16px rgb(0 0 0 / 0.3);
    transform: translateX(-50%);
}

.tiny-shop-toast[hidden] {
    display: none;
}

.tiny-shop-toast__action {
    padding: 0.25em 0.5em;
    border: 1px solid currentColor;
    border-radius: var(--tiny-shop-radius);
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
    .tiny-shop-slider__track {
        scroll-behavior: smooth;
    }

    .tiny-shop-toast:not([hidden]) {
        animation: tiny-shop-toast-in 0.2s ease-out;
    }
}

@keyframes tiny-shop-toast-in {
    from {
        opacity: 0;
        transform: translate(-50%, 0.5rem);
    }
}
