/* ═══ base: reset · fondo · layout · tipografía · motion ════════ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
html.no-scroll { overflow: hidden; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--f-body);
  overscroll-behavior-y: none;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
button:disabled { cursor: default; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
::selection { background: var(--pink); color: #fff; }

/* ── fondo: canvas de puntos (tipo Figma) + orbes + grano ───── */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-fx .grid {
  position: absolute; inset: 0;
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.4px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.4) 55%, transparent 90%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.4) 55%, transparent 90%);
}
.orb { position: absolute; border-radius: 50%; opacity: var(--orb); will-change: transform; }
.o1 { width: 70vmax; height: 70vmax; left: -32vmax; top: -38vmax; background: radial-gradient(circle, var(--violet), transparent 62%); animation: drift1 26s ease-in-out infinite alternate; }
.o2 { width: 50vmax; height: 50vmax; right: -26vmax; top: 8vh; background: radial-gradient(circle, var(--cyan), transparent 62%); opacity: calc(var(--orb) * .55); animation: drift2 32s ease-in-out infinite alternate; }
.o3 { width: 55vmax; height: 55vmax; left: 5vw; bottom: -34vmax; background: radial-gradient(circle, var(--pink), transparent 60%); opacity: calc(var(--orb) * .5); animation: drift1 38s ease-in-out infinite alternate-reverse; }
.o4 { width: 30vmax; height: 30vmax; right: -8vmax; bottom: 10vh; background: radial-gradient(circle, var(--orange), transparent 62%); opacity: calc(var(--orb) * .4); animation: drift2 28s ease-in-out infinite alternate-reverse; }
.grain {
  position: absolute; inset: 0; opacity: .06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="light"] .grain { opacity: .09; mix-blend-mode: multiply; }

/* ── layout ─────────────────────────────────────────────────── */
#app { min-height: 100dvh; }
.view {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4px var(--gutter) calc(var(--dock-h) + var(--safe-b) + 110px);
}
.view-ia { padding-bottom: calc(var(--dock-h) + var(--safe-b) + 170px); }
.view > * { animation: rise .5s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: .04s; }
.view > * > *:nth-child(n+2) { animation: rise .5s var(--ease) both; }
.view > * > *:nth-child(2) { animation-delay: .05s; }
.view > * > *:nth-child(3) { animation-delay: .09s; }
.view > * > *:nth-child(4) { animation-delay: .13s; }
.view > * > *:nth-child(5) { animation-delay: .17s; }
.view > * > *:nth-child(6) { animation-delay: .21s; }
.view > * > *:nth-child(n+7) { animation-delay: .25s; }

/* Vista IA: entrada solo con opacidad. Una animación de transform (rise), aun terminada y con
   fill-mode both, deja en Chromium un containing block que ancla el .composer (position:fixed)
   a la mitad de la pantalla (medido: top 446 px de 915). */
.view-ia > *, .view-ia > * > * { animation-name: fade !important; transform: none !important; }


section { margin-top: 30px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.h-scroll {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 12px;
  scroll-padding-inline: var(--gutter);
}
.h-scroll::-webkit-scrollbar { display: none; }

/* ── tipografía ─────────────────────────────────────────────── */
.display {
  font-family: var(--f-display); font-weight: 800;
  font-size: clamp(40px, 11vw, 58px); line-height: .92; letter-spacing: -.04em;
  margin: 0;
}
.display-sm { font: 700 22px/1.1 var(--f-display); letter-spacing: -.02em; margin: 4px 0 12px; }
.eyebrow {
  display: flex; align-items: center; gap: 6px;
  font: 500 11px/1.3 var(--f-mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-3); margin: 0 0 8px;
}
.mono { font-family: var(--f-mono); }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.danger-text { color: var(--bad); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.hint { font-size: 11px; color: var(--text-3); margin: 8px 0 0; }
.hint.danger-text { color: var(--bad); }
.sub-label { font: 500 11px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin: 20px 0 8px; }

/* ── motion ─────────────────────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes draw { from { stroke-dashoffset: 300; } to { stroke-dashoffset: 0; } }
@keyframes slideL { from { opacity: 0; transform: translateX(30px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(-30px); } }
@keyframes drift1 { to { transform: translate(8vmax, 6vmax) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-6vmax, 8vmax) scale(.94); } }
@keyframes cursorFloat { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(4px, -3px); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
@keyframes breathe { 50% { transform: scale(1.08) rotate(6deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes confetti { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }
@keyframes shimmer { to { background-position: 200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── splash ─────────────────────────────────────────────────── */
.splash { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--text-3); font-size: 11px; letter-spacing: .1em; }
.splash .logo { animation: breathe 1.8s ease-in-out infinite; filter: drop-shadow(0 12px 30px rgba(255, 79, 184, .45)); }
