/* CATALOG */
.catalog{
  padding:40px 10%;
}

/* TOP BAR */
.catalog-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:60px;
  flex-wrap:wrap;
  gap:20px;
}

/* CATEGORIES */
.categories{
  display:flex;
  gap:15px;
}

.categories button{
  padding:10px 20px;
  background:transparent;
  border:1px solid #ffffff33;
  color:#fff;
  border-radius:20px;
  cursor:pointer;
  transition:0.3s;
}

.categories button:hover{
  background:#ffffff1a;
}

.categories .active{
  background:#fff;
  color:#000;
}

/* SORT */
.sort{
  display:flex;
  flex-direction:column;
  font-size:12px;
  opacity:.7;
}

.sort select{
  margin-top:5px;
  background:#000;
  border:1px solid #ffffff33;
  color:#fff;
  padding:8px 10px;
}

/* GRID */
.catalog-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(260px, 320px));
  justify-content:center; /* важно */
  gap:30px;
}

/* CARD */
.card{
  background:linear-gradient(180deg, #ffffff0d, #000000cc);
  border-radius:20px;
  overflow:hidden;
  transition:0.4s;
  border:1px solid #ffffff1a;
  width:100%;
  max-width:320px;
  margin:0 auto;
}

.card:hover{
  transform:translateY(-10px);
}

/* IMAGE */
.card-img{
  position:relative;
  width:100%;
  aspect-ratio:5 / 6; /* вот ключ */
  background:#111;
}

.card-img img{
  width:100%;
  height:100%;
  object-fit:cover; /* чтобы красиво заполняло */
  transition: opacity 0.3s ease;
}

.card-img img.front{
  display: inline;
}
.card:hover .card-img img.front{
  display: none;
}

.card-img img.back{
  display: none;
}

.card:hover .card-img img.back{
  display: inline;
}


/* BADGE */
.badge{
  position:absolute;
  top:15px;
  left:15px;
  background:#000000;
  color:#ffffff;
  font-size:12px;
  padding:5px 10px;
  border-radius:10px;
  transition:0.2s;
  opacity: 0;
}

.card:hover .badge{
  opacity: 1;
}

/* BODY */
.card-body{
  padding:20px;
}

.category{
  font-size:12px;
  opacity:.5;
  margin-bottom:5px;
}

.card-body h3{
  font-size:16px;
  margin-bottom:15px;
}

/* PRICE */
.price{
  display:flex;
  gap:10px;
  align-items:center;
  margin-bottom:20px;
}

.current{
  font-size:18px;
}

.old{
  text-decoration:line-through;
  opacity:.5;
  font-size:14px;
}

/* BUTTON */
.card button,
.card .btn-open{
  width:100%;
  padding:12px;
  background:transparent;
  border:1px solid #ffffff33;
  color:#fff;
  cursor:pointer;
  transition:0.3s;
  border-radius:10px;
  display:block;
  text-align:center;
  text-decoration:none;
  font-size:14px;
  font-weight:500;
}

.card button:hover,
.card .btn-open:hover{
  background:#fff;
  color:#000;
}

/* ===== MOBILE RESPONSIVE ===== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .catalog {
        padding: 30px 5%;
    }

    .catalog-top {
        margin-bottom: 40px;
    }

    .categories {
        gap: 10px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }

    .categories button {
        padding: 8px 15px;
        font-size: 13px;
        white-space: nowrap;
    }

    .catalog-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 280px));
        gap: 20px;
    }

    .card {
        max-width: 100%;
    }
}

/* Mobile (max-width 767px) */
@media (max-width: 767px) {
    .catalog {
        padding: 20px 4%;
    }

    .catalog-top {
        margin-bottom: 30px;
        flex-direction: column;
        gap: 10px;
    }

    .categories {
        width: 100%;
        gap: 8px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
    }

    .categories button {
        padding: 7px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    .sort {
        font-size: 11px;
    }

    .sort select {
        font-size: 12px;
        padding: 6px 8px;
    }

    .catalog-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }

    .card {
        max-width: 100%;
    }

    .card-img {
        aspect-ratio: 5 / 6;
    }

    .card:hover {
        transform: translateY(-5px);
    }

    .badge {
        top: 10px;
        left: 10px;
        font-size: 10px;
        padding: 4px 8px;
    }

    .card-body {
        padding: 12px;
    }

    .category {
        font-size: 10px;
        margin-bottom: 3px;
    }

    .card-body h3 {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .card button,
    .card .btn-open {
        padding: 10px;
        font-size: 12px;
    }

    .price {
        font-size: 12px;
    }

    .current {
        font-size: 16px;
    }

    .old {
        font-size: 12px;
    }
}