/* ═══ "Что ещё рядом": symmetric and centred (2026-11-27) ═══
   - the rail always shows whole cards: 3 on wide columns, 2 on medium;
     on phones the active card sits in the middle with equal peeks either side
   - the distance badge is centred over its card
   - every card has the same insets, rows on the same lines, the stub edge to edge
   Works on the live markup: .detail-nearby__viewport > .detail-nearby__rail > .detail-nearby__item */
body.page-place_detail .detail-nearby__viewport { container-type: inline-size; container-name: nearby; }

body.page-place_detail .detail-nearby__rail:not(#kd-a):not(#kd-b) {
  --nb-gap: 16px;
  --nb-k: 1;
  gap: var(--nb-gap) !important;
  grid-auto-columns: calc((100% - (var(--nb-k) - 1) * var(--nb-gap)) / var(--nb-k)) !important;
  padding-inline: 0 !important;
  scroll-padding-inline: 0 !important;
  align-items: stretch !important;
}
@container nearby (min-width: 440px) { body.page-place_detail .detail-nearby__rail:not(#kd-a):not(#kd-b) { --nb-k: 2; } }
@container nearby (min-width: 700px) { body.page-place_detail .detail-nearby__rail:not(#kd-a):not(#kd-b) { --nb-k: 3; } }
/* phones: one card in the middle, the neighbours peek in equally on both sides */
@container nearby (max-width: 439px) {
  body.page-place_detail .detail-nearby__rail:not(#kd-a):not(#kd-b) {
    /* tracks are measured inside the padding: one card = the whole inner width,
       34px each side for the neighbours (12px gap + 22px peek), equal left and right */
    --nb-gap: 12px;
    grid-auto-columns: 100% !important;
    padding-inline: 34px !important;
    scroll-padding-inline: 34px !important;
  }
}
body.page-place_detail .detail-nearby__item:not(#kd-a):not(#kd-b) {
  scroll-snap-align: center !important;
  display: flex !important; flex-direction: column !important; align-items: stretch !important;
  min-width: 0 !important; height: 100% !important;
}
body.page-place_detail .detail-nearby__distance:not(#kd-a):not(#kd-b) {
  align-self: center !important; justify-content: center !important; max-width: 100% !important;
  margin-inline: auto !important; white-space: nowrap !important;
}
body.page-place_detail .detail-nearby__item > .place-card:not(#kc-a):not(#kc-b):not(#kc-r) {
  flex: 1 1 auto !important; width: 100% !important; height: auto !important; min-height: 0 !important; margin: 0 !important;
  display: flex !important; flex-direction: column !important;
}

/* same rows on every card in the rail */
body.page-place_detail .detail-nearby__item .place-card .card-price-pill:not(#kc-a):not(#kc-b) { display: none !important; }
body.page-place_detail .detail-nearby__item .place-card .card-body:not(#kc-a):not(#kc-b):not(#kc-r) {
  flex: 1 1 auto !important; display: flex !important; flex-direction: column !important; gap: 8px !important;
  padding: 14px 16px 0 !important;
}
body.page-place_detail .detail-nearby__item .place-card .card-title:not(#kc-a):not(#kc-b):not(#kc-r) {
  display: -webkit-box !important; -webkit-box-orient: vertical !important; -webkit-line-clamp: 2 !important; overflow: hidden !important;
  min-height: 2.5em !important; line-height: 1.25 !important; margin: 0 !important;
}
body.page-place_detail .detail-nearby__item .place-card .card-tags-row:not(#kc-a):not(#kc-b) { flex-wrap: nowrap !important; overflow: hidden !important; }
body.page-place_detail .detail-nearby__item .place-card .card-meta-chip--type:not(#kc-a) { display: none !important; }
body.page-place_detail .detail-nearby__item .place-card .card-meta-chip--age:not(#kc-a) { max-width: 100% !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
body.page-place_detail .detail-nearby__item .place-card :is(.card-organization, .card-map-missing):not(#kc-a):not(#kc-b) { display: none !important; }
body.page-place_detail .detail-nearby__item .place-card .card-location:not(#kc-a):not(#kc-b) { min-height: 2.6em !important; }
body.page-place_detail .detail-nearby__item .place-card .card-description:not(#kc-a):not(#kc-b) { min-height: calc(2 * 1.45em) !important; }
body.page-place_detail .detail-nearby__item .place-card .card-description.is-empty:not(#kc-a):not(#kc-b) { display: block !important; visibility: hidden !important; }
body.page-place_detail .detail-nearby__item .place-card .card-rating-row:not(#kc-a):not(#kc-b) { min-height: 20px !important; margin: 0 !important; }

/* the stub: edge to edge, same height, price centred vertically */
body.page-place_detail .detail-nearby__item .place-card .card-action-stack:not(#kc-a):not(#kc-b):not(#kc-r) {
  margin: auto -16px 0 !important; padding: 12px 16px 14px !important; min-height: 68px !important;
  display: flex !important; align-items: center !important;
  border-top: 2px dashed #cddbd1 !important; background: #f3f8f4 !important; border-radius: 0 0 20px 20px !important;
}
body.page-place_detail .detail-nearby__item .place-card .card-bottom-row:not(#kc-a):not(#kc-b):not(#kc-r) { width: 100% !important; align-items: center !important; }
/* price: shrinks and wraps to two lines, never pushes the round buttons out */
body.page-place_detail .detail-nearby__item .place-card .card-bottom-row > .card-stub-price:not(#kc-a):not(#kc-b):not(#kc-r) {
  flex: 1 1 auto !important; min-width: 0 !important; width: auto !important; height: auto !important;
  display: -webkit-box !important; -webkit-box-orient: vertical !important; -webkit-line-clamp: 2 !important; overflow: hidden !important;
  white-space: normal !important; padding: 0 !important; background: none !important; box-shadow: none !important; border-radius: 0 !important;
  color: #0d4a2a !important; font-weight: 850 !important; font-size: .98rem !important; line-height: 1.2 !important; text-align: left !important;
}
body.page-place_detail .detail-nearby__item .place-card .card-bottom-row > :not(.card-stub-price):not(#kc-a) { flex: 0 0 auto !important; }
/* whole cards + arrows + dots: the edge fades would only cut the outer cards */
body.page-place_detail .detail-nearby__viewport:not(#kd-a)::before,
body.page-place_detail .detail-nearby__viewport:not(#kd-a)::after { display: none !important; }
/* one chip row: age only, on one line */
body.page-place_detail .detail-nearby__item .place-card .card-meta-chip--type:not(#kc-a):not(#kc-b):not(#kc-r) { display: none !important; }
body.page-place_detail .detail-nearby__item .place-card .card-meta-chip--age:not(#kc-a):not(#kc-b):not(#kc-r) { min-width: 0 !important; max-width: 100% !important; }
body.page-place_detail .detail-nearby__item .place-card .card-meta-chip--age :is(.card-meta-chip__value, span):not(#kc-a):not(#kc-b) {
  min-width: 0 !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; display: block !important;
}
