/* RAFimport v132 — mobile catalog card: Genomus geometry, RAFimport palette.
   Loaded after v128/v129 and intentionally overrides their card geometry only. */

@media (max-width: 680px) {
  /* Home carousel: one card, no inherited grid-row stretching. */
  body .raf-home #catalog.vdc-catalog--home .opn-strip.vdc-strip,
  body #catalog.vdc-catalog--home .opn-strip.vdc-strip {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: flex-start !important;
    align-content: flex-start !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    padding: 0 0 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory !important;
    transition: height .18s ease !important;
    box-sizing: border-box !important;
  }

  body .raf-home #catalog.vdc-catalog--home .opn-strip.vdc-strip > .opn-card.vdc-card,
  body #catalog.vdc-catalog--home .opn-strip.vdc-strip > .opn-card.vdc-card {
    flex: 0 0 calc(100vw - 30px) !important;
    width: calc(100vw - 30px) !important;
    max-width: calc(100vw - 30px) !important;
    align-self: flex-start !important;
    scroll-snap-align: start !important;
  }

  /* Full catalog/API: keep a vertical list; same card internals. */
  body .catalog-page #catalog.vdc-catalog--page .opn-strip.vdc-strip,
  body .vdc-api-catalog-page #catalog.vdc-catalog--page .opn-strip.vdc-strip,
  body #catalog.vdc-catalog--page .opn-strip.vdc-strip {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card,
  body .vdc-api-catalog-page #catalog.opn-catalog .opn-card.vdc-card,
  body .catalog-page #catalog.opn-catalog .opn-card.vdc-card {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    grid-template-rows: auto auto !important;
    gap: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 7px !important;
    border-radius: 24px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    align-content: start !important;
  }

  /* Photo proportions copied from the successful Genomus mobile card. */
  body #catalog.opn-catalog .opn-card.vdc-card > .opn-card__photo.vdc-card__photo {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    aspect-ratio: 1.55 / 1 !important;
    border-radius: 18px !important;
    overflow: hidden !important;
    align-self: start !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card > .opn-card__photo.vdc-card__photo img {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    transform: none !important;
  }

  /* Single compact vertical flow: title -> year -> price -> buttons -> info. */
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__body.vdc-card__body,
  body .vdc-api-catalog-page #catalog.opn-catalog .opn-card.vdc-card .opn-card__body.vdc-card__body {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    grid-template-rows: repeat(5, min-content) !important;
    grid-template-areas:
      "name"
      "year"
      "price"
      "actions"
      "info" !important;
    grid-auto-rows: min-content !important;
    align-content: start !important;
    justify-content: stretch !important;
    row-gap: 10px !important;
    column-gap: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 15px 14px 13px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__name.vdc-card__name {
    grid-area: name !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__name.vdc-card__name h3,
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__name.vdc-card__name h3 a {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin: 0 !important;
    font-size: 22px !important;
    line-height: 1.05 !important;
    letter-spacing: -.04em !important;
    white-space: normal !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__name.vdc-card__name h3 small {
    flex: 0 0 auto !important;
    font-size: 10px !important;
    line-height: 1 !important;
    padding: 2px 5px !important;
    border-radius: 7px !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__name.vdc-card__name p {
    margin: 6px 0 0 !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .vdc-card__generation {
    display: block !important;
    margin: 5px 0 0 !important;
    font-size: 11.5px !important;
    line-height: 1.28 !important;
  }

  /* Year: plain line, no tile. Secondary value sits at the right like Genomus. */
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__year.vdc-card__passport {
    grid-area: year !important;
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    align-items: end !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 2px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__year.vdc-card__passport strong {
    margin: 0 !important;
    font-size: 25px !important;
    line-height: 1.02 !important;
    white-space: normal !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__year.vdc-card__passport p {
    justify-self: end !important;
    max-width: 145px !important;
    margin: 0 !important;
    font-size: 12.5px !important;
    line-height: 1.25 !important;
    text-align: right !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  /* Price: plain content row, not a second big glass box. */
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__price.vdc-card__price {
    grid-area: price !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__price.vdc-card__price strong {
    display: block !important;
    margin: 0 !important;
    font-size: 27px !important;
    line-height: 1.02 !important;
    letter-spacing: -.035em !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__price.vdc-card__price p {
    margin: 7px 0 0 !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  /* The extra "Оформить заявку" badge duplicates the real action row on phones. */
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__price.vdc-card__price em,
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__price.vdc-card__price mark {
    display: none !important;
  }

  /* Details + Request directly next to each other, no artificial spacer. */
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__actions.vdc-card__actions {
    grid-area: actions !important;
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 1px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__actions.vdc-card__actions > a,
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__actions.vdc-card__actions > button {
    flex: 1 1 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 46px !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border-radius: 13px !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  /* Bottom technical information + two real controls, as in the reference. */
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__info.vdc-card__info {
    grid-area: info !important;
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    align-items: end !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 1px 0 0 !important;
    padding: 0 !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__info.vdc-card__info > span {
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__info.vdc-card__info > div {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    min-width: 0 !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__info.vdc-card__info button {
    display: grid !important;
    place-items: center !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
    overflow: visible !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__info.vdc-card__info button svg {
    display: block !important;
    width: 21px !important;
    height: 21px !important;
    color: #fff !important;
    stroke: currentColor !important;
    fill: none !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    pointer-events: none !important;
  }

  /* Current markup contains SVGs; do not revive legacy pseudo icons. */
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__info.vdc-card__info .opn-icon-link,
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__info.vdc-card__info .opn-icon-star {
    display: none !important;
  }

  /* The continuation CTA must not stretch the visible vehicle slot. Its own
     height is handled by v132 JS when it becomes the active horizontal item. */
  body #catalog.vdc-catalog--home .raf-catalog-continue-card {
    flex: 0 0 calc(100vw - 30px) !important;
    width: calc(100vw - 30px) !important;
    max-width: calc(100vw - 30px) !important;
    align-self: flex-start !important;
    scroll-snap-align: start !important;
  }
}

@media (max-width: 420px) {
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__body.vdc-card__body {
    padding: 14px 12px 12px !important;
    row-gap: 9px !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__name.vdc-card__name h3,
  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__name.vdc-card__name h3 a {
    font-size: 21px !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__year.vdc-card__passport strong {
    font-size: 23px !important;
  }

  body #catalog.opn-catalog .opn-card.vdc-card .opn-card__price.vdc-card__price strong {
    font-size: 25px !important;
  }
}
