/* Фийдът „като социална мрежа“ (docs/feed/SVERKA.md, Р24, Р26, Р28, §9 т. 5; спецификацията §5) — общ за двете теми.
 *
 * Включва се от изгледа на фийда, не от layout-а: изключеният модул не тегли нито байт. Цветовете идват от токените на
 * темата (--ink, --line, --card, --accent, --promo — ги имат и lumen, и основната), с резервни стойности.
 *
 * Мобилното е първо: картата е на цялата ширина, бутоните са ≥ 44 px, долният панел и известието стоят над долната
 * навигация и над safe-area. На компютър лентата е колона ~480 px в средата.
 *
 * СКОРОСТ (CLS): рамката на медията има aspect-ratio ПРЕДИ да дойде снимка или видео — 4:5 за видео, 1:1 за снимки;
 * всичко вътре е absolute/cover, затова нищо не скача. <video> се прави от скрипта (product-feed.js) при активиране.
 *
 * Състоянията (скриптът ги слага): на сцената is-loading / is-playing / is-started / is-error, на картата is-active,
 * на корена is-fetching, на слоя на панела is-open, на известието is-on; на <html> nc-pfeed-lock, докато е отворен слой.
 */

.nc-pfeed-page { padding-top: 12px; padding-bottom: 32px; }
.nc-pfeed-page__crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; font-size: 14px; color: var(--soft, #6b6b6b); }
.nc-pfeed-page__crumbs a { color: inherit; }
.nc-pfeed-page__head { max-width: 480px; margin: 0 auto 8px; }
.nc-pfeed-page__title { margin: 0; font-size: 24px; line-height: 1.25; color: var(--ink, #111); }
.nc-pfeed-page__lead { margin: 4px 0 0; color: var(--soft, #6b6b6b); }
.nc-pfeed-page__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; max-width: 480px; margin: 0 auto 8px; }
.nc-pfeed-page__bar .nc-pfeed-switch { margin: 0; }
.nc-pfeed-page__filters {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line, #e4e4e1); border-radius: 999px; color: var(--ink, #111); font-weight: 600; text-decoration: none;
}

/* ---------- лентата и картата ---------- */
.nc-pfeed { display: flex; flex-direction: column; gap: 20px; max-width: 480px; margin: 0 auto; }
.nc-pfeed__card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card, #fff); border: 1px solid var(--line, #e4e4e1); border-radius: 14px; overflow: hidden;
  scroll-margin-top: 72px;
}
.nc-pfeed__card.is-active { border-color: var(--ink, #111); }
.nc-pfeed__empty, .nc-pfeed__start, .nc-pfeed__end { margin: 16px 0; text-align: center; color: var(--soft, #6b6b6b); }

/* Медията: размерът е известен предварително (без скок). */
.nc-pfeed__media { position: relative; width: 100%; aspect-ratio: 1 / 1; background: var(--lm-surface, #f5f5f3); overflow: hidden; }
.nc-pfeed__media--video { aspect-ratio: 4 / 5; background: #1a1a1a; }
.nc-pfeed__media img { display: block; width: 100%; height: 100%; object-fit: cover; padding: 0; mix-blend-mode: normal; }

/* Карусел: плъзгане с прилепване, точки отдолу. */
.nc-pfeed__track {
  display: flex; width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.nc-pfeed__track::-webkit-scrollbar { display: none; }
.nc-pfeed__slide { position: relative; display: block; flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: start; }
.nc-pfeed__media--single .nc-pfeed__slide { height: 100%; }
.nc-pfeed__dots {
  position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; pointer-events: none;
}
/* S2R2-03: точките се натискат (полето за натискане е по-голямо от точката); лентата между тях — не. */
.nc-pfeed__dots span {
  position: relative; width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .65); box-shadow: 0 0 0 1px rgba(0, 0, 0, .18);
  pointer-events: auto; cursor: pointer;
}
.nc-pfeed__dots span::after { content: ""; position: absolute; inset: -6px -3px; }
.nc-pfeed__dots span.on { background: #fff; transform: scale(1.25); }

/* S2R2-03: ‹ › за мишка (§5.4 „мишка и клавиатура“): на телефон скрити (плъзгане), видими при мишка и при фокус. */
.nc-pfeed__go {
  position: absolute; top: 50%; z-index: 2; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-top: -22px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .92); color: var(--ink, #111); box-shadow: 0 1px 6px rgba(0, 0, 0, .22);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.nc-pfeed__go--prev { left: 10px; }
.nc-pfeed__go--next { right: 10px; }
.nc-pfeed__go svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.nc-pfeed__go:focus-visible { opacity: 1; pointer-events: auto; }
@media (hover: hover) and (pointer: fine) {
  .nc-pfeed__go { opacity: .92; pointer-events: auto; }
  .nc-pfeed__go[aria-disabled="true"] { opacity: .35; cursor: default; }
}

/* Значките на BadgeResolver (същата част като картата в мрежата) — горе вляво, над медията. */
.nc-pfeed__badges { position: absolute; top: 10px; left: 10px; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 20px); margin: 0; }
/* Видеото: вдясно горе са пауза, звук и цял екран. */
.nc-pfeed__media--video .nc-pfeed__badges { max-width: calc(100% - 180px); }

/* ---------- видеото ---------- */
.nc-pfeed__stage { position: absolute; inset: 0; overflow: hidden; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.nc-pfeed__stage .nc-pfeed__cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nc-pfeed__video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: transparent;
  opacity: 0; transition: opacity .2s ease;
}
.nc-pfeed__stage.is-loading .nc-pfeed__video,
.nc-pfeed__stage.is-started .nc-pfeed__video { opacity: 1; }
.nc-pfeed__stage.is-error .nc-pfeed__video { visibility: hidden; }

.nc-pfeed__play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 64px; min-height: 56px; padding: 0 18px 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(17, 17, 17, .72); color: #fff; font: 600 15px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  transition: opacity .2s ease;
}
.nc-pfeed__play svg { width: 28px; height: 28px; fill: currentColor; }
.nc-pfeed__play .nc-pfeed__i-pause { display: none; }
/* S2R3-03 (WCAG 2.2.2): докато върви, ▶ става видим малък бутон за пауза до звука и „цял екран“ — не изчезва. */
.nc-pfeed__stage.is-playing .nc-pfeed__play {
  left: auto; right: 114px; top: 10px; transform: none;
  width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; background: rgba(17, 17, 17, .6);
}
.nc-pfeed__stage[data-audio="0"].is-playing .nc-pfeed__play { right: 62px; }
.nc-pfeed__stage.is-playing .nc-pfeed__play svg { width: 22px; height: 22px; }
.nc-pfeed__stage.is-playing .nc-pfeed__i-play,
.nc-pfeed__stage.is-playing .nc-pfeed__dur { display: none; }
.nc-pfeed__stage.is-playing .nc-pfeed__i-pause { display: inline; }
.nc-pfeed__stage.is-loading .nc-pfeed__play { opacity: 1; padding: 0; }
.nc-pfeed__stage.is-loading .nc-pfeed__play svg,
.nc-pfeed__stage.is-loading .nc-pfeed__dur,
.nc-pfeed-fs.is-loading .nc-pfeed-fs__play svg { display: none; }
.nc-pfeed__stage.is-loading .nc-pfeed__play::after,
.nc-pfeed-fs.is-loading .nc-pfeed-fs__play::after {
  content: ""; width: 22px; height: 22px; box-sizing: border-box; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: nc-pfeed-spin .8s linear infinite;
}
@keyframes nc-pfeed-spin { to { transform: rotate(360deg); } }

/* Звук и цял екран — горе вдясно, ≥ 44 px. */
.nc-pfeed__ctl {
  position: absolute; top: 10px; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(17, 17, 17, .6); color: #fff;
}
.nc-pfeed__ctl[hidden] { display: none; }
.nc-pfeed__ctl svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nc-pfeed__ctl--sound { right: 62px; }
.nc-pfeed__ctl--full { right: 10px; }
.nc-pfeed__spk { fill: currentColor; }
.nc-pfeed__on { display: none; }
[data-pfeed-sound][aria-pressed="true"] .nc-pfeed__on { display: inline; }
[data-pfeed-sound][aria-pressed="true"] .nc-pfeed__off { display: none; }

.nc-pfeed__msg {
  position: absolute; left: 12px; right: 12px; bottom: 12px; margin: 0; padding: 8px 12px; border-radius: 10px;
  background: rgba(17, 17, 17, .78); color: #fff; font-size: 14px; text-align: center; pointer-events: none;
}
.nc-pfeed__msg[hidden] { display: none; }

/* ---------- под медията ---------- */
.nc-pfeed__body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.nc-pfeed__name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  color: var(--ink, #111); font-weight: 600; font-size: 16px; line-height: 1.35; text-decoration: none;
}
.nc-pfeed__price { min-height: 24px; }
.nc-pfeed__rating { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--soft, #6b6b6b); }
.nc-pfeed__eta, .nc-pfeed__proof { margin: 0; font-size: 14px; line-height: 1.4; color: var(--body, #3d4c5c); }
.nc-pfeed__proof { font-weight: 600; color: var(--ink, #111); }
.nc-pfeed__proof--left { color: var(--promo, #c4000c); }

.nc-pfeed__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 4px; }
.nc-pfeed__add { flex: 1 1 auto; margin: 0; }
.nc-pfeed__add .nc-pfeed__btn, .nc-pfeed__actions > .nc-pfeed__btn { width: 100%; }
.nc-pfeed__actions > .nc-pfeed__btn { flex: 1 1 auto; width: auto; }

.nc-pfeed__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 18px; border: 1px solid var(--line, #e4e4e1); border-radius: 12px; cursor: pointer;
  background: var(--card, #fff); color: var(--ink, #111); font: inherit; font-weight: 600; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.nc-pfeed__btn--primary { border-color: var(--accent, #205b80); background: var(--accent, #205b80); color: #fff; }
.nc-pfeed__btn--ghost { min-width: 48px; }
.nc-pfeed__btn--wide { width: 100%; }
.nc-pfeed__btn[disabled], .nc-pfeed__btn[aria-busy="true"], .nc-pfeed__btn.is-loading { opacity: .6; cursor: progress; }
.nc-pfeed__btn[disabled] { cursor: not-allowed; }

.nc-pfeed__share { position: relative; flex: 0 0 auto; }
.nc-pfeed__share-links {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.nc-pfeed__share-links[hidden] { display: none; }
.nc-pfeed__share-links a, .nc-pfeed__share-links button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line, #e4e4e1);
  border-radius: 999px; background: var(--card, #fff); color: var(--ink, #111); font: inherit; font-size: 14px;
  text-decoration: none; cursor: pointer;
}
/* S2R2-10: viber:// и fb-messenger:// отварят приложение — само на устройство с докосване (на компютър без него не
   правят нищо). WhatsApp (https) и „Копирай адреса“ остават навсякъде. Стар браузър без any-pointer → показани. */
@media not all and (any-pointer: coarse) {
  .nc-pfeed__share-links a[href^="viber:"], .nc-pfeed__share-links a[href^="fb-messenger:"] { display: none; }
}

/* „Още“ и зареждането на следващата порция. */
.nc-pfeed__more { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.nc-pfeed__more [hidden] { display: none; }
.nc-pfeed__more-msg { order: -1; margin: 0; text-align: center; color: var(--soft, #6b6b6b); }
/* Празната жива област остава в дървото за достъпност — скрита само визуално (S2R3-09). */
.nc-pfeed__more-msg:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.nc-pfeed__retry { align-self: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--line, #e4e4e1); border-radius: 12px; background: var(--card, #fff); color: var(--ink, #111); font: inherit; font-weight: 600; cursor: pointer; }
.nc-pfeed.is-fetching .nc-pfeed__more-link, .nc-pfeed.is-fetching [data-pfeed-more-link] { opacity: .6; pointer-events: none; }

/* ---------- долният панел ---------- */
/* S2R2-01: коренът е слой на цял екран: фонът (отделен елемент) затваря при докосване и закрива страницата отдолу,
   панелът е над него и докосване вътре не затваря. */
.nc-pfeed-sheet { position: fixed; inset: 0; z-index: 1000; }
.nc-pfeed-sheet[hidden] { display: none; }
.nc-pfeed-sheet__shade { position: absolute; inset: 0; background: rgba(0, 0, 0, .42); opacity: 0; transition: opacity .22s ease; }
.nc-pfeed-sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--card, #fff); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .22);
  transform: translateY(100%); transition: transform .22s ease;
}
.nc-pfeed-sheet.is-open .nc-pfeed-sheet__shade { opacity: 1; }
.nc-pfeed-sheet.is-open .nc-pfeed-sheet__panel { transform: none; }
.nc-pfeed-sheet__form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
/* Главата (с ✕) е лепкава: при много варианти бутонът за затваряне не изчезва нагоре. */
.nc-pfeed-sheet__head {
  position: sticky; top: -12px; z-index: 1; display: flex; align-items: center; gap: 12px;
  padding: 4px 48px 4px 0; background: var(--card, #fff);
}
.nc-pfeed-sheet__img { flex: 0 0 auto; width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }
.nc-pfeed-sheet__name { margin: 0; color: var(--ink, #111); font-weight: 600; line-height: 1.35; }
.nc-pfeed-sheet__close {
  position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink, #111); cursor: pointer;
}
.nc-pfeed-sheet__close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.nc-pfeed-sheet__opts { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; }
.nc-pfeed-sheet__legend { margin-bottom: 6px; color: var(--ink, #111); font-weight: 600; }
.nc-pfeed-sheet__opt {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "dot name price" "dot stock stock"; align-items: center;
  column-gap: 10px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--line, #e4e4e1); border-radius: 12px; cursor: pointer;
}
.nc-pfeed-sheet__opt input { grid-area: dot; width: 20px; height: 20px; margin: 0; accent-color: var(--accent, #205b80); }
.nc-pfeed-sheet__opt-name { grid-area: name; color: var(--ink, #111); font-weight: 600; }
.nc-pfeed-sheet__opt-price { grid-area: price; color: var(--ink, #111); }
.nc-pfeed-sheet__opt-stock { grid-area: stock; font-size: 13px; color: var(--soft, #6b6b6b); }
.nc-pfeed-sheet__opt:has(input:checked) { border-color: var(--accent, #205b80); box-shadow: 0 0 0 1px var(--accent, #205b80); }
.nc-pfeed-sheet__opt.is-off { opacity: .55; cursor: not-allowed; }
.nc-pfeed-sheet__note { margin: 0; color: var(--soft, #6b6b6b); }
.nc-pfeed-sheet__more { align-self: center; min-height: 44px; display: inline-flex; align-items: center; color: var(--accent-ink, #17435e); }

/* ---------- известието ---------- */
.nc-pfeed-toast {
  position: fixed; left: 16px; right: 16px; z-index: 1002;
  bottom: calc(16px + var(--lm-mnav-h, 74px) + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 4px; max-width: 448px; margin: 0 auto; padding: 12px 16px;
  border-radius: 12px; background: rgba(17, 17, 17, .92); color: #fff; font-size: 15px; line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
}
/* S2R2-06: празното известие НЕ е display:none/hidden — живата област е в дървото за достъпност от зареждането,
   скрита само визуално; затова четецът казва текста, който скриптът слага в нея. */
.nc-pfeed-toast:not(.is-on) {
  width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  box-shadow: none; pointer-events: none;
}
.nc-pfeed-toast a { color: #fff; font-weight: 600; text-decoration: underline; min-height: 44px; display: inline-flex; align-items: center; }
.nc-pfeed-toast button {
  align-self: flex-start; min-height: 44px; padding: 0 16px; border: 1px solid rgba(255, 255, 255, .6); border-radius: 10px;
  background: transparent; color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}

/* ---------- цял екран 9:16 (слоят го прави скриптът) ---------- */
.nc-pfeed-lock, .nc-pfeed-lock body { overflow: hidden; }
.nc-pfeed-fs {
  position: fixed; inset: 0; z-index: 1001; display: flex; align-items: center; justify-content: center; background: #000;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.nc-pfeed-fs .nc-pfeed__video {
  position: relative; inset: auto; width: auto; height: 100%; max-width: 100%; aspect-ratio: 9 / 16; object-fit: contain; opacity: 1;
}
.nc-pfeed-fs.is-error .nc-pfeed__video { visibility: hidden; }
.nc-pfeed-fs__bar {
  position: absolute; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: center; gap: 12px;
}
.nc-pfeed-fs__bar button {
  position: static; transform: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 48px; height: 48px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer;
}
.nc-pfeed-fs__bar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nc-pfeed-fs__play svg { fill: currentColor; stroke: none; }
.nc-pfeed-fs__play .nc-pfeed__dur { display: none; }
.nc-pfeed-fs__play .nc-pfeed__i-pause { display: none; }
.nc-pfeed-fs.is-playing .nc-pfeed-fs__play .nc-pfeed__i-play { display: none; }
.nc-pfeed-fs.is-playing .nc-pfeed-fs__play .nc-pfeed__i-pause { display: inline; }
.nc-pfeed-fs__msg {
  position: absolute; left: 16px; right: 16px; top: calc(16px + env(safe-area-inset-top, 0px)); margin: 0; padding: 8px 12px;
  border-radius: 10px; background: rgba(255, 255, 255, .14); color: #fff; text-align: center;
}
.nc-pfeed-fs__msg[hidden] { display: none; }

/* ---------- фокус, движение, компютър ---------- */
.nc-pfeed a:focus-visible, .nc-pfeed button:focus-visible, .nc-pfeed input:focus-visible,
.nc-pfeed-sheet a:focus-visible, .nc-pfeed-sheet button:focus-visible, .nc-pfeed-sheet input:focus-visible,
.nc-pfeed-fs button:focus-visible, .nc-pfeed-toast a:focus-visible, .nc-pfeed-toast button:focus-visible, .nc-pfeed-page a:focus-visible {
  outline: 3px solid var(--accent, #205b80); outline-offset: 2px;
}
.nc-pfeed__slide:focus-visible { outline-offset: -4px; }

@media (prefers-reduced-motion: reduce) {
  .nc-pfeed__track { scroll-behavior: auto; }
  .nc-pfeed-sheet__panel, .nc-pfeed-sheet__shade, .nc-pfeed__video, .nc-pfeed__play, .nc-pfeed__go { transition: none; }
  .nc-pfeed__stage.is-loading .nc-pfeed__play::after, .nc-pfeed-fs.is-loading .nc-pfeed-fs__play::after { animation-duration: 2.4s; }
}

@media (min-width: 900px) {
  .nc-pfeed-page__title { font-size: 28px; }
  /* S2R2-12: лепкавата глава на lumen на компютър е основен ред (78 px) + навигация (52 px) + две линии. */
  .nc-pfeed__card { scroll-margin-top: 148px; }
  .nc-pfeed-sheet__panel { left: 50%; right: auto; bottom: 24px; width: 480px; transform: translate(-50%, 110%); border-radius: 18px; }
  .nc-pfeed-sheet.is-open .nc-pfeed-sheet__panel { transform: translate(-50%, 0); }
  .nc-pfeed-toast { bottom: 24px; }
  .nc-pfeed__ctl, .nc-pfeed__play { opacity: .92; }
}
