/* Карточка товара «Собери свой» (порт постера из ios-menu), ползунок размера,
   кнопка «Открыть» и подсказка «свайпайте» на телефоне, большие категории на ноутбуке. */

@font-face { font-family: Caveat; src: url(/menu/fonts/caveat_bold.ttf); font-weight: 700; font-display: swap; }

:root {
  --cream: #FFF8ED;
  --cream-tag: #FFFDF8;
  --p-ink: #191714;
  --p-ink2: rgba(25, 23, 20, .58);
  --p-ink3: rgba(25, 23, 20, .38);
  --p-line: rgba(25, 23, 20, .14);
  --hand: Caveat, "Segoe Print", cursive;
}
.hand { font-family: var(--hand); font-weight: 700; }

/* ─── сцена ─── */

.st { position: relative; overflow: hidden; background: var(--cream); color: var(--p-ink); width: 100%; height: 100%; }
.st-layers { position: absolute; inset: 0; pointer-events: none; }
.st-layer {
  position: absolute; top: 0;
  transform-origin: 50% 72%;
  /* края кадра растворяются в фоне */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent);
  transition: opacity .5s ease;
}
.st-layer.entering { opacity: 0; }
.st-layer img, .st-layer video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.st-layer video { object-fit: contain; opacity: 0; transition: opacity .2s; }
.st-layer video.ready { opacity: 1; }

.st-labels { position: absolute; inset: 0; pointer-events: none; }
.st-lab { position: absolute; left: 0; right: 0; height: 0; }
.st-lab .ln { position: absolute; top: -.6px; height: 1.2px; border-radius: 1px; background: var(--p-ink); transform-origin: left center; }
.st-lab.right .ln { transform-origin: right center; }
.st-lab .dot { position: absolute; top: -3px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--p-ink); }
.st-lab .tag {
  position: absolute; top: 0; display: flex; flex-direction: column; gap: 1px;
  padding: 5px 9px 6px; border-radius: 6px; white-space: nowrap;
  background: var(--cream-tag); border: 1px solid var(--p-line);
  box-shadow: 0 2px 8px rgba(25, 23, 20, .05);
}
.st-lab.left .tag { left: 12px; }
.st-lab.right .tag { right: 12px; }
.st-lab .tag b { font-weight: 600; font-size: 12.5px; color: var(--p-ink); }
.st-lab .tag small { font-weight: 500; font-size: 11.5px; color: var(--p-ink2); font-variant-numeric: tabular-nums; }

.st-note { position: absolute; left: 14px; width: 132px; pointer-events: none; }
.st-note p { margin: 0 0 0 4px; font-size: 28px; line-height: .95; color: var(--green); transform: rotate(-5deg); transform-origin: 0 100%; }
.st-note svg { display: block; margin: 4px 0 2px 26px; fill: none; stroke: var(--green); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.st-note small { display: block; width: 120px; font-weight: 500; font-size: 12px; line-height: 1.3; color: var(--p-ink2); }

.st-card { position: absolute; left: 14px; width: 118px; pointer-events: none; opacity: 0; }
.st-card[hidden] { display: none; }
.st-card .caps { margin: 0 0 10px; font-size: 10.5px; color: var(--green); }
.st-card strong { display: block; font-family: var(--head); font-weight: 700; font-size: 34px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.st-card em { display: block; margin-top: 3px; font-style: normal; font-size: 11.5px; color: var(--p-ink2); }
.st-card ul { list-style: none; margin: 12px 0 0; padding: 0; }
.st-card ul li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--p-line); }
.st-card ul span { font-weight: 500; font-size: 13px; color: var(--p-ink2); }
.st-card ul b { font-family: var(--head); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.st-card ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.st-card ol li { padding-left: 10px; border-left: 2px solid var(--lime); }
.st-card ol b { display: block; font-weight: 600; font-size: 13px; }
.st-card ol small { display: block; font-weight: 500; font-size: 11.5px; color: var(--p-ink2); font-variant-numeric: tabular-nums; }

.st-stamp { position: absolute; right: 26px; white-space: nowrap; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; opacity: 0; }
.st-stamp .hand { font-size: 32px; line-height: 1; color: var(--green); transform: rotate(6deg); }
.st-stamp i {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--lime); color: var(--green-black); font-style: normal; font-weight: 800; font-size: 14px;
}

