/* =============================================
   HOJA DE RUTA PYTHON — COLOMBIA (Estilos Definitivos)
   ============================================= */
:root {
  --bg:          #f4f6fa;
  --bg-2:        #ffffff;
  --bg-3:        #edf1f8;
  --border:      #d2dbee;
  --border-soft: #e3e8f4;

  --text:        #0d0d1a;
  --text-2:      #2a3352;
  --text-3:      #687294;

  --accent:      #306998;
  --accent-2:    #4b8bbe;
  --accent-light:#e2effb;
  --accent-inv:  #ffffff;

  --yellow:      #ffd43b;
  --yellow-dk:   #b89600;

  --sidebar-w:   240px;
  --sidebar-bg:  #141826;
  --sidebar-bdr: #232b42;

  --prog-bg:     #d4dff2;
  --prog-fill:   #ffd43b;

  --badge-prev-bg:    #e3e8f4;   --badge-prev-txt:  #4a5270;
  --badge-active-bg:  #ffd43b;   --badge-active-txt:#0d0d1a;
  --badge-next-bg:    #e2effb;   --badge-next-txt:  #306998;
  --badge-future-bg:  #eaedf6;   --badge-future-txt:#8890b0;

  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 4px 16px rgba(13,13,26,.06);
  --shadow-md:   0 10px 30px rgba(13,13,26,.10);
  --tr:          .25s cubic-bezier(0.4, 0, 0.2, 1);
  --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:        "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0d0d1a;
    --bg-2:        #121226;
    --bg-3:        #171730;
    --border:      #252b45;
    --border-soft: #1d2238;

    --text:        #f4f4f7;
    --text-2:      #a8b2cc;
    --text-3:      #5c668a;

    --accent:      #4b8bbe;
    --accent-2:    #6baed4;
    --accent-light:#0e2042;
    --accent-inv:  #0d0d1a;

    --yellow:      #ffd43b;
    --yellow-dk:   #ffe873;

    --sidebar-bg:  #0a0a16;
    --sidebar-bdr: #1e2238;

    --prog-bg:     #1e2238;
    --prog-fill:   #ffd43b;

    --shadow:      0 4px 20px rgba(0,0,0,.5);
    --shadow-md:   0 12px 36px rgba(0,0,0,.7);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

#read-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--yellow); z-index: 9999; transition: width 0.1s ease; pointer-events: none;
}

.container {
  max-width: 900px; margin-left: auto; margin-right: auto;
  padding-left: 1.5rem; padding-right: 1.5rem; width: 100%;
}

