/**
 * Post detail (Fancybox / public) — tablet+phone ≤1199:
 * - image must not cover text
 * - left sidebar / rail / mobmenu FAB behind while modal open
 * PC ≥1200 untouched. Does not revive mobile-sidebar.css.
 * Marker: postdetmob20261129e
 */
@media (max-width: 767.98px) {
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:not(:has(.post__video)),
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:has(.post__video) {
    max-width: 100% !important;
    width: 100% !important;
  }

  html body.cotinder-post-modal-open {
    overflow-x: hidden !important;
  }

  html body.cotinder-post-modal-open .fancybox__viewport,
  html body.cotinder-post-modal-open .fancybox__track {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  html body.cotinder-post-modal-open .fancy__myClose,
  html body.cotinder-post-modal-open .fancybox__container .fancy__myClose {
    top: 6px !important;
    right: 6px !important;
    left: auto !important;
  }
}

@media (max-width: 1199.98px) {
  /* Hide left filter/cabinet rail under the post modal */
  html body.cotinder-post-modal-open .tabs__content_left,
  html body.cotinder-post-modal-open .cotinder-mnav,
  html body.cotinder-post-modal-open .person__form > .tabs__content_left {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    min-width: 0 !important;
  }

  /* Mobmenu FAB + overlay must not sit over post detail (FAB z=2500) */
  html body.cotinder-post-modal-open #cotinder-mobmenu-fab,
  html body.cotinder-post-modal-open #cotinder-mobmenu,
  html body.cotinder-post-modal-open #cotinder-mobmenu-scrollbtns,
  html body.cotinder-post-modal-open #cotinder-mobmenu-boot {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: 0 !important;
  }

  /* Other fixed chrome that can sit over Fancybox while post is open */
  html body.cotinder-post-modal-open #cotinder-identity-modal,
  html body.cotinder-post-modal-open #cotinder-index-feed-hint {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html body.cotinder-post-modal-open,
  html:has(body.cotinder-post-modal-open) {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  html body.cotinder-post-modal-open .main,
  html body.cotinder-post-modal-open .person__form,
  html body.cotinder-post-modal-open .tabs__content_right,
  html body.cotinder-post-modal-open .index__posts {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  html body.cotinder-post-modal-open .main,
  html body.cotinder-post-modal-open .person__form,
  html body.cotinder-post-modal-open .tabs__content_right {
    padding-left: 0 !important;
    margin-left: 0 !important;
  }

  html body #post.js-cotinder-post-modal.card,
  html body #post.js-cotinder-post-modal.card.user-slide,
  html body .post-public-page #post.card,
  html body .post-public-page #post.card.user-slide,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    position: relative !important;
  }

  html body.cotinder-post-modal-open .post__wrapper,
  html body #post.js-cotinder-post-modal .post__wrapper,
  html body .post-public-page #post .post__wrapper {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    position: relative !important;
  }

  /* Фото 1:1 (как custom.css); без height:auto + contain — ломало квадрат и раздувало блок. */
  html body #post .post__img:not(:has(.post__video)),
  html body .post-public-page #post .post__img:not(:has(.post__video)) {
    position: relative !important;
    aspect-ratio: 1 / 1 !important;
    width: 100% !important;
    max-width: min(100%, 548px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    overflow: hidden !important;
    background: #ececec;
    box-sizing: border-box !important;
  }

  html body #post .post__img:not(:has(.post__video)) .post__swiper,
  html body #post .post__img:not(:has(.post__video)) .swiper-wrapper,
  html body #post .post__img:not(:has(.post__video)) .swiper-slide,
  html body .post-public-page #post .post__img:not(:has(.post__video)) .post__swiper,
  html body .post-public-page #post .post__img:not(:has(.post__video)) .swiper-wrapper,
  html body .post-public-page #post .post__img:not(:has(.post__video)) .swiper-slide {
    width: 100% !important;
    height: 100% !important;
  }

  html body #post .post__img:not(:has(.post__video)) img,
  html body .post-public-page #post .post__img:not(:has(.post__video)) img {
    position: static !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  /* Video stays portrait 3:4. The shared .post__img cap (55vh / 1:1) made it square. */
  html body #post .post__img:has(.post__video),
  html body .post-public-page #post .post__img:has(.post__video) {
    aspect-ratio: 3 / 4 !important;
    width: 100% !important;
    max-width: min(100%, 548px) !important;
    height: auto !important;
    max-height: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    align-self: center !important;
    flex: 0 0 auto !important;
  }

  html body #post .post__img:has(.post__video) .post__swiper,
  html body #post .post__img:has(.post__video) .swiper-wrapper,
  html body #post .post__img:has(.post__video) .swiper-slide,
  html body .post-public-page #post .post__img:has(.post__video) .post__swiper,
  html body .post-public-page #post .post__img:has(.post__video) .swiper-wrapper,
  html body .post-public-page #post .post__img:has(.post__video) .swiper-slide {
    width: 100% !important;
    height: 100% !important;
  }

  html body #post .post__img:has(.post__video) .post__video,
  html body #post .post__img:has(.post__video) .cotinder-video-still,
  html body .post-public-page #post .post__img:has(.post__video) .post__video,
  html body .post-public-page #post .post__img:has(.post__video) .cotinder-video-still {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  html body #post .post__text,
  html body .post-public-page #post .post__text {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 0 0 auto !important;
  }

  html body.cotinder-post-modal-open .fancybox__container {
    z-index: 10050 !important;
  }

  /* Модалка поста: sticky winter-header не должен перекрывать скролл контентом сквозь градиент */
  html body.cotinder-post-modal-open .header__fixed.header__fixed_active {
    background-color: var(--sk-w-cream, #fdf6ec) !important;
    background-image: none !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
  }

  html body.cotinder-post-modal-open .fancybox__container {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  html body.cotinder-post-modal-open .fancybox__slide {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    align-items: flex-start !important;
    max-width: 100vw !important;
  }

  html body.cotinder-post-modal-open .fancybox__content,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal {
    max-width: min(calc(100vw - 16px), 548px) !important;
    width: min(calc(100vw - 16px), 548px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
  }

  html body #post .post__wrapper,
  html body .post-public-page #post .post__wrapper {
    font-size: 14px !important;
    line-height: 17px !important;
  }

  html body #post .post__text_text,
  html body #post .post__text_text p,
  html body .post-public-page #post .post__text_text,
  html body .post-public-page #post .post__text_text p {
    font-size: 14px !important;
    line-height: 1.35 !important;
    font-weight: 400 !important;
  }

  html body #post .post__user span,
  html body .post-public-page #post .post__user span {
    font-size: 16px !important;
    line-height: 19px !important;
  }
}
