/* =============================================================================
   Lole Scaldaferro · portfolio v4
   Mundo visual: golden hour editorial. Un solo momento atmosférico (el cielo del
   hero, donde el grafo hace de estrellas) y después papel: canvas #f7f7f7,
   objetos blancos con anillo pálido, Newsreader en títulos, Inter en el resto,
   un único azul funcional. Pills de 50px, marcos de 22–30px.
   ============================================================================= */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("assets/fonts/newsreader-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("assets/fonts/newsreader-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/inter-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  /* Tokens de la referencia (Portal) */
  --blue: #007aff;
  --blue-deep: #0066d6;
  --blue-tint: #e6f1ff;
  --ink: #000000;
  --graphite: #3e3e3e;
  --smoke: #636363;
  --paper: #ffffff;
  --ash: #f7f7f7;
  --ash-2: #ededed;
  --line: rgba(0, 0, 0, 0.1);
  --line-soft: rgba(0, 0, 0, 0.06);
  --line-strong: rgba(0, 0, 0, 0.28);
  --dusk: #273438;
  --ground: #2f2a4d;

  /* Alias que consume graph.js (se re-declaran en el cielo) */
  --page: var(--ash);
  --surface: var(--paper);
  --muted: var(--smoke);

  --serif: "Newsreader", "Iowan Old Style", "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --r-nav: 22px;
  --r-card: 22px;
  --r-frame: 26px;
  --r-screen: 16px;
  --pill: 50px;

  --ring: 0 0 0 5px var(--ash);
  --frame-shadow: 0 1px 2px rgba(20, 22, 45, 0.06), 0 18px 48px -18px rgba(20, 22, 45, 0.22);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --hero-overlap: 280px;
  --page-max: 1200px;
  --column: 640px;
  --breakout: 1040px;
  --gutter: clamp(20px, 4vw, 40px);
  --section-gap: clamp(88px, 10vw, 128px);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--ash);
}

