/*
Plugin: Testy.org.ua — Спільні стилі
Component: архівні картки GeneratePress
Version: 1.0.9

Файл підключається тільки на стандартних архівах записів, у блозі та пошуку.
Scope обмежений body.testy-org-ua-archive-cards-active і новими classes.
Частина !important потрібна лише на перехідному Етапі 5, щоб передбачувано
перекрити чинний Additional CSS без його передчасного видалення.
*/

body.testy-org-ua-archive-cards-active {
  --testy-org-ua-archive-card-shadow:
    3px 8px 10px rgba(6, 18, 37, 0.42),
    3px 2px 4px rgba(6, 18, 37, 0.22);
  --testy-org-ua-archive-inline-end-gap-half: 11px;
  --testy-org-ua-archive-mobile-column-width-correction: 15px;
  --testy-org-ua-archive-mobile-column-padding: 20px;
}

/* Розмітку циклу й пагінацію продовжує вести GeneratePress. */
body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive {
  position: relative;
  box-sizing: border-box;
  min-height: 0;
  height: auto;
  margin-bottom: var(--testy-org-ua-test-card-row-gap, 22px) !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Повертаємо штатний gutter, який старий archive CSS зануляв через padding:0. */
body.testy-org-ua-archive-cards-active .generate-columns.testy-org-ua-test-card--archive {
  padding-top: 0 !important;
  padding-right: 0 !important;
  padding-bottom: 0 !important;
  padding-left: var(--testy-org-ua-test-card-column-gap, 22px) !important;
}

/*
 * GeneratePress розширює контейнер колонок ліворуч від'ємним margin.
 * Звичайні дві колонки тому доходять до самого правого краю. Віднімаємо
 * половину зовнішнього проміжку від кожної колонки: міжкартковий gutter
 * лишається 22/16 px, а після другої картки з'являється такий самий запас.
 */
@media (min-width: 641px) {
  body.testy-org-ua-archive-cards-active .generate-columns.testy-org-ua-test-card--archive {
    width: calc(50% - var(--testy-org-ua-archive-inline-end-gap-half, 11px)) !important;
    max-width: calc(50% - var(--testy-org-ua-archive-inline-end-gap-half, 11px)) !important;
    flex: 0 0 calc(50% - var(--testy-org-ua-archive-inline-end-gap-half, 11px)) !important;
  }
}

@media (min-width: 641px) and (max-width: 980px) {
  body.testy-org-ua-archive-cards-active {
    --testy-org-ua-archive-inline-end-gap-half: 8px;
  }
}

/*
 * На вузькому екрані нейтралізуємо від'ємний margin GeneratePress і
 * одночасно резервуємо місце праворуч. Значення підібрані під фактичний
 * GeneratePress gutter: одна колонка має поля як у «Подібних тестах».
 */
@media (max-width: 640px) {
  body.testy-org-ua-archive-cards-active .generate-columns.testy-org-ua-test-card--archive {
    width: calc(100% - var(--testy-org-ua-archive-mobile-column-width-correction, 15px)) !important;
    max-width: calc(100% - var(--testy-org-ua-archive-mobile-column-width-correction, 15px)) !important;
    flex: 0 0 calc(100% - var(--testy-org-ua-archive-mobile-column-width-correction, 15px)) !important;
    padding-left: var(--testy-org-ua-archive-mobile-column-padding, 20px) !important;
  }
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .inside-article {
  position: relative;
  min-height: 0;
  height: auto;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .entry-header {
  margin: 0 !important;
  padding: 0 !important;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .post-image {
  position: relative !important;
  z-index: 1 !important;
  display: block !important;
  width: 100%;
  height: auto !important;
  margin: 0 !important;
  overflow: hidden !important;
  border-radius: var(--testy-org-ua-card-radius, 18px) var(--testy-org-ua-card-radius, 18px) 0 0 !important;
  background: transparent !important;
  box-shadow: var(--testy-org-ua-archive-card-shadow) !important;
  filter: none !important;
  line-height: 0;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .post-image > a {
  display: block !important;
  width: 100%;
  height: auto;
  line-height: 0;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .testy-org-ua-archive-card__thumb {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: var(--testy-org-ua-card-radius, 18px) var(--testy-org-ua-card-radius, 18px) 0 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  contain: none !important;
  content-visibility: visible !important;
  line-height: 0;
}

/* Архіви показують повний рисунок у його власному співвідношенні сторін. */
body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .testy-org-ua-archive-card__thumb img {
  position: static !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: var(--testy-org-ua-card-radius, 18px) var(--testy-org-ua-card-radius, 18px) 0 0 !important;
  object-fit: initial !important;
  object-position: center !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
  contain: none !important;
  content-visibility: visible !important;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .entry-title {
  position: relative !important;
  z-index: 2 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100% !important;
  min-height: var(--testy-org-ua-card-title-min-height, 0);
  height: auto !important;
  margin: 0 !important;
  padding: var(--testy-org-ua-card-title-padding, 9px 12px 11px) !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 0 var(--testy-org-ua-card-radius, 18px) var(--testy-org-ua-card-radius, 18px) !important;
  background: var(--testy-org-ua-category-color, var(--testy-org-ua-fallback-color, #000000)) !important;
  color: #ffffff !important;
  font-family: var(--testy-org-ua-card-title-font, 'Montserrat', sans-serif) !important;
  font-size: var(--testy-org-ua-card-title-size, 16px) !important;
  font-weight: var(--testy-org-ua-card-title-weight, 400) !important;
  line-height: var(--testy-org-ua-card-title-line-height, 1.25) !important;
  text-align: var(--testy-org-ua-card-title-align, center) !important;
  box-shadow: var(--testy-org-ua-archive-card-shadow) !important;
  filter: none !important;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .entry-title > a,
body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .entry-title > a:visited,
body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .entry-title > a:hover,
body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .entry-title > a:focus {
  display: block !important;
  width: 100%;
  border-radius: 0 0 var(--testy-org-ua-card-radius, 18px) var(--testy-org-ua-card-radius, 18px) !important;
  color: #ffffff !important;
  font: inherit !important;
  text-align: inherit;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .entry-title > a,
body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .entry-title > a:visited {
  text-decoration: none;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .entry-title > a:hover,
body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .entry-title > a:focus {
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .testy-org-ua-archive-card__ribbon {
  top: var(--testy-org-ua-ribbon-top, 0) !important;
  left: var(--testy-org-ua-ribbon-left, 0) !important;
  width: var(--testy-org-ua-ribbon-width, 200px) !important;
  padding: var(--testy-org-ua-ribbon-padding, 6px 0) !important;
  background: var(--testy-org-ua-category-color, var(--testy-org-ua-fallback-color, #000000)) !important;
  color: #ffffff !important;
  font-family: var(--testy-org-ua-card-title-font, 'Montserrat', sans-serif) !important;
  font-size: var(--testy-org-ua-ribbon-font-size, 15px) !important;
  font-weight: var(--testy-org-ua-ribbon-font-weight, 400) !important;
  line-height: var(--testy-org-ua-ribbon-line-height, 1.1) !important;
  transform: var(--testy-org-ua-ribbon-transform, rotate(-45deg) translate(-100px, 35px)) !important;
  transform-origin: var(--testy-org-ua-ribbon-transform-origin, 0 0) !important;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive .testy-org-ua-archive-card__badge {
  top: var(--testy-org-ua-badge-top, 20px) !important;
  right: var(--testy-org-ua-badge-right, 0) !important;
  max-width: var(--testy-org-ua-badge-max-width, 70%) !important;
  padding: var(--testy-org-ua-badge-padding, 6px 15px) !important;
  overflow: hidden !important;
  border-radius: var(--testy-org-ua-class-badge-radius, 14px 0 0 14px) !important;
  background: var(--testy-org-ua-category-color, var(--testy-org-ua-fallback-color, #000000)) !important;
  color: #ffffff !important;
  font-family: var(--testy-org-ua-card-title-font, 'Montserrat', sans-serif) !important;
  font-size: var(--testy-org-ua-badge-font-size, 15px) !important;
  font-weight: var(--testy-org-ua-badge-font-weight, 400) !important;
  line-height: var(--testy-org-ua-badge-line-height, 1.2) !important;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive:not(.has-post-thumbnail) .entry-title {
  border-radius: var(--testy-org-ua-card-radius, 18px) !important;
}

body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive a:focus-visible {
  outline: var(--testy-org-ua-focus-outline, 2px solid #1877f2);
  outline-offset: -3px;
}

@media (prefers-reduced-motion: reduce) {
  body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive,
  body.testy-org-ua-archive-cards-active .testy-org-ua-test-card--archive * {
    transition: none !important;
  }
}
