/* ============================================================
   TALLER DE INGENIERÍA · Programa PRI
   ------------------------------------------------------------
   Hoja compartida por los talleres de Estática, Dinámica y
   Álgebra Lineal. Corrige de raíz lo que estorbaba en los
   talleres de ICFES:

   · La lámina de 100vh con overflow:hidden obligaba a apretar
     el texto hasta que no se podía leer. Aquí la página SE
     DESPLAZA y el contenido respira.
   · La letra sube a 17px de base (los de ICFES iban a 13).
   · Las fórmulas van en su propio renglón, centradas y con
     aire, nunca metidas en mitad de un párrafo.
   · Las opciones de respuesta son botones grandes, de 52 px de
     alto mínimo: se pueden tocar con el dedo sin fallar.
   · La retroalimentación aparece DEBAJO, empujando el
     contenido; no se superpone a nada.

   Paleta y tipografía heredadas del sitio.
   ============================================================ */

:root {
    --ti-fondo:    #04080f;
    --ti-lamina:   #0a1322;
    --ti-borde:    rgba(124, 58, 237, .22);
    --ti-texto:    #e8f4ff;
    --ti-suave:    #9fb6cc;
    --ti-tenue:    #6b8ba8;
    --ti-morado:   #7c3aed;
    --ti-celeste:  #38bdf8;
    --ti-naranja:  #ff5e00;
    --ti-verde:    #10b981;
    --ti-oro:      #fbbf24;
    --ti-rojo:     #ef4444;
}

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

html {
    background: var(--ti-fondo);
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}
/* clip y no hidden: hidden en html Y body a la vez fue lo que
   rompió el scroll táctil en Android. No se repite. */
html { overflow-x: clip; }
@supports not (overflow-x: clip) { html { overflow-x: hidden; } }

body {
    background: var(--ti-fondo);
    color: var(--ti-texto);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1.65;
    padding-block: 0 5rem;
}

/* ══ Cabecera fija con el progreso ═════════════════════════ */
.ti-barra {
    position: sticky; top: 0; z-index: 50;
    background: rgba(4, 8, 15, .92);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.ti-barra-int {
    max-width: 860px; margin: 0 auto;
    padding: .7rem 1.1rem;
    display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
}
.ti-volver {
    color: var(--ti-suave); text-decoration: none; font-size: .88rem;
    font-weight: 700; white-space: nowrap;
}
.ti-volver:hover { color: var(--ti-celeste); }
.ti-migaja { font-size: .76rem; letter-spacing: .12em; text-transform: uppercase;
             color: var(--ti-tenue); font-weight: 800; }
.ti-prog { flex: 1; min-width: 120px; height: 6px; border-radius: 3px;
           background: rgba(255, 255, 255, .07); overflow: hidden; }
.ti-prog i { display: block; height: 100%; width: 0;
             background: linear-gradient(90deg, var(--ti-morado), var(--ti-naranja), var(--ti-celeste));
             transition: width .5s cubic-bezier(.2, .9, .3, 1); }
.ti-prog-txt { font-size: .8rem; color: var(--ti-suave); font-variant-numeric: tabular-nums; }

/* ══ Cuerpo ════════════════════════════════════════════════ */
/* El aire de abajo es para la ballena: va fija en esa esquina y si
   no se deja sitio se queda encima del último botón. */
.ti-hoja { max-width: 860px; margin: 0 auto; padding: 0 1.1rem 6rem; }

.ti-portada { padding: 2.4rem 0 1.4rem; }
.ti-etiqueta {
    font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
    color: var(--ti-celeste); font-weight: 800; margin-bottom: .7rem;
}
.ti-portada h1 {
    font-size: clamp(1.8rem, 5.5vw, 2.7rem); line-height: 1.15;
    font-weight: 900; letter-spacing: -.02em; margin-bottom: .7rem;
}
.ti-portada p.ti-entrada { font-size: 1.06rem; color: var(--ti-suave); max-width: 62ch; }

.ti-fuente {
    margin-top: 1.3rem; padding: .85rem 1.1rem;
    border-radius: 12px; border: 1px solid rgba(56, 189, 248, .2);
    background: rgba(56, 189, 248, .06);
    font-size: .88rem; color: var(--ti-suave);
}
.ti-fuente b { color: var(--ti-celeste); }

/* ── Secciones ──────────────────────────────────────────── */
.ti-seccion {
    margin: 2.6rem 0; padding: 1.6rem 1.5rem;
    background: var(--ti-lamina);
    border: 1px solid var(--ti-borde);
    border-radius: 18px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .4);
}
.ti-seccion > h2 {
    font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em;
    margin-bottom: .3rem; display: flex; align-items: baseline; gap: .6rem;
}
.ti-seccion > h2 .ti-num {
    font-size: .72rem; font-weight: 900; letter-spacing: .1em;
    color: var(--ti-morado); background: rgba(124, 58, 237, .16);
    border: 1px solid rgba(124, 58, 237, .32);
    border-radius: 7px; padding: .2rem .5rem; flex-shrink: 0;
}
.ti-seccion > h3 {
    font-size: 1.02rem; font-weight: 800; color: var(--ti-celeste);
    margin: 1.6rem 0 .5rem;
}
.ti-seccion p { margin: .8rem 0; max-width: 68ch; }
.ti-seccion ul, .ti-seccion ol { margin: .8rem 0 .8rem 1.3rem; }
.ti-seccion li { margin: .45rem 0; }

