/* Примитивы магазина. Только переменные из tokens.css — никаких HEX. Переносится в static/css при сборке. */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--c-bg); color: var(--c-text); font-family: var(--font-sans);
  font-size: var(--fs-base); line-height: var(--lh-base); -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }

/* Кнопка */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--size-control-md); padding: 0 20px; border-radius: var(--r-pill); border: 1px solid transparent;
  font: var(--fw-ui) var(--fs-ui)/1 var(--font-sans); letter-spacing: var(--ls-ui); cursor: pointer;
  transition: background-color var(--m-fast) var(--m-ease), transform var(--m-fast) var(--m-ease); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn--sm { height: var(--size-control-sm); padding: 0 14px; }
.btn--lg { height: var(--size-control-lg); padding: 0 32px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--c-accent); color: var(--c-on-accent); }
.btn--primary:hover:not(:disabled) { background: var(--c-accent-hover); }
.btn--secondary { background: transparent; color: var(--c-text); border-color: var(--c-text); }
.btn--secondary:hover:not(:disabled) { background: var(--c-surface); }
.btn--ghost { background: transparent; color: var(--c-text); text-decoration: underline; text-underline-offset: 3px; }
.btn--danger { background: var(--c-danger); color: var(--c-on-accent); }
.btn:disabled { background: var(--c-disabled-bg); color: var(--c-disabled-text); border-color: var(--c-disabled-bg); cursor: not-allowed; }
.btn[aria-busy="true"] { position: relative; color: transparent; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--c-on-accent); border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.link { color: var(--c-link); text-decoration: underline; text-underline-offset: 3px; }

/* Бегущая строка */
.announce { display: flex; align-items: center; height: var(--size-announcement); background: var(--c-ink);
  color: var(--c-on-ink); overflow: hidden; position: relative; }
.announce__track { display: flex; gap: var(--s-9); padding-left: var(--s-6); white-space: nowrap;
  animation: marquee 30s linear infinite; }
.announce[data-paused] .announce__track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .announce__track { animation: none; } }
.announce__pause { position: absolute; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: var(--c-accent-hover); color: var(--c-on-ink); cursor: pointer; display: grid; place-items: center; }

/* Шапка */
.header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: var(--size-header);
  padding: 0 var(--s-4); border-bottom: 1px solid var(--c-border); background: var(--c-bg); }
.header__logo { font-weight: 600; font-size: var(--fs-lg); letter-spacing: -0.02em; }
.header__right { display: flex; justify-content: flex-end; gap: var(--s-1); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none;
  color: var(--c-text); border-radius: var(--r-sm); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--c-surface); }
.count { position: absolute; top: 6px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--r-pill);
  background: var(--c-accent); color: var(--c-on-accent); font-size: 11px; line-height: 18px; font-weight: 600; }

/* Бейдж */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: var(--r-xs);
  font-size: var(--fs-sm); line-height: 1.2; font-weight: 500; }
.badge--savings { background: var(--c-savings-bg); color: var(--c-savings-text); }
.badge--neutral { border: 1px solid var(--c-border); color: var(--c-text); }
.badge--promo { background: var(--c-promo-bg); color: var(--c-promo-text); }
.badge--label { background: var(--c-bg); color: var(--c-text); font-family: var(--font-mono); text-transform: uppercase;
  font-size: var(--fs-xs); font-weight: 400; }

/* Строка вкуса */
.flavours { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--c-border); }
.flavour { display: grid; grid-template-columns: 48px 1fr auto; gap: var(--s-3); align-items: center;
  padding: var(--s-2) 0; border-bottom: 1px solid var(--c-border); }
.flavour__thumb { width: 48px; height: 48px; border-radius: 50%; background: var(--c-surface-2); }
.flavour__name { font-weight: 500; }
.flavour__price { font-size: var(--fs-sm); color: var(--c-text-muted); }
.flavour[aria-disabled="true"] { opacity: .55; }
.stepper { display: flex; align-items: center; gap: var(--s-2); }
.stepper__btn { width: var(--size-control-sm); height: var(--size-control-sm); border-radius: var(--r-sm);
  display: grid; place-items: center; border: 1px solid var(--c-accent); background: var(--c-accent);
  color: var(--c-on-accent); cursor: pointer; position: relative; }
