/* ============================
   Noosfera · Testimonials (from scratch)
   ============================ */

.noosfera-pattern--testimonials.nf-testimonials {
  --nf-title: var(--wp--preset--color--blue-700, #467FF7);
  --nf-text: var(--wp--preset--color--text, #252831);
  --nf-muted: var(--wp--preset--color--text-muted, #596480);

  --card-bg: #EFEFFE;
  --card-bdr: rgba(22,53,120,.12);
  --card-radius: 18px;
  --card-shadow: 0 16px 26px rgba(22,53,120,.12);

  --outer-gap: clamp(24px, 3.2vw, 40px);
  --card-pad-x: clamp(28px, 3.5vw, 60px);
  --card-pad-top: clamp(56px, 6vw, 96px);
  --space-quote-rule: 18px;     /* space under quote, above rule */
  --space-rule-meta: 8px;       /* space under rule, above meta */
}

.nf-testimonials__title {
  color: var(--nf-title);
  margin: 0 0 .8em;
  line-height: 1.05;
  padding: var(--nf-title-padding-block) var(--nf-title-padding-inline);
}

/* The Gutenberg Columns row is a flex container already.
   Stretch items so every column equals the tallest card. */
.nf-testimonials__grid {
  gap: var(--outer-gap);
  align-items: stretch !important;     /* equal-height columns */
}

/* --- Card --- */
.nf-tcard {
  position: relative;
  height: 100%;                       /* fill column height */
  background: var(--card-bg);
  border: 1px solid var(--card-bdr);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);

  /* 4-row grid guarantees alignment:
     row1=quote · row2=flex spacer · row3=rule · row4=meta  */
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  padding: var(--card-pad-top) var(--card-pad-x) var(--card-pad-x);
}

/* optional soft quotes graphic you already had */
.nf-tcard::before{
  content:"";
  position:absolute;

  left: calc(var(--card-pad-x) - 5px);
  top: clamp(10px, 1.4vw, 18px);
  width: 50px; height: 96px;
  background: url("../../assets/img/quotes.png") no-repeat center / contain;
  opacity:.95; pointer-events:none;
}

/* --- Quote in row 1 --- */
.nf-tcard__quote{
  margin: 0 0 var(--space-quote-rule) 0;   /* explicit spacing above spacer */
}

/* --- Rule in row 3 (same Y across cards) --- */
.nf-tcard__rule{
  grid-row: 3;                              /* lock position */
  margin: 0 0 var(--space-rule-meta) 0 !important;
  border: 0;
  border-top: 1px solid rgba(86,136,245,.35);
  height: 0;
  width: 100%;
}

/* --- Meta in row 4 --- */
.nf-tcard__meta{ grid-row: 4; margin: 0; }
.nf-tcard__name{
  margin: 0 0 0px 0 !important;                        /* tighter than default */
  font-weight: 700;

  color: var(--nf-title);
}
.nf-tcard__role{
  margin: 0;
  color: var(--nf-muted);
}

/* ====== Responsive touch-ups ====== */
@media (max-width: 1024px){
  .nf-testimonials__grid { gap: clamp(20px, 3vw, 28px); }
}

@media (max-width: 782px){
  .nf-tcard{
    padding: clamp(40px, 7vw, 56px) clamp(22px, 5vw, 28px);
    grid-template-rows: auto 1fr auto auto; /* unchanged, just explicit */
  }
  .nf-tcard__quote{ margin-bottom: 14px; }
  .nf-tcard__rule { margin-bottom: 6px !important; }
}








/* ===== Equal-height row + aligned rule/meta across cards ===== */

/* Use CSS Grid for the row so every column is the same height */
.nf-testimonials__grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 3.2vw, 40px); 
  align-items: stretch;                 /* grid items (columns) same height */
}

/* Columns fill their grid cell */
.nf-testimonials__grid > .wp-block-column {
  height: 100%;
  margin: 0;                            /* neutralize theme margins if any */
  min-width: 0;                         /* prevent content-driven overflow */
  width: auto !important;               /* neutralize editor/frontend inline widths */
  max-width: none !important;           /* avoid inherited constrained max-width */
  flex: initial !important;             /* avoid flex sizing from Columns block */
  flex-basis: auto !important;          /* avoid 33.33% + gap overflow cases */
}

