/* Aula Viva · bloque 2 · Fundamentos de PROFINET */

/* ---------- rueda de PROFINET ---------- */
.b2-wheel { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 18px 28px; align-items: center; }
.b2-wsvg { width: 100%; height: auto; display: block; max-width: 340px; margin-inline: auto; }
.b2-seg { cursor: pointer; outline: none; }
.b2-seg path { stroke: var(--surface); stroke-width: 3; transition: opacity .15s; }
.b2-seg:hover path { opacity: .85; }
.b2-seg:focus-visible path { stroke: var(--fg); stroke-width: 4; }
.b2-seg.sel path { stroke: var(--fg); stroke-width: 4; }
.b2-hub { fill: var(--navy); }
.b2-winfo { border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px 16px; min-height: 96px; font-size: 17px; }
@media (max-width: 720px) { .b2-wheel { grid-template-columns: minmax(0, 1fr); } }

/* ---------- red con nombres PROFINET / PROFIBUS ---------- */
.b2-net { --b2-bus: #2FA84F; --b2-busfg: #fff; }
.b2-net[data-mode="dp"] { --b2-bus: #7B4FA8; }
.b2-net-h { margin-bottom: 10px; display: flex; justify-content: center; }
/* Copia de .seg: core.js reasigna el onclick de todo `.seg button` de la pantalla, así que el conmutador lleva clase propia */
.b2-tg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 99px; overflow: hidden; background: var(--surface); }
.b2-tg button { border: 0; background: transparent; padding: 5px 14px; font-size: 14px; font-weight: 600; color: var(--fg); cursor: pointer; }
.b2-tg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.b2-tg button:focus-visible { outline: 3px solid var(--c2); outline-offset: -3px; }
.b2-busname { text-align: center; font: 700 14px var(--display); color: var(--b2-busfg); background: var(--b2-bus); border-radius: 8px 8px 0 0; padding: 4px 10px; letter-spacing: .01em; }
.b2-net .b2-dp { display: none; }
.b2-net[data-mode="dp"] .b2-dp { display: inline; }
.b2-net[data-mode="dp"] .b2-pn { display: none; }
.b2-nodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; align-items: end; border: 1.5px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; background: var(--surface); }
.b2-node { --rc: var(--surface2); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 8px 12px; position: relative; min-width: 0; }
.b2-node::before { content: ""; position: absolute; top: 0; left: 50%; width: 6px; height: 20px; margin-left: -3px; background: var(--b2-bus); }
.b2-node[data-role="ctrl"] { --rc: var(--c3); } .b2-node[data-role="sup"] { --rc: var(--c2); } .b2-node[data-role="dev"] { --rc: var(--c4); } .b2-node[data-role="hmi"] { --rc: var(--c5); }
.b2-dv { max-width: 100%; margin-top: 20px; }
.b2-lbl { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; font-size: 14px; color: var(--muted); }
.b2-lbl b { background: var(--rc); color: var(--navy); border-radius: 8px; padding: 1px 10px; font: 700 15px var(--display); }
.b2-cap { padding: 10px 14px; border-top: 1px dashed var(--line); font-size: 15.5px; color: var(--muted); text-align: center; }
.b2-cap b { color: var(--fg); }
.b2-net .b2-cap .b2-dp { display: none; } .b2-net[data-mode="dp"] .b2-cap .b2-dp { display: inline; } .b2-net[data-mode="dp"] .b2-cap .b2-pn { display: none; }

/* ---------- figuras SVG propias ---------- */
svg.b2-cr, svg.b2-lt { color: var(--fg); }
svg.b2-lt { max-width: 760px; margin-inline: auto; }

