/* [weave_carousel]: the Apothecary card, in a row that scrolls.
   Follows the host page's fonts and the same variables as the Weave
   display and cart: --weave-accent, --weave-ink, --weave-surface,
   --weave-muted, --weave-radius, --weave-display-font, --weave-display-weight,
   --weave-heading-color, and --weave-sale for a sale price. Set them on
   `weave-cart`, `.weave-carousel`, or `:root`. */

.weave-carousel {
    --_accent: var(--weave-accent, var(--weave-primary-color, #1f6f5c));
    --_ink: var(--weave-ink, #1b1b1b);
    --_surface: var(--weave-surface, #fff);
    --_muted: var(--weave-muted, #6b6b6b);
    --_sale: var(--weave-sale, var(--_accent));
    --_radius: var(--weave-radius, 14px);
    --_line: color-mix(in srgb, var(--_ink) 14%, transparent);
    --_cols: var(--weave-cols, 4);
    --_gap: var(--weave-gap, 24px);
    --_peek: 0px;
    position: relative;
    display: block;
    width: 100%; /* inline-size containment would let a flex parent shrink it to nothing */
    color: var(--_ink);
    font-family: var(--weave-font, inherit);
    container-type: inline-size;
}
.weave-carousel[hidden] { display: none; }
/* Breakdance's fallback template puts page content in a Code Block that
   shrink-wraps its children; with inline-size containment that leaves no
   width. Stretch it. */
.bde-code-block:has(> .weave-carousel) { align-self: stretch; align-items: stretch; max-width: 100%; }
.weave-carousel *, .weave-carousel *::before, .weave-carousel *::after { box-sizing: border-box; }
.weave-carousel--peek { --_peek: 15%; }
.weave-carousel--loading { min-height: 200px; }
.weave-carousel--empty:not([hidden]) .weave-carousel__empty { color: var(--_muted); margin: 0; }

/* Heading */
.weave-carousel__head { display: flex; align-items: center; gap: 16px 24px; margin-bottom: 20px; flex-wrap: wrap; }
.weave-carousel__head > :first-child { margin-right: auto; } /* titles left; "View all" and the arrows together on the right */
.weave-carousel--align-center .weave-carousel__head { flex-direction: column; align-items: center; text-align: center; }
.weave-carousel__titles { display: flex; flex-direction: column; gap: 6px; }
.weave-carousel__title { font-family: var(--weave-display-font, inherit); font-weight: var(--weave-display-weight, 400); color: var(--weave-heading-color, inherit); font-size: 1.9rem; line-height: 1.25; margin: 0; }
.weave-carousel__intro { margin: 0; line-height: 1.6; max-width: 60ch; color: var(--_muted); }
.weave-carousel__all { color: var(--_accent); text-decoration: none; font-weight: 600; white-space: nowrap; }
.weave-carousel__all:hover { text-decoration: underline; }
.weave-carousel__all::after { content: ' →'; }

/* Track */
.weave-carousel__body { position: relative; }
.weave-carousel__track {
    list-style: none; margin: 0; padding: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - var(--_peek) - var(--_gap) * (var(--_cols) - 1)) / var(--_cols));
    column-gap: var(--_gap);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    outline: none;
}
.weave-carousel__track::-webkit-scrollbar { display: none; }
.weave-carousel__track:focus-visible { outline: 2px solid var(--_accent); outline-offset: 4px; border-radius: 4px; }
.weave-carousel--grid .weave-carousel__track {
    grid-auto-flow: row;
    grid-template-columns: repeat(var(--_cols), minmax(0, 1fr));
    grid-auto-columns: auto;
    row-gap: calc(var(--_gap) * 1.5);
    overflow: visible;
    scroll-snap-type: none;
}

/* Arrows */
.weave-carousel__nav { display: contents; }
.weave-carousel--arrows-top .weave-carousel__nav,
.weave-carousel--arrows-bottom .weave-carousel__nav { display: flex; gap: 8px; }
.weave-carousel--arrows-top .weave-carousel__nav { align-self: center; }
.weave-carousel--arrows-bottom .weave-carousel__nav { justify-content: center; margin-top: 16px; }
.weave-carousel__arrow {
    width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid var(--_line); background: var(--_surface); color: var(--_ink);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; font: inherit;
    box-shadow: 0 2px 10px rgb(0 0 0 / 0.08);
    transition: background-color 0.2s, color 0.2s, opacity 0.2s;
}
.weave-carousel__arrow:hover:not(:disabled) { background: var(--_ink); color: var(--_surface); border-color: var(--_ink); }
.weave-carousel__arrow:disabled { opacity: 0.3; cursor: default; }
.weave-carousel__arrow svg { display: block; }
.weave-carousel--arrows-sides .weave-carousel__arrow {
    position: absolute; top: calc(50% - 22px); z-index: 2;
}
.weave-carousel--arrows-sides .weave-carousel__arrow--prev { left: -22px; }
.weave-carousel--arrows-sides .weave-carousel__arrow--next { right: -22px; }
.weave-carousel--static .weave-carousel__arrow,
.weave-carousel--static .weave-carousel__dots,
.weave-carousel--grid .weave-carousel__arrow,
.weave-carousel--grid .weave-carousel__dots { display: none; }

/* Dots */
.weave-carousel__dots { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.weave-carousel__dot {
    width: 8px; height: 8px; border-radius: 50%; padding: 0; border: 0;
    background: var(--_line); cursor: pointer; transition: background-color 0.2s, width 0.2s;
}
.weave-carousel__dot[aria-selected="true"] { background: var(--_ink); width: 22px; border-radius: 4px; }

/* Cards (Apothecary) */
.weave-card { scroll-snap-align: start; display: flex; flex-direction: column; min-width: 0; }
.weave-card a { color: inherit; text-decoration: none; }
.weave-card__photo-link { display: block; }
.weave-card__photo {
    position: relative; display: block;
    aspect-ratio: var(--weave-ratio, 4 / 5);
    border-radius: var(--_radius); overflow: hidden;
    background: color-mix(in srgb, var(--_ink) 6%, transparent);
}
.weave-card__photo img { display: block; width: 100%; height: 100%; object-fit: var(--weave-fit, cover); transition: transform 0.4s; }
.weave-card:hover .weave-card__photo img { transform: scale(1.03); }
.weave-card--sold-out .weave-card__photo img { opacity: 0.5; }
.weave-card__badges { position: absolute; top: 12px; left: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.weave-card__tag {
    display: inline-block; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase;
    padding: 3px 8px; border-radius: 4px; background: var(--_surface); color: var(--_accent); line-height: 1.4;
}
.weave-card__tag--new { background: var(--_accent); color: var(--_surface); }
/* Name and price share a row. The name wraps inside its column; the price
   keeps its place at the right of the first line whatever the name's length,
   so every card reads the same. */
.weave-card__row { display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: baseline; gap: 0 10px; margin-top: 12px; }
.weave-card__name { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.3; font-family: inherit; overflow-wrap: anywhere; }
.weave-card__price { flex: none; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.weave-card__brand, .weave-card__potency, .weave-card__size { margin: 3px 0 0; font-size: 0.8rem; color: var(--_muted); }
.weave-card__brand-link { color: inherit; text-decoration: none; }
.weave-card__brand-link:hover, .weave-card__brand-link:focus-visible { color: var(--_accent); text-decoration: underline; }
.weave-card__promo { display: inline-flex; align-self: flex-start; align-items: center; gap: 5px; max-width: 100%; width: fit-content; margin: 6px 0 0; padding: 3px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: var(--_accent); background: color-mix(in srgb, var(--_accent) 12%, transparent); }
.weave-card__promo svg { flex: none; }
.weave-card__promo span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.weave-card__potency span + span::before { content: ' · '; }
/* The value is wrapped in <b> for sites that want it bold; the plugin itself leaves it as the line's weight. */
.weave-card__potency b { font-weight: inherit; color: inherit; }
/* The details line (the `meta` part): category · strain · size, as `meta_fields` says. */
.weave-card__meta { margin: 3px 0 0; font-size: 0.8rem; color: var(--_muted); }
.weave-card__meta span + span::before { content: ' · '; }
/* The `price_actions` part: price on the left, a small button on the right. */
/* The row wraps when the button's text is long for the card, so the
   button drops under the price instead of running over it. */
.weave-card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; margin-top: auto; padding-top: 12px; }
.weave-card__foot .weave-card__price { flex: 1 1 auto; min-width: 0; font-weight: 600; text-align: left; }
.weave-card__foot .weave-card__actions { flex-direction: row; flex: 0 1 auto; max-width: 100%; margin-top: 0; padding-top: 0; }
.weave-card__foot .weave-card__btn { width: auto; padding: 8px 14px; font-size: 0.9rem; white-space: nowrap; }
/* The name grows only when it shares a row with the price. */
.weave-card > .weave-card__name, .weave-card__body > .weave-card__name { flex: none; }
.weave-card__btn-icon { vertical-align: -1px; margin-right: 4px; }
/* Editorial template: the brand reads as an eyebrow above the name. */
.weave-card--editorial .weave-card__brand { margin-top: 12px; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--_accent); }
.weave-card--editorial .weave-card__brand + .weave-card__name { margin-top: 2px; }
/* Row layout: the photo beside a body holding every other part. */
.weave-card--row { flex-direction: row; align-items: flex-start; gap: 14px; }
.weave-card--row .weave-card__photo-link, .weave-card--row > .weave-card__photo { flex: 0 0 120px; width: 120px; }
.weave-card--row .weave-card__photo { aspect-ratio: 1; }
.weave-card--row .weave-card__body { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; align-self: stretch; }
.weave-card--row .weave-card__row, .weave-card--row.weave-card--editorial .weave-card__brand { margin-top: 0; }
.weave-card__desc { margin: 8px 0 0; font-size: 0.85rem; line-height: 1.5; color: var(--_muted); }
.weave-card__actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 12px; }
.weave-card__btn {
    display: block; width: 100%; padding: 10px; border-radius: 999px; text-align: center;
    border: 1px solid var(--_ink); background: none; color: var(--_ink);
    font: inherit; cursor: pointer; line-height: 1.3;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.weave-card__btn:hover { background: var(--_ink); color: var(--_surface); }
.weave-carousel--btn-solid .weave-card__btn--add { background: var(--_accent); border-color: var(--_accent); color: var(--_surface); }
.weave-carousel--btn-solid .weave-card__btn--add:hover { background: var(--_ink); border-color: var(--_ink); }
.weave-carousel--btn-text .weave-card__btn { border: 0; padding: 4px 0; width: auto; text-align: left; color: var(--_accent); }
.weave-carousel--btn-text .weave-card__btn:hover { background: none; color: var(--_ink); text-decoration: underline; }
.weave-carousel--btn-text .weave-card__actions { flex-direction: row; gap: 18px; }

.weave-carousel--boxed .weave-card { border: 1px solid var(--_line); border-radius: calc(var(--_radius) + 8px); padding: 10px 14px 14px; }
.weave-carousel--filled .weave-card { background: color-mix(in srgb, var(--_ink) 5%, var(--_surface)); border-radius: calc(var(--_radius) + 8px); padding: 10px 14px 14px; }
.weave-carousel--boxed .weave-card__photo, .weave-carousel--filled .weave-card__photo { border-radius: calc(var(--_radius) - 4px); }

/* Responsive */
@media (max-width: 1023px) {
    .weave-carousel { --_cols: var(--weave-cols-tablet, 3); }
    .weave-carousel--arrows-sides .weave-carousel__arrow--prev { left: 4px; }
    .weave-carousel--arrows-sides .weave-carousel__arrow--next { right: 4px; }
}
@media (max-width: 767px) {
    .weave-carousel { --_cols: var(--weave-cols-mobile, 2); --_gap: min(var(--weave-gap, 24px), 14px); }
    .weave-carousel__title { font-size: 1.5rem; }
    .weave-card__name { font-size: 0.95rem; }
    /* Narrow cards: a deal's two prices stack, leaving the name its room. */
    .weave-card__price { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
    .weave-card__was { margin-right: 0; }
    .weave-carousel--arrows-sides .weave-carousel__arrow { display: none; }
    .weave-carousel__head { margin-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .weave-carousel__track { scroll-behavior: auto; }
    .weave-card__photo img { transition: none; }
}

/* ---------- Deals ---------- */
.weave-card__tag--deal { background: var(--_accent); color: var(--_surface); }
.weave-card__was { color: var(--_muted); font-weight: 400; text-decoration: line-through; margin-right: 2px; }
.weave-card__now { color: var(--_sale); font-weight: 700; }

/* ---------- Shop: tabs, filter panel, toolbar ---------- */
.weave-shop__tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.weave-shop__tab {
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--_line); background: none; color: var(--_ink);
    border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 0.9rem; cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.weave-shop__tab small { font-size: 0.75em; opacity: 0.65; }
.weave-shop__tab:hover { border-color: var(--_ink); }
.weave-shop__tab[aria-selected="true"] { background: var(--_ink); color: var(--_surface); border-color: var(--_ink); }
.weave-shop__tab--deals { border-color: var(--_accent); color: var(--_accent); }
.weave-shop__tab--deals[aria-selected="true"] { background: var(--_accent); border-color: var(--_accent); color: var(--_surface); }

.weave-shop__layout { display: grid; grid-template-columns: var(--weave-sidebar, 260px) minmax(0, 1fr); gap: 40px; align-items: start; }
.weave-shop--filters-right .weave-shop__layout { grid-template-columns: minmax(0, 1fr) var(--weave-sidebar, 260px); }
.weave-shop--filters-right .weave-shop__filters { order: 2; }
.weave-shop--filters-top .weave-shop__layout, .weave-shop--filters-off .weave-shop__layout { grid-template-columns: minmax(0, 1fr); }
.weave-shop__filters { position: sticky; top: calc(var(--wp-admin--admin-bar--height, 0px) + 16px); }
.weave-shop--filters-top .weave-shop__filters { position: static; }
.weave-shop__panel { border: 1px solid var(--_line); border-radius: var(--_radius); background: var(--_surface); }
.weave-shop__panel-toggle { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; font-weight: 600; }
.weave-shop__panel-toggle::-webkit-details-marker { display: none; }
.weave-shop__panel-toggle::after { content: '+'; font-weight: 400; font-size: 1.2em; color: var(--_muted); }
.weave-shop__panel[open] > .weave-shop__panel-toggle::after { content: '–'; }
.weave-shop__panel-count { color: var(--_accent); font-size: 0.85em; margin-left: auto; margin-right: 10px; }
.weave-shop__panel-inner { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 18px; }
.weave-shop--filters-top .weave-shop__panel-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px 28px; align-items: start; }
.weave-shop__search { width: 100%; padding: 10px 12px; border: 1px solid var(--_line); border-radius: 10px; font: inherit; background: var(--_surface); color: var(--_ink); }
.weave-shop__search:focus { outline: 2px solid var(--_accent); outline-offset: 1px; }
.weave-shop__switches { display: flex; flex-direction: column; gap: 8px; }
.weave-shop__group-title { margin: 0 0 8px; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--_muted); font-family: inherit; font-weight: 600; }
.weave-shop__checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }
.weave-shop__check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.92rem; }
.weave-shop__check input { margin: 0; accent-color: var(--_accent); width: 16px; height: 16px; }
.weave-shop__check small { margin-left: auto; color: var(--_muted); font-size: 0.8em; }
.weave-shop__range { display: flex; align-items: center; gap: 8px; }
.weave-shop__range input { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--_line); border-radius: 8px; font: inherit; background: var(--_surface); color: var(--_ink); }
.weave-shop__range-sep { color: var(--_muted); }
.weave-shop__clear { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--_accent); font: inherit; font-size: 0.9rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.weave-shop__clear:hover { color: var(--_ink); }

.weave-shop__toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.weave-shop__count { color: var(--_muted); font-size: 0.92rem; }
.weave-shop__sort { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; margin-left: auto; }
.weave-shop__sort select { padding: 7px 10px; border: 1px solid var(--_line); border-radius: 8px; font: inherit; background: var(--_surface); color: var(--_ink); }
.weave-shop__more { display: flex; justify-content: center; margin-top: 32px; }
.weave-shop__more-btn { padding: 12px 28px; border-radius: 999px; border: 1px solid var(--_ink); background: none; color: var(--_ink); font: inherit; font-weight: 600; cursor: pointer; }
.weave-shop__more-btn:hover { background: var(--_ink); color: var(--_surface); }
.weave-shop__more-auto { margin: 0; padding: 12px 0; color: var(--_muted, #6b6b6b); font-size: 0.9rem; text-align: center; opacity: 0.8; }
.weave-shop__more-auto::after { content: ''; display: inline-block; width: 14px; height: 14px; margin-left: 8px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: weave-shop-spin 0.8s linear infinite; }
@keyframes weave-shop-spin { to { transform: rotate(360deg); } }
.weave-shop .weave-carousel__empty { grid-column: 1 / -1; padding: 40px 0; text-align: center; }

@media (max-width: 1023px) {
    .weave-shop__layout { grid-template-columns: minmax(0, 1fr) !important; gap: 20px; }
    .weave-shop__filters { position: static; order: 0 !important; }
    .weave-shop__tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; scrollbar-width: none; }
    .weave-shop__tabs::-webkit-scrollbar { display: none; }
    .weave-shop__tab { white-space: nowrap; }
}

/* Narrow containers (a sidebar, a preview pane) lay out like narrow screens. */
@container (max-width: 1023px) {
    .weave-carousel__track { --_cols: var(--weave-cols-tablet, 3); }
    .weave-shop__layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .weave-shop__filters { position: static; order: 0; }
}
@container (max-width: 767px) {
    .weave-carousel__track { --_cols: var(--weave-cols-mobile, 2); --_gap: min(var(--weave-gap, 24px), 14px); }
    .weave-carousel__title { font-size: 1.5rem; }
    .weave-card__name { font-size: 0.95rem; }
    /* Narrow cards: a deal's two prices stack, leaving the name its room. */
    .weave-card__price { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
    .weave-card__was { margin-right: 0; }
    .weave-carousel--arrows-sides .weave-carousel__arrow { display: none; }
}
