:root {
  --bg: #070b14;
  --bg-2: #0d1424;
  --card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8edf7;
  --muted: #8b97ad;
  --yellow: #ffd60a;
  --orange: #ff8f1f;
  --cyan: #2de2ff;
  --glow: 0 0 18px rgba(255, 214, 10, 0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: radial-gradient(ellipse at top, #111a30 0%, var(--bg) 60%);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

#sparks {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

main, .nav, .footer { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }

/* ===== NAV ===== */
.nav {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 5vw, 64px);
  background: rgba(7, 11, 20, 0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.logo b { color: var(--yellow); }
.logo-bolt { display: inline-block; animation: zap 3s infinite; }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { color: var(--muted); transition: color .2s; }
.nav-links a:hover { color: var(--yellow); }
.nav-links a.btn { color: #111; }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.6rem; cursor: pointer; }

/* ===== BOTONES ===== */
.btn {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  color: #111;
  box-shadow: var(--glow);
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 32px rgba(255, 214, 10, .8); }
.btn-small { padding: 8px 18px; font-size: .9rem; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn-ghost:hover { border-color: var(--yellow); color: var(--yellow); box-shadow: none; }

/* ===== HERO ===== */
.hero {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 40px;
  padding: 40px clamp(16px, 5vw, 64px);
  max-width: 1300px;
  margin: 0 auto;
}
.tag {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--cyan);
  font-size: .9rem;
  margin-bottom: 18px;
}
h1 { font-size: clamp(3rem, 8vw, 6rem); line-height: 1; letter-spacing: -2px; margin-bottom: 22px; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 520px; margin-bottom: 30px; }
.lead b { color: var(--text); }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 40px; }

.gradient-text {
  background: linear-gradient(90deg, var(--yellow), var(--orange), var(--cyan), var(--yellow));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 6s linear infinite;
}

.flicker { animation: flicker 5s infinite; }

.stats { display: flex; gap: 32px; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column; }
.stats strong { font-size: 2rem; color: var(--yellow); text-shadow: var(--glow); }
.stats div > span { color: var(--muted); font-size: .9rem; }

/* ===== GLOBO ===== */
.globe-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
#globe { width: 100%; max-width: 560px; cursor: grab; position: relative; z-index: 1; overflow: visible; }
#globe:active { cursor: grabbing; }
.globe-glow {
  position: absolute;
  top: 50%; left: 50%;
  width: 80%; aspect-ratio: 1;
  transform: translate(-50%, -58%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 226, 255, .25), transparent 65%);
  filter: blur(30px);
  animation: pulse 4s ease-in-out infinite;
}
.sphere { fill: #0b1830; stroke: rgba(45, 226, 255, .35); stroke-width: 1.2; }
.graticule { fill: none; stroke: rgba(45, 226, 255, .08); stroke-width: .6; }
.land { fill: #1b2a45; stroke: #0b1830; stroke-width: .4; transition: fill .6s; }
.land.latam { fill: #2a3d60; }
.land.lit { fill: var(--yellow); filter: drop-shadow(0 0 6px rgba(255, 214, 10, .9)); }
.land.active { fill: #fff3a0; }
.arc {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px var(--cyan));
}
.ping { fill: none; stroke: var(--yellow); stroke-width: 2; }

.country-label {
  margin-top: -10px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(255, 214, 10, .1);
  border: 1px solid rgba(255, 214, 10, .4);
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: var(--glow);
  z-index: 2;
  transition: transform .3s;
}
.country-label.pop { animation: pop .5s ease; }
.flag { font-size: 1.5rem; display: flex; }
.flag img { width: 30px; height: 20px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .2); }
.globe-hint { color: var(--muted); font-size: .8rem; margin-top: 10px; }

/* ===== DIVISOR CIRCUITO ===== */
.circuit-divider svg { width: 100%; height: 60px; display: block; }
.circuit-divider path {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 2;
  stroke-dasharray: 40 1400;
  filter: drop-shadow(0 0 6px var(--yellow));
  animation: current 4s linear infinite;
}

/* ===== SECCIONES ===== */
.section { padding: 100px clamp(16px, 5vw, 64px); max-width: 1200px; margin: 0 auto; }
.section-title { font-size: clamp(2.2rem, 5vw, 3.4rem); text-align: center; line-height: 1.1; margin-bottom: 12px; }
.section-title.left { text-align: left; }
.section-sub { text-align: center; color: var(--muted); font-size: 1.1rem; max-width: 620px; margin: 0 auto 60px; }

/* Timeline */
.timeline { position: relative; max-width: 760px; margin: 0 auto; }
.timeline::before {
  content: "";
  position: absolute;
  left: 27px; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(var(--yellow), var(--cyan));
  box-shadow: var(--glow);
  border-radius: 3px;
}
.t-item { display: flex; gap: 24px; margin-bottom: 36px; position: relative; }
.t-dot {
  flex: 0 0 56px; height: 56px;
  display: grid; place-items: center;
  font-size: 1.5rem;
  border-radius: 50%;
  background: var(--bg-2);
  border: 2px solid var(--yellow);
  box-shadow: var(--glow);
  z-index: 1;
}
.t-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 26px;
  transition: transform .3s, border-color .3s;
}
.t-card:hover { transform: translateX(6px); border-color: rgba(255, 214, 10, .5); }
.t-card h3 { color: var(--yellow); margin-bottom: 6px; }
.t-card p { color: var(--muted); }
.t-card b { color: var(--text); }

/* Niveles */
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.level-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  transition: transform .3s, box-shadow .3s, border-color .3s;
  position: relative;
  overflow: hidden;
}
.level-card::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 0%), rgba(255, 214, 10, .15), transparent 50%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.level-card:hover { transform: translateY(-8px); border-color: rgba(255, 214, 10, .5); box-shadow: 0 20px 40px rgba(0, 0, 0, .4); }
.level-card:hover::after { opacity: 1; }
.level-num { font-family: "JetBrains Mono", monospace; color: var(--cyan); font-size: .9rem; margin-bottom: 6px; }
.level-card h3 { font-size: 1.4rem; margin-bottom: 10px; }
.level-card p { color: var(--muted); font-size: .95rem; margin-bottom: 22px; }
.battery {
  position: relative;
  height: 18px;
  border: 2px solid var(--muted);
  border-radius: 5px;
  padding: 2px;
}
.battery::after {
  content: "";
  position: absolute;
  right: -7px; top: 3px;
  width: 4px; height: 8px;
  background: var(--muted);
  border-radius: 0 2px 2px 0;
}
.battery-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--yellow), var(--orange));
  box-shadow: var(--glow);
  transition: width 1.6s cubic-bezier(.2, .8, .2, 1) .3s;
}
.level-card.visible .battery-fill { width: var(--lvl); }

