/* =========================
   VALUES GRID
   Two rows of two: Misión/Visión (short statements) sit above
   Política integrada/Política de quejas y reclamos (longer, "Ver más"
   content). The pairing is deliberate — each row groups cards of similar
   length, so grid stretch never forces a short card to awkwardly match a
   much taller one.
========================= */
.tsm-values-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  width: 100%;
  align-items: stretch;
  margin-bottom: 50px;
}

/* Values are authored as raw text, but they still come out wrapped in <p> on
   the front end: core's do_blocks() re-registers wpautop (wp-includes/
   blocks.php) after Assets::disableAutop() removed it, and it runs over this
   shortcode's assembled output. An empty <p></p> falls out of that pass.

   Scoped to :empty deliberately. A blanket `.tsm-values-grid p` also swallowed
   every REAL paragraph, so a multi-paragraph value (Panamá's "Política de
   quejas y reclamos" is the first) rendered as an empty card AND — since the
   hidden text never grew the box — never tripped values.js's overflow check,
   so "Ver más" never appeared either. The text was simply gone, with no
   visible symptom. The client edits these in wp-admin, where pasting several
   paragraphs is the obvious thing to do, so the blanket rule was a standing
   trap. Blank gaps belong in the content, not the stylesheet: a value holding
   a spacer line (a bare "&nbsp;") should have it removed at the source. */
.tsm-values-grid p:empty {
  display: none;
}

@media (min-width: 700px) {
  .tsm-values-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }
}

/* Mobile */
@media (max-width: 900px) {
  .tsm-value-card {
    padding: 28px 24px;
  }

  .tsm-value-title {
    font-size: 18px;
    margin-bottom: 18px;
    line-height: 1.3;
  }

  .tsm-value-content {
    font-size: 14px;
    line-height: 1.65;
    max-height: calc(1.65em * 6);
  }

  .tsm-value-modal-content {
    padding: 40px 30px;
    width: 95%;
  }

  .tsm-value-modal-title {
    font-size: 24px;
    margin-bottom: 20px;
  }

  .tsm-value-modal-body {
    font-size: 16px;
    line-height: 28px;
  }

  .tsm-value-modal-close {
    top: 15px;
    right: 20px;
    font-size: 32px;
  }
}

@media (max-width: 600px) {
  .tsm-values-grid {
    gap: 16px;
  }

  .tsm-value-card {
    padding: 24px 20px;
    border-radius: 24px;
  }

  .tsm-value-icon {
    width: 48px;
    height: 6px;
    margin-bottom: 12px;
  }

  .tsm-value-title {
    font-size: 18px;
    margin-bottom: 18px;
  }

  .tsm-value-content {
    font-size: 14px;
  }

  .tsm-value-modal-content {
    padding: 30px 20px;
    border-radius: 24px;
  }

  .tsm-value-modal-title {
    font-size: 20px;
  }

  .tsm-value-modal-body {
    font-size: 14px;
    line-height: 24px;
  }
}

.tsm-value-card {
  background: #f7f7f7;
  border-radius: 28px;
  padding: 40px 36px;
  text-align: left;
  position: relative;
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition: all 0.3s ease;
  will-change: transform, box-shadow;
}

.tsm-value-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.tsm-value-icon {
  width: 50px;
  height: 6px;
  margin-bottom: 12px;
  background: #191919;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}

.tsm-value-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #191919;
  line-height: 1.3;
}

.tsm-value-content {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.7;
  /* #5c5c5c replaces the old #191919a1 (~2.9:1 on #f7f7f7) to clear the
     4.5:1 AA body-text minimum; see docs/CLAUDE/architecture.md's design
     notes for the same fix elsewhere on the site. */
  color: #5c5c5c;
  flex: 1;
  overflow: hidden;
  position: relative;
  /* Clamps to ~7 lines so a hard cutoff never lands mid-word — the fade
     below softens the edge, and "Ver más" (wired up in values.js) only
     shows once content genuinely exceeds this height. */
  max-height: calc(1.7em * 7);
  padding-bottom: 5px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
}

.tsm-value-content::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: linear-gradient(to bottom, transparent, #f7f7f7);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tsm-value-card.has-overflow .tsm-value-content::after {
  opacity: 1;
}

.tsm-value-content p {
  margin: 0 0 12px 0;
}

.tsm-value-content ul {
  margin: 4px 0 0;
  padding-left: 20px;
}

.tsm-value-content li {
  margin-bottom: 8px;
}

.tsm-value-content li:last-child {
  margin-bottom: 0;
}

.tsm-value-content p:last-child {
  margin-bottom: 0;
}

.tsm-values-section {
  background: white;
}

/* More Button */
.tsm-value-more-btn {
  background: transparent;
  border: none;
  color: #191919;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: opacity 0.3s ease;
  margin-top: 20px;
  text-decoration: underline;
}

.tsm-value-more-btn:hover {
  opacity: 0.7;
}

/* Modal */
.tsm-value-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}

.tsm-value-modal.active {
  display: flex;
}

.tsm-value-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.tsm-value-modal-content {
  position: relative;
  background: #f7f7f7;
  border-radius: 37px;
  padding: 50px 60px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 10000;
  animation: modalFadeIn 0.3s ease;
  margin: 0;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.tsm-value-modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: transparent;
  border: none;
  font-size: 40px;
  color: #191919;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.tsm-value-modal-close:hover {
  opacity: 0.6;
}

.tsm-value-modal-title {
  font-size: 32px;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 30px;
  color: #191919;
  line-height: 1.3;
}

.tsm-value-modal-body {
  font-size: 18px;
  font-weight: 500;
  line-height: 32px;
  color: #5c5c5c;
}

/* Same empty <p> artifact as .tsm-values-grid (see note above) — the modal
   copies content.innerHTML verbatim, so it inherits it too. Also :empty: the
   modal is exactly where a long multi-paragraph value gets read in full, so
   hiding real paragraphs here emptied the "Ver más" dialog as well. */
.tsm-value-modal-body p:empty {
  display: none;
}

.tsm-value-modal-body p {
  margin: 0 0 16px 0;
}

.tsm-value-modal-body p:last-child {
  margin-bottom: 0;
}
