/* ==========================================================================
   DSS · Estilos del sitio
   Estética de sala de control y plano técnico: fondo de rejilla, colores
   reservados para estados (verde marcha, rojo alarma, azul proceso) y ámbar
   como color de marca y de señal.
   ========================================================================== */

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans Condensed';
  src: url('/fonts/ibm-plex-sans-condensed-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans Condensed';
  src: url('/fonts/ibm-plex-sans-condensed-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #0b0e12;
  --bg-2: #0e1217;
  --panel: #11161c;
  --panel-2: #161c23;
  --line: #20272f;
  --line-2: #2d3640;
  --ink: #e9edf1;
  --ink-2: #b7c0ca;
  --muted: #808c98;
  --faint: #4b5560;

  /* Azul del logo DSS: del marino al celeste */
  --brand: #2457e6;
  --brand-2: #3a6cf0;
  --brand-deep: #0b1d9c;
  --brand-gradient: linear-gradient(100deg, #1238c4, #2f6ae8 60%, #4d81e1);
  --accent: #7fb2f8;
  --accent-2: #a9cbfa;
  --accent-ink: #06122e;
  --accent-soft: rgba(127, 178, 248, 0.1);
  /* Ámbar industrial: señales, alimentación y datos en tránsito */
  --amber: #ffb020;
  --amber-2: #ffc75a;
  --run: #3ddc84;
  --run-soft: rgba(61, 220, 132, 0.14);
  --alarm: #ff5a52;
  --alarm-soft: rgba(255, 90, 82, 0.14);
  --flow: #58c6f0;
  --liquid: #17465c;
  --pipe: #3b4754;
  --signal: #56616e;

  --font-sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-cond: 'IBM Plex Sans Condensed', 'Arial Narrow', 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', 'SF Mono', Menlo, Consolas, monospace;

  --container: 1200px;
  --gutter: 24px;
  --header-h: 64px;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.017) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.017) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-cond);
  font-weight: 700;
  line-height: 0.98;
  text-transform: uppercase;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

svg {
  display: block;
}

button {
  font: inherit;
}

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

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 12px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.live-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--run);
  box-shadow: 0 0 0 4px var(--run-soft);
  animation: blink 1.6s ease-in-out infinite;
}

/* Marcas de esquina, como en un plano */
.frame {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-2);
}
.frame::before {
  content: '';
  position: absolute;
  inset: -6px;
  pointer-events: none;
  --m: var(--accent);
  background:
    linear-gradient(var(--m), var(--m)) top left / 14px 2px no-repeat,
    linear-gradient(var(--m), var(--m)) top left / 2px 14px no-repeat,
    linear-gradient(var(--m), var(--m)) top right / 14px 2px no-repeat,
    linear-gradient(var(--m), var(--m)) top right / 2px 14px no-repeat,
    linear-gradient(var(--m), var(--m)) bottom left / 14px 2px no-repeat,
    linear-gradient(var(--m), var(--m)) bottom left / 2px 14px no-repeat,
    linear-gradient(var(--m), var(--m)) bottom right / 14px 2px no-repeat,
    linear-gradient(var(--m), var(--m)) bottom right / 2px 14px no-repeat;
}