/* ── Fórmulas: SIEMPRE en su propio renglón ─────────────── */
.ti-formula {
    margin: 1.5rem 0;
    padding: 1.15rem 1.2rem;
    border-radius: 14px;
    background: rgba(124, 58, 237, .08);
    border: 1px solid rgba(124, 58, 237, .24);
    border-left: 3px solid var(--ti-morado);
    overflow-x: auto; overflow-y: hidden;
    text-align: center;
}
.ti-formula .katex { font-size: 1.35em; }
.ti-formula .katex-display { margin: 0; }
.ti-formula .ti-pie {
    display: block; margin-top: .7rem; font-size: .84rem;
    color: var(--ti-tenue); text-align: center;
}

/* ── El despeje paso a paso ─────────────────────────────── */
.ti-pasos { margin: 1.4rem 0; counter-reset: paso; }
.ti-paso {
    position: relative;
    margin: 0 0 .9rem;
    padding: 1rem 1.1rem 1rem 3.2rem;
    border-radius: 13px;
    background: rgba(255, 255, 255, .028);
    border: 1px solid rgba(255, 255, 255, .07);
}
.ti-paso::before {
    counter-increment: paso; content: counter(paso);
    position: absolute; left: .95rem; top: 1rem;
    width: 1.7rem; height: 1.7rem; border-radius: 50%;
    display: grid; place-items: center;
    font-size: .82rem; font-weight: 900; color: #fff;
    background: var(--ti-morado);
    background-image: radial-gradient(circle at 32% 28%,
        rgba(255,255,255,.5), rgba(0,0,0,.25));
    box-shadow: 0 3px 9px rgba(0, 0, 0, .45);
}
.ti-paso .ti-porque {
    display: block; font-size: .87rem; color: var(--ti-suave);
    margin-bottom: .5rem;
}
.ti-paso .katex { font-size: 1.14em; }
.ti-paso .ti-mate { overflow-x: auto; overflow-y: hidden; padding: .15rem 0; }
.ti-paso.ti-paso-final {
    border-color: rgba(16, 185, 129, .35);
    background: rgba(16, 185, 129, .07);
}
.ti-paso.ti-paso-final::before { background: var(--ti-verde); }

/* ── Avisos ─────────────────────────────────────────────── */
.ti-nota, .ti-ojo {
    margin: 1.3rem 0; padding: .95rem 1.1rem;
    border-radius: 12px; font-size: .95rem;
}
.ti-nota { background: rgba(56, 189, 248, .07); border: 1px solid rgba(56, 189, 248, .22); }
.ti-ojo  { background: rgba(251, 191, 36, .07); border: 1px solid rgba(251, 191, 36, .28); }
.ti-nota b, .ti-ojo b { display: block; margin-bottom: .3rem; }
.ti-nota b { color: var(--ti-celeste); }
.ti-ojo  b { color: var(--ti-oro); }

