/* HangaKaipai 0.4.8 — Kaipai Food compatibility layer.
 * Scoped by body.hk-kaipai. No Helix assets or global Bootstrap framework.
 * Keeps HangaPro 0.4.7 behavior unchanged.
 */

/* Kaipai homepage: original hero geometry from the former Helix custom CSS. */
body.hk-kaipai.option-com_sppagebuilder .kf-home-hero {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1440 / 668;
  margin: 0 0 34px;
  padding: 0;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}
body.hk-kaipai.option-com_sppagebuilder .kf-home-hero__background {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  object-fit: cover;
  object-position: center;
  border: 0;
}
body.hk-kaipai.option-com_sppagebuilder .kf-home-hero__content {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 5%;
  width: 40%;
  max-width: 590px;
  margin: 0;
  padding: 0;
  transform: translateY(-50%);
}
body.hk-kaipai.option-com_sppagebuilder .kf-home-hero h1 {
  margin: 0;
  color: #333;
  font-size: clamp(38px, 3.2vw, 52px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.02em;
}
body.hk-kaipai.option-com_sppagebuilder .kf-home-hero__line {
  width: 88%;
  max-width: 430px;
  height: 3px;
  margin: 15px 0 12px;
  background: linear-gradient(90deg, #2ba84a, #36be21);
  border-radius: 999px;
}
body.hk-kaipai.option-com_sppagebuilder .kf-home-hero p {
  max-width: 570px;
  margin: 0;
  font-size: 17px;
  line-height: 1.55;
  color: #666;
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  body.hk-kaipai.option-com_sppagebuilder .kf-home-hero__content {right: 4%; width: 42%;}
  body.hk-kaipai.option-com_sppagebuilder .kf-home-hero h1 {font-size: 37px;}
  body.hk-kaipai.option-com_sppagebuilder .kf-home-hero p {font-size: 15px;}
}
/* Mobile: preserve former Kaipai policy — no heavy hero image. */
@media (max-width: 991.98px) {
  body.hk-kaipai.option-com_sppagebuilder .kf-home-hero {
    width: 100%; height: auto; min-height: 0; aspect-ratio: auto;
    margin: 0 0 9px; background: transparent; overflow: visible;
  }
  body.hk-kaipai.option-com_sppagebuilder .kf-home-hero__background {display: none;}
  body.hk-kaipai.option-com_sppagebuilder .kf-home-hero__content {
    position: static; width: 100%; max-width: none;
    margin: 0; padding: 0; transform: none;
  }
  body.hk-kaipai.option-com_sppagebuilder .kf-home-hero h1 {
    width: 100%; font-size: 21px; font-weight: 700;
    line-height: 1.18; text-align: center; color: #252525;
  }
  body.hk-kaipai.option-com_sppagebuilder .kf-home-hero__line,
  body.hk-kaipai.option-com_sppagebuilder .kf-home-hero p {display: none;}
}
@media (max-width: 575.98px) {
  body.hk-kaipai.option-com_sppagebuilder .kf-home-hero h1 {font-size: 20px;}
}

/* Kaipai homepage six topic tiles: port their actual original custom classes. */
body.hk-kaipai.option-com_sppagebuilder .kf-topics-section {
  max-width: 1320px;
  margin: 46px auto 40px;
  padding: 38px 42px;
  background: linear-gradient(135deg, rgba(43,168,74,.045), rgba(18,148,141,.025));
  border: 1px solid rgba(18,148,141,.12);
  border-radius: 24px;
}
body.hk-kaipai.option-com_sppagebuilder .kf-topics-header {
  max-width: 760px;
  margin: 0 auto 30px;
  text-align: center;
}
body.hk-kaipai.option-com_sppagebuilder .kf-topics-header h2 {
  margin: 0 0 10px; color: #252525; font-size: 30px; font-weight: 700; line-height: 1.2;
}
body.hk-kaipai.option-com_sppagebuilder .kf-topics-header p {
  margin: 0; color: #666; font-size: 16px; line-height: 1.6;
}
body.hk-kaipai.option-com_sppagebuilder .kf-topics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
body.hk-kaipai.option-com_sppagebuilder .kf-topic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 24px 24px 22px;
  color: #252525;
  background: #fff;
  border: 1px solid rgba(18,148,141,.11);
  border-radius: 18px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.045);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
body.hk-kaipai.option-com_sppagebuilder .kf-topic-card::before {
  content: '';
  width: 38px;
  height: 3px;
  margin-bottom: 17px;
  background: linear-gradient(90deg,#2ba84a,#36be21);
  border-radius: 999px;
}
body.hk-kaipai.option-com_sppagebuilder .kf-topic-card h3 {
  margin: 0 0 10px; color: #252525; font-size: 20px; font-weight: 700; line-height: 1.25;
}
body.hk-kaipai.option-com_sppagebuilder .kf-topic-card p {
  margin: 0 0 18px; color: #666; font-size: 14px; line-height: 1.55;
}
body.hk-kaipai.option-com_sppagebuilder .kf-topic-card__more {
  display: inline-flex; align-items: center; margin-top: auto;
  color: #2ba84a; font-size: 13px; font-weight: 700;
}
body.hk-kaipai.option-com_sppagebuilder .kf-topic-card__more::after {content: ' →'; margin-left: 5px;}
body.hk-kaipai.option-com_sppagebuilder .kf-topic-card:is(:hover,:focus-visible) {
  border-color: rgba(43,168,74,.28);
  box-shadow: 0 12px 30px rgba(0,0,0,.08);
  transform: translateY(-3px);
}
body.hk-kaipai.option-com_sppagebuilder .kf-topic-card:is(:hover,:focus-visible) h3 {color: #12948d;}
@media (max-width: 991.98px) {
  body.hk-kaipai.option-com_sppagebuilder .kf-topics-section {display: none;}
}

/* Recipe and feature grids: only rows that actually contain Bootstrap grid columns.
 * Avoid broad changes to SP Page Builder's own .sppb-row and to the template layout.
 */
body.hk-kaipai.view-article .com-content-article__body .row:has(> :is(.col-md-4,.col-sm-4,.col-lg-4,.col-4)) {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  margin-inline: -8px;
}
body.hk-kaipai.view-article .com-content-article__body .row:has(> :is(.col-md-4,.col-sm-4,.col-lg-4,.col-4)) > :is(.col-md-4,.col-sm-4,.col-lg-4,.col-4) {
  flex: 0 0 33.333333%;
  width: 33.333333%;
  max-width: 33.333333%;
  min-width: 0;
  padding-inline: 8px;
}
@media (max-width: 575.98px) {
  body.hk-kaipai.view-article .com-content-article__body .row:has(> :is(.col-md-4,.col-sm-4,.col-lg-4,.col-4)) > :is(.col-md-4,.col-sm-4,.col-lg-4,.col-4) {
    flex-basis: 100%; width: 100%; max-width: 100%;
  }
}

/* Community Polls 6.x: only its own wrapper. Replaces missing Bootstrap form/card
 * presentation; all voting and AJAX behavior remains entirely in the component.
 */
body.hk-kaipai .cjpoll-wrapper {max-width: 100%;}
body.hk-kaipai .cjpoll-wrapper .list-group {
  list-style: none; padding: 0; margin: 0 0 16px;
  border: 1px solid #dcefe6; border-radius: 12px; overflow: hidden;
}
body.hk-kaipai .cjpoll-wrapper .list-group-item {
  display: block; margin: 0; padding: 12px 16px;
  background: #fff; border: 0; border-bottom: 1px solid #e8f1ed;
}
body.hk-kaipai .cjpoll-wrapper .list-group-item:last-child {border-bottom: 0;}
body.hk-kaipai .cjpoll-wrapper .list-group-item:hover {background: #f4fbf7;}
body.hk-kaipai .cjpoll-wrapper .form-check {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 0; cursor: pointer; line-height: 1.5;
}
body.hk-kaipai .cjpoll-wrapper .form-check-input {
  flex: 0 0 17px; width: 17px; height: 17px;
  margin: 4px 0 0; padding: 0;
  accent-color: #2ba84a; cursor: pointer;
}
body.hk-kaipai .cjpoll-wrapper .poll-action-buttons {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 12px; margin-block: 18px 10px;
}
body.hk-kaipai .cjpoll-wrapper .poll-action-buttons .btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; gap: 8px;
  padding: 10px 20px;
  border: 1px solid #2ba84a; border-radius: 999px;
  background: #fff; color: #208e3f;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.3;
  text-decoration: none; cursor: pointer;
  transition: background .2s ease,color .2s ease,box-shadow .2s ease;
}
body.hk-kaipai .cjpoll-wrapper .poll-action-buttons .btn-primary {
  background: #2ba84a; color: #fff;
}
body.hk-kaipai .cjpoll-wrapper .poll-action-buttons .btn:hover,
body.hk-kaipai .cjpoll-wrapper .poll-action-buttons .btn:focus-visible {
  background: #12948d; border-color: #12948d; color: #fff;
}
body.hk-kaipai .cjpoll-wrapper .card {background: #fff; border: 1px solid #dcefe6; border-radius: 12px;}
body.hk-kaipai .cjpoll-wrapper .card-body {padding: 18px;}
body.hk-kaipai .cjpoll-wrapper .poll-results .progress {
  display: flex; height: 17px; overflow: hidden;
  background: #e6f2eb; border-radius: 12px;
}
body.hk-kaipai .cjpoll-wrapper .poll-results .progress-bar {
  display: flex; align-items: center; justify-content: center;
  height: 100%; min-width: 0;
  transition: width .3s ease;
}
body.hk-kaipai .cjpoll-wrapper .mb-3 {margin-bottom: 1rem;}
body.hk-kaipai .cjpoll-wrapper .text-center {text-align: center;}
body.hk-kaipai .cjpoll-wrapper .alert {padding: 12px; border-radius: 8px; background: #fff6e5; color: #7c4b00;}


/* Kaipai homepage: restore original emphasis of the lower SPPB module 181 title.
 * Deliberately scoped to this heading; does not affect article headings or HangaPro.
 */
body.hk-kaipai.option-com_sppagebuilder .hk-glaw [data-module_id="181"] #sppb-addon-1482796171 .sppb-addon h3.sppb-addon-title {
  display: block;
  margin: 10px auto 30px;
  color: #56c758;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}
body.hk-kaipai.option-com_sppagebuilder .hk-glaw [data-module_id="181"] #sppb-addon-1482796171 .sppb-addon h3.sppb-addon-title::after {
  content: "";
  display: block;
  position: static;
  clear: both;
  float: none;
  width: 150px;
  height: 3px;
  margin: 12px auto 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg,#2ba84a,#12948d);
}
@media (max-width: 991.98px) {
  body.hk-kaipai.option-com_sppagebuilder .hk-glaw [data-module_id="181"] #sppb-addon-1482796171 .sppb-addon h3.sppb-addon-title {
    font-size: 24px;
  }
}


/* Kaipai Food: TTX рецепта. Стили .kp-ttx имеют grid-template-columns
 * в исходном HTML, но ранее сам display:grid давал Bootstrap d-md-grid.
 * Восстанавливаем только отсутствующий display, без Bootstrap и без
 * изменения ширины, иконок, цветов и существующего inline CSS.
 */
@media (min-width: 768px) {
  body.hk-kaipai .kp-ttx.d-md-grid[data-kp-ttx="1"] {
    display: grid !important;
  }
}
@media (max-width: 767.98px) {
  body.hk-kaipai .kp-ttx.d-none[data-kp-ttx="1"] {
    display: none !important;
  }
}
