/* JAYU v19.2.1 · OBSIDIANA IMMERSIVE EXPERIENCE (ver jayu-immersive-1921.js)
 * Aditiva y reversible (?ix=off). Prefijo html.ix body:not(#ix0) para ganar a capas previas sin tocarlas.
 */
:root { --ix-violet: #a78bfa; --ix-cyan: #5ee7f0; --ix-magenta: #e8579f; --ix-ink: #ece8ff; --ix-ink-2: #a9a2cc; --ix-line: rgba(167, 139, 250, .18); --ix-hero: 0; --ix-safe-b: env(safe-area-inset-bottom, 0px); --ix-safe-t: env(safe-area-inset-top, 0px); }

/* ---------- universo 3D de fondo */
html.ix .ix-universe { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh; z-index: -1; pointer-events: none; opacity: .92; contain: strict; }
html.ix[data-ix-route="admin"] .ix-universe { opacity: .45; }
html.ix[data-ix-route="terminal"] .ix-universe { opacity: .55; }

/* ---------- globo de partículas unificado */
html.ix .ixg { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; z-index: 0; }
html.ix .ixg > img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 18px rgba(139, 92, 246, .35)); animation: ixBreath 9s ease-in-out infinite; }
html.ix .ixg > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
html.ix body:not(#ix0) .hub-core { position: relative; isolation: isolate; }
html.ix body:not(#ix0) .hub-core > img { opacity: 0 !important; }
html.ix body:not(#ix0) .hub-core > .ixg { inset: auto; left: 50%; top: 0; width: 96px; height: 96px; transform: translateX(-50%); }
html.ix body:not(#ix0) .orbit-core { position: relative; }
html.ix body:not(#ix0) .orbit-core > img, html.ix body:not(#ix0) .intro-emblem > img { opacity: 0 !important; }
html.ix body:not(#ix0) .intro-emblem { position: relative; }
html.ix body:not(#ix0) .jr-cover > .ixg.is-cover { inset: -6% -4% auto auto; width: min(46vw, 520px); aspect-ratio: 1; height: auto; opacity: .62; z-index: -1; transform: translateY(-6%); mask-image: radial-gradient(circle, #000 55%, transparent 72%); -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 72%); }
html.ix body:not(#ix0) .jr-cover > .ox-globe.is-report { opacity: .0 !important; }
/* el motor Three.js del globo institucional dibuja ya el globo de partículas: se retira el halo violeta antiguo */
html.ix.ix-globe-3d body:not(#ix0) .jayu-institutional-globe { background: radial-gradient(ellipse at 50% 52%, rgba(94, 231, 240, .07), transparent 62%) !important; }
/* expansión / contracción del globo de portada al desplazarse */
html.ix[data-ix-route="home"]:not(.ix-still) body:not(#ix0) #jayu-universe .jayu-institutional-globe { scale: calc(1 + var(--ix-hero) * .22); opacity: calc(1 - var(--ix-hero) * .55); transition: none; will-change: scale, opacity; }
html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe > .ox-globe { scale: calc(1 + var(--ix-hero) * .35); }
@keyframes ixBreath { 50% { transform: scale(1.025); filter: drop-shadow(0 0 28px rgba(94, 231, 240, .32)); } }

/* tarjetas y portadas de informes: sello del globo */
html.ix body:not(#ix0) :is(.jy-latest-card--featured, .report-card, [data-jayu-current-heading]) { position: relative; }
html.ix body:not(#ix0) .jy-latest-card--featured::after, html.ix body:not(#ix0) .report-card::after {
  content: ""; position: absolute; right: 10px; top: 10px; width: 46px; height: 46px; pointer-events: none; opacity: .85;
  background: url("/assets/obsidiana/jayu-particle-globe-256.webp") center / contain no-repeat; filter: drop-shadow(0 0 10px rgba(139, 92, 246, .45));
}
html.ix body:not(#ix0) .ix-nl-current img { background: #04030a; }

/* ---------- cabecera inteligente: opaca al desplazarse (sin texto por debajo) y, en móvil, se aparta al bajar */
html.ix.ix-scrolled body:not(#ix0) header.topbar { background: rgba(6, 5, 14, .9) !important; -webkit-backdrop-filter: saturate(140%) blur(14px); backdrop-filter: saturate(140%) blur(14px); box-shadow: 0 1px 0 rgba(167, 139, 250, .14); }
@media (max-width: 760px) {
  html.ix body:not(#ix0) header.topbar { transition: transform .3s cubic-bezier(.2, .7, .1, 1); }
  html.ix.ix-down body:not(#ix0) header.topbar { transform: translateY(-112%); }
  html.ix body:not(#ix0) .obsidian-event-toast { min-height: 0 !important; padding: 8px 14px !important; font-size: 12.5px !important; opacity: .94; }
  html.ix.ix-down body:not(#ix0) .obsidian-event-toast { opacity: 0 !important; transform: translateY(12px); transition: opacity .25s, transform .25s; }
}
/* ---------- leyenda: señal real vs movimiento decorativo */
html.ix body:not(#ix0) .ix-legend { display: flex !important; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 10px 0 0 !important; font: 500 11px/1.45 "JetBrains Mono", ui-monospace, monospace !important; color: var(--ix-ink-2) !important; letter-spacing: .01em !important; text-transform: none !important; }
html.ix body:not(#ix0) .ix-legend > span:not(.ix-k) { font: inherit !important; }
html.ix .ix-k { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: -4px; }
html.ix .ix-k--real { background: var(--ix-cyan); box-shadow: 0 0 10px var(--ix-cyan); }
html.ix .ix-k--deco { background: rgba(167, 139, 250, .38); }
html.ix .ix-legend-last { flex-basis: 100%; color: #7f78a6; }
html.ix .ix-legend.has-real .ix-legend-last { color: var(--ix-cyan); }
html.ix body:not(#ix0) .ix-glow { box-shadow: 0 0 0 1px rgba(94, 231, 240, .45), 0 0 26px rgba(139, 92, 246, .55) !important; transition: box-shadow .5s ease; }

/* ---------- transición cinematográfica (salida) */
html.ix .ix-warp { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; opacity: 0; transition: opacity .18s ease; }
html.ix .ix-warp.is-on { opacity: 1; }
html.ix .ix-warp-glow { position: absolute; inset: 0; background: radial-gradient(circle at var(--ix-x) var(--ix-y), color-mix(in srgb, var(--ix-c, #8b5cf6) 40%, transparent), rgba(4, 3, 10, .92) 46%, #04030a 78%); opacity: 0; transition: opacity .42s ease; }
html.ix .ix-warp.is-on .ix-warp-glow { opacity: 1; }
html.ix .ix-warp img { position: absolute; left: var(--ix-x); top: var(--ix-y); width: 38vmin; height: 38vmin; margin: -19vmin 0 0 -19vmin; object-fit: contain; transform: scale(.5); opacity: .2; transition: transform .46s cubic-bezier(.2, .7, .1, 1), opacity .3s ease; }
html.ix .ix-warp.is-on img { transform: scale(3.4); opacity: .95; }
html.ix .ix-warp--agent img { filter: hue-rotate(0deg) drop-shadow(0 0 30px var(--ix-c, #8b5cf6)); }
html.ix .ix-warp canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- llegada: el globo se abre y aparece el informe */
html.ix.ix-arrive::after {
  content: ""; position: fixed; inset: 0; z-index: 2147483000; pointer-events: none;
  background: url("/assets/obsidiana/jayu-particle-globe.webp") center / 60vmin no-repeat, radial-gradient(circle, rgba(60, 30, 120, .5), #04030a 70%);
  animation: ixArriveOut .9s cubic-bezier(.2, .7, .1, 1) forwards;
}
html.ix.ix-arrive body:not(#ix0) :is(.jr-cover, main > .intro, main > header, .jr-wrap > header) { animation: ixArriveIn .9s cubic-bezier(.2, .7, .1, 1) both; }
@keyframes ixArriveOut { 0% { opacity: 1; background-size: 60vmin, cover; } 100% { opacity: 0; background-size: 260vmin, cover; } }
@keyframes ixArriveIn { 0% { opacity: 0; transform: translateY(18px) scale(.985); filter: blur(6px); } 100% { opacity: 1; transform: none; filter: none; } }

/* ---------- revelado suave de secciones (contenido siempre presente en el DOM) */
html.ix.ix-reveal body:not(#ix0) :is(.obsidian-home-stage, .jr-section, .jr-scenarios, .jr-figure, main .panel, .agent-card):not(.ix-in) { opacity: 0; transform: translateY(22px); }
html.ix.ix-reveal body:not(#ix0) :is(.obsidian-home-stage, .jr-section, .jr-scenarios, .jr-figure, main .panel, .agent-card).ix-in { opacity: 1; transform: none; transition: opacity .7s ease, transform .8s cubic-bezier(.2, .7, .1, 1); }

/* ---------- compactación (escritorio) */
html.ix[data-ix-route="home"] body:not(#ix0) .obsidian-home-stage { padding-top: 38px !important; }
html.ix[data-ix-route="home"] body:not(#ix0) .obsidian-stage-heading { margin-bottom: 14px !important; }
html.ix body.jr:not(#ix0) .jr-cover { padding-top: clamp(22px, 4vw, 48px) !important; padding-bottom: clamp(18px, 3vw, 36px) !important; }

/* ---------- plegado progresivo (móvil): información ampliable al pulsar */
html.ix .ix-fold-btn { display: none; }
@media (max-width: 760px) {
  html.ix body:not(#ix0) [data-ix-fold].ix-folded:not(.ix-open) { max-height: 620px !important; overflow: hidden !important; -webkit-mask-image: linear-gradient(#000 78%, transparent); mask-image: linear-gradient(#000 78%, transparent); }
  html.ix .ix-fold-btn:not([hidden]) { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin: 8px 0 14px; border: 1px solid var(--ix-line); border-radius: 12px; background: rgba(14, 10, 30, .72); color: var(--ix-ink); font: 600 13px/1 system-ui, sans-serif; letter-spacing: .02em; }
  html.ix .ix-fold-btn::after { content: "↓"; color: var(--ix-cyan); transition: transform .2s; }
  html.ix .ix-fold-btn[aria-expanded="true"]::after { transform: rotate(180deg); }

  /* portada compacta */
  html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe { padding-top: 18px !important; padding-bottom: 10px !important; min-height: 0 !important; }
  html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe .obsidian-universe-kicker { letter-spacing: .2em !important; font-size: 9.5px !important; margin-bottom: 8px !important; }
  html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe .jayu-universe-copy h1 { font-size: clamp(1.85rem, 8.4vw, 2.25rem) !important; line-height: 1.04 !important; margin-bottom: 10px !important; }
  html.ix[data-ix-route="home"] body:not(#ix0) .jayu-hero-lead[data-ix-clamp] { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-size: 15px !important; line-height: 1.45 !important; margin-bottom: 10px !important; cursor: pointer; }
  html.ix[data-ix-route="home"] body:not(#ix0) .jayu-hero-lead[data-ix-clamp].ix-open { -webkit-line-clamp: unset; }
  html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe .jayu-hero-meta { flex-wrap: nowrap !important; overflow-x: auto; justify-content: flex-start !important; gap: 14px !important; margin: 4px 0 12px !important; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe .jayu-hero-meta::-webkit-scrollbar { display: none; }
  html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe .jayu-hero-meta span { flex: none; }
  html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe .hero-cta { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe .hero-cta .btn { min-height: 46px !important; padding: 10px 12px !important; font-size: 14px !important; margin: 0 !important; width: auto !important; }
  html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe .hero-cta .btn.obsidian-explore { grid-column: 1 / -1 !important; }
  html.ix[data-ix-route="home"] body:not(#ix0) #jayu-universe .jy-secondary { margin-top: 8px !important; gap: 14px !important; font-size: 13px !important; }
  html.ix[data-ix-route="home"] body:not(#ix0) .obsidian-home-stage { padding-top: 24px !important; }
  html.ix[data-ix-route="home"] body:not(#ix0) .obsidian-stage-heading { margin-bottom: 8px !important; }
  html.ix[data-ix-route="home"] body:not(#ix0) .obsidian-stage-heading h2 { font-size: clamp(1.7rem, 8vw, 2.2rem) !important; }
  html.ix body.jr:not(#ix0) .jr-cover h1 { font-size: clamp(1.75rem, 7.6vw, 2.3rem) !important; line-height: 1.06 !important; }
  html.ix body:not(#ix0) .jr-cover > .ixg.is-cover { width: 78vw; inset: -4% -22% auto auto; opacity: .42; }

  /* banda de grandes operaciones: propia, sin tapar la cabecera ni la banda de cotizaciones */
  html.ix body:not(#ix0) .obsidian-event-toast { top: auto !important; bottom: calc(var(--ix-safe-b) + 92px) !important; left: 12px !important; right: 66px !important; max-width: none !important; font-size: 13px !important; }
  html.ix body:not(#ix0) #sync-indicator.sync-indicator { top: calc(var(--ix-safe-t) + 8px) !important; bottom: auto !important; right: 10px !important; left: auto !important; transform: scale(.86); transform-origin: top right; }

  /* botones flotantes inteligentes: se apartan al bajar, vuelven al subir */
  html.ix body:not(#ix0) :is(.jayu-neural-voice-toggle, .jayu-market-radio, #risk-tools.obsidian-risk-float) { transition: transform .32s cubic-bezier(.2, .7, .1, 1), opacity .25s ease; }
  html.ix.ix-down body:not(#ix0) :is(.jayu-neural-voice-toggle, .jayu-market-radio:not([open]), #risk-tools.obsidian-risk-float:not([open])) { transform: translateX(74px); opacity: 0; pointer-events: none; }
  html.ix body:not(#ix0) .jayu-notifications { transition: transform .32s cubic-bezier(.2, .7, .1, 1), opacity .25s ease; }
  html.ix.ix-down body:not(#ix0) .jayu-notifications { transform: translateX(-74px); opacity: 0; pointer-events: none; }
  html.ix body:not(#ix0) main { padding-bottom: calc(var(--ix-safe-b) + 24px); }
  html.ix[data-ix-route="admin"] body:not(#ix0) { padding-bottom: calc(var(--ix-safe-b) + 150px) !important; }
  html.ix body:not(#ix0) :is(h1, h2, h3, .jr-cover h1) { overflow-wrap: anywhere; hyphens: auto; }
}

/* ---------- panel OWNER de envío automático */
.jrm { margin-top: 18px; padding: 16px; border: 1px solid rgba(94, 231, 240, .22); border-radius: 14px; background: rgba(8, 10, 24, .7); }
.jrm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.jrm h3 { margin: 0; font-size: 16px; } .jrm h4 { margin: 14px 0 6px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #9b93c4; }
.jrm-pill { font: 600 11px/1 ui-monospace, monospace; letter-spacing: .08em; padding: 6px 10px; border-radius: 999px; border: 1px solid; }
.jrm-pill.is-off { color: #f5b94a; border-color: rgba(245, 185, 74, .4); } .jrm-pill.is-on { color: #3fe0a8; border-color: rgba(63, 224, 168, .45); }
.jrm-intro { margin: 8px 0 10px; color: #b7b0d8; font-size: 13px; line-height: 1.5; }
.jrm-checks { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.jrm-checks li::before { content: "○ "; color: #f5b94a; } .jrm-checks li.ok::before { content: "● "; color: #3fe0a8; }
.jrm-meta { margin: 6px 0 0; color: #9b93c4; font-size: 12px; }
.jrm-cands { display: grid; gap: 6px; margin-bottom: 12px; }
.jrm-cand { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(167, 139, 250, .16); font-size: 12px; }
.jrm-cand strong { font-weight: 600; overflow-wrap: anywhere; } .jrm-cand span { color: #9b93c4; } .jrm-cand.ok { border-color: rgba(63, 224, 168, .4); }
.jrm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.jrm-btn, .jrm-mode { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(167, 139, 250, .35); background: rgba(20, 14, 40, .9); color: #ece8ff; font: 600 13px/1 system-ui, sans-serif; }
.jrm-btn.is-primary { background: linear-gradient(90deg, #2dd4bf, #8b5cf6); border: 0; color: #05030c; }
.jrm-btn.is-ghost { background: transparent; }
.jrm-btn:disabled { opacity: .45; }
.jrm-feedback { min-height: 18px; margin-top: 10px; font-size: 13px; color: #5ee7f0; overflow-wrap: anywhere; }
.jrm-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 260px; overflow: auto; font-size: 12px; }
.jrm-h { display: grid; grid-template-columns: 88px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(167, 139, 250, .08); color: #c9c2ea; overflow-wrap: anywhere; }
.jrm-h time { color: #8f86b6; font-family: ui-monospace, monospace; }
.jrm-h--error, .jrm-h--test-error, .jrm-h--manual-error { color: #ff8da1; }

/* ---------- movimiento reducido: todo estático */
@media (prefers-reduced-motion: reduce) {
  html.ix .ixg > img { animation: none !important; }
  html.ix.ix-reveal body:not(#ix0) :is(.obsidian-home-stage, .jr-section, .jr-scenarios, .jr-figure, main .panel, .agent-card) { opacity: 1 !important; transform: none !important; }
  html.ix.ix-arrive::after { display: none; }
}
