/* Styles for the /learn/ STEM section. Builds on /etr.css. */

/* Language switching: elements marked lang="es" are hidden in English mode and vice versa. */
html[data-view="en"] [data-l="es"],
html[data-view="es"] [data-l="en"] { display: none !important; }

.learn h1, .learn h2, .learn h3 { font-family: "Orbitron", sans-serif; }
.learn h1 { font-weight: 700; }
.learn h2 { font-weight: 600; margin-bottom: 1rem; }
.learn h3 { font-weight: 500; font-size: 1.25rem; }

.eyebrow {
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: .5rem;
}

.lang-toggle {
    display: inline-flex;
    border: 2px solid #ffffff;
    border-radius: 999px;
    overflow: hidden;
}
.lang-toggle button {
    background: transparent;
    color: #ffffff;
    border: 0;
    padding: .35rem 1rem;
    font-weight: 700;
    font-size: 1rem;
}
.lang-toggle button[aria-pressed="true"] {
    background: #ffffff;
    color: #1E4F82;
}

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; padding: 0; list-style: none; }
.chips li {
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 999px;
    padding: .2rem .9rem;
    font-size: 1rem;
    font-weight: 600;
}
.ig .chips li { background: #ffffff; border-color: #d9cfc4; }

.card-elektro {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .08);
    padding: 1.5rem;
    color: #2c3e50;
    text-shadow: none;
}
.card-elektro h3 { margin-top: 0; }
.card-elektro img { border-radius: 10px; }
.card-elektro .soon {
    display: inline-block;
    background: #F5EEE8;
    color: #1E4F82;
    border-radius: 999px;
    padding: .1rem .8rem;
    font-size: .85rem;
    font-weight: 700;
}

