/*
 * Design tokens. Promoted to :root (not scoped to a plugin wrapper) so a
 * site's own "Additional CSS" can restyle the overlay to match its theme
 * by overriding these custom properties — that is the supported
 * customization surface, instead of targeting internal class names.
 */
:root {
    --aips-accent: #7b8cff;
    --aips-accent-contrast: #fff;
    --aips-surface: #fff;
    --aips-surface-muted: #f5f5f6;
    --aips-border: rgba(0, 0, 0, 0.1);
    --aips-text: #1a1a1a;
    --aips-text-muted: #666;
    --aips-radius: 12px;
    --aips-radius-sm: 6px;
    --aips-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    --aips-backdrop: rgba(10, 10, 15, 0.55);
    --aips-button-bg: var(--aips-text);
    --aips-button-text: var(--aips-surface);
}

body.aips-scroll-lock {
    overflow: hidden;
}

.aips-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Search trigger — a real (readonly) search input, not a button, so
   focusing it feels like focusing an ordinary search box rather than a
   click-through step. Injected into a theme header, floating as a last
   resort, or rendered inline by the [thaitus_aips_search] shortcode. The
   trigger-specific appearance is separate from the overlay input. The
   combined selector `.aips-input.aips-trigger-input` (rather than
   `.aips-trigger-input` alone) is deliberate: it needs strictly higher
   specificity than the plain `.aips-input` rule above to win, since both
   are !important. */
.aips-trigger-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 100% !important;
    max-width: 440px !important;
    /* #194: injected into arbitrary theme header markup, which may be a
       flex row sized to squeeze its children. Without this, a header
       tighter on space than this trigger's own layout assumptions could
       shrink it well below a legible width; flex-shrink: 0 plus a
       min-width floor means it always renders at a usable size, at worst
       overflowing its container rather than being crushed illegibly. Astra's
       `.entry-content[data-ast-blocks-layout] > *` content-width rule would
       otherwise widen a shortcode trigger to the full content width. */
    flex-shrink: 0;
    min-width: 160px !important;
}

.aips-trigger-input-wrap .aips-search-icon {
    left: 18px;
    color: var(--aips-text);
    z-index: 1;
}

.aips-input.aips-trigger-input {
    box-sizing: border-box !important;
    width: 100% !important;
    height: 50px !important;
    padding: 0 64px 0 46px !important;
    margin: 0 !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    color: var(--aips-text) !important;
    background: var(--aips-surface) !important;
    border: 1px solid var(--aips-text) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    cursor: pointer !important;
    transition: box-shadow .15s ease;
    /* #194: this box is too narrow for the full overlay placeholder even
       before any theme-layout issue (confirmed on Neve/Astra: the built-in
       fallback trigger showed "Describe what you're loo", cut off
       mid-word). triggerPlaceholder is already shortened to fit normally;
       this is the backstop for anything that still doesn't — an ellipsis
       reads as "there's more" rather than a raw, word-splitting clip. */
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    white-space: nowrap !important;
}

.aips-input.aips-trigger-input:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,.08) !important;
}

.aips-input.aips-trigger-input:focus-visible {
    outline: 2px solid var(--aips-text) !important;
    outline-offset: 2px !important;
}

.aips-input.aips-trigger-input::placeholder {
    color: var(--aips-text-muted) !important;
    opacity: 1 !important;
}

.aips-trigger-badge {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--aips-text) !important;
    color: var(--aips-surface) !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    letter-spacing: .02em !important;
    text-transform: none !important;
    pointer-events: none;
}

.aips-trigger-input-wrap--no-icon .aips-input.aips-trigger-input {
    padding-left: 20px !important;
}

.aips-trigger-input-wrap--header,
.aips-trigger-input-wrap--floating {
    max-width: 260px !important;
}

.aips-trigger-input-wrap--header .aips-input.aips-trigger-input,
.aips-trigger-input-wrap--floating .aips-input.aips-trigger-input {
    height: 40px !important;
    font-size: 14px !important;
    padding: 0 52px 0 40px !important;
}

.aips-trigger-input-wrap--header.aips-trigger-input-wrap--no-icon .aips-input.aips-trigger-input,
.aips-trigger-input-wrap--floating.aips-trigger-input-wrap--no-icon .aips-input.aips-trigger-input {
    padding-left: 16px !important;
}

.aips-trigger-input-wrap--header .aips-search-icon,
.aips-trigger-input-wrap--floating .aips-search-icon {
    left: 14px;
}