body {
  margin: 0;
  background: var(--ash);
  color: var(--graphite);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: -0.02em;
  font-feature-settings: "cv03", "cv04", "cv09", "cv11";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.is-dialog-open { overflow: hidden; }

button, input, select { font: inherit; letter-spacing: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
hr { border: 0; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.sky :focus-visible,
.graph-dialog :focus-visible { outline-color: #fff; }

.skip-link {
  position: fixed;
  left: 20px;
  top: 16px;
  z-index: 100;
  transform: translateY(-160%);
  border-radius: var(--pill);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  font-size: 14px;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- Tipografía ---------- */

h1, h2, h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  font-optical-sizing: auto;
  letter-spacing: -0.015em;
  line-height: 1.02;
  text-wrap: balance;
}

h2 { font-size: clamp(32px, 3.2vw, 40px); }
h3 { font-size: 27px; }

p { margin: 0; }

.column {
  width: min(var(--column), 100% - 2 * var(--gutter));
  margin: 0 auto;
}

.column > h2 + p,
.column > p + p { margin-top: 14px; }
.column > h2 + p { margin-top: 18px; }
.column > p { font-size: 16px; line-height: 1.45; color: var(--graphite); }

/* ---------- Pills, badges, dots ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 22px;
  border: 1.5px solid transparent;
  border-radius: var(--pill);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: transform 260ms var(--ease), background-color 200ms ease, color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.pill:hover { transform: translateY(-1px); }
.pill:active { transform: translateY(0) scale(0.98); }

.pill-blue {
  background: var(--blue-deep);
  color: #fff;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.08), 0 3px 2px 0 rgba(0, 0, 0, 0.06);
}
.pill-blue:hover { background: #0057b8; }

.pill-white {
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 0 0 #fff, 0 0 0 1px rgba(0, 0, 0, 0.12), 0 3px 2px 0 rgba(0, 0, 0, 0.06);
}
.pill-white:hover { box-shadow: inset 0 1px 0 0 #fff, 0 0 0 1px rgba(0, 0, 0, 0.18), 0 6px 14px -4px rgba(0, 0, 0, 0.18); }

.pill-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.pill-ghost:hover { background: rgba(0, 0, 0, 0.05); }

.pill-ghost-light {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.72);
}
.pill-ghost-light:hover { background: rgba(255, 255, 255, 0.18); }

.pill-sm { min-height: 36px; padding: 8px 16px; font-size: 14px; }
.pill-lg { min-height: 50px; padding: 14px 28px; font-size: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 11px;
  border-radius: var(--pill);
  background: var(--blue-tint);
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-quiet { background: var(--ash-2); color: var(--smoke); }

.dot {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line-soft), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.dot svg { width: 15px; height: 15px; fill: var(--c, var(--ink)); }
.dot-blue { background: var(--blue); box-shadow: none; }
.dot-blue svg { fill: #fff; }

/* ---------- Nav cápsula ---------- */

.topbar {
  position: fixed;
  top: 18px;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  padding: 0 var(--gutter);
  pointer-events: none;
}

.capsule {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 52px;
  padding: 0 8px 0 10px;
  border-radius: var(--r-nav);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 0 0 5px rgba(247, 247, 247, 0.55), 0 8px 24px -10px rgba(20, 22, 45, 0.25);
  transition: box-shadow 260ms ease;
}
.topbar.is-scrolled .capsule {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 0 5px var(--ash), 0 8px 24px -10px rgba(20, 22, 45, 0.18);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.mark,
.app-icon {
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: #fff;
}
.mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.mark svg, .app-icon svg { width: 100%; height: 100%; }

.capsule-links {
  display: flex;
  gap: 4px;
}
.capsule-links a {
  padding: 7px 12px;
  border-radius: var(--pill);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 200ms ease, color 200ms ease;
}
.capsule-links a:hover { background: var(--ash); }
.capsule-links a.is-active { background: var(--ash-2); }

.capsule-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--pill);
  background: var(--ash);
}
.lang button {
  min-width: 34px;
  height: 28px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--smoke);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.lang button.is-active { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line-soft), 0 1px 2px rgba(0, 0, 0, 0.06); }

/* ---------- Cielo (hero) ---------- */

.sky {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  padding: 140px 0 300px;
  background: var(--dusk);
  color: #fff;
  overflow: clip;
}

.sky-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.sky-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: brightness(0.78) saturate(0.9);
}

.graph-home {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.knowledge-graph {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  /* El grafo se pinta con estas variables: estrellas blancas, foco cálido. */
  --ink: #ffffff;
  --muted: rgba(255, 255, 255, 0.7);
  --blue: #ffe3bd;
  --page: transparent;
  --surface: transparent;
  --graph-halo: rgba(29, 37, 34, 0.52);
}

#graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: pan-y;
  outline-offset: -4px;
}
#graph-canvas.is-dragging { cursor: grabbing; }

.horizon {
  position: absolute;
  left: -6vw;
  right: -6vw;
  bottom: 0;
  height: 26%;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(120% 100% at 50% 100%, var(--ground) 0 58%, rgba(47, 42, 77, 0.55) 60%, transparent 66%);
}
.horizon-art {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}
.horizon.has-art { background: none; height: 34%; }
.horizon-art.is-missing { display: none; }

.sky-copy {
  position: relative;
  z-index: 3;
  width: min(940px, 100% - 2 * var(--gutter));
  margin: 0 auto;
  text-align: center;
  pointer-events: none;
}
.sky-copy > * { pointer-events: auto; }

.sky h1 {
  color: #fff;
  font-size: clamp(34px, 3.3vw, 46px);
  line-height: 1.06;
  letter-spacing: -0.012em;
  text-shadow: 0 1px 24px rgba(20, 24, 22, 0.34);
}

.sky-lede {
  width: min(560px, 100%);
  margin: 20px auto 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 16px;
  line-height: 1.4;
}

.sky-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.graph-compact-actions {
  position: absolute;
  left: clamp(20px, 3vw, 40px);
  /* Por encima de la franja que pisa el mockup: el pie es la respuesta al nodo
     que se está tocando y tiene que verse mientras se explora el cielo. */
  bottom: calc(var(--hero-overlap) + 26px);
  z-index: 3;
  width: min(300px, 40vw);
  pointer-events: none;
}
.graph-compact-actions p {
  margin: 0;
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  text-shadow: 0 1px 12px rgba(40, 30, 90, 0.5);
  animation: rise 500ms var(--ease) both;
}
.graph-compact-actions p:not(.is-node) { display: none; }
.graph-compact-actions p strong { display: block; font-weight: 600; margin-bottom: 2px; }

.device {
  --rest-shadow: var(--frame-shadow);
  margin: 0;
  padding: 10px;
  border-radius: var(--r-frame);
  background: #fff;
  box-shadow: var(--ring), var(--frame-shadow);
}

.device .screen {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--r-screen);
  background: var(--ash-2);
  aspect-ratio: 16 / 10;
}
.device .screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 800ms var(--ease);
}
a.screen:hover img { transform: scale(1.015); }

