/* ==========================================================
   MediIQ · LOGO EN CÓDIGO
   ==========================================================
   Dos piezas, ambas dibujadas en SVG (sin imágenes):

     data-logo="completo"  el logotipo MEDI + IQ. La «Q» es una
                           lupa con una cruz médica adentro.
     data-logo="isotipo"   solo la Q-lupa, con degradado.

   QUÉ SE ADAPTA AL MODO OSCURO
   ----------------------------
   «MEDI» usa --ml-tinta: azul marino en el modo claro y blanco
   en el oscuro (versión positiva y negativa del manual de marca).
   El turquesa es el mismo en los dos. Como son variables, el
   cambio de tema se ve al instante, sin recargar nada.

   LA ANIMACIÓN
   ------------
   Al pasar el mouse, enfocar con el teclado o tocar el logo:
     isotipo   la lupa se balancea como buscando, la cruz da una
               vuelta y rebota, y un anillo de luz se expande.
     completo  las letras suben una a una, la cruz gira y la
               lupa late.
   En el celular o con un clic se dispara con la clase .ml-anim
   (la pone logo.js y la quita sola). Si el sistema pide menos
   movimiento, no se anima nada.
   ========================================================== */

:root{
    --ml-tinta:#12202A;          /* «MEDI» en el modo claro  (medido: 18,32,42) */
    --ml-acento:#08BCA9;         /* turquesa del logotipo    (medido: 8,188,169) */
}
html[data-tema="oscuro"]{
    --ml-tinta:#F4F8FB;          /* «MEDI» en el modo oscuro: la versión negativa */
    --ml-acento:#12CDB8;         /* un punto más vivo para que cante sobre #121417 */
}

.ml-logo{
    display:inline-block;
    line-height:0;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
    outline:none;
}
.ml-logo svg{display:block;width:100%;height:100%;overflow:visible;}
.ml-logo:focus-visible{border-radius:10px;box-shadow:0 0 0 3px color-mix(in srgb,var(--ml-acento) 45%,transparent);}

/* ---- tamaños ---- */
.ml-completo{height:34px;aspect-ratio:865/208;}
.ml-completo.ml-grande{height:62px;}
.ml-isotipo{width:26px;height:26px;}
.ml-isotipo.ml-grande{width:92px;height:92px;}

/* ---- colores del logotipo completo ---- */
.ml-t{fill:var(--ml-tinta);}
.ml-a{fill:var(--ml-acento);}

/* ---- piezas que se mueven: cada una gira sobre su propio centro ---- */
.ml-iso-lupa,.ml-iso-cruz,.ml-halo,
.ml-q-cruz,.ml-q-lupa,.ml-letra{
    transform-box:view-box;
}
.ml-iso-lupa{transform-origin:50px 50px;}
.ml-iso-cruz{transform-origin:50.5px 51px;}
.ml-halo{transform-origin:50px 50px;opacity:0;}
.ml-q-cruz{transform-origin:864.5px 348.5px;}
.ml-q-lupa{transform-origin:864.5px 349.5px;}
.ml-letra{transform-origin:center bottom;transform-box:fill-box;}

/* ---------- ISOTIPO ---------- */
.ml-logo:hover .ml-iso-lupa,
.ml-logo:focus-visible .ml-iso-lupa,
.ml-logo.ml-anim .ml-iso-lupa{animation:mlLupa 1.05s cubic-bezier(.3,.7,.3,1) 1;}
.ml-logo:hover .ml-iso-cruz,
.ml-logo:focus-visible .ml-iso-cruz,
.ml-logo.ml-anim .ml-iso-cruz{animation:mlCruz .95s cubic-bezier(.34,1.56,.64,1) .08s 1;}
.ml-logo:hover .ml-halo,
.ml-logo:focus-visible .ml-halo,
.ml-logo.ml-anim .ml-halo{animation:mlHalo 1s ease-out .05s 1;}

@keyframes mlLupa{
    0%  {transform:rotate(0)      scale(1);}
    22% {transform:rotate(-17deg) scale(1.07);}
    52% {transform:rotate(10deg)  scale(1.04);}
    78% {transform:rotate(-3deg)  scale(1.01);}
    100%{transform:rotate(0)      scale(1);}
}
@keyframes mlCruz{
    0%  {transform:scale(1)   rotate(0);}
    35% {transform:scale(.62) rotate(-90deg);}
    72% {transform:scale(1.22) rotate(8deg);}
    100%{transform:scale(1)   rotate(0);}
}
@keyframes mlHalo{
    0%  {opacity:.65;transform:scale(.78);}
    100%{opacity:0;  transform:scale(1.32);}
}

