/* Cupula — sistema visual "consola de seguridad": navy-slate tecnico, acento
   ciano tipo fosforo de terminal, cabeceras en monoespaciada a gran escala
   (la misma identidad del panel operativo, llevada a tratamiento editorial). */

:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #e4e9ed;
  --line: #c9d2da;
  --ink: #121a22;
  --ink-dim: #55636f;
  --accent: #0e9488;
  --accent-ink: #ffffff;
  --good: #1b8f57;
  --good-bg: #dff3e7;
  --warn: #a6690a;
  --warn-bg: #fbebd2;
  --critical: #c4453f;
  --critical-bg: #fbe3e1;

  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f14;
    --surface: #111820;
    --surface-2: #16202a;
    --line: #26333f;
    --ink: #e7edf3;
    --ink-dim: #93a3b4;
    --accent: #2fd9c4;
    --accent-ink: #05201c;
    --good: #4fbe7e;
    --good-bg: #12261b;
    --warn: #e0a030;
    --warn-bg: #2b2312;
    --critical: #e2665f;
    --critical-bg: #2a1614;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f14;
  --surface: #111820;
  --surface-2: #16202a;
  --line: #26333f;
  --ink: #e7edf3;
  --ink-dim: #93a3b4;
  --accent: #2fd9c4;
  --accent-ink: #05201c;
  --good: #4fbe7e;
  --good-bg: #12261b;
  --warn: #e0a030;
  --warn-bg: #2b2312;
  --critical: #e2665f;
  --critical-bg: #2a1614;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); line-height: 1.6; font-size: 16px;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px; background-attachment: fixed; background-position: -1px -1px;
}

a { color: var(--accent); }
a.link { text-decoration: none; border-bottom: 1px solid currentColor; }
a.link:hover { opacity: 0.8; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 28px; }
.prose { max-width: 68ch; }

code, .mono { font-family: var(--mono); }
code { background: var(--surface-2); border-radius: 2px; padding: 1px 6px; font-size: 0.88em; }
pre {
  font-family: var(--mono); font-size: 13px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 2px; padding: 16px 18px;
  overflow-x: auto; line-height: 1.6;
}
pre code { background: none; padding: 0; }

.eyebrow {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 10px;
}

/* ---- header ---- */
header.site {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
header.site .bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { width: 24px; height: 24px; color: var(--accent); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--mono); font-weight: 700; font-size: 16px; letter-spacing: 0.02em; }
.brand-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--ink-dim); text-transform: uppercase; }

nav.primary { display: flex; gap: 4px; flex-wrap: wrap; }
nav.primary a { font-family: var(--mono); font-size: 13px; text-decoration: none; color: var(--ink-dim); padding: 8px 12px; border-radius: 2px; }
nav.primary a:hover, nav.primary a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }

