/* ==========================================================================
   Hub Conexium — "habitación blanca" con íconos flotantes
   ========================================================================== */

:root {
  --ink: #3f4247;
  --ink-soft: #5f646c;   /* ≥4.5:1 sobre pared y piso (WCAG AA) */
  --ink-faint: #646973;
  --wall-hi: #ffffff;
  --wall: #f3f5f8;
  --wall-lo: #e3e7ed;
  --floor-hi: #fbfcfd;
  --floor-lo: #e7ebf0;
  --red: #ff1901;

  /* Tamaño del ícono: depende del ancho y del alto para caber en cualquier pantalla */
  --size: clamp(64px, min(21vw, 17vh), 132px);
  --radius: 23%;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  /* Parallax del mouse (-1..1), lo escribe hub.js */
  --px: 0;
  --py: 0;
  /* Color de la app activa, tiñe la luz de la habitación */
  --tint: #ffffff;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--wall);
  color: var(--ink);
  font-family: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Habitación ---------- */

.room {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.room > * { position: absolute; }

.room__wall {
  inset: -4%;
  background:
    radial-gradient(70% 55% at 50% 22%, var(--wall-hi) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #f7f8fa 0%, var(--wall) 45%, var(--wall-lo) 58%);
  transform: translate3d(calc(var(--px) * -6px), calc(var(--py) * -4px), 0);
}

/* Haces de luz de una ventana imaginaria */
.room__beam {
  top: -20%;
  height: 120%;
  width: 22vw;
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 78%);
  filter: blur(18px);
  opacity: .7;
  transform-origin: top center;
}
.room__beam--a {
  left: 8vw;
  transform: translate3d(calc(var(--px) * -14px), 0, 0) skewX(-18deg);
  animation: beam 14s ease-in-out infinite alternate;
}
.room__beam--b {
  left: 34vw;
  width: 10vw;
  opacity: .55;
  transform: translate3d(calc(var(--px) * -10px), 0, 0) skewX(-18deg);
  animation: beam 18s ease-in-out -6s infinite alternate;
}

.room__ceiling-light {
  left: 50%;
  top: -18vh;
  width: 90vw;
  height: 50vh;
  translate: -50% 0;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}

/* Piso con brillo central (simula superficie pulida) */
.room__floor {
  left: -10%;
  right: -10%;
  top: var(--horizon, 56%);
  bottom: 0;
  background:
    radial-gradient(55% 70% at 50% 0%, rgba(255, 255, 255, .95) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, var(--floor-lo) 0%, #f1f3f6 28%, var(--floor-hi) 100%);
  transform: translate3d(calc(var(--px) * 8px), 0, 0);
}

/* Unión pared-piso: línea fina + sombra ambiental suave */
.room__horizon {
  left: 0;
  right: 0;
  top: var(--horizon, 56%);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(60, 70, 90, .12) 20%, rgba(60, 70, 90, .12) 80%, transparent);
  box-shadow: 0 0 28px 6px rgba(60, 70, 90, .06);
}

.room__tint {
  left: 50%;
  top: 46%;
  width: 120vmax;
  height: 80vmax;
  translate: -50% -50%;
  background: radial-gradient(closest-side, var(--tint), transparent 70%);
  opacity: 0;
  mix-blend-mode: multiply;
  transition: opacity .9s var(--ease-out), background .9s var(--ease-out);
}
body.has-active .room__tint { opacity: .11; }

.room__dust {
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- Contenido ---------- */

.hub {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 6vh, 64px);
  padding:
    max(32px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.hub__header {
  max-width: 100%;
  text-align: center;
  transform: translate3d(calc(var(--px) * 4px), calc(var(--py) * 3px), 0);
}

/* Logo: "cone" + X de colores + "ium" */
.brand {
  display: inline-flex;
  align-items: center;
  margin: 0 0 clamp(18px, 3.5vh, 32px);
  font-family: Comfortaa, "Varela Round", Montserrat, sans-serif;
  font-weight: 600;
  font-size: clamp(30px, 5.2vw, 46px);
  letter-spacing: .06em;
  color: #6d6f73;
  line-height: 1;
  cursor: default;
  animation: fade-up 1s var(--ease-out) .05s backwards;
}
.brand__x {
  width: 1.12em;
  height: 1.12em;
  margin: 0 .02em 0 .04em;
  overflow: visible;
  transition: transform .9s var(--ease-spring);
}
.brand__x line {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw .9s var(--ease-out) forwards;
}
.brand__x line:nth-child(1) { animation-delay: .25s; }
.brand__x line:nth-child(2) { animation-delay: .35s; }
.brand__x line:nth-child(3) { animation-delay: .45s; }
.brand__x line:nth-child(4) { animation-delay: .55s; }
.brand__x circle {
  transform-origin: 50px 50px;
  animation: pop .6s var(--ease-spring) .9s backwards;
}
.brand:hover .brand__x { transform: rotate(180deg) scale(1.08); }

.hub__greeting {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  animation: fade-up 1s var(--ease-out) .2s backwards;
}

.hub__title {
  margin: 0;
  font-weight: 300;
  font-size: clamp(26px, 4.4vw, 44px);
  letter-spacing: -.01em;
  color: var(--ink);
  animation: fade-up 1s var(--ease-out) .3s backwards;
}

/* ---------- Grilla de apps ---------- */

/* Filas centradas que se reparten solas; hub.js fija max-width para que queden balanceadas
   (p. ej. 3+3 en vez de 5+1) según cuántas apps quepan en el ancho disponible. */
.apps {
  --tile: calc(var(--size) * 1.33);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
  gap: clamp(8px, 3vh, 36px) clamp(18px, 3.4vw, 52px);
  transform: translate3d(calc(var(--px) * -6px), calc(var(--py) * -3px), 0);
}

.app {
  --c1: #fff;
  --c2: #ddd;
  --rx: 0deg;
  --ry: 0deg;
  --gx: 50%;
  --gy: 30%;
  --lift: 0px;
  --s: 1;

  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--tile);
  padding-top: 18px;
  color: inherit;
  text-decoration: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .5s var(--ease-out), scale .5s var(--ease-out), filter .5s var(--ease-out);
  animation: rise 1.1s var(--ease-out) backwards;
  animation-delay: calc(var(--i) * 90ms + 450ms);
}

/* Efecto Netflix: al enfocar una app, el resto se aleja */
.apps.has-active .app:not(.is-active) { scale: .94; }
/* Solo se atenúa el ícono: el nombre conserva contraste legible */
.apps.has-active .app:not(.is-active) .app__stage {
  opacity: .42;
  filter: saturate(.55);
  transition: opacity .5s var(--ease-out), filter .5s var(--ease-out);
}

.app__stage {
  position: relative;
  width: var(--size);
  height: var(--size);
  perspective: 800px;
}

.app__float {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  animation: float 6.5s ease-in-out infinite;
  animation-delay: calc(var(--i) * -1.1s);
}

/* El ícono tipo iOS */
.app__icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(155deg, var(--c1) 0%, var(--c2) 100%);
  color: #fff;
  transform-style: preserve-3d;
  transform:
    translate3d(0, var(--lift), 0)
    scale(var(--s))
    rotateX(var(--rx))
    rotateY(var(--ry));
  transition: transform .6s var(--ease-out), box-shadow .6s var(--ease-out);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .65),
    inset 0 -3px 8px rgba(0, 0, 0, .08),
    0 22px 34px -16px color-mix(in srgb, var(--c2) 70%, transparent),
    0 8px 14px -8px rgba(30, 40, 60, .22);
  will-change: transform;
}

/* Reflejo curvo superior (brillo de vidrio) */
.app__icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(130% 75% at 50% -12%, rgba(255, 255, 255, .62) 0%, rgba(255, 255, 255, .16) 54%, rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
}

/* Borde interior y profundidad */
.app__icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .32),
    inset 0 -14px 24px -10px rgba(0, 0, 0, .12);
  pointer-events: none;
}

