/* Beatrice — minimalista. Una tipografia, un acento, mucho aire. */
:root {
  --bg: #0a0a0b;
  --fg: #f2f2f3;
  --muted: #8a8a93;
  --line: #1f1f24;
  --card: #111114;
  --accent: #a99bff;
  --ok: #6ee7a8;
  --err: #ff7a7a;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfc; --fg: #0c0c0e; --muted: #6d6d76; --line: #e7e7ea; --card: #ffffff;
    --accent: #5b45f0; --ok: #0d8a52; --err: #c62828;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans);
  line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden;
  animation: page-in 0.7s var(--ease) both;
}
a { color: inherit; text-decoration: none; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 24px; }

/* ---------- fondo: un solo resplandor que respira ---------- */
.glow {
  position: fixed; inset: -20vmax auto auto 50%; width: 60vmax; height: 60vmax; translate: -50% 0;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 14%, transparent), transparent);
  pointer-events: none; z-index: -1; animation: breathe 9s ease-in-out infinite;
}

/* ---------- barra ---------- */
.nav {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; backdrop-filter: blur(10px); background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid transparent; transition: border-color 0.3s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.mark {
  width: 14px; height: 14px; border-radius: 50%; background: var(--fg); position: relative;
}
.mark::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid var(--accent);
  animation: ping 2.8s var(--ease) infinite;
}
.links { display: flex; gap: 26px; align-items: center; font-size: 0.92rem; color: var(--muted); }
.links a { position: relative; transition: color 0.2s; }
.links a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: var(--fg);
  transform: scaleX(0); transform-origin: left; transition: transform 0.35s var(--ease);
}
.links a:not(.btn):hover { color: var(--fg); }
.links a:not(.btn):hover::after { transform: scaleX(1); }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: transparent;
  color: var(--fg); padding: 9px 18px; border-radius: 999px; font: inherit; font-size: 0.92rem; cursor: pointer;
  transition: transform 0.25s var(--ease), border-color 0.2s, background 0.2s, color 0.2s;
}
.btn:hover { border-color: var(--fg); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.solid { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 600; }
.btn.solid:hover { background: transparent; color: var(--fg); }
.btn .arrow { transition: transform 0.3s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }
.btn.small { padding: 5px 13px; font-size: 0.82rem; }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- portada ---------- */
.hero { padding: 14vh 0 10vh; }
.eyebrow { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 22px; }
h1 { font-size: clamp(2.6rem, 8vw, 5rem); line-height: 1.02; letter-spacing: -0.04em; font-weight: 600; margin: 0 0 24px; }
h1 .w { display: inline-block; opacity: 0; transform: translateY(0.5em); filter: blur(8px); animation: word-in 0.9s var(--ease) forwards; animation-delay: calc(var(--i) * 90ms + 150ms); }
h1 .dim { color: var(--muted); }
h1 .w:nth-of-type(1) { --i: 0; } h1 .w:nth-of-type(2) { --i: 1; } h1 .w:nth-of-type(3) { --i: 2; }
h1 .w:nth-of-type(4) { --i: 3; } h1 .w:nth-of-type(5) { --i: 4; }
.lead { color: var(--muted); font-size: 1.15rem; max-width: 34ch; margin: 0 0 34px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* terminal que se escribe sola */
.term {
  margin-top: 8vh; border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden;
}
.term-bar { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.term-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.term pre { margin: 0; padding: 20px 22px; min-height: 12.5em; font-family: var(--mono); font-size: 0.84rem; line-height: 1.7; overflow-x: auto; }
.term .p { color: var(--muted); }
.term .s { color: var(--ok); }
.term .k { color: var(--accent); }
.caret { display: inline-block; width: 0.55em; height: 1.05em; background: var(--fg); vertical-align: -0.15em; animation: blink 1s steps(1) infinite; }

/* ---------- secciones ---------- */
section { padding: 12vh 0 0; }
h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -0.03em; font-weight: 600; margin: 0 0 14px; }
.sub { color: var(--muted); margin: 0 0 36px; max-width: 52ch; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); }
.step { padding: 26px 24px 0 0; }
.step b { display: block; font-family: var(--mono); color: var(--muted); font-weight: 400; font-size: 0.8rem; margin-bottom: 14px; }
.step h3 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 600; }
.step p { margin: 0; color: var(--muted); font-size: 0.93rem; }

