/* Página de curso: Orquestación de flujos de datos con Airflow (solo empresas).
   Identidad propia: tareas con estados (en cola, corriendo, éxito, falla), el DAG que corre y la grilla de corridas.
   Acento verde de "éxito" y numeración como dependencias de tareas (tarea_01 >>). */
.c-airflow {
  --af: #0e7d63; --af-soft: color-mix(in srgb, #1a9e5c 13%, var(--surface));
  --af-q: #9aa7b4; --af-r: #2f9fd8; --af-s: #1a9e5c; --af-f: #d6453d; --af-u: #f0a33a;
  --af-ed: #0f1e1b; --af-ed2: #182a26; --af-ink: #dcebe6; --af-dim: #86a39b; --af-kw: #6fe0b5; --af-str: #f4c27a;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}
:root[data-theme="dark"] .c-airflow { --af: #4fd1a8; --af-soft: color-mix(in srgb, #4fd1a8 13%, var(--surface)); --af-s: #3ccf86; --af-q: #6d7f8f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .c-airflow { --af: #4fd1a8; --af-soft: color-mix(in srgb, #4fd1a8 13%, var(--surface)); --af-s: #3ccf86; --af-q: #6d7f8f; } }

.c-airflow .c-hero h1 { font-size: clamp(2.2rem, 1.3rem + 2.9vw, 3.6rem); max-width: 17ch; }
.c-airflow .c-hero h1 em, .c-airflow h2 em { color: var(--af); }
.c-airflow .c-solo-emp {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 6px 12px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; color: var(--ink); background: var(--af-soft); border: 1px solid color-mix(in srgb, var(--af) 35%, var(--line));
}
.c-airflow .c-solo-emp::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--af-s); box-shadow: 0 0 0 3px color-mix(in srgb, var(--af-s) 25%, transparent); }
.c-airflow .cs-step-n, .c-airflow .unit-n { font-family: var(--mono); color: var(--af); letter-spacing: 0; text-transform: none; }
.c-airflow .who-lead a { color: var(--on-deep-accent); }

/* ---------- Portada: DAG que corre (curso-airflow.js cambia los estados) ---------- */
.af-float {
  position: absolute; left: -24px; bottom: -28px; width: min(86%, 400px); border-radius: 16px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-family: var(--mono); font-size: .74rem;
  animation: c-in .8s .5s cubic-bezier(.2, .8, .2, 1) both;
}
.af-float header { display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.af-float header b { color: var(--af); }
.af-mini { list-style: none; margin: 0; padding: 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.af-mini li { position: relative; padding: 7px 4px; border-radius: 8px; text-align: center; background: var(--bg); border: 2px solid var(--st, var(--af-q)); transition: border-color .3s, background-color .3s; }
.af-mini li:not(:last-child)::after { content: ""; position: absolute; right: -12px; top: 50%; width: 12px; height: 2px; background: var(--line); }
.af-mini li[data-s="running"] { --st: var(--af-r); animation: af-pulse 1s ease-in-out infinite; }
.af-mini li[data-s="success"] { --st: var(--af-s); background: color-mix(in srgb, var(--af-s) 12%, var(--bg)); }
.af-mini li[data-s="up_for_retry"] { --st: var(--af-u); }
@keyframes af-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--af-r) 22%, transparent); } }

/* ---------- Historia ---------- */
.af-stage { font-size: .86rem; }
.c-airflow .s2, .c-airflow .s4 { display: block; }
.c-airflow .s5 { padding: 7%; }

