/*
  Blog — Terrazas San Cristóbal
  Estilos según diseño: fondo beige, título marrón, botón morado, tarjetas blancas, paginación circular.
*/

/* --- Variables (colores del diseño, homologados con front-page) --- */
:root {
  --blog-fondo: #ebe6df;
  --blog-titulo: #450E15;
  --blog-subtitulo: #6b5b62;
  --blog-btn-morado: #5c4d6b;
  --blog-btn-morado-hover: #4a3f56;
  --blog-card-bg: #fff;
  --blog-texto: #333;
  --blog-texto-suave: #666;
  /* Mismas variables que .blog-section en styles.css */
  --color-coffe: #450E15;
  --color-purple: #432E6F;
  --color-yellow-dark: #FFA105;
  --color-white: #FAFAFA;
}

/* --- Contenedor blog (zona central completa) --- */
#zona-central.blog {
  padding: 0;
  padding-bottom: 4rem;
  min-height: 0;
  background-color: #F5E9CE;
}

.blog .contenedor {
  max-width: 75rem;
  margin-left: auto;
  margin-right: auto;
}

.blog-contenido {
  padding: 1.5rem 1.5rem 2rem;
}

/* --- Hero / Banner --- */
.blog-hero {
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
  overflow: hidden;
}

.blog-hero img {
  width: 100%;
  height: auto;
  max-height: 22rem;
  object-fit: cover;
  display: block;
}

/* --- Título y subtítulo --- */
.blog-titulo {
  margin: 0 0 0.5rem;
  font-family: 'Lora', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: #450E15;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.blog-subtitulo {
  margin: 3rem 0 2rem;
  font-family: 'Gotham', 'Gotham Book', Arial, sans-serif;
  font-size: 18px;
  color: var(--blog-subtitulo);
  text-align: center;
}

/* --- Filtros --- */
.blog-filtros {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 50px;
}

.filtro-mobile-trigger {
  display: none;
}

.filtro-mobile-panel-inner {
  display: contents;
}

.filtros-selectores {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 2.25rem;
}

.filtro-grupo {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filtros-selectores .filtro-grupo label {
  font-family: 'Gotham', 'Gotham Book', Arial, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #450E15;
  margin: 0;
}

/* Select nativo oculto (se mantiene para sincronizar valor y disparar change) */
.filtro-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.filtro-select-wrap {
  position: relative;
  width: 200px;
}

/* Botón que imita el input (mismo estilo) */
.filtro-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 45px;
  padding: 0 1.5rem;
  font-family: 'Gotham', 'Gotham Book', Arial, sans-serif;
  font-size: 0.9375rem;
  color: #777;
  text-align: left;
  background-color: #fff;
  border: none;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(69, 14, 21, 0.08);
  cursor: pointer;
  box-sizing: border-box;
}

.filtro-select-trigger:hover {
  color: #555;
}

.filtro-select-text {
  flex: 1;
  min-width: 0;
}

.filtro-select-flecha {
  flex-shrink: 0;
  margin-left: 0.5rem;
  transition: transform 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filtro-select-flecha svg {
  display: block;
}

.filtro-select-wrap.open .filtro-select-flecha {
  transform: rotate(180deg);
}

/* Lista desplegable (estilo similar al input) */
.filtro-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 220px;
  overflow-y: auto;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(69, 14, 21, 0.12);
  display: none;
}

.filtro-select-wrap.open .filtro-select-dropdown {
  display: block;
}

.filtro-select-option {
  padding: 0.65rem 1rem;
  font-family: 'Gotham', 'Gotham Book', Arial, sans-serif;
  font-size: 0.9375rem;
  color: #777;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.filtro-select-option:first-child {
  border-radius: 10px 10px 0 0;
}

.filtro-select-option:last-child {
  border-radius: 0 0 10px 10px;
}

.filtro-select-option:hover {
  background: rgba(69, 14, 21, 0.06);
  color: #450E15;
}

.btn-limpiar-filtro {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 52px;
  padding: 0;
  font-family: 'Gotham', 'Gotham Book', Arial, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #FFF;
  text-align: center;
  background: #432E6F;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-limpiar-filtro:hover {
  background: #450E15;
}

.btn-limpiar-filtro:focus {
  outline: 2px solid var(--blog-titulo);
  outline-offset: 2px;
}

