/* ==========================================================================
   AGASTA — DARK EDITORIAL
   Тёмный графит, бордовый акцент, крупная типографика.
   Сетка каталога: строго 2 карточки в ряд на мобильном экране.
   ========================================================================== */

:root {
  --bg:        #0a0a0b;
  --bg-soft:   #101012;
  --surface:   #16161a;
  --line:      #26262c;
  --text:      #f2f0ee;
  --muted:     #8b8b93;
  --accent:    #7d1128;
  --accent-hi: #a8173a;
  --radius:    2px;
  --pad:       16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------------------------------------------------------------- Верх ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(10, 10, 11, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px var(--pad) 12px;
}

.logo {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
}

.topbar__tag {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-hi);
}

/* ----------------------------------------------------------- Демо-метка --- */

.demo-badge {
  position: sticky;
  top: 0;
  z-index: 29;
  padding: 7px var(--pad);
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
}

/* ---------------------------------------------------------- Категории ----- */

.catbar {
  position: sticky;
  top: 49px;
  z-index: 28;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.catbar__inner {
  display: flex;
  gap: 8px;
  padding: 11px var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.catbar__inner::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color .18s, border-color .18s, background .18s;
}

.chip.is-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

/* ------------------------------------------------------------ Контент ----- */

.wrap {
  padding: var(--pad);
  min-height: 55vh;
}

.grid {
  display: grid;
  /* СТРОГО 2 карточки в ряд на мобильном */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 8px;
}

.card {
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.card__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s ease, opacity .3s ease;
}

.card:active .card__photo { transform: scale(1.04); }

.card__ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3a3a42;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card__name {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin: 0;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__price {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--accent-hi);
}

/* ------------------------------------------------------------ Состояния --- */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 64px 20px;
  text-align: center;
}

.state__spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--line);
  border-top-color: var(--accent-hi);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.state__spinner[hidden] { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.state__text {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.btn {
  padding: 11px 22px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 100px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ----------------------------------------------------- Карточка товара ---- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  overflow: hidden;
}

.sheet__scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(10, 10, 11, 0.75);
  backdrop-filter: blur(8px);
  font-size: 20px;
  line-height: 1;
  color: var(--text);
}

.sheet__media {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.sheet__photo { width: 100%; height: 100%; object-fit: cover; }

.sheet__body { padding: 20px var(--pad) 56px; }

.sheet__cat {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-hi);
  margin-bottom: 8px;
}

.sheet__name {
  margin: 0 0 12px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.12;
}

.sheet__price {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}

.sheet__desc {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.6;
  color: #c9c7c4;
  white-space: pre-line;
}

.attrs {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--line);
}

.attr {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

.attr__k {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding-top: 3px;
}

.attr__v { text-align: right; }

/* -------------------------------------------------------------- Подвал ---- */

.foot {
  padding: 34px var(--pad) 40px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #34343a;
}

/* ------------------------------------------------- Планшет и десктоп ------ */

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .wrap, .topbar__inner, .catbar__inner { padding-left: 22px; padding-right: 22px; }
  .sheet__body { max-width: 560px; margin: 0 auto; }
}

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