.app__glyph {
  position: relative;
  width: 46%;
  height: 46%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .18));
  transform: translateZ(0);
  transition: transform .6s var(--ease-out);
}
.app__glyph svg { width: 100%; height: 100%; display: block; overflow: visible; }
.app--conexium .app__glyph { width: 58%; height: 58%; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .1)); }

/* La X del ícono Conexium se dibuja y gira igual que la del logo */
.app--conexium .app__glyph svg { transition: transform .9s var(--ease-spring); }
.app--conexium .x-bar {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw .9s var(--ease-out) forwards;
}
.app--conexium .x-bar:nth-child(1) { animation-delay: .85s; }
.app--conexium .x-bar:nth-child(2) { animation-delay: .95s; }
.app--conexium .x-bar:nth-child(3) { animation-delay: 1.05s; }
.app--conexium .x-bar:nth-child(4) { animation-delay: 1.15s; }
.app--conexium .app__glyph circle {
  transform-origin: 50px 50px;
  animation: pop .6s var(--ease-spring) 1.5s backwards;
}
.app--conexium.is-active .app__glyph svg { transform: rotate(180deg) scale(1.08); }

/* ---------- Glifos animados del resto de las apps ----------
   Entrada: cada trazo se dibuja (g-draw), aparece con rebote (g-pop) o crece desde la base (g-grow),
   en el orden que marca --d. Al activar, cada app tiene su gesto propio.
   La animación de hover se suma a la de entrada (var(--in), …) para que esta no se reinicie al salir. */
