/* ============================================================
   LFM PRODUCT CARD (shared by Subscriptions and Producer pages)
   Producer-only rules live under .lfm-product-card--producer.
   Mobile overrides MUST stay at the end of this file.
   ============================================================ */
:is(#subscriptions-page, #producer-page) {
    /* Fallback brand colors only; overridden at runtime per-site by applyThemeColors()
       in subscriptions.js, which reads the live site theme (white-label safe). */
    --lfm-teal: #345432;
    --lfm-green: #345432;
    --lfm-blue: #345432;
    --lfm-blue-light: #3e643c;
    --lfm-primary: #345432;
    --lfm-primary-dark: #3e643c;
    --lfm-warning: #92400E;
    --lfm-warning-light: #faeeda;
    --lfm-muted-bg: #f5f5f3;
    --lfm-text-primary: #1a1a1a;
    --lfm-text-secondary: #555;
    --lfm-text-muted: #6b6b6b; /* was #888 (3.94:1); #6b6b6b meets 4.5:1 on white */
}

/* GRID */
:is(#subscriptions-page, #producer-page) .lfm-product-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); column-gap: 14px; row-gap: 14px; }
@media (max-width:1000px) { :is(#subscriptions-page, #producer-page) .lfm-product-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width:760px) { :is(#subscriptions-page, #producer-page) .lfm-product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* CARD */
:is(#subscriptions-page, #producer-page) .lfm-product-card { background: #fff; display: flex; flex-direction: column; border-radius: 10px; border: 1px solid rgba(0,0,0,.45); box-shadow: rgba(0, 0, 0, 0.15) 2.95px 2.95px 2.6px; overflow: hidden; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-col { position: relative; flex-shrink: 0; width: 100%; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img { width: 100%; aspect-ratio: 1/1; position: relative; overflow: hidden; background: var(--lfm-muted-bg) center/cover no-repeat; cursor: pointer; border: none; padding: 0; display: block; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img:focus-visible { outline: 3px solid var(--lfm-blue-light); outline-offset: -3px; }

/* Carousel nav arrows + counter (shown only when a product has more than one photo) */
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-nav { position: absolute; top: 0; bottom: 0; width: 44px; display: flex; align-items: center; justify-content: center; z-index: 3; cursor: pointer; background: none; border: none; padding: 0; opacity: 0; transition: opacity .15s; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-nav:focus-visible { opacity: 1; outline: 3px solid #fff; outline-offset: -3px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-nav--prev { left: 0; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-nav--next { right: 0; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-nav[hidden] { display: none; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-nav__icon { width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
:is(#subscriptions-page, #producer-page) .lfm-product-card:hover .lfm-product-card__img-nav:not([hidden]) { opacity: 1; }
@media (hover: none) {
    :is(#subscriptions-page, #producer-page) .lfm-product-card__img-nav { display: none; }
}
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-counter { position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.45); color: #fff; font-size: 10px; font-weight: 600; line-height: 1; padding: 3px 7px; border-radius: 10px; z-index: 3; pointer-events: none; letter-spacing: .02em; white-space: nowrap; }

/* Expand (magnifying-glass) button: hidden until hover on desktop, always visible on mobile
   since touch devices have no hover state. */
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-expand { position: absolute; top: 7px; left: 50%; transform: translateX(-50%); z-index: 3; cursor: pointer; background: none; border: none; padding: 0; opacity: 0; transition: opacity .15s; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-expand:focus-visible { opacity: 1; outline: 2px solid #fff; border-radius: 50%; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img:hover .lfm-product-card__img-expand { opacity: 1; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__img-expand__icon { width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }

@media (max-width: 480px) {
    :is(#subscriptions-page, #producer-page) .lfm-product-card__img-expand {
        top: 4px;
        left: auto;
        right: 4px;
        transform: none;
        opacity: 1;
    }
    :is(#subscriptions-page, #producer-page) .lfm-product-card__img-expand__icon {
        width: 16px;
        height: 16px;
    }
}

:is(#subscriptions-page, #producer-page) .lfm-product-card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; flex: 1; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__producer { font-size: 12px; color: var(--lfm-text-secondary); margin-bottom: 2px; line-height: 1.4; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__producer a { color: inherit; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__title { margin: 0 0 4px; font-size: 14px; line-height: 1.35; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__title-control { background: none; border: none; padding: 0; margin: 0; font-family: inherit; font-weight: 700; line-height: inherit; color: var(--lfm-text-primary); text-align: left; cursor: pointer; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__title-control:hover { text-decoration: underline; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__title-control:focus-visible { outline: 2px solid var(--lfm-blue-light); outline-offset: 2px; border-radius: 2px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__subs-name { font-size: 13px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__product-name { font-size: 12px; color: var(--lfm-teal); font-weight: 600; line-height: 1.4; }
:is(#subscriptions-page, #producer-page) .lfm-product-card--product-sort .lfm-product-card__subs-name { font-size: 12px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card--product-sort .lfm-product-card__product-name { font-size: 13px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__meta { font-size: 11px; color: var(--lfm-teal); font-weight: 600; margin: 4px 0 2px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__meta--none { color: var(--lfm-text-muted); }
:is(#subscriptions-page, #producer-page) .lfm-product-card__spacer { flex: 1; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__bottom { display: flex; margin-top: 6px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__cta { display: block; width: 100%; height: 36px; padding: 0 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__confirmed { display: flex; align-items: center; justify-content: center; gap: 5px; width: 100%; height: 36px; padding: 0 12px; border-radius: 10px; background: #eef3ee; border: 1px solid rgba(0,0,0,.1); font-size: 11px; font-weight: 700; color: var(--lfm-blue); cursor: pointer; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__confirmed:hover { background: #dfe9df; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__confirmed:focus-visible { outline: 3px solid var(--lfm-blue-light); outline-offset: 2px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__confirmed--cart { background: #EAF3DE; color: #27500A; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__confirmed--cart:hover { background: #dcebc9; }

/* UNIT SELECTOR (By Product) */
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-wrap { padding-top: 2px; position: relative; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-selector { display: inline-flex; align-items: flex-start; gap: 4px; cursor: pointer; user-select: none; background: none; border: none; padding: 0; font-family: inherit; text-align: left; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-selector:focus-visible { outline: 3px solid var(--lfm-blue-light); outline-offset: 2px; border-radius: 3px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-name { font-size: 12px; color: var(--lfm-teal); font-weight: 600; line-height: 1.4; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-chevron { color: var(--lfm-teal); display: block; margin-top: 4px; transition: transform .18s; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-chevron svg { display: block; width: 12px; height: 8px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-selector[aria-expanded="true"] .lfm-product-card__unit-chevron { transform: rotate(180deg); }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-more { font-size: 10px; color: var(--lfm-text-muted); margin-top: 1px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-dd { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid rgba(0,0,0,.15); border-radius: 5px; z-index: 100; overflow: hidden; display: none; box-shadow: 0 4px 14px rgba(0,0,0,.10); }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-dd.open { display: block; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-dd-row { display: flex; align-items: center; padding: 8px 10px; cursor: pointer; gap: 6px; border-bottom: 1px solid rgba(0,0,0,.06); }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-dd-row:focus-visible { outline: 3px solid var(--lfm-blue-light); outline-offset: -2px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-dd-row:last-child { border-bottom: none; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-dd-row:hover { background: var(--lfm-muted-bg); }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-dd-row[aria-checked="true"] { background: #eef5f6; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-dd-name { font-size: 12px; color: #2a2a2a; flex: 1; line-height: 1.4; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-dd-check { color: var(--lfm-teal); flex-shrink: 0; visibility: hidden; }
:is(#subscriptions-page, #producer-page) .lfm-product-card__unit-dd-row[aria-checked="true"] .lfm-product-card__unit-dd-check { visibility: visible; }

/* PRODUCER CARD (.lfm-product-card--producer) */
#producer-page #product-list { list-style: none; margin: 0; padding: 0; }
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__title { font-size: 13px; font-weight: 600; color: var(--lfm-teal); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__title a { color: var(--lfm-teal); text-decoration: none; }
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__title a:hover { text-decoration: underline; }
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__title a:focus-visible,
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__cta:focus-visible { outline: 3px solid var(--lfm-teal); outline-offset: 2px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__body { min-height: 140px; }
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__title { min-height: calc(2 * 1.35em); }
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__meta { font-size: 11px; color: var(--lfm-teal); font-weight: 600; min-height: calc(2 * 1.4em); }
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__cta { background: #fff; color: var(--lfm-teal); border: 1px solid var(--lfm-teal); border-radius: 5px; line-height: 34px; text-align: center; text-decoration: none; text-transform: uppercase; }
:is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__cta:hover { background: var(--lfm-muted-bg); color: var(--lfm-teal); text-decoration: none; }

/* MOBILE: keep this block LAST so it wins the cascade */
@media (max-width:480px) {
    :is(#subscriptions-page, #producer-page) .lfm-product-grid { grid-template-columns: 1fr; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card { flex-direction: row; align-items: flex-start; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card__img-col { width: 92px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card__img { width: 92px; height: 92px; aspect-ratio: unset; border-radius: 4px; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card__body { padding: 10px 12px 12px 12px; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card__title { font-size: 15px; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card__meta { font-size: 12px; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card__cta,
    :is(#subscriptions-page, #producer-page) .lfm-product-card__confirmed { height: 32px; font-size: 10px; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__title { font-size: 13px; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__meta { font-size: 12px; min-height: 0; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__body { min-height: 0; }
    :is(#subscriptions-page, #producer-page) .lfm-product-card--producer .lfm-product-card__cta { line-height: 30px; }
}
