/**
 * Card Grid Section.
 *
 * Seção reutilizável do Nexo Page Kit para grids de cards.
 */

.nexo-card-grid-section {
  width: 100%;
  min-height: var(--nexo-card-grid-section-min-height, 0);
  margin-top: var(--nexo-card-grid-section-margin-top, 0);
  margin-bottom: var(--nexo-card-grid-section-margin-bottom, 0);
  padding: var(--nexo-card-grid-section-padding, 88px 24px);
  background: var(--nexo-card-grid-section-bg, #ffffff);
}

.nexo-card-grid-section *,
.nexo-card-grid-section *::before,
.nexo-card-grid-section *::after {
  box-sizing: border-box;
}

.nexo-card-grid-section__inner {
  width: min(
    var(
      --nexo-card-grid-section-container-width,
      var(--nexo-card-grid-section-content-width, 1180px)
    ),
    100%
  );
  margin: var(--nexo-card-grid-section-container-margin, 0 auto);
  padding: var(--nexo-card-grid-section-container-padding, 0);
}

.nexo-card-grid-section__header {
  max-width: var(--nexo-card-grid-section-header-width, 820px);
  margin: 0 auto 44px;
  text-align: center;
}

.nexo-card-grid-section--header-left .nexo-card-grid-section__header {
  margin-left: 0;
  text-align: left;
}

.nexo-card-grid-section--header-right .nexo-card-grid-section__header {
  margin-right: 0;
  text-align: right;
}

.nexo-card-grid-section__title {
  margin: 0;
  color: var(--nexo-card-grid-section-title-color, #111827);
  font-family: var(
    --nexo-font-family-headings,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif
  );
  font-size: var(--nexo-card-grid-section-title-size, clamp(32px, 4vw, 52px));
  font-weight: var(--nexo-font-weight-h2, 800);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.nexo-card-grid-section__subtitle {
  max-width: 680px;
  margin: 16px auto 0;
  color: var(--nexo-card-grid-section-subtitle-color, #4b5563);
  font-family: var(
    --nexo-font-family-body,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif
  );
  font-size: var(--nexo-card-grid-section-subtitle-size, 17px);
  line-height: 1.55;
}

.nexo-card-grid-section--header-left .nexo-card-grid-section__subtitle {
  margin-left: 0;
}

.nexo-card-grid-section--header-right .nexo-card-grid-section__subtitle {
  margin-right: 0;
}

.nexo-card-grid-section__rows {
  display: flex;
  flex-direction: column;
  gap: var(--nexo-card-grid-section-row-gap, 28px);
}

.nexo-card-grid-section__row {
  display: grid;
  grid-template-columns: repeat(
    var(--nexo-card-grid-section-row-count, 3),
    minmax(0, 1fr)
  );
  gap: var(--nexo-card-grid-section-column-gap, 28px);
  align-items: stretch;
}

.nexo-card-grid-section__cell {
  min-width: 0;
  width: 100%;
}

.nexo-card-grid-section__cell > .nexo-content-card,
.nexo-card-grid-section__cell > .nexo-kit-model,
.nexo-card-grid-section__cell > .nexo-kit-model > .nexo-content-card {
  width: 100%;
  max-width: none;
  margin-right: 0;
  margin-left: 0;
}

.nexo-card-grid-section__slot-placeholder,
.nexo-card-grid-section__empty-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 18px;
  border: 1px dashed #c3c4c7;
  background: #f6f7f7;
  color: #50575e;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.nexo-card-grid-section__grid {
  display: grid;
  grid-template-columns: repeat(
    var(--nexo-card-grid-section-columns-desktop, 3),
    minmax(0, 1fr)
  );
  gap: var(--nexo-card-grid-section-gap, 28px);
}

.nexo-card-grid-builder__settings,
.nexo-card-grid-builder__row-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.nexo-card-grid-builder__wide {
  grid-column: span 2;
}

.nexo-card-grid-builder {
  padding: 16px;
  border: 1px solid #dcdcde;
  background: #fff;
}

.nexo-card-grid-builder__empty {
  padding: 20px;
  margin-bottom: 14px;
  border: 1px dashed #c3c4c7;
  color: #646970;
  text-align: center;
}

.nexo-card-grid-builder__rows {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.nexo-card-grid-builder__row {
  padding: 14px;
  border: 1px solid #dcdcde;
  background: #f6f7f7;
}

.nexo-card-grid-builder__row-head,
.nexo-card-grid-builder__slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.nexo-card-grid-builder__slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.nexo-card-grid-builder__slot {
  padding: 12px;
  border: 1px solid #dcdcde;
  background: #fff;
}

.nexo-card-grid-builder__selected {
  min-height: 36px;
  padding: 9px 10px;
  margin: 8px 0;
  border: 1px solid #dcdcde;
  background: #f6f7f7;
  color: #1d2327;
  font-size: 12px;
  font-weight: 700;
}

.nexo-card-grid-builder__slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nexo-card-grid-builder__chooser {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #dcdcde;
  background: #f6f7f7;
}

.nexo-page-kit-builder--card-grid-section .nexo-page-kit-builder__section {
  margin-bottom: 18px;
}

.nexo-page-kit-builder--card-grid-section .nexo-page-kit-field input,
.nexo-page-kit-builder--card-grid-section .nexo-page-kit-field select,
.nexo-page-kit-builder--card-grid-section .nexo-page-kit-field textarea {
  width: 100%;
}

.nexo-page-kit-admin-preview .nexo-card-grid-section {
  min-width: var(--nexo-card-grid-section-container-width, 1180px);
}

.nexo-content-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  min-width: 0;
  height: var(--nexo-content-card-height, auto);
  overflow: hidden;
  color: var(--nexo-content-card-color, #111827);
  background: var(--nexo-content-card-bg, transparent);
  border-radius: var(--nexo-content-card-radius, 0px);
  border: var(--nexo-content-card-border-width, 0) solid
    var(--nexo-content-card-border-color, transparent);
  outline: 0;
}

.nexo-content-card--has-media.nexo-content-card--media-top {
  grid-template-rows: auto minmax(0, 1fr);
}

.nexo-content-card--media-top .nexo-content-card__media {
  grid-row: 1;
  border-radius: 0 0 var(--nexo-content-card-media-radius, 0)
    var(--nexo-content-card-media-radius, 0);
}

.nexo-content-card--media-top .nexo-content-card__body {
  grid-row: 2;
}

.nexo-content-card--has-media.nexo-content-card--media-bottom {
  grid-template-rows: minmax(0, 1fr) auto;
}

.nexo-content-card--media-bottom .nexo-content-card__body {
  grid-row: 1;
}

.nexo-content-card--media-bottom .nexo-content-card__media {
  grid-row: 2;
  border-radius: var(--nexo-content-card-media-radius, 0)
    var(--nexo-content-card-media-radius, 0) 0 0;
}

.nexo-content-card--standalone {
  width: min(var(--nexo-content-card-width, 300px), 100%);
  max-width: 100%;
  margin-right: auto;
  margin-left: auto;
}

.nexo-card-grid-section--shadow-soft .nexo-content-card {
  box-shadow: var(
    --nexo-content-card-shadow,
    0 18px 48px rgba(17, 24, 39, 0.12)
  );
}

.nexo-card-grid-section--shadow-none .nexo-content-card {
  box-shadow: none;
}

.nexo-content-card__media {
  position: relative;
  z-index: var(--nexo-content-card-media-z-index, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--nexo-content-card-image-height, auto);
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: var(--nexo-content-card-image-bg, #ffffff);
}

.nexo-content-card__media img {
  display: block;
  width: var(--nexo-content-card-image-width, 100%);
  height: 100%;
  padding: var(--nexo-content-card-image-padding, 0);
  object-fit: var(--nexo-content-card-image-fit, cover);
  object-position: var(--nexo-content-card-image-position, center center);
  border-radius: 0;
}

.nexo-content-card__body {
  position: relative;
  z-index: var(--nexo-content-card-body-z-index, 2);
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: var(--nexo-content-card-body-offset-y, 0);
  padding: var(--nexo-content-card-body-padding, 24px);
  background: var(--nexo-content-card-body-bg, transparent);
}

.nexo-content-card__title {
  margin: 0 0 var(--nexo-content-card-title-margin-bottom, 0);
  color: currentColor;
  font-family: var(
    --nexo-content-card-title-font-family,
    var(
      --nexo-font-family-headings,
      "Nunito Sans",
      system-ui,
      -apple-system,
      "Segoe UI",
      Roboto,
      Arial,
      sans-serif
    )
  );
  font-size: var(--nexo-content-card-title-size, 22px);
  font-weight: var(
    --nexo-content-card-title-weight,
    var(--nexo-font-weight-h3, 800)
  );
  font-style: var(--nexo-content-card-title-style, normal);
  line-height: var(--nexo-content-card-title-line-height, 1.18);
  text-align: var(--nexo-content-card-title-align, left);
  letter-spacing: -0.02em;
}

.nexo-content-card__description {
  margin: var(--nexo-content-card-description-margin-top, 14px) 0 0;
  color: var(--nexo-content-card-description-color, #4b5563);
  font-family: var(
    --nexo-content-card-description-font-family,
    var(
      --nexo-font-family-body,
      "Nunito Sans",
      system-ui,
      -apple-system,
      "Segoe UI",
      Roboto,
      Arial,
      sans-serif
    )
  );
  font-size: var(--nexo-content-card-description-size, 15px);
  font-weight: var(--nexo-content-card-description-weight, 400);
  font-style: var(--nexo-content-card-description-style, normal);
  line-height: var(--nexo-content-card-description-line-height, 1.55);
  text-align: var(--nexo-content-card-description-align, left);
}

.nexo-content-card__actions {
  display: flex;
  margin-top: var(--nexo-content-card-button-margin-top, 22px);
  padding-top: 0;
}

.nexo-content-card--button-align-left .nexo-content-card__actions {
  justify-content: flex-start;
}

.nexo-content-card--button-align-center .nexo-content-card__actions {
  justify-content: center;
}

.nexo-content-card--button-align-right .nexo-content-card__actions {
  justify-content: flex-end;
}

.nexo-content-card--button-position-bottom-left .nexo-content-card__actions,
.nexo-content-card--button-position-bottom-center .nexo-content-card__actions,
.nexo-content-card--button-position-bottom-right .nexo-content-card__actions {
  margin-top: auto;
}

.nexo-content-card--button-position-bottom-left .nexo-content-card__actions {
  justify-content: flex-start;
}

.nexo-content-card--button-position-bottom-center .nexo-content-card__actions {
  justify-content: center;
}

.nexo-content-card--button-position-bottom-right .nexo-content-card__actions {
  justify-content: flex-end;
}

.nexo-content-card--button-position-top-right .nexo-content-card__body,
.nexo-content-card--button-position-custom .nexo-content-card__body {
  position: static;
}

.nexo-content-card--button-position-top-right .nexo-content-card__actions {
  position: absolute;
  top: var(--nexo-content-card-button-offset-y, 0);
  right: var(--nexo-content-card-button-offset-x, 0);
  z-index: 5;
  margin-top: 0;
}

/* Custom anchors the button from the lower-left of the card. */
.nexo-content-card--button-position-custom .nexo-content-card__actions {
  position: absolute;
  bottom: var(--nexo-content-card-button-offset-y, 0);
  left: var(--nexo-content-card-button-offset-x, 0);
  z-index: 5;
  margin-top: 0;
}

.nexo-content-card__description-list {
  padding-left: 1.25em;
}

.nexo-content-card__description-list li + li {
  margin-top: 0.35em;
}

.nexo-content-card__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--nexo-content-card-button-min-width, 0);
  min-height: var(--nexo-content-card-button-height, 44px);
  padding: var(--nexo-content-card-button-padding, 12px 18px);
  color: var(--nexo-content-card-button-color, #ffffff);
  font-family: var(
    --nexo-content-card-button-font-family,
    var(
      --nexo-font-family-body,
      "Nunito Sans",
      system-ui,
      -apple-system,
      "Segoe UI",
      Roboto,
      Arial,
      sans-serif
    )
  );
  font-size: var(--nexo-content-card-button-font-size, 14px);
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  background: var(--nexo-content-card-button-bg, #f75c00);
  border-radius: var(--nexo-content-card-button-radius, 999px);
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.nexo-content-card__button:hover,
.nexo-content-card__button:focus {
  color: var(--nexo-content-card-button-hover-color, #ffffff);
  background: var(--nexo-content-card-button-hover-bg, #d94f00);
  transform: translateY(-1px);
}

@media (max-width: 1024px) {
  .nexo-card-grid-section {
    padding-top: var(--nexo-card-grid-section-padding-top-tablet, 72px);
    padding-bottom: var(--nexo-card-grid-section-padding-bottom-tablet, 72px);
  }

  .nexo-card-grid-section__grid {
    grid-template-columns: repeat(
      var(--nexo-card-grid-section-columns-tablet, 2),
      minmax(0, 1fr)
    );
  }

  .nexo-card-grid-section__row {
    grid-template-columns: repeat(
      var(--nexo-card-grid-section-tablet-columns, 2),
      minmax(0, 1fr)
    );
  }
}

@media (max-width: 640px) {
  .nexo-card-grid-section {
    padding-right: 20px;
    padding-left: 20px;
    padding-top: var(--nexo-card-grid-section-padding-top-mobile, 56px);
    padding-bottom: var(--nexo-card-grid-section-padding-bottom-mobile, 56px);
  }

  .nexo-card-grid-section__header {
    margin-bottom: 32px;
  }

  .nexo-card-grid-section__title {
    font-size: var(--nexo-card-grid-section-title-size-mobile, 32px);
  }

  .nexo-card-grid-section__subtitle {
    font-size: var(--nexo-card-grid-section-subtitle-size-mobile, 15px);
  }

  .nexo-card-grid-section__grid {
    grid-template-columns: repeat(
      var(--nexo-card-grid-section-columns-mobile, 1),
      minmax(0, 1fr)
    );
  }

  .nexo-card-grid-section__row {
    grid-template-columns: repeat(
      var(--nexo-card-grid-section-mobile-columns, 1),
      minmax(0, 1fr)
    );
  }

  .nexo-content-card__body {
    padding: 20px;
  }
}

/**
 * Content Cards dentro da Card Grid Section devem preencher a célula do grid.
 * A largura individual salva no Content Card não deve controlar o tamanho
 * quando o card é usado como item de uma seção composta.
 */
.nexo-card-grid-section .nexo-card-grid-section__cell {
  display: flex;
  min-width: 0;
  width: 100%;
}

.nexo-card-grid-section .nexo-card-grid-section__cell > .nexo-kit-model {
  display: flex;
  flex: 1 1 auto;
}

.nexo-card-grid-section .nexo-card-grid-section__cell > .nexo-content-card,
.nexo-card-grid-section .nexo-card-grid-section__cell .nexo-content-card,
.nexo-card-grid-section
  .nexo-card-grid-section__cell
  .nexo-content-card--standalone {
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
  height: 100%;
  margin-right: 0;
  margin-left: 0;
}
