/* ===== Noosfera · Why get certified (final) ===== */

.nf-why-certified {
  --nf-card-radius: var(--noosfera-card-radius, 18px);
  --nf-card-pad: var(--noosfera-card-pad, clamp(20px, 4vw, 40px));
  --nf-card-bg-a: var(--noosfera-card-bg-a, rgba(218,229,249,.6));
  --nf-card-bg-b: var(--noosfera-card-bg-b, rgba(243,232,252,.6));
  --nf-card-shadow: var(--noosfera-card-shadow, 0 8px 28px rgba(22,53,120,.10));
  --nf-title: var(--noosfera-title, var(--wp--preset--color--primary, #4a6cf7));
  --nf-text: var(--noosfera-text, var(--wp--preset--color--foreground, #1b2b41));
  --nf-subtle: var(--noosfera-subtle, #5c6b7a);
  --nf-why-certified-decor: url('../../assets/img/tor.png');
}

/* Card (the Columns wrapper) */
.nf-why-certified__grid{
  position: relative;
  padding: var(--nf-card-pad);
  padding-top: 128px !important;
  padding-bottom: 128px !important;
  background: linear-gradient(135deg, var(--nf-card-bg-a), var(--nf-card-bg-b));
  box-shadow: var(--nf-card-shadow);
  color: var(--nf-text);
  gap: clamp(16px, 3vw, 32px);       /* column gap */
}

/* Vertically center columns on desktop/tablet; top-align on mobile */
@media (min-width: 780px){
  .nf-why-certified__grid { align-items: center; }
}
@media (max-width: 779.98px){
  .nf-why-certified__grid { align-items: flex-start; }
}

/* Flex hygiene so text can shrink/wrap nicely */
.nf-why-certified__media,
.nf-why-certified__content { min-width: 0; box-sizing: border-box; }

/* Comfortable reading width for the text card */
.nf-why-certified__card { max-width: 100ch; }

/* Image figure: right-aligned, 4/5, never wider than its column */
.nf-why-certified__media .nf-why-certified__photo {
  display: block;
  margin-left: auto;
  max-width: 350px;
  margin-right: 0;
  width: min( clamp(260px, 38vw, 520px), 100% );
  aspect-ratio: 4 / 5;
}

/* IMG fills the figure and crops like Figma */
.nf-why-certified__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--nf-card-radius);
}

/* Decorative ellipse (pseudo background) */
.nf-why-certified__card::after{
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--nf-why-certified-decor, none);
  background-repeat: no-repeat;
  background-position: right 0% center;
  background-size: clamp(140px, 22vw, 320px) auto;
  opacity: .35;
  pointer-events: none;
}

/* Tablet tweaks */
@media (max-width: 1023px) and (min-width: 780px) {
  .nf-why-certified__media .nf-why-certified__photo {
    width: min( clamp(220px, 45vw, 420px), 100% );
  }
}

/* Mobile: stack, center image, one bullet column, hide blob */
@media (max-width: 779.98px) {
  .nf-why-certified__grid {
    gap: clamp(20px, 5vw, 32px);
    padding-top: clamp(40px, 10vw, 72px) !important;
    padding-bottom: clamp(40px, 10vw, 72px) !important;
  }

  .nf-why-certified__media .nf-why-certified__photo {
    margin-left: auto;
    margin-right: auto;
    width: min(82%, 420px);
    aspect-ratio: 4 / 5;
  }

  .nf-why-certified__bullets .wp-block-column { flex-basis: 100% !important; }

  .nf-why-certified__grid::after { display: none; }
}



/* Force vertical centering of BOTH columns on desktop/tablet */
@media (min-width: 780px) {
  /* the Columns wrapper */
  .nf-why-certified__grid {
    align-items: center !important;           /* center cross-axis */
  }
  /* its two children (columns) */
  .nf-why-certified__grid > .wp-block-column {
    align-self: center !important;            /* in case any theme rule overrides */
  }

  /* kill any default figure margins that can fake top alignment */
  .nf-why-certified__media .nf-why-certified__photo {
    margin-top: 0;
    margin-bottom: 0;
  }
}

/* On mobile: go back to top alignment (your requirement) */
@media (max-width: 779.98px) {
  .nf-why-certified__grid {
    align-items: flex-start !important;
  }
  .nf-why-certified__grid > .wp-block-column {
    align-self: auto !important;
  }
}





/* --- Desktop only: center both columns vertically --- */
@media (min-width: 1440px) {
   .nf-why-certified__card {
    padding-left: 64px; 
    padding-right: 64px;
   }
    
  .nf-why-certified__grid {
    align-items: center !important;
  }
  .nf-why-certified__grid > .wp-block-column {
    align-self: center !important;
  }
  /* remove stray figure margins that can fake misalignment */
  .nf-why-certified__media .nf-why-certified__photo {
    margin-top: 0;
    margin-bottom: 0;
  }
}

/* --- Tablet: top align both columns --- */
@media (min-width: 780px) and (max-width: 1439px) {
  .nf-why-certified__grid {
    align-items: flex-start !important;
  }
  .nf-why-certified__grid > .wp-block-column {
    align-self: flex-start !important;
  }
}

/* --- Mobile (already top by design, but force it just in case) --- */
@media (max-width: 779.98px) {
  .nf-why-certified__grid {
    align-items: flex-start !important;
  }
  .nf-why-certified__grid > .wp-block-column {
    align-self: auto !important;
  }
}



/* Bullets: 2 → 1 column under 1200px */
@media (max-width: 1199.98px) {
  /* The bullets container is itself a Gutenberg Columns block */
  .nf-why-certified__bullets {
    gap: clamp(12px, 2.5vw, 20px);   /* tighter gap on smaller widths */
  }

  /* Each bullet column becomes full width */
  .nf-why-certified__bullets > .wp-block-column {
    flex-basis: 100% !important;
    max-width: 100% !important;
  }

  /* Optional: add a little space between the two lists once stacked */
  .nf-why-certified__bullets > .wp-block-column + .wp-block-column {
    margin-top: 8px;
  }
}




/* Bullets: force 2 → 1 column below 1200px */
@media (max-width: 1000.98px) {
  /* the bullets container is itself a Columns block */
  .nf-why-certified__bullets.wp-block-columns.is-layout-flex {
    display: flex;
    flex-direction: column !important;          /* stack */
    gap: clamp(12px, 2.5vw, 20px);
  }

  /* each inner column should occupy the full row */
  .nf-why-certified__bullets.wp-block-columns.is-layout-flex > .wp-block-column {
    flex: 0 0 100% !important;                   /* override flex-basis */
    width: 100% !important;                      /* guard against width rules */
    max-width: 100% !important;                  /* guard against max-width */
    margin: 0;                                   /* neutralize theme margins */
  }

  /* small vertical space between the two lists once stacked */
  .nf-why-certified__bullets.wp-block-columns.is-layout-flex > .wp-block-column + .wp-block-column {
    margin-top: 8px;
  }
}
