/* ============================================================
   CHERTOVSKI — правки витрины (главная, карточка, корзина, оформление).
   Подключается после site.css / home.css. Ничего в старых файлах
   не ломает: если удалить этот файл, сайт вернётся к прежнему виду.
   ============================================================ */

/* ---------- Кнопки ---------- */
.button-solid { background: var(--white); color: var(--ink); border-color: var(--white); }
.button-solid:hover { background: var(--wine); border-color: var(--wine); color: var(--white); }

/* ---------- ГЛАВНАЯ: обложка ---------- */
.hx { position: relative; isolation: isolate; display: grid; align-items: end; min-height: calc(100svh - var(--header-h)); max-height: 1000px; overflow: hidden; background: #120d0d; color: var(--white); }
.hx-photos { position: absolute; inset: 0; z-index: -2; display: grid; grid-template-columns: repeat(3, 1fr); }
.hx-photos img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.hx::after { content: ""; position: absolute; inset: 0; z-index: -1; background:
  linear-gradient(180deg, rgb(15 8 8 / .18) 0%, rgb(15 8 8 / 0) 30%, rgb(15 8 8 / .35) 62%, rgb(15 8 8 / .86) 100%); }
.hx-copy { width: calc(100% - 2 * var(--gutter)); margin-inline: auto; padding: 8rem 0 clamp(2.4rem, 5.5vw, 5rem); text-align: center; }
.hx-copy .eyebrow { color: #f3e6de; letter-spacing: .28em; font-size: clamp(.66rem, .9vw, .8rem); }
.hx h1 { margin: .5rem 0 0; font: 400 clamp(3rem, 12vw, 12.5rem)/.92 var(--serif); letter-spacing: .06em; text-shadow: 0 4px 40px rgb(0 0 0 / .35); }
.hx-tag { margin-top: clamp(.7rem, 1.4vw, 1.2rem); font: italic clamp(1.05rem, 1.7vw, 1.5rem)/1.35 var(--serif); color: #f6ece6; }
.hx-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: clamp(1.4rem, 2.6vw, 2.2rem); }
.hx-actions .button { min-width: 230px; }
.hx-dots { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .hx-photos img { animation: hx-in 1.6s cubic-bezier(.2,.65,.25,1) both; }
  .hx-photos img:nth-child(2) { animation-delay: .12s; }
  .hx-photos img:nth-child(3) { animation-delay: .24s; }
  .hx-copy > * { animation: hx-up .9s cubic-bezier(.2,.65,.25,1) both; }
  .hx-copy > :nth-child(2) { animation-delay: .25s; }
  .hx-copy > :nth-child(3) { animation-delay: .45s; }
  .hx-copy > :nth-child(4) { animation-delay: .6s; }
  @keyframes hx-in { from { opacity: 0; transform: scale(1.08); } to { opacity: 1; transform: none; } }
  @keyframes hx-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
}

/* Телефон: одна фотография на весь экран, три образа сменяют друг друга */
@media (max-width: 760px) {
  .hx { min-height: calc(100svh - var(--header-h)); max-height: none; }
  .hx-photos { display: block; }
  .hx-photos img { position: absolute; inset: 0; object-position: 50% 15%; }
  .hx-photos img:nth-child(n+2) { opacity: 0; }
  .hx-copy { padding-top: 6rem; padding-bottom: 3.2rem; }
  .hx h1 { font-size: clamp(2.3rem, 12.4vw, 4.4rem); letter-spacing: .04em; white-space: nowrap; }
  .hx-actions { flex-direction: column; align-items: stretch; gap: .6rem; }
  .hx-actions .button { min-width: 0; justify-content: center; gap: .6rem; }
  .hx-dots { position: absolute; left: 50%; bottom: 1.2rem; transform: translateX(-50%); display: flex; gap: 6px; }
  .hx-dots i { width: 22px; height: 2px; background: rgb(255 255 255 / .35); overflow: hidden; position: relative; }
  .hx-dots i::after { content: ""; position: absolute; inset: 0; background: #fff; transform: scaleX(0); transform-origin: left; }
  @media (prefers-reduced-motion: no-preference) {
    .hx-photos img { animation: hx-fade 15s infinite both !important; opacity: 0; }
    .hx-photos img:nth-child(1) { animation-delay: 0s !important; }
    .hx-photos img:nth-child(2) { animation-delay: 5s !important; }
    .hx-photos img:nth-child(3) { animation-delay: 10s !important; }
    @keyframes hx-fade { 0% { opacity: 0; transform: scale(1.1); } 4% { opacity: 1; } 33% { opacity: 1; } 38% { opacity: 0; transform: scale(1); } 100% { opacity: 0; } }
    .hx-dots i::after { animation: hx-bar 15s linear infinite; }
    .hx-dots i:nth-child(2)::after { animation-delay: 5s; }
    .hx-dots i:nth-child(3)::after { animation-delay: 10s; }
    @keyframes hx-bar { 0% { transform: scaleX(0); } 33.3% { transform: scaleX(1); } 33.4%, 100% { transform: scaleX(0); } }
  }
  @media (prefers-reduced-motion: reduce) { .hx-photos img:nth-child(1) { opacity: 1; } }
}

/* ---------- Бегущая строка ---------- */
.ticker { overflow: hidden; background: var(--wine); color: #fbeee8; border-block: 1px solid var(--wine-deep); }
.ticker-run { display: flex; width: max-content; }
.ticker span { padding: .85rem 1.6rem; font-size: .7rem; font-weight: 650; letter-spacing: .2em; text-transform: uppercase; white-space: nowrap; }
.ticker span::after { content: "✦"; margin-left: 3.2rem; opacity: .6; }
@media (prefers-reduced-motion: no-preference) {
  .ticker-run { animation: tick 32s linear infinite; }
  @keyframes tick { to { transform: translateX(-50%); } }
}

/* ---------- Категории плитками ---------- */
.cats-sec { padding-top: clamp(20px, 3vw, 40px); }
.cats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(8px, 1.2vw, 18px); }
.cat-tile { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--tint); color: #fff; }
.cat-tile img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; transition: transform .7s cubic-bezier(.2,.65,.25,1); }
.cat-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgb(15 8 8 / .7)); }
.cat-tile span { position: absolute; z-index: 1; left: 0; right: 0; bottom: .9rem; text-align: center; font: clamp(1.05rem, 1.5vw, 1.35rem)/1.15 var(--serif); letter-spacing: .02em; }
.cat-tile:hover img { transform: scale(1.05); }
@media (max-width: 1000px) { .cats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .cats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cat-tile { aspect-ratio: 4 / 5; }
}