/* жест: прозрачная лента поверх сцены, её прокрутка — прогресс сборки */
.st-scrub {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; scrollbar-width: none; touch-action: pan-y;
}
.st-scrub::-webkit-scrollbar { display: none; }
.st-spacer { width: 1px; }

.st-photo { display: grid; }
.st-photo .media { position: absolute; inset: 0; }

/* ─── ползунок размера ─── */

.seg {
  --seg-bg: var(--glass); --seg-line: var(--white-faint); --seg-ink: var(--white); --seg-ink2: var(--white-soft);
  position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr);
  padding: 4px; border-radius: 999px; background: var(--seg-bg); border: 1px solid var(--seg-line);
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab;
}
.seg.dragging { cursor: grabbing; }
.seg-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / var(--n));
  translate: calc(var(--i) * 100%) 0;
  border-radius: 999px; background: var(--lime);
  box-shadow: 0 4px 14px rgba(70, 83, 37, .28);
  transition: translate .38s cubic-bezier(.3, 1.35, .5, 1), transform .38s cubic-bezier(.3, 1.35, .5, 1);
}
/* во время перетаскивания бегунок идёт за пальцем (transform), без пружины */
.seg.dragging .seg-thumb { translate: 0 0; transition: none; scale: 1.04; }
.seg-opt {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-height: 48px; padding: 6px 8px; border: 0; background: none; border-radius: 999px;
  color: var(--seg-ink); cursor: inherit; transition: color .2s;
}
.seg-opt small { font-weight: 600; font-size: 12px; color: var(--seg-ink2); transition: color .2s; }
.seg-opt b { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.seg-opt.on, .seg-opt.on small { color: var(--ink); }
.seg-opt:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
#sheet-sizes { margin-top: 2px; }

/* ─── телефон: карточка-постер ─── */

@media (max-width: 899px) {
  .sheet-card.poster {
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--cream); color: var(--p-ink);
  }
  .sheet-card.poster .sheet-close {
    position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 14px;
    width: 36px; height: 36px; font-size: 14px; color: var(--p-ink);
    background: var(--cream-tag); border-color: var(--p-line);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .sheet-card.poster .sheet-media { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .pst-head { padding: calc(env(safe-area-inset-top) + 10px) 58px 4px 18px; }
  .pst-title {
    margin: 0; font-family: var(--head); font-weight: 700; text-transform: uppercase;
    font-size: clamp(34px, 14vw, 60px); line-height: 1; letter-spacing: -.04em;
    white-space: nowrap; overflow: hidden; color: var(--p-ink);
  }
  .pst-head p {
    margin: 6px 0 0 2px; font-family: var(--head); font-weight: 600; font-size: 14px; line-height: 1.3;
    color: var(--p-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .pst-stage { position: relative; flex: 1; min-height: 0; }
  .sheet-card.poster .sheet-body {
    flex: none; min-height: 0; margin: 0; border-radius: 0; overflow: visible;
    background: var(--cream); color: var(--p-ink);
    padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px) !important;
    border-top: 1px solid var(--p-line); gap: 10px;
  }
  .poster .seg { --seg-bg: rgba(25, 23, 20, .05); --seg-line: var(--p-line); --seg-ink: var(--p-ink); --seg-ink2: var(--p-ink2); }
  .pst-tops { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .pst-tops::-webkit-scrollbar { display: none; }
  .tchip {
    flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 8px;
    border-radius: 999px; background: var(--cream-tag); border: 1px solid var(--p-line);
    color: var(--p-ink); font-weight: 600; font-size: 13px; white-space: nowrap;
  }
  .tchip .tick { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--p-line); color: transparent; }
  .tchip .tick svg { width: 12px; height: 12px; }
  .tchip b { font-weight: 600; color: var(--p-ink2); }
  .tchip.on { background: #EEF6D0; border-color: var(--green); }
  .tchip.on .tick { background: var(--lime); border-color: var(--lime); color: var(--green-black); }
  .pst-buy { display: flex; gap: 10px; align-items: center; }
  .poster .stepper { background: var(--cream-tag); border-color: var(--p-line); color: var(--p-ink); }
  .poster #sheet-add { background: var(--lime); border-color: var(--lime); color: var(--green-black); box-shadow: 0 8px 22px rgba(70, 83, 37, .22); }
  .poster .btn:disabled { color: var(--p-ink2); border-color: var(--p-line); background: rgba(25, 23, 20, .05); }
}

/* ноутбук: сцена слева, детали справа */
@media (min-width: 900px) {
  .sheet-media .pst-stage { position: absolute; inset: 0; }
}

/* ─── телефон: главный экран ─── */

.open-btn {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 54px; margin-top: 4px; padding: 0 8px 0 22px; border: 0; border-radius: 999px;
  background: var(--lime); color: var(--ink); text-align: left;
  box-shadow: 0 10px 26px rgba(198, 232, 91, .28);
  transition: transform .15s;
}
.open-btn:active { transform: scale(.98); }
.open-btn span { flex: 1; font-weight: 800; font-size: 16px; }
.open-btn b { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; opacity: .8; }
.open-btn i {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--ink); color: var(--lime); font-style: normal; font-size: 22px; line-height: 1;
}
.open-btn.out { background: var(--glass-strong); color: var(--white); box-shadow: none; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.open-btn.out i { background: var(--white-faint); color: var(--white); }

.swipe-hint {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 10px; border-radius: 999px;
  background: rgba(0, 0, 0, .38); border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  font-weight: 600; font-size: 12.5px; white-space: nowrap;
}
.swipe-hand { font-style: normal; color: var(--lime); font-size: 16px; animation: swipeHand 1.6s ease-in-out infinite; }
@keyframes swipeHand { 0%, 100% { transform: translateX(3px); } 45% { transform: translateX(-5px); } }
.m-row .counter { margin-left: auto; white-space: nowrap; }

/* толчок ленты: соседний товар выглядывает справа и возвращается */
.pager.nudge .page { animation: nudge 1.3s cubic-bezier(.45, 0, .2, 1) 2; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 40% { transform: translateX(-16%); } }

/* ─── ноутбук: большие карточки категорий, как плитки в мобилке ─── */

.d { grid-template-columns: 340px 1fr; }
.d-nav { display: grid; grid-template-columns: 1fr; grid-auto-rows: max-content; gap: 12px; align-content: start; flex: 1; min-height: 0; }
.d-cat {
  position: relative; display: block; padding: 0; border-radius: var(--radius-tile);
  border: 0; overflow: hidden; aspect-ratio: 16 / 9; isolation: isolate;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .28);
  transition: transform .2s, box-shadow .2s;
}
.d-cat:hover { background: none; transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0, 0, 0, .38); }
.d-cat .media { position: absolute; inset: 0; width: auto; height: auto; border-radius: 0; z-index: -1; }
.d-cat .media > img { object-position: center 40%; transition: transform .5s ease; }
.d-cat:hover .media > img { transform: scale(1.06); }
.d-cat::after { content: ""; position: absolute; inset: 40% 0 0; z-index: -1; background: linear-gradient(to top, rgba(15, 19, 7, .88), transparent); }
.d-cat b { position: absolute; left: 12px; right: 12px; bottom: 14px; font-weight: 700; font-size: 20px; line-height: 1.15; text-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
.d-cat small {
  position: absolute; top: 9px; right: 9px; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 11px;
  display: grid; place-items: center; background: rgba(0, 0, 0, .45); color: var(--white);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.d-cat.on { background: none; outline: 3px solid var(--lime); outline-offset: -3px; }
.d-cat.on .media { outline: 0; }
.d-cat.on small { background: var(--lime); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .swipe-hand, .pager.nudge .page { animation: none; }
}
.st-card .apx { font-size: .5em; vertical-align: .5em; margin-right: 2px; }
