/* ===== SECTION-SPECIFIC STYLES ===== */

/* ---- Programa original ---- */
.programa-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    align-items: start;
}
.programa-card {
    background: linear-gradient(160deg, var(--surface), rgba(11, 16, 32, 0.7));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    position: relative;
    overflow: hidden;
}
.programa-card::before {
    content: ""; position: absolute; top: -2px; left: -2px; right: -2px; height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
}
.programa-card dl {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 14px 24px;
    margin: 0;
    font-size: .94rem;
}
.programa-card dt { color: var(--text-muted); font-weight: 500; }
.programa-card dd { margin: 0; color: var(--text); font-family: var(--font-mono); font-size: .88rem; }

.stack-list {
    display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none;
}
.stack-list li {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.stack-list li::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 0 4px rgba(255,154,61,.18);
}
.stack-list strong { color: var(--text); }
.stack-list span { color: var(--text-muted); font-size: .88rem; margin-left: auto; font-family: var(--font-mono); }

@media (max-width: 820px) {
    .programa-grid { grid-template-columns: 1fr; }
    .programa-card dl { grid-template-columns: 1fr; gap: 4px 0; }
    .programa-card dt { margin-top: 10px; }
}

/* ---- Módulos grid ---- */
.modulos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 22px;
}
.modulo-card {
    cursor: pointer;
    --clr: var(--accent);
    /* El fondo lo aporta .card (opaco). Aquí solo refuerzo el borde y el inset. */
    border: 1px solid rgba(148, 165, 204, 0.24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.modulo-card:hover {
    border-color: var(--clr);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.02);
}
.modulo-card .card__icon {
    background: rgba(255, 255, 255, 0.04);
    color: var(--clr);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06),
                0 6px 22px rgba(0, 0, 0, 0.25);
}
.modulo-card .card__title { color: #ffffff; font-weight: 600; }
.modulo-card .card__desc { color: #d3dbef; }
.modulo-card .card__stats {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 18px; margin-top: 18px;
    border-top: 1px dashed rgba(148, 165, 204, 0.25);
    font-family: var(--font-mono); font-size: .82rem;
    color: #98a3bf;
}
.modulo-card .card__stats b { color: var(--clr); font-weight: 700; }

/* ---- Tablas section ---- */
.tablas-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
}
.top-tablas {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
}
.top-tablas ol { margin: 0; padding: 0; list-style: none; counter-reset: trk; }
.top-tablas li {
    counter-increment: trk;
    display: grid;
    grid-template-columns: 40px 1fr 100px;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: calc(var(--radius) - 4px);
    position: relative;
    transition: background .25s ease;
}
.top-tablas li::before {
    content: counter(trk, decimal-leading-zero);
    font-family: var(--font-mono); color: var(--text-muted);
    font-size: .82rem;
}
.top-tablas li:hover { background: rgba(255,255,255,.03); }
.top-tablas .t-name { font-weight: 500; font-family: var(--font-mono); font-size: .88rem; color: var(--text); }
.top-tablas .t-meta { font-size: .78rem; color: var(--text-muted); }
.top-tablas .t-rows { text-align: right; font-family: var(--font-mono); color: var(--accent); font-size: .88rem; font-weight: 600; }
.top-tablas .t-bar {
    position: absolute; left: 0; right: 0; bottom: 4px; height: 2px;
    margin: 0 18px;
    background: linear-gradient(90deg, var(--accent), transparent);
    border-radius: 2px;
    opacity: .35;
    transform-origin: left;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}
.chart-card h5 { margin: 0 0 20px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; font-weight: 600; }
.chart-holder { position: relative; width: 100%; }
.chart-holder canvas { max-width: 100%; position: relative; z-index: 2; display: block; }
.chart-skeleton {
    position: absolute; inset: 0; z-index: 1;
    background:
        linear-gradient(100deg, transparent 30%, rgba(148, 165, 204, 0.08) 50%, transparent 70%) 0 0 / 200% 100% no-repeat,
        rgba(148, 165, 204, 0.04);
    border-radius: 12px;
    animation: shimmer 1.6s ease-in-out infinite;
    transition: opacity .4s;
}
.chart-holder.is-ready .chart-skeleton { opacity: 0; pointer-events: none; }
@keyframes shimmer {
    0% { background-position: 100% 0, 0 0; }
    100% { background-position: -100% 0, 0 0; }
}

@media (max-width: 900px) { .tablas-layout { grid-template-columns: 1fr; } }

/* ---- Flujos (scrollytelling) ---- */
.flujos-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.flujo-tab {
    padding: 10px 20px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: .88rem;
    cursor: pointer;
    font-weight: 500;
    transition: all .2s ease;
}
.flujo-tab.is-active {
    background: rgba(255, 154, 61, 0.14);
    border-color: rgba(255, 154, 61, 0.35);
    color: var(--accent);
}
.flujo-tab:hover:not(.is-active) { border-color: var(--border-strong); color: var(--text); }

.flujo-header { margin-bottom: 24px; }
.flujo-header h3 { margin-bottom: 6px; }
.flujo-header p { color: var(--text-muted); margin: 0; }

.flujo-steps { position: relative; }
.flujo-steps::before {
    content: "";
    position: absolute; left: 24px; top: 12px; bottom: 12px;
    width: 2px;
    background: linear-gradient(180deg, var(--accent), transparent);
    opacity: .4;
}
.flujo-step {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 24px;
    margin-bottom: 24px;
    padding: 18px 18px 18px 0;
    border-radius: var(--radius);
    transition: background .25s;
}
.flujo-step:hover { background: rgba(255,255,255,.02); }
.flujo-step__num {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--bg-1);
    border: 2px solid var(--accent);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700;
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 0 6px var(--bg-0);
}
.flujo-step__content h5 { margin: 4px 0 8px; font-size: 1.1rem; }
.flujo-step__content p { margin: 0 0 12px; color: var(--text-soft); font-size: .92rem; }
.flujo-step__content pre {
    margin: 0;
    font-size: .78rem;
    padding: 14px 18px;
    border-left: 3px solid var(--accent);
    max-height: 180px;
}

