/* ============================================================
   VANESSA HENAO · PSICÓLOGA — Estilos base compartidos
   Paleta: #5F745E · #8DA07F · #BFC8B1 · #E9E3D7 · #C8AA84 · #A9744B
   Tipografías: Playfair Display (títulos) · Montserrat (textos)
   ------------------------------------------------------------
   ESCALA CANÓNICA DE BREAKPOINTS — para todo breakpoint nuevo:
     480 · 640 · 900 · 1100 · 1280
   Excepciones justificadas: 768 y 1024, anchos reales de tablet
   (los usa panel.css y moverlos cambiaría el layout en 768/1024).
   Convención: subir con (min-width: N), bajar con (max-width: N-1).
   NUNCA usar max-width: N junto a min-width: N sobre elementos
   relacionados: a N píxeles exactos se aplican las dos reglas.
   Quedan anchos antiguos fuera de la escala (560, 720, 960...);
   migrarlos exige revisar el layout, no se tocan por ahora.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Montserrat:wght@300;400;500;600;700&family=Great+Vibes&display=swap');

/* ---------- Variables: modo claro ---------- */
:root {
  --bg: #F3EEE4;
  --surface: #FBF8F1;
  --surface-2: #EDE7D9;
  --border: #DDD5C4;
  --text: #3E4A3D;
  --text-soft: #5A6558;
  /* #5F745E daba 4.38:1 como fondo de boton y como texto: por debajo de AA */
  --primary: #576A56;
  --primary-soft: #8DA07F;
  --pale: #BFC8B1;
  --gold: #C8AA84;
  --terra: #8F5C36;
  --acento: #C2A279;
  --on-terra: #FBF8F1;
  --on-acento: #3E2F1C;
  /* Secciones verde profundo: el par anterior daba 2.92:1 en el texto suave */
  --deep: #4C5E4B;
  --deep-text: #F3EEE4;
  --deep-muted: #D3DBC8;
  --on-primary: #F3EEE4;
  /* Oro tipografico: el --gold decorativo no llega a 4.5:1 sobre --bg */
  --gold-texto: #7A5C30;
  --error: #A4231C;
  --exito: #1F6B4F;
  --fuente-titulo: 'Playfair Display', Georgia, serif;
  --shadow: 0 10px 34px rgba(95, 116, 94, 0.12);
  --nav-bg: rgba(243, 238, 228, 0.72);
  /* Glassmorphism */
  --glass: rgba(251, 248, 241, 0.55);
  --glass-fuerte: rgba(251, 248, 241, 0.78);
  --glass-borde: rgba(255, 255, 255, 0.65);
  --glass-sombra: 0 18px 44px rgba(95, 116, 94, 0.14);
  --glow-verde: rgba(141, 160, 127, 0.35);
  --glow-oro: rgba(200, 170, 132, 0.3);
  --radio-control: 0.8rem;
  --alto-control: 44px;
  /* Escala tipográfica por roles. 12px es el piso absoluto (solo micro-etiquetas
     en mayúsculas, badges y chips); 14px es el mínimo para cualquier texto de lectura. */
  --t-xs: 0.75rem;      /* micro-etiqueta MAYÚSCULAS, badge, chip, contador */
  --t-sm: 0.8125rem;    /* texto auxiliar: metadatos, notas breves, pies */
  --t-md: 0.875rem;     /* CUERPO mínimo: prosa, nombre de producto, precio, estado */
  --t-lg: 1rem;         /* cuerpo destacado, entradillas, títulos de tarjeta */
  --t-xl: 1.125rem;     /* subtítulo, h4 */
  --t-2xl: 1.375rem;    /* h3, título de sección */
  --t-3xl: clamp(1.75rem, 3.6vw, 2.6rem); /* display, h1 y h2 */
  /* Radios: escala única (control 0.8 · tarjeta 1/1.2/1.4 · panel 1.5) */
  --radio-pildora: 999px;
  --radio-card-sm: 1rem;
  --radio-card: 1.2rem;
  --radio-card-lg: 1.4rem;
  --radio-panel: 1.5rem;
  /* Elevaciones: 1 hover sutil · 2 elemento flotante · 3 modal / overlay */
  --sombra-1: 0 8px 20px rgba(95, 116, 94, 0.22);
  --sombra-2: 0 12px 30px rgba(95, 116, 94, 0.35);
  --sombra-3: 0 24px 60px rgba(30, 36, 31, 0.25);
  /* Ritmo vertical de sección: una sola escala para todo el sitio */
  --sec-y-sm: 2rem;
  --sec-y: 2.75rem;
  --sec-y-lg: 3.75rem;
  /* Desplazamiento del nav pegajoso: --alto-nav (web.css) + holgura */
  --offset-sticky: calc(var(--alto-nav, 76px) + 0.75rem);
  color-scheme: light;
}