.app__glyph { --base: calc(var(--i, 0) * 90ms + 850ms); }
.drawer.is-open .mini__glyph { --base: .2s; }

.app__glyph .g,
.mini__glyph .g { --delay: calc(var(--base) + var(--d, 0) * 110ms); }
.app__glyph .g-draw,
.mini__glyph .g-draw { stroke-dasharray: 1; --in: draw-in .8s var(--ease-out) var(--delay) backwards; }
.app__glyph .g-pop,
.mini__glyph .g-pop { transform-box: fill-box; transform-origin: center; --in: pop .55s var(--ease-spring) var(--delay) backwards; }
.app__glyph .g-grow,
.mini__glyph .g-grow { transform-box: fill-box; transform-origin: center bottom; --in: grow .7s var(--ease-spring) var(--delay) backwards; }
.app__glyph .g,
.drawer.is-open .mini__glyph .g { animation: var(--in); }

/* Hoja de libro que se da vuelta (solo visible al hojear) */
.l-page { opacity: 0; transform-box: view-box; transform-origin: 12px 0; }

/* Brote: cada hoja crece y se mece desde su unión con el tallo */
.s-leaf { transform-box: view-box; }
.s-leaf--r { transform-origin: 12px 13px; }
.s-leaf--l { transform-origin: 12px 11.2px; }

/* MiConexia: la información corre por los enlaces y los nodos laten en cadena */
:is(.app.is-active, .drawer.is-open .mini:hover, .drawer.is-open .mini:focus-visible) .r-link {
  animation: var(--in), flow 1.4s linear infinite;
}
:is(.app.is-active, .drawer.is-open .mini:hover, .drawer.is-open .mini:focus-visible) .r-node {
  animation: var(--in), node-pulse 1.5s ease-in-out calc(var(--d) * .12s) infinite;
}

/* Oportunidades: la línea se redibuja y la flecha empuja hacia arriba */
:is(.app.is-active, .drawer.is-open .mini:hover, .drawer.is-open .mini:focus-visible) .t-line {
  animation: var(--in), redraw .8s var(--ease-out);
}
:is(.app.is-active, .drawer.is-open .mini:hover, .drawer.is-open .mini:focus-visible) .t-arrow {
  animation: var(--in), redraw .5s var(--ease-out) .45s backwards, nudge 1.1s ease-in-out .95s infinite;
}

/* Indicadores: las barras suben y bajan como un tablero en vivo */
:is(.app.is-active, .drawer.is-open .mini:hover, .drawer.is-open .mini:focus-visible) .b-bar {
  animation: var(--in), equalize 1.2s ease-in-out calc(var(--d) * -.35s) infinite;
}

/* Programa Legado: las hojas se mecen */
:is(.app.is-active, .drawer.is-open .mini:hover, .drawer.is-open .mini:focus-visible) .s-leaf--r {
  animation: var(--in), sway-r 2.2s ease-in-out infinite;
}
:is(.app.is-active, .drawer.is-open .mini:hover, .drawer.is-open .mini:focus-visible) .s-leaf--l {
  animation: var(--in), sway-l 2.2s ease-in-out infinite;
}