/* ── Qué significa cada símbolo ─────────────────────────── */
.ti-simbolos {
    margin: -.4rem 0 1.4rem; padding: .85rem 1.1rem;
    border-radius: 12px; font-size: .93rem;
    background: rgba(124, 58, 237, .06); border: 1px solid var(--ti-borde);
}
.ti-simbolos > b { display: block; margin-bottom: .45rem; color: #b69cff; font-size: .9rem; }
.ti-simbolos dl {
    display: grid; grid-template-columns: max-content 1fr;
    gap: .35rem .9rem; margin: 0; align-items: baseline;
}
.ti-simbolos dt { margin: 0; text-align: right; white-space: nowrap; }
.ti-simbolos dd { margin: 0; color: var(--ti-suave); }
.ti-simbolos dd i.u { font-style: normal; color: var(--ti-tenue); white-space: nowrap; }
@media (max-width: 480px) {
    .ti-simbolos dl { grid-template-columns: 1fr; gap: .1rem; }
    .ti-simbolos dt { text-align: left; margin-top: .35rem; }
}

/* ══ Visor 3D ══════════════════════════════════════════════ */
.v3d {
    position: relative;
    margin: 1.5rem 0;
    height: clamp(280px, 46vw, 400px);
    border-radius: 16px;
    background: radial-gradient(ellipse at 50% 40%, #071427 0%, #03080f 100%);
    border: 1px solid rgba(56, 189, 248, .2);
    overflow: hidden;
}
.v3d-lienzo { display: block; width: 100%; height: 100%; cursor: grab; }
.v3d-lienzo:active { cursor: grabbing; }
.v3d-ayuda {
    position: absolute; left: 50%; bottom: .7rem; transform: translateX(-50%);
    font-size: .76rem; color: var(--ti-tenue);
    background: rgba(2, 8, 20, .7); padding: .25rem .7rem; border-radius: 999px;
    pointer-events: none; transition: opacity .4s ease;
}
.v3d-reset {
    position: absolute; right: .6rem; top: .6rem;
    width: 2rem; height: 2rem; border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, .16);
    background: rgba(2, 8, 20, .62); color: var(--ti-suave);
    font-size: 1rem; cursor: pointer; line-height: 1;
}
.v3d-reset:hover { color: #fff; border-color: var(--ti-celeste); }
.v3d-titulo {
    font-size: .84rem; color: var(--ti-tenue); text-align: center;
    margin: -.9rem 0 1.5rem;
}

/* ══ Cuestionario ══════════════════════════════════════════
   Opciones grandes y retroalimentación DEBAJO. Antes las
   opciones eran diminutas y el mensaje tapaba la pregunta. */
.ti-pregunta {
    margin: 1.5rem 0;
    padding: 1.3rem 1.2rem;
    border-radius: 15px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .09);
}
.ti-pregunta > .ti-p-num {
    font-size: .73rem; letter-spacing: .14em; text-transform: uppercase;
    color: var(--ti-tenue); font-weight: 800; margin-bottom: .55rem;
}
.ti-pregunta > .ti-p-txt { font-size: 1.02rem; font-weight: 600; margin-bottom: 1rem; }

.ti-opciones { display: grid; gap: .6rem; }
.ti-opcion {
    display: flex; align-items: center; gap: .85rem;
    width: 100%; min-height: 52px;
    padding: .8rem 1rem;
    border-radius: 12px;
    border: 1.5px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .035);
    color: var(--ti-texto);
    font-family: inherit; font-size: 1rem; line-height: 1.45;
    text-align: left; cursor: pointer;
    transition: transform .22s cubic-bezier(.2,.9,.3,1.25),
                border-color .2s, background .2s, box-shadow .22s;
}
.ti-opcion .ti-letra {
    flex-shrink: 0; width: 1.85rem; height: 1.85rem; border-radius: 50%;
    display: grid; place-items: center;
    font-size: .85rem; font-weight: 900;
    background: rgba(124, 58, 237, .2); border: 1px solid rgba(124, 58, 237, .4);
}
.ti-opcion .katex { font-size: 1.06em; }
/* Un hijo de flex no baja de su ancho de contenido a menos que se le
   diga. Sin esto, una opción larga ensancha el botón, el botón ensancha
   la página y el teléfono acaba desplazándose de lado. */
