/* =====================================================================
   Стили витрины. Сделано под телефон: колонка до 640px по центру,
   на компьютере выглядит как мобильная страница (как у Take App).
   --brand и --page-bg приходят из настроек магазина.
   ===================================================================== */
:root { --brand: #c03e37; --page-bg: #fff7f6; --text: #1d1d1f; --muted: #7a7a7f; --line: #ececec; }
* { box-sizing: border-box; }
body.shop {
  margin: 0; background: #f2f2f2; color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.page { max-width: 640px; min-height: 100vh; margin: 0 auto; background: var(--page-bg); padding-bottom: 40px; }

/* ---- Шапка магазина ---- */
.hero { position: relative; }
.hero-cover { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.hero-cover.ph { background: linear-gradient(135deg, var(--brand), #333); }
.hero-logo {
  position: absolute; left: 50%; bottom: -44px; transform: translateX(-50%);
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--page-bg); background: #fff;
}
.store-head { text-align: center; padding: 52px 16px 8px; }
.store-head h1 { margin: 0 0 8px; font-size: 26px; }
.pill { display: inline-block; padding: 3px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: 13px; }
.tagline { margin: 8px 0 0; }
.socials { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.socials a { font-size: 13px; padding: 4px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); }

/* ---- Иконки категорий ---- */
.cat-icons {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 12px 8px;
  padding: 16px;
}
.cat-icons a { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: 12px; line-height: 1.2; }
.cat-icons img, .cat-icons .ph {
  width: 60px; height: 60px; border-radius: 16px; object-fit: cover; margin-bottom: 6px; background: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}

/* ---- Разделы ---- */
.section { padding: 8px 16px; scroll-margin-top: 8px; }
.section h2 { font-size: 20px; margin: 16px 0 10px; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }

/* Сетка товаров: 2 колонки на телефоне, 3 на широком */
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 560px) { .pgrid { grid-template-columns: 1fr 1fr 1fr; } }
.pcard { display: flex; flex-direction: column; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.pimg { position: relative; display: block; aspect-ratio: 1; background: #f6f6f6; }
.pimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pimg .ph { display: flex; height: 100%; align-items: center; justify-content: center; font-size: 32px; }
.pbody { display: flex; flex-direction: column; gap: 4px; padding: 10px; }
.pname { font-size: 14px; font-weight: 500; line-height: 1.3; }
.pprice { font-weight: 700; color: var(--brand); }
.pprice s { color: var(--muted); font-weight: 400; margin-left: 4px; }
.pcard.soldout .pimg img { filter: grayscale(.8); opacity: .6; }
.tag-sold {
  position: absolute; left: 8px; top: 8px; padding: 2px 10px; border-radius: 99px;
  background: #1d1d1f; color: #fff; font-style: normal; font-size: 12px;
}
.tag-sold.inline { position: static; display: inline-block; margin-bottom: 8px; }

/* Список товаров: фото слева, текст справа */
.plist { display: flex; flex-direction: column; gap: 10px; }
.plist .pcard { flex-direction: row; }
.plist .pimg { width: 96px; flex-shrink: 0; }
.plist .pbody { justify-content: center; }

/* ---- Карточка товара ---- */
.back { display: inline-block; padding: 12px 16px; color: var(--muted); }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: 0 0 100%; width: 100%; aspect-ratio: 1; object-fit: cover; scroll-snap-align: start; }
.pdetail { padding: 16px; }
.pdetail h1 { margin: 0 0 6px; font-size: 22px; }
.pprice.big { font-size: 20px; margin-bottom: 12px; }
.desc { white-space: pre-line; margin: 12px 0; }
.block { background: #fff; border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.block h3 { margin: 0 0 8px; font-size: 15px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.line:first-of-type { border-top: 0; }
.line.soldout { color: var(--muted); text-decoration: line-through; }
.btn-buy {
  width: 100%; margin-top: 12px; padding: 14px; border: 0; border-radius: 12px;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; font-size: 16px;
}
.btn-buy:disabled { opacity: .5; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 0; }

/* ---- Общая страница магазинов ---- */
.dir { padding: 16px; }
.dir-title { font-size: 26px; margin: 8px 0 16px; }
.dir-card { display: block; background: #fff; border-radius: 16px; overflow: hidden; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.dir-cover { display: block; width: 100%; aspect-ratio: 2.4; object-fit: cover; }
.dir-cover.ph { background: linear-gradient(135deg, var(--c, #c03e37), #333); }
.dir-body { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.dir-body span { display: flex; flex-direction: column; }
.dir-body small { color: var(--muted); }
.dir-logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }

/* ---- Ошибки ---- */
.error-page { text-align: center; padding: 80px 16px; }
.error-code { font-size: 64px; font-weight: 800; color: var(--muted); }
.error-page a { color: var(--brand); }
