/* ==========================================================
   Alejandro Aquino — Portafolio
   ========================================================== */

:root {
  --bg: #0b1120;
  --bg-alt: #0f172a;
  --surface: #131c2e;
  --surface-2: #1a2438;
  --border: #243049;
  --text: #e6ebf5;
  --text-muted: #94a3b8;
  --accent: #10a2b9;
  --accent-strong: #2cc3da;
  --accent-soft: rgba(16, 162, 185, .14);
  --purple: #a78bfa;
  --blue: #60a5fa;
  --amber: #fbbf24;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --nav-h: 68px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f7f9fc;
  --bg-alt: #eef2f8;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #dbe3ee;
  --text: #0f172a;
  --text-muted: #526075;
  --accent: #0a7f91;
  --accent-strong: #086a79;
  --accent-soft: rgba(16, 162, 185, .12);
  --purple: #7c3aed;
  --blue: #2563eb;
  --amber: #b45309;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--text-muted); }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip:focus { left: 16px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .8rem 1.3rem; border-radius: 10px;
  font-weight: 600; font-size: .95rem;
  border: 1px solid transparent;
  transition: transform .15s, background .2s, border-color .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
[data-theme="dark"] .btn-primary { color: #03161a; }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); cursor: pointer; font-size: 1rem;
  transition: border-color .2s, color .2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Navegación ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.brand { display: flex; align-items: center; gap: .65rem; font-weight: 700; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .85rem; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.nav-links { list-style: none; display: flex; align-items: center; gap: .25rem; }
.nav-links a {
  display: block; padding: .5rem .8rem; border-radius: 8px;
  color: var(--text-muted); font-size: .93rem; font-weight: 500;
  transition: color .2s, background .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface); }
.nav-links .nav-cta { color: var(--accent); }

.nav-actions { display: flex; gap: .5rem; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem);
  background:
    radial-gradient(700px 380px at 85% 10%, var(--accent-soft), transparent 70%),
    radial-gradient(500px 300px at 0% 90%, color-mix(in srgb, var(--purple) 10%, transparent), transparent 70%);
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .35rem .8rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: .85rem; color: var(--text-muted); margin-bottom: 1.4rem;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent); animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); font-weight: 800; }
.accent { color: var(--accent); }
.lead { margin-top: 1.25rem; font-size: 1.1rem; color: var(--text-muted); max-width: 56ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.hero-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 2rem; color: var(--text-muted); font-size: .92rem; }
.hero-meta i { color: var(--accent); margin-right: .35rem; }

