/* ═══ v2: fondo espacial con circuitos, íconos dibujados, funciones con detalle, videos ═══ */

/* Fondo: nebulosas + dos capas de estrellas + pistas de circuito que se desvanecen hacia abajo */
.circuit-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-color: #05070f;
  background-image:
    radial-gradient(ellipse 60% 45% at 15% 10%, rgba(139, 92, 246, .28), transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 20%, rgba(56, 189, 248, .18), transparent 70%),
    radial-gradient(ellipse 70% 50% at 60% 95%, rgba(236, 72, 153, .14), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='12' cy='30' r='.9'/%3E%3Ccircle cx='70' cy='12' r='.6'/%3E%3Ccircle cx='130' cy='60' r='1.1'/%3E%3Ccircle cx='200' cy='20' r='.7'/%3E%3Ccircle cx='40' cy='110' r='.6'/%3E%3Ccircle cx='170' cy='130' r='.9'/%3E%3Ccircle cx='100' cy='170' r='.7'/%3E%3Ccircle cx='220' cy='200' r='1'/%3E%3Ccircle cx='20' cy='210' r='.8'/%3E%3Ccircle cx='150' cy='225' r='.5'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520'%3E%3Cg fill='%23c4b5fd'%3E%3Ccircle cx='60' cy='90' r='1.4'/%3E%3Ccircle cx='300' cy='40' r='1.1'/%3E%3Ccircle cx='450' cy='260' r='1.5'/%3E%3Ccircle cx='210' cy='380' r='1.2'/%3E%3Ccircle cx='90' cy='470' r='1'/%3E%3C/g%3E%3Cg fill='%237dd3fc'%3E%3Ccircle cx='380' cy='140' r='1.2'/%3E%3Ccircle cx='140' cy='250' r='1'/%3E%3Ccircle cx='490' cy='470' r='1.1'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, auto, auto, 240px 240px, 520px 520px;
}
.circuit-bg::before {
  content: ''; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320' fill='none' stroke='%238b5cf6' stroke-width='1.4'%3E%3Cpath d='M0 40 H80 L100 60 H180 M180 60 V140 L200 160 H320'/%3E%3Cpath d='M40 320 V240 L60 220 H140 L160 200 V120'/%3E%3Cpath d='M240 0 V60 L260 80 H320'/%3E%3Cpath d='M0 260 H60 L80 280 V320'/%3E%3Cpath d='M220 320 V250 L240 230 H280 V200'/%3E%3Cg fill='%2305070f'%3E%3Ccircle cx='180' cy='60' r='4'/%3E%3Ccircle cx='160' cy='120' r='4'/%3E%3Ccircle cx='240' cy='60' r='3.5'/%3E%3Ccircle cx='60' cy='260' r='3.5'/%3E%3Ccircle cx='280' cy='200' r='3.5'/%3E%3Ccircle cx='80' cy='40' r='3'/%3E%3C/g%3E%3Crect x='112' y='212' width='22' height='14' rx='2'/%3E%3C/svg%3E");
  background-size: 320px 320px; opacity: .22;
  -webkit-mask-image: radial-gradient(ellipse 85% 70% at 50% 0%, #000 30%, transparent 85%);
  mask-image: radial-gradient(ellipse 85% 70% at 50% 0%, #000 30%, transparent 85%);
}
.circuit-bg::after { /* brillo que recorre las pistas, muy suave */
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle 220px at var(--gx, 30%) 18%, rgba(139, 92, 246, .10), transparent 70%);
  animation: barrido 18s ease-in-out infinite alternate;
}
@keyframes barrido { from { --gx: 20%; background-position: -20vw 0; } to { background-position: 40vw 0; } }
@media (prefers-reduced-motion: reduce) { .circuit-bg::after { animation: none; } }
.site-header { background: rgba(5, 7, 15, .72); }
.forum, .chatbot-section { display: none !important; }

/* Íconos dibujados */
.ico-comp { width: 100%; height: 100%; display: block; }
.tarjeta .ico { width: 52px; height: 52px; font-size: 0; }
.articulo h1 .ico-h1 { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -.18em; margin-right: .25em; }
.relacionados a .ico-chip { display: inline-block; width: 22px; height: 22px; vertical-align: -6px; margin-right: 4px; }
.feature-icon.dib { width: 56px; height: 56px; font-size: 0; margin-bottom: 14px; }

/* Cifras */
.cifras { padding: 10px 0 0; }
.cifras-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cifra { text-align: center; background: rgba(19, 27, 38, .7); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 10px; backdrop-filter: blur(4px); }
.cifra b { display: block; font-family: var(--font-display); font-size: 2rem; color: #c4b5fd; line-height: 1.1; }
.cifra span { color: var(--text-dim); font-size: .9rem; }
@media (max-width: 700px) { .cifras-grid { grid-template-columns: repeat(2, 1fr); } }

/* Funciones con detalle */
button.feature-card { text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; background: rgba(19, 27, 38, .78); }
button.feature-card:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.ver-mas { display: inline-block; margin-top: 12px; color: #b69cff; font-size: .88rem; font-weight: 600; }
.detalle-fondo { position: fixed; inset: 0; z-index: 200; background: rgba(3, 5, 12, .72); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 18px; }
.detalle-fondo.abierto { display: flex; }
.detalle { position: relative; max-width: 620px; width: 100%; max-height: 86vh; overflow-y: auto; background: #0f1620; border: 1px solid rgba(139, 92, 246, .55); border-radius: 18px; padding: 26px 26px 20px; box-shadow: 0 30px 80px -20px #000; }
.detalle h3 { font-size: 1.4rem; margin: 0 0 6px; display: flex; align-items: center; gap: 12px; }
.detalle h3 .ico-det { width: 46px; height: 46px; flex: 0 0 auto; }
.detalle p { color: #c4cddb; }
.detalle ul { padding-left: 1.2em; margin: 8px 0 14px; }
.detalle li { color: #c4cddb; margin: 6px 0; line-height: 1.5; }
.detalle li b { color: var(--text); }
.detalle .cerrar { position: absolute; top: 10px; right: 12px; background: none; border: none; color: var(--text-dim); font-size: 1.6rem; cursor: pointer; line-height: 1; padding: 4px 8px; }
.detalle .cerrar:hover { color: var(--text); }
.detalle .acciones-det { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }

/* Videos */
.videos { padding: 70px 0; }
.videos h2, .videos .intro { text-align: center; }
.videos .intro { max-width: 56ch; margin: 0 auto 30px; }
.video-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .video-grid { grid-template-columns: repeat(2, 1fr); } }
.video { position: relative; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #000; border: 1px solid var(--border); cursor: pointer; padding: 0; display: block; width: 100%; }
.video img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.video:hover img { transform: scale(1.04); }
.video .play { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: 58px; height: 58px; border-radius: 50%; background: rgba(139, 92, 246, .92); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 24px #0009; }
.video .play::after { content: ''; border-style: solid; border-width: 11px 0 11px 18px; border-color: transparent transparent transparent #fff; margin-left: 4px; }
.video .tit { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 10px 10px; background: linear-gradient(transparent, rgba(0, 0, 0, .88)); color: #fff; font-size: .85rem; line-height: 1.3; text-align: left; font-weight: 600; }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }
.videos .mas { text-align: center; margin-top: 26px; }

/* Builder con dibujo */
.builder-visual.dib { font-size: 0; display: flex; justify-content: center; }
.builder-visual.dib .ico-comp { width: 170px; height: 170px; filter: drop-shadow(0 0 30px rgba(139, 92, 246, .45)); }

/* Portada: mini íconos en las tarjetas de Aprende */
.mini-iconos { display: flex; gap: 8px; margin-bottom: 12px; }
.mini-iconos span { width: 40px; height: 40px; display: block; }

/* Ajustes de la muestra: más espacio (nebulosas y estrellas en toda la pantalla) y circuitos en todo el fondo */
.circuit-bg {
  background-image:
    radial-gradient(ellipse 55% 40% at 12% 8%, rgba(139, 92, 246, .38), transparent 70%),
    radial-gradient(ellipse 45% 38% at 88% 22%, rgba(56, 189, 248, .24), transparent 70%),
    radial-gradient(ellipse 60% 45% at 30% 75%, rgba(99, 102, 241, .18), transparent 70%),
    radial-gradient(ellipse 55% 40% at 85% 92%, rgba(236, 72, 153, .20), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cg fill='%23fff' fill-opacity='.7'%3E%3Ccircle cx='10' cy='20' r='.5'/%3E%3Ccircle cx='60' cy='8' r='.4'/%3E%3Ccircle cx='110' cy='40' r='.6'/%3E%3Ccircle cx='30' cy='70' r='.4'/%3E%3Ccircle cx='90' cy='95' r='.5'/%3E%3Ccircle cx='130' cy='120' r='.4'/%3E%3Ccircle cx='50' cy='125' r='.5'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='12' cy='30' r='.9'/%3E%3Ccircle cx='70' cy='12' r='.6'/%3E%3Ccircle cx='130' cy='60' r='1.1'/%3E%3Ccircle cx='200' cy='20' r='.7'/%3E%3Ccircle cx='40' cy='110' r='.6'/%3E%3Ccircle cx='170' cy='130' r='.9'/%3E%3Ccircle cx='100' cy='170' r='.7'/%3E%3Ccircle cx='220' cy='200' r='1'/%3E%3Ccircle cx='20' cy='210' r='.8'/%3E%3Ccircle cx='150' cy='225' r='.5'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520'%3E%3Cg fill='%23c4b5fd'%3E%3Ccircle cx='60' cy='90' r='1.6'/%3E%3Ccircle cx='300' cy='40' r='1.2'/%3E%3Ccircle cx='450' cy='260' r='1.7'/%3E%3Ccircle cx='210' cy='380' r='1.3'/%3E%3Ccircle cx='90' cy='470' r='1.1'/%3E%3C/g%3E%3Cg fill='%237dd3fc'%3E%3Ccircle cx='380' cy='140' r='1.3'/%3E%3Ccircle cx='140' cy='250' r='1.1'/%3E%3Ccircle cx='490' cy='470' r='1.2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, auto, auto, auto, 140px 140px, 240px 240px, 520px 520px;
}
.circuit-bg::before {
  opacity: .26;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.55) 55%, rgba(0,0,0,.8) 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.55) 55%, rgba(0,0,0,.8) 100%);
}
/* 6 funciones: 3 por fila en pantallas anchas */
#funciones .feature-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { #funciones .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { #funciones .feature-grid { grid-template-columns: 1fr; } }
/* tarjetas semitransparentes para que se vea el fondo */
.feature-card, .cifra, .tarjeta { background: rgba(15, 22, 32, .72); backdrop-filter: blur(3px); }

/* Builder: celular con una captura real de la app */
.builder-visual.tel { font-size: 0; position: relative; display: flex; justify-content: center; opacity: 1; filter: none; }
.builder-visual.tel .phone { width: 250px; height: 413px; } /* pantalla interior 210 × 373 = 9:16, como la captura */
@media (max-width: 860px) { .builder-visual.tel .phone { width: 216px; height: 353px; } }

/* Historia: «De la chispa al chip» */
.historia { padding: 70px 0 20px; }
.historia h2, .historia .eyebrow { text-align: center; }
.historia-intro { max-width: 70ch; margin: 0 auto 34px; text-align: center; font-size: 1.04rem; }
.linea { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.linea li { background: rgba(15, 22, 32, .72); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 14px; position: relative; backdrop-filter: blur(3px); }
.linea li::before { content: ''; position: absolute; top: -6px; left: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 10px var(--violet); }
.linea .anio { display: block; font-family: var(--font-mono); color: #c4b5fd; font-size: .85rem; margin-bottom: 4px; }
.linea strong { display: block; font-family: var(--font-display); font-size: 1.02rem; margin-bottom: 6px; color: var(--text); }
.linea p { margin: 0; font-size: .9rem; line-height: 1.45; }
.historia .mas { text-align: center; margin-top: 24px; }
@media (max-width: 900px) { .linea { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .linea { grid-template-columns: 1fr; } }
.linea-tiempo li { margin: 8px 0; }
.linea-tiempo b { font-family: var(--font-mono); color: #c4b5fd; margin-right: 6px; }
.tarjeta.destacada { margin: 10px 0 24px; border-color: rgba(139, 92, 246, .6); background: linear-gradient(135deg, rgba(139,92,246,.16), rgba(15,22,32,.8)); }