/* ---------- Variables: modo oscuro ---------- */
[data-theme="dark"] {
  --bg: #1C211C;
  --surface: #252C25;
  --surface-2: #2E362E;
  --border: #3A443A;
  --text: #E9E3D7;
  --text-soft: #A9B3A2;
  --primary: #8DA07F;
  --primary-soft: #8DA07F;
  --pale: #4A564A;
  --gold: #C8AA84;
  --terra: #C08A5E;
  --acento: #C2A279;
  --on-terra: #2A1F12;
  --on-acento: #3E2F1C;
  --deep: #161B16;
  --deep-text: #E9E3D7;
  --deep-muted: #8DA07F;
  /* --primary aclara en oscuro: la tinta encima debe oscurecer */
  --on-primary: #1C211C;
  --gold-texto: #C8AA84;
  --error: #EE8279;
  --exito: #63C79B;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
  --nav-bg: rgba(28, 33, 28, 0.72);
  /* Glassmorphism */
  --glass: rgba(37, 44, 37, 0.55);
  --glass-fuerte: rgba(37, 44, 37, 0.8);
  --glass-borde: rgba(255, 255, 255, 0.1);
  --glass-sombra: 0 18px 44px rgba(0, 0, 0, 0.45);
  --glow-verde: rgba(141, 160, 127, 0.18);
  --glow-oro: rgba(200, 170, 132, 0.15);
  --radio-control: 0.8rem;
  --alto-control: 44px;
  /* Las sombras verdes y terra no se leen sobre fondo oscuro */
  --sombra-card-hover: 0 12px 32px rgba(0, 0, 0, 0.45);
  --sombra-card-hover-fuerte: 0 20px 44px rgba(0, 0, 0, 0.55);
  --sombra-card-hover-terra: 0 8px 24px rgba(0, 0, 0, 0.45);
  --sombra-1: 0 8px 20px rgba(0, 0, 0, 0.5);
  --sombra-2: 0 12px 30px rgba(0, 0, 0, 0.55);
  --sombra-3: 0 24px 60px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* El ritmo vertical se abre en pantallas grandes */
@media (min-width: 900px) {
  :root {
    --sec-y-sm: 2.75rem;
    --sec-y: 4.5rem;
    --sec-y-lg: 6.5rem;
  }
}

/* ---------- Base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Montserrat', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .serif {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500;
}
h1, h2 { line-height: 1.15; }
h3 { line-height: 1.25; }

img, svg { display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Utilidades ---------- */
.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--gold-texto);
}

.fade-in { animation: fadeIn 0.5s ease both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fade-in { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Botones (efectos glassmorphism) ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radio-pildora);
  padding: 0.85rem 1.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}