/* Terminal */
.term {
  background: #0a0f1c; border: 1px solid #1e293b; border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.term-bar { display: flex; align-items: center; gap: 6px; padding: .7rem .9rem; background: #111827; border-bottom: 1px solid #1e293b; }
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: #ef4444; }
.term-bar span:nth-child(2) { background: #f59e0b; }
.term-bar span:nth-child(3) { background: #22c55e; }
.term-bar em { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: .75rem; color: #64748b; }
.term-body { margin: 0; padding: 1.2rem 1.3rem 1.4rem; font-family: var(--mono); font-size: .86rem; line-height: 1.75; color: #cbd5e1; overflow-x: auto; }
.c-mute { color: #64748b; }
.c-accent { color: #2cc3da; }
.c-key { color: #93c5fd; }
.c-str { color: #fcd34d; }
.c-num { color: #f9a8d4; }
.cursor { display: inline-block; width: 8px; height: 1.05em; vertical-align: text-bottom; background: #2cc3da; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Secciones ---------- */
.section { padding: clamp(4rem, 8vw, 6rem) 0; }
.section.alt { background: color-mix(in srgb, var(--bg-alt) 80%, transparent); }
.section-head { margin-bottom: 2.75rem; }
.kicker { font-family: var(--mono); font-size: .8rem; color: var(--accent); letter-spacing: .04em; margin-bottom: .6rem; }
.section-head h2, .contact-card h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 800; }
.section-sub { margin-top: .75rem; color: var(--text-muted); max-width: 60ch; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 190px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.tl-item { display: grid; grid-template-columns: 190px 1fr; gap: 2.5rem; position: relative; padding-bottom: 2.5rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: 184px; top: 7px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--text-muted);
}
.tl-item.current::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.tl-date { font-family: var(--mono); font-size: .82rem; color: var(--text-muted); padding-top: .15rem; text-align: right; padding-right: 1.6rem; }
.tl-item.current .tl-date { color: var(--accent); }
.tl-body {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
}
.tl-body h3 { font-size: 1.15rem; }
.tl-org { color: var(--accent); font-weight: 600; font-size: .93rem; margin: .25rem 0 .75rem; }
.tl-body > p:not(.tl-org) { color: var(--text-muted); }
.tl-body ul { list-style: none; display: grid; gap: .45rem; }
.tl-body li { position: relative; padding-left: 1.1rem; color: var(--text-muted); font-size: .95rem; }
.tl-body li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

/* ---------- Proyectos ---------- */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.project {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.project:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); }
.project-media { aspect-ratio: 16 / 8; background: var(--surface-2); overflow: hidden; border-bottom: 1px solid var(--border); }
.project-media img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .4s; }
.project:hover .project-media img { transform: scale(1.03); }
.aquisys { display: grid; place-items: center; background: linear-gradient(135deg, #1e3a8a, #0f766e); }
.aquisys-logo { display: flex; align-items: center; gap: .8rem; color: #fff; font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; }
.aquisys-logo i { font-size: 2rem; opacity: .9; }
.black { display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(16,162,185,.35), #060a12 70%); }
.black-logo { display: flex; flex-direction: column; align-items: center; gap: .8rem; color: var(--accent); font-family: var(--mono); font-size: 1.5rem; font-weight: 700; letter-spacing: .3em; text-shadow: 0 0 18px rgba(16,162,185,.85), 0 0 40px rgba(16,162,185,.4); }
.black-logo img { width: 72px; height: 72px; filter: drop-shadow(0 0 16px rgba(16,162,185,.55)); }
.project-body { padding: 1.5rem; display: flex; flex-direction: column; gap: .75rem; flex: 1; }
.project-tag { font-size: .82rem; color: var(--text-muted); }
.project-tag i { color: var(--accent); margin-right: .3rem; }
.project h3 { font-size: 1.3rem; }
.project-body > p:not(.project-tag) { color: var(--text-muted); }
.project .chips { margin-top: auto; padding-top: .5rem; }
.project-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; padding-top: .25rem; }
.btn-sm { padding: .55rem 1rem; font-size: .9rem; }
.project-note { color: var(--text-muted); font-size: .85rem; }

/* ---------- Chips ---------- */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .45rem; }
.chips li {
  font-size: .8rem; font-weight: 500; padding: .3rem .7rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}

/* ---------- Automatizaciones ---------- */
.flows { display: grid; gap: 1.25rem; }
.flow {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; display: grid; grid-template-columns: minmax(260px, 1fr) 1.4fr; gap: 1.5rem; align-items: center;
}
.flow-head { display: flex; gap: 1rem; align-items: flex-start; }
.flow-head h3 { font-size: 1.08rem; }
.flow-head p { color: var(--text-muted); font-size: .93rem; margin-top: .3rem; }
.flow-icon {
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1.1rem;
}
.flow-icon.purple { background: color-mix(in srgb, var(--purple) 14%, transparent); color: var(--purple); }
.flow-icon.blue { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }

.nodes { list-style: none; display: flex; align-items: stretch; gap: 1.6rem; }
.node {
  position: relative; flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  padding: .85rem .5rem; border-radius: 12px; text-align: center;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .8rem; font-weight: 600;
}
.node i { font-size: 1.1rem; }
.node small { display: block; font-weight: 400; color: var(--text-muted); font-size: .72rem; }
.node:not(:last-child)::after {
  content: ""; position: absolute; right: -1.35rem; top: 50%;
  width: 1.1rem; height: 2px; background: var(--border);
}
.node:not(:last-child)::before {
  content: ""; position: absolute; right: -1.4rem; top: calc(50% - 4px);
  border: 5px solid transparent; border-left-color: var(--text-muted);
}
.n-trigger i { color: var(--amber); }
.n-ai i { color: var(--purple); }
.n-code i { color: var(--blue); }
.n-out i { color: var(--accent); }
.n-db i { color: var(--accent-strong); }

/* ---------- Habilidades ---------- */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.skill-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; }
.skill-group h3 { font-size: 1rem; margin-bottom: 1rem; display: flex; align-items: center; gap: .55rem; }
.skill-group h3 i { color: var(--accent); }

.edu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; margin-top: 1.25rem; }
.edu-item {
  display: flex; gap: 1rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem 1.4rem;
}
.edu-icon { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.15rem; }
.edu-item h3 { font-size: 1rem; }
.edu-item p { color: var(--text-muted); font-size: .92rem; }

/* ---------- Contacto ---------- */
.github-activity {
  display: block; margin-top: 2rem; padding: clamp(1rem, 3vw, 1.75rem);
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius);
  text-align: center; overflow-x: auto;
}
.github-activity img { max-width: 100%; height: auto; display: inline-block; }

.contact-card {
  text-align: center; padding: clamp(2.5rem, 6vw, 4rem) clamp(1.25rem, 5vw, 4rem);
  background:
    radial-gradient(600px 260px at 50% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px);
}
.contact-card .section-sub { margin-inline: auto; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 2rem; }
.socials { display: flex; justify-content: center; gap: .75rem; margin-top: 1.75rem; }
.socials a {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); font-size: 1.1rem;
  transition: color .2s, border-color .2s, transform .15s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* ---------- Footer ---------- */
.brand-mark svg { width: 22px; height: 22px; }
.brand-cursor { animation: blink 1.1s steps(1) infinite; }

.footer { border-top: 1px solid var(--border); padding: 1.75rem 0; font-size: .88rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }


.fx-result-head, .fx-db-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.fx-db-head h2 { font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }
.fx-db-head h2 i { color: var(--accent); }
.fx-db-head p { font-size: .88rem; margin-top: .2rem; }
.fx-badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; white-space: nowrap; }
.fx-badge.ia { color: var(--accent); background: var(--accent-soft); }
.fx-badge.reglas { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.fx-aviso { font-size: .88rem; color: var(--amber); }
.fx-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .6rem; margin: 0; }
.fx-fields > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem; }
.fx-fields dt { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.fx-fields dd { margin: .15rem 0 0; font-weight: 600; overflow-wrap: anywhere; }
.fx-fields .destacado { border-color: var(--accent); background: var(--accent-soft); }
.fx-fields .destacado dd { color: var(--accent); font-size: 1.1rem; }
.fx-db-actions { display: flex; gap: .5rem; align-items: flex-start; flex-wrap: wrap; }
.fx-btn, .fx-cols summary {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  padding: .45rem .8rem; border-radius: 9px; font: inherit; font-size: .85rem; font-weight: 600;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
}
.fx-btn:hover, .fx-cols summary:hover { border-color: var(--accent); color: var(--accent); }
.fx-cols { position: relative; }
.fx-cols summary { list-style: none; }
.fx-cols summary::-webkit-details-marker { display: none; }
.fx-cols-list {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 5; width: 220px; max-height: 300px; overflow-y: auto;
  display: grid; gap: .35rem; padding: .75rem; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.fx-cols-list label { display: flex; align-items: center; gap: .5rem; font-size: .88rem; cursor: pointer; }
.fx-cols-list input { accent-color: var(--accent); }
.fx-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.fx-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.fx-table th, .fx-table td { padding: .6rem .8rem; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
.fx-table th { font-family: var(--mono); font-size: .75rem; font-weight: 600; color: var(--text-muted); background: var(--surface-2); text-transform: uppercase; letter-spacing: .03em; }
.fx-table tbody tr:last-child td { border-bottom: none; }
.fx-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.fx-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.fx-table td.id { color: var(--text-muted); font-family: var(--mono); }

/* ---------- Cascada de código (fondo) ---------- */
#code-bg {
  position: fixed; inset: 0; z-index: -1;
  overflow: hidden; pointer-events: none;
}
.code-stream {
  position: absolute; top: 0;
  white-space: pre; user-select: none;
  font-family: var(--mono); font-size: .9rem; font-weight: 600;
  color: var(--accent);
  opacity: 0;
  animation: codeFall linear forwards;
}
@keyframes codeFall {
  0%   { transform: translateY(-60px); opacity: 0; }
  10%  { opacity: var(--o, .12); }
  90%  { opacity: var(--o, .12); }
  100% { transform: translateY(100vh); opacity: 0; }
}
[data-theme="light"] .code-stream { color: var(--text-muted); }


/* ---------- Botón "Probar demo" en las tarjetas ---------- */
.flow-demo {
  grid-column: 1 / -1; justify-self: start;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1rem; border-radius: 9px;
  font: inherit; font-size: .88rem; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  cursor: pointer; transition: background .2s, color .2s, transform .15s;
}
.flow-demo:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.flow-demo.is-soon { cursor: default; opacity: .7; }
.flow-demo.is-soon:hover { background: var(--accent-soft); color: var(--accent); transform: none; }

/* ---------- Chat flotante ---------- */
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 60; }
.chat-fab {
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 1.35rem;
  border: none; cursor: pointer;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .2s, background .2s;
}
.chat-fab:hover { transform: scale(1.06); background: var(--accent-strong); }

.chat-panel {
  position: absolute; right: 0; bottom: 74px;
  width: min(370px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow); overflow: hidden;
  opacity: 0; transform: translateY(12px) scale(.98); transform-origin: bottom right;
  transition: opacity .2s, transform .2s;
}
.chat-panel.open { opacity: 1; transform: none; }

.chat-head {
  display: flex; align-items: center; gap: .7rem;
  padding: .9rem 1rem; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.chat-head h2 { font-size: 1rem; }
.chat-head p { font-size: .78rem; color: var(--text-muted); }
.chat-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--accent); color: #fff;
}
.chat-close, .chat-back {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  display: grid; place-items: center; background: transparent;
  border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem;
}
.chat-close { margin-left: auto; }
.chat-close:hover, .chat-back:hover { background: var(--surface-2); color: var(--text); }

.chat-menu { padding: 1rem; display: grid; gap: .6rem; align-content: start; overflow-y: auto; flex: 1; }
.chat-hello { font-weight: 600; margin-bottom: .25rem; }
.chat-opt {
  display: flex; align-items: center; gap: .8rem; width: 100%;
  padding: .85rem 1rem; border-radius: 12px; text-align: left;
  font: inherit; font-size: .93rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
  transition: border-color .2s, transform .15s;
}
.chat-opt i { color: var(--accent); width: 18px; text-align: center; }
.chat-opt:hover { border-color: var(--accent); transform: translateX(2px); }

.chat-conv { display: flex; flex-direction: column; height: min(440px, calc(100vh - 200px)); min-height: 0; }
.chat-conv[hidden], .chat-menu[hidden] { display: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.msg {
  max-width: 85%; padding: .65rem .9rem; border-radius: 14px;
  font-size: .9rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg-links { display: flex; gap: .5rem; flex-wrap: wrap; }
.msg-links a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .8rem; border-radius: 999px; font-size: .83rem; font-weight: 600;
  color: var(--accent); border: 1px solid var(--accent);
}
.msg-links a:hover { background: var(--accent); color: #fff; }
.typing { display: flex; gap: 4px; padding: .8rem .9rem; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); animation: dots 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--border); }
.chat-form input {
  flex: 1; min-width: 0; padding: .7rem .9rem; border-radius: 10px;
  font: inherit; font-size: .92rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
}
.chat-form input:focus { outline: none; border-color: var(--accent); }
.chat-form button {
  width: 42px; border-radius: 10px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: .95rem;
}
.chat-form button:disabled, .chat-form input:disabled { opacity: .6; cursor: default; }

@media (max-width: 560px) {
  .chat { right: 14px; bottom: 14px; }
  .chat-panel { bottom: 70px; }
}


/* ---------- Página demo de facturas ---------- */
.fx-wrap { max-width: 820px; display: grid; gap: 1.5rem; }
.fx .section-head { margin-bottom: 0; }
.fx-title { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }
.fx-nodes { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.fx-drop {
  display: grid; justify-items: center; gap: .5rem; text-align: center;
  padding: 2.75rem 1.5rem; border-radius: var(--radius); cursor: pointer;
  background: var(--surface); border: 2px dashed var(--border);
  transition: border-color .2s, background .2s;
}
.fx-drop:hover, .fx-drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.fx-drop.busy { pointer-events: none; opacity: .6; }
.fx-drop.disabled { cursor: not-allowed; opacity: .45; pointer-events: none; }
.fx-drop-icon {
  width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1.6rem; margin-bottom: .25rem;
}
.fx-drop .muted { font-size: .88rem; }
.fx-progress p { font-size: .9rem; color: var(--text-muted); margin-top: .5rem; }
.fx-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.fx-bar span { display: block; height: 100%; width: 40%; border-radius: inherit; background: var(--accent); animation: load 1.2s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
.fx-alert { padding: .9rem 1.1rem; border-radius: 12px; font-size: .93rem; border: 1px solid; }
.fx-alert.ok { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.fx-alert.error { color: #f87171; border-color: #f87171; background: rgba(248, 113, 113, .1); }
.fx-offline {
  display: flex; gap: 1rem; align-items: flex-start; padding: 1.1rem 1.25rem; border-radius: 12px;
  background: color-mix(in srgb, var(--amber) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
}
.fx-offline i { color: var(--amber); font-size: 1.2rem; margin-top: .2rem; }
.fx-offline p { color: var(--text-muted); font-size: .92rem; margin-top: .2rem; }
.fx-result, .fx-info, .fx-db { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; display: grid; gap: .75rem; }
.fx-info { justify-items: start; }
.fx-result h2, .fx-info h2 { font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }
.fx-result h2 i, .fx-info h2 i { color: var(--accent); }
.fx-result p, .fx-info p { color: var(--text-muted); font-size: .95rem; }

/* ---------- Animación de entrada ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  #code-bg { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { max-width: 520px; }
  .skills { grid-template-columns: repeat(2, 1fr); }
  .flow { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .menu-btn { display: grid; }
  .nav-links {
    position: fixed; inset: var(--nav-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: .75rem 16px 1.25rem;
    background: var(--bg); border-bottom: 1px solid var(--border);
    transform: translateY(-120%); transition: transform .25s ease;
    z-index: -1;
  }
  .nav-links.open { transform: none; }
  .nav-links a { padding: .85rem .5rem; font-size: 1rem; }

  .projects, .edu { grid-template-columns: 1fr; }

  .timeline::before { left: 6px; }
  .tl-item { grid-template-columns: 1fr; gap: .6rem; padding-left: 2rem; }
  .tl-item::before { left: 0; top: 4px; }
  .tl-date { text-align: left; padding: 0; }
}

@media (max-width: 560px) {
  .skills { grid-template-columns: 1fr; }
  .brand-name { display: none; }
  .nodes { flex-direction: column; gap: 1.1rem; }
  .node { flex-direction: row; justify-content: flex-start; gap: .75rem; padding: .7rem 1rem; text-align: left; }
  .node small { display: inline; margin-left: .35rem; }
  .node:not(:last-child)::after { right: auto; left: 50%; top: auto; bottom: -1rem; width: 2px; height: .8rem; }
  .node:not(:last-child)::before { display: none; }
  .hero-cta .btn { flex: 1; justify-content: center; }
}

/* ---------- Demo de reservas ---------- */
.rv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .85rem; align-items: end; }
.rv-campo { display: grid; gap: .35rem; font-size: .88rem; }
.rv-campo > span { color: var(--text-muted); font-weight: 500; }
.rv-campo input, .rv-campo select {
  width: 100%; padding: .65rem .8rem; font: inherit; font-size: .95rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.rv-campo input:focus, .rv-campo select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rv-campo.rv-chico { max-width: 130px; }
.rv-campo.rv-ancho { grid-column: 1 / -1; }
.rv-ver { justify-content: center; }
.rv-nota { font-size: .85rem; }
.rv-slots { display: flex; flex-wrap: wrap; gap: .5rem; }
.rv-slot {
  font: inherit; font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: .5rem .9rem; border-radius: 999px; cursor: pointer;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color .15s, color .15s, background .15s;
}
.rv-slot:hover { border-color: var(--accent); color: var(--accent); }
.rv-slot[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #03161a; }
[data-theme="light"] .rv-slot[aria-pressed="true"] { color: #fff; }
.rv-lista { display: grid; gap: .6rem; }
.rv-item {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .75rem .95rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
}
.rv-item.cancelada { opacity: .55; }
.rv-item-cod { font-family: var(--mono); font-weight: 600; color: var(--accent); }
.rv-item-txt { font-size: .9rem; color: var(--text-muted); }
