/**
 * Vitrine VK news v6.2 — readable captions and complete hover excerpts.
 * The user-selectable TEST Vitrine is the only affected mode.
 * Classic/Editorial and the VK carousel JavaScript remain unchanged.
 */

/* Titles are inserted once for live variant switching, but must be hidden
 * in Classic and Editorial, and on ALL mobile variants. Otherwise the JS-
 * injected short caption appears above the original full VK excerpt. */
body.kcv20-chrome.kcv15-home .kcv20-news .kcv61-news__caption {
  display: none;
}

/* Contrast is guaranteed by an opaque caption panel, not by depending on
 * the brightness and crop of each VK image. */
@media (min-width: 601px) {
  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card {
    box-shadow: 0 3px 14px rgb(59 19 31 / 15%);
    outline-offset: 3px;
  }

  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card::before {
    content: "";
    position: absolute;
    inset: 32% 0 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
      to bottom,
      rgb(31 8 18 / 0%) 0%,
      rgb(31 8 18 / 18%) 40%,
      rgb(31 8 18 / 84%) 100%
    );
    opacity: 1;
    transition: opacity .22s ease;
  }

  /* Fixed-contrast plaque: short editorial heading is always readable
   * even on the brightest VK photos and posters. */
  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card .kcv61-news__caption {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    bottom: 0;
    box-sizing: border-box;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    /* Fixed plaque height keeps all five cards on one visual baseline,
     * regardless of whether a particular headline uses 1, 2 or 3 lines. */
    height: 100px;
    min-height: 100px;
    max-height: 100px;
    margin: 0;
    padding: 13px 15px 16px;
    border-top: 1px solid rgb(210 160 91 / 70%);
    background: linear-gradient(180deg, #451726 0%, #270b16 100%);
    color: #fff6e8;
    font: 400 clamp(15px, 1.12vw, 17px)/1.3 Georgia, serif;
    text-align: left;
    text-wrap: pretty;
    text-shadow: 0 1px 2px rgb(12 3 7 / 50%);
    pointer-events: none;
    opacity: 1;
    transform: translateY(0);
    transition: opacity .22s ease, transform .22s ease;
  }

  /* Root cause of the missing beginning/end of long posts:
   * old overlay used justify-content:center, large 56px vertical padding and
   * 1.52 line height while the card is capped at 440px. Content larger than
   * its container therefore overflowed above the scroll origin. Align from
   * the TOP, increase usable space and allow overflow for long announcements.
   *
   * The existing VK carousel deliberately sends vertical mouse-wheel motion
   * to the PAGE. Keep that interaction. Very long post excerpts can still
   * be accessed by dragging the clearly visible inner scrollbar or opening
   * the original VK link. */
  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card .vk_slider_post-text {
    position: absolute;
    z-index: 4;
    inset: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    margin: 0;
    padding: 20px 13px 25px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d8a868 #351321;
    color: #fff6e8;
    background: rgb(40 11 22 / 98%);
    font: 400 15px/1.38 Georgia, serif;
    text-align: left;
    overflow-wrap: anywhere;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .22s ease, transform .22s ease;
  }

  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card .vk_slider_post-text__inner {
    display: block;
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card .vk_slider_post-text::-webkit-scrollbar {
    width: 8px;
  }

  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card .vk_slider_post-text::-webkit-scrollbar-thumb {
    border: 2px solid #351321;
    border-radius: 8px;
    background: #d8a868;
  }

  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card:is(:hover, :focus-visible, .is-touch-revealed) .vk_slider_post-text {
    opacity: 1;
    transform: translateY(0);
  }

  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card:is(:hover, :focus-visible, .is-touch-revealed)::before,
  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card:is(:hover, :focus-visible, .is-touch-revealed) .kcv61-news__caption {
    opacity: 0;
    transform: translateY(6px);
  }

  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card:focus-visible {
    outline: 3px solid #ba8c4f;
  }
}

/* Existing mobile layout already displays the VK excerpt below the image.
 * Do not duplicate text or change touch swipe/click in that layout. */
@media (max-width: 600px) {
  body.kcv20-chrome.kcv15-home .kcv20-news .kcv61-news__caption {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card::before,
  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card .kcv61-news__caption,
  body.kcv20-chrome.kcv15-home.kcv56-cards--vitrine
    .kcv20-news .kupetz-home-vk-card .vk_slider_post-text {
    transition: none;
    transform: none;
  }
}
