/* ===========================================================================
   Витрина koreyaglow.

   ДИЗАЙН РАССЧИТАН НА ДЕСЯТКИ ТОВАРОВ, А НЕ НА ТЫСЯЧИ. Сорок позиций
   в вёрстке гипермаркета выглядят пустой полкой, поэтому: крупные карточки,
   много воздуха, три колонки максимум. Каждая позиция подана как выбор,
   а не как строка прайса.

   ДВЕ ТЕМЫ. Светлая — база: оттенок и текстура средства часть товара,
   на светлом фоне они читаются как в жизни. Тёмная — полноценная, а не
   инверсия: у неё свои акценты, иначе розовый на чёрном выглядит ядовитым.
   Обе задаются одними и теми же переменными, поэтому правка цвета
   не разъезжается между темами.

   БЕЗ СБОРКИ И БЕЗ CDN. Ни Tailwind, ни шрифтов со стороны: каждый внешний
   запрос — это задержка отрисовки, а скорость здесь часть поисковой
   стратегии, а не украшение.
   =========================================================================== */

:root {
  --bg:        #fbfaf9;
  --surface:   #ffffff;
  --surface-2: #f4f1ef;
  --line:      #e8e3df;
  --text:      #201c1a;
  --muted:     #7a726d;
  --accent:    #c8617a;   /* приглушённый розово-коралловый: женственно, но не сладко */
  --accent-ink:#ffffff;
  --accent-sf: #fdf2f5;
  --ok:        #3f7d55;
  --warn:      #b8791f;
  --danger:    #b3392f;
  --shadow:    0 1px 2px rgba(32,28,26,.05), 0 8px 24px rgba(32,28,26,.06);
  --radius:    14px;
  --radius-s:  9px;
}

:root[data-theme="dark"] {
  --bg:        #14110f;
  --surface:   #211c19;
  --surface-2: #241f1c;
  --line:      #3a322d;
  --text:      #f0eae6;
  --muted:     #a0938c;
  /* Светлее и менее насыщенный, чем в светлой теме: тот же розовый
     на тёмном фоне читается кислотным. */
  --accent:    #e58aa2;
  --accent-ink:#1a1210;
  --accent-sf: #2a1d21;
  --ok:        #6fbf8b;
  --warn:      #e0a850;
  --danger:    #e0736a;
  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  /* Плавный переход только по цвету: анимировать всё подряд на телефоне
     значит получить дёрганый скролл. */
  transition: background-color .2s ease, color .2s ease;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); letter-spacing: -.01em; }
p { margin: 0 0 1em; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* --- Шапка ---------------------------------------------------------------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.head-inner {
  display: flex; align-items: center; gap: 20px;
  height: 66px;
}
.logo {
  font-size: 1.25rem; font-weight: 700; letter-spacing: -.03em;
  white-space: nowrap;
}
.logo span { color: var(--accent); }

.search { flex: 1; max-width: 460px; position: relative; }
.search input {
  width: 100%; height: 42px; padding: 0 44px 0 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: .95rem;
}
.search input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-sf);
}
.search button {
  position: absolute; right: 5px; top: 5px;
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.search button:hover { color: var(--accent); }

.head-nav { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.head-nav > a { font-size: .95rem; }
.theme-toggle {
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer; padding: 6px; display: grid; place-items: center;
  border-radius: 8px;
}
.theme-toggle:hover { color: var(--accent); background: var(--surface-2); }
:root[data-theme="light"] .i-moon,
:root[data-theme="dark"]  .i-sun { display: none; }

.cart-link { position: relative; display: grid; place-items: center; }
.badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; font-size: .7rem; font-weight: 700;
  display: grid; place-items: center;
}

/* --- Кнопки --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border: 0; border-radius: var(--radius-s);
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; font-size: .95rem;
  cursor: pointer; transition: filter .15s ease, transform .05s ease;
}
.btn:hover { filter: brightness(1.06); color: var(--accent-ink); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn.wide { width: 100%; }
.btn.sm { height: 36px; padding: 0 14px; font-size: .875rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* --- Карточка товара в сетке ---------------------------------------------- */
.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-img {
  aspect-ratio: 1; background: var(--surface-2);
  position: relative; overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .noimg {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: var(--muted); font-size: .8rem;
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card-brand { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em;
              color: var(--muted); margin-bottom: 4px; }
.card-name { font-weight: 600; font-size: .97rem; line-height: 1.35; margin-bottom: 6px; }
.card-vol { font-size: .8rem; color: var(--muted); }
.card-foot { margin-top: auto; padding-top: 12px;
             display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.price .old { font-weight: 400; font-size: .85rem; color: var(--muted);
              text-decoration: line-through; margin-left: 6px; }

/* Метка разбора. Не «бейдж на всё», а тихий признак: товары без разбора
   не должны выглядеть ущербными — их большинство и будет большинство. */
.tag-review {
  position: absolute; left: 10px; top: 10px;
  background: var(--accent); color: var(--accent-ink);
  font-size: .7rem; font-weight: 700; letter-spacing: .02em;
  padding: 4px 9px; border-radius: 999px;
}
.stock { font-size: .78rem; }
.stock.in { color: var(--ok); }
.stock.order { color: var(--muted); }
.stock.out { color: var(--muted); }

/* --- Каталог -------------------------------------------------------------- */
.catalog { display: grid; grid-template-columns: 260px 1fr; gap: 34px; align-items: start; }
.filters {
  position: sticky; top: 86px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.filters h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em;
              color: var(--muted); margin: 18px 0 8px; }
.filters h4:first-child { margin-top: 0; }
.filters a, .filters label {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 5px 0; font-size: .9rem; cursor: pointer;
}
.filters a.on { color: var(--accent); font-weight: 600; }
.filters .cnt { color: var(--muted); font-size: .8rem; }
.chip.filters-toggle { display: none; }

.toolbar { display: flex; align-items: center; justify-content: space-between;
           gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: .85rem;
  border: 1px solid var(--line); background: var(--surface);
}
.chip.on { background: var(--accent-sf); border-color: var(--accent); color: var(--accent); }
select, input[type=text], input[type=tel], input[type=email], input[type=search], textarea {
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); color: var(--text);
  padding: 11px 13px; font: inherit; font-size: .95rem; width: 100%;
}
select:focus, input:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-sf);
}
select { height: 42px; padding: 0 12px; }

.toolbar select { width: auto; flex: 0 0 auto; min-width: 190px; }

.pager { display: flex; gap: 6px; justify-content: center; margin: 36px 0 0; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: var(--radius-s);
  border: 1px solid var(--line); display: grid; place-items: center; font-size: .9rem;
}
.pager .cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* --- Карточка товара ------------------------------------------------------ */
.product { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr);
           gap: 44px; align-items: start; }
