/* ====== КАТАЛОГ СТРАНИЦА ====== */

.catalog-page {
  padding-block-start: calc(var(--section-padding) + 80px);
  padding-block-end: var(--section-padding);
  background-color: var(--white);
}

.catalog-head {
  display: grid;
  gap: 2rem;
  margin-bottom: 2rem;
}

/* хлебные крошки */
.breadcrumbs-mini {
  font-size: 1.3rem;
  color: var(--spanish-gray);
  display: flex;
  flex-wrap: wrap;
  line-height: 1.4;
  letter-spacing: 0.03em;
}
.breadcrumbs-mini a {
  color: var(--granite-gray);
  transition: var(--transition-1);
}
.breadcrumbs-mini a:hover {
  color: var(--tan-crayola);
}
.breadcrumbs-mini span.divider {
  margin-inline: 8px;
  color: var(--light-gray);
}

/* заголовок и описание */
.catalog-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.catalog-title {
  font-size: clamp(2.2rem, 1vw + 2rem, 2.8rem);
  font-weight: var(--fw-500);
  color: var(--smokey-black);
  line-height: 1.3;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1rem;
}

.catalog-subtext {
  font-size: 1.4rem;
  color: var(--granite-gray);
  max-width: 60ch;
  line-height: 1.5;
}

/* панель фильтров */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: flex-start;
  justify-content: flex-start;
  background-color: #fff;
  border: 1px solid hsl(0 0% 90%);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.04);
}

/* чипы фильтров */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-btn {
  --chip-bg: var(--white);
  --chip-color: var(--smokey-black);
  --chip-border: var(--light-gray);

  background: var(--chip-bg);
  color: var(--chip-color);
  border: 1px solid var(--chip-border);
  padding: 8px 14px 9px;
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1.2;
  font-weight: 500;
  transition: var(--transition-1);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
}

.filter-btn .dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background-color: var(--tan-crayola);
  opacity: 0;
  transition: var(--transition-1);
}

.filter-btn.active,
.filter-btn:hover,
.filter-btn:focus {
  --chip-bg: var(--tan-crayola);
  --chip-color: var(--white);
  --chip-border: var(--tan-crayola);
  box-shadow: 0 10px 20px rgba(238, 91, 33, 0.2);
}

.filter-btn.active .dot,
.filter-btn:hover .dot {
  opacity: 1;
  background-color: var(--white);
}

/* ====== СЕТКА ТОВАРОВ ====== */

.product-grid {
  margin-top: 2rem;
}

.product-grid-list {
  display: grid;
  gap: 2rem;
}

/* адаптивные колонки */
@media (min-width: 480px) {
  .product-grid-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 768px) {
  .product-grid-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1200px) {
  .product-grid-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ====== КАРТОЧКА ====== */

.product-card {
  position: relative;
  border-radius: 14px;
  background: var(--white);
  border: 1px solid hsl(0 0% 92%);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  transition:
    box-shadow var(--transition-2),
    transform var(--transition-2);
  overflow: hidden;
}

.product-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.product-media-wrapper {
  position: relative;
  background-color: var(--light-gray);
  overflow: hidden;
  aspect-ratio: 1 / 1;
}

.product-media-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-2);
}

.product-card:hover .product-media-wrapper img {
  transform: scale(1.05);
}

/* кнопка лупы */
.quick-preview-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background-color: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  color: var(--smokey-black);
  transition: var(--transition-1);
}

.quick-preview-btn:hover {
  background-color: var(--tan-crayola);
  color: var(--white);
  box-shadow: 0 14px 24px rgba(238, 91, 33, 0.3);
}

/* текстовая часть карточки */
.card-info {
  padding: 1.4rem 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  text-align: left;
}

.card-title {
  font-size: 1.5rem;
  line-height: 1.4;
  font-weight: 500;
  color: var(--smokey-black);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  transition: var(--transition-1);
}

.product-card:hover .card-title {
  color: var(--tan-crayola);
}

.card-meta-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.card-price {
  font-size: 1.4rem;
  line-height: 1.4;
  color: var(--granite-gray);
  font-weight: 500;
}

/* бейдж категории */
.card-category-badge {
  font-size: 1.2rem;
  line-height: 1.2;
  font-weight: 500;
  color: var(--white);
  background-color: var(--tan-crayola);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0.03em;
  box-shadow: 0 8px 16px rgba(238, 91, 33, 0.25);
}

/* нет результатов */
.empty-state {
  text-align: center;
  color: var(--granite-gray);
  margin-top: 4rem;
  font-size: 1.5rem;
  line-height: 1.5;
}

/* === MODAL DETAIL INFO === */

