/* ==========================================================================
   rr-ui.css — Estilo común de tarjetas de rutasrurales.io
   --------------------------------------------------------------------------
   Copia el diseño de las tarjetas del hub de eventos (index/modules/
   hub-blocks.php → .hub-card) y lo aplica a las tarjetas "cercanas" de las
   fichas de lugar, evento y alojamiento (.nearby-card).

   Color por tipo de contenido (variable --rr-accent en el contenedor):
     alojamientos #2F5233 · eventos #3d2b6e · lugares #1a3a5c · actividades #b5541c

   Los selectores van con .nearby-grid delante y !important para ganar a
   lugar.css y a los <style> en línea de cada página.
   ========================================================================== */

:root {
  --rr-primary: #2F5233;
  --rr-text: #2d3436;
  --rr-text-l: #636e72;
  --rr-border: #e8eaed;
  --rr-radius: 14px;
  --rr-shadow: 0 2px 12px rgba(0,0,0,.07);
  --rr-shadow-h: 0 8px 20px rgba(0,0,0,.11);
}

/* ── Rejilla ─────────────────────────────────────────────────────────── */
.nearby-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
  gap: 18px !important;
  min-height: 0 !important;        /* la sección está oculta hasta que hay datos */
  align-items: stretch;
  align-content: start;
}
#nearby-alojamientos, #nearby-aloj-content { --rr-accent: #2F5233; }
#nearby-lugares, #nearby-lugares-content   { --rr-accent: #1a3a5c; }
#nearby-actividades, #nearby-activ-content { --rr-accent: #b5541c; }
#nearby-eventos-content, #similar-events   { --rr-accent: #3d2b6e; }

/* ── Tarjeta ─────────────────────────────────────────────────────────── */
.nearby-grid .nearby-card {
  position: relative;
  display: flex !important;
  flex-direction: column !important;
  background: #fff !important;
  border: 1.5px solid var(--rr-border) !important;
  border-radius: var(--rr-radius) !important;
  overflow: hidden !important;
  box-shadow: var(--rr-shadow) !important;
  color: var(--rr-text) !important;
  text-decoration: none !important;
  transition: transform .2s ease, box-shadow .2s ease !important;
  height: auto !important;
  min-height: 0 !important;
}
.nearby-grid .nearby-card:hover,
.nearby-grid .nearby-card:focus-visible {
  transform: translateY(-3px) !important;
  box-shadow: var(--rr-shadow-h) !important;
  color: var(--rr-text) !important;
}
.nearby-grid .nearby-card:focus-visible { outline: 2px solid var(--rr-accent, var(--rr-primary)); outline-offset: 2px; }

/* Imagen: siempre a todo el ancho, proporción fija 16:10 */
.nearby-grid .nearby-card-img {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 10;
  background: #f0f4f1 !important;
  overflow: hidden !important;
  flex-shrink: 0;
  margin: 0 !important;
}
.nearby-grid .nearby-card-img img,
.nearby-grid img.nearby-card-img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover !important;
  display: block !important;
  transition: transform .35s ease;
}
.nearby-grid .nearby-card:hover .nearby-card-img img { transform: scale(1.04); }
.nearby-grid .nearby-card-ph {
  height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; background: linear-gradient(135deg, #f0f4f1, #e3ece4);
}

/* Etiqueta sobre la foto (distancia), como la fecha en las de eventos */
.nearby-grid .nearby-card-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--rr-accent, var(--rr-primary));
  color: #fff;
  font-size: .72rem; font-weight: 800; letter-spacing: .02em;
  padding: 4px 9px; border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  text-transform: uppercase;
}

/* Cuerpo */
.nearby-grid .nearby-card-body {
  padding: 14px 16px 16px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px;
  flex-grow: 1;
}
.nearby-grid .nearby-card-loc {
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  color: var(--rr-accent, var(--rr-primary));
  text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nearby-grid .nearby-card-name,
.nearby-grid .nearby-card-title {
  font-size: .96rem !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
  color: var(--rr-text) !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: normal !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
  font-family: inherit !important;
}
.nearby-grid .nearby-card-desc {
  font-size: .8rem !important;
  color: var(--rr-text-l) !important;
  line-height: 1.5 !important;
  margin: 0 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
}
.nearby-grid .nearby-card-meta {
  font-size: .78rem !important;
  color: var(--rr-text-l) !important;
  margin: 0 !important;
}
.nearby-grid .nearby-card-price {
  margin-top: auto !important;
  padding-top: 8px;
  font-size: .8rem !important;
  font-weight: 700 !important;
  color: var(--rr-accent, var(--rr-primary)) !important;
}
.nearby-grid .nearby-card-price.is-free { color: #2e7d32 !important; }

/* Botones "Ver más" con el mismo aire */
.nearby-ver-mas,
.nearby-show-more button {
  display: inline-flex !important; align-items: center; gap: 6px;
  padding: 10px 22px !important;
  border-radius: 25px !important;
  border: 1.5px solid var(--rr-primary) !important;
  background: #fff !important;
  color: var(--rr-primary) !important;
  font-weight: 700 !important; font-size: .85rem !important;
  text-decoration: none !important;
  transition: background .18s ease, color .18s ease !important;
}
.nearby-ver-mas:hover,
.nearby-show-more button:hover { background: var(--rr-primary) !important; color: #fff !important; }

@media (max-width: 600px) {
  .nearby-grid { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
  .nearby-grid .nearby-card-body { padding: 10px 12px 12px !important; }
  .nearby-grid .nearby-card-name { font-size: .88rem !important; }
  .nearby-grid .nearby-card-desc { -webkit-line-clamp: 2; }
}
@media (max-width: 380px) {
  .nearby-grid { grid-template-columns: 1fr !important; }
}

@media (prefers-reduced-motion: reduce) {
  .nearby-grid .nearby-card,
  .nearby-grid .nearby-card-img img { transition: none !important; }
  .nearby-grid .nearby-card:hover { transform: none !important; }
  .nearby-grid .nearby-card:hover .nearby-card-img img { transform: none; }
}

/* Variantes de marcado antiguas (ficha de alojamiento) */
.nearby-grid .nearby-card-dist {
  position: absolute !important; top: 10px !important; left: 10px !important; right: auto !important; bottom: auto !important;
  background: var(--rr-accent, var(--rr-primary)) !important; color: #fff !important;
  font-size: .72rem !important; font-weight: 800 !important; letter-spacing: .02em;
  padding: 4px 9px !important; border-radius: 6px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.2); text-transform: uppercase;
}
.nearby-grid .nearby-card-img-placeholder {
  height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; background: linear-gradient(135deg, #f0f4f1, #e3ece4);
}
