/* ==========================================================================
   Workmed — sitio público (web_workmed)
   Estilos del sitio de marketing. Autocontenido: tokens + reset + componentes.
   Paleta y tipografía siguen el Workmed Design System (ver otros portales).
   Los templates conservan estilos inline para el layout; aquí viven los tokens,
   los estados :hover/:focus (que el inline no puede expresar) y la animación de
   aparición al hacer scroll (data-reveal).
   ========================================================================== */

:root {
  --wm-rojo: #CC2D3B;
  --wm-rojo-700: #A6232E;
  --wm-azul-oscuro: #2D334E;
  --wm-azul: #535A75;
  --wm-negro: #0A0E1A;
  --bg: #FAFBFD;
  --fg: #2D334E;
  --fg-muted: #535A75;
  --fg-soft: #7A8197;
  --line: #D5DCE5;
  --line-soft: #EAEEF3;
  --font-sans: 'Poppins', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--wm-rojo); text-decoration: none; }
a:hover { color: var(--wm-rojo-700); }
::selection { background: var(--wm-rojo); color: #fff; }
img { max-width: 100%; }

/* Solo para lectores de pantalla (mantiene el H1 accesible cuando el título
   va dentro de una imagen/banner) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Contenedor central del sitio */
.wm-container { width: min(1320px, 92vw); margin: 0 auto; }
.wm-container--md { width: min(1180px, 92vw); margin: 0 auto; }
.wm-container--sm { width: min(1080px, 90vw); margin: 0 auto; }

/* Compensa el header sticky al saltar a un ancla (#soluciones, etc.) */
section[id] { scroll-margin-top: 96px; }

/* --------------------------------------------------------------------------
   Estados hover/focus — reemplazan los style-hover="{...}" del prototipo dc.
   Necesitan !important porque el estilo base va inline (mayor especificidad).
   -------------------------------------------------------------------------- */

/* Botón/enlace rojo (CTA): oscurece y sube un pelo */
.h-red-lift:hover { background: var(--wm-rojo-700) !important; transform: translateY(-1px); }
.h-red:hover { background: var(--wm-rojo-700) !important; }

/* Botón/enlace claro con borde: borde navy al pasar */
.h-border:hover { border-color: var(--wm-azul-oscuro) !important; }
/* Botón fantasma sobre fondo oscuro: borde blanco */
.h-white-border:hover { border-color: #fff !important; }

/* Tarjetas que se elevan */
.h-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -12px rgba(45, 51, 78, 0.18);
  border-color: #fff !important;
}
.h-lift3:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -12px rgba(45, 51, 78, 0.18);
  border-color: #fff !important;
}
.h-lift-red:hover { transform: translateY(-4px); box-shadow: 0 24px 50px -16px rgba(204, 45, 59, 0.5); }
.h-lift-navy:hover { transform: translateY(-4px); box-shadow: 0 24px 50px -16px rgba(45, 51, 78, 0.5); }

