/* ============================================================
   RUTAS DEL HOME — rediseño animado
   #ruta : ruta horizontal con scroll sticky sobre "código esqueleto"
   #rutas: tarjeta de ruta con reveal escalonado
   Vanilla CSS/JS (rutas-home.js). Respeta prefers-reduced-motion.
============================================================ */
:root {
    --rh-accent: var(--primary-color, #fbfb9a);
    --rh-accent-dim: rgba(251, 251, 154, .14);
    --rh-accent-ink: var(--secondary-color, #161616);
    --rh-line: #33332d;
    --rh-mono: ui-monospace, "JetBrains Mono", Consolas, monospace;
}

/* ---------- Sección #ruta: ruta horizontal ---------- */
.ruta-track { position: relative; height: 300vh; background-color: var(--surface-bg-alt, #111); }
.ruta-stage { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; overflow: hidden; }

.code-bg {
    position: absolute; inset: -12% 0; pointer-events: none; display: flex; justify-content: center;
    will-change: transform; opacity: .55; filter: blur(1.4px); --e: 0; --sh: 0;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 78%, transparent 100%), linear-gradient(transparent 0, #000 25%, #000 75%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 78%, transparent 100%), linear-gradient(transparent 0, #000 25%, #000 75%, transparent 100%);
    mask-composite: intersect;
}
.code-bg .code { width: min(1400px, 100%); display: flex; flex-direction: column; gap: 16px; padding-left: 6%; }
.code-bg .row-code { display: flex; gap: 10px; height: 10px; }
.code-bg .bar {
    height: 10px; border-radius: 5px; flex: none; background-color: var(--c);
    background-image: linear-gradient(90deg, transparent 0 42%, rgba(255, 255, 235, calc(var(--e) * .16)) 50%, transparent 58% 100%);
    background-size: 900px 100%; background-repeat: repeat-x;
    background-position-x: calc((var(--sh) + var(--o)) * 1px);
}
.code-bg .bar.t1 { --c: #2a2a26; }
.code-bg .bar.t2 { --c: #34342e; }
.code-bg .bar.t3 { --c: rgba(251, 251, 154, .13); }
.code-bg .caret { width: 10px; height: 14px; margin-top: -2px; border-radius: 2px; background: var(--rh-accent); animation: rh-blink 1.1s steps(1) infinite; }
@keyframes rh-blink { 50% { opacity: 0; } }
.ruta-veil { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 62% 52% at 50% 60%, var(--surface-bg-alt, #111) 0%, transparent 78%); opacity: .8; }

.ruta-stage .container { position: relative; }
.ruta-head { text-align: center; margin-bottom: 8px; }
.ruta-head .section-title { margin-bottom: 10px; }

.ruta-levels { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 44px; padding-block: 96px 40px; }
.ruta-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ruta-links .ln { fill: none; stroke: var(--rh-accent); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.ruta-links .ln-ghost { fill: none; stroke: var(--rh-line); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 2 7; }
.ruta-links .head { fill: none; stroke: var(--rh-accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.ruta-links .tip { fill: var(--rh-accent); opacity: 0; filter: drop-shadow(0 0 6px var(--rh-accent)); }

.ruta-level { position: relative; display: flex; flex-direction: column; align-items: center; gap: 22px; will-change: transform, opacity; min-width: 0; }
.ruta-badge {
    width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 18px;
    position: relative; z-index: 1; background: var(--surface-2, #2a2a2a); color: #8b8b8b; border: 1.5px solid var(--rh-line);
    transition: background .35s, color .35s, border-color .35s, box-shadow .35s, transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.ruta-level.on .ruta-badge { background: var(--rh-accent); color: var(--rh-accent-ink); border-color: var(--rh-accent); box-shadow: 0 0 0 6px var(--rh-accent-dim); transform: scale(1.06); }
.ruta-card {
    width: 100%; display: flex; flex-direction: column; background: var(--surface-1, #1e1e1e); border: 1px solid var(--rh-line);
    border-radius: 14px; padding: 26px 22px 22px; text-align: center; position: relative; z-index: 1;
    transition: border-color .3s, transform .3s, box-shadow .3s;
}
.ruta-card:hover { border-color: rgba(251, 251, 154, .45); transform: translateY(-4px); box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .8); }
.ruta-card .lvl { font-family: var(--rh-mono); font-size: 12px; letter-spacing: .14em; color: var(--rh-accent); font-weight: 500; text-transform: uppercase; }
.ruta-card h3 { font-size: 19px; font-weight: 700; color: #FCFCFC; margin: 6px 0 8px; line-height: 1.2; }
.ruta-card p { font-size: 14px; color: #8b8b8b; margin: 0 0 18px; min-height: 3em; }
.ruta-card .btn { margin-top: auto; }

/* ---------- Sección #rutas: tarjeta que se arma de arriba hacia abajo ---------- */
.pack { background: var(--surface-1, #1e1e1e); border: 1px solid var(--rh-line); border-radius: 18px; overflow: hidden; transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1); }
.pack-head { padding: 28px 32px; border-bottom: 1px solid var(--rh-line); }
.pack-head .k { font-family: var(--rh-mono); font-size: 12px; letter-spacing: .14em; color: #8b8b8b; text-transform: uppercase; }
.pack-head h3 { font-size: 24px; font-weight: 800; color: #FCFCFC; margin: 6px 0 2px; }
.pack-head p { margin: 0; color: #8b8b8b; }
.pack-steps { list-style: none; margin: 0; padding: 24px 20px; display: flex; flex-direction: column; }
.pack-step {
    position: relative; display: flex; align-items: center; gap: 16px; padding: 12px; border-radius: 12px; cursor: pointer;
    transition: opacity .5s ease, transform .5s cubic-bezier(.2, .8, .2, 1), background .25s;
    transition-delay: calc(var(--i) * 140ms + 200ms), calc(var(--i) * 140ms + 200ms), 0s;
}
.pack-step + .pack-step { margin-top: 22px; }
.pack-step:not(:last-child)::after {
    content: ""; position: absolute; left: 37px; top: calc(100% - 6px); width: 2px; height: 34px; border-radius: 2px;
    background: linear-gradient(var(--rh-accent), rgba(251, 251, 154, .15)); transform-origin: top; transform: scaleY(1);
    transition: transform .45s ease; transition-delay: calc(var(--i) * 140ms + 420ms);
}
.pack-dot {
    flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--rh-accent);
    background: var(--surface-2, #2a2a2a); border: 1.5px solid rgba(251, 251, 154, .35); position: relative; z-index: 1;
    transition: background .25s, color .25s, transform .3s cubic-bezier(.3, 1.6, .5, 1), box-shadow .25s;
}
.pack-step-a { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; color: inherit; text-decoration: none; outline: none; }
.pack-step-txt { min-width: 0; flex: 1; }
.pack-step-title { font-size: 19px; font-weight: 600; color: #FCFCFC; display: block; }
.pack-step-meta { font-family: var(--rh-mono); font-size: 12px; color: #8b8b8b; display: block; max-height: 0; opacity: 0; overflow: hidden; transition: max-height .3s ease, opacity .3s ease; }
.pack-go { color: var(--rh-accent); opacity: 0; transform: translateX(-8px); transition: opacity .25s, transform .25s; font-size: 20px; }
.pack-step:hover, .pack-step:focus-within { background: var(--surface-2, #2a2a2a); transform: scale(1.025); outline: none; }
.pack-step:hover .pack-dot, .pack-step:focus-within .pack-dot { background: var(--rh-accent); color: var(--rh-accent-ink); transform: scale(1.12); box-shadow: 0 0 0 6px var(--rh-accent-dim); }
.pack-step:hover .pack-step-meta, .pack-step:focus-within .pack-step-meta { max-height: 20px; opacity: 1; }
.pack-step:hover .pack-go, .pack-step:focus-within .pack-go { opacity: 1; transform: none; }
.pack-steps:hover .pack-step:not(:hover) { opacity: .55; }

.pack-foot {
    padding: 24px 32px 28px; border-top: 1px solid var(--rh-line); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    transition: opacity .5s ease .9s, transform .5s ease .9s;
}
.pack-foot .k { font-family: var(--rh-mono); font-size: 12px; letter-spacing: .12em; color: #8b8b8b; text-transform: uppercase; }
.pack-price { font-size: 26px; font-weight: 800; color: #FCFCFC; margin: 2px 0; }
.pack-price-old { color: #8b8b8b; font-size: 15px; }
.pack-price-old s { text-decoration-color: var(--rh-accent); }
.pack-cta { position: relative; overflow: hidden; }
.pack-cta::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .7) 50%, transparent 70%); transform: translateX(-120%); pointer-events: none; }
.pack.in .pack-cta::after { animation: rh-shine 1.2s ease 1.5s; }
.pack-cta:hover::after { animation: rh-shine .9s ease; }
@keyframes rh-shine { to { transform: translateX(120%); } }

.js .pack:not(.in) { opacity: .3; transform: translateY(24px); }
.js .pack:not(.in) .pack-step { opacity: 0; transform: translateY(-14px); }
.js .pack:not(.in) .pack-step::after { transform: scaleY(0); }
.js .pack:not(.in) .pack-foot { opacity: 0; transform: translateY(10px); }
.js .pack:not(.in) .pack-step, .js .pack:not(.in) .pack-step::after, .js .pack:not(.in) .pack-foot { transition-delay: 0s; }

@media (max-height: 760px) and (min-width: 861px) {
    .ruta-levels { padding-block: 80px 32px; }
    .ruta-card { padding: 20px 18px 18px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
    .ruta-track { height: auto; }
    .ruta-stage { position: relative; height: auto; padding-block: 48px; }
    .ruta-levels { grid-template-columns: 1fr; max-width: 440px; margin: 0 auto; gap: 40px; padding-block: 24px; }
    .ruta-level { flex-direction: row; align-items: flex-start; gap: 18px; }
    .ruta-card { text-align: left; }
    .ruta-card p { min-height: 0; }
    .code-bg .code { gap: 14px; padding-left: 4%; }
    .pack-head, .pack-foot { padding-left: 22px; padding-right: 22px; }
    .pack-steps { padding: 18px 10px; }
}

/* Reducir movimiento: se conservan las transiciones de aparición (#pack y niveles de la ruta);
   solo se apagan las animaciones decorativas: cursor titilante y destello del CTA.
   El parallax y el brillo del código los apaga rutas-home.js. */
@media (prefers-reduced-motion: reduce) {
    .code-bg .caret, .pack-cta::after { animation: none !important; }
}