.kit-item { text-align: center; }
.kit-item i { font-size: 2.2rem; color: #E45C2C; }
.kit-item p { margin: .25rem 0 0; line-height: 1.35; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li {
    counter-increment: s;
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    padding: 1rem 1.25rem 1rem 4.25rem;
    margin-bottom: .9rem;
    color: #2c3e50;
}
.steps li::before {
    content: counter(s);
    position: absolute;
    left: 1rem;
    top: 1rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: #1E4F82;
    color: #ffffff;
    font-family: "Orbitron", sans-serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.steps li:last-child::before { background: #E45C2C; }

.safety {
    border: 3px solid #E45C2C;
    background: #ffffff;
    color: #2c3e50;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
}
.safety i { color: #E45C2C; font-size: 1.6rem; }

.dl {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.dl img { width: 110px; flex: none; border: 1px solid #ddd; border-radius: 6px; background: #fff; }

.btn-elektro {
    background-color: #E45C2C;
    border-color: #E45C2C;
    color: #ffffff;
    font-weight: 700;
}
.btn-elektro:hover, .btn-elektro:focus { background-color: #c94b1f; border-color: #c94b1f; color: #ffffff; }
.btn-outline-elektro { border: 2px solid #1E4F82; color: #1E4F82; font-weight: 700; }
.btn-outline-elektro:hover { background: #1E4F82; color: #ffffff; }

.learn a.text-link { color: #1E4F82; font-weight: 600; }
.wht a.text-link { color: #ffffff; }

/* ---------- Build animation (12-second loop) ---------- */
.anim-wrap { background: #ffffff; border-radius: 16px; padding: 1rem; }
.anim-wrap svg { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto; }

.anim-steps { list-style: none; padding: 0; margin: 0; }
.anim-steps li {
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: .55rem .9rem;
    margin-bottom: .6rem;
    color: #2c3e50;
    line-height: 1.35;
    animation: 12s infinite;
}
.anim-steps li strong { display: block; }
.anim-steps li:nth-child(1) { animation-name: hl1; }
.anim-steps li:nth-child(2) { animation-name: hl2; }
.anim-steps li:nth-child(3) { animation-name: hl3; }
.anim-steps li:nth-child(4) { animation-name: hl4; }
.anim-steps li:nth-child(5) { animation-name: hl5; }
@keyframes hl1 { 0%, 14% { border-color: #E45C2C; background: #FFF4EE; } 15%, 100% { border-color: transparent; background: #ffffff; } }
@keyframes hl2 { 0%, 14% { border-color: transparent; background: #ffffff; } 15%, 32% { border-color: #E45C2C; background: #FFF4EE; } 33%, 100% { border-color: transparent; background: #ffffff; } }
@keyframes hl3 { 0%, 32% { border-color: transparent; background: #ffffff; } 33%, 47% { border-color: #E45C2C; background: #FFF4EE; } 48%, 100% { border-color: transparent; background: #ffffff; } }
@keyframes hl4 { 0%, 47% { border-color: transparent; background: #ffffff; } 48%, 59% { border-color: #E45C2C; background: #FFF4EE; } 60%, 100% { border-color: transparent; background: #ffffff; } }
@keyframes hl5 { 0%, 59% { border-color: transparent; background: #ffffff; } 60%, 100% { border-color: #E45C2C; background: #FFF4EE; } }

#build-anim .tape { fill: none; stroke: #C87F4E; stroke-width: 12; stroke-linejoin: miter; stroke-linecap: butt; }
#build-anim .tape-minus { stroke-dasharray: 240; animation: drawMinus 12s infinite linear; }
#build-anim .tape-minus-bar { stroke-dasharray: 90; animation: drawMinusBar 12s infinite linear; }
#build-anim .tape-plus  { stroke-dasharray: 520; animation: drawPlus 12s infinite linear; }
#build-anim .tape-flap  { stroke-dasharray: 170; animation: drawFlap 12s infinite linear; }
@keyframes drawMinus { 0% { stroke-dashoffset: 240; } 9%, 100% { stroke-dashoffset: 0; } }
@keyframes drawMinusBar { 0%, 9% { stroke-dashoffset: 90; } 13%, 100% { stroke-dashoffset: 0; } }
@keyframes drawPlus  { 0%, 15% { stroke-dashoffset: 520; } 27%, 100% { stroke-dashoffset: 0; } }
@keyframes drawFlap  { 0%, 27% { stroke-dashoffset: 170; } 32%, 100% { stroke-dashoffset: 0; } }

#build-anim .leds    { opacity: 0; animation: showLeds 12s infinite; }
#build-anim .battery { opacity: 0; animation: showBattery 12s infinite; }
@keyframes showLeds    { 0%, 34% { opacity: 0; transform: translateY(-14px); } 42%, 100% { opacity: 1; transform: none; } }
@keyframes showBattery { 0%, 49% { opacity: 0; transform: translateY(-14px); } 56%, 100% { opacity: 1; transform: none; } }

#build-anim .flap {
    transform-box: view-box;
    transform-origin: 0 470px;
    animation: foldFlap 12s infinite ease-in-out;
}
@keyframes foldFlap { 0%, 61% { transform: scaleY(1); } 70%, 96% { transform: scaleY(-1); } 100% { transform: scaleY(1); } }

#build-anim .clip { opacity: 0; animation: showClip 12s infinite; }
@keyframes showClip { 0%, 70% { opacity: 0; } 73%, 96% { opacity: 1; } 100% { opacity: 0; } }

#build-anim .glow { opacity: 0; animation: glow 12s infinite; }
@keyframes glow { 0%, 73% { opacity: 0; } 76%, 96% { opacity: 1; } 100% { opacity: 0; } }

#build-anim .flow {
    fill: none;
    stroke: #FFD23F;
    stroke-width: 4;
    stroke-dasharray: 8 12;
    opacity: 0;
    animation: flowShow 12s infinite, flowMove 1s infinite linear;
}
@keyframes flowShow { 0%, 74% { opacity: 0; } 77%, 96% { opacity: 1; } 100% { opacity: 0; } }
@keyframes flowMove { from { stroke-dashoffset: 40; } to { stroke-dashoffset: 0; } }

/* Respect reduced-motion settings: show the finished, glowing circuit with no movement. */
@media (prefers-reduced-motion: reduce) {
    #build-anim *, .anim-steps li { animation: none !important; }
    #build-anim .tape { stroke-dashoffset: 0; }
    #build-anim .leds, #build-anim .battery, #build-anim .clip, #build-anim .glow, #build-anim .flow { opacity: 1; }
    #build-anim .flap { transform: scaleY(-1); }
}

/* Links inside white cards stay navy, even when the section around them uses white text. */
.card-elektro a.text-link { color: #1E4F82; }

/* Drawings beside each build step */
.steps .step-row { display: flex; gap: 1rem; align-items: flex-start; }
.steps .step-text { flex: 1 1 auto; }
.steps .step-fig { flex: 0 0 auto; display: flex; gap: .5rem; align-items: flex-start; }
.steps .step-svg { width: 160px; height: auto; display: block; }
.steps .step-inset { width: 120px; }
@media (max-width: 575.98px) {
    .steps .step-row { flex-direction: column; }
    .steps .step-svg { width: 140px; }
    .steps .step-inset { width: 100px; }
}

/* Big ideas cards */
.idea .idea-svg { width: 100%; max-width: 220px; height: auto; display: block; margin: 0 auto .75rem; }
.idea h3 { font-size: 1.1rem; }
.flow-dash { animation: flowMove 1s infinite linear; }
@media (prefers-reduced-motion: reduce) { .flow-dash { animation: none; } }

/* Shown if the Creative Commons badge image can't load */
.cc-fallback {
    display: inline-block;
    border: 2px solid currentColor;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .5px;
    white-space: nowrap;
    vertical-align: middle;
}
.card-elektro .cc-fallback { color: #2c3e50; }
.cc-badge { display: inline-block; vertical-align: middle; }

/* Video pop-up and callouts */
.video-modal .modal-content { background: #1E4F82; color: #ffffff; border: 0; border-radius: 16px; overflow: hidden; }
.video-modal .modal-header { border-bottom: 0; }
.video-modal .modal-title { font-family: "Orbitron", sans-serif; font-size: 1.25rem; margin: 0; color: #ffffff; }
.btn-video {
    border: 2px solid #ffffff;
    color: #ffffff;
    font-weight: 700;
    background: transparent;
}
.btn-video:hover, .btn-video:focus { background: #ffffff; color: #1E4F82; }
.video-card {
    display: block;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    text-decoration: none;
}
.video-card img { width: 100%; height: auto; display: block; opacity: .85; transition: opacity .2s; }
.video-card:hover img, .video-card:focus img { opacity: 1; }
.video-card .play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #E45C2C;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
