/* Portada, escena animada del PLC y diagrama escalera. */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(2rem, 4vw, 4rem);
  padding: clamp(2.5rem, 5vw, 4.5rem) var(--gutter);
  background:
    radial-gradient(60% 70% at 78% 45%, rgb(54 231 110 / 0.13), transparent 70%),
    linear-gradient(rgb(54 231 110 / 0.07) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, rgb(54 231 110 / 0.07) 1px, transparent 1px) 0 0 / 32px 100%;
}

.hero-copy { display: grid; gap: 1.6rem; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 48ch; }
.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.meta { color: var(--muted); font-size: 0.95rem; }

.scene { margin: 0; min-width: 0; }
.scene svg { width: 100%; height: auto; max-height: calc(100vh - 9rem); margin-inline: auto; }

.scene figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.belt { fill: var(--metal); }
.belt-stripe { fill: var(--line); }
.roller { fill: var(--black); stroke: var(--line); stroke-width: 3; }
.metal { fill: var(--metal); stroke: var(--line); stroke-width: 2; }
.rail { fill: var(--line); }
.board { fill: var(--green-deep); stroke: var(--green-dim); stroke-width: 2; }
.chip { fill: var(--black); stroke: var(--green-dim); }
.traces { stroke: var(--green-dim); stroke-width: 3; fill: none; }
.port { fill: var(--black); stroke: var(--green-dim); }
.vents path, .terminals path { stroke: var(--line); stroke-width: 4; fill: none; }

.lamp { fill: #25302a; transition: fill 120ms; }
.lamp.is-on { fill: var(--green); filter: drop-shadow(0 0 6px var(--green)); }
.lamp.is-warn { fill: var(--amber); filter: drop-shadow(0 0 6px var(--amber)); }

.beam { stroke: var(--green-dim); stroke-width: 2; stroke-dasharray: 4 5; }
.beam.is-hit { stroke: var(--green); stroke-width: 4; stroke-dasharray: none; }

.wire, .cable, .wireless { fill: none; stroke-linejoin: round; }
.wire { stroke: var(--green-dim); stroke-width: 2.5; }
.cable { stroke: var(--line); stroke-width: 7; }
.wireless { stroke: var(--green-dim); stroke-width: 3; stroke-dasharray: 3 11; stroke-linecap: round; }
.wireless.is-down { stroke: var(--amber); opacity: 0.45; }

.label { fill: var(--text); font: 600 21px var(--font-display); }
.silk { fill: var(--muted); font: 13px var(--font-code); }
.silk.on-board { fill: var(--text); }
.cut { fill: var(--amber); font: 600 19px var(--font-display); }
.readout { fill: var(--black); stroke: var(--line); }
.readout-text { fill: var(--green); font: 600 24px var(--font-code); }

.part { fill: #c8d3cd; stroke: var(--black); stroke-width: 2; }
.part.is-bad { fill: var(--amber); }

.packet { fill: var(--green); filter: drop-shadow(0 0 8px var(--green)); }

.screen-frame { fill: var(--metal); stroke: var(--line); stroke-width: 2; }
.screen { fill: #05100a; }
.screen-title { fill: var(--green); font: 600 18px var(--font-display); }
.screen-dim { fill: var(--muted); font: 13px var(--font-code); }
.screen-rule, .stand { stroke: var(--line); stroke-width: 2; }
.stand { stroke-width: 7; }
.screen-cell { fill: var(--text); font: 15px var(--font-code); }
.screen-row.is-new .screen-cell { fill: var(--green); font-weight: 700; }

/* Banco de prueba */

.bench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}

.ladder-panel, .log-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  padding: clamp(1rem, 2.5vw, 2rem);
  background: var(--panel);
  border-radius: 14px;
}

.ladder-panel svg { width: 100%; height: auto; margin-block: auto; }
.rung-rail { stroke: var(--green); stroke-width: 5; }
.seg, .contact { stroke: var(--line); stroke-width: 4; fill: none; }
.contact { stroke: var(--muted); }
.seg.is-live, .contact.is-live { stroke: var(--green); filter: drop-shadow(0 0 4px var(--green)); }
.contact.is-open { stroke: var(--amber); }
.coil { fill: var(--black); stroke: var(--line); stroke-width: 2; }
.coil.is-live { fill: var(--green-deep); stroke: var(--green); }
.ladder-panel text { fill: var(--text); font: 600 17px var(--font-display); }
.ladder-panel text.addr { fill: var(--muted); font: 14px var(--font-code); }
.ladder-panel text.value { fill: var(--green); font: 700 16px var(--font-code); }

.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }

.status {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--green-deep);
  color: var(--text);
  min-height: 4.2rem;
}

.status.is-warn { background: #33230a; color: var(--amber); }

.log-panel table { width: 100%; border-collapse: collapse; font: 0.9rem var(--font-code); }
.log-panel caption { text-align: left; font: 600 1.15rem var(--font-display); padding-bottom: 0.6rem; }
.log-panel th, .log-panel td { height: 2.5rem; padding: 0.3rem; text-align: right; border-bottom: 1px solid var(--metal); }
.log-panel th { color: var(--muted); font-weight: 400; }
.log-panel th:nth-child(-n+3), .log-panel td:nth-child(-n+3) { text-align: left; }
.log-panel .table-box { min-height: 19.5rem; }
.log-panel tr.is-new td { color: var(--green); animation: arrive 700ms var(--ease); }
.hint { color: var(--muted); font-size: 0.9rem; margin-top: auto; }

@keyframes arrive {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 960px) {
  .hero, .bench { grid-template-columns: minmax(0, 1fr); }
  .scene svg { max-height: none; }
}

@media (max-width: 440px) {
  .controls { grid-template-columns: minmax(0, 1fr); }
  .log-panel table { font-size: 0.78rem; }
}
