/* ── INFRAESTRUCTURA (/infrastructure · /es/infraestructura) ───────────────
   La página madre de Plataforma y MCP. Va encima de agents.css (la del MCP):
   mismos tokens, titulares a dos tonos, fondo de líneas de pantalla, entradas
   al hacer scroll, filas de frases y la sección en blanco. Aquí solo lo propio:

   1 · La historia (infra-story.js, con el lienzo de puntos de /mcp): del mapa
       a una casa de Chamberí, el hueco en la tele, el bidder y la puja. Sin
       WebGL o sin JS se lee en orden y el diagrama sale en SVG.
   4 · Las dos puertas (Plataforma y MCP) con su miniatura.
   ──────────────────────────────────────────────────────────────────────── */

/* ════ 1 · LA HISTORIA ════
   Como en /mcp: escenario fijo mientras se hace scroll, el lienzo de puntos
   ocupa todo y el dibujo se encaja en .ivisual (a la derecha en escritorio,
   debajo del titular en móvil). Sin WebGL, sin JS o con la pantalla baja
   (.is-fallback): titulares en orden y el diagrama en SVG. */
.istory { position: relative; }
.istage { position: relative; display: grid; gap: clamp(28px, 4vw, 48px); padding: 120px var(--gutter) 56px; }
.istage::after {
  content: '';
  position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(55% 50% at 72% 45%, rgba(43, 95, 217, 0.18), transparent 70%);
  pointer-events: none;
}
.icanvas, .ivisual, .ilabels { display: none; }
.icopy { display: grid; gap: 40px; max-width: 640px; }
.icap .s-display { font-size: clamp(2rem, 1.2rem + 2.6vw, 3.5rem); }
.icap-hero .s-display { font-size: clamp(2.375rem, 1.1rem + 3.4vw, 4.75rem); line-height: 0.98; }
.icap p { margin-top: 16px; font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem); line-height: 1.55; color: var(--t2); max-width: 40ch; text-wrap: pretty; }
.ifig { margin: 0; display: grid; gap: 8px; justify-items: center; min-height: 0; }
.isvg { width: 100%; max-width: 460px; height: auto; overflow: visible; }
.inote { font-size: 0.75rem; color: var(--t3); }
.ihint { display: none; }
.ilive-note { display: none; }
html.js .istory.is-live:not(.is-fallback) .ilive-note {
  display: block;
  position: absolute; z-index: 4; right: clamp(16px, 3vw, 48px); bottom: 16px;
  font-size: 0.75rem; color: var(--t3);
}

/* Con JS: escenario fijo, un titular cada vez. */
html.js .istory.is-live:not(.is-fallback) { height: calc((var(--end) + 1) * 100svh); }
html.js .istory.is-live:not(.is-fallback) .istage {
  display: block;
  position: sticky; top: 0;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  padding: 0;
  background: var(--night);
}
html.js .istory.is-live:not(.is-fallback) .icanvas {
  display: block;
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease-out;
}
html.js .istory.is-live.is-ready:not(.is-fallback) .icanvas { opacity: 1; }
html.js .istory.is-live:not(.is-fallback) .ivisual { display: block; position: absolute; pointer-events: none; }
html.js .istory.is-live:not(.is-fallback) .ilabels { display: block; position: absolute; inset: 0; z-index: 2; pointer-events: none; }
html.js .istory.is-live:not(.is-fallback) .ifig { display: none; }
html.js .istory.is-live:not(.is-fallback) .icopy { position: absolute; z-index: 3; display: grid; gap: 0; }
html.js .istory.is-live:not(.is-fallback) .icap {
  grid-area: 1 / 1;
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.7s var(--ease-out);
  pointer-events: none;
}
html.js .istory.is-live:not(.is-fallback) .icap.is-on { opacity: 1; transform: none; pointer-events: auto; }
html.js .istory.is-live:not(.is-fallback) .ihint {
  display: flex; align-items: center; gap: 12px;
  position: absolute; z-index: 5;
  font-size: 0.9375rem; font-weight: 600; line-height: 1; color: #fff;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.6s var(--ease-out);
  pointer-events: none;
}
html.js .istory.is-live.is-start:not(.is-fallback) .ihint, html.js .istory.is-live.is-idle:not(.is-fallback) .ihint { opacity: 1; transform: none; }

