/* ============================================================
   cx-bento — Mixed-size animated grid (vanilla port of bento-grid-01)
   Used in /recursos/quienes-somos/ and partner-style landings.
   ============================================================ */

.cx-bento {
  --cx-bento-bg: var(--cx-bg, #f9fbfc);
  --cx-bento-card: var(--cx-card, #fff);
  --cx-bento-line: var(--cx-line, #e0e5e9);
  --cx-bento-ink: var(--cx-ink, #021521);
  --cx-bento-mute: var(--cx-ink-soft, #47555d);
  --cx-bento-accent: var(--cx-blue, #00828c);

  padding: 64px 16px 80px;
  background: var(--cx-bento-bg);
}

.cx-bento__wrap {
  max-width: 1180px;
  margin: 0 auto;
}

.cx-bento__head {
  margin: 0 0 36px;
}

.cx-bento__eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cx-bento-mute);
  margin-bottom: 10px;
}

.cx-bento__title {
  margin: 0;
  font-size: clamp(1.7rem, 3vw + .3rem, 2.4rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--cx-bento-ink);
}

.cx-bento__sub {
  margin: 10px 0 0;
  color: var(--cx-bento-mute);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 640px;
}

/* ---------- Grid ---------- */

.cx-bento__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  /* minmax en vez de 200px fijo: la celda crece si el texto es más largo (p.ej. en inglés,
     que es más largo que el español) → no se corta. Mantiene el mínimo de 200px. */
  grid-auto-rows: minmax(200px, auto);
}

@media (min-width: 720px) {
  .cx-bento__grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
  }
}

/* ---------- Card ---------- */

.cx-bento__card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 22px;
  background: var(--cx-bento-card);
  border: 1px solid var(--cx-bento-line);
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  transition:
    transform .35s cubic-bezier(.34, 1.56, .64, 1),
    box-shadow .35s ease,
    border-color .25s ease,
    background .25s ease;
  cursor: default;
  opacity: 0;
  transform: translateY(22px);
  will-change: transform, opacity;
}

.cx-bento__card.is-in {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity .55s cubic-bezier(.4, 0, .2, 1),
    transform .55s cubic-bezier(.4, 0, .2, 1),
    box-shadow .35s ease,
    border-color .25s ease,
    background .25s ease;
}

.cx-bento__card:hover {
  border-color: rgba(28,164,175, .35);
  box-shadow:
    0 1px 2px rgba(2,21,33, .04),
    0 16px 40px -16px rgba(2,21,33, .18);
}

a.cx-bento__card { cursor: pointer; }
a.cx-bento__card:hover { transform: translateY(-2px); }

/* Span helpers — desktop only */
@media (min-width: 720px) {
  .cx-bento__card--2 { grid-column: span 2; }
  .cx-bento__card--3 { grid-column: span 3; }
  .cx-bento__card--4 { grid-column: span 4; }
  .cx-bento__card--6 { grid-column: span 6; }
  .cx-bento__card--tall { grid-row: span 2; }
}

/* ---------- Visual area (top) ---------- */

.cx-bento__visual {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 -6px 14px;
  min-height: 120px;
}

/* ---------- Card content (bottom) ---------- */

.cx-bento__card-h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.005em;
  color: var(--cx-bento-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cx-bento__card-h3 svg { width: 18px; height: 18px; }

.cx-bento__card-p {
  margin: 6px 0 0;
  font-size: .88rem;
  line-height: 1.55;
  color: var(--cx-bento-mute);
}

/* ============================================================
   Visual modules — each card type has its own scene
   ============================================================ */

/* 1. Big number pulse (TypeTester-style) */
.cx-bento-number {
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  background: linear-gradient(135deg, var(--cx-bento-accent), #1ca4af);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: cxBentoPulse 4s ease-in-out infinite;
  display: inline-block;
}

.cx-bento-number--gold {
  background: linear-gradient(135deg, #986700, #f5c674);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes cxBentoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* 2. Speed loader → number (SpeedIndicator-style) */
.cx-bento-speed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.cx-bento-speed__display {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
}

.cx-bento-speed__loader {
  width: 96px;
  height: 26px;
  border-radius: 6px;
  background: rgba(28,164,175, .12);
  animation: cxBentoLoaderPulse 1.2s ease-in-out infinite;
}

.cx-bento-speed.is-loaded .cx-bento-speed__loader { display: none; }

.cx-bento-speed__value {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--cx-bento-ink);
  opacity: 0;
  transform: translateY(12px);
  filter: blur(4px);
  transition: opacity .55s ease, transform .55s ease, filter .55s ease;
}

.cx-bento-speed.is-loaded .cx-bento-speed__value {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.cx-bento-speed__bar {
  width: 80%;
  max-width: 160px;
  height: 5px;
  background: rgba(28,164,175, .1);
  border-radius: 999px;
  overflow: hidden;
}

.cx-bento-speed__bar::after {
  content: "";
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cx-bento-accent), #1ca4af);
  border-radius: 999px;
  transition: width 1.4s cubic-bezier(.34, 1.56, .64, 1);
}

.cx-bento-speed.is-loaded .cx-bento-speed__bar::after { width: 100%; }

@keyframes cxBentoLoaderPulse {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}

/* 3. Shield badges (SecurityBadge-style) */
.cx-bento-shields {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.cx-bento-shield {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(28,164,175, .08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(28,164,175, .45);
  transition: background .3s ease, color .3s ease, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}

.cx-bento-shield.is-on {
  background: var(--cx-bento-accent);
  color: #fff;
  transform: scale(1.08);
}

.cx-bento-shield svg { width: 20px; height: 20px; }

/* 4. Global network (GlobalNetwork-style — concentric pulses) */
.cx-bento-globe {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cx-bento-globe__icon {
  z-index: 2;
  width: 60px;
  height: 60px;
  color: var(--cx-bento-accent);
}

.cx-bento-globe__pulse {
  position: absolute;
  inset: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border: 2px solid rgba(28,164,175, .45);
  border-radius: 50%;
  opacity: 0;
  animation: cxBentoPulseRing 3s ease-out infinite;
}

.cx-bento-globe__pulse:nth-child(2) { animation-delay: .6s; }
.cx-bento-globe__pulse:nth-child(3) { animation-delay: 1.2s; }
.cx-bento-globe__pulse:nth-child(4) { animation-delay: 1.8s; }
.cx-bento-globe__pulse:nth-child(5) { animation-delay: 2.4s; }

@keyframes cxBentoPulseRing {
  0%   { transform: scale(.5); opacity: 1; }
  100% { transform: scale(3);  opacity: 0; }
}

/* 5. Partner grid (LayoutAnimation-style — small reshuffling cells) */
.cx-bento-grid-anim {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 140px;
  transition: grid-template-columns .55s cubic-bezier(.34, 1.56, .64, 1);
}

.cx-bento-grid-anim.is-stage-2 { grid-template-columns: repeat(2, 1fr); }
.cx-bento-grid-anim.is-stage-3 { grid-template-columns: repeat(3, 1fr); }

.cx-bento-grid-anim__cell {
  height: 22px;
  background: linear-gradient(135deg, rgba(28,164,175, .18), rgba(28,164,175, .12));
  border-radius: 5px;
  transition: all .55s cubic-bezier(.34, 1.56, .64, 1);
}

/* 6. Badge list (sellos certificaciones) */
.cx-bento-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.cx-bento-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(28,164,175, .08);
  border: 1px solid rgba(28,164,175, .18);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cx-bento-accent);
  white-space: nowrap;
}

.cx-bento-badge::before {
  content: "✓";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cx-bento-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Dark mode ---------- */

html[data-theme="dark"] .cx-bento {
  --cx-bento-bg: var(--cx-bg, #021521);
  --cx-bento-card: var(--cx-bg-soft, #0a1e2a);
  --cx-bento-line: var(--cx-line, #1c3542);
  --cx-bento-ink: var(--cx-ink, #f1f4f6);
  --cx-bento-mute: var(--cx-mute, #aab2b8);
}

html[data-theme="dark"] .cx-bento__card:hover {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, .4),
    0 16px 40px -16px rgba(0, 0, 0, .6);
}

html[data-theme="dark"] .cx-bento-speed__loader { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .cx-bento-shield { background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .35); }
html[data-theme="dark"] .cx-bento-badge { background: rgba(28,164,175, .12); border-color: rgba(28,164,175, .25); color: #85cad0; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .cx-bento__card { transition-duration: .25s; }
  .cx-bento-number,
  .cx-bento-globe__pulse,
  .cx-bento-speed__loader { animation: none; }
  .cx-bento-grid-anim { transition-duration: .2s; }
}
