/* =============================================================
   iFlow Agents · Tokens y clases base para landings
   Extraído de web/frontend/src/index.css (iFlow Agents).
   Enlaza este archivo ANTES de tus estilos propios.
   Tema por defecto: OSCURO. Aplica la clase `light` a <html> para claro.
   ============================================================= */

/* ===== Tipografías (copia los .woff2 junto a este CSS) =====
   Origen: web/frontend/public/fonts/*.woff2
   Si no puedes usar los archivos, borra estos @font-face y define
   `font-family: sans-serif` como respaldo (se pierde la firma tipográfica). */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./fonts/jetbrains-mono-400-700-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("./fonts/space-grotesk-500-700-latin.woff2") format("woff2");
}

/* ===== Tokens ===== */
:root {
  color-scheme: dark;

  --bg: 5 7 15;
  --panel: 11 17 32;
  --panel-2: 15 23 42;
  --input: 2 4 9;
  --line: 30 41 59;
  --text: 226 232 240;
  --text-strong: 241 245 249;
  --muted: 148 163 184;
  --dim: 100 116 139;
  --accent: 0 210 255;
  --accent-soft: 125 228 255;
  --accent-2: 0 168 255;
  --accent-2-soft: 141 214 255;
  --warn: 203 213 225;
  --overlay: 255 255 255; /* base de las capas «white/N» */
  --shade: 0 0 0;         /* base de «black/N» */

  --radius-btn: 4px;
  --radius-field: 7px;
  --radius-surface: 10px;
  --grad-brand: linear-gradient(90deg, rgb(var(--accent)), rgb(var(--accent-2)));
  --shadow-brand: 0 4px 18px -6px rgba(0, 210, 255, 0.4);
}
html.light {
  color-scheme: light;

  --bg: 244 247 251;
  --panel: 255 255 255;
  --panel-2: 238 242 248;
  --input: 255 255 255;
  --line: 214 223 235;
  --text: 15 23 42;
  --text-strong: 2 6 23;
  --muted: 71 85 105;
  --dim: 100 116 139;
  --accent: 0 168 255;
  --accent-soft: 2 132 199;
  --accent-2: 0 143 219;
  --accent-2-soft: 2 116 176;
  --warn: 180 83 9;
  --overlay: 15 23 42;
  --shade: 148 163 184;
}

/* ===== Base ===== */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; scrollbar-color: rgb(var(--line)) rgb(var(--bg)); }

body {
  margin: 0;
  min-height: 100vh;
  color: rgb(var(--text));
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: rgb(var(--bg));
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 {
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  margin: 0;
}

::selection { background: rgb(var(--accent)); color: rgb(var(--bg)); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgb(var(--line)); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgb(var(--accent)); }

/* Contenedor y ritmo de sección (patrón de landing) */
.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 20px; }
.section { padding-block: 84px; }
@media (max-width: 640px) { .section { padding-block: 56px; } }

/* ===== Superficies =====
   Translúcida + brillo superior para dejar ver la constelación.
   SIN `backdrop-filter`: en Chromium excluiría el canvas fijo del fondo. */
.pf-panel {
  position: relative;
  border-radius: var(--radius-surface);
  border: 1px solid rgb(var(--line));
  background: rgb(var(--panel) / 0.24);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 55%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}
.glass {              /* variante sólida (como la app) */
  border-radius: var(--radius-surface);
  border: 1px solid rgb(var(--line));
  background: rgb(var(--panel));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
html.light .glass { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }
.glass-hover { transition: border-color .3s, box-shadow .3s, transform .3s; }
.glass-hover:hover {
  border-color: rgb(var(--accent) / 0.4);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28), 0 0 0 1px rgb(var(--accent) / 0.1);
  transform: translateY(-2px);
}

/* ===== Botones ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .625rem 1rem; font-size: .875rem; font-weight: 600;
  border-radius: var(--radius-btn); transition: all .15s;
  cursor: pointer; text-decoration: none;
}
.btn-primary {
  background: var(--grad-brand);
  color: #05070f;                 /* oscuro fijo: el degradado es brillante en ambos temas */
  border: 1px solid transparent;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 6px 26px -6px rgba(0, 210, 255, 0.6); }