.gallery-main {
  aspect-ratio: 1; background: var(--surface-2);
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.thumbs img {
  width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-s);
  border: 1px solid var(--line); cursor: pointer;
}
.thumbs img.on { border-color: var(--accent); }

.p-brand { color: var(--muted); text-transform: uppercase; letter-spacing: .08em;
           font-size: .8rem; margin-bottom: 8px; }
.p-price { font-size: 1.9rem; font-weight: 700; margin: 18px 0 6px; }
.buy-row { display: flex; gap: 12px; margin: 22px 0; }

/* Разбор Олеси — главное на карточке. Он и должен выглядеть как то,
   ради чего сюда пришли. */
.review {
  background: var(--accent-sf); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius); padding: 20px 22px; margin: 26px 0;
}
.review h3 { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.review .summary { font-size: 1.05rem; font-weight: 600; margin-bottom: 14px; }
.review dl { margin: 0; display: grid; gap: 12px; }
.review dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
             color: var(--muted); margin-bottom: 2px; }
.review dd { margin: 0; }

/* Состав. Позиция — это данные, а не украшение: INCI печатают по убыванию
   концентрации, и номер строки показывает силу компонента. */
.inci { border: 1px solid var(--line); border-radius: var(--radius);
        overflow: hidden; margin: 26px 0; }
.inci-row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: .92rem;
  align-items: baseline;
}
.inci-row:last-child { border-bottom: 0; }
.inci-row .pos { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.inci-row .ru { color: var(--muted); font-size: .82rem; }
.inci-row.key { background: var(--accent-sf); }
.inci-row.key .name { font-weight: 600; }

.section { padding-block: 52px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between;
                gap: 16px; margin-bottom: 24px; }
.section-head a { color: var(--accent); font-size: .9rem; }

/* --- Главная -------------------------------------------------------------- */
.hero { padding-block: 56px 40px; }
.hero h1 { max-width: 18ch; }
.hero p { max-width: 52ch; font-size: 1.08rem; color: var(--muted); }
.hero-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.pills { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 30px; }
.pill {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: .9rem;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }

/* --- Формы, корзина ------------------------------------------------------- */
.form-grid { display: grid; gap: 16px; }
label.field { display: block; }
label.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-row input { position: absolute; opacity: 0; pointer-events: none; }
.radio-row input:checked + span {
  background: var(--accent-sf); border-color: var(--accent); color: var(--accent);
  font-weight: 600;
}
.radio-row label > span {
  display: inline-block; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .9rem; cursor: pointer;
}
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.cart-row {
  display: grid; grid-template-columns: 88px 1fr auto; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--line); align-items: center;
}
.cart-row img { width: 88px; height: 88px; object-fit: cover; border-radius: var(--radius-s); }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button {
  width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); border-radius: var(--radius-s); cursor: pointer; font-size: 1rem;
}
.total-row { display: flex; justify-content: space-between; align-items: baseline;
             padding: 20px 0; font-size: 1.15rem; }