/* Módulos */
.modules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px; }
.module {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  transition: transform .3s, border-color .3s, box-shadow .3s;
}
.module:hover { transform: translateY(-8px); border-color: rgba(255, 214, 10, .5); box-shadow: 0 20px 50px rgba(0, 0, 0, .45); }
.module-art {
  height: 150px;
  display: grid;
  place-items: center;
  position: relative;
  background:
    linear-gradient(rgba(45, 226, 255, .06) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, rgba(45, 226, 255, .06) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(135deg, #0d1a33, #0a1020);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.module-art svg { width: auto; height: 120px; max-width: 90%; display: block; }
.module-body { padding: 26px 28px 30px; display: flex; flex-direction: column; flex: 1; }
.module-num { font-family: "JetBrains Mono", monospace; color: var(--cyan); font-size: .85rem; }
.module h3 { font-size: 1.6rem; margin: 4px 0 4px; }
.module-hook { color: var(--yellow); margin-bottom: 16px; }
.module ul { list-style: none; display: grid; gap: 8px; margin-bottom: 24px; color: var(--muted); }
.module li::before { content: "⚡ "; }
.module-btn {
  margin-top: auto;
  align-self: flex-start;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--yellow);
  color: var(--yellow);
  font-weight: 700;
  transition: background .2s, color .2s, box-shadow .2s;
}
.module-btn:hover { background: var(--yellow); color: #111; box-shadow: var(--glow); }
.module-btn.soon { border-color: var(--border); color: var(--muted); pointer-events: none; }

/* Módulo 01: foco que se enciende */
.art-start .bulb { font-size: 4rem; animation: bulbOn 3s infinite; }
@keyframes bulbOn {
  0%, 30% { filter: grayscale(1) brightness(.5); }
  35%, 100% { filter: drop-shadow(0 0 25px rgba(255, 214, 10, .9)); }
  33% { filter: grayscale(1) brightness(.5); }
}

/* Módulo 02: corriente fluyendo por la tubería */
.pipe { fill: none; stroke: #3a4a68; stroke-width: 14; stroke-linecap: round; }
.pipe-flow {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 12 18;
  filter: drop-shadow(0 0 5px var(--yellow));
  animation: flow 1.2s linear infinite;
}
@keyframes flow { to { stroke-dashoffset: -30; } }

/* Módulo 03: plano que se dibuja solo */
.plan-line {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: draw 6s ease-in-out infinite;
}
.plan-wire {
  fill: none;
  stroke: var(--orange);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  animation: symPop 6s infinite, flow 1s linear infinite;
  opacity: 0;
}
.plan-sym { fill: none; stroke: var(--yellow); stroke-width: 2; animation: symPop 6s infinite; opacity: 0; filter: drop-shadow(0 0 4px rgba(255, 214, 10, .7)); }
.plan-sym-t { fill: var(--yellow); font: 700 14px "JetBrains Mono", monospace; animation: symPop 6s infinite; opacity: 0; }
@keyframes draw { 0% { stroke-dashoffset: 600; } 40%, 88% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -600; } }
@keyframes symPop { 0%, 45% { opacity: 0; } 55%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* Módulo 04: conocimientos orbitando */
.art-general .core { font-size: 2.6rem; z-index: 1; }
.orbit { position: absolute; width: 120px; height: 120px; animation: spin 10s linear infinite; }
.orbit span { position: absolute; font-size: 1.4rem; animation: spin 10s linear infinite reverse; }
.orbit span:nth-child(1) { top: -6px; left: 48px; }
.orbit span:nth-child(2) { right: -6px; top: 48px; }
.orbit span:nth-child(3) { bottom: -6px; left: 48px; }
.orbit span:nth-child(4) { left: -6px; top: 48px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Módulo 05: tarjeta ancha con chat de preguntas */
.module-wide { grid-column: 1 / -1; flex-direction: row; }
.module-wide .module-art { flex: 0 0 45%; height: auto; min-height: 240px; border-bottom: 0; border-right: 1px solid var(--border); }
.chat { display: flex; flex-direction: column; gap: 10px; width: 85%; max-width: 340px; padding: 20px 0; }
.bubble {
  padding: 9px 14px;
  border-radius: 16px;
  font-size: .9rem;
  max-width: 85%;
  opacity: 0;
  animation: bubbleIn 8s infinite;
}
.bubble.q { align-self: flex-start; background: #1d2a44; border-bottom-left-radius: 4px; }
.bubble.a { align-self: flex-end; background: linear-gradient(135deg, var(--yellow), var(--orange)); color: #111; font-weight: 700; border-bottom-right-radius: 4px; }
.bubble:nth-child(2) { animation-delay: 1s; }
.bubble:nth-child(3) { animation-delay: 2s; }
.bubble:nth-child(4) { animation-delay: 3s; }
@keyframes bubbleIn {
  0% { opacity: 0; transform: translateY(12px) scale(.9); }
  6%, 75% { opacity: 1; transform: none; }
  85%, 100% { opacity: 0; transform: none; }
}

/* Módulo 05: libro del NEC con artículos que salen */
.module-flip { flex-direction: row-reverse; }
.module-flip .module-art { border-right: 0; border-left: 1px solid var(--border); }
.art-nec { gap: 30px; grid-template-columns: auto auto; justify-content: center; }
.nec-book {
  width: 110px; height: 145px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 6px 12px 12px 6px;
  background: linear-gradient(135deg, #1f4fbf, #0f2a6b);
  border-left: 10px solid #0a1d4d;
  box-shadow: 0 0 30px rgba(45, 226, 255, .25), 6px 6px 0 #d9dfeb, 8px 8px 0 #0a1d4d;
  animation: bookFloat 4s ease-in-out infinite;
}
.nec-title { font-size: 2rem; font-weight: 700; color: #fff; letter-spacing: 2px; text-shadow: 0 0 12px var(--cyan); }
.nec-sub { font-size: .65rem; color: #b9c9ef; text-transform: uppercase; letter-spacing: 1px; text-align: center; }
.nec-tags { display: flex; flex-direction: column; gap: 10px; }
.nec-tags span {
  font-family: "JetBrains Mono", monospace;
  font-size: .85rem;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 214, 10, .5);
  color: var(--yellow);
  background: rgba(255, 214, 10, .08);
  opacity: 0;
  animation: tagIn 6s infinite;
}
.nec-tags span:nth-child(2) { animation-delay: .6s; }
.nec-tags span:nth-child(3) { animation-delay: 1.2s; }
.nec-tags span:nth-child(4) { animation-delay: 1.8s; }
@keyframes bookFloat { 50% { transform: translateY(-8px) rotate(-3deg); } }
@keyframes tagIn {
  0% { opacity: 0; transform: translateX(-20px); }
  8%, 70% { opacity: 1; transform: none; }
  80%, 100% { opacity: 0; transform: translateX(10px); }
}

/* Módulo 06: sol cargando el panel solar */
.art-solar svg { height: 170px; }
.sun circle { fill: var(--yellow); filter: drop-shadow(0 0 12px rgba(255, 214, 10, .9)); }
.sun-rays { stroke: var(--yellow); stroke-width: 3; stroke-linecap: round; transform-origin: 45px 38px; animation: spin 12s linear infinite; }
.sun-beam { stroke: rgba(255, 214, 10, .7); stroke-width: 2; stroke-dasharray: 6 8; animation: flow .8s linear infinite reverse; }
.panel-frame { fill: #12306e; stroke: #9fb6e6; stroke-width: 2; animation: panelCharge 3s ease-in-out infinite; }
.panel-grid { fill: none; stroke: rgba(159, 182, 230, .6); stroke-width: 1; }
.panel-leg { fill: none; stroke: #6b7a96; stroke-width: 3; stroke-linecap: round; }
.solar-wire { fill: none; stroke: var(--orange); stroke-width: 2.5; stroke-dasharray: 5 6; filter: drop-shadow(0 0 4px var(--orange)); animation: flow .7s linear infinite reverse; }
.solar-bulb { font-size: 22px; animation: bulbGlow 3s ease-in-out infinite; }
@keyframes panelCharge {
  0%, 100% { fill: #12306e; }
  50% { fill: #1f4fbf; filter: drop-shadow(0 0 10px rgba(45, 226, 255, .6)); }
}
@keyframes bulbGlow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(255, 214, 10, .4)); }
  50% { filter: drop-shadow(0 0 14px rgba(255, 214, 10, 1)); }
}

/* ===== APRENDE A LEER PLANOS ===== */
.plan-teaser { color: inherit; }
.plan-teaser:hover .module-btn { background: var(--yellow); color: #111; box-shadow: var(--glow); }
.back-link { display: inline-block; color: var(--muted); margin-bottom: 20px; transition: color .2s; }
.back-link:hover { color: var(--yellow); }
.page-title { font-size: clamp(2.6rem, 6vw, 4rem); }
.nav-links a.current { color: var(--yellow); }
.plan-tabs { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.plan-tab {
  font: inherit;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s, color .2s, box-shadow .2s;
}
.plan-tab.active { border-color: var(--yellow); color: var(--yellow); box-shadow: var(--glow); }
.plan-tab:disabled { color: var(--muted); cursor: default; opacity: .6; }

.plan-lesson { display: none; }
.plan-lesson.active { display: block; }
.plan-defs { position: absolute; width: 0; height: 0; }

/* Pestañas de hojas (alumbrado / fuerza) */
.sheet-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.sheet-tab {
  font: inherit;
  font-size: .95rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.sheet-tab:hover { color: var(--text); }
.sheet-tab.active { color: #111; background: var(--cyan); border-color: var(--cyan); }
.plan-pane { display: none; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.plan-pane.active { display: grid; }

.plan-sheet {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08);
  transform: perspective(1400px) rotateX(4deg);
  transition: transform .5s;
}
.plan-sheet:hover { transform: none; }
.plan-svg { display: block; width: 100%; height: auto; font-family: "JetBrains Mono", monospace; }

/* Papel y arquitectura */
.sheet-bg { fill: #f6f4ec; }
.sheet-border { fill: none; stroke: #111; stroke-width: 2; }
.wall-line { fill: none; stroke: #6d737d; stroke-width: 1.5; }
.door { stroke: #6d737d; stroke-width: 3; }
.door-swing { fill: none; stroke: #9aa0aa; stroke-width: 1; stroke-dasharray: 5 4; }
.fixture { fill: none; stroke: #9aa0aa; stroke-width: 1.4; }
.room-tag rect { fill: #f6f4ec; stroke: #6d737d; stroke-width: 1; }
.room-tag text { fill: #4a4f58; font-size: 11px; font-weight: 600; }
.dims path { fill: none; stroke: #6d737d; stroke-width: .8; }
.dims .dim-tick { stroke-width: 1.4; }
.dims text { fill: #4a4f58; font-size: 12px; }

/* Eléctrico */
.elec { fill: #f6f4ec; stroke: #111; stroke-width: 2.4; }
.elec.thin { fill: none; stroke-width: 1; }
.elec.em-fill, .lg.em-fill { fill: url(#hatchEm); }
.wire { fill: none; stroke: #111; stroke-width: 1.6; }
.tick { fill: none; stroke: #111; stroke-width: 1.6; }
.circ { fill: #111; font-size: 11px; font-weight: 700; }
.tag { fill: #f6f4ec; stroke: #111; stroke-width: 1.4; }
.tag-t { fill: #111; font-size: 10px; font-weight: 700; }
.sym-t { fill: #111; font-size: 11px; font-weight: 700; }
.sym-s { fill: #111; font-size: 20px; font-weight: 700; }
.north circle { fill: none; stroke: #111; stroke-width: 1.4; }
.north path { fill: #111; }
.north text { fill: #111; font-size: 14px; font-weight: 700; }
.notes text { fill: #222; font-size: 9.5px; }
.notes .notes-h { font-weight: 700; font-size: 10.5px; text-decoration: underline; }
.title-block rect, .title-block path { fill: none; stroke: #111; stroke-width: 2; }
.title-block text { fill: #111; }
.tb-brand { font-size: 15px; font-weight: 700; }
.tb-small { font-size: 10px; fill: #555 !important; }
.tb-label { font-size: 9px; fill: #666 !important; letter-spacing: 1px; }
.tb-value { font-size: 13px; font-weight: 700; }
.tb-sheet { font-size: 26px; font-weight: 700; }

/* Símbolos interactivos */
.sym { cursor: pointer; transition: filter .2s; }
.sym.hl .elec, .sym.hl .wire, .sym.hl .tick, .sym.hl .tag { stroke: #ff7a00; }
.sym.hl text { fill: #ff7a00; }
.sym.hl { filter: drop-shadow(0 0 6px rgba(255, 122, 0, .8)); }
.sym.hl .wire { stroke-width: 2.6; }

/* Los símbolos aparecen uno por uno cuando el plano entra en pantalla */
.plan-lesson .sym { opacity: 0; }
.plan-lesson.visible .sym { animation: symIn .6s ease forwards; animation-delay: var(--d, 0s); }
@keyframes symIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Leyenda */
.plan-legend {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
}
.plan-legend h3 { color: var(--yellow); margin-bottom: 12px; }
.plan-legend ul { list-style: none; display: grid; gap: 6px; margin-bottom: 16px; }
.plan-legend li {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .2s, border-color .2s;
}
.plan-legend li.hl { background: rgba(255, 214, 10, .08); border-color: rgba(255, 214, 10, .5); }
.plan-legend li svg { flex: 0 0 38px; height: 38px; background: #f6f4ec; border-radius: 6px; }
.plan-legend li div { display: flex; flex-direction: column; line-height: 1.25; }
.plan-legend li b { font-size: .95rem; }
.plan-legend li span { color: var(--muted); font-size: .8rem; }
.lg { fill: none; stroke: #111; stroke-width: 2.4; }
.lg.thin { stroke-width: 1; }
.lg-fill { fill: #111; }
.lg-t { fill: #111; font: 700 10px "JetBrains Mono", monospace; }
.lg-s { fill: #111; font: 700 22px "JetBrains Mono", monospace; }
.plan-info {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  min-height: 130px;
}
.plan-info b { color: var(--yellow); display: block; margin-bottom: 6px; }
.plan-info p { color: var(--muted); font-size: .92rem; }
.plan-info.pop { animation: pop .4s ease; }
.ceiling-grid path { fill: none; stroke: #c4c8cf; stroke-width: .9; }
.ceiling-grid.hl path { stroke: #ff7a00; stroke-width: 1.4; }
.hr-head { fill: #111; }
.cota-line { fill: none; stroke: #111; stroke-width: 1; }
.cota-tick { fill: none; stroke: #111; stroke-width: 1.8; }
.cota-t { fill: #111; font-size: 13px; font-weight: 700; }
.sym.hl .cota-line, .sym.hl .cota-tick { stroke: #ff7a00; }
.sym.hl .hr-head { fill: #ff7a00; }
.grid-mini { fill: none; stroke: #8a909a; stroke-width: 1; }
.lg-mini { fill: #111; font: 700 7px "JetBrains Mono", monospace; }
.lg-row { fill: #222; font-size: 9px; }

/* Conocimiento libre */
.libre-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: center; }
.libre p { color: var(--muted); font-size: 1.1rem; margin: 20px 0; }
.libre b { color: var(--text); }
.free-list { list-style: none; display: grid; gap: 12px; }
.free-list li { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.terminal {
  background: #05080f;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(45, 226, 255, .12);
}
.terminal-bar { display: flex; gap: 8px; align-items: center; padding: 12px 16px; background: #0d1424; }
.terminal-bar span { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.terminal-bar span:nth-child(2) { background: #febc2e; }
.terminal-bar span:nth-child(3) { background: #28c840; }
.terminal-bar em { margin-left: 10px; color: var(--muted); font-style: normal; font-family: "JetBrains Mono", monospace; font-size: .85rem; }
.terminal pre {
  font-family: "JetBrains Mono", monospace;
  font-size: .9rem;
  color: #9dffb0;
  padding: 22px;
  min-height: 290px;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal pre .hl { color: var(--yellow); }
.cursor { display: inline-block; width: 9px; background: #9dffb0; animation: blink 1s steps(1) infinite; }

/* Redes */
.socials { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.social {
  --c: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 36px 20px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--border);
  transition: transform .3s, box-shadow .3s, border-color .3s;
  cursor: pointer;
}
.social svg { width: 52px; height: 52px; fill: var(--c); transition: transform .4s; }
.social span { font-weight: 700; font-size: 1.2rem; }
.social small { color: var(--muted); }
.social:hover { transform: translateY(-10px); border-color: var(--c); box-shadow: 0 0 30px color-mix(in srgb, var(--c) 45%, transparent); }
.social:hover svg { transform: scale(1.15) rotate(-8deg); }
.social[data-social="youtube"] { --c: #ff3b3b; }
.social[data-social="tiktok"] { --c: #2de2ff; }
.social[data-social="instagram"] { --c: #ff4fa3; }
.social[data-social="facebook"] { --c: #3b8bff; }

/* Footer */
.footer { text-align: center; padding: 50px 16px; border-top: 1px solid var(--border); }
.muted { color: var(--muted); font-size: .9rem; margin-top: 6px; }

/* ===== REVEAL AL HACER SCROLL ===== */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity .8s ease, transform .8s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ===== ANIMACIONES ===== */
@keyframes shine { to { background-position: 300% 0; } }
@keyframes pulse { 50% { opacity: .5; transform: translate(-50%, -58%) scale(1.08); } }
@keyframes current { from { stroke-dashoffset: 1440; } to { stroke-dashoffset: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes zap {
  0%, 90%, 100% { transform: none; filter: none; }
  92% { transform: scale(1.4) rotate(-10deg); filter: drop-shadow(0 0 10px var(--yellow)); }
  95% { transform: scale(.9) rotate(8deg); }
}
@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { text-shadow: 0 0 12px rgba(255, 214, 10, .6), 0 0 40px rgba(255, 143, 31, .35); opacity: 1; }
  20%, 24%, 55% { text-shadow: none; opacity: .75; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 30px; }
  .lead { margin-left: auto; margin-right: auto; }
  .hero-cta, .stats { justify-content: center; }
  .levels, .socials { grid-template-columns: repeat(2, 1fr); }
  .libre-grid { grid-template-columns: 1fr; }
  .section-title.left { text-align: center; }
}
@media (max-width: 960px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 18px;
    padding: 20px;
    background: rgba(7, 11, 20, .97);
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav-links.open { display: flex; }
  .plan-pane.active { grid-template-columns: 1fr; }
  .plan-sheet { transform: none; }
}
@media (max-width: 640px) {
  .levels, .modules { grid-template-columns: 1fr; }
  .socials { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .social { padding: 24px 12px; }
  .social svg { width: 40px; height: 40px; }
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stats strong { font-size: 1.7rem; }
  .stats div > span { font-size: .8rem; line-height: 1.3; }
  .module-wide { flex-direction: column; }
  .module-wide .module-art { flex: none; border-right: 0; border-left: 0; border-bottom: 1px solid var(--border); min-height: 200px; }
  .section { padding: 70px 16px; }
  .plan-legend ul { grid-template-columns: 1fr 1fr; }
  .plan-legend li { gap: 8px; padding: 6px 4px; }
  .plan-legend li svg { flex-basis: 32px; height: 32px; }
  .plan-legend li span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ===== EJERCICIO PRÁCTICO: FERRETERÍA (ejercicio.html) ===== */
.tz-section { max-width: 1400px; }
.tz-rooms { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 22px; }
.tz-room-btn, .tz-btn {
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.tz-room-btn:hover, .tz-btn:hover { border-color: var(--yellow); color: var(--yellow); }
.tz-room-btn.active { background: var(--yellow); border-color: var(--yellow); color: #111; }
.tz-viewer { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
.tz-stage { min-width: 0; }
.tz-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; min-height: 40px; }
.tz-crumb { color: var(--muted); }
.tz-crumb b { color: var(--yellow); }
.tz-layers { margin-left: auto; display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.tz-layers label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.tz-layers input { accent-color: var(--yellow); width: 16px; height: 16px; }
.tz-sheet { border-radius: 10px; overflow: hidden; box-shadow: 0 25px 60px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08); }
.tz-svg { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 660; font-family: "JetBrains Mono", monospace; background: #f6f4ec; }
.tz-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: .9rem; text-align: center; }

/* Dibujo */
.tz-svg .wall-ext { stroke: #5d636c; stroke-width: 7; }
.tz-svg .wall-int { stroke: #7d838c; stroke-width: 4.5; }
.tz-svg .glass { fill: none; stroke: #7d838c; stroke-width: .8; }
.tz-svg .door { stroke: #7d838c; stroke-width: 1.4; }
.tz-svg .door-swing { fill: none; stroke: #a3a8b0; stroke-width: .7; stroke-dasharray: 3 2; }
.tz-svg .fix { fill: none; stroke: #a3a8b0; stroke-width: 1; }
.tz-svg .fix-t { fill: #8a8f99; font-size: 6px; }
.tz-svg .fix-t.sm { font-size: 4.5px; }
.tz-svg .furn { fill: #eceae1; stroke: #9aa0aa; stroke-width: .9; }
.tz-svg .furn-t { fill: #7a808a; font-size: 3.6px; font-weight: 600; }
.tz-svg .room-tag text { fill: #4a4f58; font-size: 6.5px; font-weight: 700; }
.tz-svg .room-tag .num { font-size: 5px; font-weight: 400; }
.tz-svg .e { fill: #f6f4ec; stroke: #111; stroke-width: 1.3; }
.tz-svg .e.thin { fill: none; stroke-width: .5; }
.tz-svg .e.thin2 { fill: none; stroke-width: .8; }
.tz-svg .e.em { fill: url(#tzHatch); }
.tz-svg .e.fill { fill: #111; }
.tz-svg .w { fill: none; stroke: #111; stroke-width: .8; }
.tz-svg .tag-t { fill: #111; font-size: 4.5px; font-weight: 700; }
.tz-svg .sw-t { fill: #444; font-size: 4.5px; font-style: italic; }
.tz-svg .s-t { fill: #111; font-size: 7px; font-weight: 700; }
.tz-svg .sw-sub { font-size: 4.5px; }
.tz-svg .dev-t { fill: #111; font-size: 3.6px; font-weight: 700; }
.tz-svg .exit-t { fill: #111; font-size: 5px; font-weight: 700; }
.tz-svg .panel-t { fill: #111; font-size: 5px; font-weight: 700; }
.tz-svg .hr-t { fill: #111; font-size: 4.2px; font-weight: 700; }
.tz-svg .ig { fill: #ff8f1f; stroke: #111; stroke-width: .5; }
.tz-svg .hr-head { fill: #111; }
.tz-svg .sheet-bg { fill: #f6f4ec; }
.tz-svg .sheet-border { fill: none; stroke: #111; stroke-width: 2; }
.tz-svg .north circle { fill: none; stroke: #111; stroke-width: 1.2; }
.tz-svg .north path { fill: #111; }
.tz-svg .north text { fill: #111; font-size: 11px; font-weight: 700; }
.tz-svg .dims path { fill: none; stroke: #6d737d; stroke-width: .7; }
.tz-svg .dims .dim-tick { stroke-width: 1.3; }
.tz-svg .dims text { fill: #4a4f58; font-size: 9px; }
.tz-svg .leg-h { fill: #111; font-size: 10px; font-weight: 700; text-decoration: underline; }
.tz-svg .leg-t { fill: #222; font-size: 8px; }
.tz-svg .leg-row { cursor: pointer; }
.tz-svg .leg-row:hover .leg-t { fill: #ff7a00; }
.tz-svg .note-t { fill: #333; font-size: 7.5px; }
.tz-svg .title-block rect, .tz-svg .title-block path { fill: none; stroke: #111; stroke-width: 2; }
.tz-svg .title-block text { fill: #111; }

/* Áreas clickeables */
.tz-svg .hit { fill: rgba(255, 214, 10, 0); stroke: none; cursor: zoom-in; transition: fill .25s; }
.tz-svg .hit:hover { fill: rgba(255, 190, 0, .14); }
.tz-svg.zoomed .hit.active { cursor: default; }
.tz-svg.zoomed .hit.active:hover { fill: rgba(255, 214, 10, 0); }
.tz-svg .fog { fill: rgba(246, 244, 236, .82); pointer-events: none; }

/* Símbolos */
.tz-svg .it { cursor: pointer; }
.tz-svg .it:hover .e, .tz-svg .it:hover .w { stroke: #ff7a00; }
.tz-svg .it.on .e, .tz-svg .it.on .w { stroke: #ff7a00; stroke-width: 2; }
.tz-svg .it.on text { fill: #ff7a00; }
.tz-svg .it.on { filter: drop-shadow(0 0 3px rgba(255, 122, 0, .9)); }
.tz-svg.circ-mode .layer-luz > *:not(.circ-on), .tz-svg.circ-mode .layer-fza > *:not(.circ-on) { opacity: .18; }
.tz-svg .circ-on .e, .tz-svg .circ-on.w, .tz-svg .circ-on .w { stroke: #e0007a; }
.tz-svg .circ-on.w { stroke-width: 1.4; }
.tz-svg .circ-on text { fill: #e0007a; }
.tz-svg .circ-on { filter: drop-shadow(0 0 2px rgba(224, 0, 122, .6)); }
.tz-svg.hide-luz .layer-luz, .tz-svg.hide-fza .layer-fza, .tz-svg.hide-detail .layer-detail { display: none; }

/* Panel lateral */
.tz-panel {
  position: sticky;
  top: 84px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.tz-panel h3 { font-size: 1.4rem; margin-bottom: 8px; }
.tz-kicker { font-family: "JetBrains Mono", monospace; color: var(--cyan); font-size: .85rem; }
.tz-lead { color: var(--text); margin-bottom: 12px; }
.tz-points, .tz-steps { color: var(--muted); padding-left: 20px; display: grid; gap: 8px; margin-bottom: 14px; font-size: .95rem; }
.tz-steps b { color: var(--text); }
.tz-why { background: rgba(45, 226, 255, .07); border: 1px solid rgba(45, 226, 255, .35); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.tz-why b { color: var(--cyan); display: block; margin-bottom: 6px; }
.tz-why p { color: var(--text); font-size: .93rem; }
.tz-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.tz-chips span { color: var(--muted); font-size: .85rem; width: 100%; }
.tz-chip {
  font: 700 .8rem "JetBrains Mono", monospace;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(224, 0, 122, .5);
  background: rgba(224, 0, 122, .08);
  color: #ff5cb0;
  cursor: pointer;
}
.tz-chip.active, .tz-chip:hover { background: #e0007a; color: #fff; }
.tz-item:not(:empty) { border-top: 1px solid var(--border); padding-top: 14px; }
.tz-item b { color: var(--yellow); display: block; margin-bottom: 6px; font-size: 1.05rem; }
.tz-item p { color: var(--muted); font-size: .95rem; margin-bottom: 10px; }
.tz-item.pop { animation: pop .4s ease; }

/* Tarjeta que lleva al ejercicio (en planos.html) */
.tz-promo {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 900px;
  margin: 0 auto 40px;
  padding: 20px 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 214, 10, .45);
  background: linear-gradient(135deg, rgba(255, 214, 10, .1), rgba(45, 226, 255, .06));
  box-shadow: var(--glow);
  transition: transform .25s, box-shadow .25s;
}
.tz-promo:hover { transform: translateY(-4px); box-shadow: 0 0 34px rgba(255, 214, 10, .55); }
.tz-promo-icon { font-size: 2.4rem; }
.tz-promo-text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 220px; }
.tz-promo-text b { font-size: 1.15rem; }
.tz-promo-text span { color: var(--muted); font-size: .92rem; }
.tz-promo-go { font-weight: 700; color: #111; background: var(--yellow); padding: 10px 18px; border-radius: 999px; white-space: nowrap; }

/* Tabla del tablero */
.tz-schedule { margin-top: 60px; }
.tz-schedule h2 { text-align: center; font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 8px; }
.tz-schedule .section-sub { margin-bottom: 24px; }
.tz-table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
.tz-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tz-table th { text-align: left; padding: 12px 14px; background: #0d1424; color: var(--yellow); font-weight: 700; white-space: nowrap; }
.tz-table td { padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); }
.tz-table td:first-child { font-family: "JetBrains Mono", monospace; white-space: nowrap; color: var(--text); }
.tz-table tbody tr { cursor: pointer; transition: background .2s; }
.tz-table tbody tr:hover { background: rgba(255, 255, 255, .04); }
.tz-table tbody tr.active { background: rgba(224, 0, 122, .15); }
.tz-table tbody tr.active td { color: var(--text); }

@media (max-width: 960px) {
  .tz-viewer { grid-template-columns: 1fr; }
  .tz-panel { position: static; max-height: none; }
  .tz-layers { margin-left: 0; width: 100%; }
}
@media (max-width: 640px) {
  .tz-table th:nth-child(4), .tz-table td:nth-child(4) { display: none; }
  .tz-promo { flex-wrap: wrap; }
  .tz-room-btn { font-size: .8rem; padding: 7px 11px; }
  .tz-table { font-size: .82rem; }
  .tz-table td, .tz-table th { padding: 8px 10px; }
}

/* Cotas del ejercicio: solo se ven al acercarse a un área */
.tz-svg .layer-cotas { pointer-events: none; }
.tz-svg .cota { display: none; font-family: "JetBrains Mono", monospace; }
.tz-svg.zoomed .cota.cur { display: inline; animation: cotaIn .5s ease .35s both; }
.tz-svg.hide-cotas .layer-cotas { display: none; }
.tz-svg .cota path, .tz-svg .leg-cota path { fill: none; stroke: #1769c4; stroke-width: 1; vector-effect: non-scaling-stroke; }
.tz-svg .cota .ce { stroke-dasharray: 3 2; opacity: .8; }
.tz-svg .cota text { fill: #1769c4; font-weight: 700; paint-order: stroke; stroke: #f6f3ec; stroke-linejoin: round; }
.tz-svg .layer-cbox { visibility: hidden; pointer-events: none; }
@keyframes cotaIn { from { opacity: 0; } to { opacity: 1; } }

/* Página de planos: el pie de página siempre abajo y tarjetas de qué vas a aprender */
.page-planos { display: flex; flex-direction: column; min-height: 100vh; }
.page-planos main { flex: 1; }
.pl-learn { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; max-width: 900px; margin: 0 auto; }
.pl-card { padding: 20px; border-radius: 16px; border: 1px solid var(--border); background: rgba(255, 255, 255, .03); }
.pl-card span { font-size: 1.6rem; }
.pl-card b { display: block; margin: 8px 0 6px; }
.pl-card p { color: var(--muted); font-size: .9rem; margin: 0; }
@media (max-width: 820px) { .pl-learn { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .pl-learn { grid-template-columns: 1fr; } }

/* Cambio de unidades de las cotas */
.tz-units { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.tz-units button { background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; padding: 6px 12px; cursor: pointer; }
.tz-units button.active { background: #1769c4; color: #fff; font-weight: 700; }

/* Módulo Electrónica desde 0: placa con chip ASERE */
.art-elec svg { height: 170px; width: 100%; }
.art-elec .pcb { fill: rgba(16, 120, 80, .18); stroke: rgba(45, 226, 160, .5); stroke-width: 1.5; }
.art-elec .trace { fill: none; stroke: rgba(255, 214, 10, .45); stroke-width: 3; stroke-linecap: round; }
.art-elec .trace.flow { stroke: var(--yellow); stroke-dasharray: 6 10; filter: drop-shadow(0 0 4px var(--yellow)); animation: flow .8s linear infinite; }
.art-elec .chip { fill: #12161f; stroke: #8a93a6; stroke-width: 1.5; }
.art-elec .chip-pins { stroke: #c9ced8; stroke-width: 3; }
.art-elec .chip-t { fill: var(--cyan, #2de2ff); font: 700 14px "JetBrains Mono", monospace; letter-spacing: 2px; animation: bulbGlow 3s ease-in-out infinite; }
.art-elec .res { fill: none; stroke: #ff9f43; stroke-width: 2; }
.art-elec .cap { fill: #2d6cdf; stroke: #9cc0ff; stroke-width: 1; }
.art-elec .pad { fill: #d8b25a; }
.art-elec .led { fill: #ff3b3b; animation: ledBlink 1.2s steps(2, jump-none) infinite; }
@keyframes ledBlink { 0% { fill: #5a1414; } 100% { fill: #ff3b3b; filter: drop-shadow(0 0 8px #ff3b3b); } }
