/* Fonts and colours are the site's (its Bootstrap and tenant.css, linked first). */
body {
    margin: 0;
}

.shop-main {
    max-width: 960px;
    padding: 1rem 1.5rem 3rem;
}

/* while the app downloads, as the tenant app shows it: a heading over a bar that fills as Blazor sets
   --blazor-load-percentage. Its own classes, so the site's Bootstrap (or none, on the admin page) can't change it. */
.shop-loading {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #6c757d;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.shop-loading h1 {
    font-size: 2.5rem;
    font-weight: 500;
    margin: 0;
}

.shop-progress {
    width: 200px;
    height: 11px;
    margin: 1rem auto 0;
    overflow: hidden;
    border-radius: 0.25rem;
    background: #e9ecef;
}

.shop-progress-bar {
    width: var(--blazor-load-percentage, 0%);
    height: 100%;
    background: var(--store-accent, #007bff);
    transition: width 0.6s ease;
}

/* on the splash, between the heading and the cards still to come */
.shop-splash .shop-progress {
    margin: 0 0 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .shop-progress-bar {
        transition: none;
    }
}

.shop-main section {
    margin-top: 2rem;
}

.shop-note {
    padding: 0.75rem 1rem;
    background: #e7f1ff;
    border-radius: 0.25rem;
}

.shop-problem {
    padding: 0.75rem 1rem;
    color: #842029;
    background: #f8d7da;
    border-radius: 0.25rem;
}

.shop-button {
    padding: 0.4rem 1rem;
    border: 0;
    border-radius: 0.25rem;
    color: #fff;
    background: #0d6efd;
    cursor: pointer;
}

.shop-button:disabled {
    opacity: 0.6;
    cursor: default;
}

.shop-table {
    width: 100%;
    margin-top: 1rem;
    border-collapse: collapse;
}

.shop-table th,
.shop-table td {
    padding: 0.4rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0.6rem 1.25rem;
    background: lightyellow;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    cursor: pointer;
}

/* ---------- the storefront ----------
   Everything here draws on the site's own palette, which the platform's Bootstrap 4 defines and each
   tenant's stylesheet sets (--body, --primary, --highlight, --on-primary and their derived -light,
   -lightest and -darker shades), and on the tenant's fonts. The fallbacks are for running without the
   site's stylesheets. The site ships Bootstrap 4, so markup uses only Bootstrap 4 classes. */

:root {
    --store-ink: var(--body, #262626);
    --store-muted: var(--body-light, #737373);
    --store-rule: var(--body-lightest, #e9e9e9);
    /* the outline of something to click or type in: the text colour, faded, so it shows on any page colour
       (--store-rule is for dividers, and all but vanishes on a light grey page) */
    --store-edge: color-mix(in srgb, var(--store-ink) 24%, transparent);
    --store-accent: var(--primary, #00b5e2);
    --store-accent-deep: var(--primary-darker, #0089ab);
    --store-on-accent: var(--on-primary, #fff);
    --store-saving: var(--highlight-darker, var(--highlight, #c2410c));
    /* a little deeper than --primary-lightest, which all but vanishes on a white site */
    --store-docket: color-mix(in srgb, var(--primary, #00b5e2) 9%, var(--surface, #fff));
    --store-heading-font: var(--font-family-headings, inherit);
    --store-radius: 0.375rem;
}

.store-header {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.store-nav {
    display: flex;
    gap: 1.5rem;
    align-items: baseline;
}

.store-nav .store-home {
    margin-right: auto;
    font-weight: 600;
}

.store-main {
    padding-bottom: 4rem;
}

.store-main h1 {
    margin-bottom: 1.5rem;
    font-family: var(--store-heading-font);
}

/* a field and its button, side by side */
.store-inline {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.store-inline .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

/* prices line up in columns */
.store-money {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- the shop and a product ---------- */

/* the shop while it loads: index.html's splash (js/splash.js), over the app until StoreLayout has drawn
   the same; and the shop's front page while its products come */
.shop-splash {
    position: fixed;
    inset: 0;
    z-index: 10;
    overflow: auto;
    background: var(--surface, #fff);
    transition: opacity 0.25s ease-out;
}

.shop-splash[hidden] {
    display: none;
}

.shop-splash-gone {
    opacity: 0;
    pointer-events: none;
}

/* a card still to come: its picture's square and its name's line, shimmering */
.store-card-skeleton .store-card-image,
.store-card-skeleton .store-card-name {
    background: linear-gradient(100deg, var(--store-docket) 40%, var(--surface, #fff) 50%, var(--store-docket) 60%) 0 0 / 300% 100%;
    animation: store-shimmer 1.6s ease-in-out infinite;
}

.store-card-skeleton .store-card-name {
    width: 60%;
    height: 1.1em;
    border-radius: 0.25rem;
}

@keyframes store-shimmer {
    to { background-position: -150% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .store-card-skeleton .store-card-image,
    .store-card-skeleton .store-card-name {
        animation: none;
    }
}

.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 2.5rem 1.75rem;
}

.store-card {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    color: inherit;
    text-decoration: none;
}

.store-card:hover,
.store-card:focus {
    color: inherit;
    text-decoration: none;
}

.store-card:hover .store-card-name,
.store-card:focus-visible .store-card-name {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.store-card:focus-visible {
    outline: 2px solid var(--store-accent);
    outline-offset: 4px;
}

.store-card-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.25rem;
    background: var(--store-docket);
}

/*
    A product without a picture: its description in the picture's square, a short accent bar at the top and the words
    toward the foot, on a wash that deepens toward the accent. The edge brightens when the card is pointed at.
*/
.store-card-no-image {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--store-accent) 18%, transparent);
    background: linear-gradient(160deg, var(--store-docket) 55%, color-mix(in srgb, var(--store-accent) 16%, var(--store-docket)));
    transition: border-color 0.15s;
}

.store-card-no-image::before {
    content: "";
    flex: none;
    width: 2rem;
    height: 3px;
    border-radius: 2px;
    background: var(--store-accent);
}

.store-card:hover .store-card-no-image,
.store-card:focus-visible .store-card-no-image {
    border-color: color-mix(in srgb, var(--store-accent) 55%, transparent);
}

.store-card-blurb {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 6;
    line-clamp: 6;
    overflow: hidden;
    white-space: pre-line;
    text-wrap: pretty;
    font-size: 0.95rem;
    line-height: 1.55;
    color: color-mix(in srgb, currentColor 82%, transparent);
}

@media (prefers-reduced-motion: reduce) {
    .store-card-no-image {
        transition: none;
    }
}

/* under each picture: the name, then the price on a line of its own */
.store-card-line {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.store-card-name {
    font-family: var(--store-heading-font);
    font-size: 1.0625rem;
}

.store-card-price {
    font-variant-numeric: tabular-nums;
}

.store-card-gst {
    font-size: 0.875rem;
    color: var(--store-muted);
}

.store-card-note {
    margin-top: -0.375rem;
    font-size: 0.875rem;
}

.store-card-stock,
.store-unavailable,
.store-card-trial {
    color: var(--store-muted);
}

.store-card-sold-out .store-card-image {
    opacity: 0.5;
    filter: grayscale(1);
}

.store-was {
    color: var(--store-muted);
}

.store-special {
    color: var(--store-saving);
}

.store-pages {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: baseline;
    margin-top: 3rem;
    color: var(--store-muted);
}

/* finding things: the search box, then the shop's categories as a row of pills on the docket's colour */
.store-finder {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.store-search {
    display: flex;
    max-width: 32rem;
}

.store-search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.store-search-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--store-edge);
    border-right: 0;
    border-radius: var(--store-radius) 0 0 var(--store-radius);
    background: var(--surface, #fff);
    color: var(--store-ink);
    font: inherit;
}

.store-search-input:focus {
    outline: 2px solid var(--store-accent);
    outline-offset: -1px;
}

.store-search-button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--store-accent);
    border-radius: 0 var(--store-radius) var(--store-radius) 0;
    background: var(--store-accent);
    color: var(--store-on-accent);
    font: inherit;
    cursor: pointer;
}

.store-search-button:hover,
.store-search-button:focus-visible {
    background: var(--store-accent-deep);
    border-color: var(--store-accent-deep);
}

.store-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.store-tag {
    padding: 0.25rem 0.875rem;
    border: 1px solid var(--store-edge);
    border-radius: 999px;
    color: var(--store-ink);
    font-size: 0.875rem;
    text-decoration: none;
}

.store-tag:hover,
.store-tag:focus-visible {
    border-color: var(--store-accent);
    color: var(--store-ink);
    text-decoration: none;
}

.store-tag:focus-visible {
    outline: 2px solid var(--store-accent);
    outline-offset: 2px;
}

.store-tag-current,
.store-tag-current:hover {
    background: var(--store-docket);
    border-color: var(--store-accent);
    font-weight: 600;
}

.store-found {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    margin: -1rem 0 1.5rem;
    color: var(--store-muted);
}

.store-clear {
    font-size: 0.875rem;
}

.store-product-tags {
    margin-top: 1.5rem;
}

/* a product: its pictures, and the buy box as a docket */

.store-back {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.store-product {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 1fr);
    gap: 3rem;
    align-items: start;
}

.store-product-image {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.25rem;
    background: var(--store-docket);
}

/* the merchant's own page content, in place of the pictures: its own styles are scoped to it */
.store-product-content {
    min-width: 0;
    overflow-wrap: break-word;
}

.store-product-content img {
    max-width: 100%;
    height: auto;
}

.store-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.store-thumb {
    width: 4.5rem;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 0.25rem;
    background: none;
    opacity: 0.7;
}

.store-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.125rem;
}

.store-thumb-current,
.store-thumb:hover {
    border-color: var(--store-accent);
    opacity: 1;
}

.store-thumb:focus-visible {
    outline: 2px solid var(--store-ink);
    outline-offset: 2px;
}

.store-product-name {
    margin: 0 0 0.75rem;
    font-family: var(--store-heading-font);
    font-size: 2rem;
    line-height: 1.15;
}

.store-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.75rem;
    margin: 0;
}

.store-now {
    font-family: var(--store-heading-font);
    font-size: 1.75rem;
    font-variant-numeric: tabular-nums;
}

.store-saving,
.store-plan-note {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
}

.store-plan-note {
    color: var(--store-muted);
}

.store-saving {
    color: var(--store-saving);
}

/* the GST beside the price: "+ GST of AUD 2.00" or "incl GST" */
.store-gst {
    font-size: 0.9375rem;
    color: var(--store-muted);
    font-variant-numeric: tabular-nums;
}

.store-option {
    margin: 1.5rem 0 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.store-option-name {
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.store-option-chosen {
    margin-left: 0.25rem;
    font-weight: normal;
    color: var(--store-muted);
}

/* each value a chip: a radio underneath, so the keyboard and screen readers treat it as one */
.store-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.store-chip input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.store-chip label {
    display: inline-block;
    min-width: 2.75rem;
    margin: 0;
    padding: 0.375rem 0.875rem;
    border: 1px solid color-mix(in srgb, var(--store-ink) 30%, transparent);
    border-radius: 999px;
    background: var(--surface, #fff);
    font-size: 0.9375rem;
    font-weight: normal;
    text-align: center;
    cursor: pointer;
}

.store-chip input:checked + label {
    border-color: var(--store-accent);
    box-shadow: inset 0 0 0 1px var(--store-accent);
    font-weight: 600;
}

.store-chip input:focus-visible + label {
    outline: 2px solid var(--store-ink);
    outline-offset: 2px;
}

/* sold out with the other choices, or a mix no variant has */
.store-chip-sold-out label,
.store-chip-missing label {
    color: var(--store-muted);
    text-decoration: line-through;
}

.store-chip-missing label {
    border-style: dashed;
}

.store-low {
    margin: 1.25rem 0 0;
    color: var(--store-saving);
    font-weight: 600;
}

.store-unavailable {
    margin: 1.25rem 0 0;
}

.store-add {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    margin-top: 1.25rem;
}

.store-add .store-primary-button {
    flex: 1 1 auto;
}

.store-added {
    margin: 1rem 0 0;
    font-weight: 600;
}

/* a product's description is plain text: keep the merchant's line breaks */
.store-description {
    margin: 1.5rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px dashed color-mix(in srgb, var(--store-muted) 45%, transparent);
    white-space: pre-line;
}

.store-account-form {
    max-width: 24rem;
}

.store-setup {
    max-width: 40rem;
}

/* ---------- the cart: the items, and the docket beside them ---------- */

.store-cart {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem);
    gap: 3rem;
    align-items: start;
}

.store-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 7rem;
    grid-template-areas:
        "main qty total"
        "main . remove";
    gap: 0.25rem 1.5rem;
    align-items: start;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--store-rule);
}

.store-line:first-child {
    border-top: 1px solid var(--store-rule);
}

.store-line-main {
    grid-area: main;
}

.store-line-name {
    margin: 0;
    font-family: var(--store-heading-font);
    font-size: 1.125rem;
}

.store-line-options,
.store-line-each,
.store-line-repeats {
    margin: 0.125rem 0 0;
    color: var(--store-muted);
}

/* a plan's quantity: always one, where the stepper would be */
.store-line-one {
    grid-area: qty;
    justify-self: start;
    padding: 0.375rem 0.75rem;
}

.store-line-discount {
    margin: 0.25rem 0 0;
    color: var(--store-saving);
}

.store-line-short {
    margin: 0.25rem 0 0;
    font-weight: 600;
}

.store-line-total {
    grid-area: total;
    align-self: center;
    text-align: right;
    font-size: 1.125rem;
}

.store-line .store-line-remove {
    grid-area: remove;
    justify-self: end;
    padding: 0;
    color: var(--store-muted);
    font-size: 0.875rem;
}

.store-stepper {
    grid-area: qty;
    justify-self: start;
    display: inline-flex;
    align-items: stretch;
    background: var(--surface, #fff);
    border: 1px solid color-mix(in srgb, var(--store-ink) 20%, transparent);
    border-radius: var(--store-radius);
}

.store-stepper button {
    width: 2.25rem;
    border: 0;
    background: transparent;
    color: var(--store-ink);
    font-size: 1.125rem;
    line-height: 1;
}

.store-stepper button:hover:not(:disabled) {
    background: var(--store-docket);
}

.store-stepper button:focus-visible,
.store-stepper .store-line-quantity:focus-visible,
.store-stepper .store-quantity:focus-visible {
    outline: 2px solid var(--store-accent);
    outline-offset: 1px;
}

.store-stepper .store-line-quantity,
.store-stepper .store-quantity {
    width: 3.25rem;
    height: auto;
    border: 0;
    border-radius: 0;
    text-align: center;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}

.store-stepper input::-webkit-inner-spin-button,
.store-stepper input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/*
 * The docket: the order summed up as a shop's till slip. A strip in the site's lightest primary,
 * dotted leaders from each label to its amount, the total set large in the site's heading face, and
 * a torn bottom edge. It is the one decorated thing on the page; everything around it stays plain.
 */
.store-docket {
    position: sticky;
    top: 1.5rem;
    margin-bottom: 0.75rem;
    padding: 1.5rem 1.5rem 2rem;
    background: var(--store-docket);
    border-top: 3px solid var(--store-accent);
    color: var(--store-ink);
}

/* the torn edge: scallops cut from a strip the docket's own colour */
.store-docket::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.625rem;
    height: 0.625rem;
    background: radial-gradient(circle at 0.5rem 0.625rem, transparent 0.4rem, var(--store-docket) 0.425rem) 0 0 / 1rem 0.625rem repeat-x;
}

.store-docket-title {
    margin: 0 0 1rem;
    font-family: var(--store-heading-font);
    font-size: 1.25rem;
}

.store-docket dl {
    margin: 0;
}

.store-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0.375rem 0;
}

/* the leader: dots from the label to the amount */
.store-row::after {
    content: "";
    order: 1;
    flex: 1 1 auto;
    min-width: 1rem;
    border-bottom: 2px dotted var(--store-muted);
    opacity: 0.45;
    transform: translateY(-0.3em);
}

.store-row dt {
    order: 0;
    font-weight: normal;
}

.store-row dd {
    order: 2;
    margin: 0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.store-row-saving dd {
    color: var(--store-saving);
}

.store-total-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--store-ink);
}

.store-total-row dt {
    font-weight: normal;
}

.store-total {
    margin: 0;
    font-family: var(--store-heading-font);
    font-size: 2rem;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.store-gst-note,
.store-repeats-note {
    margin: 0.25rem 0 0;
    text-align: right;
    color: var(--store-muted);
    font-size: 0.875rem;
}

.store-docket-part {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px dashed color-mix(in srgb, var(--store-muted) 45%, transparent);
}

.store-docket-part h3,
.store-docket-label {
    display: block;
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.store-postcode {
    flex: 0 1 8rem !important;
}

.store-docket-part > p {
    margin-bottom: 0.5rem;
    color: var(--store-muted);
    font-size: 0.875rem;
}

.store-code-problem,
.store-postcode-problem {
    margin: 0.5rem 0 0;
    color: var(--danger, #b02a37);
    font-size: 0.875rem;
}

.store-delivery-options {
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
}

.store-delivery-options li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0;
}

.store-delivery-options small {
    display: block;
    color: var(--store-muted);
    font-size: 0.8125rem;
}

.store-checkout {
    margin-top: 1.75rem;
}

.store-primary-button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 0;
    border-radius: var(--store-radius);
    background: var(--store-accent);
    color: var(--store-on-accent);
    font-size: 1.125rem;
    font-weight: 600;
}

.store-primary-button:hover:not(:disabled) {
    background: var(--store-accent-deep);
}

.store-primary-button:focus-visible {
    outline: 3px solid var(--store-ink);
    outline-offset: 2px;
}

.store-primary-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.store-orders-note {
    margin: 0.75rem 0 0;
    color: var(--store-muted);
    font-size: 0.875rem;
    text-align: center;
}

.store-empty {
    max-width: 32rem;
}

@media (max-width: 860px) {
    .store-cart {
        grid-template-columns: minmax(0, 1fr);
        gap: 2rem;
    }

    /* not sticky once it sits under the items, but still the anchor for its torn edge */
    .store-docket {
        position: relative;
        top: auto;
    }

    .store-product {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 520px) {
    .store-line {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "main main"
            "qty total"
            ". remove";
    }
}
