/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  font-family: 'Montserrat', sans-serif;
  background-color: #f9f9f9;
  color: #222;
  line-height: 1.5;
}

/* ===== Secci車n de bienvenida ===== */
.seccion-bienvenida {
  width: 100%; /* antes 100vw -> pod赤a provocar scroll horizontal */
  background: linear-gradient(90deg, #fdf7f0 0%, #fff 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px 0;
}
.contenido-bienvenida {
  width: 100%; max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; padding: 1rem;
}
.texto-bienvenida { flex: 1 1 500px; padding: 1rem; }
.texto-bienvenida h2 { font-size: 2.4rem; color: #8B3A3A; margin-bottom: 1.2rem; font-weight: 700; }
.texto-bienvenida p  { font-size: 1.15rem; color: #444; margin-bottom: 1.2rem; text-align: justify; }

.btn-bienvenida {
  display: inline-block; background: #8B3A3A; color: #fff;
  padding: 12px 25px; border-radius: 8px; font-weight: 600; font-size: 1rem;
  text-decoration: none; transition: background-color .2s ease;
}
.btn-bienvenida:hover { background-color: #732e2e; }

.imagen-bienvenida { flex: 1 1 500px; text-align: center; }
.imagen-bienvenida img {
  width: 100%; max-width: 500px; max-height: 350px; object-fit: cover;
  border-radius: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.15); display: block; margin: auto;
}

/* Responsive bienvenida */
@media (max-width: 900px) {
  .contenido-bienvenida { flex-direction: column; text-align: center; }
  .texto-bienvenida { padding: 0; }
  .imagen-bienvenida img { max-width: 90%; }
  .texto-bienvenida h2 { font-size: 2rem; }
  .texto-bienvenida p  { font-size: 1rem; }
}

/* ===== T赤tulos ===== */
.title-section {
  text-align: center;
  font-size: 2rem;
  margin: 26px auto 18px; /* <-- este margen controla el espacio */
  color: #732e2e;
  padding: .5rem;
}


/* ===== Grid de tarjetas ===== */
/* ===== Grid de tarjetas ===== */
.row-cards {
  display: grid;
  gap: 20px;                         /* un poco menos espacio entre cards */
  grid-template-columns: repeat(3, minmax(0, 1fr));  /* 3 por fila en desktop */
  max-width: 1200px;
  margin: 0 auto 24px;
  padding: 0 12px;
}

/* 2 por fila en tablets */
@media (max-width: 1024px) {
  .row-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 1 por fila en m車viles */
@media (max-width: 640px) {
  .row-cards { grid-template-columns: 1fr; }
}


/* ===== Card ===== */
.card {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* sin width fija: el grid controla el ancho */
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,.12); }

.card-img-top {
  width: 100%;
  height: 230px;           /* altura uniforme */
  object-fit: cover;
  background: #f3f3f3;
  display: block;
}

.card-body {
  width: 100%;
  padding: 12px 14px;
  background-color: #f7f7f7;
  text-align: left;
}

.card-text {
  font-size: 1.08rem;
  font-weight: 800;
  color: #111;
  margin-bottom: 6px;
}
.card-text strong { display: block; margin-bottom: 4px; }

/* ===== Descripci車n con truncado ===== */
.card-text-des {
  margin: 4px 0 10px;
  font-size: 1rem;
  color: #000;

  /* Evita desbordes */
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;

  /* Fallback por altura (4 l赤neas aprox con line-height:1.4) */
  line-height: 1.4;
  max-height: calc(1.4em * 4);

  /* Truncado elegante si est芍 disponible */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

/* ===== Bot車n card ===== */
.button-card {
  margin: 0 12px 12px;
  padding: 10px 12px;
  width: auto;
  text-align: center;
  background-color: #B85050;
  color: white;
  text-decoration: none;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 8px;
  transition: background .2s ease, transform .2s ease;
}
.button-card:hover { background-color: #a03f3f; transform: translateY(-2px); }

/* ===== Utilidades / opcional (paginaci車n, etc.) ===== */
.paginacion {
  display: flex; gap: 8px; justify-content: center; align-items: center;
  margin: 10px 0 28px; padding: 0 12px; flex-wrap: wrap;
}
.pagina-enlace {
  min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px; background: #fff; border: 1px solid #ddd; border-radius: 8px;
  color: #8B3A3A; text-decoration: none; font-weight: 700;
}
.pagina-enlace:hover { background: #f7ecec; }
.pagina-enlace.activa { background: #8B3A3A; color: #fff; border-color: #8B3A3A; }

/* ===== Responsive cards ===== */
@media (max-width: 700px) {
  .card-img-top { height: 200px; }
}
/* ==== HOTFIX: noticias que se salen del margen ==== */

/* 1) Asegura que nada provoque scroll horizontal accidental */
html, body { overflow-x: hidden; }

/* 2) Fuerza el salto de palabras muy largas dentro de la secci車n de noticias */
.noticias,               /* si envuelves noticias_home.php en <section class="noticias"> */
.noticias-home,          /* alias opcional */
.noticia,                /* item */
.noticia-card,
.noticia-contenido,
.noticia-resumen,
.noticia-texto,
.noticia-body,
.noticias p {            /* p sueltos que vengan del include */
  max-width: 1200px;     /* mismo ancho de tu layout */
  margin-left: auto;
  margin-right: auto;
  padding: 0 12px;

  /* Lo importante para cortar palabras sin espacios: */
  white-space: normal;
  overflow-wrap: anywhere;  /* est芍ndar actual */
  word-break: break-word;   /* fallback */
  /* Para navegadores muy viejos: */
  word-wrap: break-word;

  /* Opcional: mejor lectura */
  text-align: justify;
  line-height: 1.6;
}

/* 3) Si quieres truncar los res迆menes a 4 l赤neas (opcional) */
.noticia-resumen, .noticia-texto {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 4) Im芍genes de noticias siempre responsivas */
.noticias img, .noticia img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  margin: 0 auto;
}
