/* ============================================================
   KUBOTA BAANDUNG — In-Feed Seller + Tractor Cards (มือถือ) v2
   โชว์การ์ดเซลล์ประกบภาพรถในฟีดจอ <1024px
   ============================================================ */

.kb-if { display: none; }

@media (max-width: 1023.98px) {
  .kb-if {
    display: flex;
    flex-direction: column;
    grid-column: 1 / -1;
    position: relative;
    margin: 14px 0 6px;
    background: #0d1014;
    border: 1px solid rgba(255, 122, 26, .38);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(255, 77, 0, .14), 0 2px 10px rgba(0, 0, 0, .35);
    -webkit-tap-highlight-color: transparent;
  }

  /* ── โซนเหตุผล (ภาพพื้นหลังประจำใบ) ── */
  .kb-if-top {
    position: relative;
    min-height: 172px;
    padding: 18px 16px 16px;
    background-size: cover;
    background-position: center 42%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }
  .kb-if-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 14, 20, .16) 0%, rgba(10, 14, 20, .52) 52%, rgba(10, 14, 20, .90) 100%);
    pointer-events: none;
  }
  .kb-if-mark {
    position: absolute;
    top: 12px;
    left: 14px;
    z-index: 2;
    font-family: 'Barlow Condensed', Prompt, sans-serif;
    font-weight: 800;
    font-size: 12.5px;
    letter-spacing: .16em;
    color: #ffd9c0;
    padding: 4px 11px;
    border: 1px solid rgba(255, 122, 26, .6);
    border-radius: 999px;
    background: rgba(10, 14, 20, .55);
  }
  .kb-if-copy {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .kb-if-eyebrow {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
    color: #ffa158;
  }
  .kb-if-title {
    font-size: 23px;
    line-height: 1.18;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .55);
  }
  .kb-if-sub {
    font-size: 12.5px;
    line-height: 1.5;
    color: #ecdfd5;
  }

  /* ── โซนเซลล์ (รูปเซลล์ซ้าย + คำพูดขวา) ── */
  .kb-if-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px 10px;
    background: #12161c;
    text-decoration: none;
    transition: opacity .3s ease;
  }
  .kb-if-cellimg {
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 122, 26, .45);
    background: #1a1f26;
  }
  .kb-if-cellpic {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .kb-if-cellbody { min-width: 0; }
  .kb-if-quote {
    display: block;
    font-size: 12.5px;
    line-height: 1.45;
    color: #f3ede8;
    font-weight: 500;
  }
  .kb-if-carname {
    display: block;
    font-size: 15.5px;
    font-weight: 700;
    color: #fff;
    margin-top: 3px;
  }
  .kb-if-chips {
    display: inline-flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
  }
  .kb-if-chip {
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 122, 26, .5);
    color: #ffc09a;
    background: rgba(255, 90, 0, .12);
    white-space: nowrap;
  }
  .kb-if-chip.kb-if-free {
    color: #fff;
    background: linear-gradient(135deg, #ff7a1a, #ff4d00);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(255, 77, 0, .35);
  }

  /* ── แถวปุ่ม ── */
  .kb-if-foot {
    display: flex;
    gap: 8px;
    padding: 0 14px 13px;
    background: #12161c;
  }
  .kb-if-cta,
  .kb-if-line {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
  }
  .kb-if-cta {
    background: #1d232c;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .14);
  }
  .kb-if-cta:active { background: #232b36; }
  .kb-if-line {
    background: linear-gradient(135deg, #ff7a1a, #ff4d00);
    color: #fff;
    box-shadow: 0 6px 16px rgba(255, 77, 0, .35);
  }

  /* สลับภาพเซลล์และรถพร้อมกัน */
  .kb-if.kb-if-swap .kb-if-offer { opacity: 0; }

  .kb-if {
    display: block;
    margin: 12px 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 122, 26, .4);
    border-radius: 16px;
    background: #10141a;
    box-shadow: 0 10px 24px rgba(13, 16, 20, .17), 0 3px 10px rgba(255, 90, 0, .08);
  }
  .kb-if-offer {
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
    min-height: 176px;
  }
  .kb-if-seller {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 8px;
    background: linear-gradient(160deg, #fff 0%, #fff8f1 100%);
    text-align: center;
  }
  .kb-if-sellerpic {
    display: block;
    width: min(100%, 88px);
    height: 82px;
    border-radius: 11px;
    object-fit: cover;
    object-position: center 24%;
    background: #f5eee7;
  }
  .kb-if-sellername {
    max-width: 100%;
    color: #182a52;
    font-family: Prompt, sans-serif;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
  }
  .kb-if-phone {
    color: #7a4a20;
    font-family: Prompt, sans-serif;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
  }
  .kb-if-quote {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    color: #57463a;
    font-family: Prompt, sans-serif;
    font-size: 9.5px;
    font-weight: 600;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }
  .kb-if-vehicle {
    position: relative;
    display: block;
    min-width: 0;
    min-height: 176px;
    overflow: hidden;
    background: #171b20;
    color: #fff;
    text-decoration: none;
  }
  .kb-if-carimg,
  .kb-if-carveil {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
  .kb-if-carimg {
    display: block;
    object-fit: cover;
  }
  .kb-if-carveil {
    background: linear-gradient(180deg, rgba(7, 10, 14, .02) 22%, rgba(7, 10, 14, .83) 100%);
  }
  .kb-if-burst {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    display: grid;
    width: 70px;
    height: 70px;
    place-items: center;
    padding: 8px;
    background: linear-gradient(145deg, #ffae00 0%, #ff5a00 54%, #d92319 100%);
    clip-path: polygon(50% 0%, 60% 12%, 75% 4%, 79% 20%, 96% 18%, 91% 35%, 100% 50%, 88% 61%, 96% 77%, 79% 80%, 75% 97%, 60% 89%, 50% 100%, 39% 89%, 23% 97%, 20% 80%, 3% 77%, 11% 61%, 0% 50%, 11% 36%, 3% 19%, 21% 20%, 24% 4%, 39% 12%);
    color: #fff;
    font-family: Prompt, sans-serif;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.15;
    text-align: center;
    text-shadow: 0 1px 3px rgba(71, 20, 0, .6);
    filter: drop-shadow(0 3px 5px rgba(31, 12, 0, .38));
  }
  .kb-if-cardetails {
    position: absolute;
    right: 8px;
    bottom: 8px;
    left: 9px;
    z-index: 1;
    display: grid;
    gap: 3px;
  }
  .kb-if-carname {
    overflow: hidden;
    color: #fff;
    font-family: Prompt, sans-serif;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 5px rgba(0, 0, 0, .75);
  }
  .kb-if-teaser {
    display: -webkit-box;
    overflow: hidden;
    color: #fff1df;
    font-family: Prompt, sans-serif;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.25;
    text-shadow: 0 1px 5px rgba(0, 0, 0, .9);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .kb-if-year {
    color: #fff1df;
    font-family: Prompt, sans-serif;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    text-shadow: 0 1px 5px rgba(0, 0, 0, .85);
  }
  .kb-if-cta {
    display: inline-flex;
    justify-self: start;
    padding: 4px 10px;
    border-radius: 999px;
    background: #ff6500;
    color: #fff;
    font-family: Prompt, sans-serif;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
  }
  .kb-if-story-slot[hidden] { display: none; }
  .kb-if.kb-if-swap .kb-if-offer { opacity: 0; }
  .kb-if-offer { transition: opacity .3s ease; }

  /* ── LOCK-025: วาร์ปแบบคุณหนู — เบลอลอยนุ่ม ช้าหรู ไม่กระตุก
     ออกช้านิด กลับมาช้ากว่า ให้อารมณ์ผ้าไหมลอยผ่าน ไม่ใช่ไฟกระพริบ ── */
  .kb-if .kb-if-offer { will-change: opacity, filter, transform; }
  .kb-if.kb-if-warp .kb-if-offer {
    opacity: 0;
    filter: blur(12px);
    transform: translateY(10px) scale(.984);
    transition: opacity .78s cubic-bezier(.5, .06, .35, 1),
                filter .78s cubic-bezier(.5, .06, .35, 1),
                transform .78s cubic-bezier(.5, .06, .35, 1);
  }
  .kb-if.kb-if-warp-back .kb-if-offer {
    transition: opacity 1.05s cubic-bezier(.22, 1, .36, 1),
                filter 1.05s cubic-bezier(.22, 1, .36, 1),
                transform 1.05s cubic-bezier(.22, 1, .36, 1);
  }
  @media (prefers-reduced-motion: reduce) {
    .kb-if.kb-if-warp .kb-if-offer,
    .kb-if.kb-if-warp-back .kb-if-offer { transition: none; filter: none; transform: none; }
  }

  /* ── เข้าจอครั้งแรก: ลอยขึ้นนุ่ม ๆ ── */
  @media (prefers-reduced-motion: no-preference) {
    .kb-if {
      opacity: 0;
      transform: translateY(16px);
      transition: opacity .55s ease, transform .55s ease;
    }
    .kb-if.kb-if-in {
      opacity: 1;
      transform: none;
    }
  }

  @media (max-width: 390px) {
    .kb-if-offer { grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr); min-height: 164px; }
    .kb-if-vehicle { min-height: 164px; }
    .kb-if-sellerpic { height: 72px; }
    .kb-if-seller { padding: 7px 6px; gap: 4px; }
    .kb-if-burst { top: 6px; right: 6px; width: 62px; height: 62px; font-size: 9px; }
    .kb-if-cardetails { right: 6px; bottom: 7px; left: 7px; }
    .kb-if-carname { font-size: 11px; }
    .kb-if-quote { font-size: 9px; }
  }
}

/* Larger, clearer seller portrait and readable contact copy in the in-feed popup. */
@media (max-width: 1023.98px) {
  .kb-if-offer { min-height: 212px; }
  .kb-if-seller { gap: 6px; padding: 10px 8px; }
  .kb-if-sellerpic { width: min(100%, 112px); height: 104px; object-position: center 24%; border-radius: 13px; }
  .kb-if-sellername { color: #10264d; font-size: 13px; line-height: 1.3; }
  .kb-if-phone { color: #704016; font-size: 11px; line-height: 1.3; }
  .kb-if-quote { color: #40352c; font-size: 11px; line-height: 1.42; -webkit-line-clamp: 4; }
}
@media (max-width: 390px) {
  .kb-if-offer { min-height: 220px; }
  .kb-if-sellerpic { width: min(100%, 106px); height: 98px; }
  .kb-if-sellername { font-size: 12.5px; }
  .kb-if-phone, .kb-if-quote { font-size: 10.5px; }
}