/* mrd-menu — базовые состояния, на которые опираются JS и тесты (полные стили ниже, Task 3) */
.mrd-card__desc-text { max-height: 45px; overflow: hidden; }
.mrd-card__desc.is-open .mrd-card__desc-text { max-height: none; }
@media (max-width: 600px) { .mrd-card__desc-text { max-height: 35px; } }
.mrd-qty[hidden], .mrd-add-form[hidden], .mrd-more[hidden] { display: none !important; }
/* «В корзину» и «− N +» в одной ячейке; скрытый невидим, но держит место — блок всегда шириной с кнопку, при переключении ничего не сдвигается */
.mrd-buy > .mrd-add-form[hidden] { display: block !important; visibility: hidden; }
.mrd-buy > .mrd-qty[hidden] { display: flex !important; visibility: hidden; }
.mrd-popup { padding: 0; border: 0; overscroll-behavior: contain; } /* прокрутка попапа не передаётся странице */
.mrd-popup::backdrop { background: rgba(0, 0, 0, .55); }
html:has(.mrd-popup[open]) { overflow: hidden; }
.mrd-popup .woocommerce-variation-add-to-cart, .mrd-popup .reset_variations { display: none !important; }
.mrd-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100000; max-width: calc(100vw - 32px); }

/* ===== Полные стили: 1:1 с сетками Impreza (layout 218 — ПК, 404 — телефон) и прежним попапом quick view ===== */

