/* LFO uplift v2 — слой поверх основной сборки.
   Подключён ТОЛЬКО к preview.html. Прод (index.html) не затронут.
   v2: зелёный убран — палитра остаётся чёрно-белой, как была.
       Добавлена типографика. Ничего не удаляет, только переопределяет. */

:root {
  --lfo-ease: cubic-bezier(.22, 1, .36, 1);
  --lfo-spring: cubic-bezier(.34, 1.42, .5, 1);
  --lfo-focus: #111;
}
:root[data-theme=dark] {
  --lfo-focus: #f4f4f4;
}

/* ==========================================================
   1. ТИПОГРАФИКА
   ========================================================== */

/* Цифры одной ширины: цены в каталоге встают в ровную колонку,
   и число не «дёргается» при смене количества в корзине. */
.price,
.product-card,
.pricing-row,
.summary-product,
.cart-item,
.quantity,
.order-items-short,
.delivery-summary,
.delivery-row,
.status-pill,
.micro,
.photo-count {
  font-variant-numeric: tabular-nums lining-nums;
}

/* Заголовки не оставляют одно висячее слово на последней строке.
   Браузер сам ищет более ровный перенос. */
h1, h2, h3,
.hero h1,
.section-heading,
.admin-heading,
.product-name,
.blog-card h3,
.eyebrow {
  text-wrap: balance;
}

/* Абзацы: убираем «сирот» в конце. Деградирует молча в старых браузерах. */
p,
.article-body p,
.rich-description p,
.story-copy p,
.media-edit-copy p {
  text-wrap: pretty;
}

/* Длинный текст блога: комфортная длина строки 66–70 знаков.
   Без этого на 1440px строка растягивается и читать тяжело. */
.article-body p,
.article-body li {
  max-width: 68ch;
}

/* Крупные заголовки: на больших кеглях межбуквенное нужно поджать,
   иначе набор выглядит рыхлым. Мелкий текст не трогаем. */
.hero h1,
.section-heading {
  letter-spacing: -.025em;
}

/* Дефисные переносы в узких колонках — длинные русские слова
   перестают рвать сетку на мобильном. */
@media (max-width: 520px) {
  .product-name,
  .article-body p,
  .rich-description p {
    hyphens: auto;
  }
}

/* ==========================================================
   2. Тактильность: наведение и нажатие
   ========================================================== */
.button {
  transition: background .22s var(--lfo-ease),
              transform .22s var(--lfo-ease),
              box-shadow .22s var(--lfo-ease);
}
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -10px rgba(17, 17, 17, .45);
}
.button:active {
  transform: translateY(0) scale(.985);
  box-shadow: none;
}

.icon-btn {
  transition: background .18s var(--lfo-ease), transform .18s var(--lfo-ease);
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }

/* Карточка товара: лёгкий подъём, фото чуть приближается.
   .product-image-link уже имеет overflow:hidden — фото не вылезет. */
.product-card { transition: transform .34s var(--lfo-ease); }
.product-card:hover { transform: translateY(-4px); }

.product-image-link { transition: box-shadow .34s var(--lfo-ease); }
.product-card:hover .product-image-link {
  box-shadow: 0 16px 34px -20px rgba(17, 17, 17, .38);
}

.product-image { transition: transform .55s var(--lfo-ease), filter .3s var(--lfo-ease); }
.product-card:hover .product-image { transform: scale(1.035); }

.product-open {
  border-radius: 9px;
  transition: transform .24s var(--lfo-spring), background .2s var(--lfo-ease);
}
.product-card:hover .product-open { transform: scale(1.08); }

/* Карточка блога: вместо brightness — честное приближение */
.blog-card-cover > img {
  transition: transform .55s var(--lfo-ease), filter .25s var(--lfo-ease);
}
.blog-card-cover:hover > img { transform: scale(1.04); }
.blog-card { transition: transform .34s var(--lfo-ease), border-color .34s var(--lfo-ease); }
.blog-card:hover { transform: translateY(-3px); }

.text-link {
  text-underline-offset: 3px;
  transition: text-decoration-color .18s var(--lfo-ease);
}

/* ==========================================================
   3. Видимый фокус с клавиатуры
   ========================================================== */
a:focus-visible,
button:focus-visible,
.button:focus-visible,
.icon-btn:focus-visible,
.text-link:focus-visible,
.product-image-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--lfo-focus);
  outline-offset: 3px;
}

/* ==========================================================
   4. Появление при прокрутке (классы ставит uplift-v1.js)
   Если скрипт не сработал — элементы просто видны.
   ========================================================== */
.u-rise {
  opacity: 0;
  transform: translateY(16px);
  will-change: opacity, transform;
}
.u-rise.u-in {
  opacity: 1;
  transform: none;
  transition: opacity .5s var(--lfo-ease), transform .6s var(--lfo-ease);
  transition-delay: var(--u-d, 0ms);
}

/* ==========================================================
   5. Тост «в корзине»: мягкий вход вместо резкого
   ========================================================== */
.toast {
  transform: translate(-50%, 26px) scale(.96);
  box-shadow: 0 20px 44px -20px rgba(0, 0, 0, .5);
  transition: opacity .3s var(--lfo-ease), transform .42s var(--lfo-spring);
}
.toast.visible { transform: translate(-50%, 0) scale(1); }

/* ==========================================================
   6. Починка плашек на фото (баг был и до этого слоя)
   У .photo-count / .product-open / .blog-card-arrow / .zoom-button
   фон задан жёстко белым, а цвет текста брался из var(--ink).
   В тёмной теме --ink светлый → белый текст на белой плашке = пусто.
   ========================================================== */
:root[data-theme=dark] .photo-count,
:root[data-theme=dark] .product-open,
:root[data-theme=dark] .blog-card-arrow,
:root[data-theme=dark] .zoom-button {
  color: #111;
}

/* ==========================================================
   7. Уважение к системной настройке «меньше движения»
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  .u-rise,
  .u-rise.u-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .button,
  .icon-btn,
  .product-card,
  .product-image,
  .product-open,
  .blog-card,
  .blog-card-cover > img,
  .toast {
    transition-duration: .01ms !important;
  }
  .button:hover,
  .icon-btn:hover,
  .product-card:hover,
  .blog-card:hover,
  .product-card:hover .product-image,
  .blog-card-cover:hover > img,
  .product-card:hover .product-open {
    transform: none !important;
  }
}