/* ---- Integraciones grid ---- */
.integ-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 20px;
}
.integ-card { padding: 24px; --clr: var(--accent); }
.integ-card__head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 16px;
}
.integ-card__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px;
}
.integ-card__cat {
    font-size: .75rem; text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--text-muted);
}
.integ-card__badge {
    font-size: .72rem;
    padding: 3px 10px; border-radius: 999px;
    font-weight: 600;
}
.integ-card p { font-size: .92rem; margin-bottom: 14px; }
.integ-card__impl, .integ-card__reempl {
    font-size: .84rem;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 10px;
}
.integ-card__impl {
    background: rgba(148, 165, 204, 0.06);
    color: var(--text-muted);
    border-left: 3px solid var(--text-muted);
}
.integ-card__reempl {
    background: rgba(255, 154, 61, 0.07);
    color: var(--text);
    border-left: 3px solid var(--accent);
}
.integ-card__reempl strong { color: var(--accent); }

/* ---- Fases timeline ---- */
.timeline {
    position: relative;
    padding: 40px 0;
    max-width: 960px;
    margin: 0 auto;
}
.timeline::before {
    content: "";
    position: absolute; left: 50%; top: 0; bottom: 0;
    width: 2px; background: var(--border);
    transform: translateX(-50%);
}
.timeline-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 48px;
    position: relative;
}
.timeline-item:nth-child(even) { direction: rtl; }
.timeline-item:nth-child(even) > * { direction: ltr; }
.timeline-item::before {
    content: "";
    position: absolute; left: 50%; top: 24px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--bg-0);
    border: 3px solid var(--accent);
    transform: translateX(-50%);
    z-index: 1;
    box-shadow: 0 0 0 6px var(--bg-0);
}
.timeline-item.is-highlight::before { box-shadow: 0 0 0 6px var(--bg-0), 0 0 24px var(--accent); }
.timeline-item__card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 26px;
    position: relative;
}
.timeline-item__card h5 { margin: 0 0 6px; display: flex; align-items: center; gap: 10px; }
.timeline-item__card h5 .tl-id {
    font-family: var(--font-mono);
    font-size: .72rem;
    padding: 3px 9px;
    border-radius: 6px;
    background: rgba(255, 154, 61, 0.12);
    color: var(--accent);
    font-weight: 600;
}
.timeline-item__card .tl-duration {
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--accent-2);
    margin-bottom: 10px;
}
.timeline-item__card p { margin: 0; font-size: .9rem; color: var(--text-soft); }
.timeline-item__spacer { display: block; }
.timeline-item:nth-child(odd) .timeline-item__card::after {
    content: ""; position: absolute; right: -12px; top: 28px;
    width: 0; height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 12px solid var(--border);
}
.timeline-item:nth-child(even) .timeline-item__card::after {
    content: ""; position: absolute; left: -12px; top: 28px;
    width: 0; height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 12px solid var(--border);
}
.timeline-summary {
    text-align: center; margin-top: 40px;
    padding: 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    max-width: 500px; margin-left: auto; margin-right: auto;
    font-family: var(--font-mono);
    color: var(--text-muted);
}
.timeline-summary strong { color: var(--accent); font-family: var(--font-display); font-size: 1.25em; }