/* Conexed: se hojea una página */
:is(.app.is-active, .drawer.is-open .mini:hover, .drawer.is-open .mini:focus-visible) .l-page {
  animation: page-flip 1.8s var(--ease-out) .1s infinite;
}

/* Destello que sigue al mouse */
.app__glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 48%);
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}

/* Barrido de luz al entrar */
.app__shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.app__shine::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -120%;
  width: 60%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: rotate(20deg);
}

/* Halo de color detrás del ícono */
.app__glow {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: var(--c2);
  filter: blur(34px);
  opacity: 0;
  transform: translateZ(-40px) scale(.8);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
}

/* Etiqueta "Nuevo" */
.app__badge {
  position: absolute;
  top: -9px;
  right: -12px;
  padding: 5px 9px 4px;
  border-radius: 999px;
  background: #d91400; /* algo más oscuro que --red: 5.2:1 con texto blanco */
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 4px 10px -2px rgba(255, 25, 1, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
  transform: translateZ(30px);
  animation: badge 3s ease-in-out infinite;
}

/* Reflejo en el piso: copia invertida que se desvanece */
.app__mirror {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 22px);
  height: 100%;
  transform: scaleY(-1);
  perspective: 800px;
  opacity: .32;
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, .25) 28%, transparent 52%);
          mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, .25) 28%, transparent 52%);
  pointer-events: none;
}
.app__mirror .app__icon { box-shadow: none; will-change: auto; }
/* En el reflejo no se ven: evitar rasterizarlos en cada frame */
.app__mirror :is(.app__glow, .app__glare, .app__shine, .app__badge) { display: none; }

/* Sombra de contacto sobre el piso */
.app__shadow {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  width: 76%;
  height: 16px;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--c2) 45%, rgba(30, 40, 60, .5)), transparent);
  filter: blur(5px);
  animation: shadow 6.5s ease-in-out infinite;
  animation-delay: calc(var(--i) * -1.1s);
  transition: opacity .6s var(--ease-out), scale .6s var(--ease-out);
}

.app__label {
  position: relative;
  margin-top: calc(var(--size) * .47);
  text-align: center;
}

.app__name {
  position: relative;
  display: inline-block;
  font-size: clamp(13px, calc(var(--size) * .115), 22px);
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--ink);
  transition: color .4s ease, transform .5s var(--ease-out);
}
.app__name::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  translate: -50% 0;
  transition: width .5s var(--ease-out);
}
.app--conexium .app__name::after {
  background: linear-gradient(90deg, #ffcc17, #1e8fd6, #5ab97f, #c878b9);
}

.app__desc {
  min-height: 2.6em;
  margin-top: 12px;
  font-size: clamp(10.5px, calc(var(--size) * .088), 16px);
  line-height: 1.3;
  color: var(--ink-soft);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .45s ease, transform .5s var(--ease-out);
}

.app__here {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--c2);
  vertical-align: middle;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c2) 22%, transparent);
}

/* ---------- Estado activo (hover / foco) ---------- */

.app.is-active { --lift: -16px; --s: 1.07; }
.app.is-active .app__float { animation-play-state: paused; }
.app.is-active .app__glare { opacity: 1; }
.app.is-active .app__glyph { transform: translateZ(26px) scale(1.06); }
.app.is-active .app__glow { opacity: .45; transform: translateZ(-40px) scale(1.1); }
.app.is-active .app__shine::before { animation: shine 1.1s var(--ease-out); }
.app.is-active .app__shadow { opacity: .55; scale: .78; animation-play-state: paused; }
.app.is-active .app__name::after { width: 70%; }
.app.is-active .app__desc { opacity: 1; transform: none; }
.app.is-active .app__icon {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .7),
    inset 0 -3px 8px rgba(0, 0, 0, .08),
    0 40px 50px -22px color-mix(in srgb, var(--c2) 80%, transparent),
    0 14px 22px -12px rgba(30, 40, 60, .28);
}

.app:focus-visible > .app__stage > .app__float .app__icon {
  outline: 3px solid #1e6fb0;
  outline-offset: 6px;
}