.aips-trigger-input-wrap--header .aips-trigger-badge,
.aips-trigger-input-wrap--floating .aips-trigger-badge {
    right: 6px;
    height: 28px;
    padding: 0 10px;
    font-size: 12px !important;
}

.aips-trigger-input-wrap--inline {
    max-width: 440px !important;
}

.aips-trigger-input-wrap--floating {
    position: fixed;
    right: 1em;
    bottom: 1em;
    z-index: 999990;
    border-radius: 999px;
    box-shadow: var(--aips-shadow);
}

/* Sits in a theme's header row next to the menu: keep it off the menu's
   first item and centered in rows taller than the box. */
.aips-trigger-input-wrap.aips-trigger-input-wrap--header {
    align-self: center;
    margin-inline-end: 16px !important;
}

.aips-trigger-input-wrap.aips-trigger-input-wrap--header.aips-trigger-input-wrap--compact {
    margin-inline-end: 4px !important;
}

/* "Match my theme" trigger style: a plain search field carrying the
   theme's own input styling (class search-field, like core/Woo search
   forms), with only the icon, the AI badge and a pointer cursor added. */
.aips-trigger-input-wrap--theme .aips-trigger-input {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding-right: 48px !important;
    cursor: pointer;
    text-overflow: ellipsis;
}

.aips-trigger-input-wrap--theme .aips-search-icon:not(.aips-search-icon--compact-only) ~ .aips-trigger-input {
    padding-left: 2.6em !important;
}

.aips-trigger-input-wrap--theme .aips-search-icon {
    left: 0.85em;
    color: inherit;
    opacity: 0.75;
}

.aips-trigger-input-wrap--theme .aips-trigger-badge,
.aips-trigger-badge.aips-trigger-badge--attached {
    height: 22px;
    padding: 0 8px;
    font-size: 11px !important;
}

/* The badge added to a theme search field we hand off to the overlay;
   aips-frontend.js positions it over the field's right edge. */
.aips-trigger-badge.aips-trigger-badge--attached {
    right: auto;
    transform: none;
    z-index: 2;
}

.aips-trigger-badge[hidden] {
    display: none !important;
}

/* Icon-only trigger: the fallback trigger at phone/tablet widths, or in a
   header row with no room for the text box. A 44px tap target that takes
   the header's own text color, so it sits beside the theme's menu and
   cart icons on light and dark headers alike. */
.aips-search-icon--compact-only {
    display: none;
}

.aips-trigger-input-wrap.aips-trigger-input-wrap--compact {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px;
    color: inherit;
}

.aips-trigger-input-wrap.aips-trigger-input-wrap--compact .aips-trigger-input {
    width: 44px !important;
    height: 44px !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: transparent !important;
    caret-color: transparent;
    box-shadow: none !important;
}

.aips-trigger-input-wrap.aips-trigger-input-wrap--compact .aips-trigger-input::placeholder {
    color: transparent !important;
}

.aips-trigger-input-wrap.aips-trigger-input-wrap--compact .aips-trigger-input:focus-visible {
    outline: 2px solid currentColor !important;
    outline-offset: 0 !important;
}

.aips-trigger-input-wrap.aips-trigger-input-wrap--compact .aips-search-icon {
    display: block;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 22px;
    transform: translate(-50%, -50%);
    color: currentColor;
    opacity: 1;
}

.aips-trigger-input-wrap.aips-trigger-input-wrap--compact .aips-trigger-badge {
    top: 3px;
    right: 0;
    transform: none;
    height: 15px;
    padding: 0 4px;
    border-radius: 4px;
    font-size: 9px !important;
}

.aips-trigger-input-wrap.aips-trigger-input-wrap--floating.aips-trigger-input-wrap--compact {
    width: 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
    height: 52px;
    border-radius: 50%;
    background: var(--aips-surface);
    color: var(--aips-text);
}

.aips-trigger-input-wrap.aips-trigger-input-wrap--floating.aips-trigger-input-wrap--compact .aips-trigger-input {
    width: 52px !important;
    height: 52px !important;
}

/* Overlay */

.aips-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.aips-overlay[hidden] {
    display: none;
}

.aips-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: var(--aips-backdrop);
    opacity: 0;
    transition: opacity 160ms ease;
}

.aips-overlay.is-open .aips-overlay-backdrop {
    opacity: 1;
}