/* ---------- laboratorio de funciones IO ---------- */
.b2-roles { display: flex; flex-wrap: wrap; gap: 8px; }
.b2-role { border: 2px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 16px; font-weight: 700; }
.b2-role:hover { border-color: var(--accent); }
.b2-role[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.b2-rdesc { margin: 10px 0; min-height: 3.2em; color: var(--muted); max-width: 72ch; }
.b2-rdesc b { color: var(--fg); }
.b2-stage { position: relative; width: 100%; aspect-ratio: 100 / 68; border: 1.5px dashed var(--line); border-radius: 14px; background: var(--surface2); }
.b2-cab { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.b2-w { fill: none; stroke: #14532b; stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.b2-cab .b2-w { filter: none; }
.b2-flows { display: none; }
.b2-ok .b2-flows { display: block; }
.b2-fc, .b2-fa { fill: none; stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 7 9; animation: b2dash 1s linear infinite; }
.b2-fc { stroke: var(--c3); } .b2-fa { stroke: var(--c2); animation-direction: reverse; }
@keyframes b2dash { to { stroke-dashoffset: -32; } }
.b2-nd { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: 4px 4px 5px; min-width: 0; text-align: center; }
.b2-nd:hover { border-color: var(--accent); }
.b2-nd[data-r="ctrl"] { border-color: var(--c3); box-shadow: 0 0 0 3px var(--c3); }
.b2-nd[data-r="sup"] { border-color: var(--c2); box-shadow: 0 0 0 3px var(--c2); }
.b2-nd[data-r="dev"] { border-color: var(--c4); box-shadow: 0 0 0 3px var(--c4); }
.b2-nd.good { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-a); }
.b2-nd.wrong { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-a); }
.b2-ndv { display: block; width: 100%; }
.b2-ndn { font-size: clamp(10px, 1.7vw, 14px); font-weight: 700; line-height: 1.1; }
.b2-badge { font-size: clamp(9px, 1.5vw, 13px); font-weight: 700; border-radius: 6px; padding: 0 6px; background: var(--surface2); min-height: 1.2em; line-height: 1.25; max-width: 100%; }
.b2-nd[data-r="ctrl"] .b2-badge { background: var(--c3); color: var(--navy); }
.b2-nd[data-r="sup"] .b2-badge { background: var(--c2); color: var(--navy); }
.b2-nd[data-r="dev"] .b2-badge { background: var(--c4); color: var(--navy); }
.b2-nd.wrong .b2-badge::after { content: " ✗"; }
.b2-nd.good .b2-badge::after { content: " ✓"; }
.b2-why { margin: 8px 0 0; padding-left: 1.2em; color: var(--bad); }
.b2-why li { margin-bottom: 4px; }
.b2-flowtxt { display: grid; gap: 8px; margin-top: 10px; }
.b2-flowtxt > div { display: flex; gap: 10px; align-items: flex-start; background: var(--surface2); border-radius: 10px; padding: 8px 12px; }
.b2-k { flex: none; width: 26px; height: 6px; border-radius: 3px; margin-top: 10px; }
.b2-k.c { background: var(--c3); } .b2-k.a { background: var(--c2); } .b2-k.s { background: var(--muted); }
@media (max-width: 520px) { .b2-nd { padding: 2px; border-radius: 8px; } }

/* ---------- tarjetas de resultado de la pantalla ---------- */
.b2-steps { counter-reset: s; }

/* Cinco tarjetas: 3 arriba y 2 abajo */
.b2-five { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.b2-five .cd { grid-column: span 2; }
.b2-five .cd:nth-child(n+4) { grid-column: span 3; }
@media (max-width: 1000px) { .b2-five { grid-template-columns: repeat(2, minmax(0, 1fr)); } .b2-five .cd, .b2-five .cd:nth-child(n+4) { grid-column: auto; } .b2-five .cd:last-child { grid-column: 1 / -1; } }
@media (max-width: 560px) { .b2-five { grid-template-columns: minmax(0, 1fr); } .b2-five .cd:last-child { grid-column: auto; } }

/* Tablas que se apilan en pantallas angostas */
@media (max-width: 560px) {
  .b2-rt, .b2-rt tbody, .b2-rt tr, .b2-rt td { display: block; width: 100%; }
  .b2-rt thead { position: absolute; left: -9999px; }
  .b2-rt tr { padding: 10px 14px; border-top: 1.5px solid var(--line); }
  .b2-rt tr:first-child { border-top: 0; }
  .b2-rt td { border: 0; padding: 3px 0; }
  .b2-rt td::before { content: attr(data-l); display: block; font: 700 11.5px var(--mono); text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
  .b2-rt td:first-child::before { display: none; }
  .b2-rt td:first-child { font-size: 16.5px; padding-bottom: 5px; }
}
@media (max-width: 560px) { .b2-c2 td::before { display: none; } }

/* Carriles de 2.6 */
.b2-lanes { display: grid; gap: 10px; color: #0E1E3F; }
.b2-lanes p { margin: 4px 0 0; text-align: center; font-size: 14.5px; color: var(--fg); }
.b2-lane { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; padding: 12px 18px; border-radius: 10px; }
.b2-lt1 { flex: 1 1 250px; min-width: 0; }
.b2-lt1 b { display: block; font-size: 19px; line-height: 1.25; }
.b2-lt1 span { display: block; font-size: 15.5px; }
.b2-lt2 { flex: 1 1 280px; min-width: 0; }
.b2-lt2 em { display: block; font-style: normal; font-weight: 700; font-size: 14.5px; text-align: right; margin-bottom: 6px; }
.b2-lt2 i { display: block; height: 18px; border-radius: 3px; opacity: .8;
  background: linear-gradient(90deg, #0E1E3F 0, #0E1E3F var(--w), transparent var(--w)) 0 0 / calc(var(--w) + var(--g)) 100% round no-repeat; background-repeat: round; }
@media (max-width: 560px) { .b2-lt2 em { text-align: left; } .b2-lt1, .b2-lt2 { flex-basis: 100%; } }