.total-row b { font-size: 1.5rem; }

.notice {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-s); padding: 14px 16px; margin: 18px 0; font-size: .92rem;
}
.notice.ok   { border-left-color: var(--ok); }
.notice.warn { border-left-color: var(--warn); }
.notice.err  { border-left-color: var(--danger); }

.empty { text-align: center; padding: 70px 20px; color: var(--muted); }

/* --- Подвал --------------------------------------------------------------- */
.site-foot { border-top: 1px solid var(--line); margin-top: 70px; padding: 44px 0 60px;
             background: var(--surface); }
.foot-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 34px; }
.site-foot h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em;
                color: var(--muted); }
.site-foot a { display: block; padding: 4px 0; font-size: .92rem; }

/* --- Телефон -------------------------------------------------------------- */
@media (max-width: 900px) {
  .product { grid-template-columns: 1fr; gap: 28px; }
  .catalog { grid-template-columns: 1fr; }
  .filters { position: static; display: none; }
  .filters.open { display: block; }
  .chip.filters-toggle { display: inline-flex; }
  .foot-inner { grid-template-columns: 1fr 1fr; }
  .head-inner { height: auto; padding-block: 12px; flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .hero { padding-block: 34px 26px; }
}


/* --- Тёмная тема: правки под реальный контент ------------------------------
   Все товарные фото сняты на белом фоне. В тёмной теме два десятка таких
   квадратов светятся на почти чёрном и физически слепят ночью — а смотрят
   каталог как раз вечером с телефона. Приглушаем изображение, а карточке
   возвращаем видимую границу: иначе она перестаёт читаться как объект. */
:root[data-theme="dark"] .card-img img,
:root[data-theme="dark"] .gallery-main img,
:root[data-theme="dark"] .thumbs img,
:root[data-theme="dark"] .cart-row img {
  filter: brightness(.86) saturate(.94);
}
:root[data-theme="dark"] .card-img::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
}
/* Подвал в тёмной теме был светлее фона и выглядел подсвеченной плитой. */
:root[data-theme="dark"] .site-foot { background: #100e0d; }

/* --- Ряды карточек не должны разъезжаться ---------------------------------
   У части товаров нет объёма или бренда, и соседние карточки в одном ряду
   начинались с разной высоты. Взгляд идёт по сетке горизонтально, и такой
   разнобой читается как небрежность даже без понимания причины. */
.card-brand { min-height: 1.1em; }
.card-vol   { min-height: 1.2em; }
.card-name  {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.7em;
}

/* --- Пустое состояние ------------------------------------------------------
   Заголовок наследовал приглушённый цвет и не отличался от пояснения —
   взгляду не за что зацепиться. */
.empty h2 { color: var(--text); margin-bottom: 8px; }
.empty p  { max-width: 38ch; margin: 0 auto 24px; }

/* --- Описание товара -------------------------------------------------------
   Текст поставщика приходит с переносами строк, а выводился одним абзацем:
   «Подходит для» и «Преимущества» — ровно то, ради чего читают, — тонули
   в середине простыни. */
.p-desc { white-space: pre-line; max-width: 62ch; }

/* --- Доступность и поведение ввода -----------------------------------------
   hover на тач-экране «залипает»: после тапа и возврата назад карточка
   остаётся приподнятой и выглядит как зависший интерфейс. */
@media (hover: hover) {
  .card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
}
@media (hover: none) {
  .card:hover { transform: none; }
}
:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Заготовка под ингредиентные ссылки не должна оставлять дыру на первом
   экране, пока она не наполнена. */
.pills:empty { display: none; }


/* --- Мобильная покупка: цена и кнопка всегда под рукой ---------------------
   На телефоне кнопка «В корзину» оказывалась на 964-м пикселе — ниже
   галереи, миниатюр и заголовка. Решение о покупке принималось вслепую,
   после долгой прокрутки, и обратно к кнопке надо было возвращаться.
   Липкая полоса внизу держит цену, срок и действие в поле зрения всегда. */
.buy-bar { display: none; }

@media (max-width: 900px) {
  .buy-bar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .buy-bar .bb-price { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
  .buy-bar .bb-note  { font-size: .72rem; color: var(--muted); }
  .buy-bar form { margin-left: auto; }
  .buy-bar .btn { height: 44px; padding: 0 20px; }
  /* Место под полосу, чтобы она не накрывала последний блок страницы. */
  body.has-buybar { padding-bottom: 78px; }
}

/* --- Отклик на добавление в корзину ----------------------------------------
   Единственным ответом на нажатие была цифра в правом верхнем углу —
   на телефоне её просто не видно, и человек жмёт кнопку второй раз. */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  z-index: 70; display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: .9rem; box-shadow: var(--shadow);
  animation: toast-in .2s ease;
}
.toast a { color: var(--bg); text-decoration: underline; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
