:root {
  --color-bg: #f4f5f7;
  --color-surface: #ffffff;
  --color-text: #1c1f26;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-primary: #d64545;
  --color-primary-dark: #b83636;
  --color-success: #1a8f4c;
  --color-danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --header-h: 64px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header__row {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 18px;
}

.brand img { height: 36px; width: 36px; border-radius: 6px; object-fit: cover; }

.main-nav { display: flex; gap: 18px; flex-shrink: 0; }
.main-nav a { color: var(--color-text-muted); font-weight: 500; }
.main-nav a:hover { color: var(--color-primary); }

.search-form {
  flex: 1;
  display: flex;
  max-width: 480px;
  margin-left: auto;
}

.search-form input {
  flex: 1;
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 10px 14px;
  font-size: 14px;
}

.search-form button {
  border: none;
  background: var(--color-primary);
  color: #fff;
  padding: 0 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  font-weight: 600;
}
.search-form button:hover { background: var(--color-primary-dark); }

.header-phone {
  flex-shrink: 0;
  font-weight: 700;
  white-space: nowrap;
}

.burger {
  display: none;
  border: none;
  background: none;
  font-size: 24px;
  cursor: pointer;
}

/* ── Hero ── */
.hero {
  padding: 40px 0;
  text-align: center;
}
.hero h1 { font-size: 30px; margin: 0 0 10px; }
.hero p { color: var(--color-text-muted); max-width: 640px; margin: 0 auto; }

/* ── Sections ── */
.section { padding: 32px 0; }
.section__title {
  font-size: 22px;
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section__title a { font-size: 14px; color: var(--color-primary); font-weight: 600; }

/* ── Category grid ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.category-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  font-weight: 600;
  transition: transform 0.15s, box-shadow 0.15s;
}
.category-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

/* ── Product grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
}
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.product-card__img {
  aspect-ratio: 4 / 3;
  background: #eef0f3 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 13px;
}

.product-card__body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card__name { font-weight: 600; font-size: 14px; min-height: 40px; }
.product-card__meta { font-size: 12px; color: var(--color-text-muted); }
.product-card__price { font-size: 18px; font-weight: 700; margin-top: auto; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  width: fit-content;
}
.badge--in-stock { background: #e5f6ec; color: var(--color-success); }
.badge--out-of-stock { background: #fdecea; color: var(--color-danger); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
}
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dark); }
.btn--secondary { background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text); }
.btn--secondary:hover { background: var(--color-bg); }
.btn--tg { background: #26a5e4; color: #fff; }
.btn--vk { background: #0077ff; color: #fff; }
.btn--block { width: 100%; }

.contact-buttons { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── Floating contact widget ── */
.floating-contacts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 60;
}
.floating-contacts a {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  box-shadow: var(--shadow);
}

/* ── Contacts section ── */
.contacts-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.contacts-card__item dt { font-size: 12px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.contacts-card__item dd { margin: 4px 0 0; font-weight: 600; font-size: 16px; }

/* ── Footer ── */
.site-footer {
  background: #16181d;
  color: #c9ccd3;
  padding: 32px 0;
  margin-top: 40px;
  font-size: 14px;
}
.site-footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}
.footer-bottom {
  border-top: 1px solid #2a2d34;
  margin-top: 20px;
  padding-top: 16px;
  color: #7a7f8a;
  font-size: 13px;
}

/* ── Catalog layout ── */
.catalog-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

.filters {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
.filters h3 { font-size: 15px; margin: 0 0 14px; }
.filter-group { margin-bottom: 16px; }
.filter-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.filter-group select,
.filter-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
}
.price-range { display: flex; gap: 8px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
.checkbox-row input { width: auto; }

.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.catalog-toolbar select { padding: 8px 10px; border-radius: 6px; border: 1px solid var(--color-border); }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pagination button {
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 6px;
  cursor: pointer;
}
.pagination button.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--color-text-muted); }

/* ── Product page ── */
.product-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: start;
}
.gallery__main {
  aspect-ratio: 4/3;
  background: #eef0f3 center/cover no-repeat;
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.gallery__thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery__thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
}
.gallery__thumbs img.active { border-color: var(--color-primary); }

.product-info h1 { font-size: 24px; margin: 0 0 8px; }
.product-info .price { font-size: 30px; font-weight: 800; margin: 12px 0; }
.spec-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.spec-table td { padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.spec-table td:first-child { color: var(--color-text-muted); width: 45%; }

.breadcrumbs { font-size: 13px; color: var(--color-text-muted); margin: 16px 0; }
.breadcrumbs a:hover { color: var(--color-primary); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
}
.modal h2 { margin: 0 0 16px; font-size: 20px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-close { position: absolute; top: 16px; right: 20px; background: none; border: none; font-size: 22px; cursor: pointer; }
.modal { position: relative; }
.form-success { color: var(--color-success); font-weight: 600; }
.form-error { color: var(--color-danger); font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .product-page { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main-nav { display: none; }
  .header-phone { display: none; }
  .search-form { max-width: none; margin-left: 0; }
  .site-header__row { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #14161b;
    --color-surface: #1c1f26;
    --color-text: #eceef1;
    --color-text-muted: #9aa0ac;
    --color-border: #2a2d34;
  }
  .product-card__img { background-color: #262a33; }
  .site-footer { background: #0d0e11; }
}