/* Escena 1: lista a mano y la pregunta de siempre */
.c-airflow .s1 { background: repeating-linear-gradient(0deg, transparent 0 27px, color-mix(in srgb, var(--line) 50%, transparent) 27px 28px); }
.af-note { position: absolute; left: 8%; top: 10%; width: 64%; padding: 14px 16px 16px; border-radius: 4px 4px 18px 4px; background: #fff3c4; color: #3d3410; box-shadow: 0 16px 30px -18px rgba(60, 50, 10, .55); transform: rotate(-2deg); }
.af-note header { font-weight: 700; font-size: .84rem; margin-bottom: 8px; }
.af-note ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-family: var(--mono); font-size: .78rem; }
.af-note li.ok::marker, .af-note li.bad::marker { font-weight: 700; }
.af-note li.ok { text-decoration: line-through; text-decoration-color: #1a9e5c; text-decoration-thickness: 2px; }
.af-note li.bad { color: #a8321f; font-weight: 600; }
.af-note li small { display: block; font-family: var(--f-body); font-weight: 500; font-size: .72rem; }
.af-msg { position: absolute; right: 7%; bottom: 10%; display: grid; gap: 2px; max-width: 52%; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--deep); color: var(--on-deep); font-weight: 600; font-size: .9rem; --d: .35s; }
.af-msg small { font-weight: 500; font-size: .7rem; opacity: .7; }
.cs-stage:not([data-step="1"]) .s1 .af-note { opacity: 0; transform: translateY(20px) rotate(-2deg); }
.cs-stage:not([data-step="1"]) .s1 .af-msg { opacity: 0; transform: translateX(16px); }

/* Escena 2: el DAG escrito en Python */
.c-airflow .s2 { background: var(--af-ed); color: var(--af-ink); }
.af-code { margin: 0; font-family: var(--mono); font-size: .76rem; line-height: 1.65; white-space: pre-wrap; color: var(--af-ink); }
.af-code i { font-style: normal; color: var(--af-dim); }
.af-code b { color: var(--af-kw); }
.af-code u { text-decoration: none; color: var(--af-str); }
.af-code em { font-style: normal; font-weight: 700; color: var(--af-kw); }
.af-tip { position: absolute; left: 7%; bottom: 7%; margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--af-ed2); font-size: .78rem; --d: .3s; }
.af-tip code { font-family: var(--mono); color: var(--af-kw); }
.cs-stage:not([data-step="2"]) .s2 > * { opacity: 0; transform: translateY(14px); }

/* Escena 3: el grafo corriendo, cada tarea cambia de estado */
.c-airflow .s3 { display: grid; grid-template-rows: auto 1fr auto; gap: 10px; }
.af-run-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.af-run-head span { color: var(--ink); font-weight: 700; }
.af-run-head b { font-weight: 500; color: var(--af); }
.af-graph { position: relative; border-radius: 14px; background: radial-gradient(color-mix(in srgb, var(--line) 80%, transparent) 1px, transparent 1px) 0 0 / 16px 16px, var(--bg); border: 1px solid var(--line); }
.af-graph svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.af-graph path { fill: none; stroke: var(--faint); stroke-width: 2; vector-effect: non-scaling-stroke; }
.af-graph .t { position: absolute; left: var(--x); top: var(--y); translate: -50% -50%; padding: 8px 10px; border-radius: 9px; white-space: nowrap; font-family: var(--mono); font-size: .72rem; background: var(--surface); border: 2px solid var(--af-q); }
.cs-stage[data-step="3"] .af-graph .t { animation: af-state 1.4s var(--dl, 0s) both; }
.af-graph .g1 { --dl: .3s; } .af-graph .g2 { --dl: 1.3s; } .af-graph .g2b { --dl: 1.5s; } .af-graph .g3 { --dl: 2.6s; } .af-graph .g4 { --dl: 3.5s; }
@keyframes af-state {
  0% { border-color: var(--af-q); }
  15%, 60% { border-color: var(--af-r); box-shadow: 0 0 0 5px color-mix(in srgb, var(--af-r) 20%, transparent); }
  75%, 100% { border-color: var(--af-s); background: color-mix(in srgb, var(--af-s) 14%, var(--surface)); box-shadow: none; }
}
.af-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 14px; font-size: .72rem; color: var(--muted); }
.af-legend li::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; background: var(--c); }
.af-legend .q { --c: var(--af-q); } .af-legend .r { --c: var(--af-r); } .af-legend .s { --c: var(--af-s); }
.cs-stage:not([data-step="3"]) .s3 > * { opacity: 0; transform: translateY(12px); }