/* ---------- LOGOTIPO COMPLETO ---------- */
.ml-logo:hover .ml-letra,
.ml-logo:focus-visible .ml-letra,
.ml-logo.ml-anim .ml-letra{animation:mlLetra .6s cubic-bezier(.34,1.56,.64,1) 1;}
.ml-logo:hover .ml-letra:nth-of-type(2),.ml-logo.ml-anim .ml-letra:nth-of-type(2){animation-delay:.05s;}
.ml-logo:hover .ml-letra:nth-of-type(3),.ml-logo.ml-anim .ml-letra:nth-of-type(3){animation-delay:.10s;}
.ml-logo:hover .ml-letra:nth-of-type(4),.ml-logo.ml-anim .ml-letra:nth-of-type(4){animation-delay:.15s;}
.ml-logo:hover .ml-letra:nth-of-type(5),.ml-logo.ml-anim .ml-letra:nth-of-type(5){animation-delay:.20s;}
.ml-logo:hover .ml-q-cruz,
.ml-logo:focus-visible .ml-q-cruz,
.ml-logo.ml-anim .ml-q-cruz{animation:mlCruz .95s cubic-bezier(.34,1.56,.64,1) .22s 1;}
.ml-logo:hover .ml-q-lupa,
.ml-logo:focus-visible .ml-q-lupa,
.ml-logo.ml-anim .ml-q-lupa{animation:mlLatido .8s cubic-bezier(.34,1.56,.64,1) .25s 1;}

@keyframes mlLetra{
    0%  {transform:translateY(0);}
    40% {transform:translateY(-9px);}
    100%{transform:translateY(0);}
}
@keyframes mlLatido{
    0%  {transform:scale(1);}
    40% {transform:scale(1.07);}
    100%{transform:scale(1);}
}

/* Entrada al cargar (pantalla de acceso): el trazo se dibuja solo. */
.ml-logo.ml-entra .ml-iso-aro{stroke-dasharray:240;animation:mlDibuja 1.1s ease-out 1 both;}
@keyframes mlDibuja{from{stroke-dashoffset:240;}to{stroke-dashoffset:0;}}

@media (prefers-reduced-motion:reduce){
    .ml-logo *{animation:none !important;}
}


/* ---------- DÓNDE VA EL LOGO ---------- */

/* La barra lateral (consola y Centro de Control) y la pantalla de acceso
   son oscuras en los DOS temas: ahí siempre va la versión negativa. */
.barra .ml-logo,
.centro-barra .ml-logo,
.acceso-titulo .ml-logo{
    --ml-tinta:#F4F8FB;
    --ml-acento:#12CDB8;
}

/* Barra lateral: logotipo arriba y el lema debajo. */
.marca.marca-ml{flex-direction:column;align-items:flex-start;gap:6px;}
.marca-ml .ml-barra{height:26px;}
.marca-ml .ml-lema{font-size:10.5px;color:#8AA5BA;line-height:1.3;}
/* El halo de hover del cuadro viejo ya no existe. */
.marca-ml:hover{transform:none;}

/* Barra superior flotante: el isotipo al lado del nombre. */
.topbar-marca{display:inline-flex;align-items:center;gap:7px;}
.topbar-marca .ml-topbar{height:17px;flex:none;}

/* Pantalla de acceso: el logotipo grande en lugar del título de texto. */
.acceso-titulo{background:none !important;-webkit-background-clip:border-box !important;background-clip:border-box !important;
    color:inherit !important;line-height:0;margin:0 0 14px;}
.acceso-titulo .ml-acceso{height:clamp(56px,8vw,86px);}

/* En el modo claro la cabecera flotante es cian muy pálido: el turquesa de la
   marca (#08BCA9) quedaba tono sobre tono (~2:1). Aquí va un punto más hondo. */
html:not([data-tema="oscuro"]) .topbar .ml-logo{--ml-acento:#078F82;}

/* Sello del formulario de acceso: el isotipo llena el cuadro. */
.acceso-sello .ml-sello{width:26px;height:26px;display:block;}
.acceso-sello{--ml-acento:#12CDB8;}