@keyframes blink {
  50% {
    opacity: 0.35;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 12.5px;
}
.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-2);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: progress;
}
.btn-ghost {
  border-color: var(--line-2);
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--ink-2);
}
.btn-icon {
  flex: none;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ---------- Cabecera ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 14, 18, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.brand-logo {
  display: block;
  width: auto;
  height: 40px;
}
.brand-name {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 5px 12px;
  border: 1px solid rgba(61, 220, 132, 0.35);
  border-radius: 999px;
  color: var(--run);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}
.live-chip[hidden] {
  display: none;
}
.live-chip .live-dot {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 26px;
}
.live-chip[hidden] + .nav {
  margin-left: auto;
}
.nav a:not(.btn) {
  font-size: 15px;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.15s;
}
.nav a:not(.btn):hover {
  color: var(--ink);
}

.lang {
  display: flex;
  flex: none;
  border: 1px solid var(--line-2);
  border-radius: 2px;
}
.lang a {
  padding: 5px 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.lang a + a {
  border-left: 1px solid var(--line-2);
}
.lang a:hover {
  color: var(--ink);
}
.lang a[aria-current] {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block;
  width: 22px;
  height: 2px;
  margin: 0 auto;
  background: currentColor;
  transition: transform 0.2s;
}
.nav-toggle-bar {
  position: relative;
}
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: '';
  position: absolute;
  left: 0;
}
.nav-toggle-bar::before {
  top: -7px;
}
.nav-toggle-bar::after {
  top: 7px;
}
.nav-toggle[aria-expanded='true'] .nav-toggle-bar {
  background: transparent;
}
.nav-toggle[aria-expanded='true'] .nav-toggle-bar::before {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded='true'] .nav-toggle-bar::after {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Hero ---------- */

.hero {
  padding: 64px 0 104px;
}

.hero-grid {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.hero-side {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 56px;
}
.hero-side .lead {
  max-width: 640px;
}
.hero-side .hero-actions {
  margin-top: 0;
}

.hero h1 {
  margin-top: 18px;
  font-size: clamp(3.1rem, 7vw, 6.4rem);
  line-height: 0.9;
  letter-spacing: -0.005em;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, #3f74e6, #9bc5f6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead {
  font-size: 18px;
  color: var(--ink-2);
}
.lead strong {
  font-weight: 500;
  color: var(--ink);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

/* ---------- Planta en vivo ---------- */

.planta {
  margin-top: 56px;
}

.planta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.planta-title {
  color: var(--ink);
  font-weight: 500;
}
.planta-conn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.planta-conn::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.planta-conn[data-modo='online']::before {
  background: var(--run);
  animation: blink 1s steps(2) infinite;
}
.planta-conn[data-modo='local']::before {
  background: var(--amber);
}
.planta-conn[data-modo='reconectando']::before {
  background: var(--alarm);
}
.planta-viewers {
  margin-left: auto;
  color: var(--muted);
}

.planta-body {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
}
.planta-pid {
  padding: 18px 16px 10px;
  border-right: 1px solid var(--line-2);
}
.pid {
  width: 100%;
  height: auto;
}

/* P&ID */
.pid text {
  font-family: var(--font-mono);
}
.pid .tag {
  font-size: 10px;
  letter-spacing: 0.04em;
  fill: var(--muted);
}
.pid .tag-state {
  font-size: 10px;
  letter-spacing: 0.06em;
  fill: var(--muted);
}
.planta.is-running .pid .tag-state {
  fill: var(--run);
}
.planta[data-fallo='temperatura'] .pid .tag-state {
  fill: var(--alarm);
}
.pid .sheet {
  font-size: 9px;
  letter-spacing: 0.1em;
  fill: var(--faint);
}

.pid .pipe path {
  fill: none;
  stroke: var(--pipe);
  stroke-width: 4;
  stroke-linejoin: round;
}
.pid .flow path {
  fill: none;
  stroke: var(--flow);
  stroke-width: 2;
  stroke-dasharray: 4 10;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.4s;
}
.planta.is-running .pid .flow-main path,
.planta.xv-open .pid .flow-in path {
  opacity: 0.95;
  animation: pid-flow 0.7s linear infinite;
}
@keyframes pid-flow {
  to {
    stroke-dashoffset: -14;
  }
}

.pid .sig path {
  fill: none;
  stroke: var(--signal);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.pid .sig-flow path {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.6;
  stroke-dasharray: 2 22;
  stroke-linecap: round;
  animation: pid-sig 1.6s linear infinite;
}
@keyframes pid-sig {
  to {
    stroke-dashoffset: -24;
  }
}
.pid .junctions circle {
  fill: var(--signal);
}

.pid .plc-box {
  fill: var(--panel-2);
  stroke: var(--ink-2);
  stroke-width: 1.2;
}
.pid .plc-name {
  font-size: 13px;
  font-weight: 500;
  fill: var(--ink);
}
.pid .plc-sub {
  font-size: 8.5px;
  letter-spacing: 0.06em;
  fill: var(--muted);
}
.pid .led {
  fill: #29313a;
}
.planta.is-running .pid .led-run {
  fill: var(--run);
}
.planta.has-alarm .pid .led-err {
  fill: var(--alarm);
  animation: blink 0.8s steps(2) infinite;
}
.planta.is-online .pid .led-com,
.planta.is-local .pid .led-com {
  fill: var(--amber);
  animation: blink 0.5s steps(2) infinite;
}
.pid .api-out {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.6;
}
.pid .api-arrow {
  fill: var(--amber);
}

.pid .valve-body,
.pid .valve-act {
  fill: var(--panel);
  stroke: var(--ink-2);
  stroke-width: 1.4;
  stroke-linejoin: round;
  transition: fill 0.3s, stroke 0.3s;
}
.pid .valve-stem {
  stroke: var(--ink-2);
  stroke-width: 1.4;
}
.planta.xv-open .pid .valve-body {
  fill: var(--run);
  stroke: var(--run);
}

.pid .tank-shell {
  fill: var(--bg-2);
  stroke: var(--ink-2);
  stroke-width: 1.5;
}
.pid .liquid {
  fill: var(--liquid);
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scaleY(0.5);
  transition: transform 1s linear;
}
.pid .surface {
  fill: var(--flow);
  transform: translateY(100px);
  transition: transform 1s linear;
}
.pid .tank-val {
  font-size: 15px;
  font-weight: 500;
  fill: var(--ink);
  text-anchor: middle;
}

.pid .proc-thin {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.2;
}
.pid .orifice {
  stroke: var(--ink-2);
  stroke-width: 2;
}

.pid .inst circle {
  fill: var(--panel);
  stroke: var(--ink-2);
  stroke-width: 1.3;
}
.pid .inst text {
  text-anchor: middle;
}
.pid .inst-a {
  font-size: 11px;
  font-weight: 500;
  fill: var(--ink);
}
.pid .inst-n {
  font-size: 10px;
  fill: var(--ink-2);
}
.planta.is-hot .pid [data-inst='tt103'] circle {
  stroke: var(--alarm);
  fill: var(--alarm-soft);
  animation: blink 0.8s steps(2) infinite;
}

.pid .readout rect {
  fill: var(--bg);
  stroke: var(--line-2);
}
.pid .readout text {
  font-size: 11px;
  fill: var(--flow);
  text-anchor: middle;
}
.planta.is-hot .pid .readout-tt rect {
  stroke: var(--alarm);
}
.planta.is-hot .pid .readout-tt text {
  fill: var(--alarm);
}

.pid .pump-body {
  fill: var(--panel);
  stroke: var(--ink-2);
  stroke-width: 1.5;
  transition: stroke 0.3s;
}
.pid .pump-base {
  fill: var(--line-2);
}
.pid .impeller {
  transform-box: view-box;
  transform-origin: 300px 330px;
}
.pid .impeller path {
  stroke: var(--ink-2);
  stroke-width: 2;
  stroke-linecap: round;
}
.planta.is-running .pid .pump-body,
.planta.is-running .pid .impeller path {
  stroke: var(--run);
}
.planta.is-running .pid .impeller {
  animation: spin 0.8s linear infinite;
}
.planta[data-fallo='temperatura'] .pid .pump-body {
  stroke: var(--alarm);
}

.pid .hx-body {
  fill: var(--panel);
  stroke: var(--ink-2);
  stroke-width: 1.5;
}
.pid .hx-coil {
  fill: none;
  stroke: var(--flow);
  stroke-width: 1.5;
}
.pid .hx-util {
  stroke: var(--signal);
  stroke-width: 1.5;
}
.planta[data-fallo='temperatura'] .pid .hx-body,
.planta.is-hot .pid .hx-body {
  stroke: var(--alarm);
}
.planta.is-hot .pid .hx-util {
  stroke: var(--alarm);
  stroke-dasharray: 2 3;
}

.pid .filler-body {
  fill: var(--panel-2);
  stroke: var(--ink-2);
}
.pid .nozzle {
  fill: var(--ink-2);
}
.pid .bottles use {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1;
}
.pid .bottles-fill use {
  fill: var(--flow);
  stroke: none;
  opacity: 0.85;
}
.pid .bottles {
  animation: belt 0.6s linear infinite;
  animation-play-state: paused;
}
.planta.is-running .pid .bottles {
  animation-play-state: running;
}
@keyframes belt {
  to {
    transform: translateX(36px);
  }
}
.pid .belt {
  fill: var(--panel-2);
  stroke: var(--ink-2);
}
.pid .roller {
  fill: var(--ink-2);
}
.pid .fallen {
  opacity: 0;
  transition: opacity 0.2s;
}
.pid .fallen use {
  fill: var(--alarm-soft);
  stroke: var(--alarm);
  stroke-width: 1.2;
}
.planta[data-fallo='atasco'] .pid .fallen {
  opacity: 1;
}
.planta[data-fallo='atasco'] .pid .belt {
  stroke: var(--alarm);
  animation: blink 0.8s steps(2) infinite;
}

/* Vista web (portal) */
.planta-web {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
}
.dots {
  display: flex;
  gap: 5px;
}
.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-2);
}
.url {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.url svg {
  flex: none;
  width: 11px;
  height: 11px;
  fill: var(--run);
  stroke: var(--run);
  stroke-width: 1.2;
}

.dash {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  padding: 18px;
}
.dash-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.dash-kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.dash-title {
  margin-top: 2px;
  font-size: 17px;
  font-weight: 600;
}

.state-chip {
  flex: none;
  padding: 4px 9px;
  border: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.state-chip.is-run {
  border-color: rgba(61, 220, 132, 0.4);
  background: var(--run-soft);
  color: var(--run);
}
.state-chip.is-alarm {
  border-color: rgba(255, 90, 82, 0.5);
  background: var(--alarm-soft);
  color: var(--alarm);
  animation: blink 0.8s steps(2) infinite;
}

.kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line-2);
  border: 1px solid var(--line-2);
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--bg-2);
}
.kpi-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi-value {
  font-family: var(--font-cond);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi-value small {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.planta.is-hot .kpi:nth-child(4) .kpi-value {
  color: var(--alarm);
}

.trend-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.trend-head > span:last-child {
  color: var(--flow);
}
.spark {
  width: 100%;
  height: 56px;
  margin-top: 6px;
}
.spark-grid {
  stroke: var(--line);
  vector-effect: non-scaling-stroke;
}
.spark-line {
  fill: none;
  stroke: var(--flow);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}
.spark-area {
  fill: rgba(88, 198, 240, 0.1);
}

.alarms {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 12px;
}
.alarm-none {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.alarm-none::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--run);
}
.alarm-row {
  color: var(--alarm);
}
.alarm-row strong {
  font-weight: 500;
}
.alarm-meta {
  margin-top: 2px;
  color: var(--ink-2);
}
.planta.has-alarm .alarms {
  border-color: rgba(255, 90, 82, 0.5);
  background: var(--alarm-soft);
}

.toast {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50px;
  z-index: 2;
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: #1b222a;
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--alarm);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}
.toast[hidden] {
  display: none;
}
.toast.is-in {
  animation: toast-in 0.35s ease-out;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
}
.toast svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  fill: none;
  stroke: var(--alarm);
  stroke-width: 1.6;
}
.toast-app {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.toast-text {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.4;
}

/* Mandos */
.planta-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line-2);
}
.ctl {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--panel-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, opacity 0.15s;
}
.ctl:hover:not(:disabled) {
  border-color: var(--ink-2);
}
.ctl:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.ctl-ico {
  width: 10px;
  height: 10px;
  background: var(--alarm);
}
.ctl.is-start .ctl-ico {
  width: 0;
  height: 0;
  background: none;
  border-left: 10px solid var(--run);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}