/* ---------- Новинки: обычная сетка (2 в ряд на телефоне, 4 на компьютере) ---------- */
.arrivals { padding-block: clamp(48px, 7vw, 110px); }
.arrivals .new-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.arrivals .product-copy { text-align: left; }
@media (max-width: 1000px) { .arrivals .new-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .arrivals .new-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 10px; }
  .arrivals .product-title { font-size: .98rem; }
}

/* ---------- Пошив по меркам ---------- */
.tailor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: #191313; color: #f7eee9; }
.tailor > img { width: 100%; height: 100%; min-height: 520px; max-height: 860px; object-fit: cover; object-position: 50% 20%; }
.tailor-copy { display: grid; align-content: center; justify-items: start; gap: 1.4rem; padding: clamp(40px, 7vw, 110px); }
.tailor-copy .eyebrow { color: #d9a9a0; }
.tailor-copy h2 { font: 400 clamp(2.1rem, 4vw, 3.8rem)/1.05 var(--serif); }
.steps { list-style: none; margin: .4rem 0; padding: 0; display: grid; gap: 1.1rem; counter-reset: st; }
.steps li { position: relative; display: grid; gap: .15rem; padding-left: 3.3rem; counter-increment: st; }
.steps li::before { content: counter(st); position: absolute; left: 0; top: -.15rem; width: 2.3rem; height: 2.3rem; display: grid; place-items: center; border: 1px solid rgb(255 255 255 / .35); border-radius: 50%; font: 1.05rem var(--serif); }
.steps b { font-weight: 600; font-size: 1.02rem; }
.steps span { color: #cbbab3; font-size: .92rem; line-height: 1.5; }
@media (max-width: 760px) {
  .tailor { grid-template-columns: 1fr; }
  .tailor > img { min-height: 0; aspect-ratio: 4 / 5; height: auto; }
  .tailor-copy { padding: 40px var(--gutter) 48px; }
  .tailor-copy .button { width: 100%; justify-content: center; gap: .6rem; }
}

/* ---------- Карточка товара: размеры кнопками ---------- */
.size-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .35rem 0 .2rem; }
.size-chip { min-width: 3.2rem; min-height: 46px; padding: .5rem .9rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; letter-spacing: .04em; }
.size-chip:hover { border-color: var(--ink); }
.size-chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.size-chip.is-out { color: #b3a7a1; text-decoration: line-through; }
.size-chips.is-wanted .size-chip { border-color: var(--wine); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.size-pick-label { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: .9rem; }
.size-pick-label b { font-weight: 650; }
.size-pick-label .size-need { color: var(--wine); font-size: .85rem; }
.variant-row.has-chips .field:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.variant-row.has-chips { grid-template-columns: 1fr; }
.variant-row.has-chips .quantity-field { display: none; }

/* Пустое описание не показываем */
.product-details.is-empty { display: none; }

/* После добавления — сразу предложить оформить */
.added-box { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }
.added-box .button { justify-content: center; gap: .5rem; min-height: 48px; }
.added-box p { grid-column: 1 / -1; font-size: .9rem; color: var(--wine); font-weight: 600; }

/* Телефон: кнопка «В корзину» всегда под пальцем */
.buy-bar { display: none; }
@media (max-width: 760px) {
  .buy-bar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: flex; gap: .75rem; align-items: center; padding: .65rem var(--gutter) calc(.65rem + env(safe-area-inset-bottom)); background: rgb(247 243 238 / .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); transform: translateY(110%); transition: transform .3s ease; }
  .buy-bar.is-on { transform: none; }
  .buy-bar .bb-info { min-width: 0; flex: 1; line-height: 1.25; }
  .buy-bar .bb-name { display: block; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .buy-bar .bb-price { font-weight: 650; }
  .buy-bar .button { min-height: 48px; padding: .7rem 1.1rem; gap: .5rem; white-space: nowrap; }
  body.has-buy-bar .site-footer { padding-bottom: 76px; }
}

/* ---------- Оформление ---------- */
.mix-warn { margin: 0 0 1rem; padding: .9rem 1rem; border: 1px solid var(--wine); background: #fbf1ef; color: var(--wine-deep); font-size: .92rem; line-height: 1.5; }
.measure-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .75rem; }
.measure-help { display: inline-block; margin: .1rem 0 .6rem; font-size: .86rem; color: var(--wine); border-bottom: 1px solid; }
@media (max-width: 640px) {
  .commerce-page .commerce-panel { padding: 0; border: 0; background: transparent; }
  .commerce-page .fieldset { padding: .9rem .9rem 1rem; }
}

/* Пока размер не выбран — не пишем «в наличии» */
form.chips-waiting [data-mode-note][data-state="ok"], form.chips-waiting [data-mode-note][data-state="none"] { visibility: hidden; height: 0; margin: 0; }
/* Модели только под пошив */
.mode-card.is-off { opacity: .45; pointer-events: none; }
/* Корзина: «Удалить» — тихой ссылкой, а не огромной кнопкой */
.cart-row > .button { min-height: 0; padding: .3rem 0; border: 0; background: none; color: var(--muted); font-size: .85rem; text-decoration: underline; width: auto !important; justify-content: flex-start; }
.cart-row > .button:hover { color: var(--wine); }
@media (max-width: 420px) { .added-box { grid-template-columns: 1fr; } }
.added-box .button { white-space: nowrap; }

/* A single CMS hero photo fills the banner without blank slideshow intervals. */
.hx-photos--single { grid-template-columns: minmax(0, 1fr); }
.hx-photos--single img { animation: none !important; opacity: 1; }
.hx--long h1 { font-size: clamp(2rem, 6.2vw, 6rem); white-space: normal; }
.variant-row.has-chips .quantity-field { display: grid; max-width: 100px; }
.cart-row > .button { min-height: 44px; }
@media (prefers-reduced-motion: reduce) {
  .size-chips.is-wanted .size-chip { animation: none; }
}

/* Всё шьём по меркам */
.tailor-info { margin: 0 0 .9rem; padding: .8rem 1rem; background: var(--tint); border-left: 3px solid var(--wine); font-size: .92rem; line-height: 1.5; }

/* Блок «Ваши мерки для пошива» (как в макете) */
.measure-box { border: 1px solid var(--ink) !important; background: var(--surface); }
.measure-box > legend { font: 1.15rem var(--serif); letter-spacing: .06em; text-transform: uppercase; padding: 0 .6rem; }
.measure-intro { color: var(--muted); font-size: .92rem; line-height: 1.55; margin: .2rem 0 .8rem; }
.measure-grid { gap: .2rem 1rem; }
.measure-grid .field { font-weight: 600; font-size: .92rem; }
.cm-wrap { position: relative; display: block; margin-top: .3rem; }
.cm-wrap input { width: 100%; padding-right: 2.6rem; }
.cm-wrap .cm { position: absolute; right: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 400; font-size: .9rem; pointer-events: none; }
.measure-hint { display: block; margin-top: .25rem; color: var(--muted); font-weight: 400; font-size: .76rem; }
.measure-box textarea { width: 100%; margin-top: .3rem; }
.measure-box .measure-help { margin-top: .6rem; color: var(--ink); font-size: .86rem; }
.measure-box .measure-help { display: inline-block; width: auto; }
.measure-box .field > span:first-child { font-weight: 400; }

/* Обложка с фирменным логотипом */
.hx-seal { display: block; width: clamp(64px, 7vw, 104px); height: auto; margin: 0 auto clamp(.8rem, 1.6vw, 1.4rem); filter: drop-shadow(0 2px 14px rgb(0 0 0 / .35)); }
.hx-logo { margin: 0 0 clamp(.6rem, 1.2vw, 1rem) !important; line-height: 0; }
.hx-logo img { display: block; width: min(76vw, 860px); height: auto; margin-inline: auto; filter: drop-shadow(0 3px 24px rgb(0 0 0 / .35)); }
@media (max-width: 760px) { .hx-logo img { width: 84vw; } .hx-seal { width: 62px; } }
/* Блок пошива — фирменный тёмно-синий */
.tailor { background: var(--navy, #1A273D); }
.tailor-copy .eyebrow { color: #d9c7b0; }
.steps span { color: #c4cad6; }
