
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: sans-serif;
  background: #f9f9f9;
  color: #333;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: #c00;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

/* ===== CONTAINER ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== HEADER ===== */
.main-header {
  background-color: #d62828;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.main-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
}

.logo {
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}

/* ===== NAVIGATION ===== */
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.main-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  transition: color 0.2s;
}

.main-nav a:hover {
  color: #ffc300;
}

/* ===== СІТКА ТОВАРІВ ===== */
.product-grid {
  display: grid;
  /* minmax(0, 1fr) гарантує, що довгі слова не розірвуть екран на телефоні */
  grid-template-columns: repeat(2, minmax(0, 1fr)); 
  gap: 12px;
  margin-top: 24px;
  padding: 0;
}

/* ===== ПОСИЛАННЯ (Обгортка картки) ===== */
.product-link {
  text-decoration: none;
  color: inherit;
  display: flex; 
  height: 100%;
  width: 100%;
}

/* ===== КАРТКА ТОВАРУ (Непробивна структура Grid) ===== */
.product-card {
  width: 100%;
  min-width: 0; /* Додатковий захист від розширення картки через довгий текст */
  height: 100%;
  
  /* Ділимо картку на 3 жорсткі поверхи: 1-картинка, 2-текст, 3-ціна */
  display: grid;
  grid-template-rows: auto 1fr auto; 
  gap: 12px; /* Відстань між елементами всередині картки */
  
  background: white;
  border-left: 4px solid #d50000;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: center;
  transition: transform 0.2s ease;
}

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

/* ===== КАРТИНКА ===== */
.product-card .img-wrap {
  width: 100%;
  height: 140px; /* Фіксуємо висоту блоку з картинкою */
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ===== ЗАГОЛОВОК ТОВАРУ ===== */
.product-card h3 {
  font-size: 0.85rem;
  line-height: 1.3;
  color: #111;
  margin: 0; 
  
  /* Центруємо текст зверху вниз */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  
  /* Дозволяємо перенесення дуже довгих слів (як "напівсинтетична") */
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

.price-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  margin: 0;
  padding-top: 8px;
  gap: 6px;
}

.volume {
  background-color: rgba(0,0,0,0.05);
  padding: 4px 6px;
  border-radius: 4px;
  font-weight: 500;
  color: #333;
  font-size: 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.price {
  font-weight: bold;
  color: #d50000;
  font-size: 0.9rem;
  line-height: 1.2;
  text-align: right;
}

.map {
  margin: 40px auto;
  text-align: center;
}

.map-container {
  width: 100%;
  max-width: 1000px;
  margin: auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

footer {
  background: #222;
  color: #ccc;
  text-align: center;
  padding: 20px 16px;
  margin-top: 40px;
  font-size: 0.9rem;
}

@media (min-width: 540px) {
  .product-card {
    padding: 16px;
  }
  
  .product-card .img-wrap {
    height: 180px;
  }

  .product-card h3 {
    font-size: 1rem;
  }

  .volume {
    font-size: 0.85rem;
    padding: 4px 8px;
  }

  .price {
    font-size: 1.1rem;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 0 24px;
  }

  .logo {
    font-size: 28px;
  }

  .main-nav ul {
    gap: 24px;
  }

  .main-nav a {
    font-size: 16px;
  }

  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 30px;
  }

  .product-card {
    padding: 20px;
    gap: 16px;
    border-left-width: 5px;
  }

  .product-card h3 {
    font-size: 1.1rem;
  }
}

@media (min-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}