.btn:not(.btn-sm) { min-height: var(--alto-control); }
/* Barrido de brillo */
.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  z-index: -1;
  width: 55%;
  height: 100%;
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.38) 50%, transparent 80%);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
  pointer-events: none;
}
.btn:hover::after { left: 130%; }
/* Reflejo superior tipo vidrio */
.btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 45%);
  pointer-events: none;
}
.btn:hover { transform: translateY(-2px) scale(1.015); }
.btn:active { transform: translateY(0) scale(0.985); transition-duration: 0.08s; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:disabled::after { display: none; }

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 22px rgba(95, 116, 94, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { box-shadow: 0 14px 32px rgba(95, 116, 94, 0.4), 0 0 0 4px rgba(141, 160, 127, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.3); }

.btn-terra {
  background: var(--terra);
  color: var(--on-terra);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 22px rgba(169, 116, 75, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-terra:hover { box-shadow: 0 14px 32px rgba(169, 116, 75, 0.42), 0 0 0 4px rgba(200, 170, 132, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3); }

.btn-acento {
  background: var(--acento);
  color: var(--on-acento);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 22px rgba(194, 162, 121, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-acento:hover { box-shadow: 0 14px 32px rgba(194, 162, 121, 0.45), 0 0 0 4px rgba(194, 162, 121, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3); }

.btn-outline { border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: rgba(141, 160, 127, 0.1); box-shadow: 0 8px 20px rgba(95, 116, 94, 0.15); }

.btn-ghost {
  border: 1.5px solid var(--glass-borde, var(--border));
  background: var(--glass, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-soft);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--text); box-shadow: 0 8px 20px rgba(200, 170, 132, 0.18); }

.btn-glass {
  background: var(--glass);
  border: 1px solid var(--glass-borde);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
}
.btn-crema { background: #F3EEE4; color: #5F745E; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }

/* Acciones destructivas (eliminar, cancelar). Usa --error, que ya cumple AA
   en ambos temas, para que el borrado no se confunda con una accion normal. */
.btn-peligro {
  border: 1.5px solid var(--error);
  color: var(--error);
}
.btn-peligro:hover {
  border-color: var(--error);
  color: var(--error);
  box-shadow: 0 8px 20px rgba(164, 35, 28, 0.22), 0 0 0 4px rgba(164, 35, 28, 0.12);
}

.btn-sm { padding: 0.5rem 1.1rem; font-size: var(--t-xs); }

/* ---------- Campos de formulario ---------- */
.campo { display: block; }
.campo span {
  display: block;
  margin-bottom: 0.4rem;
  /* 0.68rem (10.9px) en mayúsculas era ilegible: piso de la escala. */
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
}
.campo input,
.campo select,
.campo textarea {
  width: 100%;
  min-height: var(--alto-control);
  border: 1px solid var(--border);
  border-radius: var(--radio-control);
  background: var(--bg);
  color: var(--text);
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s ease;
}
.campo input:focus,
.campo select:focus,
.campo textarea:focus { border-color: var(--primary); }
.campo input:focus-visible,
.campo select:focus-visible,
.campo textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(200, 170, 132, 0.18);
}
.campo input[aria-invalid="true"],
.campo select[aria-invalid="true"],
.campo textarea[aria-invalid="true"] { border-color: var(--terra); }
.campo-error {
  display: block;
  margin-top: 0.35rem;
  color: var(--terra);
  font-size: var(--t-xs);
  line-height: 1.35;
}
.campo textarea { resize: none; }

/* ---------- Mensajes de estado (compartidos: el panel no carga web.css) ---------- */
.error,
.exito {
  display: none;
  max-width: 460px;
  margin: 0.8rem auto 0;
  border-radius: var(--radio-control);
  padding: 0.7rem 1rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
}
.error { background: rgba(169, 116, 75, 0.12); color: var(--error); border-left: 3px solid var(--error); }
.exito { background: rgba(141, 160, 127, 0.14); color: var(--exito); border-left: 3px solid var(--exito); }
.error.visible,
.exito.visible { display: block; }

/* ---------- Tarjeta base ----------
   Cuatro familias repetían el mismo fondo, borde y radio. Aquí vive
   la base común; cada familia declara ya sólo sus diferencias reales
   (padding, layout, hover). estilos.css carga el primero, así que
   cualquier regla del CSS de página sigue ganando sobre esta. */
.card,
.test-card,
.tpub-card,
.cita-card,
.hist-pac-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radio-card);
}

/* ---------- Badges de estado ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: var(--radio-pildora);
  padding: 0.28rem 0.85rem;
  font-size: var(--t-xs);
  font-weight: 600;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.confirmada { background: rgba(141, 160, 127, 0.2); color: var(--primary); }
.badge.pendiente  { background: rgba(200, 170, 132, 0.22); color: var(--gold-texto); }
.badge.completada { background: rgba(141, 160, 127, 0.14); color: var(--text-soft); }
.badge.cancelada  { background: rgba(169, 116, 75, 0.15); color: var(--terra); }

/* ---------- Toggle de tema ---------- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--glass-borde, var(--border));
  background: var(--glass, var(--surface));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}
.theme-toggle:hover {
  transform: translateY(-2px) rotate(15deg);
  box-shadow: 0 8px 20px rgba(200, 170, 132, 0.28), 0 0 0 4px rgba(200, 170, 132, 0.12);
}
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle .ic-sol { display: none; }
[data-theme="dark"] .theme-toggle .ic-sol { display: block; }
[data-theme="dark"] .theme-toggle .ic-luna { display: none; }

/* Los botones-icono miden 34-38px por diseno. Ampliamos el area tactil
   hasta los 44px que exige --alto-control sin tocar el tamano visual. */
.theme-toggle { position: relative; }
.theme-toggle::before { content: ""; position: absolute; inset: -3px; border-radius: inherit; }

@media (prefers-reduced-motion: reduce) {
  .btn, .theme-toggle { transition: none; }
  .btn::after { display: none; }
  .btn:hover, .theme-toggle:hover { transform: none; }
}

/* ---------- Switch ---------- */
.switch {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radio-control);
  text-align: left;
}
.switch strong { display: block; font-size: 0.85rem; font-weight: 500; }
.switch small { display: block; margin-top: 2px; font-size: var(--t-xs); color: var(--text-soft); }
.switch .pista {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  border-radius: var(--radio-pildora);
  background: var(--border);
  transition: background 0.2s ease;
}
.switch .pista::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FBF8F1;
  transition: transform 0.2s ease;
}
.switch[aria-checked="true"] .pista { background: var(--primary); }
.switch[aria-checked="true"] .pista::after { transform: translateX(20px); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radio-pildora);
  padding: 0.8rem 1.4rem;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
/* El aviso de cookies ocupa la misma franja inferior centrada (bottom 1.5rem)
   y va a z-index 9999 frente al z-index 100 del toast, así que sin esto el
   toast queda tapado por completo. Mismo salto que ya usan .asis-btn y
   .carrito-flotante. */
body.cookies-activos .toast { bottom: clamp(6.5rem, 38vh, 15rem); }
/* En móvil el toast centrado se solapa con el botón del asistente
   (bottom 1rem / right 1rem) y con el carrito flotante. Lo anclamos dejando
   libre esa columna en lugar de centrarlo. */
@media (max-width: 639px) {
  .toast {
    left: 1rem;
    right: 5.4rem;
    justify-content: center;
    text-align: center;
    line-height: 1.35;
    transform: translateY(20px);
  }
  .toast.visible { transform: translateY(0); }
}

/* ---------- Modal ---------- */
.modal-fondo {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(30, 36, 31, 0.55);
  overflow-y: auto;
  /* Evita que el scroll del modal se encadene a la página de detrás */
  overscroll-behavior: contain;
}
.modal-fondo.abierto { display: flex; }
.modal-fondo[aria-hidden="true"] { visibility: hidden; }
/* Bloqueo del scroll del fondo mientras hay un modal abierto.
   vhInicializarModales() (js/comun.js) ya añade y quita esta clase en <body>,
   pero hasta ahora no existía ninguna regla CSS que la aprovechara. */
body.modal-abierto { overflow: hidden; }
.modal {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border-radius: var(--radio-panel);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  animation: fadeIn 0.3s ease both;
}

/* ---------- Estado vacío compartido ----------
   Mismo patrón que .sin-resultados (tienda.css) y .blog-vacio (blog.css), pero
   disponible en todas las páginas porque vive en estilos.css. */
.estado-vacio {
  grid-column: 1 / -1;
  padding: 3rem 1.2rem;
  text-align: center;
  border-radius: var(--radio-card-lg);
  background: var(--glass);
  border: 1px solid var(--glass-borde);
}
.estado-vacio h3 { margin: 0; font-size: 1.15rem; }
.estado-vacio p { margin: 0.5rem auto 0; max-width: 30rem; font-size: 0.85rem; color: var(--text-soft); }

/* ---------- Isotipo ---------- */
.isotipo { flex-shrink: 0; }
.isotipo .arco { stroke: var(--gold); }
.isotipo .punto { fill: var(--gold); }
.isotipo .rama { stroke: var(--primary); }
.isotipo .hoja { fill: var(--primary); }
.isotipo.claro .rama { stroke: var(--pale); }
.isotipo.claro .hoja { fill: var(--pale); }

/* ---------- Imagen de portada de productos ---------- */
.prod-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

/* ---------- Scrollbar sutil ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--pale); border-radius: var(--radio-pildora); }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Movimiento reducido — red de seguridad global.
   Los bloques especificos de cada modulo cubrian 16 de 26
   animaciones; esto alcanza al resto y a las que se anadan.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Enlaces de contacto del pie: heredan color, necesitan afordancia propia */
.dato a { text-decoration: none; }
.dato a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   Campos: talla mínima de texto en pantallas táctiles.
   iOS Safari hace zoom automático al enfocar un campo cuyo texto
   mide menos de 16px. Todas las definiciones del proyecto usan
   entre 0.78rem y 0.88rem, así que en móvil las subimos a 16px.
   Lleva !important porque los CSS de página se cargan después de
   este archivo y sus reglas de clase ganarían por orden.
   ============================================================ */
@media (max-width: 639px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}