/* Píldoras de navegación del header */
.h-navlink:hover { background: var(--line-soft) !important; }
/* Filas suaves (menú de utilidades, listado de centros) */
.h-soft:hover { background: #F3F6F9 !important; }
/* Tarjetas de logos */
.h-logocard:hover {
  border-color: var(--line) !important;
  box-shadow: 0 8px 22px -12px rgba(45, 51, 78, 0.18);
}

/* Enlaces sobre fondo oscuro (footer, hero dark) → blanco puro */
.h-white:hover { color: #fff !important; }
.h-white:hover svg { stroke: #fff; }
/* Enlaces gris → rojo (breadcrumb, secundarios) */
.h-redink:hover { color: var(--wm-rojo) !important; }

/* Inputs del login */
.wm-input:focus {
  border-color: var(--wm-azul-oscuro) !important;
  box-shadow: 0 0 0 4px rgba(45, 51, 78, 0.07);
  outline: none;
}

/* --------------------------------------------------------------------------
   Reveal on scroll (data-reveal). Gate por html.js: sin JavaScript, el
   contenido se ve siempre (no queda invisible). El controlador Stimulus
   `reveal` agrega la clase .reveal-in cuando el elemento entra en viewport.
   Delay opcional por elemento con  style="--reveal-delay:.12s".
   -------------------------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity .8s cubic-bezier(.16, .84, .44, 1) var(--reveal-delay, 0s),
    transform .8s cubic-bezier(.16, .84, .44, 1) var(--reveal-delay, 0s);
  will-change: opacity, transform;
}
.js [data-reveal].reveal-in { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   Placeholder de imagen (reemplaza <image-slot> del prototipo, que dependía
   del runtime de diseño). Mantiene la caja/proporción del layout.
   -------------------------------------------------------------------------- */
.wm-slot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  background: rgba(45, 51, 78, 0.035);
  color: rgba(45, 51, 78, 0.5);
  border: 1.5px dashed rgba(45, 51, 78, 0.18);
  border-radius: inherit;
  font-size: 13px;
  font-weight: 400;
}
.wm-slot svg { opacity: .5; }
.wm-slot__cap { max-width: 90%; line-height: 1.35; }
.wm-slot-frame { position: relative; overflow: hidden; }

/* Leaflet: alto explícito ya viene inline; solo la tipografía del popup */
.leaflet-popup-content { font-family: var(--font-sans); }

/* --------------------------------------------------------------------------
   Slider de logos (marquee autodeslizante infinito, CSS puro). El track lleva
   la lista DUPLICADA; se traslada -50% para un bucle sin costuras. Pausa al
   pasar el mouse; se detiene con prefers-reduced-motion. Cada ítem usa
   margin-right (no gap) para que -50% caiga exactamente al inicio de la 2ª copia.
   -------------------------------------------------------------------------- */
.wm-marquee {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.wm-marquee__track {
  display: flex;
  width: max-content;
  animation: wm-marquee 40s linear infinite;
}
.wm-marquee:hover .wm-marquee__track,
.wm-marquee:focus-within .wm-marquee__track { animation-play-state: paused; }

@keyframes wm-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.wm-logo-card {
  flex: 0 0 auto;
  width: 200px;
  height: 88px;
  margin-right: 24px;
  background: transparent;      /* sin fondo: los logos flotan sobre la sección */
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
}
.wm-logo-card img {
  max-width: 100%;
  max-height: 48px;
  object-fit: contain;
  transition: opacity .2s ease, filter .2s ease;
}
/* Descanso visual: logos algo atenuados; al pasar el mouse por el slider,
   el logo bajo el cursor recupera intensidad. */
.wm-marquee:hover .wm-logo-card img { opacity: .55; }
.wm-marquee:hover .wm-logo-card:hover img { opacity: 1; }
.wm-logo-card img { opacity: .85; }

@media (prefers-reduced-motion: reduce) {
  .wm-marquee__track { animation: none; }
  .wm-marquee { overflow-x: auto; }
}
@media (max-width: 560px) {
  .wm-logo-card { width: 168px; height: 84px; padding: 16px 20px; }
}

/* --------------------------------------------------------------------------
   Submenú de navegación (Soluciones): se abre al pasar el mouse o con foco de
   teclado. El puente ::before cubre el hueco entre el gatillo y el panel para
   que no se cierre al mover el mouse hacia abajo.
   -------------------------------------------------------------------------- */
.wm-nav-dd { position: relative; }
.wm-nav-dd__chev { transition: transform .18s ease; }
.wm-nav-dd:hover .wm-nav-dd__chev,
.wm-nav-dd:focus-within .wm-nav-dd__chev { transform: rotate(180deg); }
.wm-nav-dd__panel {
  position: absolute; left: 0; top: calc(100% + 8px);
  width: 320px; background: #fff; border: 1px solid var(--line-soft);
  border-radius: 16px; box-shadow: 0 18px 40px -12px rgba(45, 51, 78, 0.22);
  padding: 8px; z-index: 95;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.wm-nav-dd__panel::before {
  content: ''; position: absolute; left: 0; right: 0; top: -10px; height: 10px;
}
.wm-nav-dd:hover .wm-nav-dd__panel,
.wm-nav-dd:focus-within .wm-nav-dd__panel {
  opacity: 1; visibility: visible; transform: none;
}

/* Submenú anidado (flyout) — p.ej. las subsecciones de Salud ocupacional */
.wm-subdd { position: relative; }
.wm-subdd__panel {
  position: absolute; left: calc(100% + 6px); top: -8px;
  width: 280px; background: #fff; border: 1px solid var(--line-soft);
  border-radius: 16px; box-shadow: 0 18px 40px -12px rgba(45, 51, 78, 0.22);
  padding: 8px; z-index: 96;
  opacity: 0; visibility: hidden; transform: translateX(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.wm-subdd__panel::before {
  content: ''; position: absolute; left: -12px; top: 0; bottom: 0; width: 12px;
}
.wm-subdd:hover .wm-subdd__panel,
.wm-subdd:focus-within .wm-subdd__panel {
  opacity: 1; visibility: visible; transform: none;
}

/* --------------------------------------------------------------------------
   Header responsive: nav de escritorio vs botón de menú móvil.
   Breakpoint 1100px (misma intención que el `narrow` del prototipo).
   -------------------------------------------------------------------------- */
.wm-only-desktop { display: flex; }
.wm-only-mobile { display: none; }

@media (max-width: 1100px) {
  .wm-only-desktop { display: none !important; }
  .wm-only-mobile { display: inline-flex !important; }
}

/* --------------------------------------------------------------------------
   Estados activos de listas interactivas (industrias, chips de zona, roles).
   El estilo base va inline en el template; .is-active lo pinta de navy.
   -------------------------------------------------------------------------- */
.wm-ind-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; text-align: left; padding: 17px 20px; border-radius: 12px;
  border: 1px solid #EAEEF3; background: #fff; color: #2D334E; cursor: pointer;
  font-family: inherit; font-size: 16px; font-weight: 400; transition: all .18s ease;
}
.wm-ind-row.is-active { background: #2D334E !important; color: #fff !important; border-color: #2D334E !important; }

.wm-chip {
  padding: 9px 18px; border-radius: 999px; border: 1px solid #D5DCE5; background: #fff;
  color: #2D334E; font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all .15s ease;
}
.wm-chip.is-active { background: #2D334E; color: #fff; border-color: #2D334E; }

.wm-role {
  padding: 9px 16px; border-radius: 999px; border: 1px solid #D5DCE5; background: #fff;
  color: #2D334E; font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all .15s ease;
}
.wm-role.is-active { background: #2D334E; color: #fff; border-color: #2D334E; }

/* Nosotros: foto (más ancha) a la izquierda, texto separado a la derecha */
.wm-nosotros-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 72px;
  align-items: center;
}
.wm-nosotros-grid > .wm-nosotros-text { padding-left: 8px; }
@media (max-width: 900px) {
  .wm-nosotros-grid { grid-template-columns: 1fr; gap: 40px; }
  .wm-nosotros-grid > .wm-nosotros-text { padding-left: 0; }
}

/* Grilla de industrias 3×3 (→ 2 → 1 en pantallas chicas) */
.wm-ind-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .wm-ind-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .wm-ind-grid { grid-template-columns: 1fr; } }

.wm-ind-tile {
  position: relative; overflow: hidden; border-radius: 18px;
  border: 1px solid var(--line-soft); background: #fff;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.wm-ind-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -12px rgba(45, 51, 78, 0.18);
  border-color: #fff;
}
.wm-ind-tile__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top; transition: transform .5s ease;
}
.wm-ind-tile:hover .wm-ind-tile__img { transform: scale(1.05); }