.device-hero {
  position: relative;
  z-index: 4;
  width: min(900px, 100% - 2 * var(--gutter));
  margin: calc(-1 * var(--hero-overlap)) auto 0;
}

.hero-foot {
  width: min(900px, 100% - 2 * var(--gutter));
  margin: 0 auto;
  padding: 0;
}

/* ---------- Entradas de proyecto ---------- */

.entry {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: 22px 6px 0;
}
.entry > div:first-child { max-width: 560px; }
.entry h2 { font-size: 34px; }
.entry h3 + p, .entry h2 + p { margin-top: 8px; color: var(--graphite); font-size: 15px; line-height: 1.45; }
.entry-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding-top: 4px;
}
.entry-hero { padding-top: 26px; }

/* ---------- Secciones editoriales ---------- */

.editorial { padding: var(--section-gap) 0 0; }

.stack {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
}
.stack li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}

.rule {
  width: min(var(--column), 100% - 2 * var(--gutter));
  height: 0;
  margin: var(--section-gap) auto;
  border-top: 2px dashed var(--ash-2);
}

/* ---------- Proyectos ---------- */

.work {
  width: min(var(--breakout), 100% - 2 * var(--gutter));
  margin: 0 auto;
}
.work-wide { margin-top: 56px; }

.pair {
  width: min(var(--breakout), 100% - 2 * var(--gutter));
  margin: 64px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.pair .work { width: 100%; min-width: 0; }
.pair .entry { flex-direction: column; gap: 14px; }
.pair .entry-actions { flex-direction: row; flex-wrap: wrap; align-items: center; padding-top: 0; }
.pair h3 { font-size: 26px; }

.device[data-gallery] { position: relative; }
.gallery-controls {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 2;
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 6px 18px -6px rgba(0, 0, 0, 0.25);
}
.gallery-controls button {
  min-height: 32px;
  border: 0;
  border-radius: var(--pill);
  padding: 0 13px;
  background: transparent;
  color: var(--smoke);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.gallery-controls button.is-active { background: var(--ink); color: #fff; }

.device-concept .screen img { object-position: center; }
.device .screen .mission-pixel {
  object-position: left top;
  transform: scale(1.035);
  transform-origin: left top;
}
a.screen:hover .mission-pixel { transform: scale(1.05); }

/* Reportes Power BI: páginas reales exportadas del .pbix, compuestas sobre el mismo
   ceniza de las pantallas vacías para que un 4:3 o un 16:9 entren en el 16:10 sin
   recortarse. La página completa se lee en .report-dialog. */

/* Abanico de pantallas en perspectiva */
.fan {
  --tilt: 18deg;
  width: min(1200px, 100%);
  margin: 96px auto 0;
  padding: 24px var(--gutter) 40px;
  display: grid;
  grid-template-columns: 0.92fr 1.16fr 0.92fr;
  gap: 18px;
  perspective: 1600px;
  perspective-origin: 50% 40%;
}
.fan-item {
  --rest-shadow: 0 24px 60px -24px rgba(20, 22, 45, 0.4);
  margin: 0;
  padding: 7px;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--ring), 0 24px 60px -24px rgba(20, 22, 45, 0.4);
  transform: rotateY(calc(var(--i) * var(--tilt))) translateZ(calc(-1 * abs(var(--i)) * 40px)) translateY(calc(abs(var(--i)) * 16px));
  transform-style: preserve-3d;
  transition: transform 700ms var(--ease);
}
.fan-item-featured { position: relative; z-index: 1; }
.fan-item img {
  width: 100%;
  /* height auto: sin esto el atributo height del <img> vale como alto real y anula el 16:10. */
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  border-radius: 13px;
  background: var(--ash-2);
}
.fan-item figcaption { display: grid; gap: 3px; padding: 12px 8px 8px; }
.fan-item figcaption strong { color: var(--ink); font-size: 14px; font-weight: 600; }
.fan-item figcaption span { color: var(--smoke); font-size: 12px; line-height: 1.35; }
.fan-item:hover { transform: rotateY(0deg) translateZ(30px); z-index: 2; }

.list {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
}
.list li:first-child { border-top: 0; }
.list strong { display: block; color: var(--ink); font-size: 15px; font-weight: 600; }
.list li > div > span { display: block; margin-top: 3px; color: var(--smoke); font-size: 14px; line-height: 1.4; }
.list li > a {
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.list li > a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Sistema ---------- */

.fleet {
  width: min(var(--breakout), 100% - 2 * var(--gutter));
  margin: 64px auto 0;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 64px;
}

.fleet-stack {
  display: grid;
  gap: 0;
  padding: 12px 24px;
}
.agent {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 14px 34px -16px rgba(20, 22, 45, 0.3);
  transform: rotate(calc(var(--r, 0) * 1deg)) translateX(calc(var(--x, 0) * 1px));
  transition: transform 600ms var(--ease);
}
.agent + .agent { margin-top: -6px; }
.agent:nth-child(1) { --r: -1.4; --x: -8; }
.agent:nth-child(2) { --r: 0.9; --x: 10; }
.agent:nth-child(3) { --r: -0.5; --x: -2; }
.agent:nth-child(4) { --r: 1.2; --x: 12; }
.agent:hover { transform: rotate(0) translateX(0) translateY(-2px); z-index: 1; position: relative; }
.avatar {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.agent strong { display: block; color: var(--ink); font-size: 15px; font-weight: 600; }
.agent div > span { display: block; margin-top: 2px; color: var(--smoke); font-size: 13px; line-height: 1.35; }

.fleet-copy h3 { font-size: 30px; }
.fleet-copy p { margin-top: 12px; font-size: 15px; line-height: 1.45; }
.tools {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tools li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 12px 0 8px;
  border-radius: var(--pill);
  background: #fff;
  box-shadow: 0 0 0 1px var(--line-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}
.tools svg { width: 14px; height: 14px; fill: var(--ink); }

.flow-shell {
  --rest-shadow: 0 22px 54px -22px rgba(0, 0, 0, 0.38);
  width: min(var(--breakout), 100% - 2 * var(--gutter));
  margin: 72px auto 0;
  overflow: hidden;
  border-radius: var(--r-frame);
  background: #0b0d0c;
  box-shadow: 0 0 0 5px var(--ash), 0 22px 54px -22px rgba(0, 0, 0, 0.38);
}

.flow-topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
}
.flow-topbar > div:first-child { display: grid; gap: 2px; }
.flow-topbar strong { color: #fff; font-size: 15px; font-weight: 600; }
.flow-topbar span { color: rgba(255, 255, 255, 0.66); font-size: 13px; }

.flow-controls { display: flex; gap: 6px; }
.flow-controls button,
.graph-nav button,
.graph-close {
  border: 0;
  background: var(--ash);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--line-soft);
}
.flow-controls button {
  min-width: 36px;
  height: 36px;
  border-radius: var(--pill);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  background: #1a1d1b;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.n8n-embed {
  --n8n-workflow-min-height: 560px;
  position: relative;
  min-height: 560px;
  margin: 0 10px;
  overflow: hidden;
  border-radius: var(--r-screen);
  background: #050706;
}
.n8n-embed n8n-demo { display: block; }

.n8n-gate {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 0;
  background: rgba(0, 0, 0, 0);
  cursor: pointer;
  transition: background-color 240ms ease;
}
.n8n-gate:hover { background: rgba(0, 0, 0, 0.2); }
.n8n-gate .pill {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 240ms ease, transform 320ms var(--ease);
}
.n8n-gate:hover .pill,
.n8n-gate:focus-visible .pill { opacity: 1; transform: translateY(0); }
.n8n-embed.is-live .n8n-gate { display: none; }

.flow-shell:not(.is-fallback) .flow-controls,
.flow-shell:not(.is-fallback) .flow-viewport,
.flow-shell:not(.is-fallback) .flow-detail,
.flow-shell.is-fallback .n8n-embed { display: none; }

.flow-footnote {
  padding: 14px 22px 18px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

/* Réplica propia (fallback sin CDN) */
.flow-viewport {
  position: relative;
  height: 540px;
  margin: 0 10px;
  overflow: hidden;
  border-radius: var(--r-screen);
  background-color: #101311;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 22px 22px;
  cursor: grab;
}
.flow-viewport.is-dragging { cursor: grabbing; }
.flow-board { position: absolute; left: 0; top: 0; width: 1400px; height: 620px; transform-origin: 0 0; }
.flow-lines { position: absolute; left: 0; top: 0; }
.flow-node {
  position: absolute;
  width: 156px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #202421;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 8px 22px -10px rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  border: 0;
}
.flow-node.is-active { box-shadow: 0 0 0 2px var(--blue); }
.flow-node .mark { width: 26px; height: 26px; border-radius: 8px; font-size: 10px; font-weight: 700; }
.flow-detail {
  display: grid;
  gap: 3px;
  padding: 14px 22px 0;
}
.flow-detail span { color: var(--blue); font-size: 11px; font-weight: 600; }
.flow-detail strong { color: #fff; font-size: 15px; font-weight: 600; }
.flow-detail p { color: rgba(255, 255, 255, 0.66); font-size: 13px; }

/* ---------- Sobre mí (memo) ---------- */

.about { display: flex; justify-content: center; padding: 0 var(--gutter); }

.memo {
  position: relative;
  width: min(680px, 100%);
  padding: 44px 48px 40px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04), 0 30px 60px -30px rgba(20, 22, 45, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.04);
  transform: rotate(-1.2deg);
  color: var(--graphite);
  font-size: 15px;
  line-height: 1.5;
}
.memo > p + p { margin-top: 14px; }
.memo-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.memo h2 {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  padding-top: 4px;
}

.seal {
  position: relative;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin: -14px -10px 0 0;
  color: #fff;
  transform: rotate(8deg);
}
.seal svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.seal-lobes { fill: none; stroke: var(--blue); stroke-width: 11; stroke-dasharray: 0 15.29; stroke-linecap: round; }
.seal-body { fill: var(--blue); }
.seal b {
  position: relative;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}
.seal small { font-size: 13px; font-weight: 400; }

.memo-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 30px;
}
.signature {
  font-family: var(--serif);
  font-style: italic;
  font-size: 34px;
  line-height: 1.1;
  color: var(--ink);
  padding-bottom: 2px;
}
.memo-links { display: flex; gap: 18px; font-size: 14px; font-weight: 500; }
.memo-links a { display: inline-flex; align-items: center; min-height: 26px; color: var(--ink); text-decoration: none; }
.memo-links a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Cierre ---------- */

.close {
  width: min(var(--column), 100% - 2 * var(--gutter));
  margin: var(--section-gap) auto 0;
  display: grid;
  justify-items: center;
  text-align: center;
}
.app-icon {
  width: 58px;
  height: 58px;
  border-radius: 17px;
  box-shadow: 0 0 0 4px #fff, 0 0 0 5px rgba(0, 0, 0, 0.08), 0 10px 30px -10px rgba(29, 37, 34, 0.35);
}
.close h2 { margin-top: 22px; font-size: clamp(34px, 3.6vw, 44px); }
.close p { margin-top: 14px; max-width: 460px; font-size: 16px; line-height: 1.45; }
.close .pill { margin-top: 30px; }

/* ---------- Footer ---------- */

.foot {
  position: relative;
  margin-top: 88px;
  overflow: hidden;
}
.foot-row {
  width: min(var(--column), 100% - 2 * var(--gutter));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  color: var(--smoke);
  font-size: 13px;
}
.foot-links { display: grid; gap: 4px; text-align: right; justify-items: end; }
.foot-links a { display: inline-flex; align-items: center; min-height: 26px; color: var(--ink); text-decoration: none; }
.foot-links a:hover { text-decoration: underline; text-underline-offset: 4px; }

.foot-horizon {
  display: block;
  position: relative;
  height: 220px;
  margin-top: 40px;
  background: linear-gradient(180deg, var(--ash) 0%, #eef1f8 100%);
}
.foot-horizon .horizon-art { object-position: center top; }
.foot-horizon.has-art { height: clamp(220px, 28vw, 420px); background: none; }

/* ---------- Dialog del grafo (modo nocturno sólido) ---------- */

.graph-dialog {
  width: calc(100vw - 32px);
  max-width: none;
  height: calc(100dvh - 32px);
  max-height: none;
  margin: 16px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--r-frame);
  background: var(--dusk);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 40px 120px -30px rgba(0, 0, 0, 0.6);
}
.dialog-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.dialog-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: brightness(0.6) saturate(0.85);
}
.graph-dialog-body { position: relative; z-index: 1; }
.graph-dialog::backdrop {
  background: rgba(20, 18, 40, 0.55);
  backdrop-filter: blur(10px);
}
.graph-dialog-header {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 5;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  pointer-events: none;
}
.graph-dialog-header > * { pointer-events: auto; }
.graph-dialog-header span { color: rgba(255, 255, 255, 0.8); font-size: 12px; font-weight: 600; }
.graph-dialog-header h2 { margin-top: 2px; color: #fff; font-size: 28px; }
.graph-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  font-size: 25px;
  line-height: 1;
  box-shadow: none;
}
.graph-dialog-body { height: 100%; }
.graph-dialog-body .knowledge-graph[data-mode="expanded"] { height: 100%; }

/* ---------- Visor de reportes Power BI (papel, no cielo) ---------- */

.report-dialog {
  width: calc(100vw - 32px);
  max-width: 1480px;
  height: calc(100dvh - 32px);
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--r-frame);
  background: var(--ash);
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 40px 120px -30px rgba(0, 0, 0, 0.45);
}
.report-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.report-dialog::backdrop {
  background: rgba(20, 18, 40, 0.55);
  backdrop-filter: blur(10px);
}
.report-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px 26px;
}
.report-dialog-header span { color: var(--smoke); font-size: 12px; font-weight: 600; }
.report-dialog-header h2 { margin-top: 2px; font-size: 28px; }
.report-dialog .graph-close { flex: 0 0 auto; box-shadow: var(--ring); }
.report-dialog-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 0 20px 20px;
}
.report-dialog-body img {
  width: auto;
  height: auto;
  max-width: 100%;
  /* Alto explícito: con max-height: 100% la página ignoraba la fila de la grilla y se cortaba.
     150px = margen del dialog (32) + encabezado (~98) + padding inferior (20). */
  max-height: calc(100dvh - 150px);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--ring), var(--frame-shadow);
}

