/* ==================================================================
   CSS COMPARTIDO — Laboratorios Duncan
   ------------------------------------------------------------------
   Reglas comunes a index.html (home) y productos/index.html (catálogo):
   variables, reset, nav, footer, botón WhatsApp, modal de producto,
   animación reveal y fallbacks para navegadores viejos.
   Lo específico de cada página sigue inline en su <style>.
   Al editar: bump del ?v= en los <link> de ambas páginas
   (.htaccess cachea CSS 1 año).
   ================================================================== */

/* --- Poppins auto-hospedada (subset latín, alcanza para español) ---
   Archivos en assets/fonts/ — URLs relativas a este CSS, funcionan
   igual desde / y desde /productos/. El peso 800 solo lo usa la home. */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 300; font-display: swap; src: url('fonts/poppins-300.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/poppins-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/poppins-600.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/poppins-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 800; font-display: swap; src: url('fonts/poppins-800.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --teal: #3DC8C2;
  --teal-dark: #2aada8;
  --teal-text: #0b716d;   /* teal oscuro legible (WCAG AA) — mismo tono, para textos sobre fondo claro */
  --gray: #888;
  --dark: #333;
  --light: #f7f7f7;
  --white: #fff;
  --border: #e0e0e0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Poppins', Arial, sans-serif; color: var(--dark); overflow-x: hidden; overflow-x: clip; }  /* hidden = fallback viejos; clip = modernos (no rompe sticky) */
/* Títulos largos ("terapéutica", "Ciprofloxacina") cortan en vez de desbordar */
h1, h2, h3, h4, .card-nombre, .modal-info h2 { overflow-wrap: break-word; word-break: break-word; }
img, canvas, video, svg { max-width: 100%; }  /* medios no fuerzan ancho */

/* ===== NAV ===== */
/* ⚠ La banda gris de arriba es parte del ARCHIVO del logo: ocupa el 62,5%
   superior de logo.webp (80 px de 128). El degradado del nav la continúa a lo
   ancho de la página, así que su corte tiene que caer EXACTAMENTE donde
   termina la banda del logo: corte = alto del logo × 0,625 + lo que el logo
   esté corrido desde arriba. Si no coinciden queda un escalón gris/blanco.
   Al 2026-08-10 el logo va pegado al borde superior, así que 64 × 0,625 = 40. */
nav {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(#98999B 0, #98999B 40px, #fff 40px, #fff 100%);
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;                 /* menú baja de fila en pantallas chicas en vez de desbordar */
  padding: .25rem 2rem;
}
nav img {
  height: 64px; width: 185px; object-fit: cover; object-position: left center; display: block;
  margin-top: -.25rem;   /* cancela el padding del nav: el logo arranca en el borde de la página, sin franja gris arriba */
  margin-left: 3.5rem;   /* ≈1,5 cm a la derecha (pedido 2026-08-10); en ≤680 px se resetea, no hay lugar */
}
nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem 2rem; align-self: flex-start; margin-top: .5rem; }
nav a { text-decoration: none; color: #1f1f1f; font-size: 1.07rem; font-weight: 600; letter-spacing: .03em; }
nav a:hover { color: var(--teal); }
nav a.active { text-decoration: underline; text-underline-offset: 4px; font-weight: 700; }

/* ===== FOOTER ===== */
footer {
  background: #2a2a2a; color: #ccc;
  text-align: center; padding: 1.2rem;
  font-size: .82rem;
}
footer a { color: var(--teal); text-decoration: underline; }

/* ===== WHATSAPP FLOTANTE ===== */
.wa-btn {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 200;
  background: #25d366; border-radius: 50%; width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.25); text-decoration: none;
  transition: transform .2s;
}
.wa-btn:hover { transform: scale(1.1); }
.wa-btn svg { width: 30px; height: 30px; fill: #fff; }

/* ===== MODAL DETALLE DE PRODUCTO (parte común; .modal-3d/.escena van por página) ===== */
.modal-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1000;  /* no inset: Samsung Internet <14 no lo soporta */
  background: rgba(20, 35, 50, .72); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 1rem; opacity: 0; transition: opacity .25s ease;
}
.modal-overlay.activo { display: flex; opacity: 1; }
.modal {
  background: #fff; border-radius: 18px;
  width: 100%; max-width: 1080px; max-height: 92vh;
  overflow: hidden; position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
  display: grid; grid-template-columns: 1fr 340px;  /* 3D ancho + info angosta */
  grid-template-rows: minmax(0, 1fr);  /* limita la fila al alto del modal — sin esto la fila crece con el contenido y .modal-info nunca llega a scrollear */
  transform: scale(.92); transition: transform .25s ease;
}
.modal-overlay.activo .modal { transform: scale(1); }
.modal-cerrar {
  position: absolute; top: .9rem; right: .9rem; z-index: 10;
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.9); color: #333;
  font-size: 1.4rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.18); transition: background .2s, transform .2s;
}
.modal-cerrar:hover { background: #fff; transform: rotate(90deg); }
.hint-3d {
  position: absolute; bottom: .8rem; left: 0; right: 0;
  text-align: center; color: rgba(11,113,109,.85);  /* teal oscuro: sobre el fondo teal claro del panel 3D el blanco no se leía */
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  padding: 0 .8rem;
}
.badge-ia {
  position: absolute; top: .9rem; left: .9rem; z-index: 5;
  background: rgba(255,255,255,.9); color: var(--teal-text);
  font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: .3rem .75rem; border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.badge-ia[hidden] { display: none; }  /* refuerzo: hidden pierde contra display de otras reglas en algunos navegadores viejos */
.modal-info {
  padding: 2rem 2rem 2.2rem; overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column; gap: .8rem; text-align: left;
}
.modal-info .cat-pill {
  align-self: flex-start; font-size: .72rem; font-weight: 700;
  color: var(--teal-text); background: #e0f7f6;
  padding: .25rem .8rem; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .04em;
}
.modal-info h2 { font-size: 1.6rem; color: var(--teal-text); line-height: 1.15; }
.modal-info .activo { font-size: .98rem; color: #444; font-weight: 600; }
.modal-info .presentacion {
  font-size: .88rem; color: #6f6f6f;
  border-bottom: 1px solid var(--border); padding-bottom: .9rem; margin-bottom: .3rem;
}
.modal-info .desc-titulo {
  font-size: .78rem; font-weight: 700; color: var(--teal-text);
  text-transform: uppercase; letter-spacing: .06em; margin-top: .2rem;
}
.modal-info .desc-texto { font-size: .9rem; color: #555; line-height: 1.55; }
.modal-info .nota {
  margin-top: auto; padding-top: 1rem;
  font-size: .75rem; color: #6f6f6f; font-style: italic;
  border-top: 1px dashed var(--border);
}
@media (max-width: 700px) {
  /* apilado en 1 columna; el modal entero scrollea (el título no se corta abajo) */
  .modal { grid-template-columns: 1fr; grid-template-rows: auto; max-height: 95vh; overflow-y: auto; }  /* rows auto: acá scrollea el modal, no la columna de info */
  .modal-info { padding: 1.4rem; overflow: visible; }
  .modal-info h2 { font-size: 1.3rem; }
}

/* ===== Aparición progresiva al scrollear ===== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s cubic-bezier(.22,.7,.3,1), transform .7s cubic-bezier(.22,.7,.3,1); }
.reveal.visible { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .08s; } .reveal.d2 { transition-delay: .16s; } .reveal.d3 { transition-delay: .24s; } .reveal.d4 { transition-delay: .32s; } .reveal.d5 { transition-delay: .40s; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.d1, .reveal.d2, .reveal.d3, .reveal.d4, .reveal.d5 { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ===== Fallback de `gap` en flexbox (Samsung Internet ≤13 / Chrome <84) =====
   gap en flex NO se puede detectar con @supports; un script de cada página
   agrega .no-flexgap a <html> cuando no funciona. Acá van las reglas comunes;
   las de elementos propios de cada página siguen inline. */
.no-flexgap nav li { margin: 0 1.2rem .35rem 0; }
.no-flexgap .modal-info > * { margin-bottom: .8rem; }

/* ===== NAV responsive (compartido) ===== */
@media (max-width: 680px) {
  /* Acá el gris tiene DOS trabajos: seguir la banda del logo y contener el menú
     compacto, que entra en una sola fila. Por eso el corte se queda en 33 px
     (el menú ocupa hasta el 33) y el logo crece para que su banda llegue justo
     ahí: 33 ÷ 0,625 = 52,8 px de alto → 152,63 de ancho (relación 370:128).
     Si se achica el logo, el menú se sale del gris. */
  nav { padding: .25rem 1rem; background: linear-gradient(#98999B 0, #98999B 33px, #fff 33px, #fff 100%); }
  nav img { height: 52.8px; width: 152.63px; margin-left: 0; }   /* acá no sobra ancho: sin el corrimiento del escritorio */
  nav ul { gap: .9rem; }
  nav a { font-size: .95rem; }
}
@media (max-width: 430px) {
  /* Sólo cambian padding, gaps y tipografía: el logo y el corte se heredan de
     ≤680 px (52,8 → banda en 33) porque acá el menú del catálogo y las fichas
     —4 ítems, una sola fila— llega hasta el 32,2 y necesita ese gris.
     El margen negativo sí hay que rehacerlo: el padding baja a .2rem. */
  nav { padding: .2rem .7rem; }
  nav img { margin-top: -.2rem; }
  nav ul { gap: .5rem; }
  nav a { font-size: .8rem; letter-spacing: 0; }
}

/* ===== Tipografía fluida (solo navegadores con clamp; el resto usa lo de arriba) ===== */
.modal-info h2 { font-size: clamp(1.2rem, 5vw, 1.6rem); }

/* ═══════════════════════════════════════════════════════════════
   PRUEBA TIPOGRÁFICA — Lora + DM Sans (la dupla de Farmacovigilancia)
   Fuentes variables auto-hospedadas (subset latín, alcanza para español).
   PARA REVERTIR: borrar este bloque completo y restaurar los preload
   de poppins-400/700 en index.html y productos/index.html.
   Las @font-face de Poppins de arriba quedan intactas a propósito.
   ═══════════════════════════════════════════════════════════════ */
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('fonts/dm-sans.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Lora'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('fonts/lora.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
body { font-family: 'DM Sans', Arial, sans-serif; }
h1, h2, h3, h4, h5 { font-family: 'Lora', Georgia, serif; }