.btn-primary:active { transform: scale(0.98); }
.btn-ghost {
  border: 1px solid rgb(var(--line));
  background: rgb(var(--panel-2));
  color: rgb(var(--text));
}
.btn-ghost:hover { background: rgb(var(--line)); color: rgb(var(--text-strong)); border-color: rgb(var(--accent) / 0.35); }
.btn-danger { border: 1px solid rgba(255, 143, 143, 0.4); background: #c24343; color: #fff; }
.btn-danger:hover { background: #d45252; }

/* ===== Campos ===== */
.field {
  width: 100%; padding: .625rem .875rem; font-size: .875rem; font-family: inherit;
  border-radius: var(--radius-field);
  border: 1px solid rgb(var(--line));
  background: rgb(var(--input) / 0.75);
  color: rgb(var(--text)); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field::placeholder { color: rgb(var(--dim)); }
.field:focus { border-color: rgb(var(--accent)); box-shadow: 0 0 0 2px rgb(var(--accent) / 0.22); }

/* Select con flecha propia temada */
.select-field {
  cursor: pointer; padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85rem center; background-size: 1rem 1rem;
}
html.light .select-field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.select-field:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2300a8ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* ===== Chips ===== */
.chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .125rem .625rem; font-size: 11px; font-weight: 500;
  border-radius: 3px; border: 1px solid rgb(var(--line));
  background: rgb(var(--panel-2)); color: rgb(var(--text));
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

/* ===== Texto degradado de marca ===== */
.gradient-text, .pf-grad {
  background: linear-gradient(92deg, rgb(var(--accent)) 12%, rgb(var(--accent-soft)) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ===== Motivos «blueprint» ===== */
.pf-display { font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif; }
.pf-mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.pf-cyan { color: rgb(var(--accent)); }
.pf-amber { color: rgb(var(--text)); }
.pf-mut { color: rgb(var(--muted)); }
.pf-dim { color: rgb(var(--dim)); }

.pf-title { font-family: "Space Grotesk", sans-serif; font-weight: 700; letter-spacing: -0.01em; }

.pf-kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: "JetBrains Mono", monospace; font-size: 10.5px;
  letter-spacing: 0.22em; color: rgb(var(--muted));
  border: 1px solid rgb(var(--line)); padding: 6px 14px;
  background: rgb(var(--panel) / 0.85); text-transform: uppercase;
  /* Esquinas rectas (app). Para el estilo «píldora» del sitio, añade:
     border-radius: 999px; */
}
.pf-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: rgb(var(--accent)); animation: pf-pulse 1.8s infinite;
}
@keyframes pf-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.pf-micro {
  font-family: "JetBrains Mono", monospace; font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: rgb(var(--dim));
}
.pf-label {
  font-family: "JetBrains Mono", monospace; font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: rgb(var(--muted));
}
.pf-tag {
  font-family: "JetBrains Mono", monospace; font-size: 9.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 9px; border: 1px solid rgb(var(--line));
  color: rgb(var(--muted)); white-space: nowrap; border-radius: 4px;
}
.pf-tag.g { border-color: rgba(74, 222, 128, 0.45); color: #16a34a; }
html:not(.light) .pf-tag.g { color: #4ade80; }
.pf-tag.a { border-color: rgb(var(--muted) / 0.5); color: rgb(var(--muted)); }
.pf-tag.c { border-color: rgb(var(--accent) / 0.45); color: rgb(var(--accent)); }
.pf-tag.r { border-color: rgba(248, 113, 113, 0.5); color: #dc2626; }
html:not(.light) .pf-tag.r { color: #f87171; }

.pf-rule { height: 1px; border: 0; background: linear-gradient(90deg, rgb(var(--line)), transparent); }

.pf-link { font-family: "JetBrains Mono", monospace; font-size: 11px; letter-spacing: 0.08em; color: rgb(var(--accent)); text-decoration: none; }
.pf-link:hover { color: rgb(var(--accent-2)); }

.pf-row {
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 6px; border: 1px solid rgb(var(--line));
  background: rgb(var(--input) / 0.5); padding: 10px 14px;
}
.pf-listitem {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 8px; font-size: 13.5px; border-radius: 6px;
}
.pf-listitem:hover { background: rgb(var(--accent) / 0.08); }

/* ===== Fondo «constelación» ===== */
.constellation {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
}

/* ===== Animaciones de espera (chat) ===== */
@keyframes pf-think { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-3px); opacity: 1; } }
.pf-think-dot { width: 5px; height: 5px; border-radius: 999px; background: rgb(var(--accent)); animation: pf-think 1.15s ease-in-out infinite both; }
.pf-think-dot:nth-child(2) { animation-delay: 0.15s; }
.pf-think-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes pf-sweep { from { transform: translateX(-120%); } to { transform: translateX(220%); } }
.pf-sweep { position: relative; overflow: hidden; }
.pf-sweep::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgb(var(--accent) / 0.1), transparent);
  transform: translateX(-120%); animation: pf-sweep 1.7s ease-in-out infinite;
}

@keyframes pf-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.pf-shimmer {
  background-image: linear-gradient(90deg, rgb(var(--overlay) / 0.05) 0%, rgb(var(--overlay) / 0.14) 50%, rgb(var(--overlay) / 0.05) 100%);
  background-size: 200% 100%; animation: pf-shimmer 1.5s linear infinite;
}

/* ===== Accesibilidad: menos movimiento ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pf-think-dot, .pf-sweep::after, .pf-shimmer, .pf-dot { animation: none; }
  .glass-hover:hover { transform: none; }
}

/* ===== Aparición al hacer scroll (opcional, activada por JS con `.js`) ===== */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
  .js .reveal.in { opacity: 1; transform: none; }
}