.knowledge-graph[data-mode="expanded"] .graph-compact-actions { display: none; }

.knowledge-graph[data-mode="expanded"] .graph-expanded-controls {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 22px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}
.graph-expanded-controls, .graph-detail, .graph-nav { display: none; }
.graph-search, .graph-filters { pointer-events: auto; }
.graph-search input {
  width: min(340px, 30vw);
  height: 44px;
  border: 0;
  border-radius: var(--pill);
  background: #fff;
  color: #000;
  padding: 0 18px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.graph-search input::placeholder { color: #5f5f5f; }
.graph-filters {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--pill);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.graph-filters button {
  min-height: 34px;
  border: 0;
  border-radius: var(--pill);
  padding: 0 13px;
  background: transparent;
  color: var(--smoke);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.graph-filters button.is-active { background: #000; color: #fff; }

.knowledge-graph[data-mode="expanded"] .graph-detail {
  position: absolute;
  left: 24px;
  top: 96px;
  z-index: 4;
  display: grid;
  width: min(330px, calc(100% - 120px));
  gap: 4px;
  padding: 16px 18px;
  border-radius: 16px;
  background: #fff;
  color: var(--graphite);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 16px 40px -16px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.graph-detail span { color: var(--blue-deep); font-size: 11px; font-weight: 600; }
.graph-detail strong { color: #000; font-family: var(--serif); font-size: 24px; font-weight: 400; }
.graph-detail p { margin-top: 2px; font-size: 13px; line-height: 1.4; }

.knowledge-graph[data-mode="expanded"] .graph-nav {
  position: absolute;
  right: 24px;
  top: 96px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.graph-nav button { width: 42px; height: 42px; border-radius: 50%; background: #fff; color: #000; font-size: 18px; box-shadow: none; }
.graph-close { color: #000; }

.knowledge-graph[data-mode="expanded"] #graph-canvas { touch-action: none; }

/* ---------- Motion ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 900ms var(--ease), transform 900ms var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

.sky-copy > * {
  animation: rise 1100ms var(--ease) both;
}
.sky-copy > :nth-child(2) { animation-delay: 90ms; }
.sky-copy > :nth-child(3) { animation-delay: 180ms; }
.device-hero { animation: rise 1200ms var(--ease) 260ms both; }
.graph-home { animation: fade 1600ms ease 200ms both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Llegada desde el grafo: el objeto que respondió al nodo se identifica una vez.
   Mismo anillo de 5px del sistema, teñido de azul y devuelto a ceniza. */
@keyframes arrive {
  from { box-shadow: 0 0 0 5px var(--blue), var(--rest-shadow); }
  to { box-shadow: 0 0 0 5px var(--ash), var(--rest-shadow); }
}
.is-arrived { animation: arrive 1300ms var(--ease) both; }

/* Canvas de n8n: el pill del gate solo aparecía al hacer hover, así que en touch y
   sin mover el mouse el canvas se leía como una captura. Al entrar en viewport se
   muestra una vez y después vuelve a depender del hover. */
.n8n-embed.is-primed .n8n-gate .pill { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .sky-copy > *, .device-hero, .graph-home { animation: none; opacity: 1; transform: none; transition: none; }
  .pill, .agent, .fan-item, .device .screen img { transition: none; }
  .is-arrived { animation: none; }
}

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

/* Viewport muy bajo: celular apaisado o 400% de zoom. El cielo respira menos
   para que el titular y los dos CTA entren sin scrollear. */
@media (max-height: 430px) {
  :root { --hero-overlap: 80px; }
  .sky { padding-top: 92px; padding-bottom: 150px; }
  .sky h1 { font-size: clamp(26px, 3.2vw, 34px); }
  .sky-lede { margin-top: 12px; }
  .sky-actions { margin-top: 18px; }
}


@media (max-width: 1100px) {
  .fleet { grid-template-columns: 1fr; gap: 40px; }
  .fleet-stack { max-width: 520px; }
}

@media (max-width: 900px) {
  .pair { grid-template-columns: 1fr; gap: 48px; }
  .fan {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    perspective: none;
    padding-bottom: 24px;
    -webkit-overflow-scrolling: touch;
  }
  .fan-item { flex: 0 0 72%; margin: 0; scroll-snap-align: center; transform: none; }
  .fan-item:hover { transform: none; }
  .capsule-links { display: none; }
}

@media (max-width: 640px) {
  :root { --section-gap: 72px; --hero-overlap: 150px; }
  .topbar { top: 12px; }
  .capsule { gap: 10px; height: 48px; padding: 0 6px 0 8px; }
  .brand span:last-child { display: none; }
  .sky { min-height: 100dvh; padding: 116px 0 200px; }
  .sky h1 { font-size: 31px; }
  .sky-lede { font-size: 15px; }
  .sky-actions { flex-direction: column; align-items: center; }
  .device { padding: 6px; border-radius: 18px; }
  .device .screen { border-radius: 12px; }
  .graph-compact-actions { width: min(320px, 62vw); }
  /* En mobile el cielo es angosto: las estrellas se desvanecen detrás del titular. */
  .graph-home {
    opacity: 0.58;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 18%, #000 46%);
    mask-image: linear-gradient(to bottom, transparent 0, transparent 18%, #000 46%);
  }
  .hero-foot { padding-top: 0; }
  .entry { flex-direction: column; gap: 14px; }
  .entry-actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .entry h2 { font-size: 28px; }
  h3 { font-size: 24px; }
  .stack { grid-template-columns: 1fr; }
  .list li { grid-template-columns: auto 1fr; }
  .list li > a, .list li > .badge { grid-column: 2; justify-self: start; }
  /* Tres botones de reporte en un marco de 270px: controles más compactos. */
  .gallery-controls { left: 10px; bottom: 10px; }
  .gallery-controls button { padding: 0 10px; font-size: 12px; }
  .report-dialog { width: 100vw; height: 100dvh; margin: 0; border-radius: 0; }
  .report-dialog-header { padding: 14px 14px 10px 18px; }
  .report-dialog-header h2 { font-size: 22px; }
  /* En un celular vertical la página entera mide 320px y no se lee: se muestra a 760px
     y se recorre con scroll horizontal, empezando por la izquierda. */
  .report-dialog-body { padding: 0 12px 12px; place-items: start; }
  .report-dialog-body img { width: 760px; max-width: none; max-height: none; }
  .fleet-stack { padding: 8px 10px; }
  .memo { padding: 30px 24px 28px; transform: rotate(-0.8deg); }
  .memo-foot { flex-direction: column; align-items: flex-start; }
  .flow-topbar { flex-direction: column; align-items: flex-start; }
  .n8n-embed { --n8n-workflow-min-height: 440px; min-height: 440px; }
  .foot-row { flex-direction: column; }
  .foot-links { text-align: left; justify-items: start; }
  .graph-dialog { width: 100vw; height: 100dvh; margin: 0; border-radius: 0; }
  .knowledge-graph[data-mode="expanded"] .graph-expanded-controls { flex-direction: column; align-items: stretch; }
  .graph-search input { width: 100%; }
  .graph-filters { overflow-x: auto; }
}