.stepper__btn::before { content: ""; position: absolute; inset: -4px; }   /* область 44×44 */
.stepper__btn--minus { background: var(--c-bg); color: var(--c-text); }
.stepper__btn:disabled { background: var(--c-disabled-bg); border-color: var(--c-disabled-bg); color: var(--c-disabled-text); }
.stepper output { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }

/* Выбор плана */
.plan { border: 0; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.plan__head { background: var(--c-promo-bg); color: var(--c-promo-text); text-align: center; font-size: var(--fs-sm);
  font-weight: 500; padding: 6px; border-radius: var(--r-sm) var(--r-sm) 0 0; margin-bottom: calc(-1 * var(--s-3)); }
.plan__opt { display: grid; grid-template-columns: 22px 1fr auto; gap: var(--s-3); padding: var(--s-4);
  border: 1px solid var(--c-border); border-radius: var(--r-sm); cursor: pointer; background: var(--c-bg); }
.plan__opt:hover { border-color: var(--c-text-muted); }
.plan__opt:has(input:checked) { border: 2px solid var(--c-selected); padding: calc(var(--s-4) - 1px); }
.plan__opt input { appearance: none; width: 22px; height: 22px; margin: 2px 0 0; border-radius: 50%;
  border: 1.5px solid var(--c-border-input); display: grid; place-items: center; }
.plan__opt input:checked { border-color: var(--c-selected); }
.plan__opt input:checked::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--c-selected); }
.plan__opt input:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.plan__title { font-size: var(--fs-lg); font-weight: 500; line-height: var(--lh-lg); }
.plan__price { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-top: var(--s-1); }
.plan__old { color: var(--c-text-muted); text-decoration: line-through; font-size: var(--fs-sm); }
.plan__meta { font-size: var(--fs-sm); color: var(--c-text-muted); }
.checklist { list-style: none; margin: var(--s-3) 0 0; padding: var(--s-3) 0 0; border-top: 1px solid var(--c-border);
  display: grid; gap: 6px; font-size: var(--fs-sm); }
.checklist li { display: flex; gap: var(--s-2); align-items: center; }
.checklist .icon { width: 16px; height: 16px; color: var(--c-selected); }

/* Шкала порогов */
.threshold { display: grid; gap: var(--s-2); }
.threshold__msg { background: var(--c-promo-bg); color: var(--c-promo-text); padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 500; display: flex; gap: var(--s-2); align-items: center; }
.threshold__track { height: 6px; border-radius: var(--r-pill); background: var(--c-progress-track); overflow: hidden; }
.threshold__fill { height: 100%; background: var(--c-progress); border-radius: inherit; transition: width var(--m-slow) var(--m-ease); }
.threshold__marks { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--c-text-muted); }

/* Поля */
.field { display: grid; gap: 6px; }
.field__label { font-size: var(--fs-sm); font-weight: 500; }
.field__hint { font-size: var(--fs-xs); color: var(--c-text-muted); }
.input { height: var(--size-control-md); padding: 0 var(--s-3); border: 1px solid var(--c-border-input); border-radius: var(--r-sm);
  font: inherit; color: var(--c-text); background: var(--c-bg); width: 100%; }
.input:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 0; border-color: var(--c-focus); }
.input[aria-invalid="true"] { border-color: var(--c-danger); }
.input:disabled { background: var(--c-disabled-bg); color: var(--c-disabled-text); }
.field__error { font-size: var(--fs-sm); color: var(--c-danger); display: flex; gap: 6px; align-items: center; }
.check { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--fs-sm); }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--c-accent); }

/* Доставка */
.option { display: grid; grid-template-columns: 22px 1fr auto; gap: var(--s-3); padding: var(--s-4); border: 1px solid var(--c-border);
  border-radius: var(--r-sm); cursor: pointer; }
.option:has(input:checked) { border: 2px solid var(--c-selected); padding: calc(var(--s-4) - 1px); }
.option input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--c-selected); }
.option__title { font-weight: 500; }
.option__meta { font-size: var(--fs-sm); color: var(--c-text-muted); }
.option__price { font-weight: 500; }