/* Escena 4: grilla de corridas y log */
.af-grid { display: grid; grid-template-columns: auto repeat(5, minmax(0, 1fr)); gap: 6px 8px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.af-grid b { font-family: var(--mono); font-size: .66rem; font-weight: 500; color: var(--muted); text-align: center; }
.af-grid em { font-style: normal; font-family: var(--mono); font-size: .7rem; padding-right: 6px; }
.af-grid i { height: 18px; border-radius: 4px; background: var(--c); }
.af-grid i.s { --c: var(--af-s); } .af-grid i.f { --c: var(--af-f); box-shadow: 0 0 0 3px color-mix(in srgb, var(--af-f) 30%, transparent); animation: af-blink 1.4s ease-in-out infinite; } .af-grid i.u { --c: var(--af-u); }
@keyframes af-blink { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--af-f) 0%, transparent); } }
.af-log { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--af-ed); color: var(--af-ink); font-family: var(--mono); font-size: .72rem; line-height: 1.6; white-space: pre-wrap; --d: .3s; }
.af-log .dim { color: var(--af-dim); } .af-log .err { color: #ff8a7a; font-weight: 700; } .af-log .warn { color: #ffc96b; font-weight: 700; } .af-log .ok { color: var(--af-kw); font-weight: 700; }
.cs-stage:not([data-step="4"]) .s4 > * { opacity: 0; transform: translateY(14px); }

/* Escena 5: conectores, variables, operadores */
.c-airflow .s5 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto auto; gap: 10px; align-content: start; }
.af-panel { padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.af-panel header { font-family: var(--mono); font-size: .68rem; color: var(--af); margin-bottom: 8px; }
.af-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-family: var(--mono); font-size: .72rem; }
.af-panel li { display: flex; align-items: center; gap: 7px; min-width: 0; }
.af-panel li i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--af-s); }
.af-panel .kv li { justify-content: space-between; padding: 4px 8px; border-radius: 7px; background: var(--bg); }
.af-panel .kv b { color: var(--af); }
.af-panel:nth-child(2) { --d: .12s; }
.af-ops { grid-column: 1 / -1; --d: .24s; }
.af-ops p { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.af-ops span { padding: 5px 10px; border-radius: 999px; font-family: var(--mono); font-size: .7rem; color: #fff; background: var(--af); }
:root[data-theme="dark"] .af-ops span { color: #062b20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .af-ops span { color: #062b20; } }
.af-done { grid-column: 1 / -1; justify-self: start; padding: 9px 14px; border-radius: 12px; background: var(--af-s); color: #fff; font-weight: 600; font-size: .84rem; --d: .4s; }
.cs-stage:not([data-step="5"]) .s5 > * { opacity: 0; transform: translateY(14px); }

/* ---------- Programa ---------- */
.c-airflow .unit li::before { background: var(--af-s); border-radius: 3px; }
.c-airflow .af-wide { grid-row: auto; background: var(--af-ed); border-color: transparent; color: var(--af-ink); }
.c-airflow .af-wide h3 { color: #fff; } .c-airflow .af-wide ul { color: var(--af-ink); font-size: 1rem; } .c-airflow .af-wide .unit-n { color: var(--af-kw); }
.c-airflow .cs-path-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.c-airflow .road-line i { background: linear-gradient(90deg, var(--af-r), var(--af-s)); }
.c-airflow .road-classes.on .dots i { background: var(--af-s); }
.c-airflow .gain-list span { -webkit-text-stroke-color: var(--af); }

@media (max-width: 900px) {
  .af-float { left: -10px; bottom: -22px; }
  .c-airflow .cs-path-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .af-stage { font-size: .76rem; }
  .af-mini { gap: 8px; padding: 9px; } .af-mini li { font-size: .6rem; padding: 6px 2px; } .af-mini li:not(:last-child)::after { right: -8px; width: 8px; }
  .af-note { width: 74%; padding: 9px 10px; } .af-note header { font-size: .68rem; margin-bottom: 4px; } .af-note ol { font-size: .6rem; gap: 3px; padding-left: 16px; } .af-note li small { font-size: .56rem; }
  .af-msg { font-size: .72rem; padding: 7px 10px; }
  .af-code { font-size: .52rem; line-height: 1.5; }
  .af-tip { font-size: .62rem; padding: 5px 8px; }
  .af-run-head { font-size: .56rem; } .af-graph .t { font-size: .52rem; padding: 4px 5px; border-width: 1.5px; } .af-legend { font-size: .58rem; gap: 8px; }
  .af-grid { padding: 7px 8px; gap: 4px 5px; } .af-grid i { height: 11px; } .af-grid em { font-size: .54rem; } .af-grid b { font-size: .5rem; }
  .af-log { font-size: .54rem; padding: 6px 8px; margin-top: 7px; line-height: 1.45; }
  .c-airflow .s5 { gap: 6px; }
  .af-panel { padding: 6px 8px; } .af-panel header { font-size: .54rem; margin-bottom: 4px; } .af-panel ul { font-size: .56rem; gap: 3px; } .af-panel .kv li { padding: 2px 5px; }
  .af-ops span { font-size: .54rem; padding: 3px 7px; } .af-done { font-size: .64rem; padding: 6px 10px; }
  .c-airflow .cs-path-list { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .af-float, .af-mini li, .af-grid i.f { animation: none !important; }
  .cs-stage[data-step="3"] .af-graph .t { animation: none !important; border-color: var(--af-s); }
}