/* Escritorio: titular a la izquierda, dibujo a la derecha. */
@media (min-width: 1024px) {
  .istage { grid-template-columns: minmax(0, 5fr) minmax(0, 5fr); align-items: center; column-gap: clamp(40px, 6vw, 112px); }
  html.js .istory.is-live:not(.is-fallback) .icopy { left: clamp(24px, 5vw, 96px); width: min(36vw, 560px); top: 50%; translate: 0 -50%; }
  html.js .istory.is-live:not(.is-fallback) .ivisual { left: calc(clamp(24px, 5vw, 96px) + min(36vw, 560px) + clamp(24px, 3vw, 56px)); right: clamp(16px, 3vw, 48px); top: 92px; bottom: 40px; }
  html.js .istory.is-live:not(.is-fallback) .ihint { left: clamp(24px, 5vw, 96px); bottom: clamp(32px, 6svh, 56px); }
}
/* Móvil y tableta: titular arriba y dibujo debajo. */
@media (max-width: 1023px) {
  html.js .istory.is-live:not(.is-fallback) .icopy { left: var(--gutter); right: var(--gutter); top: 84px; }
  html.js .istory.is-live:not(.is-fallback) .icap .s-display { font-size: clamp(1.625rem, 1.1rem + 2.4vw, 2.5rem); }
  html.js .istory.is-live:not(.is-fallback) .icap-hero .s-display { font-size: clamp(2rem, 1.2rem + 3.6vw, 3.25rem); }
  html.js .istory.is-live:not(.is-fallback) .icap p { font-size: 0.9375rem; margin-top: 8px; }
  html.js .istory.is-live:not(.is-fallback) .ivisual { left: 10px; right: 10px; top: 36svh; bottom: 72px; }
  html.js .istory.is-live:not(.is-fallback) .ihint { left: 50%; bottom: 18px; translate: -50% 0; }
  html.js .istory.is-live:not(.is-fallback) .ilive-note { left: var(--gutter); right: var(--gutter); bottom: 70px; text-align: center; }
}