/* Квиз */
.quiz-opt { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 var(--s-4);
  border: 1px solid var(--c-border); border-radius: var(--r-sm); background: var(--c-bg); cursor: pointer; }
.quiz-opt:has(input:checked) { border: 2px solid var(--c-text); }
.quiz-opt input { appearance: none; width: 20px; height: 20px; border: 1.5px solid var(--c-border-input); border-radius: var(--r-xs);
  display: grid; place-items: center; }
.quiz-opt input:checked { background: var(--c-accent); border-color: var(--c-accent); }
.quiz-opt input:checked::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--c-on-accent);
  border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.quiz-progress { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-sm); color: var(--c-text-muted); }

/* Аккордеон */
.acc { border-top: 1px solid var(--c-border); }
.acc details { border-bottom: 1px solid var(--c-border); }
.acc summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--s-4);
  padding: var(--s-4) 0; font-weight: 500; cursor: pointer; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary .icon { transition: transform var(--m-base) var(--m-ease); }
.acc details[open] summary .icon { transform: rotate(45deg); }
.acc p { margin: 0 0 var(--s-4); color: var(--c-text-muted); }

/* Карточка товара */
.pcard { position: relative; display: grid; gap: var(--s-2); }
.pcard__media { aspect-ratio: 1; border-radius: var(--r-md); background: var(--c-surface); display: grid; place-items: center;
  position: relative; color: var(--c-text-muted); font-size: var(--fs-sm); }
.pcard__media .badge { position: absolute; top: 12px; left: 12px; }
.pcard__title { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 500; margin: 0; }
.pcard__title a { color: inherit; text-decoration: none; }
.pcard__title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }
.pcard__title a:focus-visible { outline: none; }
.pcard:has(a:focus-visible) { outline: 2px solid var(--c-focus); outline-offset: 4px; border-radius: var(--r-md); }
.pcard__meta, .pcard__unit { font-size: var(--fs-sm); color: var(--c-text-muted); }
.pcard__price { font-weight: 500; }

/* Тост */
.toast { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm);
  background: var(--c-ink); color: var(--c-on-ink); box-shadow: var(--sh-pop); font-size: var(--fs-sm); max-width: 400px; }
.toast--error { background: var(--c-danger-bg); color: var(--c-danger); border: 1px solid var(--c-danger); box-shadow: none; }

/* Карточка продления */
.cycle { display: grid; gap: var(--s-3); padding: var(--s-5); border: 1px solid var(--c-border); border-radius: var(--r-md); }
.cycle__top { display: flex; justify-content: space-between; gap: var(--s-3); align-items: start; flex-wrap: wrap; }
.cycle__date { font-size: var(--fs-lg); font-weight: 500; }
.cycle__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.cycle[data-state="skipped"] .cycle__date { color: var(--c-text-muted); text-decoration: line-through; }
.status { font-size: var(--fs-sm); font-weight: 500; padding: 2px 8px; border-radius: var(--r-pill); }
.status--ok { background: var(--c-savings-bg); color: var(--c-savings-text); }
.status--muted { background: var(--c-surface-2); color: var(--c-text-muted); }
.status--bad { background: var(--c-danger-bg); color: var(--c-danger); }

/* Пустое состояние */
.empty { text-align: center; display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-8) var(--s-4);
  background: var(--c-surface); border-radius: var(--r-md); }
.empty .icon { width: 32px; height: 32px; color: var(--c-text-muted); }
.empty h3 { margin: 0; font-size: var(--fs-lg); font-weight: 500; }
.empty p { margin: 0 0 var(--s-2); color: var(--c-text-muted); font-size: var(--fs-sm); }

/* Скелет */
.skeleton { background: var(--c-surface-2); border-radius: var(--r-xs); height: 14px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Подвал */
.footer { background: var(--c-ink); color: var(--c-on-ink); padding: var(--s-7) var(--s-4); font-size: var(--fs-sm); }
.footer a { color: var(--c-on-ink); }