/* Each card fills its column and uses 4-row grid:
   quote | 1fr spacer | rule | meta  */
.nf-tcard {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto auto;  /* KEY: aligns rule & meta */
  padding: clamp(56px, 6vw, 96px) clamp(28px, 3.5vw, 60px) clamp(28px, 3.5vw, 60px);
}

/* Quote (row 1) */
.nf-tcard__quote { margin: 0 0 18px 0; }

/* Separator forced to row 3, same Y on every card */
.nf-tcard__rule {
  grid-row: 3;
  margin: 0 0 8px 0 !important;
  border: 0;
  border-top: 1px solid rgba(86,136,245,.35);
  height: 0;
  width: 100%;
}

/* Meta (row 4) — tighten name ↔ role */
.nf-tcard__meta { grid-row: 4; margin: 0; }
.nf-tcard__name { margin: 0 0 2px 0; font-weight: 700; color: var(--wp--preset--color--blue-700, #467FF7); }
.nf-tcard__role { margin: 0; color: var(--nf-muted, #596480); }

/* Responsive: keep grid, just let it wrap to 2 → 1 columns */
@media (max-width: 1100px) {
  .nf-testimonials__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .nf-testimonials__grid { grid-template-columns: 1fr; }
  .nf-tcard { padding: clamp(40px, 7vw, 56px) clamp(22px, 5vw, 28px); }
  .nf-tcard__quote { margin-bottom: 14px; }
  .nf-tcard__rule  { margin-bottom: 6px !important; }
}




/* Remove the old card-level quote */
.nf-tcard::before { content: none !important; }

/* Anchor the quote mark to the quote paragraph */
.nf-tcard__quote { 
  position: relative; 
}

/* Quote icon: pinned near the top-left of the text block */
.nf-tcard__quote::before{
  content:"";
  position: absolute;
  /* place it slightly above & left of the first line */
  top: -3.4em;                     /* stays proportional to font size */
  left: -0.2em;
  width: clamp(34px, 4.6vw, 52px);
  height: clamp(34px, 4.6vw, 52px);
  background: url("../../assets/img/quotes.png")
              no-repeat center / contain;
  opacity: .95;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(22,53,120,.12));
}

/* Optional fine-tuning by breakpoint */
@media (max-width: 1024px){
  .nf-tcard__quote::before{ top: -3.5em; left: -0.2em; }
}
@media (max-width: 782px){
  .nf-tcard__quote::before{ top: -2.5em; left: -0.2em; }
}


/* Progressive enhancement: gradient fill via CSS mask */
@supports (mask-image: url("")) or (-webkit-mask-image: url("")) {
  .nf-tcard__quote::before{
    /* paint the gradient */
    background: linear-gradient(156.8deg, #5688F5 0%, #999BFF 28.06%, #9747FF 78.35%);

    /* use the PNG’s alpha as a mask */
    -webkit-mask-image: url("../../assets/img/quotes.png");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;

    mask-image: url("../../assets/img/quotes.png");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
  }
}


.noosfera-pattern--testimonials.nf-testimonials {
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 40px);
}

/* default: fluid up to container width */
.noosfera-pattern--testimonials .nf-testimonials__grid {
  width: 100%;                  /* important for centering */
  max-width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
}

/* ≥1141px viewport: cap the grid and keep it centered */
@media (min-width: 1141px) {
  .noosfera-pattern--testimonials .nf-testimonials__grid {
    max-width: 1141px !important;   /* beats the old inline, if still present */
    margin-inline: auto !important;
  }
}

/* ---------------------------------------------
 * Gutenberg editor safety overrides
 * Prevent card overflow inside editor Columns UI
 * ------------------------------------------ */
.editor-styles-wrapper .noosfera-pattern--testimonials .nf-testimonials__grid > .wp-block-column {
  height: auto !important;
  min-height: 0 !important;
}

.editor-styles-wrapper .noosfera-pattern--testimonials .nf-tcard {
  height: auto !important;
  min-height: 0 !important;
  grid-template-rows: auto auto auto !important;
}

.editor-styles-wrapper .noosfera-pattern--testimonials .nf-tcard__rule,
.editor-styles-wrapper .noosfera-pattern--testimonials .nf-tcard__meta {
  grid-row: auto !important;
}
