/**
 * Restore index-feed column grid.
 * Scope: ONLY .cotinder-index-feed — owner/pet detail pages untouched.
 * Phone ≤480 → 1 col (elsewhere).
 * Large phone / small 481–767 → flex 2 cols (unchanged).
 * Tablet 768–1199 → dense 2-col grid (no empty half before banner/horoscope).
 * PC ≥1200 → dense 3 cols.
 * Marker: feedpccols20261005dense2
 */
@media (min-width: 1200px) {
  /* dense: a full-width banner/horoscope/be-part must not leave an empty cell
     in the row above. Later posts backfill that cell. */
  .cotinder-index-feed .index__posts {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-flow: dense !important;
    align-items: stretch !important;
  }

  .cotinder-index-feed .index__posts > .index__post {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: none !important;
    box-sizing: border-box !important;
  }

  .cotinder-index-feed .index__posts > .index__post.index__post_full,
  .cotinder-index-feed .index__posts > .index__post.index__post_be-part {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post.cotinder-feed-nudge-break {
    display: none !important;
  }
}

/*
 * Phone / small (481–767.98): keep flex 2-col as before.
 * Do not change this band when fixing tablet voids.
 */
@media (min-width: 481px) and (max-width: 767.98px) {
  html body .cotinder-index-feed .index__posts {
    display: flex !important;
    flex-wrap: wrap !important;
    flex-direction: row !important;
  }

  html body .cotinder-index-feed .index__posts > .index__post {
    width: calc((100% - 15px) / 2) !important;
    max-width: calc((100% - 15px) / 2) !important;
    flex: 0 0 calc((100% - 15px) / 2) !important;
    box-sizing: border-box !important;
  }

  html body .cotinder-index-feed .index__posts > .index__post.index__post_full,
  html body .cotinder-index-feed .index__posts > .index__post.index__post_be-part {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
}

/*
 * Tablet 768–1199.98 (portrait + landscape): dense 2-col grid.
 * Flex wrap left an empty half-slot when a full-width banner/horoscope/be-part
 * followed an odd number of half cards. Dense grid backfills like PC.
 */
@media (min-width: 768px) and (max-width: 1199.98px) {
  html body .cotinder-index-feed .index__posts {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-flow: dense !important;
    /* start kept for full-width; half-cards stretch via late unlock so media fills */
    align-items: stretch !important;
    gap: 15px !important;
  }

  html body .cotinder-index-feed .index__posts > .index__post {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: none !important;
    align-self: stretch !important;
    height: auto !important;
    box-sizing: border-box !important;
  }

  html body .cotinder-index-feed .index__posts > .index__post.index__post_full,
  html body .cotinder-index-feed .index__posts > .index__post.index__post_be-part,
  html body .cotinder-index-feed .index__posts > .index__post.cotinder-pet-horoscope-wrap,
  html body .cotinder-index-feed .index__posts > .index__post.index__post_full.index__post_feed-banner,
  html body .cotinder-index-feed .index__posts > .index__post.index__post_full.cotinder-city-ads,
  html body .cotinder-index-feed .index__posts > .index__post.index__post_full.cotinder-onboarding,
  /* Short curator tip must not sit half-width beside a tall post (portrait void) */
  html body .cotinder-index-feed .index__posts > .index__post.index__post_curator-advice {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post.cotinder-feed-nudge-break {
    display: none !important;
  }
}
