/* Página de curso: Visualización de datos con Python. Identidad propia: lienzo de gráficos con la paleta
   de Plotly (índigo, coral, verde, violeta, naranja), anatomía de una figura y un dashboard de Dash. */
.c-visualizacion-python {
  --vz-1: #5b63e8; --vz-2: #ef5b3f; --vz-3: #00a982; --vz-4: #9a5ae0; --vz-5: #f59a3c;
  --vz-ink: var(--ink); --vz-canvas: #ffffff; --vz-grid: #e6ebf2;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}
:root[data-theme="dark"] .c-visualizacion-python { --vz-1: #8f96ff; --vz-2: #ff8a70; --vz-3: #3fd6ad; --vz-4: #c398ff; --vz-5: #ffb867; --vz-canvas: #0f1c2b; --vz-grid: #1f3247; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .c-visualizacion-python { --vz-1: #8f96ff; --vz-2: #ff8a70; --vz-3: #3fd6ad; --vz-4: #c398ff; --vz-5: #ffb867; --vz-canvas: #0f1c2b; --vz-grid: #1f3247; }
}

/* Detalle tipográfico: el <em> del título pintado con la paleta de gráficos; pasos rotulados como figuras */
.c-visualizacion-python .c-hero h1 { font-size: clamp(2.2rem, 1.3rem + 2.8vw, 3.5rem); max-width: 18ch; }
.c-visualizacion-python h1 em, .c-visualizacion-python h2 em { color: var(--vz-1); }
.c-visualizacion-python .c-hero h1 em { background: linear-gradient(90deg, var(--vz-1), var(--vz-4) 45%, var(--vz-2) 80%, var(--vz-5)); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .06em; }
.c-visualizacion-python .cs-step-n { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: .95rem; letter-spacing: 0; color: var(--vz-1); }
.c-visualizacion-python .cs-step-n::before { content: ""; display: inline-block; width: 22px; height: 3px; margin-right: 8px; vertical-align: middle; border-radius: 2px; background: linear-gradient(90deg, var(--vz-1) 0 33%, var(--vz-2) 33% 66%, var(--vz-3) 66%); }

/* ---------- Portada: gráfico interactivo con tooltip que recorre los puntos ---------- */
.vz-live {
  position: absolute; left: -26px; bottom: -34px; width: min(78%, 360px); padding: 12px 14px 14px; border-radius: 16px;
  background: var(--vz-canvas); border: 1px solid var(--line); box-shadow: 0 24px 50px -20px rgba(10, 30, 60, .5);
  animation: c-in .8s .5s cubic-bezier(.2, .8, .2, 1) both;
}
.vz-live-top { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; font-weight: 600; color: var(--ink); }
.vz-mode { display: flex; gap: 4px; } .vz-mode b { width: 14px; height: 14px; border-radius: 4px; background: var(--vz-grid); }
.vz-live-svg { width: 100%; height: auto; display: block; margin-top: 4px; overflow: visible; }
.vz-area { fill: color-mix(in srgb, var(--vz-1) 16%, transparent); }
.vz-ln { fill: none; stroke: var(--vz-1); stroke-width: 2.5; stroke-linejoin: round; }
.vz-spike { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; transition: all .45s cubic-bezier(.2, .8, .2, 1); }
.vz-dot { fill: var(--vz-canvas); stroke: var(--vz-1); stroke-width: 3; transition: all .45s cubic-bezier(.2, .8, .2, 1); }
.vz-tip { position: absolute; left: var(--tx, 43%); top: var(--ty, 32%); translate: -50% -110%; display: grid; padding: 5px 9px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: .7rem; line-height: 1.3; white-space: nowrap; transition: left .45s cubic-bezier(.2, .8, .2, 1), top .45s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
.vz-tip b { font-weight: 700; } .vz-tip span { font-family: var(--mono); }

/* ---------- Historia ---------- */
.vz-stage { font-size: .86rem; background: var(--vz-canvas); }
.c-visualizacion-python .s1 { background: none; }
.c-visualizacion-python .s2, .c-visualizacion-python .s4 { display: block; }
.c-visualizacion-python .s5 { padding: 7%; }

/* Escena 1: gráfico por defecto */
.vz-fig1 { position: absolute; left: 7%; top: 6%; margin: 0; font-family: "DejaVu Sans", Verdana, sans-serif; font-size: .8rem; color: var(--muted); }
.vz-pie { position: absolute; left: 22%; top: 14%; width: 44%; aspect-ratio: 1; border-radius: 50%;
  background: conic-gradient(#1f77b4 0 8%, #ff7f0e 0 17%, #2ca02c 0 24%, #d62728 0 34%, #9467bd 0 43%, #8c564b 0 51%, #e377c2 0 57%, #7f7f7f 0 66%, #bcbd22 0 74%, #17becf 0 83%, #aec7e8 0 92%, #ffbb78 0); }
.vz-pie-labels span { position: absolute; left: var(--x); top: var(--y); font-family: "DejaVu Sans", Verdana, sans-serif; font-size: .7rem; color: var(--ink); white-space: nowrap; }
.vz-legend-bad { position: absolute; right: 8%; top: 18%; margin: 0; padding: 6px 10px; list-style: none; display: grid; gap: 1px; font-family: "DejaVu Sans", Verdana, sans-serif; font-size: .6rem; color: var(--ink); background: color-mix(in srgb, var(--vz-canvas) 85%, transparent); border: 1px solid var(--faint); }
.vz-legend-bad li::before { content: ""; display: inline-block; width: 12px; height: 6px; margin-right: 5px; background: var(--faint); }
.vz-q { position: absolute; left: 7%; bottom: 7%; margin: 0; padding: 8px 14px; border-radius: 999px; background: var(--bad); color: #fff; font-weight: 600; font-size: .84rem; --d: .5s; }
.cs-stage:not([data-step="1"]) .s1 > * { opacity: 0; transform: translateY(18px); }

/* Escena 2: anatomía */
.vz-anat { position: absolute; left: 16%; right: 8%; top: 16%; bottom: 18%; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; padding: 12px 14px 10px 18px; border: 1.5px dashed color-mix(in srgb, var(--vz-4) 60%, transparent); border-radius: 12px; --d: .05s; }
.vz-anat-title { margin: 0; font-weight: 700; font-size: .9rem; }
.vz-anat-plot { position: relative; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); outline: 1.5px dashed color-mix(in srgb, var(--vz-3) 70%, transparent); outline-offset: 4px; background: repeating-linear-gradient(0deg, transparent 0 24%, var(--vz-grid) 24% calc(24% + 1px)); }
.vz-cols { position: absolute; inset: 8px 8px 0; display: flex; align-items: flex-end; gap: 9%; }
.vz-cols i { flex: 1; height: var(--h); border-radius: 4px 4px 0 0; background: var(--vz-1); transform-origin: bottom; transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
.vz-cols i.lo { background: var(--vz-2); }
.cs-stage:not([data-step="2"]) .vz-cols i { transform: scaleY(.1); }
.vz-note { position: absolute; left: 56%; top: 20%; padding: 3px 8px; border-radius: 6px; font-size: .72rem; font-weight: 600; color: var(--vz-2); background: color-mix(in srgb, var(--vz-2) 12%, var(--vz-canvas)); }
.vz-anat-x { display: flex; justify-content: space-around; font-size: .68rem; color: var(--muted); }
.vz-tag { position: absolute; padding: 3px 9px; border-radius: 999px; font-family: var(--mono); font-size: .68rem; font-weight: 600; color: #fff; background: var(--vz-4); white-space: nowrap; }
.t-fig { left: 16%; top: 8%; --d: .2s; }
.t-tit { right: 8%; top: 8%; background: var(--vz-1); --d: .3s; }
.t-ax { right: 4%; top: 46%; background: var(--vz-3); --d: .4s; }
.t-y { left: 3%; top: 44%; background: var(--ink); color: var(--bg); --d: .5s; }
.t-x { left: 44%; bottom: 7%; background: var(--ink); color: var(--bg); --d: .6s; }
.t-ann { left: 60%; top: 25%; background: var(--vz-2); --d: .7s; }
.cs-stage:not([data-step="2"]) .s2 .vz-tag { opacity: 0; transform: scale(.7); }
.cs-stage:not([data-step="2"]) .s2 .vz-anat { opacity: 0; }

/* Escena 3: subplots y theme */
.c-visualizacion-python .s3 { background: #111a27; color: #dbe6f1; transition: opacity .6s, visibility 0s .6s, background-color .6s; }
.vz-code { margin: 0 0 12px; font-family: var(--mono); font-size: .76rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vz-code b { color: #a9b0ff; } .vz-code span { margin-left: auto; padding: 2px 9px; border-radius: 999px; background: #2a3a55; font-size: .68rem; }
.vz-subs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; height: calc(100% - 34px); }
.vz-sub { display: grid; grid-template-rows: auto 1fr; gap: 4px; padding: 8px 10px; border-radius: 10px; background: #182537; min-height: 0; }
.vz-sub small { font-size: .7rem; color: #9fb2c6; }
.vz-sub svg { width: 100%; height: 100%; min-height: 0; overflow: visible; }
.vz-sub path { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.vz-sub .p1 { stroke: #8f96ff; } .vz-sub .p2 { stroke: #ff8a70; } .vz-sub .p3 { stroke: #ffb867; stroke-width: 2.5; }
.vz-sub .pts circle { fill: #3fd6ad; }
.vz-sub .bb rect { fill: #5b63e8; }
.vz-heat { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.vz-heat i { border-radius: 3px; background: color-mix(in srgb, #ff8a70 calc(var(--v) * 100%), #24344c); min-height: 10px; }
.s3 .vz-sub { transition: opacity .5s, transform .6s cubic-bezier(.2, .8, .2, 1); }
.s3 .vz-sub:nth-child(2) { transition-delay: .1s; } .s3 .vz-sub:nth-child(3) { transition-delay: .2s; } .s3 .vz-sub:nth-child(4) { transition-delay: .3s; }
.cs-stage:not([data-step="3"]) .s3 .vz-sub { opacity: 0; transform: scale(.9); }

/* Escena 4: app de Dash */
.vz-app { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--vz-canvas); box-shadow: 0 16px 30px -18px rgba(10, 30, 60, .4); }
.vz-app-bar { display: flex; align-items: center; gap: 6px; padding: 7px 10px; background: var(--sky); font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.vz-app-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.vz-app-bar span { margin-left: 8px; padding: 2px 10px; border-radius: 6px; background: var(--vz-canvas); }
.vz-app-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.vz-dd { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; width: fit-content; font-size: .76rem; }
.vz-dd small { color: var(--muted); }
.vz-dd-v { position: relative; display: inline-grid; min-width: 4.2em; font-weight: 700; color: var(--vz-1); }
.vz-dd-v em { grid-area: 1 / 1; font-style: normal; }
.vz-dd-v em:last-child { opacity: 0; }
.vz-app-bars { display: flex; align-items: flex-end; gap: 8%; height: 110px; border-bottom: 1px solid var(--line); }
.vz-app-bars i { flex: 1; height: var(--a); border-radius: 4px 4px 0 0; background: var(--vz-1); transition: height .6s cubic-bezier(.2, .8, .2, 1); }
.vz-dt { display: grid; grid-template-columns: 1fr auto; align-content: start; font-size: .72rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.vz-dt span { padding: 5px 8px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.vz-dt span:nth-child(-n+2) { border-top: 0; color: var(--muted); background: var(--sky); font-weight: 600; }
.cs-stage[data-step="4"] .vz-dd-v em:first-child { animation: vz-swap-a 4s 1s infinite; }
.cs-stage[data-step="4"] .vz-dd-v em:last-child { animation: vz-swap-b 4s 1s infinite; }
.cs-stage[data-step="4"] .vz-app-bars i { animation: vz-bars 4s 1s infinite; }
@keyframes vz-swap-a { 0%, 45% { opacity: 1; } 50%, 95% { opacity: 0; } 100% { opacity: 1; } }
@keyframes vz-swap-b { 0%, 45% { opacity: 0; } 50%, 95% { opacity: 1; } 100% { opacity: 0; } }
@keyframes vz-bars { 0%, 45% { height: var(--a); background: var(--vz-1); } 52%, 95% { height: var(--b); background: var(--vz-3); } 100% { height: var(--a); } }
.vz-cb { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #111a27; color: #dbe6f1; font-family: var(--mono); font-size: .72rem; line-height: 1.5; white-space: pre-wrap; --d: .3s; }
.vz-cb b { color: #a9b0ff; font-weight: 600; } .vz-cb u { color: #ffb867; text-decoration: none; }
.cs-stage:not([data-step="4"]) .s4 > * { opacity: 0; transform: translateY(14px); }

/* Escena 5: gráfico interactivo */
.vz-plotly { position: relative; padding: 30px 12px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--vz-canvas); }
.vz-modebar { position: absolute; right: 10px; top: 6px; display: flex; gap: 4px; }
.vz-modebar i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; font-style: normal; font-size: .68rem; color: var(--muted); background: var(--sky); }
.vz-plotly svg { width: 100%; height: 150px; display: block; overflow: visible; }
.vz-ln2, .vz-ln3 { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-dasharray: 700; stroke-dashoffset: 700; transition: stroke-dashoffset 1.3s .3s ease; }
.vz-ln2 { stroke: var(--vz-1); } .vz-ln3 { stroke: var(--vz-2); }
.cs-stage[data-step="5"] .vz-ln2, .cs-stage[data-step="5"] .vz-ln3 { stroke-dashoffset: 0; }
.vz-spike2 { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; opacity: 0; transition: opacity .4s 1.4s; }
.cs-stage[data-step="5"] .vz-spike2 { opacity: 1; }
.vz-tip2 { position: absolute; left: 48%; top: 22%; display: grid; gap: 1px; padding: 7px 10px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: .72rem; box-shadow: var(--shadow); opacity: 0; transform: translateY(6px); transition: opacity .4s 1.5s, transform .4s 1.5s; }
.cs-stage[data-step="5"] .vz-tip2 { opacity: 1; transform: none; }
.vz-tip2 .c1::before, .vz-tip2 .c2::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--vz-1); }
.vz-tip2 .c2::before { background: var(--vz-2); }
.vz-range { margin-top: 10px; height: 16px; border-radius: 4px; background: var(--sky); position: relative; }
.vz-range i { position: absolute; left: 30%; right: 12%; top: 0; bottom: 0; border-radius: 4px; border: 2px solid var(--vz-1); background: color-mix(in srgb, var(--vz-1) 14%, transparent); }
.vz-pbi { position: absolute; left: 7%; bottom: 7%; margin: 0; padding: 8px 14px; border-radius: 12px; font-size: .8rem; background: color-mix(in srgb, #f2c811 26%, var(--surface)); border: 1px solid color-mix(in srgb, #f2c811 60%, transparent); --d: 1.6s; }
.cs-stage:not([data-step="5"]) .s5 .vz-pbi { opacity: 0; transform: translateY(12px); }

/* ---------- Programa ---------- */
.c-visualizacion-python .unit-n { font-family: Georgia, "Times New Roman", serif; font-style: italic; text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--vz-1); }
.c-visualizacion-python .unit li::before { border-radius: 2px; }
.c-visualizacion-python .vz-u1 li::before { background: var(--vz-4); }
.c-visualizacion-python .vz-u2 li::before { background: var(--vz-1); }
.c-visualizacion-python .vz-u3 li::before { background: var(--vz-3); }
.c-visualizacion-python .vz-u4 li::before { background: #e8b400; }
.c-visualizacion-python .vz-u3 { background: #111a27; border-color: transparent; color: #dbe6f1; }
.c-visualizacion-python .vz-u3 h3 { color: #fff; } .c-visualizacion-python .vz-u3 ul { color: #c4d3e2; font-size: 1rem; }
.c-visualizacion-python .vz-u3 .unit-n { color: #a9b0ff; }
@media (min-width: 1001px) {
  .vz-units .vz-u1 { grid-area: 1 / 1; } .vz-units .vz-u4 { grid-area: 2 / 1; }
  .vz-units .vz-u2 { grid-area: 1 / 2 / 3 / 3; } .vz-units .vz-u3 { grid-area: 1 / 3 / 3 / 5; }
}
.vz-road { grid-template-columns: 1.5fr 1fr 1fr; }
.vz-road .dots { grid-template-columns: repeat(8, 1fr); max-width: 260px; }

@media (max-width: 900px) {
  .vz-live { left: -10px; bottom: -26px; width: 74%; }
  .vz-road { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .vz-stage { font-size: .76rem; }
  .vz-live { padding: 8px 10px 10px; } .vz-live-top { font-size: .68rem; } .vz-tip { font-size: .62rem; padding: 4px 7px; }
  .vz-pie-labels span { font-size: .56rem; } .vz-legend-bad { font-size: .5rem; padding: 4px 6px; right: 4%; } .vz-q { font-size: .7rem; padding: 6px 10px; }
  .vz-anat { left: 18%; padding: 6px 8px 6px 10px; } .vz-anat-title { font-size: .72rem; } .vz-tag { font-size: .56rem; padding: 2px 6px; } .vz-note { font-size: .58rem; }
  .t-fig, .t-tit { top: 5%; } .t-ax { right: 1%; } .t-y { left: 1%; }
  .vz-code { font-size: .6rem; margin-bottom: 6px; } .vz-subs { gap: 6px; height: calc(100% - 22px); } .vz-sub { padding: 5px 7px; } .vz-sub small { font-size: .58rem; }
  .vz-app-body { padding: 8px; gap: 6px; } .vz-dd { font-size: .64rem; padding: 4px 8px; } .vz-app-bars { height: 64px; } .vz-dt { font-size: .58rem; } .vz-dt span { padding: 3px 5px; }
  .vz-cb { font-size: .56rem; margin-top: 8px; padding: 6px 8px; }
  .vz-plotly { padding: 24px 8px 8px; } .vz-plotly svg { height: 84px; } .vz-tip2 { font-size: .6rem; padding: 5px 7px; top: 18%; left: 40%; } .vz-pbi { font-size: .66rem; padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .vz-live { animation: none !important; }
  .vz-spike, .vz-dot, .vz-tip, .vz-ln2, .vz-ln3, .vz-spike2, .vz-tip2, .vz-cols i, .s3 .vz-sub { transition: none !important; }
  .cs-stage[data-step="4"] .vz-dd-v em, .cs-stage[data-step="4"] .vz-app-bars i { animation: none !important; }
}

/* Más aire para los gráficos en escritorio */
@media (min-width: 901px) {
  .vz-app-bars { height: 160px; }
  .vz-plotly svg { height: 210px; }
  .vz-cb { font-size: .8rem; }
}