.modal-dialog {
  /* уже есть базовые стили у тебя, мы просто уточним грид */
  display: grid;
  grid-template-rows: auto auto;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  max-width: min(900px, 90vw);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

.modal-description {
  font-size: 1.4rem;
  line-height: 1.7;
  color: #555;
}
.modal-description p { margin: 0.4em 0; }
.modal-description strong, .modal-description b { font-weight: 700; }
.modal-description em, .modal-description i { font-style: italic; }

.card-price-sold { color: #c0392b !important; font-weight: 700; }

.modal-info {
  background: #fff;
  border-top: 1px solid #eee;
  padding: 1.6rem 2rem;

  display: grid;
  grid-template-columns: 1fr auto;
  align-items: flex-start;
  column-gap: 2rem;
  row-gap: 1.6rem;
  overflow-y: auto;
  max-height: calc(90vh - 320px);
}

/* мобильный вид: в столбик */
@media (max-width: 600px) {
  .modal-info {
    grid-template-columns: 1fr;
  }
}

.modal-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.modal-main .title {
  font-size: 2rem;
  font-weight: 600;
  color: #222;
  line-height: 1.4;
}

.modal-main .material {
  font-size: 1.5rem;
  line-height: 1.4;
  color: #666;
  margin-top: 0.4rem;
}

.modal-main .category {
  display: inline-block;
  font-size: 1.3rem;
  line-height: 1.2;
  font-weight: 500;
  color: var(--white);
  background-color: var(--tan-crayola);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  box-shadow: 0 8px 16px rgba(238, 91, 33, 0.25);
  margin-top: 0.6rem;
  align-self: flex-start;
}

.modal-main .price {
  font-size: 1.6rem;
  font-weight: 600;
  color: #444;
  line-height: 1.4;
  margin-top: 0.5rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: baseline;
  font-size: 1.3rem;
  line-height: 1.4;
}

.faq-link {
  font-size: 1.3rem;
  line-height: 1.4;
  color: #e67e22;
  font-weight: 500;
  text-decoration: none;
}
.faq-link:hover {
  text-decoration: underline;
}

.modal-order-box {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.05);

  font-size: 1.3rem;
  line-height: 1.4;
  color: #222;
  min-width: 240px;
  max-width: 260px;
}

@media (max-width: 600px) {
  .modal-order-box {
    max-width: 100%;
    min-width: 0;
  }
}

.order-text {
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: #222;
}

.order-contacts {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.order-contact-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  color: #333;
  text-decoration: none;
  transition: color 0.2s ease;
  word-break: break-word;
}
.order-contact-link i {
  font-size: 1.4rem;
  color: #e67e22;
}
.order-contact-link:hover {
  color: #e67e22;
}

.payment-hint {
  font-size: 1.2rem;
  color: #777;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.03);
}

/* адаптив заголовка */
@media (min-width: 992px) {
  .catalog-head {
    margin-bottom: 3rem;
  }

  .catalog-title-wrap {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 1rem;
  }
}

/* === MODAL VISIBILITY & LAYERING === */

.modal[aria-hidden="true"] {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal[aria-hidden="false"] {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 1;
  pointer-events: all;
}

/* фоновой клик-закрывашка */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 0;
  cursor: pointer;
}

/* само белое окно */
.modal-dialog {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  width: min(900px, 90vw);
  max-width: min(900px, 90vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

/* кнопка закрытия */
.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 2;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  line-height: 30px;
  font-size: 1.6rem;
  text-align: center;
  cursor: pointer;
  color: var(--smokey-black);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* верхняя часть слайдера */
.modal-body {
  background: #fff;
  color: #000;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  min-height: 500px;
}

/* Контейнер для фото/видео */
.gallery-viewport {
  position: relative;
  width: 500px;
  height: 500px;
  background: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  overflow: hidden;
}

.gallery-counter {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.2rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

.gallery-counter:empty {
  display: none;
}

/* Фото и видео отображаются естественно */
.gallery-viewport img,
.gallery-viewport video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: opacity 0.4s ease;
}

.gallery-viewport img.fade-out,
.gallery-viewport video.fade-out {
  opacity: 0;
}

/* стрелки листания */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Левая и правая позиция */
#modal-prev {
  left: 2rem;
}
#modal-next {
  right: 2rem;
}

@media (max-width: 768px) {
  .gallery-viewport {
    width: 400px;
    height: 400px;
  }

  .modal-body {
    padding: 2rem;
    min-height: 400px;
  }
}

@media (max-width: 500px) {
  .gallery-viewport {
    width: 300px;
    height: 300px;
  }

  .modal-body {
    padding: 1.5rem;
    min-height: 300px;
  }

  .nav-btn {
    width: 36px;
    height: 36px;
    font-size: 1.6rem;
  }

  #modal-prev {
    left: 1rem;
  }

  #modal-next {
    right: 1rem;
  }
}