.app:active .app__icon { --s: .97; transition-duration: .15s; }

/* Próximamente */
.app.is-soon { cursor: default; }
.app.is-soon .app__icon { filter: saturate(.7); }
.app.is-soon .app__desc { opacity: 1; transform: none; color: var(--ink-faint); }
.app.is-soon .app__soon {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  border: 1px solid #dde1e7;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: rgba(255, 255, 255, .6);
}
.app.is-wiggle .app__stage { animation: wiggle .5s ease; }

/* ---------- Pie ---------- */

.hub__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  animation: fade-up 1s var(--ease-out) 1.1s backwards;
}
.hub__footer .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffcc17, #1e8fd6 40%, #5ab97f 70%, #c878b9);
}

/* ---------- Portal (transición al abrir una app) ---------- */

.portal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  pointer-events: none;
  visibility: hidden;
}
.portal.is-open { visibility: visible; }
.portal__glyph { width: 72px; height: 72px; color: #fff; }
.portal__glyph svg { width: 100%; height: 100%; }

/* ---------- Animaciones ---------- */

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -11px, 0); }
}
@keyframes shadow {
  0%, 100% { scale: 1; opacity: .95; }
  50% { scale: .84; opacity: .62; }
}
@keyframes rise {
  from { opacity: 0; translate: 0 46px; scale: .9; }
}
@keyframes fade-up {
  from { opacity: 0; translate: 0 14px; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(0); } }
@keyframes draw-in { from { stroke-dashoffset: 1; } }
@keyframes redraw { from { stroke-dashoffset: 1; } }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes flow {
  from { stroke-dasharray: .14 .06; stroke-dashoffset: 0; }
  to { stroke-dasharray: .14 .06; stroke-dashoffset: -.4; }
}
@keyframes node-pulse {
  0%, 60%, 100% { transform: scale(1); }
  25% { transform: scale(1.28); }
}
@keyframes nudge {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(1.3px, -1.3px); }
}
@keyframes equalize {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(.55); }
}
@keyframes sway-r {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(-12deg); }
}
@keyframes sway-l {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(12deg); }
}
@keyframes page-flip {
  0% { opacity: 0; transform: scaleX(1); }
  8% { opacity: 1; }
  45% { opacity: 1; transform: scaleX(-1); }
  55%, 100% { opacity: 0; transform: scaleX(-1); }
}
@keyframes shine { to { left: 160%; } }
@keyframes beam {
  from { opacity: .45; translate: -2vw 0; }
  to { opacity: .8; translate: 2vw 0; }
}
@keyframes badge {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}
@keyframes wiggle {
  20% { rotate: -4deg; }
  40% { rotate: 4deg; }
  60% { rotate: -2.5deg; }
  80% { rotate: 1.5deg; }
}

/* ---------- Responsive ---------- */

/* Celulares y tablets angostas */
@media (max-width: 640px) {
  .apps { --tile: max(calc(var(--size) * 1.26), 98px); gap: 4px 10px; }
  .app__mirror { top: calc(100% + 16px); }
  .room__beam { width: 40vw; }
  .room__beam--b { left: 52vw; width: 18vw; }
}

/* Celulares muy angostos (320–360 px) */
@media (max-width: 360px) {
  .hub__greeting { letter-spacing: .16em; }
  .hub__footer { font-size: 10px; letter-spacing: .14em; }
  .app__badge { right: -6px; padding: 4px 7px 3px; font-size: 9px; }
  .app__name { font-size: 12px; letter-spacing: 0; }
}

