/*
  Оформление сайта We Sell в «кристаллическом» стиле:
  срезанные углы как у гранёного камня, холодные светлые тона и радужные блики.
  Основные цвета, шрифты и размер срезов собраны вверху в :root.
*/

:root {
  --bg: #f1f4f8;
  --surface: #ffffff;
  --ink: #0f1724;
  --muted: #5b6474;
  --line: #d9e0ea;
  --track: #e6ebf2;
  --accent: #2346c8;
  --accent-hover: #1a369f;
  --focus: #9cc4ff;
  --prism: linear-gradient(90deg, #79c6ff 0%, #8d9cff 38%, #c99bff 62%, #ff9fc6 82%, #ffc98a 100%);
  --cut: 14px;
  --font-display: "Exo 2", "Segoe UI", sans-serif;
  --font-body: "Golos Text", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* text-wrap: pretty не даёт оставлять в конце абзаца одно короткое слово на отдельной строке */
p {
  margin: 0;
  text-wrap: pretty;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.wrap {
  width: min(1320px, 100% - 32px);
  margin-inline: auto;
}

/* Срезанные углы (слева сверху и справа снизу), как у гранёного камня.
   Размер среза задаёт --cut у каждого элемента. */
.btn,
.card,
.card__term,
.logo__mark,
.feed,
.feed__avatar,
.post,
.post__reaction,
.modal,
.modal__img,
.modal__close {
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

/* ---------- Кнопки ---------- */

.btn {
  --cut: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 17px 28px;
  border: 0;
  font: 600 14px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

/* Обычная рамка фокуса обрезается срезанными углами, поэтому рисуем её внутри кнопки */
.btn:focus-visible,
.modal__close:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--focus);
}

.btn:active {
  transform: translateY(1px);
}

.btn--accent {
  background: var(--accent);
  color: #fff;
}

.btn--accent:hover {
  background: var(--accent-hover);
}

.btn--dark {
  background: var(--ink);
  color: #fff;
}

.btn--dark:hover {
  background: var(--accent);
}

/* ---------- Шапка ---------- */

.header {
  padding: 22px 0;
}

.header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 600 21px/1 var(--font-display);
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.logo__mark {
  --cut: 7px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--ink);
  color: #fff;
}

.logo__mark img {
  display: block;
  width: 22px;
  height: 22px;
}

.header__nav {
  display: flex;
  gap: 28px;
}

.header__link {
  font: 500 13px/1 var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 0;
  border-bottom: 1px solid var(--ink);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.header__link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Приветственный блок ---------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  padding: 40px 0 104px;
}

/* Фон из светлых «лучей», как свет, преломлённый в кристалле */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: conic-gradient(from 190deg at 74% 44%,
    #e7edf6 0deg 18deg, #f5f8fb 18deg 44deg, #e1e9f4 44deg 70deg, #f1f5f9 70deg 101deg,
    #e8eff7 101deg 128deg, #f6f8fb 128deg 160deg, #e3eaf4 160deg 196deg, #f2f5f9 196deg 230deg,
    #e9eff7 230deg 262deg, #f6f8fb 262deg 300deg, #e5ecf5 300deg 334deg, #f3f6fa 334deg 360deg);
  -webkit-mask-image: radial-gradient(ellipse 62% 78% at 74% 44%, #000 25%, transparent 80%);
  mask-image: radial-gradient(ellipse 62% 78% at 74% 44%, #000 25%, transparent 80%);
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 48px;
}

.hero__content > * {
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.hero__content > :nth-child(2) { animation-delay: 70ms; }
.hero__content > :nth-child(3) { animation-delay: 140ms; }
.hero__content > :nth-child(4) { animation-delay: 210ms; }

.hero__title {
  margin: 0 0 22px;
  font: 600 clamp(36px, 4.6vw, 62px)/1.04 var(--font-display);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

/* «Целый месяц.» всегда с новой строки */
.hero__title em {
  display: block;
  font-style: normal;
  color: var(--accent);
}

/* balance делит абзац на строки примерно одинаковой длины, без короткого хвоста в конце */
.hero__text {
  max-width: 50ch;
  margin-bottom: 34px;
  text-wrap: balance;
  font-size: 18px;
  color: var(--muted);
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.hero__facts li {
  padding: 18px 28px 0 0;
  margin-right: 28px;
  border-right: 1px solid var(--line);
}

.hero__facts li:last-child {
  margin-right: 0;
  border-right: 0;
}

.hero__facts b {
  display: block;
  font: 600 22px/1.1 var(--font-display);
}

.hero__facts span {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Пример ленты канала ---------- */

/* Тень рисуем на обёртке: у самой ленты срезанные углы, и тень на ней обрезалась бы */
.hero__visual {
  position: relative;
  justify-self: end;
  width: min(100%, 420px);
  filter: drop-shadow(0 28px 40px rgba(15, 23, 36, 0.14));
  animation: rise 0.9s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.feed {
  --cut: 22px;
  position: relative;
  background: var(--surface);
}

/* Радужная полоска по верху ленты */
.feed::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--prism);
}

.feed__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.feed__avatar {
  --cut: 8px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: #fff;
}

.feed__avatar img {
  display: block;
  width: 24px;
  height: 24px;
}

.feed__name {
  font: 600 16px/1.2 var(--font-display);
}

.feed__meta {
  font-size: 13px;
  color: var(--muted);
}

/* Лента прокручена вниз, как в Telegram: новые посты внизу, верхний уходит под шапку */
.feed__list {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  height: 450px;
  overflow: hidden;
  padding: 14px 14px 18px;
  background: #e9eff7;
}

/* Плавное затухание верхнего поста под шапкой */
.feed__list::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  height: 36px;
  background: linear-gradient(#e9eff7, rgba(233, 239, 247, 0));
}

.post {
  --cut: 10px;
  position: relative;
  flex: none;
  padding: 12px 14px 10px;
  background: var(--surface);
}

/* Новый пост отмечен радужной полоской слева */
.post--new::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #79c6ff, #c99bff, #ff9fc6);
}

/* Картинка поста во всю ширину, как в Telegram */
.post__image {
  display: block;
  width: calc(100% + 28px);
  height: 104px;
  margin: -12px -14px 10px;
}

.post__tag {
  display: inline-block;
  margin-bottom: 6px;
  font: 600 10px/1 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.post__title {
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.post__text {
  font-size: 13px;
  line-height: 1.4;
  text-wrap: balance;
}

.post__foot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* Реакции слева внизу поста, как в Telegram */
.post__reactions {
  display: flex;
  gap: 6px;
  margin-right: auto;
}

.post__reaction {
  --cut: 5px;
  padding: 4px 8px;
  background: #edf2fa;
  color: var(--accent);
  font: 600 12px/1 var(--font-display);
  white-space: nowrap;
}

.post__views {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 600 13px/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.post--new .post__views {
  color: var(--accent);
}

.post__views svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.post__num {
  min-width: 4.4ch;
  text-align: right;
}

/* Всплывающее «+N», когда на пост добавляются просмотры */
.post__plus {
  position: absolute;
  right: 46px;
  bottom: 100%;
  font: 600 12px/1 var(--font-display);
  color: var(--accent);
  pointer-events: none;
  animation: plus 1.1s ease-out forwards;
}

/* ---------- Каталог ---------- */

.catalog {
  padding: 8px 0 104px;
  scroll-margin-top: 16px;
}

.catalog__head,
.faq__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.catalog__title,
.faq__title {
  margin: 0;
  font: 600 clamp(26px, 3.2vw, 40px)/1.05 var(--font-display);
  letter-spacing: -0.01em;
}

.catalog__note,
.faq__note {
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

/* Сама карточка служит рамкой: по умолчанию серой, при наведении радужной */
.card {
  --cut: 18px;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  padding: 1px;
  background: var(--prism);
  transition: transform 0.25s ease;
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  animation-delay: calc(var(--i, 0) * 60ms + 200ms);
}

/* Порядковый номер карточки: по нему карточки появляются одна за другой */
.card:nth-child(2) { --i: 1; }
.card:nth-child(3) { --i: 2; }
.card:nth-child(4) { --i: 3; }
.card:nth-child(5) { --i: 4; }
.card:nth-child(6) { --i: 5; }
.card:nth-child(7) { --i: 6; }
.card:nth-child(8) { --i: 7; }
.card:nth-child(9) { --i: 8; }
.card:nth-child(10) { --i: 9; }

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--line);
  transition: opacity 0.3s ease;
}

/* Блик, пробегающий по карточке при наведении */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.5) 50%, transparent 62%);
  transform: translateX(-120%);
}

.card:hover {
  transform: translateY(-4px);
}

.card:hover::before {
  opacity: 0;
}

.card:hover::after {
  transform: translateX(120%);
  transition: transform 0.9s ease;
}

.card__media {
  position: relative;
  z-index: 1;
  background: #000;
  clip-path: polygon(calc(var(--cut) - 0.6px) 0, 100% 0, 100% 100%, 0 100%, 0 calc(var(--cut) - 0.6px));
}

.card__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.card__term {
  --cut: 6px;
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: 600 11px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card__body {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: var(--surface);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut) + 0.6px), calc(100% - var(--cut) + 0.6px) 100%, 0 100%);
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 18px;
}

/* Заголовок карточки: крупное число и подпись под ним */
.card__title {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.card__number {
  font: 600 42px/1 var(--font-display);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Номер карточки в правом верхнем углу, не отнимает место у заголовка */
.card__index {
  position: absolute;
  top: 22px;
  right: 18px;
  font: 500 12px/1 var(--font-display);
  letter-spacing: 0.1em;
  color: var(--muted);
}

.card__label {
  margin-top: 8px;
  font: 400 14px/1.35 var(--font-body);
  color: var(--muted);
}

/* Радужная полоска показывает размер пакета относительно самого большого */
.card__meter {
  height: 4px;
  margin-top: auto;
  margin-bottom: 18px;
  background: var(--track);
}

.card__fill {
  display: block;
  height: 100%;
  background: var(--prism);
  clip-path: inset(0 calc(100% - var(--fill, 100%)) 0 0);
  animation: fill 1s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  animation-delay: calc(var(--i, 0) * 60ms + 500ms);
}

.card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.card__price {
  font: 600 24px/1 var(--font-display);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.card__more {
  padding: 6px 0;
  border: 0;
  background: none;
  font: 500 14px/1.2 var(--font-body);
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.card__more:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

.card__buy {
  width: 100%;
  padding: 15px 16px;
}

/* ---------- Окно «Подробнее» ---------- */

/* Пока окно открыто, страница под ним не прокручивается */
body:has(.modal[open]) {
  overflow: hidden;
}

.modal {
  --cut: 22px;
  width: min(660px, 100% - 32px);
  max-height: min(88vh, 860px);
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
}

.modal[open] {
  display: flex;
  flex-direction: column;
  animation: pop 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.modal::backdrop {
  background: rgba(15, 23, 36, 0.5);
  backdrop-filter: blur(4px);
}

.modal__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid var(--line);
}

/* Радужная полоска по верху окна */
.modal__head::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--prism);
}

.modal__img {
  --cut: 10px;
  flex: none;
  width: 72px;
  height: 72px;
  object-fit: cover;
  background: #000;
}

.modal__title {
  margin: 0 0 6px;
  font: 600 26px/1.05 var(--font-display);
  letter-spacing: -0.01em;
}

.modal__sub {
  font-size: 14px;
  color: var(--muted);
}

.modal__close {
  --cut: 8px;
  flex: none;
  align-self: flex-start;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: var(--track);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.modal__close:hover {
  background: var(--line);
}

.modal__close svg {
  width: 20px;
  height: 20px;
}

.modal__body {
  overflow-y: auto;
  padding: 4px 20px;
}

.details {
  margin: 0;
  padding: 0;
  list-style: none;
}

.details li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.5;
}

.details li:last-child {
  border-bottom: 0;
}

.details p + p {
  margin-top: 2px;
}

.details b {
  font-weight: 600;
}

.details__icon {
  font-size: 18px;
  line-height: 1.35;
}

.modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}

.modal__price {
  font: 600 28px/1 var(--font-display);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ---------- Вопросы и ответы ---------- */

.faq {
  padding: 0 0 104px;
  scroll-margin-top: 16px;
}

.faq__list {
  max-width: 900px;
}

.faq__item {
  border-bottom: 1px solid var(--line);
}

/* Строка с вопросом: по нажатию открывает и закрывает ответ */
.faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  cursor: pointer;
  list-style: none;
}

.faq__question::-webkit-details-marker {
  display: none;
}

.faq__question h3 {
  margin: 0;
  font: 600 19px/1.3 var(--font-display);
  text-wrap: balance;
  transition: color 0.2s ease;
}

.faq__question:hover h3 {
  color: var(--accent);
}

/* Значок «+» справа, у открытого вопроса превращается в «−» */
.faq__question::after {
  --cut: 7px;
  content: "";
  flex: none;
  width: 34px;
  height: 34px;
  background:
    linear-gradient(var(--accent), var(--accent)) center / 14px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center / 2px 14px no-repeat,
    var(--track);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

.faq__item[open] .faq__question::after {
  background:
    linear-gradient(#fff, #fff) center / 14px 2px no-repeat,
    var(--accent);
}

.faq__answer {
  max-width: 72ch;
  padding: 0 50px 22px 0;
  color: var(--muted);
}

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

.footer {
  padding: 28px 0 36px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

.footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

/* ---------- Анимации ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes fill {
  from {
    clip-path: inset(0 100% 0 0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes plus {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-16px);
  }
}

/* ---------- Адаптация под разные экраны ---------- */

/* Большой экран: 5 карточек в ряд */
@media (min-width: 1240px) {
  .cards {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Средний экран: 2 карточки в ряд, картинка слева, текст справа */
@media (min-width: 640px) and (max-width: 1239px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .card {
    flex-direction: row;
  }

  .card__media {
    flex: 0 0 42%;
  }

  .card__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }
}

@media (max-width: 900px) {
  .hero {
    padding: 24px 0 88px;
  }

  .hero .wrap {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero__visual {
    justify-self: center;
  }
}

@media (max-width: 480px) {
  .hero__text {
    font-size: 16px;
  }

  .header__nav {
    gap: 18px;
  }

  .faq__question h3 {
    font-size: 17px;
  }

  .faq__answer {
    padding-right: 0;
  }

  /* Три факта в одну строку, подписи без переноса */
  .hero__facts {
    flex-wrap: nowrap;
  }

  .hero__facts li {
    padding-right: 12px;
    margin-right: 12px;
  }

  .hero__facts span {
    white-space: nowrap;
  }

  .hero__facts b {
    font-size: 18px;
  }

  .hero__facts span {
    font-size: 12px;
  }

  .modal__head {
    gap: 12px;
    padding: 20px 16px 16px;
  }

  .modal__img {
    width: 56px;
    height: 56px;
  }

  .modal__title {
    font-size: 21px;
  }

  .modal__body {
    padding: 4px 16px;
  }

  .modal__foot {
    padding: 14px 16px;
  }
}

/* Очень узкие телефоны: подписям фактов разрешаем перенос, чтобы ничего не обрезалось */
@media (max-width: 359px) {
  .hero__facts span {
    white-space: normal;
  }
}

/* Для тех, у кого в системе отключены анимации */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
