/* Тёмная карточка. Сетка, адаптивные вкладки и размеры шрифтов общие с дневным режимом. */
html[data-theme="dark"] #five-product {
    color-scheme: dark;
    --five-bg: #1a1a1c;
    --five-ink: #f7f7f8;
    --five-soft: #242426;
    --five-line: #403e3c;
    --five-sub: #bdbdc3;
    --five-orange: #dd550a;
    --pd-accent: #ff9e53;
    --pd-warm: #35261e;
    --pd-border: #544033;
    --c-ink: var(--five-ink);
    --c-text: #ededf0;
    --c-muted: var(--five-sub);
    --c-line: var(--five-line);
    --c-brand-press: var(--pd-accent);
    color: var(--c-text);
}

html[data-theme="dark"] #five-product .five-main {
    background: var(--five-bg);
}

html[data-theme="dark"] #five-product :is(
    .five-buy,
    .five-receive,
    .five-preparation,
    .five-allergens,
    .five-reading-grid > a
) {
    background: var(--five-soft);
}

html[data-theme="dark"] #five-product :is(
    .five-reading,
    .five-reviews,
    .five-reading-soon,
    .five-pickup-store,
    .five-ozon-row,
    .five-preparation > p,
    .five-review-list article,
    .five-nutrition-table th,
    .five-nutrition-table td
) {
    border-color: var(--five-line);
}

/* Сохраняем светлую подложку для исходников на белом фоне и читаемость марки. */
html[data-theme="dark"] #five-product .five-photo {
    background: #fff;
    height: auto;
    min-height: 0;
    flex: none;
}

html[data-theme="dark"] #five-product .five-photo-label {
    color: #47474d;
}

html[data-theme="dark"] #five-product .five-photo:has(img[data-theme-image="dark"]) {
    background: #121213;
}

html[data-theme="dark"] #five-product .five-photo:has(img[data-theme-image="dark"]) .five-photo-label {
    color: #f4f4f5;
    text-shadow: 0 1px 5px #000;
}

html[data-theme="dark"] #five-product .five-photo img[data-theme-image="dark"] {
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: contain;
}

@media (min-width: 901px) {
    html[data-theme="dark"] #five-product .five-photo {
        aspect-ratio: 7 / 6;
    }

    /* Квадратный снимок занимает 6/7 ширины. Продлеваем его края зеркально,
       чтобы не обрезать упаковку и не прерывать тени у основания. */
    html[data-theme="dark"] #five-product .five-photo:has(img[data-theme-image="dark"])::before,
    html[data-theme="dark"] #five-product .five-photo:has(img[data-theme-image="dark"])::after {
        content: "";
        position: absolute;
        inset-block: 0;
        left: 0;
        width: calc(100% / 14 + 1px);
        background: var(--five-photo-image, none) left center / auto 100% no-repeat;
        transform: scaleX(-1);
        pointer-events: none;
    }

    html[data-theme="dark"] #five-product .five-photo:has(img[data-theme-image="dark"])::after {
        left: auto;
        right: 0;
        background-position: right center;
    }
}

@media (max-width: 900px) {
    html[data-theme="dark"] #five-product .five-photo {
        aspect-ratio: 1;
        max-width: 560px;
        width: 100%;
        margin-inline: auto;
    }
}

html[data-theme="dark"] #five-product :is(.five-thumb, .five-fav) {
    background: var(--five-bg);
    border: 1px solid var(--five-line);
    color: var(--five-ink);
}

html[data-theme="dark"] #five-product .five-thumb:is(:hover, [aria-pressed="true"]) {
    border-color: var(--five-orange);
}

html[data-theme="dark"] #five-product .five-fav[aria-pressed="true"] {
    color: var(--pd-accent);
    background: var(--pd-warm);
}

/* Варианты товара, подсказки о составе и текущее состояние выбора. */
html[data-theme="dark"] #five-product :is(.five-options .five-option-toggle, .five-not-here, .five-quantity) {
    background: var(--five-bg);
    color: var(--five-ink);
}

html[data-theme="dark"] #five-product :is(.five-option-menu, #five-flavors, .ig-panel) {
    color: var(--five-ink);
    background: var(--five-soft);
    border-color: #59595f;
    box-shadow: 0 12px 32px rgb(0 0 0 / 38%);
}

html[data-theme="dark"] #five-product :is(.five-option-menu, #five-flavors) a {
    color: var(--five-ink);
    background: transparent;
}

html[data-theme="dark"] #five-product :is(.five-option-menu, #five-flavors) a:is(:hover, :focus-visible),
html[data-theme="dark"] #five-product .five-option-menu .five-option-current,
html[data-theme="dark"] #five-product .five-reading-grid > a:hover {
    background: var(--pd-warm);
    color: var(--pd-accent);
}

/* Клубная цена, акции и выделенные строки таблицы. */
html[data-theme="dark"] #five-product :is(
    .five-price-hero,
    .five-deal,
    .five-protein-row,
    .five-store-plaza,
    .five-preparation li > span,
    .ig-info
) {
    background: var(--pd-warm);
    border-color: var(--pd-border);
    color: #fff1df;
}

html[data-theme="dark"] #five-product .five-price-hero .five-club-main-price {
    color: #fff1df;
}

html[data-theme="dark"] #five-product :is(.five-saving, .five-club-scope) {
    color: #ffdcc1;
}

html[data-theme="dark"] #five-product :is(
    .five-price-hero .five-club-pill,
    .five-deal-left,
    .five-store-club,
    .five-description-text a,
    .five-reading-soon a,
    .five-ozon-row time,
    .five-preparation li > span,
    .five-nutrition-table .five-protein-row th,
    .five-nutrition-table .five-protein-row td,
    .five-section-eyebrow
),
html[data-theme="dark"] #five-product :is(.ig-info, .ig-panel a, .ig-draft) {
    color: var(--pd-accent);
}

html[data-theme="dark"] #five-product :is(.ig-info[aria-expanded="true"], .five-deal-tag, .five-cart) {
    background: #cb4b06;
    color: #fff;
}

html[data-theme="dark"] #five-product .five-cart:hover {
    background: #b54004;
}

html[data-theme="dark"] #five-product :is(
    .five-gallery > span,
    .five-pickup-store div > span,
    .five-pickup-list p,
    .five-demo-note,
    .five-reading-head > span,
    .five-reading-caption
) {
    color: var(--five-sub);
}

html[data-theme="dark"] #five-product :is(
    .five-brand,
    .five-label,
    .five-crumb,
    .five-crumb a,
    .five-facts span,
    .five-caption,
    .five-unit-price,
    .five-regular-price span,
    .five-label-link,
    .five-description-copy > p,
    .five-description-text ul,
    .five-description-text ol,
    .five-reading-arrow,
    .ig-panel p,
    .ig-panel strong,
    .ig-close
) {
    color: var(--c-text);
}

html[data-theme="dark"] #five-product .five-tabs button {
    color: var(--five-ink);
}

html[data-theme="dark"] #five-product .five-tabs button:hover,
html[data-theme="dark"] #five-product .five-crumb a:hover {
    color: var(--pd-accent);
}

html[data-theme="dark"] #five-product :is(.five-pickup-state.is-ok, .five-store-state > strong) {
    color: #80d8a3;
}

html[data-theme="dark"] #five-product .five-stock-dot {
    background: #80d8a3;
}