.ti-opcion > span:last-child { min-width: 0; flex: 1; }
.ti-opcion > span.ti-mate-op { overflow-x: auto; overflow-y: hidden; }
.ti-opcion > span.ti-texto-op { white-space: normal; overflow-wrap: anywhere; }
/* Lo mismo para el enunciado de la pregunta */
.ti-pregunta > .ti-p-txt { overflow-x: auto; overflow-y: hidden; }
.ti-opcion:hover:not(:disabled) {
    transform: perspective(900px) translateZ(12px);
    border-color: var(--ti-morado); background: rgba(124, 58, 237, .14);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .4);
}
.ti-opcion:disabled { cursor: default; }
.ti-opcion.ti-bien {
    border-color: var(--ti-verde); background: rgba(16, 185, 129, .16); color: #c9f7e5;
}
.ti-opcion.ti-bien .ti-letra { background: var(--ti-verde); border-color: var(--ti-verde); color: #04201a; }
.ti-opcion.ti-mal {
    border-color: var(--ti-rojo); background: rgba(239, 68, 68, .13); color: #fecaca;
}
.ti-opcion.ti-mal .ti-letra { background: var(--ti-rojo); border-color: var(--ti-rojo); }

/* La retroalimentación empuja, no tapa */
.ti-fb {
    margin-top: .9rem; padding: .95rem 1.1rem;
    border-radius: 12px; font-size: .96rem; line-height: 1.6;
    display: none;
}
.ti-fb.abierta { display: block; animation: ti-entra .3s ease both; }
.ti-fb.ti-fb-bien { background: rgba(16, 185, 129, .1);  border: 1px solid rgba(16, 185, 129, .3); }
.ti-fb.ti-fb-mal  { background: rgba(239, 68, 68, .09);  border: 1px solid rgba(239, 68, 68, .28); }
.ti-fb b { display: block; margin-bottom: .35rem; }
.ti-fb .katex { font-size: 1.05em; }
@keyframes ti-entra { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ── Cierre ─────────────────────────────────────────────── */
.ti-cierre { text-align: center; padding: 2.2rem 0 1rem; }
.ti-btn {
    display: inline-flex; align-items: center; gap: .6rem;
    padding: .95rem 1.9rem; border-radius: 999px; border: none;
    background: linear-gradient(135deg, var(--ti-morado), var(--ti-naranja));
    color: #fff; font-family: inherit; font-size: 1rem; font-weight: 800;
    cursor: pointer; text-decoration: none;
    box-shadow: 0 10px 26px rgba(124, 58, 237, .35);
    transition: transform .22s cubic-bezier(.2,.9,.3,1.3), box-shadow .22s;
}
.ti-btn:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(124, 58, 237, .45); }
.ti-btn:active { transform: translateY(0); }
.ti-btn.ti-btn-sec {
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: none;
}

/* ══ Teléfono ══════════════════════════════════════════════ */
@media (max-width: 640px) {
    body { font-size: 16.5px; }
    .ti-hoja { padding: 0 .9rem 6rem; }
    .ti-seccion { padding: 1.2rem 1rem; border-radius: 15px; margin: 1.9rem 0; }
    .ti-paso { padding: .9rem .9rem .9rem 2.9rem; }
    .ti-formula { padding: .95rem .8rem; }
    .ti-formula .katex { font-size: 1.15em; }
    .ti-opcion { font-size: .97rem; padding: .75rem .85rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .ti-opcion:hover:not(:disabled) { transform: none; }
    .ti-btn:hover { transform: none; }
    .ti-fb.abierta { animation: none; }
}
/* ══ Mandos del visor 3D ═══════════════════════════════════════
   Las casillas para escribir las componentes del vector. Van
   debajo del lienzo, no encima: tapar el dibujo con los mandos
   es justo lo contrario de lo que se busca. */
.v3d-mandos {
    margin: -1.2rem 0 1.5rem;
    padding: .8rem .9rem;
    border-radius: 0 0 14px 14px;
    background: rgba(7, 20, 39, .75);
    border: 1px solid rgba(56, 189, 248, .2);
    border-top: none;
    display: flex; flex-direction: column; gap: .6rem;
}
.v3d-fila {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    font-size: .92rem;
}
.v3d-nom { font-weight: 900; font-size: 1.05rem; min-width: 1.6rem; }
.v3d-fila label {
    display: inline-flex; align-items: center; gap: .3rem;
    color: var(--ti-tenue); font-size: .85rem;
}
.v3d-fila input {
    width: 4.6rem; min-height: 40px;          /* se puede tocar con el dedo */
    padding: .35rem .5rem;
    border-radius: 8px; border: 1px solid rgba(255,255,255,.16);
    background: rgba(2, 8, 20, .8); color: var(--ti-texto);
    font-family: inherit; font-size: .95rem; text-align: center;
}
.v3d-fila input:focus { outline: none; border-color: var(--ti-celeste); }
.v3d-mag {
    flex: 1 1 100%; color: var(--ti-suave); font-size: .85rem;
    font-variant-numeric: tabular-nums;
}
@media (min-width: 640px) { .v3d-mag { flex: 1 1 auto; text-align: right; } }