/* ── Rótulos sobre el lienzo (infra-story.js los coloca; .lbl viene de agents.css) ── */
.lbl-home { color: var(--ice); }
.lbl-home::before { box-shadow: 0 0 0 1.5px var(--ice), 0 0 12px 2px rgba(168, 228, 255, 0.5); }
/* Lo que pide la tele: una píldora bajo el suelo de la casa. */
.ilbl-attrs {
  translate: -50% -50%;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(168, 228, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(168, 228, 255, 0.28);
  font-family: var(--mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.01em; color: var(--ice);
}
.ilbl-slot { translate: -50% -50%; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(168, 228, 255, 0.6); }
.ilbl-bid { translate: -50% -50%; font-size: 0.8125rem; font-weight: 600; color: #fff; }
.ilbl-chip {
  translate: -50% -50%;
  padding: 8px 16px; border-radius: 999px;
  background: #fff; color: var(--ink);
  font-size: 0.8125rem; font-weight: 600;
}
.ilbl-name { translate: 0 -50%; font-size: calc(0.75rem * var(--ls, 1)); font-weight: 500; color: var(--t1); transition: color 0.4s ease; }
.ilbl-name.is-you { color: var(--ice); }
.ilbl-name.is-out { color: var(--t3); text-decoration: line-through; text-decoration-color: #ffb4a8; }
.ilbl-why { translate: -100% -50%; font-size: calc(0.75rem * var(--ls, 1)); color: #ffb4a8; }
.ilbl-why.is-you { color: var(--ice); }
@media (min-width: 1280px) {
  .ilbl-name, .ilbl-why { font-size: calc(0.8125rem * var(--ls, 1)); }
}

/* ── El diagrama ── */
.isvg text { font-family: var(--text); font-size: 13px; fill: var(--t2); }
.isvg line { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1.5; }
.tv-frame { fill: rgba(255, 255, 255, 0.04); stroke: rgba(255, 255, 255, 0.45); stroke-width: 2; }
.isvg .tv-stand { stroke: rgba(255, 255, 255, 0.45); stroke-width: 3; stroke-linecap: round; }
.slot { fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 1.5; stroke-dasharray: 6 5; }
.isvg .slot-t { fill: var(--t3); }
.ad rect { fill: var(--blue); }
.isvg .ad text { fill: #fff; font-family: var(--display); font-size: 22px; }
.isvg .attrs { fill: var(--ice); font-family: var(--mono); font-size: 12px; }
.isvg .wire { stroke: var(--ice); stroke-dasharray: 3 4; }
.pkt { fill: var(--ice); }
.bidder rect { fill: rgba(255, 255, 255, 0.04); stroke: rgba(255, 255, 255, 0.3); stroke-width: 1.5; transition: fill 0.6s ease, stroke 0.6s ease; }
.isvg .b-t { font-family: var(--display); font-size: 17px; fill: #fff; }
.isvg .b-s { font-size: 11.5px; fill: var(--t3); }
.isvg .fan line { stroke: rgba(168, 228, 255, 0.4); }
.row-box, .row-name, .bar { transition: opacity 0.5s ease; }
.row-box { fill: rgba(255, 255, 255, 0.05); stroke: rgba(255, 255, 255, 0.1); }
.row-you .row-box { fill: rgba(43, 95, 217, 0.18); stroke: var(--ice); stroke-width: 1.5; }
.isvg .row-name { fill: var(--t1); font-weight: 600; }
.isvg .row-you .row-name { fill: var(--ice); }
.isvg .row-why { font-size: 12px; fill: #ffb4a8; }
.isvg .row-you .row-why { fill: var(--ice); font-weight: 600; }
.bar { fill: rgba(255, 255, 255, 0.35); }
.bar-you { fill: var(--ice); }
.isvg .strike { stroke: #ffb4a8; stroke-width: 1.5; stroke-dasharray: 140; stroke-dashoffset: 140; transition: stroke-dashoffset 0.6s var(--ease-out); }
.chip rect { fill: #fff; }
.isvg .chip text { fill: var(--ink); font-weight: 600; font-size: 13px; }

/* La tele del respaldo: los mismos pesos de trazo que en el lienzo de puntos. */
.isvg .h-main, .isvg .h-mid, .isvg .h-fine { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.isvg .h-main { stroke: rgba(196, 216, 255, 0.9); stroke-width: 2; }
.isvg .h-mid { stroke: rgba(160, 190, 255, 0.55); stroke-width: 1.6; }
.isvg .h-fine { stroke: rgba(130, 160, 255, 0.34); stroke-width: 1.3; }
.isvg .ad rect { fill: #3a62d4; }
.isvg .ad text { font-size: 24px; }
.isvg .tv-halo { opacity: 0.55; }
.isvg .attrs-pill rect { fill: rgba(168, 228, 255, 0.07); stroke: rgba(168, 228, 255, 0.3); stroke-width: 1; }
.isvg .pin { stroke: rgba(168, 228, 255, 0.5); stroke-width: 1.5; stroke-linecap: round; }
.isvg .bidder .b-in { fill: none; stroke: rgba(168, 228, 255, 0.32); stroke-width: 1; }
.isvg .sdot { fill: rgba(168, 228, 255, 0.5); }
.isvg .row-you .sdot { fill: var(--ice); }
.isvg .track { fill: rgba(255, 255, 255, 0.1); }
.isvg .node { fill: var(--ice); }
.isvg .node-h { fill: rgba(168, 228, 255, 0.18); }
.isvg .row[data-out] .sdot { opacity: 0.4; }

/* El SVG es el respaldo: se ve terminado, sin escenas. */
.pkt { display: none; }
.isvg .ad text { fill: #fff; }
.row[data-out] :is(.row-box, .row-name, .bar) { opacity: 0.38; }
.row[data-out] .strike { stroke-dashoffset: 0; }
.bidder rect { fill: rgba(43, 95, 217, 0.22); stroke: var(--ice); }

/* ════ 4 · DOS FORMAS DE USARLA ════
   Sección en blanco (.start de agents.css). Dos tarjetas arriba, Plataforma
   («con clics») y MCP («con palabras»), y debajo la base que las une: la
   infraestructura. Una línea baja de cada tarjeta a la base. */
.stack { display: grid; gap: 0; }
.doors { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(20px, 2.4vw, 32px); }
.door {
  position: relative;
  display: grid; align-content: start; gap: 12px; min-width: 0;
  padding: clamp(22px, 2.4vw, 32px);
  border-radius: var(--r-lg);
  background: var(--soft);
  box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.05);
}
/* La línea que baja a la base. */
.door::after {
  content: '';
  position: absolute; left: 50%; top: 100%;
  width: 2px; height: clamp(20px, 2.4vw, 32px);
  background: repeating-linear-gradient(to bottom, var(--blue) 0 4px, transparent 4px 8px);
  translate: -50% 0;
}
.door-tag {
  justify-self: start;
  padding: 6px 12px; border-radius: 999px;
  background: #fff; box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.08);
  font-size: 0.8125rem; font-weight: 600; color: var(--blue);
}
.door h3 { font-family: var(--display); font-weight: 500; font-size: clamp(1.75rem, 1.3rem + 1.2vw, 2.5rem); line-height: 1.05; color: var(--t1); }
.door p { font-size: 1.0625rem; line-height: 1.55; color: var(--t2); max-width: 42ch; }
.door-link { justify-self: start; margin-top: 4px; font-weight: 600; color: var(--blue); text-decoration: none; }
.door-link::after { content: ' →'; }
@media (hover: hover) { .door-link:hover { text-decoration: underline; text-underline-offset: 4px; } }
.door-shot {
  display: grid; place-items: center;
  min-height: 200px; padding: 20px;
  border-radius: var(--r-md);
  background: radial-gradient(90% 80% at 50% 30%, #ffffff 0%, #eef1f6 75%);
  box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.05);
}
/* Miniatura de la plataforma: una ventana del panel. */
.win {
  width: min(100%, 320px);
  border-radius: 12px; overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.08), 0 20px 40px -24px rgba(10, 20, 40, 0.45);
  font-size: 0.8125rem; color: var(--t1);
}
.win-bar { display: flex; gap: 5px; padding: 9px 12px; background: #f3f5f8; border-bottom: 1px solid rgba(10, 10, 10, 0.06); }
.win-bar i { width: 8px; height: 8px; border-radius: 50%; background: #d5dae2; }
.win-body { display: grid; gap: 8px; padding: 14px; }
.win-title { font-weight: 600; margin-bottom: 2px; }
.win-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.08); color: var(--t2); }
.win-row i { width: 14px; height: 14px; flex-shrink: 0; border-radius: 4px; box-shadow: inset 0 0 0 1.5px #b8c0cc; }
.win-row.is-on { color: var(--t1); box-shadow: inset 0 0 0 1.5px var(--blue); }
.win-row.is-on i { background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3.5 7.2 6 9.6l4.5-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; box-shadow: none; }
.win-btn { justify-self: end; margin-top: 4px; padding: 7px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; }
/* Miniatura del MCP: un chat como el de /mcp. */
.chatmini {
  display: grid; gap: 10px;
  width: min(100%, 320px);
  padding: 16px;
  border-radius: 14px;
  background: #1f1f21;
  box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.06), 0 20px 40px -24px rgba(10, 20, 40, 0.55);
  font-size: 0.8125rem; line-height: 1.45;
}
.cm-me { justify-self: end; max-width: 85%; padding: 8px 12px; border-radius: 14px; background: #3a3a3d; color: #fff; }
.cm-ai { justify-self: start; max-width: 92%; color: #dcdcdc; }
.cm-yes { justify-self: start; padding: 6px 14px; border-radius: 999px; background: #fff; color: #000; font-weight: 600; }
/* La base: la infraestructura, de la que salen las dos. */
.stack-base {
  display: grid; justify-items: center; gap: 14px;
  margin-top: clamp(20px, 2.4vw, 32px);
  padding: clamp(22px, 2.6vw, 34px);
  border-radius: var(--r-lg);
  background: var(--night); color: #fff;
  text-align: center;
}
.stack-base b { font-family: var(--display); font-weight: 500; font-size: clamp(1.375rem, 1.1rem + 0.9vw, 2rem); line-height: 1.1; }
.stack-base ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.stack-base li { padding: 7px 14px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(168, 228, 255, 0.35); color: var(--ice, #a8e4ff); font-size: 0.875rem; }
@media (max-width: 899px) {
  /* Una debajo de otra: solo la segunda baja a la base. */
  .door:first-child::after { display: none; }
}
@media (min-width: 900px) {
  .doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html.js .istory.is-live:not(.is-fallback) .icap, html.js .istory.is-live .icanvas { transition: none; }
}
