/* =========================================================
   Vejez Digna - Estilos personalizados complementarios
   Tailwind se carga vía CDN; aquí agregamos utilidades y
   componentes reutilizables que no se pueden expresar
   cómodamente en clases utilitarias.
   ========================================================= */

/* Evitar scroll horizontal accidental en cualquier pantalla */
html, body { max-width: 100%; overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }
img { max-width: 100%; height: auto; }

/* Scroll offset para anclas (respeta la navbar fija) */
section[id] { scroll-margin-top: 80px; }
@media (min-width: 1024px) { section[id] { scroll-margin-top: 100px; } }

/* ---------- Navbar links ---------- */
.nav-link {
  position: relative;
  padding-bottom: 4px;
  transition: color .2s ease;
}
.nav-link:hover { color: #c9a96a; }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 3px;
  background: #c9a96a;
  border-radius: 2px;
}

/* ---------- Tarjetas de servicio con imagen de fondo (Hero-Servicios) ---------- */
.service-card {
  position: relative;
  min-height: 140px;
  border-radius: 1rem;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  transition: transform .35s ease, box-shadow .35s ease;
}
.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px -10px rgba(31,71,87,.35);
}
.service-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(31,71,87,.15) 0%, rgba(31,71,87,.85) 100%);
}

/* ---------- Tarjetas de servicio "detalle" (grid 4 cols) ---------- */
.service-item {
  background: #fff;
  border: 1px solid #dde8eb;
  border-radius: 1rem;
  padding: 1.75rem 1.5rem;
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.service-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 35px -15px rgba(31,71,87,.25);
  border-color: #c9a96a;
}
.service-icon {
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  background: #fbf7ef;
  color: #a6842f;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .5rem;
  transition: background .3s ease, color .3s ease;
}
.service-item:hover .service-icon {
  background: #c9a96a;
  color: #fff;
}
.service-title {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 1.35rem;
  color: #1f4757;
}
.service-desc {
  color: #305867;
  font-size: .95rem;
  line-height: 1.55;
}
.service-link {
  margin-top: .5rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: #a6842f;
  font-weight: 600;
  font-size: .9rem;
}

/* ---------- Testimonios ---------- */
.testimonial {
  background: #fff;
  border-radius: 1.25rem;
  padding: 2rem;
  box-shadow: 0 10px 30px -15px rgba(31,71,87,.2);
  transition: transform .3s ease;
}
.testimonial:hover { transform: translateY(-4px); }

