/* ---------------- Vista 3D (web/vista3d.js): pantallas de vidrio en el espacio ---------------- */
/* colores del mundo: los del tema de la principal (web/temas.js pone --acc / --acc2 / --info / --bg en :root); se
   oscurecen siempre, así la escena queda de noche también con un tema claro */
#v3d { --w1: var(--acc, #8b5cf6); --w2: var(--acc2, #22d3ee); --w3: var(--info, #ec4899); --wbg: color-mix(in srgb, var(--bg, #0a0d1d) 30%, #05060d);
  position: fixed; inset: 0; z-index: 400; display: none; overflow: hidden; perspective: 1700px; perspective-origin: 50% 42%;
  background: radial-gradient(120% 80% at 50% 115%, color-mix(in srgb, var(--w1) 26%, var(--wbg)) 0%, var(--wbg) 45%, color-mix(in srgb, var(--wbg) 40%, #000) 100%);
  opacity: 0; transition: opacity .55s ease; }
#v3d.show { display: block; }
/* precalentada (web/vista3d.js, warm): las tres apps arrancan con su tamaño real pero no se ven ni se tocan */
#v3d.warm:not(.show) { display: block; visibility: hidden; pointer-events: none; }
#v3d.on, #v3d.lit { opacity: 1; }
#v3d.out { opacity: 0; transition: opacity .6s ease .15s; }
body.v3d-on > *:not(#v3d):not(#tbTip):not(#tour):not(#ofLogin):not(script) { visibility: hidden; }

/* cielo: auroras que respiran y estrellas que derivan */
.v3-sky { position: absolute; inset: 0; pointer-events: none; }
/* (gradientes que ya nacen difusos: sin filter blur ni mix-blend, que la placa tenía que recalcular en cada cuadro) */
.v3-aur { position: absolute; width: 80vw; height: 80vw; border-radius: 50%; opacity: .5; will-change: transform; --c: var(--w1);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--c) 70%, transparent), color-mix(in srgb, var(--c) 25%, transparent) 45%, transparent); }
.v3-aur.a1 { left: -28vw; top: -40vw; animation: v3Aur 18s ease-in-out infinite; }
.v3-aur.a2 { right: -30vw; top: -35vw; --c: var(--w2); animation: v3Aur 22s ease-in-out infinite reverse; }
.v3-aur.a3 { left: 15vw; bottom: -55vw; --c: var(--w3); opacity: .3; animation: v3Aur 26s ease-in-out infinite 3s; }
@keyframes v3Aur { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(6vw, 4vw) scale(1.12); } 66% { transform: translate(-4vw, 6vw) scale(.92); } }
.v3-stars { position: absolute; inset: -50%; opacity: .55;
  background-image: radial-gradient(1px 1px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 120px 80px, #c7d2fe, transparent),
    radial-gradient(1.5px 1.5px at 200px 160px, #fff, transparent), radial-gradient(1px 1px at 60px 200px, #a5f3fc, transparent), radial-gradient(1px 1px at 260px 40px, #fbcfe8, transparent);
  background-size: 300px 240px; animation: v3Drift 120s linear infinite; will-change: transform; }
.v3-stars.s2 { opacity: .3; background-size: 190px 170px; animation-duration: 80s; animation-direction: reverse; }
@keyframes v3Drift { to { transform: translate(300px, 240px); } }

/* piso: grilla en perspectiva que avanza hacia vos */
.v3-floor { position: absolute; left: -60%; right: -60%; bottom: -4%; height: 62%; transform-origin: 50% 100%; transform: rotateX(80deg); pointer-events: none;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%); mask-image: linear-gradient(to top, #000 10%, transparent 85%); }
.v3-floor { overflow: hidden; }
.v3-floor i { position: absolute; left: 0; right: 0; top: -70px; bottom: 0; will-change: transform;
  background-image: linear-gradient(color-mix(in srgb, var(--w2) 24%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--w1) 22%, transparent) 1px, transparent 1px);
  background-size: 70px 70px; animation: v3Grid 4s linear infinite; }
@keyframes v3Grid { to { transform: translateY(70px); } }

/* escena */
.v3-stage { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.v3-scr { position: absolute; left: 0; top: 0; transform-style: preserve-3d; --d: 16px;
  transition: transform 1.1s cubic-bezier(.34, 1.25, .5, 1), opacity .6s ease; }
.v3-body { position: absolute; width: var(--w); height: var(--h); left: calc(var(--w) / -2); top: calc(var(--h) / -2); transform-style: preserve-3d;
  transition: scale 1.1s cubic-bezier(.34, 1.25, .5, 1), transform .6s cubic-bezier(.34, 1.56, .64, 1); }
.v3-scr:hover .v3-body { transform: translateZ(26px); }
/* entrar: explotan desde el centro con rebote elástico (la escala va después del lugar, así que también las abre
   hacia afuera), primero la del frente (--k, web/vista3d.js) · salir: se inflan un poquito e implotan al centro */
#v3d.enter .v3-scr { opacity: 0; scale: .04; transition: none; }
#v3d.on .v3-scr { animation: v3Pop 1.15s both; animation-delay: calc(var(--k, 0) * 110ms); }
@keyframes v3Pop {
  0% { scale: .04; opacity: 0; animation-timing-function: cubic-bezier(.15, .85, .35, 1); }
  14% { opacity: 1; }
  42% { scale: 1.1; animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  62% { scale: .955; animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  80% { scale: 1.022; animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  100% { scale: 1; opacity: 1; } }
#v3d.out .v3-scr { animation: v3Out .6s both; animation-delay: calc(var(--k, 0) * 55ms); }
@keyframes v3Out {
  0% { scale: 1; opacity: 1; animation-timing-function: cubic-bezier(.3, 1.6, .6, 1); }
  32% { scale: 1.08; opacity: 1; animation-timing-function: cubic-bezier(.7, 0, .9, .45); }
  100% { scale: .03; opacity: 0; } }
/* onda expansiva al entrar (y al revés al salir) */
.v3-shock { position: absolute; left: 50%; top: 46%; width: 150vmax; height: 150vmax; margin: -75vmax 0 0 -75vmax; border-radius: 50%; pointer-events: none;
  border: 3px solid color-mix(in srgb, var(--w1) 70%, #fff); box-shadow: 0 0 40px color-mix(in srgb, var(--w1) 70%, transparent), inset 0 0 60px color-mix(in srgb, var(--w2) 35%, transparent); opacity: 0; scale: .01; will-change: scale, opacity; }
#v3d.on .v3-shock { animation: v3Shock 1s cubic-bezier(.1, .7, .3, 1) both; }
#v3d.out .v3-shock { animation: v3Shock .55s cubic-bezier(.6, 0, .9, .3) reverse both; }
@keyframes v3Shock { 0% { scale: .01; opacity: 1; } 60% { opacity: .5; } 100% { scale: 1; opacity: 0; } }

/* el vidrio: marco grueso con luz arriba, canto con espesor (los cuatro lados hacia atrás) y brillo que cruza */
.v3-glass { position: absolute; inset: 0; border-radius: 20px;
  background: linear-gradient(140deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05) 38%, rgba(255, 255, 255, .03) 62%, rgba(255, 255, 255, .12));
  border: 1px solid rgba(255, 255, 255, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(255, 255, 255, .12), 0 30px 50px rgba(0, 0, 0, .55);
  transition: border-color .4s; }
.v3-glass::before { content: ''; position: absolute; inset: -2px; border-radius: 22px; pointer-events: none; z-index: -1; opacity: .45; will-change: opacity;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--hue) 40%, transparent), 0 0 50px color-mix(in srgb, var(--hue) 45%, transparent); transition: opacity .5s; }
.v3-scr.front .v3-glass::before { opacity: .8; }
.v3-scr.act .v3-glass { border-color: color-mix(in srgb, var(--hue) 75%, #fff); }
.v3-scr.act .v3-glass::before { animation: v3Act 2.4s ease-in-out infinite; }
@keyframes v3Act { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
.v3-view { position: absolute; inset: 10px; border-radius: 13px; overflow: hidden; background: #05070c; box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), 0 0 0 2px rgba(255, 255, 255, .06); }
.v3-view iframe { display: block; width: 100%; height: 100%; border: 0; background: #05070c; }
.v3-edge { position: absolute; pointer-events: none; opacity: .9;
  background: linear-gradient(90deg, color-mix(in srgb, var(--hue) 40%, rgba(255, 255, 255, .25)), rgba(255, 255, 255, .06) 45%, color-mix(in srgb, var(--hue) 25%, rgba(255, 255, 255, .12))); }
.v3-edge.l { left: 0; top: 16px; bottom: 16px; width: var(--d); transform-origin: 0 50%; transform: rotateY(90deg); border-radius: 0 6px 6px 0; }
.v3-edge.r { right: 0; top: 16px; bottom: 16px; width: var(--d); transform-origin: 100% 50%; transform: rotateY(-90deg); border-radius: 6px 0 0 6px; }
.v3-edge.t { top: 0; left: 16px; right: 16px; height: var(--d); transform-origin: 50% 0; transform: rotateX(-90deg); border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .4), color-mix(in srgb, var(--hue) 20%, rgba(255, 255, 255, .08))); }
.v3-edge.b { bottom: 0; left: 16px; right: 16px; height: var(--d); transform-origin: 50% 100%; transform: rotateX(90deg); border-radius: 6px 6px 0 0;
  background: linear-gradient(0deg, color-mix(in srgb, var(--hue) 35%, rgba(255, 255, 255, .15)), rgba(255, 255, 255, .05)); }
.v3-sheen { position: absolute; inset: 0; border-radius: 20px; pointer-events: none; overflow: hidden; }
.v3-sheen::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 60%; will-change: transform; transform: translateX(-110%);
  background: linear-gradient(112deg, transparent 20%, rgba(255, 255, 255, .1) 45%, rgba(255, 255, 255, .02) 58%, transparent 75%);
  animation: v3Sheen 9s ease-in-out infinite; animation-delay: inherit; }
.v3-scr[data-i="1"] .v3-sheen { animation-delay: 3s; } .v3-scr[data-i="2"] .v3-sheen { animation-delay: 6s; }
#v3d.moving .v3-sheen::before { animation: v3Sweep 1.2s cubic-bezier(.3, .1, .3, 1); }
@keyframes v3Sheen { 0%, 70% { transform: translateX(-110%); } 100% { transform: translateX(190%); } }
@keyframes v3Sweep { 0% { transform: translateX(-110%); } 100% { transform: translateX(190%); } }
/* charco de luz en el piso */
.v3-pool { position: absolute; left: 8%; right: 8%; bottom: -90px; height: 70px; border-radius: 50%; pointer-events: none; opacity: .55; will-change: opacity;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--hue) 55%, transparent), color-mix(in srgb, var(--hue) 15%, transparent) 60%, transparent); transform: rotateX(78deg); animation: v3Pool 4s ease-in-out infinite; }
@keyframes v3Pool { 50% { opacity: .85; } }

/* cartel con el par y la vela: tocarlo trae la pantalla al frente */
.v3-tag { position: absolute; left: 50%; top: -38px; transform: translateX(-50%) translateZ(18px); display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 12px 0 9px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(12, 16, 30, .72); color: #e2e8f0; font: 600 11px var(--sans, system-ui); cursor: pointer; white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5), 0 0 18px color-mix(in srgb, var(--hue) 25%, transparent); transition: scale .45s cubic-bezier(.34, 1.9, .5, 1), box-shadow .25s; }
.v3-tag:hover { scale: 1.1; box-shadow: 0 8px 22px rgba(0, 0, 0, .5), 0 0 26px color-mix(in srgb, var(--hue) 55%, transparent); }
.v3-tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--hue); box-shadow: 0 0 10px var(--hue); animation: v3Dot 2s ease-in-out infinite; }
@keyframes v3Dot { 50% { opacity: .45; } }
.v3-tag span { font-family: var(--mono, ui-monospace); color: color-mix(in srgb, var(--hue) 55%, #fff); }
.v3-tag span:empty { display: none; }

/* cargando: dos anillos que giran */
.v3-load { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 4px; pointer-events: none; color: #cbd5e1;
  background: radial-gradient(70% 60% at 50% 45%, color-mix(in srgb, var(--hue) 14%, #0b1020), #04060b); transition: opacity .7s ease, filter .7s ease; }
.v3-load b { font: 700 14px var(--sans, system-ui); margin-top: 90px; letter-spacing: .02em; }
.v3-load em { font: 400 11.5px var(--sans, system-ui); font-style: normal; color: #94a3b8; }
.v3-ring { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -54px 0 0 -32px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 55%, var(--hue) 100%); -webkit-mask: radial-gradient(closest-side, transparent 82%, #000 84%); mask: radial-gradient(closest-side, transparent 82%, #000 84%);
  animation: v3Spin 1.1s linear infinite; filter: drop-shadow(0 0 8px var(--hue)); }
.v3-ring.r2 { width: 44px; height: 44px; margin: -44px 0 0 -22px; animation-duration: 1.7s; animation-direction: reverse; opacity: .7; }
@keyframes v3Spin { to { rotate: 360deg; } }
.v3-scr.ready .v3-load { opacity: 0; filter: blur(8px); }

/* dock de abajo: ‹ disposiciones › · salir */
.v3-dock { position: absolute; left: 50%; bottom: 14px; translate: -50% 0; display: flex; align-items: center; gap: 3px; padding: 4px; border-radius: 15px;
  background: rgba(14, 18, 34, .62); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 20px 50px rgba(0, 0, 0, .6), 0 0 40px color-mix(in srgb, var(--w1) 18%, transparent); }
#v3d.on .v3-dock { animation: v3Dock .9s cubic-bezier(.34, 1.56, .64, 1) both .35s; }
@keyframes v3Dock { 0% { opacity: 0; transform: translateY(70px) scale(.7); filter: blur(8px); } 100% { opacity: 1; transform: none; filter: none; } }
.v3-dock button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 30px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  background: transparent; color: #cbd5e1; font: 600 11px var(--sans, system-ui); transition: scale .45s cubic-bezier(.34, 1.9, .5, 1), background .2s, color .2s, box-shadow .25s, border-color .2s; }
.v3-dock button:hover { scale: 1.1; color: #fff; background: rgba(255, 255, 255, .08); }
.v3-dock button:active { scale: .9; transition-duration: .06s; }
.v3-nav { width: 32px; background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .02)) !important; border-color: rgba(255, 255, 255, .14) !important; }
.v3-nav:hover { box-shadow: 0 0 22px color-mix(in srgb, var(--w2) 45%, transparent); color: color-mix(in srgb, var(--w2) 55%, #fff) !important; }
.v3-nav:hover svg { animation: v3Nudge .8s cubic-bezier(.34, 1.56, .64, 1) infinite; }
[data-v3="prev"]:hover svg { --nx: -3px; } [data-v3="next"]:hover svg { --nx: 3px; }
@keyframes v3Nudge { 50% { translate: var(--nx, 3px) 0; } }
.v3-lays { display: flex; gap: 2px; padding: 0 2px; }
.v3-lays button { padding: 0 9px; }
.v3-lays svg { width: 20px; height: 13px; } .v3-nav svg { width: 15px; height: 15px; } .v3-x svg { width: 12px; height: 12px; }
.v3-lays button.on { color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--w2) 25%, transparent), color-mix(in srgb, var(--w1) 25%, transparent)); border-color: color-mix(in srgb, var(--w1) 50%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--w1) 35%, transparent); }
.v3-dsep { width: 1px; height: 18px; background: rgba(255, 255, 255, .14); margin: 0 2px; }
.v3-x { padding: 0 10px; }
.v3-x:hover { color: #fecdd3 !important; background: rgba(244, 63, 94, .16) !important; box-shadow: 0 0 18px rgba(244, 63, 94, .3); }

/* el botón de arriba */
#top .v3-btn:hover > svg { animation: v3Btn 1.4s cubic-bezier(.34, 1.56, .64, 1) infinite !important; }
@keyframes v3Btn { 0%, 100% { transform: perspective(60px) rotateY(0); } 35% { transform: perspective(60px) rotateY(28deg); } 70% { transform: perspective(60px) rotateY(-22deg); } }
#top .v3-btn.on { color: #c4b5fd; border-color: rgba(167, 139, 250, .5); box-shadow: 0 0 16px rgba(167, 139, 250, .35); }
/* dentro de una pantalla: sin intro ni botón de Vista 3D */
.of-embed #v3dBtn { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .v3-aur, .v3-stars, .v3-floor i, .v3-sheen::before, .v3-pool, .v3-glass::before, .v3-scr, .v3-shock, .v3-ring, .v3-tag i, #v3d.on .v3-dock, .v3-scr.act .v3-glass { animation: none !important; }
  .v3-scr, .v3-body { transition: none !important; }
}

/* carga (web/vista3d.js): esfera de partículas, un anillo y una barra por pantalla, y lo que va pasando */
.v3-boot { position: absolute; inset: 0; z-index: 5; display: none; pointer-events: none; }
#v3d.booting .v3-boot { display: block; animation: v3BootIn .8s cubic-bezier(.34, 1.56, .64, 1) both; }
#v3d.booting .v3-dock { opacity: 0; pointer-events: none; }
@keyframes v3BootIn { 0% { opacity: 0; transform: scale(.7); filter: blur(14px); } 100% { opacity: 1; transform: none; filter: none; } }
.v3-boot.implode .v3b-c, .v3-boot.implode .v3b-rows, .v3-boot.implode .v3b-feed { opacity: 0; transform: scale(.85); filter: blur(6px); transition: all .45s cubic-bezier(.6, -0.3, .7, .6); }
.v3b-c { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); display: grid; place-items: center; gap: 4px; text-align: center; }
.v3b-p { font: 800 46px/1 var(--mono, ui-monospace); color: #fff; letter-spacing: -.02em; text-shadow: 0 0 24px color-mix(in srgb, var(--w1) 80%, transparent), 0 0 60px color-mix(in srgb, var(--w2) 40%, transparent); }
.v3b-s { font: 500 12.5px var(--sans, system-ui); font-style: normal; color: #cbd5e1; letter-spacing: .02em; animation: v3Blink 2.2s ease-in-out infinite; }
@keyframes v3Blink { 50% { opacity: .55; } }
.v3b-rows { position: absolute; left: 50%; top: calc(44% + min(35vh, 310px) + 6px); transform: translateX(-50%); display: flex; gap: 14px; }
.v3b-r { width: 190px; padding: 9px 11px 10px; border-radius: 12px; background: rgba(12, 16, 30, .6); border: 1px solid rgba(255, 255, 255, .12);
  display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 2px 7px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); transition: border-color .4s, box-shadow .4s; }
.v3b-r i { width: 8px; height: 8px; border-radius: 50%; background: var(--hue); box-shadow: 0 0 10px var(--hue); animation: v3Dot 1.2s ease-in-out infinite; }
.v3b-r b { font: 700 12px var(--sans, system-ui); color: #e2e8f0; }
.v3b-tf { justify-self: end; font: 600 11px var(--mono, ui-monospace); color: color-mix(in srgb, var(--hue) 60%, #fff); }
.v3b-r em { grid-column: 1 / -1; font: 400 11px var(--sans, system-ui); font-style: normal; color: #94a3b8; }
.v3b-r u { grid-column: 1 / -1; display: block; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 4px; }
.v3b-r u s { display: block; height: 100%; width: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--hue) 50%, transparent), var(--hue)); box-shadow: 0 0 10px var(--hue); }
.v3b-r.ok { border-color: color-mix(in srgb, var(--hue) 55%, transparent); box-shadow: 0 10px 30px rgba(0, 0, 0, .4), 0 0 24px color-mix(in srgb, var(--hue) 30%, transparent); animation: v3Ok .6s cubic-bezier(.34, 1.9, .5, 1); }
.v3b-r.ok i { animation: none; }
.v3b-r.ok em { color: color-mix(in srgb, var(--hue) 60%, #fff); }
@keyframes v3Ok { 40% { transform: scale(1.07); } }
.v3b-feed { position: absolute; left: 28px; bottom: 26px; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column-reverse; gap: 5px; width: 380px; }
.v3b-feed li { display: flex; align-items: center; gap: 8px; font: 500 11.5px var(--mono, ui-monospace); color: #cbd5e1; animation: v3Feed .5s cubic-bezier(.34, 1.56, .64, 1) both; }
.v3b-feed li:nth-child(n+4) { opacity: .5; } .v3b-feed li:nth-child(n+6) { opacity: .25; }
.v3b-feed li i { width: 6px; height: 6px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
@keyframes v3Feed { 0% { opacity: 0; transform: translateX(-16px); filter: blur(4px); } 100% { transform: none; filter: none; } }
@media (max-width: 760px) { .v3b-rows { flex-direction: column; gap: 6px; } .v3b-feed { display: none; } }
