/* smooth-scroll.css — loaded last. Fixes the heavy / sticky scrolling that appeared once
   Code & Prompt posts joined the feed. */

/* 1. Long feeds: skip layout + paint for posts that are off screen. "auto" in contain-intrinsic-size makes the
      browser remember each post's real height, so the scrollbar stops jumping when you scroll back up. */
.kc-snip { content-visibility: auto; contain-intrinsic-size: auto 380px; }
.feed-card { contain-intrinsic-size: auto 420px; }
.explore-tile { contain-intrinsic-size: auto 210px; }
.collection-card { contain-intrinsic-size: auto 100px; }
.myproject-card { contain-intrinsic-size: auto 90px; }
.thread-item { contain-intrinsic-size: auto 80px; }
.connection-card { contain-intrinsic-size: auto 68px; }
.search-project-row { contain-intrinsic-size: auto 66px; }
.notification-row { contain-intrinsic-size: auto 72px; }

/* 2. Code / prompt boxes were scroll traps: a swipe that started on a code box was captured by the box (both axes), so
      the page stopped moving until you lifted your finger. On touch screens a box now scrolls sideways freely, lets
      vertical swipes pass straight to the page, and only scrolls up/down after you tap it (.is-live). */
@media (pointer: coarse) {
  .kc-snip .kc-snip-scroll:not(.is-live) { overflow-y: hidden !important; overscroll-behavior: auto; }
  .kc-snip .kc-snip-scroll.is-live { overflow-y: auto !important; overscroll-behavior: contain; outline: 2px solid color-mix(in srgb, var(--sn-b, #8b6cff) 70%, transparent); outline-offset: -2px; }
  .kc-snip-lang i::after { content: " · tap to scroll"; }
}
@media (pointer: fine) {
  .kc-snip-scroll { overscroll-behavior: auto !important; }
  .kc-snip-lang i::after { content: " · scroll"; }
}

/* 3. The "more below" shadow was an inset box-shadow on the scrolling element (repainted on every scroll frame).
      A fixed gradient strip does the same job for free. */
.kc-snip-codewrap.is-long .kc-snip-scroll { box-shadow: none !important; }
.kc-snip-codewrap.is-long::after { background: linear-gradient(transparent, var(--sn-code-bg, #0f1420)); bottom: 0; content: ""; display: block !important; height: 26px; left: 0; pointer-events: none; position: absolute; right: 0; }

/* 4. Cheaper frames while a finger is moving. */
.kc-snip, .feed-card { transform: translateZ(0); }
.kc-snip-act, .kc-snip-copy { transition-property: color, background-color, transform; }
html.is-scrolling .kc-snip *, html.is-scrolling .feed-card * { transition: none !important; }
html.is-scrolling .project-card:hover, html.is-scrolling .feed-card:hover { box-shadow: none; }
