/* Шаблон basic сайту-магазину: мобільна верстка насамперед — одна колонка до 640 px, сітка 2–4 колонки ширше.
   Колір теми — змінна --primary у <style> сторінки; шрифт — системний. */
:root { --primary: #1f6feb; --text: #1b1f24; --muted: #57606a; --line: #d0d7de; --bg: #f6f8fa; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Колонка на всю висоту вікна: футер короткої сторінки — внизу екрана, а не посередині. */
body {
  margin: 0; color: var(--text); background: #fff; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px;
}
a { color: var(--primary); }
img { max-width: 100%; height: auto; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.125rem; margin: 1.5rem 0 0.75rem; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
/* Однаковий верхній відступ вмісту на кожній сторінці — з крихтами чи без. */
main.wrap { flex: 1 0 auto; padding-top: 24px; }
main > section:first-child > h2:first-child { margin-top: 0; }

.top { border-bottom: 1px solid var(--line); background: #fff; }
.top-row { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; font-size: 1.25rem; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.search { display: flex; gap: 8px; min-width: 0; }
.search input {
  flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 8px;
}
.search button, .pager a, .btn {
  min-height: 44px; padding: 8px 16px; font: inherit; font-weight: 600; color: #fff; background: var(--primary);
  border: 0; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
}

.crumbs { margin: 0 0 16px; font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.crumbs a { color: var(--muted); }

.cats { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cats a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--text); text-decoration: none; overflow-wrap: anywhere;
}

.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
.card {
  display: grid; grid-template-columns: 96px 1fr; grid-template-rows: auto auto 1fr; column-gap: 12px;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0;
}
.card a { display: contents; color: var(--text); text-decoration: none; }
.card img, .card .noimg {
  grid-row: 1 / 4; width: 96px; height: 96px; object-fit: contain; background: var(--bg); border-radius: 8px;
}
.card .noimg { display: block; }
.card-title { font-weight: 600; overflow-wrap: anywhere; }
.price { font-weight: 700; font-size: 1.125rem; white-space: nowrap; }
.badge { font-size: 0.875rem; }
.badge-in { color: #1a7f37; }
.badge-low { color: #9a6700; }
.badge-out { color: var(--muted); }
.empty { color: var(--muted); }

.pager { display: flex; justify-content: space-between; gap: 12px; margin: 24px 0; }

.product { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.product-img { width: 100%; max-width: 560px; object-fit: contain; background: var(--bg); border-radius: 12px; }
.product-info { min-width: 0; overflow-wrap: anywhere; }
.product .price { font-size: 1.5rem; margin: 0; }
.sku { color: var(--muted); font-size: 0.875rem; }
.text { max-width: 760px; overflow-wrap: anywhere; }

.error { padding: 48px 0; text-align: center; }

.foot { margin-top: 48px; border-top: 1px solid var(--line); background: var(--bg); font-size: 0.875rem; }
.foot-grid { display: flex; flex-direction: column; gap: 16px; padding-top: 24px; overflow-wrap: anywhere; }
.foot p { margin: 0 0 4px; }
.foot a { display: inline-block; padding: 4px 0; }
.foot-links { list-style: none; padding: 0; margin: 0; }
.foot .powered { color: var(--muted); margin: 0 auto; padding-top: 16px; padding-bottom: 24px; }

@media (min-width: 640px) {
  .top-row { flex-direction: row; align-items: center; justify-content: space-between; }
  .search { width: 420px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .card { display: flex; flex-direction: column; gap: 6px; }
  .card a { display: flex; flex-direction: column; gap: 6px; }
  .card img, .card .noimg { width: 100%; height: auto; aspect-ratio: 1 / 1; }
  .product { flex-direction: row; align-items: flex-start; }
  .product-img { width: 50%; }
  .foot-grid { flex-direction: row; justify-content: space-between; }
}
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
