/**
 * Fancybox post detail on PC ≥1200.
 * Culprits:
 * 1) feed .card { height:446/525px; overflow:hidden } also hits
 *    #post.js-cotinder-post-modal → clips the 730px .post__wrapper.
 * 2) slide align-items:center + tall video → top of the card (author +
 *    start of text) sits above the viewport and looks “missing”.
 * 3) .post__wrapper { max-height:730px; overflow:hidden } +
 *    .post__text_wrapper { height:100%; overflow-y:auto } clips / scrolls
 *    the right column the same way as on /posts/{id}/ (see post-public-pc).
 * 4) Video column capped at ~548px while wrapper stayed 1275px → empty
 *    white strip on the right of the modal.
 * Mobile already opts out via cotinder-post-detail-mobile.css (≤1199).
 * Does not edit custom.css / custom.min.css / cotinder-mobile-card-fixes.css / footer.php.
 * Marker: postdetpc20261129b
 *
 * Photo column was locked at 730px (custom.css); at 1200–1366 the text
 * column crushed / clipped. Cap photos like video; keep text ≥360px.
 */

@media (min-width: 1200px) {
  /* Header .header__fixed is z-index 1100 — must sit under Fancybox or
     author + start of text are covered by the sticky bar. */
  html body.cotinder-post-modal-open .fancybox__container:has(.js-cotinder-post-modal),
  html body .fancybox__container.cotinder-post-fancybox {
    z-index: 1200 !important;
  }

  /* Start from the top so author / text are never above the fold */
  html body.cotinder-post-modal-open .fancybox__container:has(.js-cotinder-post-modal) .fancybox__slide,
  html body .fancybox__container.cotinder-post-fancybox .fancybox__slide {
    align-items: flex-start !important;
    justify-content: center !important;
    padding-top: 48px !important;
    padding-bottom: 40px !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal.card,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal.card.user-slide,
  html body.cotinder-post-modal-open .fancybox__content#post,
  html body .fancybox__container:has(.js-cotinder-post-modal) #post.js-cotinder-post-modal,
  html body .fancybox__container.cotinder-post-fancybox #post.js-cotinder-post-modal {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    /* Hug media + text; no trailing empty strip when video < 730px */
    width: auto !important;
    max-width: min(1275px, calc(100vw - 48px)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-right: 0 !important;
    overflow: visible !important;
    transform: none !important;
    box-shadow: none !important;
  }

  /* Unlock two-column shell — same idea as cotinder-post-public-pc.css */
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__wrapper,
  html body .fancybox__container.cotinder-post-fancybox #post .post__wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    max-height: none !important;
    height: auto !important;
    width: auto !important;
    max-width: min(1275px, calc(100vw - 48px)) !important;
    overflow: visible !important;
    align-items: flex-start !important;
  }

  /* Фото: квадрат 1:1 как в ленте (не height:auto + contain). */
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:not(:has(.post__video)),
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:not(:has(.post__video)) {
    align-self: flex-start !important;
    flex: 0 0 auto !important;
    aspect-ratio: 1 / 1 !important;
    width: min(560px, 46vw, calc(100% - 400px)) !important;
    max-width: min(560px, 46vw, calc(100% - 400px)) !important;
    height: auto !important;
    max-height: min(560px, 46vw, calc(100vh - 160px)) !important;
    overflow: hidden !important;
    background: #f3f0eb;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:not(:has(.post__video)) .post__swiper,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:not(:has(.post__video)) .swiper-wrapper,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:not(:has(.post__video)) .swiper-slide,
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:not(:has(.post__video)) .post__swiper,
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:not(:has(.post__video)) .swiper-wrapper,
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:not(:has(.post__video)) .swiper-slide {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:not(:has(.post__video)) img,
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:not(:has(.post__video)) img {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text,
  html body .fancybox__container.cotinder-post-fancybox #post .post__text {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    align-self: flex-start !important;
    flex: 1 1 360px !important;
    min-width: 360px !important;
    max-width: 566px !important;
    width: auto !important;
    /* Keep avatar/name below card border-radius (was flush → clipped) */
    padding-top: 18px !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_top,
  html body .fancybox__container.cotinder-post-fancybox #post .post__text_top {
    margin-top: 0 !important;
    padding-top: 4px !important;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_wrapper,
  html body .fancybox__container.cotinder-post-fancybox #post .post__text_wrapper {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_top,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_text,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_bottom,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_comment,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__add,
  html body .fancybox__container.cotinder-post-fancybox #post .post__text_top,
  html body .fancybox__container.cotinder-post-fancybox #post .post__text_text {
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Video column: 3:4. Absolute still/video have no intrinsic size —
     width:auto collapsed the box to 0×0 (blank preview). */
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:has(.post__video),
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:has(.post__video) {
    align-self: flex-start !important;
    flex: 0 0 auto !important;
    aspect-ratio: 3 / 4 !important;
    width: min(548px, 42vw) !important;
    max-width: min(548px, 42vw) !important;
    height: auto !important;
    max-height: min(730px, calc(100vh - 120px)) !important;
    background: #ececec;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:has(.post__video) .post__swiper,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:has(.post__video) .swiper-wrapper,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:has(.post__video) .swiper-slide,
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:has(.post__video) .post__swiper,
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:has(.post__video) .swiper-wrapper,
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:has(.post__video) .swiper-slide {
    width: 100% !important;
    height: 100% !important;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:has(.post__video) .post__video,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__img:has(.post__video) .cotinder-video-still,
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:has(.post__video) .post__video,
  html body .fancybox__container.cotinder-post-fancybox #post .post__img:has(.post__video) .cotinder-video-still {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  /* Keep author row in view if something still scrolls to comments */
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_comment[id^="post-comments-"],
  html body .fancybox__container.cotinder-post-fancybox #post .post__text_comment[id^="post-comments-"] {
    scroll-margin-top: 200px;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__wrapper,
  html body .fancybox__container.cotinder-post-fancybox #post .post__wrapper {
    font-size: 14px !important;
    line-height: 17px !important;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_text,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_text p,
  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_text li,
  html body .fancybox__container.cotinder-post-fancybox #post .post__text_text,
  html body .fancybox__container.cotinder-post-fancybox #post .post__text_text p {
    font-size: 14px !important;
    line-height: 1.35 !important;
    font-weight: 400 !important;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_text h1,
  html body .fancybox__container.cotinder-post-fancybox #post .post__text_text h1 {
    font-size: 1.15rem !important;
    line-height: 1.3 !important;
  }

  html body.cotinder-post-modal-open #post.js-cotinder-post-modal .post__text_text h2,
  html body .fancybox__container.cotinder-post-fancybox #post .post__text_text h2 {
    font-size: 1.05rem !important;
    line-height: 1.3 !important;
  }
}

/* Closed delete confirm must not leak on PC (overflow:visible on #post). */
#post.card > .delete-alert:not(.delete-alert__active),
#post.card > .cotinder-delete-alert:not(.delete-alert__active),
#post.card > .delete-alert[aria-hidden="true"],
#post.card > .cotinder-delete-alert[aria-hidden="true"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: none !important;
}