.aips-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1040px;
    max-height: calc(100vh - 6em);
    margin: 3em 1em 0;
    background: var(--aips-surface);
    border-radius: var(--aips-radius);
    box-shadow: var(--aips-shadow);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.aips-overlay.is-open .aips-dialog {
    opacity: 1;
    transform: translateY(0);
}

.aips-dialog-head {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.9em 1em;
    border-bottom: 1px solid var(--aips-border);
}

.aips-search-form {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.aips-search-icon {
    position: absolute;
    left: 0.7em;
    color: var(--aips-text-muted);
    pointer-events: none;
}

/*
 * !important below on .aips-input/.aips-input-clear/.aips-dialog-close is
 * deliberate, not sloppy: this overlay is injected into arbitrary themes,
 * and generic theme rules like `input[type="text"]` or `button` outrank a
 * single class selector on specificity alone (an attribute selector is
 * worth as much as a class), regardless of source order. Confirmed live:
 * without it, a theme's own input[type="text"] padding silently won and
 * the search icon overlapped the placeholder text.
 */
.aips-input {
    box-sizing: border-box !important;
    width: 100% !important;
    padding: 0.7em 2.2em !important;
    border: 1px solid var(--aips-border) !important;
    border-radius: var(--aips-radius-sm) !important;
    font-size: 1.05em !important;
    color: var(--aips-text) !important;
    background: var(--aips-surface-muted) !important;
    margin: 0 !important;
}

.aips-input:focus-visible {
    outline: 2px solid var(--aips-accent) !important;
    outline-offset: 1px;
}

.aips-input-clear {
    position: absolute;
    right: 0.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.6em;
    height: 1.6em;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--aips-text-muted) !important;
    font-size: 1.1em;
    line-height: 1;
    cursor: pointer;
}

.aips-input-clear[hidden] {
    display: none;
}

.aips-input-clear:hover,
.aips-input-clear:focus-visible {
    background: var(--aips-border) !important;
}

.aips-dialog-close {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.2em;
    height: 2.2em;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--aips-text-muted) !important;
    font-size: 1.3em;
    line-height: 1;
    cursor: pointer;
}

.aips-dialog-close:hover,
.aips-dialog-close:focus-visible {
    background: var(--aips-surface-muted) !important;
    color: var(--aips-text) !important;
}

button.aips-dialog-close:focus-visible,
button.aips-input-clear:focus-visible {
    outline: 2px solid var(--aips-accent);
    outline-offset: 1px;
}

/* Thin indeterminate progress bar — the one loading affordance, replacing
   the old badge/banner/shimmer combination. */
.aips-progress {
    position: relative;
    height: 2px;
    background: transparent;
    overflow: hidden;
}

.aips-progress.is-active::after {
    content: '';
    position: absolute;
    top: 0;
    left: -30%;
    width: 30%;
    height: 100%;
    background: var(--aips-accent);
    animation: aips-progress-slide 1.1s ease-in-out infinite;
}

@keyframes aips-progress-slide {
    0% {
        left: -30%;
    }
    60% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}

.aips-dialog-body {
    padding: 1.25em;
    overflow-y: auto;
}

/* AI-17: escape hatch to the theme's regular search. Outside the scrolling
   body, so it stays visible in every state. */
.aips-dialog-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25em 0.5em;
    flex-shrink: 0;
    padding: 0.7em 1.25em;
    padding-bottom: calc(0.7em + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--aips-border);
    background: var(--aips-surface);
    color: var(--aips-text-muted);
    font-size: 0.875em;
    line-height: 1.4;
}

.aips-overlay .aips-dialog-foot .aips-native-link {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    color: var(--aips-text) !important;
    font-weight: 500;
    text-decoration: underline !important;
    text-overflow: ellipsis;
    text-transform: none !important;
    white-space: nowrap;
}

.aips-overlay .aips-dialog-foot .aips-native-link:hover,
.aips-overlay .aips-dialog-foot .aips-native-link:focus-visible {
    color: var(--aips-accent) !important;
}

/* While the shopper prefers regular search, the attached badge is the
   button back to AI search. */
.aips-trigger-badge.aips-trigger-badge--switch {
    pointer-events: auto;
    cursor: pointer;
}

/* Empty state */

.aips-hint {
    margin: 0 0 1.25em;
    color: var(--aips-text-muted);
}

.aips-chip-group {
    margin-bottom: 1.5em;
}

.aips-chip-group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.aips-chip-heading {
    margin: 0 0 0.6em;
    font-size: 0.78em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--aips-text-muted);
}

