/* ============================================================
   RELEVANTE.IA · ARKO
   Asistente de la web. Botón fijo abajo a la derecha y panel de
   conversación. Mismos materiales que el resto del sitio: cristal
   claro, cabecera oscura y lima solo como fondo, nunca como texto.
   ============================================================ */

.arko { --arko-sube: 0px; position: fixed; right: 20px; bottom: calc(20px + var(--arko-sube)); z-index: 80; font-family: var(--font-sans); transition: bottom 300ms var(--ease-out); }
.arko[hidden] { display: none; }

/* ---------- Botón: Cami suelto, sin placa detrás ---------- */
.arko__boton { position: relative; display: block; width: 76px; height: 86px; padding: 0; border: 0; border-radius: 22px; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.arko__boton:focus-visible, .arko__cerrar:focus-visible, .arko__enviar:focus-visible, .arko__pregunta:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 5px var(--accent); }
.arko__boton img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; pointer-events: none; transform-origin: 50% 100%; filter: drop-shadow(0 10px 12px rgba(10, 10, 10, 0.28)) drop-shadow(0 2px 3px rgba(10, 10, 10, 0.2)); transition: transform 320ms var(--ease-out), filter 320ms ease; }
.arko__boton:hover img { transform: translateY(-4px) rotate(-4deg) scale(1.04); filter: drop-shadow(0 16px 16px rgba(10, 10, 10, 0.3)) drop-shadow(0 2px 3px rgba(10, 10, 10, 0.2)); }
.arko__boton:active img { transform: scale(0.96); }
.arko.esta-abierto .arko__boton img { transform: none; }