/* Pantallas bajas: celulares en horizontal, ventanas achicadas, netbooks */
@media (max-height: 560px) {
  .hub { gap: 14px; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .brand { margin-bottom: 8px; font-size: clamp(24px, 7vh, 34px); }
  .hub__greeting { margin-bottom: 2px; font-size: 11px; }
  .hub__title { font-size: clamp(20px, 6vh, 30px); }
  .apps { row-gap: 4px; }
  .app { padding-top: 12px; }
  .app__desc { min-height: 0; margin-top: 8px; }
}

/* Muy bajas (celulares chicos en horizontal): se omite el saludo para que quepa todo */
@media (max-height: 400px) {
  .hub { gap: 10px; }
  .hub__greeting { display: none; }
  .brand { margin-bottom: 6px; }
}

/* Pantallas grandes: monitores 2K/4K, TVs y proyectores.
   zoom escala todo el contenido (íconos, textos, cajón) manteniendo las proporciones;
   min-height se divide por el zoom para seguir ocupando exactamente una pantalla. */
@media (min-width: 2200px) and (min-height: 1200px) { .hub { --zoom: 1.3; } }
@media (min-width: 2800px) and (min-height: 1550px) { .hub { --zoom: 1.65; } }
@media (min-width: 3600px) and (min-height: 2000px) { .hub { --zoom: 2.1; } }
@media (min-width: 2200px) and (min-height: 1200px) {
  .hub {
    zoom: var(--zoom);
    min-height: calc(100vh / var(--zoom));
    min-height: calc(100svh / var(--zoom));
  }
}

/* En pantallas táctiles no hay hover: la bajada se muestra siempre */
@media (hover: none) {
  .app__desc { opacity: 1; transform: none; }
  .apps.has-active .app:not(.is-active) { scale: 1; }
  .apps.has-active .app:not(.is-active) .app__stage { opacity: 1; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important; /* sin esto el contenido queda invisible hasta 1,5 s */
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
  .room__dust { display: none; }
  .app.is-active { --lift: 0px; --s: 1; }
  .app.is-active .app__glyph,
  .app--conexium.is-active .app__glyph svg,
  .brand:hover .brand__x,
  .drawer.is-open .drawer__dots { transform: none; }
  .apps.has-active .app:not(.is-active) { scale: 1; }
}

/* ---------- Cajón "Más apps" (apps secundarias, en pequeño) ---------- */

.drawer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: calc(clamp(28px, 6vh, 64px) * -0.5);
  animation: fade-up 1s var(--ease-out) 1s backwards;
}
.drawer[hidden] { display: none; }

.drawer__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 14px 7px 10px;
  border: 1px solid #e1e5eb;
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  color: var(--ink-soft);
  font: 500 11px/1 Montserrat, system-ui, sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.drawer__toggle:hover,
.drawer.is-open .drawer__toggle {
  color: var(--ink);
  border-color: #d3d8e0;
  box-shadow: 0 6px 16px -10px rgba(30, 40, 60, .35);
}
.drawer__toggle:focus-visible { outline: 2px solid #1e8fd6; outline-offset: 3px; }

.drawer__dots { width: 14px; height: 14px; color: var(--ink-faint); transition: transform .5s var(--ease-spring); }
.drawer__dots svg { width: 100%; height: 100%; display: block; }
.drawer.is-open .drawer__dots { transform: rotate(90deg); }

.drawer__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  translate: 0 -6px;
  transition: max-height .5s var(--ease-out), opacity .4s ease, translate .5s var(--ease-out);
}
.drawer.is-open .drawer__list { max-height: 60vh; opacity: 1; translate: 0 0; } /* 60vh: no recorta con zoom al 200 % */

.mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 6px 4px 2px;
  color: inherit;
  text-decoration: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.mini__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: linear-gradient(155deg, var(--c1), var(--c2));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .6),
    0 10px 16px -10px color-mix(in srgb, var(--c2) 75%, transparent);
  transition: transform .45s var(--ease-spring), box-shadow .45s var(--ease-out);
}
.mini__icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(130% 75% at 50% -12%, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 60%);
}
.mini__glyph { position: relative; width: 48%; height: 48%; }
.mini__glyph svg { width: 100%; height: 100%; display: block; }

.mini__name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-soft);
}
.mini__name small {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.mini:hover .mini__icon,
.mini:focus-visible .mini__icon { transform: translateY(-4px) scale(1.06); }
.mini:focus-visible .mini__icon { outline: 3px solid #1e6fb0; outline-offset: 4px; }
.mini:hover .mini__name { color: var(--ink); }
.mini.is-soon { cursor: default; }
.mini.is-soon .mini__icon { filter: saturate(.7); }
.mini.is-wiggle .mini__icon { animation: wiggle .5s ease; }