a { color: var(--accent); text-decoration: none; transition: color var(--tr); }
a:hover { color: var(--accent-2); text-decoration: underline; }
code {
  font-family: var(--mono); font-size: .84em; background: var(--code-bg, #e0e8f5);
  color: var(--code-text, #306998); padding: .15em .4em; border-radius: 4px;
}
h1, h2, h3, h4, h5 { font-weight: 600; letter-spacing: -.02em; line-height: 1.3; color: var(--text); }
ul { padding-left: 1.4rem; }
ul li { margin-bottom: .3rem; }

/* Layout y Sidebar */
body.sidebar-open .layout { padding-left: var(--sidebar-w); transition: padding-left var(--tr); }
.layout { display: flex; flex-direction: column; min-height: 100vh; transition: padding-left var(--tr); width: 100%; }

.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-w);
  background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-bdr);
  display: flex; flex-direction: column; z-index: 200; transform: translateX(-100%);
  transition: transform var(--tr); overflow: hidden; box-shadow: 6px 0 24px rgba(0,0,0,.25);
}
.sidebar.is-open { transform: translateX(0); }
.sidebar-header { display: flex; align-items: center; gap: .75rem; padding: 1.1rem; border-bottom: 1px solid var(--sidebar-bdr); flex-shrink: 0; }
.sidebar-brand { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #ffd43b; font-family: var(--mono); flex: 1; }
.sidebar-close { background: none; border: none; cursor: pointer; color: #8b96b5; font-size: 1rem; padding: .25rem .45rem; border-radius: var(--radius); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem 0; }
.sidebar-nav ul { list-style: none; padding: 0; }
.sidebar-link { display: block; padding: .5rem 1.1rem; font-size: .83rem; color: #a4afcc; text-decoration: none; border-left: 3px solid transparent; transition: all var(--tr); }
.sidebar-link:hover { background: rgba(255,255,255,0.04); color: #fff; }
.sidebar-link.is-active { color: #ffd43b; font-weight: 600; border-left-color: #ffd43b; background: rgba(255, 212, 59, 0.08); }
.sidebar-sub { list-style: none; padding: 0; }
.sidebar-sublink { display: block; padding: .35rem 1.1rem .35rem 2rem; font-size: .77rem; color: #7884a6; text-decoration: none; }
.sidebar-sublink:hover { color: #ffd43b; }
.sidebar-progress { padding: 1.1rem; border-top: 1px solid var(--sidebar-bdr); flex-shrink: 0; background: rgba(0,0,0,0.25); }
.sp-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #8b96b5; margin-bottom: .45rem; font-weight: 600; }
.sp-bar-wrap { height: 6px; background: var(--prog-bg); border-radius: 4px; overflow: hidden; margin-bottom: .4rem; }
.sp-bar { height: 100%; width: 0%; background: var(--prog-fill); border-radius: 4px; transition: width .4s ease; }
.sp-count { font-size: .74rem; font-family: var(--mono); color: #a4afcc; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(5, 5, 12, 0.65); z-index: 199; }
.sidebar-overlay.is-visible { display: block; }
.sidebar-reopen { position: fixed; top: 1.2rem; left: 0; z-index: 201; background: var(--sidebar-bg); border: 1px solid var(--sidebar-bdr); border-left: none; border-radius: 0 var(--radius) var(--radius) 0; padding: .6rem .7rem; cursor: pointer; color: #ffd43b; display: none; }
.sidebar-reopen.is-visible { display: flex; align-items: center; justify-content: center; }
.sidebar-fab { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 198; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--accent-inv); border: none; cursor: pointer; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md); }

@media (min-width: 900px) { .sidebar-fab { display: none; } }
@media (max-width: 899px) { .sidebar-reopen { display: none !important; } }

/* Hero */
.hero { border-bottom: 1px solid var(--border); padding: 5rem 0 4rem; background: linear-gradient(135deg, #0d0d1a 0%, #161a2e 100%); color: #fff; width: 100%; }
.cohort-label { font-size: .75rem; font-family: var(--mono); color: #ffd43b; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 1.2rem; display: flex; align-items: center; gap: .75rem; }
.cohort-label::before { content: ''; display: inline-flex; width: 58px; height: 9px; background: linear-gradient(to right, #e24329, #f58220, #ffd43b, #2fb350, #4b8bbe, #5c4ee5); border-radius: 3px; flex-shrink: 0; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 700; margin-bottom: 1.2rem; color: #ffffff; }
.hero h1 span { color: #ffd43b; }
.hero-desc { color: rgba(244,244,245,0.8); font-size: .98rem; line-height: 1.75; margin-bottom: 1.8rem; }
.hero-stats { display: flex; gap: 2rem; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.1); }
.hero-stat { display: flex; flex-direction: column; }
.stat-num { font-size: 1.8rem; font-weight: 700; font-family: var(--mono); color: #ffd43b; }
.stat-label { font-size: .78rem; text-transform: uppercase; color: rgba(255,255,255,0.6); margin-top: .2rem; }

/* Secciones y Animaciones */
main { width: 100%; }
main > section.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.5s ease, transform 0.5s ease; }
main > section.reveal.is-visible { opacity: 1; transform: translateY(0); }
main > section { padding: 4rem 0; border-bottom: 1px solid var(--border-soft); width: 100%; }
main > section:last-child { border-bottom: none; }
section h2 { font-size: 1.5rem; margin-bottom: .6rem; }
.section-desc { color: var(--text-2); font-size: .95rem; margin-bottom: 2rem; }

/* Tarjetas y componentes */
.principles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.2rem; margin-bottom: 1.25rem; }
.principle-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.35rem; box-shadow: var(--shadow); transition: transform 0.2s ease; }
.principle-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.principle-card h3 { font-size: .95rem; margin-bottom: .4rem; color: var(--accent); }
.principle-card p { font-size: .84rem; color: var(--text-2); }
.result-box { background: var(--accent-light); border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; padding: 1.1rem 1.35rem; font-size: .88rem; color: var(--text-2); box-shadow: var(--shadow); }

/* Fases */
.phases { list-style: none; padding: 0; }
.phase { display: flex; gap: 1.25rem; padding: 1.35rem 0; border-bottom: 1px solid var(--border-soft); align-items: flex-start; }
.phase-num { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .84rem; font-weight: 700; font-family: var(--mono); border: 2px solid var(--border); color: var(--text-3); background: var(--bg-2); }
.phase--active .phase-num { border-color: var(--accent); color: var(--accent-inv); background: var(--accent); }
.phase-body { flex: 1; }
.phase-body h3 { font-size: 1.05rem; margin-bottom: .3rem; }
.phase-body p { font-size: .89rem; color: var(--text-2); margin-bottom: .6rem; }

.badge { display: inline-block; font-size: .7rem; font-weight: 600; text-transform: uppercase; padding: .2em .65rem; border-radius: 20px; }
.badge--prev { background: var(--badge-prev-bg); color: var(--badge-prev-txt); }
.badge--active { background: var(--badge-active-bg); color: var(--badge-active-txt); font-weight: 700; }
.badge--next { background: var(--badge-next-bg); color: var(--badge-next-txt); }
.badge--future { background: var(--badge-future-bg); color: var(--badge-future-txt); }

/* Módulos Acordeones */
.module-card { border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 1.25rem; overflow: hidden; background: var(--bg-2); box-shadow: var(--shadow); }
.module-toggle { width: 100%; display: flex; align-items: center; gap: .85rem; padding: 1.2rem 1.35rem; background: var(--bg-2); border: none; cursor: pointer; text-align: left; color: var(--text); font-size: 1rem; }
.module-num { font-family: var(--mono); font-size: .75rem; font-weight: 700; background: var(--accent-light); color: var(--accent); padding: .2em .55rem; border-radius: 6px; }
.module-title { flex: 1; font-weight: 600; }
.module-hours { font-size: .77rem; font-family: var(--mono); color: var(--text-3); }
.module-chevron { font-size: 1.1rem; color: var(--text-3); transition: transform 0.2s ease; }
.module-toggle[aria-expanded="true"] .module-chevron { transform: rotate(45deg); color: var(--accent); }
.module-content { padding: 1.6rem 1.35rem; border-top: 1px solid var(--border-soft); background: var(--bg); }

/* Tablas */
.ficha-table { width: 100%; border-collapse: collapse; font-size: .87rem; margin-bottom: 1rem; background: var(--bg-2); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.ficha-table th, .ficha-table td { padding: .75rem 1rem; border: 1px solid var(--border-soft); vertical-align: top; text-align: left; }
.ficha-table th { width: 160px; font-weight: 600; background: var(--bg-3); color: var(--text-2); }

/* Videos Grid */
.video-section { margin-top: 1rem; }
.videos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.video-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform 0.2s ease; }
.video-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.video-placeholder { width: 100%; aspect-ratio: 16 / 9; background: var(--bg-3); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-3); border-bottom: 1px solid var(--border-soft); }
.video-icon { font-size: 2.2rem; margin-bottom: .4rem; color: var(--accent); }
.video-placeholder span { font-size: .8rem; font-family: var(--mono); }
.video-info { padding: 1.15rem; }
.video-info h3 { font-size: .98rem; margin-bottom: .35rem; }
.video-info p { font-size: .84rem; color: var(--text-2); }
.repo-link { display: inline-block; font-size: .77rem; font-family: var(--mono); padding: .3em .75rem; border: 1px solid var(--accent); border-radius: var(--radius); color: var(--accent); width: fit-content; margin-top: .5rem; }
.repo-link:hover { background: var(--accent-light); text-decoration: none; }

/* Checklist */
.checklist-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; gap: .75rem; }
.cl-reset-btn { font-size: .8rem; padding: .4rem .9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); color: var(--text-2); cursor: pointer; }
.cl-global-count { font-size: .82rem; font-family: var(--mono); color: var(--text-3); font-weight: 600; }
.cl-block { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-2); margin-bottom: 1rem; box-shadow: var(--shadow); }
.cl-block-header { display: flex; justify-content: space-between; align-items: center; padding: .85rem 1.25rem; background: var(--bg-3); border-bottom: 1px solid var(--border); }
.cl-block-title { font-size: .88rem; font-weight: 600; }
.cl-block-count { font-size: .76rem; font-family: var(--mono); color: var(--text-3); background: var(--bg-2); padding: .15em .55rem; border-radius: 4px; }
.cl-list { list-style: none; padding: 0; }
.cl-list li { border-bottom: 1px solid var(--border-soft); }
.cl-list label { display: flex; align-items: flex-start; gap: .8rem; padding: .7rem 1.25rem; cursor: pointer; font-size: .85rem; color: var(--text-2); }
.cl-list input[type="checkbox"] { margin-top: .2rem; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.cl-list li.is-checked label { color: var(--text-3); text-decoration: line-through; opacity: .65; }

/* Confeti */
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(120px) rotate(360deg); opacity: 0; }
}
.confetti-particle {
  position: fixed; top: 40%; width: 8px; height: 8px; border-radius: 50%; z-index: 99999;
  animation: confettiFall 1.8s ease-out forwards; pointer-events: none;
}

/* Playground */
.playground-area { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.playground-editor, .playground-output { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-2); box-shadow: var(--shadow); }
.editor-toolbar, .output-label { display: flex; align-items: center; gap: .5rem; padding: .65rem 1rem; background: var(--bg-3); border-bottom: 1px solid var(--border); font-size: .74rem; font-family: var(--mono); color: var(--text-3); font-weight: 600; }
.run-btn { background: var(--yellow); color: #0d0d1a; border: none; font-weight: 700; padding: .35rem .95rem; border-radius: var(--radius); cursor: pointer; }
.clear-btn { background: var(--bg-2); border: 1px solid var(--border); padding: .35rem .95rem; border-radius: var(--radius); cursor: pointer; color: var(--text-2); }
#py-editor, .output-content { padding: 1.15rem; font-family: var(--mono); font-size: .84rem; line-height: 1.65; min-height: 240px; width: 100%; border: none; outline: none; background: var(--bg-2); color: var(--text); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 3rem 0; background: var(--bg-2); margin-top: 3.5rem; width: 100%; }
.site-footer p { font-size: .84rem; color: var(--text-3); margin-bottom: .25rem; text-align: center; }

@media (max-width: 899px) {
  body.sidebar-open .layout { padding-left: 0; }
  .container { padding: 0 1.25rem; }
  .hero { padding: 3.5rem 0 2.5rem; }
  .playground-area { grid-template-columns: 1fr; }
}