.rows { border-top: 1px solid var(--line); }
.row-ep { display: grid; grid-template-columns: 70px 150px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: baseline; transition: padding-left 0.35s var(--ease); }
.row-ep:hover { padding-left: 10px; }
.m { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); }
.path { font-family: var(--mono); font-size: 0.9rem; }
.row-ep span:last-child { color: var(--muted); font-size: 0.93rem; }
code.i { font-family: var(--mono); font-size: 0.85em; background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }

.code2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
pre.code {
  margin: 0; font-family: var(--mono); font-size: 0.8rem; line-height: 1.65; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; overflow-x: auto; max-width: 100%;
}
.c { color: var(--muted); }
.s { color: var(--ok); }
.k { color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.stat { padding: 30px 0 0; }
.stat .n { font-size: clamp(2.4rem, 7vw, 3.6rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat small { display: block; margin-top: 8px; color: var(--muted); font-size: 0.9rem; }

.work {
  border: 1px solid var(--line); border-radius: 16px; padding: 34px; background: var(--card);
  position: relative; overflow: hidden;
}
.work::before {
  content: ""; position: absolute; inset: 0; background: radial-gradient(400px circle at var(--mx, 80%) var(--my, 0%), color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
  opacity: 0; transition: opacity 0.4s; pointer-events: none;
}
.work:hover::before { opacity: 1; }
.tag { display: inline-block; font-family: var(--mono); font-size: 0.72rem; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 2px 10px; margin-bottom: 14px; }

footer { margin-top: 14vh; padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- aparicion al hacer scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- cuenta ---------- */
.auth { max-width: 400px; margin: 9vh auto 0; }
.auth h1, .dash h1 { font-size: 1.9rem; letter-spacing: -0.03em; margin-bottom: 8px; animation: none; }
.tabs { position: relative; display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 28px 0 24px; }
.tab { background: none; border: 0; color: var(--muted); font: inherit; padding: 0 0 12px; cursor: pointer; transition: color 0.2s; }
.tab[aria-selected="true"] { color: var(--fg); }
.tab-line { position: absolute; bottom: -1px; left: 0; height: 1px; background: var(--fg); transition: transform 0.4s var(--ease), width 0.4s var(--ease); }
form { display: grid; gap: 18px; animation: rise 0.5s var(--ease) both; }
label { display: grid; gap: 7px; font-size: 0.8rem; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"] {
  background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--fg); padding: 9px 0;
  font: inherit; font-size: 1rem; border-radius: 0; transition: border-color 0.25s;
}
input:focus { outline: none; border-bottom-color: var(--fg); }
.hint { font-size: 0.78rem; color: var(--muted); margin: -8px 0 0; }
.msg { font-size: 0.88rem; min-height: 1.3em; }
.msg.err { color: var(--err); animation: shake 0.4s; }
.msg.ok { color: var(--ok); }
.hidden { display: none !important; }

.dash { margin: 7vh auto 0; display: grid; gap: 34px; }
.panel { animation: rise 0.6s var(--ease) both; }
.panel:nth-child(2) { animation-delay: 80ms; }
.panel:nth-child(3) { animation-delay: 160ms; }
.panel h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 500; margin: 0 0 14px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.keyrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); flex-wrap: wrap; animation: rise 0.5s var(--ease) both; }
.keyname { font-weight: 600; }
.keymeta { color: var(--muted); font-size: 0.8rem; font-family: var(--mono); }
.acts { display: flex; gap: 8px; }
.newkey { border: 1px solid var(--ok); border-radius: 14px; padding: 22px; animation: pop 0.6s var(--ease) both; }
.newkey pre { margin: 12px 0 16px; font-family: var(--mono); font-size: 0.85rem; white-space: pre-wrap; word-break: break-all; background: var(--card); border-radius: 8px; padding: 12px 14px; }
progress { width: 100%; height: 3px; appearance: none; border: 0; background: var(--line); border-radius: 2px; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--fg); transition: width 0.8s var(--ease); }
progress::-moz-progress-bar { background: var(--fg); }

/* ---------- animaciones ---------- */
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes word-in { to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes breathe { 0%, 100% { opacity: 0.55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes ping { 0% { transform: scale(0.7); opacity: 0.9; } 80%, 100% { transform: scale(1.9); opacity: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

@media (max-width: 720px) {
  .steps, .stats, .code2 { grid-template-columns: 1fr; }
  .step { padding: 22px 0; border-bottom: 1px solid var(--line); }
  .row-ep { grid-template-columns: 56px 1fr; }
  .row-ep span:last-child { grid-column: 1 / -1; }
  .stat { padding: 22px 0; border-bottom: 1px solid var(--line); }
  .hero { padding-top: 9vh; }
  .links { gap: 16px; }
}
.steps > *, .stats > *, .code2 > *, .dash > * { min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  h1 .w, .reveal { opacity: 1 !important; transform: none !important; filter: none !important; }
}

/* ---------- Beatrice at Work ---------- */
.wrap.wide { max-width: 1180px; }
.whead { padding: 7vh 0 3vh; }
.whead h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); animation: none; margin-bottom: 14px; }
.keybar { max-width: 460px; margin: 2vh 0 8vh; animation: rise 0.6s var(--ease) both; }
.keybar form { display: grid; gap: 16px; }
.app { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; margin-top: 2vh; animation: rise 0.6s var(--ease) both; }
.col { min-width: 0; }
.chat { display: flex; flex-direction: column; gap: 14px; }
.log { height: 52vh; min-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 6px; scroll-behavior: smooth; }
.bubble { max-width: 92%; padding: 11px 15px; border-radius: 14px; font-size: 0.93rem; white-space: pre-wrap; word-break: break-word; animation: pop 0.35s var(--ease) both; }
.bubble.a { background: var(--card); border: 1px solid var(--line); align-self: flex-start; }
.bubble.u { background: var(--fg); color: var(--bg); align-self: flex-end; }
.bubble.thinking { color: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
#task-form { display: grid; gap: 10px; animation: none; }
textarea {
  width: 100%; background: transparent; color: var(--fg); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font: inherit; font-size: 0.95rem; resize: vertical; transition: border-color 0.25s;
}
textarea:focus { outline: none; border-color: var(--fg); }
.stage { border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 14px; display: grid; gap: 12px; align-content: start; }
.stabs { display: flex; gap: 6px; }
.stab { background: none; border: 0; color: var(--muted); font: inherit; font-size: 0.85rem; padding: 6px 12px; border-radius: 999px; cursor: pointer; transition: background 0.2s, color 0.2s; }
.stab[aria-selected="true"] { background: var(--fg); color: var(--bg); }
.filelist { display: flex; gap: 6px; flex-wrap: wrap; min-height: 28px; }
.chip { font-family: var(--mono); font-size: 0.78rem; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; cursor: pointer; transition: all 0.2s; }
.chip.on, .chip:hover { color: var(--fg); border-color: var(--fg); }
.editor { font-family: var(--mono); font-size: 0.82rem; line-height: 1.6; height: 38vh; min-height: 240px; border-radius: 10px; tab-size: 2; white-space: pre; overflow: auto; }
.tools { justify-content: flex-start; }
.console { margin: 0; font-family: var(--mono); font-size: 0.82rem; line-height: 1.6; height: 34vh; min-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.c-stdout { color: var(--fg); } .c-stderr { color: var(--err); } .c-info { color: var(--muted); }
.artifacts { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.art img { max-width: 100%; max-height: 260px; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: block; margin-bottom: 4px; }
.sbx { width: 100%; height: 52vh; min-height: 320px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
@keyframes pulse { 50% { opacity: 0.4; } }
@media (max-width: 860px) { .app { grid-template-columns: 1fr; } .log { height: 38vh; } }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; color: var(--fg); cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--fg); }
.rate { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--muted); align-self: flex-start; }