/* Rótulo: asoma una vez al cargar y vuelve al pasar el cursor */
.arko__rotulo { position: absolute; right: calc(100% + 10px); top: 50%; padding: 9px 13px; border-radius: 12px; white-space: nowrap; font-size: 13.5px; font-weight: 600; color: var(--ink); background: rgba(255, 255, 255, 0.94); border: 1px solid #FFFFFF; box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.05), 0 14px 30px -16px rgba(10, 10, 10, 0.4); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); opacity: 0; transform: translate(8px, -50%); pointer-events: none; transition: opacity 250ms ease, transform 300ms var(--ease-out); }
.arko__boton:hover .arko__rotulo, .arko__boton:focus-visible .arko__rotulo, .arko.saluda .arko__rotulo { opacity: 1; transform: translate(0, -50%); }
.arko.esta-abierto .arko__rotulo { opacity: 0; }

/* ---------- Panel ---------- */
.arko__panel { position: absolute; right: 0; bottom: 98px; width: 384px; max-width: calc(100vw - 24px); height: min(600px, calc(100vh - 170px)); height: min(600px, calc(100dvh - 170px)); display: flex; flex-direction: column; border-radius: 24px; background: rgba(255, 255, 255, 0.97); border: 1px solid #FFFFFF; box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.06), 0 40px 80px -30px rgba(10, 10, 10, 0.5); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); transform-origin: 100% 100%; animation: arko-abre 260ms var(--ease-out) both; }
.arko__panel[hidden] { display: none; }
@keyframes arko-abre { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }

.arko__cab { position: relative; flex: none; display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px 12px 12px 96px; border-radius: 23px 23px 0 0; color: #FFFFFF; background: radial-gradient(80% 90% at 0% 0%, #2A2F33 0%, rgba(42, 47, 51, 0) 60%), linear-gradient(170deg, #17191C, #070808); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16); }
/* Arko asoma por encima del panel, apoyado en la línea de la cabecera */
.arko__figura { position: absolute; left: 16px; bottom: 0; width: 70px; height: auto; pointer-events: none; }
.arko__quien { min-width: 0; flex: 1; }
.arko__nombre { display: block; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
.arko__papel { display: block; margin-top: 2px; font-family: var(--font-brand); font-size: 12.5px; color: var(--on-ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arko__cerrar { flex: none; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #FFFFFF; cursor: pointer; transition: background 150ms ease; }
.arko__cerrar:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- Conversación ---------- */
.arko__hilo { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.arko__msj { max-width: 86%; padding: 10px 13px; font-size: 14.5px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.arko__msj p { margin: 0; }
.arko__msj p + p, .arko__msj p + ul, .arko__msj ul + p { margin-top: 8px; }
.arko__msj ul { margin: 0; padding-left: 18px; list-style: disc; }
.arko__msj li + li { margin-top: 3px; }
.arko__msj--arko { align-self: flex-start; background: #F1F2EE; border-radius: 16px 16px 16px 5px; }
.arko__msj--tu { align-self: flex-end; background: var(--ink); color: #FFFFFF; border-radius: 16px 16px 5px 16px; }
.arko__msj a { color: inherit; font-weight: 600; text-decoration: none; background: linear-gradient(transparent 60%, var(--accent) 60%); border-radius: 2px; }
.arko__msj a:hover { background: var(--accent); }

.arko__espera { display: inline-flex; gap: 5px; align-items: center; height: 22px; }
.arko__espera i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); opacity: 0.25; animation: arko-punto 1.1s ease-in-out infinite; }
.arko__espera i:nth-child(2) { animation-delay: 0.16s; }
.arko__espera i:nth-child(3) { animation-delay: 0.32s; }
@keyframes arko-punto { 0%, 70%, 100% { opacity: 0.25; transform: none; } 35% { opacity: 0.9; transform: translateY(-3px); } }

/* Preguntas de arranque: filas, no etiquetas */
.arko__preguntas { align-self: stretch; margin: 4px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.arko__preguntas li { border-bottom: 1px solid var(--rule); }
.arko__pregunta { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 6px 12px 4px; border: 0; background: transparent; font: inherit; font-size: 14.5px; font-weight: 550; text-align: left; color: var(--ink); cursor: pointer; border-radius: 8px; transition: background 150ms ease, padding 200ms var(--ease-out); }
.arko__pregunta:hover { background: var(--accent); padding-left: 10px; }
.arko__pregunta svg { flex: none; }

/* ---------- Escribir ---------- */
.arko__form { flex: none; display: flex; align-items: flex-end; gap: 8px; margin: 6px 12px 0; padding: 6px 6px 6px 14px; border-radius: 16px; background: #FFFFFF; border: 1px solid rgba(10, 10, 10, 0.14); transition: border-color 150ms ease, box-shadow 150ms ease; }
.arko__form:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(221, 245, 10, 0.55); }
.arko__campo { flex: 1; min-width: 0; max-height: 104px; padding: 8px 0; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: 16px; line-height: 1.4; color: var(--ink); }
.arko__campo::placeholder { color: var(--muted); }
.arko__enviar { flex: none; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: var(--accent); color: var(--ink); cursor: pointer; transition: transform 200ms var(--ease-out), filter 150ms ease, opacity 150ms ease; }
.arko__enviar:hover { filter: brightness(0.94); transform: translateY(-1px); }
.arko__enviar[disabled] { opacity: 0.4; cursor: default; transform: none; }
.arko__nota { flex: none; margin: 0; padding: 9px 16px 13px; font-family: var(--font-brand); font-size: 11.5px; line-height: 1.45; color: var(--muted); text-align: center; }
.arko__nota a { color: var(--ink); text-decoration: underline; }

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
  .arko { right: 14px; bottom: calc(14px + var(--arko-sube)); }
  .arko__boton { width: 62px; height: 70px; }
  .arko__rotulo { display: none; }
  .arko.esta-abierto { --arko-sube: 0px; }
  .arko.esta-abierto .arko__boton { visibility: hidden; }
  .arko__panel { position: fixed; left: 8px; right: 8px; bottom: var(--arko-teclado, 8px); width: auto; max-width: none; height: min(620px, calc(var(--arko-alto, 100dvh) - 46px)); border-radius: 22px; transform-origin: 50% 100%; }
  .arko__cab { border-radius: 21px 21px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .arko, .arko__boton, .arko__boton img, .arko__rotulo, .arko__pregunta, .arko__enviar { transition: none; }
  .arko__panel { animation: none; }
  .arko__espera i { animation: none; opacity: 0.5; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .arko__panel, .arko__rotulo { background: #FFFFFF; }
}

@media print { .arko { display: none; } }

/* Con el menú del móvil abierto, el botón de Arko se aparta para no tapar la lista */
body.overlay-abierto .arko:not(.esta-abierto) { visibility: hidden; }
