/* ==============================
   home.css
   ============================== */

/* ------------- Поиск ------------- */
.search-form { display: flex; align-items: center; }
.search-input {
  width: 240px; padding: 0 16px; height: 44px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border: 1.5px solid var(--border); border-right: none;
  background: var(--offwhite); color: var(--black);
  font-size: 14px; outline: none; transition: all 0.2s;
}
.search-input::placeholder { color: var(--gray); }
.search-input:focus { border-color: var(--black); background: var(--white); }
.icon-btn {
  height: 44px; padding: 0 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border: 1.5px solid var(--black); background: var(--black);
  color: var(--white); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background 0.2s; white-space: nowrap;
}
.icon-btn:hover { background: var(--dark); }

/* ------------- Hero ------------- */
.hero {
  margin: 28px 0; border-radius: var(--radius-lg);
  background: var(--black); padding: 52px 48px;
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 18px;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -60px; right: -60px;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,0.04); pointer-events: none;
}
.hero h1 {
  margin: 0 0 10px; font-size: clamp(20px, 4vw, 20px);
  font-weight: 900; color: var(--white); line-height: 1.2;
}
.hero p { margin: 0; color: rgba(255,255,255,0.6); font-size: 16px; }

/* ------------- Фильтр брендов ------------- */
.brand-filter {
  display: flex; flex-wrap: wrap;
  align-items: center; gap: 8px; margin: 24px 0;
}
.brand-filter__label {
  padding: 8px 16px; border-radius: 999px;
  background: var(--black); color: var(--white);
  font-weight: 700; font-size: 13px;
  white-space: nowrap; flex-shrink: 0;
}
.brand-pill {
  display: inline-flex; align-items: center;
  padding: 7px 16px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--white);
  color: var(--black); font-size: 13px; font-weight: 500;
  text-decoration: none; transition: all 0.2s;
  white-space: nowrap; flex-shrink: 0;
}
.brand-pill:hover { border-color: var(--black); background: var(--offwhite); }
.brand-pill--active {
  background: var(--black); color: var(--white);
  border-color: var(--black); font-weight: 600;
}
.brand-pill--more,
.brand-pill--collapse {
  cursor: pointer; border: 1.5px solid var(--border);
  background: var(--white); color: var(--black);
  font-weight: 700; padding: 7px 14px;
  border-radius: 999px; flex-shrink: 0; transition: all 0.2s;
}
.brand-pill--more { font-size: 16px; letter-spacing: 2px; }
.brand-pill--collapse { font-size: 13px; }
.brand-pill--more:hover,
.brand-pill--collapse:hover { border-color: var(--black); background: var(--offwhite); }

/* ------------- Каталог ------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
  min-height: 400px;
}
.grid-title { margin: 24px 0 16px; font-size: 18px; font-weight: 700; color: var(--black); }

/* ------------- Карточка ------------- */
.card {
  display: flex;
  flex-direction: column;
  min-height: 400px;
  height: 100%;
  contain: layout style;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  transition: all 0.2s;
}
.card:hover {
  border-color: #d1d5db;
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.card-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: center;
  background: var(--offwhite);
  padding: 16px;
  display: block;
}
.card-body {
  padding: 16px; border-top: 1.5px solid var(--border);
  display: flex; flex-direction: column; gap: 10px; flex: 1;
}
.title {
  font-size: 15px; font-weight: 700; color: var(--black);
  line-height: 1.3; margin: 0; height: 2.6em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px; flex-wrap: nowrap;
}
.price-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.price { font-size: 20px; font-weight: 900; color: var(--black); white-space: nowrap; }
.product-options { margin-top: auto; }
.available-from { font-size: 13px; font-weight: 600; color: var(--gray); }

/* ------------- Badge ------------- */
.badge {
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  white-space: nowrap; flex-shrink: 0;
}
.badge--green { background: #ecfdf5; color: #166534; }
.badge--orange { background: #fff7ed; color: #92400e; }

/* ------------- Кнопка В корзину ------------- */
.add {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--black); background: var(--white);
  color: var(--black); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
  text-align: center; white-space: nowrap; overflow: hidden;
}
.add:hover { background: var(--black); color: var(--white); }
.add.added { background: var(--green); color: var(--white); border-color: var(--green); }

/* ------------- Счётчик мл ------------- */
.add-btn-wrap {
  display: flex; flex-direction: row;
  align-items: center; gap: 4px; margin-top: 4px; width: 100%;
}
.add-btn-wrap .ml-btn {
  background: var(--offwhite); border: 1.5px solid var(--black);
  color: var(--black); font-size: 16px; font-weight: 700;
  cursor: pointer; width: 36px; min-width: 36px; height: 40px;
  border-radius: var(--radius-sm); display: inline-flex;
  align-items: center; justify-content: center;
  transition: background 0.2s; flex-shrink: 0; padding: 0;
}
.add-btn-wrap .ml-btn:hover { background: var(--black); color: var(--white); }
.add-btn-wrap .add {
  flex: 1; height: 40px; white-space: nowrap; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 8px;
}
.ml-value { display: inline; min-width: 18px; text-align: center; }

/* ------------- Избранное ------------- */
.fav-btn {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,0.45); border: none; border-radius: 50%;
  width: 36px; height: 36px; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, background 0.2s; z-index: 10;
  backdrop-filter: blur(4px);
}
.fav-btn:hover { transform: scale(1.15); background: rgba(0,0,0,0.65); }

/* ------------- Акции ------------- */
.hero-sales-link {
  font-size: 26px; font-weight: 700; color: #ffffff;
  text-decoration: none; opacity: 0.9;
  transition: opacity 0.2s, transform 0.2s;
  display: flex; align-items: flex-start; gap: 8px; flex-shrink: 0;
}
.hero-sales-link:hover { opacity: 1; transform: translateY(-2px); }

/* ------------- Адаптив ------------- */
@media (max-width: 860px) {
  .hero { flex-direction: column; align-items: flex-start; padding: 32px 24px; gap: 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
}

@media (max-width: 520px) {
  .row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .add-btn-wrap { width: 100%; display: flex; flex-wrap: wrap; gap: 4px; }
  .ml-minus, .ml-plus, .ml-value { order: 1; }
  .add { order: 2; width: 100%; font-size: 12px; padding: 6px 4px; text-align: center; white-space: nowrap; }
  .ml-btn { width: 28px; height: 28px; font-size: 14px; padding: 0; flex-shrink: 0; }
  .card { width: 100%; }
  .card-body { width: 100%; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}