.aips-recent-clear {
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--aips-text-muted) !important;
    font-size: 0.8em;
    text-decoration: underline;
    cursor: pointer;
}

.aips-recent-clear:hover,
.aips-recent-clear:focus-visible {
    background: transparent !important;
    color: var(--aips-accent) !important;
}

.aips-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.aips-chip {
    padding: 0.45em 0.9em !important;
    margin: 0 !important;
    border: 1px solid var(--aips-border) !important;
    border-radius: 999px !important;
    background: var(--aips-surface-muted) !important;
    color: var(--aips-text) !important;
    font-size: 0.9em;
    cursor: pointer;
    text-align: left;
}

.aips-chip:hover,
.aips-chip:focus-visible {
    background: var(--aips-surface-muted) !important;
    border-color: var(--aips-accent) !important;
    color: var(--aips-accent) !important;
}

/* Status / error */

.aips-status {
    padding: 0.75em 0;
    color: var(--aips-text-muted);
}

.aips-status--error {
    color: #b32d2e;
}

/* #64: sits above already-rendered fast results, so it needs enough visual
   weight not to disappear against the product grid below it — unlike
   .aips-status--error (a full-dialog replacement, no competing content to
   stand out against). */
.aips-degraded-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75em;
    margin-bottom: 0.75em;
    padding: 0.6em 0.9em;
    background: var(--aips-surface-muted);
    border: 1px solid var(--aips-border);
    border-radius: var(--aips-radius-sm);
}

.aips-degraded-notice p {
    margin: 0;
}

.aips-retry {
    padding: 0 !important;
    margin: 0 0 0 0.5em !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--aips-accent) !important;
    text-decoration: underline;
    cursor: pointer;
}

.aips-retry:hover,
.aips-retry:focus-visible {
    background: transparent !important;
}

/* AI-generated answer summary */

.aips-answer {
    display: flex;
    gap: 0.6em;
    align-items: flex-start;
    background: var(--aips-surface-muted);
    border: 1px solid var(--aips-border);
    border-radius: var(--aips-radius-sm);
    padding: 0.9em 1em;
    margin-bottom: 1.25em;
}

.aips-answer[hidden] {
    display: none;
}

.aips-answer-icon {
    flex: 0 0 auto;
    color: var(--aips-accent);
    margin-top: 0.1em;
    line-height: 0;
}

.aips-answer-body p {
    margin: 0;
    color: var(--aips-text);
}

.aips-answer-label {
    display: block;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--aips-accent);
    margin-bottom: 0.2em;
}

.aips-result-count {
    margin: 0 0 0.9em;
    font-size: 0.85em;
    color: var(--aips-text-muted);
}

.aips-result-count[hidden] {
    display: none;
}

/* Results grid — one shape for both the fast preview and the full result;
   upgrading a card in place never changes the grid's layout. */
.aips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.25em;
}

.aips-product {
    border: 1px solid var(--aips-border);
    border-radius: var(--aips-radius-sm);
    padding: 1em;
}

/* #191: the fast preview, until the full (reasoned) result replaces it.
   Three signals so it never rests on one visual cue: the text label below,
   dimmed product images, and aria-busy on the grid (set in
   aips-frontend.js). Only the image is dimmed, never the card: opacity on
   the card would composite its text too, and --aips-text-muted (#666, used
   for brand and struck-through prices) at 0.6 over white falls to about
   2.5:1, below WCAG 1.4.3's 4.5:1. The images are product photos, which
   1.4.3 and 1.4.11 don't cover, so the card's text keeps its normal
   contrast. Both visual parts fade in only after a short delay, so a full
   result that lands right behind the preview (common, see the 2026-08-21
   overlay redesign decision) replaces it without a flash of "preview"
   styling, which is why the old "Quick pick" treatment was removed. */
.aips-dialog-body .aips-preview-note {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin: 0 0 0.9em;
    padding: 0;
    font-size: 0.85em;
    font-style: normal;
    line-height: 1.4;
    color: var(--aips-text-muted);
    animation: aips-provisional-note-in 0.2s ease-out 0.25s both;
}

/* A static marker before the label, drawn in currentColor so it follows
   the theme's text color rather than hard-coding one. */
.aips-dialog-body .aips-preview-note::before {
    content: '';
    flex: 0 0 auto;
    width: 0.5em;
    height: 0.5em;
    border: 1.5px solid currentColor;
    border-radius: 50%;
}

