/* =========================================================
   CIHF Main Topics
   Shortcode: [cihf_main_topics]
   ========================================================= */

.cihf-main-topics,
.cihf-main-topics * {
  box-sizing: border-box;
}

.cihf-main-topics {
  width: 100%;
}

.cihf-main-topics__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
}

.cihf-main-topic {
  position: relative;
  isolation: isolate;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem;
  overflow: hidden;
  border-radius: 0;
  background: #1a1a1a;
  color: #ffffff;
  cursor: pointer;
}

/* Fundo decorativo do card */
.cihf-main-topic::before {
  content: "";
  position: absolute;
  left: -22%;
  right: -22%;
  bottom: -34%;
  height: 68%;
  z-index: -1;
  background:
    radial-gradient(ellipse at 18% 100%, rgba(216, 23, 124, 0.70) 0%, rgba(132, 20, 111, 0.38) 34%, rgba(77, 7, 63, 0.10) 58%, transparent 74%),
    radial-gradient(ellipse at 58% 105%, rgba(255, 138, 42, 0.32) 0%, rgba(243, 111, 33, 0.18) 28%, rgba(216, 23, 124, 0.08) 48%, transparent 68%),
    radial-gradient(ellipse at 92% 86%, rgba(132, 20, 111, 0.36) 0%, rgba(77, 7, 63, 0.18) 36%, transparent 64%),
    linear-gradient(180deg, transparent 0%, rgba(5, 5, 5, 0.08) 100%);
  opacity: 0.96;
  -webkit-transform: rotate(-1deg);
  transform: rotate(-1deg);
}

.cihf-main-topic::after {
  content: "";
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: 12%;
  height: 2px;
  z-index: -1;
  background:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(77, 7, 63, 0.10) 12%,
      rgba(216, 23, 124, 0.95) 32%,
      rgba(255, 138, 42, 0.60) 50%,
      rgba(132, 20, 111, 0.45) 68%,
      transparent 92%
    );
  -webkit-transform: rotate(7deg);
  transform: rotate(7deg);
  opacity: 0.78;
  box-shadow:
    0 0 18px rgba(216, 23, 124, 0.28),
    0 0 34px rgba(255, 138, 42, 0.12);
}

.cihf-main-topic:hover,
.cihf-main-topic:focus {
  outline: none;
}

.cihf-main-topic__title {
  margin: 0 0 1.1rem;
  color: #ffffff;
  font-size: 20px;
  font-weight: 850;
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.cihf-main-topic__excerpt {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
  line-height: 1.55;
}

/* =========================================================
   Botão do Card
   Ícone + feito em CSS para evitar problemas no iPhone/Safari
   ========================================================= */

.cihf-main-topic__button {
  position: relative;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 2rem;
  border: 2px solid #f8f8f8;
  border-radius: 50%;
  background: transparent !important;
  background-image: none !important;
  color: transparent;
  font-size: 0;
  line-height: 0;
  box-shadow: none;
  -webkit-transform: none !important;
  transform: none !important;
  -webkit-transition: -webkit-transform 0.2s ease, opacity 0.2s ease;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.cihf-main-topic__button::before,
.cihf-main-topic__button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 2px;
  background: #f8f8f8;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

.cihf-main-topic__button::after {
  -webkit-transform: translate(-50%, -50%) rotate(90deg);
  transform: translate(-50%, -50%) rotate(90deg);
}

.cihf-main-topic:hover .cihf-main-topic__button,
.cihf-main-topic:focus .cihf-main-topic__button {
  -webkit-transform: scale(1.05) !important;
  transform: scale(1.05) !important;
}

/* =========================================================
   Modal
   ========================================================= */

.cihf-main-topic-modal,
.cihf-main-topic-modal * {
  box-sizing: border-box;
}

.cihf-main-topic-modal[hidden] {
  display: none !important;
}

.cihf-main-topic-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
}

.cihf-main-topic-modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 5, 0.84);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.cihf-main-topic-modal__dialog {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(100%, 920px);
  max-width: calc(100vw - 48px);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border-radius: 0;
  background: #1a1a1a;
  color: #ffffff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

/* =========================================================
   Botão de fechar do Modal
   Mantém o SVG de close, sem rotação
   ========================================================= */

.cihf-main-topic-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0 !important;
  border-radius: 50%;
  background: transparent !important;
  background-image: url("/wp-content/uploads/2026/06/cross-circle-close.svg") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  cursor: pointer;
  box-shadow: none !important;
  -webkit-transform: none !important;
  transform: none !important;
  -webkit-transition: opacity 0.2s ease, -webkit-transform 0.2s ease;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.cihf-main-topic-modal__close:hover,
.cihf-main-topic-modal__close:focus,
.cihf-main-topic-modal__close:active {
  background-color: transparent !important;
  color: transparent !important;
  outline: none;
  opacity: 0.82;
  -webkit-transform: scale(1.05) !important;
  transform: scale(1.05) !important;
}

.cihf-main-topic-modal__hero {
  position: relative;
  flex: 0 0 auto;
  min-height: 300px;
  display: flex;
  align-items: center;
  padding: 2.4rem;
  background-image: url("/wp-content/uploads/2026/05/CIHF2026_banner-programa-scaled.webp") !important;
  background-size: cover;
  background-position: center;
  color: #ffffff;
  isolation: isolate;
}

.cihf-main-topic-modal__title {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.75rem, 3.2vw, 3rem);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.cihf-main-topic-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
  padding: 2.4rem;
  background: #1a1a1a;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  line-height: 1.7;
}

.cihf-main-topic-modal__body p {
  margin: 0 0 1.1rem;
  color: rgba(255, 255, 255, 0.82);
}

.cihf-main-topic-modal__body p:last-child {
  margin-bottom: 0;
}

.cihf-main-topic-modal__body::-webkit-scrollbar {
  width: 6px;
}

.cihf-main-topic-modal__body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
}

.cihf-main-topic-modal__body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.42);
}

body.cihf-main-topic-modal-open {
  overflow: hidden;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 767px) {
  .cihf-main-topics__grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .cihf-main-topic {
    min-height: 330px;
    padding: 1.55rem;
  }

  .cihf-main-topic__button {
    width: 28px;
    height: 28px;
  }

  .cihf-main-topic__button::before,
  .cihf-main-topic__button::after {
    width: 12px;
    height: 2px;
  }

  .cihf-main-topic-modal {
    padding: 14px;
  }

  .cihf-main-topic-modal__dialog {
    width: 100%;
    max-width: calc(100vw - 28px);
    max-height: calc(100dvh - 28px);
  }

  .cihf-main-topic-modal__close {
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    -webkit-transform: none !important;
    transform: none !important;
  }

  .cihf-main-topic-modal__close:hover,
  .cihf-main-topic-modal__close:focus,
  .cihf-main-topic-modal__close:active {
    -webkit-transform: scale(1.05) !important;
    transform: scale(1.05) !important;
  }

  .cihf-main-topic-modal__hero {
    min-height: 275px;
    padding: 5.2rem 1.5rem 2rem;
  }

  .cihf-main-topic-modal__title {
    font-size: clamp(1.45rem, 7vw, 2.15rem);
    line-height: 1.1;
  }

  .cihf-main-topic-modal__body {
    padding: 1.75rem 1.5rem 2rem;
    font-size: 1rem;
    line-height: 1.65;
  }
}

@media (min-width: 768px) and (max-width: 1180px) {
  .cihf-main-topics__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