/* ---- hero ---- */
.hero { border-bottom: 1px solid var(--line); padding: 88px 0 76px; }
.hero .prompt {
  font-family: var(--mono); font-size: 12.5px; color: var(--accent);
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px;
  border: 1px solid var(--line); border-radius: 2px; padding: 5px 10px; background: var(--surface);
}
.hero .prompt .cursor { width: 7px; height: 14px; background: var(--accent); display: inline-block; }
.hero h1 {
  font-family: var(--mono); font-weight: 700; letter-spacing: -0.01em;
  font-size: clamp(2rem, 4.4vw, 3.4rem); line-height: 1.16; margin: 0; text-wrap: balance;
}
.hero h1 .dim { color: var(--ink-dim); }
.hero p.lede { font-size: 1.1rem; color: var(--ink-dim); max-width: 60ch; margin-top: 22px; }
.hero .ctas { display: flex; gap: 14px; margin-top: 32px; flex-wrap: wrap; }
.btn {
  font-family: var(--mono); font-size: 13.5px; font-weight: 600; text-decoration: none;
  padding: 12px 20px; border-radius: 2px; display: inline-block; border: 1px solid transparent;
  background: transparent; cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { opacity: 0.9; }
.btn.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.secondary:hover { background: var(--surface-2); }

.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 30px; }
.pill { font-family: var(--mono); font-size: 10.5px; padding: 4px 8px; border-radius: 3px; border: 1px solid transparent; }
.pill.good { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.neutral { background: var(--surface-2); color: var(--ink-dim); border-color: var(--line); }

/* ---- sections ---- */
main section { padding: 68px 0; border-bottom: 1px solid var(--line); }
main section:last-of-type { border-bottom: none; }
.section-head { max-width: 62ch; margin-bottom: 40px; }
.section-head h2 { font-family: var(--mono); font-size: 1.7rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.section-head p { color: var(--ink-dim); margin-top: 12px; font-size: 15.5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.grid-2 > div, .grid-3 > div { background: var(--surface); padding: 30px 28px; }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card-kind { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.card-title { font-family: var(--mono); font-weight: 700; font-size: 1.15rem; margin: 10px 0 12px; }
.card-desc { color: var(--ink-dim); font-size: 14.5px; margin-bottom: 14px; }
.card-meta { font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim); display: flex; flex-direction: column; gap: 4px; }
.card-meta b { color: var(--ink); font-weight: 600; }

/* ---- fact sheet ---- */
.fact-sheet { border: 1px solid var(--line); background: var(--surface); }
.fact-row { display: grid; grid-template-columns: 240px 1fr; gap: 20px; padding: 14px 24px; border-bottom: 1px solid var(--line); font-size: 14.5px; align-items: baseline; }
.fact-row:last-child { border-bottom: none; }
.fact-row dt { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--ink-dim); text-transform: uppercase; }
.fact-row dd { margin: 0; font-family: var(--mono); word-break: break-word; }
@media (max-width: 640px) { .fact-row { grid-template-columns: 1fr; gap: 4px; } }

/* ---- diagram ---- */
figure.diagram { margin: 0; background: var(--surface); border: 1px solid var(--line); padding: 16px 20px 8px; }
figure.diagram svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
figure.diagram figcaption { font-size: 12.5px; color: var(--ink-dim); padding: 12px 4px 4px; border-top: 1px solid var(--line); margin-top: 10px; }
svg text { font-family: var(--mono); fill: currentColor; }
.dg-shell { color: var(--ink); }
.dg-box { fill: var(--surface-2); stroke: var(--ink-dim); stroke-width: 1.2; }
.dg-box-accent { fill: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); stroke: var(--accent); stroke-width: 1.6; }
.dg-box-good { fill: color-mix(in srgb, var(--good) 14%, var(--surface-2)); stroke: var(--good); stroke-width: 1.6; }
.dg-title { font-size: 12.5px; font-weight: 700; fill: var(--ink); }
.dg-sub { font-size: 10px; fill: var(--ink-dim); }
.dg-zone { fill: none; stroke: var(--line); stroke-width: 1.2; stroke-dasharray: 4 4; }
.dg-zone-label { font-size: 10px; letter-spacing: 0.04em; fill: var(--accent); }
.dg-arrow { fill: none; stroke: var(--ink-dim); stroke-width: 1.3; }
.dg-arrow-label { font-size: 10px; fill: var(--ink-dim); }
.dg-chip-text { font-size: 10.5px; }
.chip-critical { fill: var(--critical-bg); stroke: var(--critical); }
.chip-critical text { fill: var(--critical); }
.chip-warn { fill: var(--warn-bg); stroke: var(--warn); }
.chip-warn text { fill: var(--warn); }
.chip-neutral { fill: var(--surface-2); stroke: var(--line); }
.chip-neutral text { fill: var(--ink-dim); }

table.simple { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.simple th, table.simple td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.simple th { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-dim); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.table-wrap table.simple { border: none; }
.table-wrap th:first-child, .table-wrap td:first-child { padding-left: 20px; }

.step-block { padding: 26px 0; border-bottom: 1px solid var(--line); }
.step-block:last-child { border-bottom: none; }
.step-block h3 { font-family: var(--mono); font-weight: 700; margin: 0 0 6px; }
.step-block p.who { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 14px; }

ul.checklist { list-style: none; margin: 0; padding: 0; }
ul.checklist li { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13.8px; }
ul.checklist li:last-child { border-bottom: none; }
ul.checklist .status { flex: none; width: 18px; height: 18px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-family: var(--mono); margin-top: 1px; }
.status.good { background: var(--good-bg); color: var(--good); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
ul.checklist .txt code { font-size: 12px; }
ul.checklist .txt small { display: block; color: var(--ink-dim); margin-top: 2px; font-size: 12px; }

footer.site { padding: 48px 0 60px; }
footer.site .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 36px; }
@media (max-width: 720px) { footer.site .cols { grid-template-columns: 1fr; } }
footer.site h4 { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 14px; }
footer.site ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
footer.site .legal { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-dim); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---- demo interactivo ---- */
.demo-panel {
  background: var(--surface); border: 1px solid var(--line); padding: 24px 26px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; margin-bottom: 24px;
}
@media (max-width: 720px) { .demo-panel { grid-template-columns: 1fr; } }
.demo-field { display: flex; flex-direction: column; gap: 8px; }
.demo-field label {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink); display: flex;
  align-items: center; justify-content: space-between; gap: 10px;
}
.demo-field .val { color: var(--accent); font-weight: 700; }
.demo-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.demo-toggle { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12.5px; }
.demo-toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
.demo-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.demo-note {
  grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-dim); background: var(--surface-2);
  border: 1px solid var(--line); padding: 10px 14px; border-radius: 2px;
}