/* --- Listado de entradas (grid 3 columnas en escritorio) --- */
.blog-listado {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.blog-listado > * {
  min-width: 0;
}

.entrada-blog {
  flex: 1 1 100%;
  max-width: 100%;
}

.entrada-blog[hidden] {
  display: none;
}

/* --- Cards homologadas con .blog-card de front-page (styles.css) --- */
.entrada-enlace {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  color: inherit;
  text-decoration: none;
  background-color: var(--color-white);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.entrada-enlace:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.entrada-enlace:focus {
  outline: 2px solid var(--blog-titulo);
  outline-offset: 2px;
}

.entrada-imagen {
  position: relative;
  width: 100%;
  padding-top: 75%;
  overflow: hidden;
  background: #eee;
}

.entrada-imagen img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Fecha sobre la imagen (igual que .blog-card-date en front-page) */
.entrada-imagen .entrada-fecha {
  position: absolute;
  bottom: 15px;
  left: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.entrada-fecha-icon {
  width: 40px;
  height: 40px;
  background-color: var(--color-yellow-dark);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.entrada-fecha-icon svg {
  width: 18px;
  height: 18px;
}

.entrada-fecha-text {
  font-family: 'Gotham', 'Gotham Book', Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-white);
  line-height: 21px;
}

.entrada-cuerpo {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 25px;
}

.entrada-titulo {
  margin: 0 0 15px 0;
  font-family: 'Lora', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  color: #000000;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entrada-enlace:hover .entrada-titulo {
  text-decoration: none;
}

.entrada-extracto {
  margin: 0 0 20px 0;
  font-family: 'Gotham', 'Gotham Book', Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: #666;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entrada-divider {
  width: 100%;
  height: 2px;
  background-color: #D1D5DB;
  margin: 0 0 15px 0;
}

.entrada-leer-mas {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Gotham', 'Gotham Book', Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-coffe);
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.3s ease;
}

.entrada-enlace:hover .entrada-leer-mas {
  color: var(--color-purple);
}

.entrada-leer-mas svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.entrada-enlace:hover .entrada-leer-mas svg {
  transform: translateX(4px);
}

/* --- Paginación (flechas + números en círculos) --- */
.blog-paginacion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.btn-pagina {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  font-family: inherit;
  color: #fff;
  background: #450E15;
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(69, 14, 21, 0.25);
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.btn-pagina:hover:not(:disabled) {
  background: #450E15;
  box-shadow: 0 3px 10px rgba(69, 14, 21, 0.35);
}

.btn-pagina:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-pagina:focus {
  outline: 2px solid var(--blog-titulo);
  outline-offset: 2px;
}

.paginacion-flecha {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.paginacion-flecha img {
  display: block;
  flex-shrink: 0;
}

.paginacion-flecha--adelante img {
  transform: rotate(180deg);
}

.paginacion-numeros {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-numero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--blog-titulo);
  background: #FFF;
  border: 1px solid #FFF;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-numero:hover {
  background: rgba(69, 14, 21, 0.8);
  border-color: var(--blog-titulo);
  color: #FFF;
}

.btn-numero.activo {
  background: #450E15;
  color: #fff;
  border-color: var(--blog-titulo);
}

.btn-numero:focus {
  outline: none;
  outline-offset: 2px;
}

/* --- Breakpoints --- */

@media (min-width: 40rem) {
  .blog-contenido {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .blog-titulo {
    font-size: 64px;
    padding: 2rem 0 0;
  }

  .filtro-mobile-trigger {
    display: none;
  }

  .filtro-mobile-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    position: static;
    background: transparent;
    padding: 0;
    flex: 1;
    min-width: 0;
  }

  .filtro-mobile-panel-inner {
    display: contents;
  }

  .entrada-blog {
    flex: 1 1 calc(50% - 0.75rem);
    max-width: calc(50% - 0.75rem);
  }

  .blog-hero img {
    max-height: 28rem;
  }
}

@media (min-width: 64rem) {
  .blog-listado {
    gap: 2rem;
  }

  .entrada-blog {
    flex: 1 1 calc(33.333% - 1.334rem);
    max-width: calc(33.333% - 1.334rem);
  }

  .entrada-cuerpo {
    padding: 30px;
  }

  .entrada-titulo {
    font-size: 24px;
  }

  .blog-hero img {
    max-height: 26rem;
  }
}

@media (min-width: 90rem) {
  .blog-contenido {
    padding-bottom: 4rem;
  }
}

/* --- Solo mobile --- */
@media (max-width: 39.9375rem) {
  .blog-hero {
    height: 400px;
  }

  .blog-hero img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: top center;
  }

  /* Filtros: barra "Filtrar por:" + icono; al clic se despliega panel */
  .filtro-mobile-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    font-family: 'Gotham', 'Gotham Book', Arial, sans-serif;
    font-size: 17px;
    color: #777;
    text-align: left;
    background: #fff;
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(69, 14, 21, 0.08);
    cursor: pointer;
    margin-bottom: 1rem;
  }

  .filtro-mobile-trigger-icon {
    flex-shrink: 0;
    width: 25px;
    height: 20px;
  }

  .filtro-mobile-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }

  .blog-filtros.filtros-mobile-open .filtro-mobile-panel {
    display: flex;
  }

  .filtro-mobile-panel-inner {
    display: block;
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }

  .filtro-mobile-panel .filtros-selectores {
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
    width: 100%;
  }

  .filtro-mobile-panel .filtro-grupo {
    width: 100%;
  }

  .filtro-mobile-panel .filtro-select-wrap {
    width: 100%;
  }

  .filtro-mobile-panel .filtro-select-trigger {
    width: 100%;
    box-sizing: border-box;
  }
}