.ctl-fallo {
  border-color: rgba(255, 90, 82, 0.45);
  color: #ffb1ac;
}
.ctl-fallo:hover:not(:disabled) {
  border-color: var(--alarm);
  background: var(--alarm-soft);
}
.planta-feedback {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--run);
}
.planta-feedback.is-error {
  color: var(--alarm);
}
.planta-note {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

/* Bus de datos */
.planta-bus {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line-2);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.bus-label {
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.5;
}
.bus-label span {
  display: block;
  font-weight: 400;
  color: var(--muted);
}
.bus-log {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: calc(6 * 1.65em);
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  line-height: 1.65;
}
.bus-log li {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink-2);
  animation: bus-in 1.2s ease-out;
}
@keyframes bus-in {
  from {
    background: rgba(255, 176, 32, 0.14);
  }
}
.bus-log .t {
  color: var(--faint);
}
.bus-log .topic {
  color: var(--flow);
}
.bus-log .ev-alarma {
  color: var(--alarm);
}
.bus-log .ev-aviso,
.bus-log .ev-operador {
  color: var(--amber);
}
.bus-log .ev-normal {
  color: var(--run);
}
.bus-log .ev .topic {
  color: inherit;
  opacity: 0.7;
}

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

.section {
  padding: 112px 0;
}
.section-band {
  background: linear-gradient(180deg, rgba(14, 18, 23, 0.92), rgba(14, 18, 23, 0.92));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.sheet-label {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 40px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.sheet-label > span:first-child {
  color: var(--accent);
}
.sheet-label i {
  flex: 1;
  height: 1px;
  background: var(--line-2);
}

.section-head {
  max-width: 760px;
  margin-bottom: 56px;
}
.section-head h2 {
  font-size: clamp(2.4rem, 4.4vw, 4rem);
  line-height: 0.95;
}
/* En secciones a dos columnas el titular tiene menos ancho. */
.api-grid h2,
.metodo-head h2 {
  font-size: clamp(2.2rem, 3.4vw, 3.1rem);
}
/* Mantiene la "s" minúscula de "APIs" dentro de titulares en mayúsculas. */
.lc {
  text-transform: none;
}
.section-intro {
  margin-top: 20px;
  font-size: 18px;
  color: var(--ink-2);
}

/* ---------- Servicios ---------- */

.services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line-2);
  background: var(--panel);
}
.service {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}
.service + .service {
  border-left: 1px solid var(--line-2);
}
.service-visual {
  display: grid;
  place-items: center;
  height: 180px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
  background: var(--bg-2);
}
.service-body {
  display: flex;
  flex-direction: column;
  padding: 26px 26px 24px;
}
.service-tag {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.isa {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1.3px solid var(--ink-2);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.service h3 {
  margin-top: 20px;
  font-size: 26px;
}
.service-body > p:not(.service-tag):not(.service-stack) {
  margin-top: 12px;
  color: var(--ink-2);
}
.service-list {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.service-list li {
  position: relative;
  padding-left: 22px;
  font-size: 15.5px;
}
.service-list li + li {
  margin-top: 8px;
}
.service-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 10px;
  height: 2px;
  background: var(--accent);
}
.service-stack {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px dashed var(--line-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.service-list + .service-stack {
  margin-top: 24px;
}

/* Ladder animado */
.ladder {
  width: 100%;
  max-width: 330px;
  height: auto;
}
.ladder text {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  fill: var(--muted);
  text-anchor: middle;
}
.ladder .rail {
  stroke: var(--amber);
  stroke-width: 2.5;
}
.ladder .rail-r {
  stroke: var(--line-2);
}
.ladder .w {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 2;
}
.ladder .w-pow {
  stroke: var(--amber);
}
.ladder .ct {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 2.5;
}
.ladder .w-a,
.ladder .c-marcha {
  animation: lad-a 8s infinite;
}
.ladder .w-b,
.ladder .c-seal,
.ladder .coil {
  animation: lad-b 8s infinite;
}
.ladder .c-paro {
  animation: lad-paro 8s infinite;
}
.ladder .st {
  font-size: 10.5px;
  fill: var(--ink-2);
  opacity: 0;
}
.ladder .st0 { animation: lad-st0 8s infinite; }
.ladder .st1 { animation: lad-st1 8s infinite; }
.ladder .st2 { animation: lad-st2 8s infinite; }
.ladder .st3 { animation: lad-st3 8s infinite; }

@keyframes lad-a {
  0%, 18% { stroke: var(--line-2); }
  19%, 38% { stroke: var(--run); }
  39%, 100% { stroke: var(--line-2); }
}
@keyframes lad-b {
  0%, 18% { stroke: var(--line-2); }
  19%, 72% { stroke: var(--run); }
  73%, 100% { stroke: var(--line-2); }
}
@keyframes lad-paro {
  0%, 18% { stroke: var(--ink-2); }
  19%, 72% { stroke: var(--run); }
  73%, 88% { stroke: var(--alarm); }
  89%, 100% { stroke: var(--ink-2); }
}
@keyframes lad-st0 {
  0%, 18% { opacity: 1; }
  19%, 88% { opacity: 0; }
  89%, 100% { opacity: 1; }
}
@keyframes lad-st1 {
  0%, 18% { opacity: 0; }
  19%, 38% { opacity: 1; }
  39%, 100% { opacity: 0; }
}
@keyframes lad-st2 {
  0%, 38% { opacity: 0; }
  39%, 72% { opacity: 1; }
  73%, 100% { opacity: 0; }
}
@keyframes lad-st3 {
  0%, 72% { opacity: 0; }
  73%, 88% { opacity: 1; }
  89%, 100% { opacity: 0; }
}

/* Mini terminal API */
.term-mini {
  width: 100%;
  max-width: 330px;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-2);
}
.term-mini .l {
  opacity: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-mini .l1 { animation: tm1 7s infinite; }
.term-mini .l2 { animation: tm2 7s infinite; }
.term-mini .l3 { animation: tm3 7s infinite; }
.term-mini .l4 { animation: tm4 7s infinite; }
.term-mini .m-post {
  color: var(--amber);
}
.term-mini .ok {
  color: var(--run);
}
.term-mini .c {
  color: var(--flow);
}
@keyframes tm1 { 0%, 3% { opacity: 0; } 5%, 92% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes tm2 { 0%, 16% { opacity: 0; } 18%, 92% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes tm3 { 0%, 38% { opacity: 0; } 40%, 92% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes tm4 { 0%, 58% { opacity: 0; } 60%, 92% { opacity: 1; } 96%, 100% { opacity: 0; } }

/* Mini web + servidor */
.web-stack {
  width: 100%;
  max-width: 300px;
}
.web-mini {
  border: 1px solid var(--line-2);
  background: var(--bg);
}
.wm-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line-2);
}
.wm-bar i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-2);
}
.wm-bar span {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}
.wm-body {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  align-items: end;
  gap: 5px;
  height: 78px;
  padding: 10px 12px;
}
.wm-body i {
  height: 100%;
  background: var(--flow);
  opacity: 0.75;
  transform-origin: bottom;
  animation: bars 2.6s ease-in-out infinite alternate;
}
.wm-body i:nth-child(1) { animation-delay: -0.2s; }
.wm-body i:nth-child(2) { animation-delay: -1.1s; }
.wm-body i:nth-child(3) { animation-delay: -0.6s; }
.wm-body i:nth-child(4) { animation-delay: -1.9s; }
.wm-body i:nth-child(5) { animation-delay: -0.4s; }
.wm-body i:nth-child(6) { animation-delay: -2.3s; }
.wm-body i:nth-child(7) { animation-delay: -1.4s; }
.wm-body i:nth-child(8) { animation-delay: -0.9s; }
.wm-body i:nth-child(9) { animation-delay: -1.7s; }
.wm-body i:nth-child(10) { animation-delay: -0.1s; background: var(--amber); }
@keyframes bars {
  from { transform: scaleY(0.25); }
  to { transform: scaleY(1); }
}
.srv {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}
.srv-leds {
  display: flex;
  gap: 4px;
}
.srv-leds i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--run);
  animation: blink 0.9s steps(2) infinite;
}
.srv-leds i:nth-child(2) { animation-delay: 0.3s; background: var(--amber); }
.srv-leds i:nth-child(3) { animation-duration: 2.2s; }

/* ---------- API en vivo ---------- */

.api-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 56px;
  align-items: start;
}
.api-grid .section-head {
  margin-bottom: 32px;
}
.endpoints {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ep {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 2px 12px;
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.ep:hover {
  border-color: var(--ink-2);
}
.ep.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.ep .m {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--run);
}
.ep .m-post {
  color: var(--amber);
}
.ep-path {
  font-family: var(--font-mono);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}
.ep small {
  grid-column: 2;
  font-size: 13.5px;
  color: var(--muted);
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.terminal-copy {
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  background: none;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  cursor: pointer;
}
.terminal-copy:hover {
  border-color: var(--ink-2);
}
.terminal-body {
  height: 440px;
  margin: 0;
  padding: 18px 20px;
  overflow: auto;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tk-prompt {
  color: var(--run);
}
.tk-cmd {
  color: var(--ink);
}
.tk-status {
  color: var(--accent);
}
.tk-error {
  color: var(--alarm);
}
.j-key {
  color: #8fd3ff;
}
.j-str {
  color: #b5e48c;
}
.j-num {
  color: var(--amber-2);
}
.j-lit {
  color: #ff9e7a;
}
.caret {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  vertical-align: text-bottom;
  background: var(--ink-2);
  animation: blink 1s steps(2) infinite;
}

/* ---------- Método (GRAFCET) ---------- */

.metodo-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 56px;
  align-items: start;
}
.metodo-head {
  position: sticky;
  top: calc(var(--header-h) + 40px);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend i {
  display: block;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--ink-2);
}
.legend .lg-init {
  box-shadow: inset 0 0 0 2px var(--bg), inset 0 0 0 3.5px var(--ink-2);
}
.legend .lg-trans {
  width: 16px;
  height: 3px;
  border: 0;
  background: var(--ink-2);
}
.legend .lg-active {
  border-color: var(--accent);
  background: var(--accent);
}

.grafcet {
  position: relative;
  margin: 0;
  padding: 0 0 0 44px;
  list-style: none;
}
.g-step {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  column-gap: 30px;
}
/* Enlace vertical entre etapas */
.g-step::before {
  content: '';
  position: absolute;
  left: 26px;
  top: 54px;
  bottom: 0;
  width: 2px;
  background: var(--ink-2);
}
.g-box {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 2px solid var(--ink-2);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}
.g-step.is-initial .g-box {
  box-shadow: inset 0 0 0 4px var(--bg), inset 0 0 0 6px var(--ink-2);
}
.g-action {
  position: relative;
  padding: 16px 20px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  transition: border-color 0.3s, background-color 0.3s;
}
.g-action::before {
  content: '';
  position: absolute;
  left: -31px;
  top: 26px;
  width: 30px;
  height: 2px;
  background: var(--ink-2);
}
.g-action h3 {
  font-size: 24px;
}
.g-action p {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 15.5px;
}
.g-trans {
  grid-column: 1 / -1;
  position: relative;
  display: flex;
  align-items: center;
  min-height: 74px;
  padding-left: 84px;
}
.g-trans::after {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  width: 30px;
  height: 3px;
  margin-top: -1.5px;
  background: var(--ink);
}
.g-cond {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.g-cond abbr {
  text-decoration: underline dotted;
  cursor: help;
}
.g-step.is-active .g-box {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.g-step.is-active .g-box::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--accent-ink);
}
.g-step.is-active .g-action {
  border-color: var(--accent);
  background: var(--accent-soft);
}
/* Bucle de retorno a la etapa inicial */
.g-loop {
  position: absolute;
  left: -32px;
  bottom: 0;
  width: 58px;
  height: 2px;
  background: var(--ink-2);
}
.grafcet::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 26px;
  bottom: 0;
  width: 32px;
  border: 2px solid var(--ink-2);
  border-right: 0;
  border-bottom: 0;
}
.grafcet::after {
  content: '';
  position: absolute;
  left: 36px;
  top: 21px;
  border-left: 8px solid var(--ink-2);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

/* ---------- Configurador + contacto ---------- */

.proyecto {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: 56px;
  align-items: start;
}
.cfg-group {
  min-width: 0;
  margin: 0 0 40px;
  padding: 0;
  border: 0;
}
.cfg-group:last-child {
  margin-bottom: 0;
}
.cfg-group legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 0;
  font-family: var(--font-cond);
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
}
.step-n {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  position: relative;
}
.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  font-size: 15px;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.chip span::before {
  content: '';
  flex: none;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--muted);
  transition: background-color 0.15s, border-color 0.15s;
}
.chip span:hover {
  border-color: var(--ink-2);
}
.chip input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.chip input:checked + span::before {
  border-color: var(--accent);
  background: var(--accent);
}
.chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field-full {
  grid-column: 1 / -1;
}
.field label {
  font-size: 14px;
  font-weight: 500;
}
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  transition: border-color 0.15s;
}
.field textarea {
  min-height: 116px;
  resize: vertical;
}
.field input::placeholder,
.field textarea::placeholder {
  color: #66717d;
}
.field input:hover,
.field textarea:hover {
  border-color: #46505b;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(127, 178, 248, 0.2);
}
.field [aria-invalid='true'] {
  border-color: var(--alarm);
}
.field-check {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}
.field-check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  padding: 0;
  accent-color: var(--accent);
}
.field-check label {
  font-weight: 400;
  color: var(--ink-2);
}
.field-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}
.form-status {
  font-size: 15px;
  color: var(--ink-2);
}
.form-status.is-ok {
  color: var(--run);
}
.form-status.is-error {
  color: var(--alarm);
}