.demo-narration {
  font-family: var(--mono); padding: 16px 20px; border: 1px solid var(--line);
  border-left: 3px solid var(--accent); background: var(--surface);
  margin-bottom: 18px; display: flex; flex-direction: column; gap: 4px;
  min-height: 58px; justify-content: center;
  transition: border-left-color 0.2s ease;
}
.demo-narration.is-reject { border-left-color: var(--critical); }
.demo-narration.is-failclosed { border-left-color: var(--warn); }
.demo-narration.is-pass { border-left-color: var(--good); }
.demo-narration-step { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.demo-narration-sub { font-size: 12.5px; color: var(--ink-dim); }

.demo-result {
  font-family: var(--mono); font-size: 14px; padding: 14px 18px; border: 1px solid var(--line);
  margin-bottom: 18px; display: none; align-items: center; gap: 10px;
}
.demo-result.show { display: flex; }
.demo-result.pass { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.demo-result.reject { border-color: var(--critical); background: var(--critical-bg); color: var(--critical); }
.demo-result.failclosed { border-color: var(--warn); background: var(--warn-bg); color: var(--warn); }

/* estados que la demo aplica sobre las cajas/chips del diagrama existente */
.dg-box.step-active, .dg-box-good.step-active { stroke: var(--accent); stroke-width: 2.2; }
.dg-box.step-pass { stroke: var(--good); }
.dg-box.step-dim, .dg-box-good.step-dim { opacity: 0.35; }
.chip-critical.chip-fired, .chip-warn.chip-fired { stroke-width: 2.4; }
.chip-dim { opacity: 0.28; }

/* ---- iconos del diagrama ---- */
.dg-icon { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--ink-dim); }
.dg-icon.on-accent { color: var(--seal-ink, var(--accent-ink)); }
.dg-icon .ic-cut { fill: var(--surface); stroke: none; }
.dg-icon.ic-check { color: var(--good); }
.dg-icon.ic-active { color: var(--accent); }

@keyframes dg-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.16); }
}
@keyframes dg-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
@keyframes dg-flash {
  0%, 100% { stroke-width: 1.2; }
  50% { stroke-width: 3.4; }
}
.icon-pulse { transform-box: fill-box; transform-origin: center; animation: dg-pulse 0.7s ease-in-out infinite; }
.chip-fired-group { transform-box: fill-box; transform-origin: center; animation: dg-shake 0.5s ease-in-out; }
.dg-box.step-active { animation: dg-flash 0.9s ease-in-out infinite; }

@keyframes dg-bounce-in {
  0%   { transform: scale(0.9); }
  45%  { transform: scale(1.07); }
  70%  { transform: scale(0.98); }
  100% { transform: scale(1); }
}
.step-bounce { transform-box: fill-box; transform-origin: center; animation: dg-bounce-in 0.6s cubic-bezier(.34,1.56,.64,1) both; }

@keyframes dg-pop-in {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.outcome-badge {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; flex: none; animation: dg-pop-in 0.55s cubic-bezier(.34,1.56,.64,1) both;
}
.outcome-badge svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.outcome-badge.pass { background: var(--good-bg); color: var(--good); }
.outcome-badge.reject { background: var(--critical-bg); color: var(--critical); }
.outcome-badge.failclosed { background: var(--warn-bg); color: var(--warn); }

@media (prefers-reduced-motion: reduce) {
  .icon-pulse, .chip-fired-group, .dg-box.step-active, .step-bounce, .outcome-badge { animation: none !important; }
}

/* ---- indicador de progreso, pensado para publico no tecnico ---- */
.progress-row { display: flex; align-items: center; gap: 6px; margin-bottom: 18px; }
.progress-dot {
  width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-family: var(--mono);
  font-size: 12px; color: var(--ink-dim); background: var(--surface); flex: none;
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}
.progress-dot.current { border-color: var(--accent); color: var(--accent); transform: scale(1.18); }
.progress-dot.done { border-color: var(--good); color: var(--good); background: var(--good-bg); }
.progress-dot.failed { border-color: var(--critical); color: var(--critical); background: var(--critical-bg); }
.progress-line { flex: 1; height: 2px; background: var(--line); border-radius: 1px; transition: background 0.25s ease; }
.progress-line.done { background: var(--good); }

/* paquete de respuesta viajando de vuelta al cliente */
.packet-dot { fill: var(--accent); opacity: 0; }
.packet-dot.show { opacity: 1; }
.packet-dot.reject { fill: var(--critical); }
.packet-dot.failclosed { fill: var(--warn); }
.packet-dot.pass { fill: var(--good); }
