/* Фирменная палитра TRENDHUB (с логотипа) — одинаковая в светлой и тёмной теме Telegram */
:root {
  --cream: #FAF7EE;      /* фон логотипа */
  --paper: #FFFDF8;      /* карточки */
  --sand: #F1EBDD;       /* подложки, поля */
  --line: #E6DCC6;       /* тонкие линии */
  --green: #052D24;      /* изумрудный круг и надпись */
  --green-2: #0B3D30;    /* нажатия, наведение */
  --gold: #C5A665;       /* золото монограммы */
  --gold-ink: #8A6F38;   /* золото для мелкого текста (читаемее на креме) */
  --muted: #6E776F;
  --danger: #A8402F;
  --radius: 16px;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Montserrat", -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

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

body {
  margin: 0;
  padding: 0 16px 96px;
  background: var(--cream);
  color: var(--green);
  font: 400 14px/1.45 var(--sans);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

button { font: inherit; cursor: pointer; border: 0; color: inherit; }
.link { background: none; color: var(--green); padding: 0; font-weight: 500; }

h1, h2 { font-family: var(--serif); font-weight: 600; color: var(--green); }
h1 { font-size: 26px; line-height: 1.15; margin: 0; flex: 1; min-width: 0; }
h2 {
  font-size: 13px; margin: 24px 0 10px; font-family: var(--sans); font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink);
}

.top { display: flex; align-items: center; gap: 12px; padding: 16px 0 8px; }

/* Шапка витрины */
.brand-head { display: flex; align-items: center; gap: 10px; padding: 18px 0 14px; border-bottom: 1px solid var(--line); }
.emblem {
  width: 48px; height: 48px; flex: none; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 1px var(--gold), 0 2px 8px rgba(5, 45, 36, .18);
}
.brand { flex: 1; min-width: 0; }
.wordmark {
  font: 600 23px/1 var(--serif); letter-spacing: .2em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tagline {
  margin-top: 6px; font-size: 8.5px; line-height: 1.5; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold-ink); text-wrap: balance;
}

/* Связь с менеджером */
.support-chip {
  flex: none; padding: 7px 10px; border-radius: 999px;
  background: transparent; color: var(--green); font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--gold);
}
.support-chip:active { background: var(--sand); }
.support-card {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px;
  padding: 14px 16px; border-radius: var(--radius); text-align: left;
  background: var(--paper); border: 1px solid var(--line); color: var(--green);
}
.support-card > span:first-child {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--green); font-size: 17px;
}
.support-card b { font-weight: 600; }

/* Категории */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0; margin: 0 -16px; padding-inline: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 16px; border-radius: 999px;
  background: transparent; color: var(--green); font-size: 13px; font-weight: 500;
  border: 1px solid var(--line);
}
.chip.active { background: var(--green); border-color: var(--green); color: var(--cream); }

/* Карточки */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.grid > .muted { grid-column: 1 / -1; text-align: center; padding: 48px 16px; font-family: var(--serif); font-size: 19px; }
.card {
  position: relative; display: flex; flex-direction: column; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.thumb { aspect-ratio: 4 / 5; display: grid; place-items: center; font-size: 60px; background: var(--sand); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card-title { font: 600 17px/1.2 var(--serif); }
.card-sizes { font-size: 11px; letter-spacing: .06em; color: var(--muted); }
.price { font-weight: 600; margin-top: auto; padding-top: 6px; color: var(--green); }
.photo-badge {
  position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(5, 45, 36, .72); color: var(--cream); font-size: 11px;
}

.add-btn, .qty {
  margin-top: 8px; height: 36px; border-radius: 10px;
  background: var(--green); color: var(--cream); font-size: 13px; font-weight: 500;
}
.add-btn:active { background: var(--green-2); }
.add-btn.in-cart { background: transparent; color: var(--green); border: 1px solid var(--gold); font-weight: 600; }
.qty { display: flex; align-items: center; justify-content: space-between; overflow: hidden; }
.qty button { width: 40px; height: 100%; background: none; color: inherit; font-size: 18px; }
.qty span { font-weight: 600; }

/* Экран товара */
#product .top { padding-bottom: 4px; }
#product .top:has(.back-btn.hidden) { display: none; }
.gallery-wrap { position: relative; margin: 0 -16px; }
.gallery {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  aspect-ratio: 4 / 5; max-height: 62vh; background: var(--sand);
}
.gallery::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: grid; place-items: center; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.slide.emoji { font-size: 120px; }
.gallery-count {
  position: absolute; top: 12px; right: 12px; padding: 3px 10px; border-radius: 999px;
  background: rgba(5, 45, 36, .72); color: var(--cream); font-size: 12px; letter-spacing: .05em;
}
.dots { display: flex; justify-content: center; gap: 6px; padding: 12px 0 0; min-height: 20px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: all .2s; }
.dots span.active { width: 18px; border-radius: 3px; background: var(--gold); }

.product-info h1 { font-size: 28px; margin-top: 10px; }
.p-price { font-size: 20px; font-weight: 600; margin-top: 6px; }
.p-desc { white-space: pre-wrap; margin: 18px 0; line-height: 1.6; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.size {
  position: relative; min-width: 50px; height: 44px; padding: 0 12px; border-radius: 10px;
  background: var(--paper); color: var(--green); font-weight: 500; border: 1px solid var(--line);
}
.size.active { background: var(--green); border-color: var(--green); color: var(--cream); }
.size i {
  position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--gold); color: var(--green);
  font: 700 11px/18px var(--sans); font-style: normal;
}
.size-hint { color: var(--danger); margin: 10px 0 0; font-size: 13px; }
.p-qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.p-qty-row .qty { width: 120px; margin: 0; }

/* Корзина */
.cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.cart-thumb { flex: none; cursor: pointer; }
.cart-item .thumb { width: 56px; border-radius: 10px; font-size: 28px; overflow: hidden; }
.cart-item .info { flex: 1; min-width: 0; cursor: pointer; }
.cart-item .info div:first-child { font: 600 16px/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-size { font-size: 12px; }
.cart-item .qty { margin: 0; width: 104px; flex: none; }
.total-row {
  display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0;
  font: 600 20px var(--serif);
}

/* Форма */
.form label { display: block; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.form input, .form textarea {
  display: block; width: 100%; margin-top: 5px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--green); font: inherit; resize: vertical;
}
.form input::placeholder, .form textarea::placeholder { color: #A8AEA6; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197, 166, 101, .2); }
.error { color: var(--danger); }

/* Готово */
.done { text-align: center; padding-top: 20vh; }
.done .emblem { width: 96px; height: 96px; margin-bottom: 18px; }
.done h1 { font-size: 28px; }
.done p { max-width: 320px; margin: 12px auto; }

/* Кнопка для открытия вне Telegram (в браузере) */
.fallback {
  position: fixed; left: 16px; right: 16px; bottom: 16px; height: 50px;
  border-radius: 12px; background: var(--green); color: var(--cream); font-weight: 600; letter-spacing: .02em;
}