@media (max-width: 820px) {
    .timeline::before { left: 24px; }
    .timeline-item { grid-template-columns: 1fr; gap: 0; padding-left: 56px; direction: ltr !important; }
    .timeline-item::before { left: 24px; }
    .timeline-item__spacer { display: none; }
    .timeline-item__card::after { display: none !important; }
}

/* ---- Stack section ---- */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 22px;
}
.stack-col h4 {
    font-size: .82rem; text-transform: uppercase;
    letter-spacing: .18em; color: var(--accent);
    margin-bottom: 18px;
}
.stack-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.stack-col li {
    display: grid; grid-template-columns: 36px 1fr; align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .2s, transform .2s;
}
.stack-col li:hover { border-color: var(--border-strong); transform: translateX(4px); }
.stack-col .emoji { font-size: 1.2rem; }
.stack-col strong { display: block; font-weight: 600; font-size: .94rem; }
.stack-col em { color: var(--text-muted); font-size: .82rem; font-style: normal; }

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(5, 7, 14, 0.72);
    backdrop-filter: blur(8px);
    z-index: 100;
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.modal {
    background: var(--bg-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    max-width: 640px; width: 100%;
    padding: 36px;
    box-shadow: var(--shadow-2);
    transform: translateY(20px) scale(.97);
    transition: transform .3s cubic-bezier(.19,1,.22,1);
    max-height: 85vh; overflow-y: auto;
}
.modal-backdrop.is-open .modal { transform: none; }
.modal__close {
    position: absolute; top: 18px; right: 18px;
    width: 36px; height: 36px; border-radius: 50%;
    background: transparent; color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.modal__close:hover { color: var(--accent); border-color: var(--accent); }
.modal h4 { margin-top: 0; display: flex; align-items: center; gap: 14px; }
.modal h4 .card__icon { margin: 0; }
.modal__section { margin-bottom: 20px; }
.modal__section h5 { font-size: .78rem; text-transform: uppercase; letter-spacing: .15em; color: var(--text-muted); margin-bottom: 10px; font-weight: 600; }
.modal__tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- Particle canvas ---- */
#particles-bg { position: absolute; inset: 0; z-index: -1; opacity: .5; }

/* ---- Reveal variations ---- */
.reveal--left { transform: translateX(-40px); }
.reveal--right { transform: translateX(40px); }
.reveal--left.is-visible, .reveal--right.is-visible { transform: none; }