.proyecto-right {
  position: sticky;
  top: calc(var(--header-h) + 32px);
}
.cfg-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cfg-bar span:last-child {
  color: var(--accent);
}
.cfg-diagram {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
  min-height: 380px;
  padding: 22px 18px;
}
.cfg-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.cfg-wires path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 6;
  opacity: 0.75;
  animation: pid-sig 1.4s linear infinite;
}
.cfg-col {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.cfg-col-title {
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
}
.cfg-node {
  position: relative;
  padding: 9px 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  animation: node-in 0.35s ease-out;
}
.cfg-node.core {
  border-color: var(--accent);
  background: #0f1a33;
  font-weight: 500;
}
.cfg-node.core small {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
@keyframes node-in {
  from {
    opacity: 0;
  }
}
.cfg-empty {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
.cfg-diagram.is-empty .cfg-empty {
  display: grid;
}
.cfg-diagram.is-empty .cfg-col {
  visibility: hidden;
}
.cfg-summary {
  padding: 12px 16px;
  border-top: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
}

/* ---------- Pie: cajetín ---------- */

.site-footer {
  padding: 72px 0 40px;
}
.cajetin {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-2);
  border-left: 1px solid var(--line-2);
}
.cj {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}
.cj-l {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.cj-v {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
a.cj-v:hover {
  color: var(--accent);
}
.cj-brand {
  grid-row: span 2;
  justify-content: center;
  gap: 12px;
  padding: 20px 22px;
}
.cj-brand .brand-logo {
  height: 52px;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}
.cj-brand p {
  font-size: 13.5px;
  color: var(--muted);
}
.cj-nav {
  grid-column: 1 / -1;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px 26px;
}
.cj-nav a {
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
}
.cj-nav a:hover {
  color: var(--ink);
}

/* ---------- Páginas simples (privacidad, gracias, 404) ---------- */

.page-simple main {
  padding: 96px var(--gutter) 120px;
}
.page-simple .notice {
  max-width: 680px;
}
.notice h1,
.legal h1 {
  margin-top: 14px;
  font-size: clamp(2.4rem, 4vw + 1rem, 4rem);
}
.notice p:not(.eyebrow) {
  margin-top: 18px;
  color: var(--ink-2);
}
.notice .btn,
.legal .btn {
  margin-top: 18px;
}
.page-simple .header-inner {
  justify-content: space-between;
}
.legal {
  max-width: 780px;
}
.legal h2 {
  margin-top: 48px;
  font-size: 26px;
}
.legal p,
.legal ul {
  margin-top: 14px;
  color: var(--ink-2);
}
.legal .placeholder {
  padding: 0 4px;
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  color: var(--accent-2);
}

.legal h3 {
  margin-top: 28px;
  font-size: 19px;
}
.legal a {
  color: var(--accent);
}
.legal .btn {
  color: #fff;
}
.legal-meta {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
}
.legal-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 14.5px;
}
.legal-table th,
.legal-table td {
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  text-align: left;
  vertical-align: top;
}
.legal-table th {
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.legal-table code {
  font-family: var(--font-mono);
  color: var(--ink);
}
.table-wrap {
  overflow-x: auto;
}

/* Pie de las páginas legales */
.legal-footer {
  padding: 32px 0 40px;
  border-top: 1px solid var(--line);
}
.legal-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}
.legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}
.legal-footer a,
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.legal-footer a:hover,
.link-btn:hover {
  color: var(--ink);
}
.legal-footer p {
  font-size: 13.5px;
  color: var(--muted);
}

/* ---------- Información básica de protección de datos (formulario) ---------- */

.form-legal {
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  font-size: 13px;
  line-height: 1.5;
}
.form-legal-title {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.form-legal-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 6px 20px;
  margin: 0;
}
.form-legal-list div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 8px;
}
.form-legal-list dt {
  color: var(--muted);
}
.form-legal-list dd {
  margin: 0;
  color: var(--ink-2);
}
.form-legal a {
  color: var(--accent);
}

/* ---------- Consentimiento de cookies ---------- */

.cookie-banner {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 70;
  width: min(560px, calc(100% - 32px));
  padding: 18px 20px;
  border: 1px solid var(--line-2);
  border-top: 3px solid var(--accent);
  background: var(--panel-2);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  animation: toast-in 0.35s ease-out;
}
.cookie-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.cookie-text {
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.cookie-text a {
  color: var(--accent);
}
.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.cookie-actions .btn {
  min-width: 112px;
}
.cookie-link {
  margin-left: auto;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cookie-link:hover {
  color: var(--ink);
}

.cookie-dialog {
  width: min(560px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--ink);
}
.cookie-dialog::backdrop {
  background: rgba(5, 7, 10, 0.72);
}
.cookie-dialog form {
  padding: 24px;
}
.cookie-dialog h2 {
  font-size: 26px;
}
.ck-intro {
  margin-top: 10px;
  font-size: 14.5px;
  color: var(--ink-2);
}
.ck-cat {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
}
.ck-cat h3 {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  text-transform: none;
}
.ck-cat p {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--muted);
}
.ck-policy {
  display: inline-block;
  margin-top: 18px;
  font-size: 14px;
  color: var(--accent);
}
.ck-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Interruptor accesible: el checkbox real queda encima, invisible */
.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 24px;
  margin-top: 2px;
}
.switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch input:disabled {
  cursor: not-allowed;
}
.switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--bg);
  transition: background-color 0.15s, border-color 0.15s;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background-color 0.15s;
}
.switch input:checked + .switch-track {
  border-color: var(--brand);
  background: var(--brand);
}
.switch input:checked + .switch-track::after {
  transform: translateX(20px);
  background: #fff;
}
.switch input:disabled + .switch-track {
  opacity: 0.6;
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

@media (max-width: 1100px) {
  .planta-body {
    grid-template-columns: 1fr;
  }
  .planta-pid {
    border-right: 0;
    border-bottom: 1px solid var(--line-2);
  }
  .dash {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
  }
  .dash-head {
    grid-column: 1 / -1;
  }
  .kpis {
    grid-row: span 2;
  }
  .services {
    grid-template-columns: 1fr;
  }
  .service + .service {
    border-left: 0;
    border-top: 1px solid var(--line-2);
  }
  .service {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    grid-template-rows: none;
  }
  .service-visual {
    height: auto;
    border-bottom: 0;
    border-right: 1px solid var(--line-2);
  }
  .cajetin {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .cj-brand {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 900px) {
  .api-grid,
  .metodo-grid,
  .proyecto {
    grid-template-columns: 1fr;
  }
  .metodo-head,
  .proyecto-right {
    position: static;
  }
  /* En una columna, el esquema va justo después de las opciones (pasos 1 y 2). */
  .proyecto {
    gap: 0;
  }
  .proyecto-left {
    display: contents;
  }
  .proyecto-right {
    order: 2;
    margin-bottom: 40px;
  }
  .cfg-group:last-child {
    order: 3;
  }
  .planta-note {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 760px) {
  :root {
    --gutter: 16px;
    --header-h: 60px;
  }
  body {
    font-size: 16px;
  }

  .nav-toggle {
    display: block;
  }
  .live-chip[hidden] ~ .lang {
    margin-left: auto;
  }
  .brand-logo {
    height: 32px;
  }
  .live-extra {
    display: none;
  }
  .header-inner {
    gap: 12px;
  }
  .nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line-2);
  }
  .nav.is-open {
    display: flex;
  }
  .nav a:not(.btn) {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    font-size: 16px;
  }
  .nav .btn {
    margin-top: 16px;
    min-height: 48px;
  }

  .hero {
    padding: 44px 0 72px;
  }
  .lead {
    font-size: 16.5px;
  }
  .hero-side .hero-actions {
    width: 100%;
  }
  .hero-actions .btn {
    flex: 1 1 auto;
  }
  .planta {
    margin-top: 40px;
  }
  .planta-pid {
    padding: 12px 8px 6px;
  }
  .planta-viewers {
    margin-left: 0;
  }
  .dash {
    display: flex;
    padding: 14px;
  }
  .kpi-value {
    font-size: 26px;
  }
  .ctl {
    flex: 1 1 auto;
    justify-content: center;
  }
  .planta-bus {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .bus-label span {
    display: inline;
  }
  .bus-label span::before {
    content: '· ';
  }
  .bus-log .t {
    display: none;
  }

  .section {
    padding: 80px 0;
  }
  .sheet-label {
    margin-bottom: 28px;
  }
  .sheet-label > span:last-child {
    display: none;
  }
  .section-head {
    margin-bottom: 40px;
  }
  .section-intro {
    font-size: 16.5px;
  }

  .service {
    grid-template-columns: 1fr;
  }
  .service-visual {
    height: 170px;
    border-right: 0;
    border-bottom: 1px solid var(--line-2);
  }
  .service-body {
    padding: 22px 18px;
  }

  .terminal-body {
    height: 360px;
    padding: 14px;
    font-size: 11.5px;
  }

  .grafcet {
    padding-left: 34px;
  }
  .grafcet::before {
    left: 6px;
    width: 28px;
  }
  .grafcet::after {
    left: 26px;
  }
  .g-loop {
    left: -28px;
    width: 54px;
  }
  .g-step {
    grid-template-columns: 46px minmax(0, 1fr);
    column-gap: 18px;
  }
  .g-box {
    width: 46px;
    height: 46px;
    font-size: 16px;
  }
  .g-step::before {
    left: 22px;
    top: 46px;
  }
  .g-action {
    padding: 14px 16px;
  }
  .g-action::before {
    left: -19px;
    top: 22px;
    width: 18px;
  }
  .g-trans {
    padding-left: 64px;
  }
  .g-trans::after {
    left: 8px;
  }

  .fields {
    grid-template-columns: 1fr;
  }
  .form-actions .btn {
    width: 100%;
  }
  .cfg-diagram {
    grid-template-columns: 1fr;
    gap: 40px;
    min-height: 0;
    padding: 34px 14px 22px;
  }
  .cfg-diagram.is-empty {
    min-height: 200px;
  }
  .cfg-col {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .cfg-col-title {
    top: -24px;
  }
  .cfg-node {
    flex: 1 1 40%;
  }

  .cajetin {
    grid-template-columns: 1fr 1fr;
  }
  .cookie-banner {
    left: 8px;
    bottom: 8px;
    width: calc(100% - 16px);
    padding: 16px;
  }
  .cookie-actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }
  .cookie-link {
    width: 100%;
    margin-left: 0;
    text-align: center;
  }
  .ck-actions .btn {
    flex: 1 1 100%;
  }

  .page-simple main {
    padding: 64px var(--gutter) 88px;
  }
}

@media (max-width: 480px) {
  .live-chip {
    display: none;
  }
  .lang {
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ladder .st0,
  .term-mini .l {
    opacity: 1;
  }
  .ladder .st1,
  .ladder .st2,
  .ladder .st3 {
    display: none;
  }
}