.aips-grid.aips-grid--provisional .aips-product .aips-image {
    animation: aips-provisional-image-in 0.2s ease-out 0.25s both;
}

@keyframes aips-provisional-note-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes aips-provisional-image-in {
    from {
        opacity: 1;
    }
    to {
        opacity: 0.5;
    }
}

.aips-image {
    aspect-ratio: 1 / 1;
    background: var(--aips-surface-muted);
    border-radius: var(--aips-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0.6em;
}

.aips-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.aips-product-brand {
    display: block;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--aips-text-muted);
    margin-bottom: 0.15em;
}

.aips-product-title {
    font-size: 1em;
    margin: 0 0 0.3em;
}

.aips-product-title a {
    color: inherit;
    text-decoration: none;
}

.aips-product-title a:hover,
.aips-product-title a:focus-visible {
    text-decoration: underline;
}

.aips-product-price {
    font-weight: 600;
    margin-bottom: 0.5em;
}

.aips-product-price del {
    font-weight: 400;
    color: var(--aips-text-muted);
    text-decoration: line-through;
    margin-right: 0.4em;
}

.aips-product-price ins {
    text-decoration: none;
    color: #b32d2e;
}

.aips-product-explanation {
    font-size: 0.9em;
    color: var(--aips-text-muted);
    margin: 0 0 0.75em;
}

.aips-product-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 0.5em;
}

.aips-stock-badge {
    font-size: 0.78em;
    padding: 0.2em 0.6em;
    border-radius: 999px;
}

.aips-stock-badge--out {
    background: #fbeaea;
    color: #b32d2e;
}

.aips-stock-badge--backorder {
    background: #fff4e0;
    color: #8a5a00;
}

/* One add-to-cart button whatever the theme: themes style .button anywhere
   from a full-width block to a bare text link, which read as a different
   control on every shop. !important for the same reason as .aips-input
   below: theme rules like `.woocommerce a.button` outrank one class. */
.aips-dialog .aips-product-actions .aips-add-to-cart {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-height: 40px;
    margin: 0 !important;
    padding: 0.5em 1.1em !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: var(--aips-button-bg) !important;
    color: var(--aips-button-text) !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
}

.aips-dialog .aips-product-actions .aips-add-to-cart:hover {
    opacity: 0.88;
}

.aips-dialog .aips-product-actions .aips-add-to-cart.loading {
    opacity: 0.6;
}

.aips-product-actions .added_to_cart {
    font-size: 0.85em;
}

.aips-product-title a:focus-visible,
.aips-add-to-cart:focus-visible,
.aips-chip:focus-visible {
    outline: 2px solid var(--aips-accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .aips-progress.is-active::after,
    .aips-overlay-backdrop,
    .aips-dialog {
        animation: none;
        transition: none;
    }

    /* #191: keep the delay (it is what stops a flash of preview styling)
       but drop the fade, so the provisional state switches on in one step. */
    .aips-dialog-body .aips-preview-note,
    .aips-grid.aips-grid--provisional .aips-product .aips-image {
        animation-duration: 1ms;
    }
}

/* Responsive */

@media (max-width: 782px) {
    .aips-dialog {
        margin: 0;
        max-width: none;
        max-height: none;
        height: 100%;
        border-radius: 0;
    }

    .aips-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .aips-dialog-head {
        padding: 0.75em;
    }

    .aips-dialog-foot {
        padding-left: 1em;
        padding-right: 1em;
    }

    .aips-dialog-body {
        padding: 1em;
    }

    /* Compact rows (thumbnail beside the details) instead of one
       full-width card per screen. */
    .aips-grid {
        grid-template-columns: 1fr;
        gap: 0.6em;
    }

    .aips-product {
        display: grid;
        grid-template-columns: 84px minmax(0, 1fr);
        gap: 0 0.85em;
        align-items: start;
        padding: 0.65em;
    }

    .aips-product .aips-image {
        margin-bottom: 0;
    }

    .aips-product-title {
        font-size: 0.95em;
    }

    .aips-product-price {
        margin-bottom: 0.35em;
    }

    .aips-product-explanation {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
        font-size: 0.85em;
        margin-bottom: 0.5em;
    }

    .aips-dialog .aips-product-actions .aips-add-to-cart {
        min-height: 36px;
        padding: 0.45em 0.95em !important;
        font-size: 0.8125rem !important;
    }

    .aips-trigger-input-wrap--inline {
        max-width: 100% !important;
    }
}