/* Сетка: > 1280 — 4 колонки, 1025–1280 — 3, 601–1024 — 2, ≤ 600 — 1 */
.mrd-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 64px; align-items: start; }
@media (max-width: 1280px) { .mrd-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .mrd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mrd-grid--empty { display: block; }
.mrd-empty { margin: 0; padding: 2rem; background: #f5f5f5; text-align: center; } /* как .w-grid-none.type_message */

/* Карточка: фото, название, описание, (распорка), строка покупки */
.mrd-card { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto 1fr auto; color: #444; font-size: 16px; line-height: 28px; }
.mrd-card::before { content: ""; grid-area: 2 / 1 / 5; min-height: 60px; } /* название + описание не ниже 60px, как обёртка в Impreza */
.mrd-card__media { grid-area: 1 / 1; align-self: start; position: relative; display: block; aspect-ratio: 1; margin-bottom: 16px; border-radius: 32px; overflow: hidden; transition: transform .3s; }
.mrd-card:hover .mrd-card__media, .mrd-card:focus-within .mrd-card__media { transform: translateY(1%); }
.mrd-card__img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.mrd-card__title { grid-area: 2 / 1; margin: 0 0 8px; padding: 0 0 0 16px; font-size: 20.8px; line-height: 24.96px; font-weight: 700; color: #444; letter-spacing: 0; text-transform: none; }
.mrd-grid .mrd-card a, .mrd-grid .mrd-card a:hover { color: inherit; text-decoration: none; }
.mrd-card__desc { grid-area: 3 / 1; padding-left: 16px; font-size: 14.4px; line-height: 20.16px; color: #5c6370; }
.mrd-card__desc-text p { margin: 0; }
.mrd-more { display: block; width: fit-content; margin: 8px 0 0; padding: 0; border: 0; border-bottom: 1px dotted; border-radius: 0; background: none; color: #222; font: inherit; cursor: pointer; transition: border-color .3s, color .3s; }
.mrd-more:hover { color: #602c28; }
.mrd-card__buy { grid-area: 5 / 1; display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding-left: 16px; }
.mrd-price { margin: 8px 19.2px 0 0; font-size: 22.4px; line-height: 28px; font-weight: 500; color: #444; }
@media (max-width: 1024px) { .mrd-price { font-weight: 700; } }

/* Бейджи на фото. ponytail: два бейджа одного товара лягут друг на друга — обёртку добавить, когда такой товар появится */
.mrd-badge { position: absolute; top: 12.8px; left: 16px; color: #444; font-size: 16px; line-height: 28px; }
.mrd-sale { position: absolute; top: 1rem; right: 1rem; padding: .3rem 1rem .1rem; border-radius: .5rem; background: linear-gradient(120deg, #ff3906 0%, #e5007a 100%); color: #fff; font-size: 1rem; font-weight: 700; }

/* Покупка: «В корзину» / «Выбрать» (us-btn-style_7), «Нет в наличии», «− N +».
   .mrd-add — <button type="submit">, а тема красит такие правилом [type=submit]:not(.w-btn):not(.button) (цвет с !important):
   :not(#_) поднимает специфичность выше темы */
.mrd-buy { display: grid; justify-content: start; align-items: center; }
.mrd-buy > .mrd-add-form, .mrd-buy > .mrd-qty { grid-area: 1 / 1; }
.mrd-buy .mrd-add:not(#_) { width: 100%; }
.mrd-add-form { margin: 0; }
.mrd-add:not(#_), .mrd-grid .mrd-choose { display: inline-flex; align-items: center; justify-content: center; padding: 12.8px 25.6px; border: 0; border-radius: 64px; background: #fce4c1; color: #602c28 !important; font-family: inherit; font-size: 16px; line-height: 19.2px !important; font-weight: 400; white-space: nowrap; cursor: pointer; transition: background-color .3s, color .3s; }
.mrd-add:not(#_):hover, .mrd-grid .mrd-choose:hover { background: #ffc45a; color: #222 !important; }
.mrd-add .fa-shopping-cart, .mrd-choose .fa-shopping-cart { display: none; }
.mrd-out { display: block; padding: 12.8px 25.6px; border-radius: 32px; background: #f5f5f5; color: #222; font-size: 16px; line-height: 28px; cursor: default; }
/* «− N +»: пилюля без фона с серой обводкой, «−» и «+» — кружки цвета кнопок меню (наведение — жёлтый темы); прозрачная рамка кнопки — зазор до обводки без уменьшения зоны нажатия */
.mrd-qty { box-sizing: border-box; display: inline-flex; align-items: center; height: 44.78px; border: 1px solid #e0e0e0; border-radius: 64px; color: #602c28; font-size: 16px; line-height: 1; }
.mrd-qty button { height: 100%; aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 50%; background: #fce4c1 padding-box; color: #602c28; font: inherit; cursor: pointer; transition: background-color .3s, color .3s; }
.mrd-qty button:hover { background-color: #ffc45a; color: #222; }
.mrd-qty__value { flex: 1; min-width: 1.5em; font-size: 1.25em; font-weight: 700; text-align: center; }

/* Телефон: горизонтальная карточка (фото 45% слева, текст справа), пилюля цены, круглая кнопка-иконка */
@media (max-width: 600px) {
  .mrd-grid { grid-template-columns: minmax(0, 1fr); gap: 96px; }
  .mrd-card { grid-template-columns: 45% minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; column-gap: 12.8px; color: #222; }
  .mrd-card::before, .mrd-card .mrd-badge { display: none; }
  .mrd-card__media { grid-area: 1 / 1 / -1; align-self: center; margin: 0; border-radius: 24px; }
  .mrd-card__title { grid-area: 1 / 2; margin: 0 0 11.2px; padding: 0; font-size: 17.6px; line-height: 21.12px; font-weight: 500; color: #222; }
  .mrd-card__desc { grid-area: 2 / 2; margin: 0 0 11.2px; padding: 0; font-size: 12px; line-height: 16.8px; }
  /* Цена и кнопка/«− N +» всегда одной строкой: размеры в em от --u — 16px, а на узких экранах меньше пропорционально ширине строки
     (cqw считается у дочерних элементов, поэтому через переменную), так самая длинная цена с «− N +» влезает и на 320 px */
  .mrd-card__buy { container-type: inline-size; --u: min(16px, 8.7cqw); grid-area: 3 / 2; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 6px; padding: 0; }
  .mrd-card__buy > * { font-size: var(--u); }
  .mrd-price { margin: 0; padding: .19em .6em; border-radius: 16px; background: #fce4c1; color: #602c28; font-size: calc(1.05 * var(--u)) !important; line-height: 1.43; font-weight: 500; white-space: nowrap; }
  .mrd-card .mrd-add:not(#_), .mrd-grid .mrd-choose { width: 2.5em; height: 2.5em; padding: 0; border-radius: 52px; font-size: 1em; line-height: 1.2 !important; }
  .mrd-card .mrd-add .fa-shopping-cart, .mrd-choose .fa-shopping-cart { display: inline-block; line-height: inherit; }
  .mrd-card .mrd-add__label { display: none; }
  .mrd-card .mrd-out { padding: 0; border-radius: 0; background: none; color: #e91e63; font-size: calc(.9 * var(--u)); white-space: nowrap; }
  .mrd-card .mrd-qty { height: 2.5em; border-radius: 52px; font-size: 1em; }
  .mrd-card .mrd-qty__value { min-width: 1em; }
  .mrd-card .mrd-buy > [hidden] { display: none !important; } /* кнопка здесь — круглая иконка: место под «− N +» не держим, иначе цена с кнопкой переносятся */
}

/* Попап */
.mrd-popup { width: 930px; max-width: calc(100vw - 32px); border-radius: 24px; background: #fff; color: #444; font-size: 16px; line-height: 28px; }
.mrd-popup__close { position: fixed; top: 0; right: 0; z-index: 1; width: 72px; height: 72px; padding: 0; border: 0; background: none; color: #fff; font: 400 24px/72px fontawesome; cursor: pointer; }
.mrd-popup__close::before { content: "\f00d"; }
.mrd-popup__body { padding: 24px; }
.mrd-pp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 48px; }
.mrd-pp__media { position: relative; align-self: stretch; aspect-ratio: 1; margin: -24px 0 -24px -24px; overflow: hidden; border-radius: 24px 0 0 24px; }
.mrd-pp__img { position: absolute; top: -8px; left: -16px; width: calc(100% + 16px); height: calc(100% + 16px); max-width: none; object-fit: cover; } /* кадр прежнего попапа: фото на 16px больше окна, со сдвигом */
.mrd-pp__media .mrd-badge { top: 68.8px; left: 64px; } /* место бейджа в прежнем попапе */
.mrd-pp__pill { display: none; }
.mrd-pp__info { padding: 32px 24px 32px 0; }
.mrd-pp__cat { font-size: 16px; line-height: 28px; color: #444; }
.mrd-pp__title { margin: 0 0 24px; padding: 0; font-size: 30.4px; line-height: 36.48px; font-weight: 700; color: #444; letter-spacing: 0; text-transform: none; }
.mrd-pp__desc { font-size: 14.4px; line-height: 20.16px; color: #5c6370; }
.mrd-pp__desc p { margin: 0; }
.mrd-pp .variations_form { margin: 0; padding-top: 24px; }
/* правила темы для формы вариаций, которые раньше включал класс .woocommerce обёртки попапа */
.mrd-pp .variations { margin: 0; }
.mrd-pp .variations th, .mrd-pp .variations td { border: none; padding-top: 0; padding-left: 0; padding-right: 0; }
.mrd-pp .variations td.value { position: relative; }
.mrd-pp__price { margin: 0; padding: 16px 0 24px; }
.mrd-popup .woocommerce-Price-amount { font-size: 22.4px; font-weight: 700; color: #333; }
.mrd-pp .variations_form + .mrd-buy { margin-top: 9.6px; }
.mrd-pp .mrd-add:not(#_) { background: #ffcd73; color: #222 !important; }
.mrd-pp .mrd-qty { color: #222; }
.mrd-pp .mrd-add:not(#_):hover { background: #ffbe4a; }
.mrd-pp .mrd-out { padding: 0; border-radius: 0; background: none; color: #f00; font-weight: 700; } /* как p.stock.out-of-stock */
/* Скелетон загрузки: та же сетка .mrd-pp (квадрат фото задаёт высоту), поэтому окно не меняет размер, когда приходят данные */
.mrd-pp--skeleton .mrd-pp__media, .mrd-pp--skeleton i { background: linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 50%, #f2f2f2 75%) 0 0 / 200% 100%; animation: mrd-shimmer 1.2s linear infinite; }
.mrd-pp--skeleton i { display: block; height: 16px; margin-bottom: 12px; border-radius: 8px; }
.mrd-pp--skeleton i:nth-child(1) { width: 25%; }
.mrd-pp--skeleton i:nth-child(2) { width: 75%; height: 30px; margin-bottom: 24px; }
.mrd-pp--skeleton i:nth-child(3) { width: 90%; height: 14px; }
.mrd-pp--skeleton i:nth-child(4) { width: 60%; height: 14px; margin-bottom: 28px; }
.mrd-pp--skeleton i:nth-child(5) { width: 20%; height: 24px; margin-bottom: 28px; }
.mrd-pp--skeleton i:nth-child(6) { width: 140px; height: 45px; border-radius: 64px; }
@keyframes mrd-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .mrd-pp--skeleton * { animation: none; } }
.mrd-popup__error { margin: 0; padding: 48px 0; color: #5c6370; text-align: center; }

@media (max-width: 600px) {
  .mrd-popup { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; }
  .mrd-popup__close { width: 50px; height: 50px; color: #000; line-height: 50px; }
  .mrd-popup__body { padding: 34px 24px 24px; }
  .mrd-pp { display: block; }
  .mrd-pp__media { margin: 0 0 32px; overflow: visible; border-radius: 0; }
  .mrd-pp__img { top: 0; left: 0; width: 100%; height: 100%; border-radius: 16px; }
  .mrd-pp__media .mrd-badge { top: 24px; left: 24px; }
  .mrd-pp--skeleton .mrd-pp__media { border-radius: 16px; }
  .mrd-pp--skeleton i:nth-child(6) { width: auto; height: 54px; margin: 48px -24px 0; } /* кнопка на всю ширину, как .mrd-buy на телефоне */
  .mrd-pp__pill { display: block; position: absolute; top: calc(100% - 33px); right: 24px; padding: 16px; border-radius: 16px; background: #fff; box-shadow: 0 5px 15px rgba(0, 0, 0, .14); font-size: 16px; line-height: 1; }
  .mrd-pp__pill .price { font-size: 24px; } /* цена вариации, как .woocommerce-variation-price */
  .mrd-pp__info { padding: 0 24px; }
  .mrd-pp__title { font-size: 27.2px; line-height: 32.64px; }
  .mrd-pp__price, .mrd-popup .woocommerce-variation-price { display: none; }
  .mrd-pp__price + .mrd-buy, .mrd-pp__price + .mrd-out { padding-top: 48px; } /* место скрытой цены: прежние отступы 24 + 24 */
  /* кнопка и «− N +» — на всю ширину попапа (как фото: поверх отступов текста), крупнее */
  .mrd-pp .mrd-buy { justify-content: stretch; margin-inline: -24px; }
  .mrd-pp .mrd-add:not(#_) { padding-block: 17.4px; font-size: 18px; }
  .mrd-pp .mrd-qty { height: 54px; font-size: 18px; }
}

/* Уведомление об ошибке корзины: .woocommerce-error темы на белой подложке */
.mrd-toast { width: max-content; border-radius: 8px; background: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, .15); }
.mrd-toast .woocommerce-error { margin: 0; border-radius: inherit; }

/* Баннер главной [mrd_banner]: одна адаптивная разметка; размеры текста — от ширины баннера (cqi), высота — пропорцией */
.mrd-banner { container-type: inline-size; }
.mrd-banner__in {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 4cqi;
  --glow: 84% 50%; /* свечение за логотипом */
  aspect-ratio: 4 / 1; padding: 0 7cqi 0 6cqi; overflow: hidden; border-radius: 24px; color: #fff;
  background:
    radial-gradient(circle at var(--glow), rgba(247, 148, 29, .28), transparent 34%),
    radial-gradient(circle at 0 100%, rgba(247, 148, 29, .16), transparent 38%),
    radial-gradient(circle, rgba(255, 170, 60, .55) 0 1px, transparent 1.6px) 0 0 / 173px 131px,
    radial-gradient(circle, rgba(255, 120, 30, .4) 0 1.2px, transparent 2px) 61px 37px / 251px 197px,
    #131212;
}
.mrd-banner__text { margin: 0; font-size: 5.2cqi; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
.mrd-banner__line { display: block; }
.mrd-banner__sum { display: inline-block; padding: 0 .28em; border-radius: .22em; background: #efad37; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.mrd-banner__logo { flex: none; width: auto; height: 84%; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .45)); }
@media (max-width: 600px) {
  .mrd-banner__in { --glow: 82% 50%; aspect-ratio: 2 / 1; padding: 0 5cqi 0 6cqi; border-radius: 16px; } /* та же раскладка, но выше: при 4:1 текст был бы нечитаемым */
  .mrd-banner__text { font-size: 5.6cqi; white-space: nowrap; }
  .mrd-banner__logo { height: 74%; }
}