/* ---------- Blog cards ---------- */
.post-card {
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid #e5edef;
  transition: transform .3s ease, box-shadow .3s ease;
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 35px -15px rgba(31,71,87,.25);
}
.post-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.post-body { padding: 1.25rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.post-tag {
  align-self: flex-start;
  background: #fbf7ef;
  color: #a6842f;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .25rem .6rem;
  border-radius: 9999px;
}
.post-title {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  color: #1f4757;
  font-size: 1.1rem;
  line-height: 1.35;
}
.post-date { color: #6b8490; font-size: .85rem; }
.post-link {
  margin-top: auto;
  color: #a6842f;
  font-weight: 600;
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.post-link:hover { color: #614c1e; }

/* ---------- Stats / contadores ---------- */
.stat { padding: 1rem; }

/* ---------- Botones de redes sociales (icono circular) ---------- */
.social-btn {
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: background-color .25s ease, transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.social-btn img { transition: transform .25s ease; }
.social-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #c8a96a;
  transform: translateY(-3px);
  box-shadow: 0 10px 20px -8px rgba(0, 0, 0, 0.35);
}
.social-btn:hover img { transform: scale(1.08); }

/* ---------- Navbar semi-transparente al hacer scroll ---------- */
#navbar.is-transparent {
  background-color: rgba(255, 255, 255, 0.55) !important;
  backdrop-filter: blur(14px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(14px) saturate(140%) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  box-shadow: 0 8px 24px -12px rgba(31, 71, 87, 0.18) !important;
}

/* ---------- Tarjetas de reflexión (Misión/Valores) ---------- */
.reflection-card {
  position: relative;
  background: #fff;
  border-radius: 1.25rem;
  padding: 2rem 1.5rem 1.75rem;
  text-align: center;
  border: 1px solid rgba(200, 169, 106, 0.2);
  box-shadow: 0 6px 20px -12px rgba(31, 71, 87, 0.18);
  transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
  overflow: hidden;
}
.reflection-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #c8a96a 0%, #e9d39c 50%, #c8a96a 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .5s ease;
}
.reflection-card:hover {
  transform: translateY(-6px);
  border-color: #c8a96a;
  box-shadow: 0 20px 40px -20px rgba(31, 71, 87, 0.3);
}
.reflection-card:hover::before { transform: scaleX(1); }
.reflection-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 1.1rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fbf7ef 0%, #f4ead1 100%);
  color: #a6842f;
  box-shadow: 0 4px 14px -4px rgba(200, 169, 106, 0.5);
  transition: transform .35s ease;
}
.reflection-card:hover .reflection-icon { transform: scale(1.08) rotate(-4deg); }
.reflection-title {
  font-weight: 600;
  color: #1f4757;
  font-size: 1.02rem;
  line-height: 1.45;
  margin-bottom: .75rem;
}
.reflection-quote {
  color: #547e8b;
  font-size: .9rem;
  font-style: italic;
  padding-top: .75rem;
  border-top: 1px dashed rgba(200, 169, 106, 0.35);
}

/* ---------- Tarjetas de "Cómo ayudar" (opciones rápidas) ---------- */
.help-card {
  position: relative;
  background: #fff;
  border: 2px solid rgba(31, 71, 87, 0.08);
  border-radius: 1.25rem;
  padding: 1.75rem 1.5rem;
  text-align: left;
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.help-card:hover {
  transform: translateY(-6px);
  border-color: #c8a96a;
  box-shadow: 0 20px 40px -20px rgba(31, 71, 87, 0.25);
}
.help-card.is-active {
  border-color: #c8a96a;
  box-shadow: 0 0 0 4px rgba(200, 169, 106, 0.18), 0 20px 40px -20px rgba(31, 71, 87, 0.25);
}
.help-card-icon {
  width: 58px;
  height: 58px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .25rem;
}
.help-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f4757;
}
.help-card-desc {
  color: #3b5a66;
  font-size: .95rem;
  line-height: 1.5;
  flex: 1;
}
.help-card-cta {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: #c8a96a;
  font-weight: 600;
  font-size: .9rem;
  margin-top: .5rem;
}
.help-card:hover .help-card-cta { color: #b8985e; }

/* ---------- Formulario inteligente ---------- */
.form-field { display: flex; flex-direction: column; gap: .5rem; }
.form-label {
  font-weight: 600;
  color: #1f4757;
  font-size: .95rem;
}
.form-input {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid #dbe6ea;
  border-radius: .75rem;
  font-size: 1rem;
  font-family: inherit;
  color: #1f4757;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.form-input:focus {
  outline: none;
  border-color: #c8a96a;
  box-shadow: 0 0 0 3px rgba(200, 169, 106, 0.2);
}
textarea.form-input { resize: vertical; min-height: 90px; }

.radio-card {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem 1rem;
  border: 1.5px solid #dbe6ea;
  border-radius: .75rem;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
  color: #1f4757;
  font-weight: 500;
}
.radio-card input { accent-color: #c8a96a; }
.radio-card:has(input:checked) {
  border-color: #c8a96a;
  background: rgba(200, 169, 106, 0.08);
}
.radio-card span { display: inline-flex; align-items: center; gap: .5rem; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: #1f4757;
  cursor: pointer;
  font-weight: 500;
}
.checkbox-row input { accent-color: #c8a96a; width: 18px; height: 18px; }

/* Animación suave al mostrar bloques condicionales */
.help-block:not(.hidden),
#block-especie:not(.hidden),
#block-otros:not(.hidden) {
  animation: fadeSlideDown .35s ease-out;
}
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Reveal on scroll (fade-in al entrar en viewport) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s ease-out, transform .8s ease-out;
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Micro-interacciones en botones (lift sutil) ---------- */
a.inline-flex, button[type="submit"] { transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease; }
a.inline-flex:hover { transform: translateY(-2px); }

/* ---------- Accesibilidad: reducir animaciones si el usuario lo prefiere ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Focus accesible ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid #c9a96a;
  outline-offset: 2px;
}

/* =========================================================
   AJUSTES RESPONSIVE
   Refinan la experiencia en móviles y tablets pequeñas.
   ========================================================= */

/* Móviles medianos y pequeños (≤ 640px) */
@media (max-width: 640px) {
  /* Tipografía base ligeramente menor para mejor lectura */
  body { font-size: 16px; }

  /* Reducir el padding interno de las tarjetas para ganar ancho útil */
  .reflection-card { padding: 1.5rem 1.1rem 1.25rem; }
  .service-item    { padding: 1.35rem 1.2rem; }
  .testimonial     { padding: 1.5rem; }
  .help-card       { padding: 1.35rem 1.2rem; }

  /* Iconos y títulos algo más compactos */
  .reflection-icon { width: 60px; height: 60px; }
  .service-title   { font-size: 1.2rem; }
  .help-card-title { font-size: 1.3rem; }

  /* El formulario ocupa todo el ancho cómodamente */
  #formWrapper { border-radius: 1.25rem; }
}

/* Móviles muy pequeños (≤ 380px) */
@media (max-width: 380px) {
  /* Tarjetas de servicio con imagen: una sola columna para que respiren */
  .service-card { min-height: 120px; }
  .service-card p { font-size: .8rem; }

  /* Botones de acción a ancho completo cuando envuelven */
  .btn-responsive { width: 100%; justify-content: center; }
}

/* Botón flotante de WhatsApp: algo más pequeño en móvil */
@media (max-width: 640px) {
  a[aria-label="Contactar por WhatsApp"] {
    width: 3.5rem;
    height: 3.5rem;
    bottom: 1rem;
    right: 1rem;
  }
}

/* =========================================================
   WIDGET DE COMPARTIR
   ========================================================= */
#shareWidget { flex-direction: column; align-items: flex-end; }

#sharePanel {
  transform-origin: bottom right;
}

.share-option {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .6rem .7rem;
  border-radius: .75rem;
  font-weight: 600;
  font-size: .95rem;
  color: #1f4757;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color .2s ease, transform .15s ease;
}
.share-option:hover { background: #f5f1e8; transform: translateX(2px); }

.share-ico {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Botón principal de compartir: más pequeño en móvil (igual que WhatsApp) */
@media (max-width: 640px) {
  #shareWidget { bottom: 5.25rem; right: 1rem; }
  #shareToggle { width: 3.5rem; height: 3.5rem; }
  #sharePanel { width: min(18rem, calc(100vw - 2rem)); }
}
