/* Дополнительные стили оболочки витрины поверх /styles.css магазина. */

.sr-only, .skip {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip:focus {
  position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto;
  padding: 10px 16px; background: #15181f; color: #fff; border-radius: 8px; z-index: 100;
}

/* Каталог в шапке открывается без JS — это <details>, а не кнопка со скриптом */
.catalog-wrap > summary { list-style: none; cursor: pointer; }
.catalog-wrap > summary::-webkit-details-marker { display: none; }
.catalog-wrap[open] > .catalog-dropdown { display: block; }

/* Счётчик товаров рядом с заголовком раздела */
.section-count { color: #7a7a85; font-size: 14px; white-space: nowrap; }

/* Пустой список: сообщение вместо сетки */
.empty-note { color: #7a7a85; padding: 26px 0; }

/* Товар без фото — ровный серый прямоугольник в пропорции карточки */
.p-photo-none { display: block; width: 100%; aspect-ratio: 3 / 4; background: #f2f2f5; }

/* Блок покупки: кнопка и счётчик количества лежат рядом, показывается один.
   Правило нужно явно — у .qty-ctl в стилях магазина стоит display:flex, а он
   сильнее атрибута hidden, и спрятанный счётчик всё равно был бы виден. */
.card-buy [hidden],
.buy-row [hidden] { display: none !important; }

/* Реквизиты продавца и документы должны быть доступны и на телефоне (#20, раздел 9). */
@media (max-width: 640px) {
  .footer { display: block; margin-top: 32px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; padding-top: 28px; padding-bottom: 20px; }
  .footer .container { padding-left: 16px; padding-right: 16px; }
  .footer-col { min-width: 0; overflow-wrap: anywhere; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* Строка объявления над шапкой (#20, раздел 6): цвет акцента или кнопок магазина,
   покупатель закрывает её на сутки. */
.announce { display: flex; font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.announce[hidden] { display: none; }
.announce.is-accent { background: var(--accent-fill, var(--accent)); color: var(--accent-ink); }
.announce.is-button { background: var(--btn-bg); color: var(--btn-fg); }
.announce-inner { position: relative; display: flex; align-items: center; justify-content: center; min-height: 36px; padding-top: 8px; padding-bottom: 8px; }
.announce-text { min-width: 0; padding: 0 40px; text-align: center; overflow-wrap: anywhere; }
a.announce-text { text-decoration: underline; text-underline-offset: 3px; }
.announce-close { position: absolute; right: 32px; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; color: inherit; opacity: .75; }
.announce-close:hover { opacity: 1; }

/* Телефон магазина в шапке — если магазин его показывает */
.header-phone { flex: none; font-weight: 700; font-size: 15px; white-space: nowrap; color: inherit; }
.has-topbanner.tb-dark .header-phone { color: #fff; }

/* Логотип по центру: строка «телефон | логотип | действия», поиск — второй строкой */
@media (min-width: 641px) {
  .header.logo-center .header-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; row-gap: 12px; }
  .header.logo-center .logo { grid-column: 2; grid-row: 1; }
  .header.logo-center .header-phone { grid-column: 1; grid-row: 1; justify-self: start; }
  .header.logo-center .header-actions { grid-column: 3; grid-row: 1; justify-self: end; margin-left: 0; }
  .header.logo-center .search-area { grid-column: 1 / -1; grid-row: 2; }
}

/* Высоту объявления учитывает сама шапка, в том числе при переносах и закрытии. */
@media (max-width: 640px) {
  .announce-inner { padding: 6px 12px; }
  .announce-text { padding: 0 40px 0 0; text-align: left; }
  .announce-close { right: 12px; }
  .header-phone { display: none; }
}

/* Карточки и списки (#20, раздел 8): настройки магазина, одни на все списки */
@media (min-width: 1025px) {
  .cards-grid-3 .grid { grid-template-columns: repeat(3, 1fr); }
}
.cards-ratio-square .card-img { aspect-ratio: 1 / 1; }
.cards-ratio-4-3 .card-img { aspect-ratio: 4 / 3; }
.cards-ratio-square .card-img .p-photo-none,
.cards-ratio-4-3 .card-img .p-photo-none { aspect-ratio: auto; height: 100%; }
/* «Вписывается на светлом фоне»: фото целиком, поля — светлые */
.cards-fit-contain .card-img .p-photo { object-fit: contain; background: var(--white); }

/* Страница товара: галерея сверху во всю ширину, описание и покупка — под ней */
@media (min-width: 1025px) {
  .product-gallery-top .product-layout { grid-template-columns: minmax(0, 1.15fr) minmax(300px, 1fr); }
  .product-gallery-top .product-layout > .gallery { grid-column: 1 / -1; }
  .product-gallery-top .gallery-main { aspect-ratio: 16 / 9; }
  .product-gallery-top .g-slide .p-photo { object-fit: contain; }
}

/* Характеристики на странице вместо шторки */
.spec-inline .sd-body { max-width: 760px; }
