/* ============================================================
   Curso IA — Sistema visual compartido
   Estética: lúdica y colorida sobre crema cálido
   ============================================================ */

:root {
  /* Fondo y superficies (crema cálido) */
  --bg: #faf8f3;
  --bg-deep: #f3efe6;
  --surface: #fffdf8;
  --surface-2: #fbf7ee;
  --line: #e6dfd1;
  --line-strong: #d8cfbb;

  /* Tinta */
  --ink: #1f1b16;
  --ink-soft: #6b6358;
  --ink-faint: #9b9285;

  /* Colores de marca */
  --orange: #c2410c;
  --orange-soft: #fbe6d8;
  --teal: #0d9488;
  --teal-soft: #d7efeb;

  /* Color por tema (cohesionados, misma luminosidad/croma vía oklch) */
  --c-ml: #c2410c;          /* Machine Learning  — naranja */
  --c-ml-soft: #fbe6d8;
  --c-nn: #0d9488;          /* Redes neuronales  — teal */
  --c-nn-soft: #d7efeb;
  --c-mon: oklch(0.52 0.13 255);   /* Monitoreo — azul */
  --c-mon-soft: oklch(0.93 0.04 255);
  --c-img: oklch(0.50 0.16 350);   /* Imágenes  — ciruela */
  --c-img-soft: oklch(0.93 0.045 350);
  --c-iris: oklch(0.55 0.13 152);  /* Entrena tu modelo — verde */
  --c-iris-soft: oklch(0.93 0.045 152);

  --yellow: #e0a020;
  --yellow-soft: #fbeecb;

  /* Acento dinámico por página (lo setea cada página) */
  --accent: var(--c-ml);
  --accent-soft: var(--c-ml-soft);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --shadow: 0 1px 2px rgba(31,27,22,.04), 0 8px 24px -12px rgba(31,27,22,.18);
  --shadow-lg: 0 2px 4px rgba(31,27,22,.05), 0 20px 48px -20px rgba(31,27,22,.28);

  --font-display: "Bricolage Grotesque", "Space Grotesk", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Textura sutil de puntos en el fondo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: .5;
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

p { margin: 0 0 1em; text-wrap: pretty; }
a { color: inherit; }

.mono { font-family: var(--font-mono); }

/* ---------- Layout ---------- */
.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}

.section { padding: 56px 0; }
.section-tight { padding: 32px 0; }

/* ---------- Barra de navegación ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250,248,243,.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.nav-logo {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.nav-logo span {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 7px 0 0 -2px var(--teal);
}
.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
  align-items: center;
}
.nav-link {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 7px 12px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-link:hover { background: var(--bg-deep); color: var(--ink); }
.nav-link.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.nav-link .done-check {
  width: 15px; height: 15px; display: none;
}
.nav-link.completed .done-check { display: inline-block; }

@media (max-width: 860px) {
  .nav-link span.lbl { display: none; }
  .nav-link { padding: 7px 9px; }
}

/* ---------- Botones ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  transition: transform .12s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
}
.btn-primary:hover { box-shadow: var(--shadow-lg); }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 8px 15px; font-size: 14px; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Etiquetas / chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Encabezado de tema ---------- */
.topic-head {
  padding: 48px 0 12px;
}
.topic-num {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .1em;
}
.topic-title {
  font-size: clamp(34px, 5.5vw, 56px);
  margin: 14px 0 16px;
}
.topic-lead {
  font-size: 20px;
  color: var(--ink-soft);
  max-width: 60ch;
}

/* ---------- Bloque de contenido / "lección" ---------- */
.lesson { margin: 0 auto; }
.block-title {
  font-size: clamp(24px, 3.5vw, 32px);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.block-title .idx {
  font-family: var(--font-mono);
  font-size: 16px;
  color: #fff;
  background: var(--accent);
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.block-sub { color: var(--ink-soft); margin-bottom: 22px; max-width: 62ch; }

/* "Try it" hint banner */
.try-hint {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 7px 14px;
  margin-bottom: 16px;
}
.try-hint::before {
  content: "";
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: .4; }
}

/* ---------- Demos ---------- */
.demo {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: 18px 0 8px;
}
.demo-stage {
  padding: 24px;
  display: grid;
  gap: 22px;
}
.demo-canvas-wrap {
  background: var(--bg-deep);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.demo-controls {
  display: grid;
  gap: 18px;
  align-content: start;
}
.demo-foot {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding: 14px 24px;
  font-size: 14px;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.demo-foot b { color: var(--ink); }

@media (min-width: 760px) {
  .demo-stage.split { grid-template-columns: 1.3fr 1fr; }
}

/* Controles tipo slider */
.control { display: grid; gap: 6px; }
.control-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 14px;
}
.control-row .label { font-weight: 600; }
.control-row .val {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  background: var(--line-strong);
  border-radius: 999px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}

/* Segmented control */
.seg {
  display: inline-flex;
  background: var(--bg-deep);
  border-radius: 999px;
  padding: 4px;
  gap: 3px;
}
.seg button {
  border: none; background: none; cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  color: var(--ink-soft);
  padding: 8px 16px; border-radius: 999px;
  transition: all .15s;
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Stat readout */
.stat {
  background: var(--bg-deep);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: grid; gap: 2px;
}
.stat .k { font-size: 12px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--ink); }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); gap: 10px; }

/* ---------- Diagrama paso a paso ---------- */
.steps { display: grid; gap: 12px; }
.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.step:hover { border-color: var(--accent); transform: translateX(3px); }
.step.open { border-color: var(--accent); box-shadow: var(--shadow); }
.step-num {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--font-mono); font-weight: 600; font-size: 17px;
  display: grid; place-items: center; flex-shrink: 0;
}
.step.open .step-num { background: var(--accent); color: #fff; }
.step-h { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.step-body { color: var(--ink-soft); font-size: 15px; max-height: 0; overflow: hidden; transition: max-height .3s ease, margin .3s; }
.step.open .step-body { max-height: 240px; margin-top: 8px; }

/* ---------- Quiz ---------- */
.quiz {
  background: var(--accent-soft);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.quiz-q { margin-bottom: 22px; }
.quiz-q:last-of-type { margin-bottom: 0; }
.quiz-q .q-text { font-family: var(--font-display); font-weight: 700; font-size: 19px; margin-bottom: 14px; }
.quiz-opts { display: grid; gap: 9px; }
.quiz-opt {
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  text-align: left;
  font-family: var(--font-body); font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; gap: 11px;
  transition: border-color .15s, background .15s;
}
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt .mark {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line-strong);
  flex-shrink: 0; display: grid; place-items: center;
  font-size: 14px;
}
.quiz-opt.correct { border-color: var(--teal); background: var(--teal-soft); }
.quiz-opt.correct .mark { border-color: var(--teal); background: var(--teal); color: #fff; }
.quiz-opt.wrong { border-color: #d4633a; background: #fbe3d8; }
.quiz-opt.wrong .mark { border-color: #d4633a; background: #d4633a; color: #fff; }
.quiz-opt.locked { cursor: default; pointer-events: none; opacity: .7; }
.quiz-opt.locked.correct, .quiz-opt.locked.wrong { opacity: 1; }
.quiz-feedback {
  margin-top: 10px; font-size: 14px; color: var(--ink-soft);
  padding-left: 4px; display: none;
}
.quiz-feedback.show { display: block; }
.quiz-result {
  margin-top: 8px; font-family: var(--font-display); font-weight: 700; font-size: 20px;
  display: none; align-items: center; gap: 10px;
}
.quiz-result.show { display: flex; }

/* ---------- Footer nav (siguiente tema) ---------- */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin: 48px 0 64px;
}
.pager-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
  display: grid; gap: 4px;
}
.pager-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.pager-card .dir { font-size: 13px; color: var(--ink-faint); font-weight: 600; }
.pager-card .ttl { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.pager-card.next { text-align: right; }
.pager-card.empty { visibility: hidden; }

@media (max-width: 560px) {
  .pager { grid-template-columns: 1fr; }
}

/* ---------- Utilidades ---------- */
.tag-soft {
  display:inline-block; font-family: var(--font-mono); font-size: 12px;
  background: var(--bg-deep); color: var(--ink-soft);
  padding: 3px 9px; border-radius: 7px;
}
.callout {
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 18px 0;
  font-size: 15.5px;
}
.callout b { color: var(--accent); }
.kbd-hint { font-size: 13px; color: var(--ink-faint); }
.placeholder-note {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------- Bloque de código ---------- */
.code {
  background: #1f1b16;
  color: #f3efe6;
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  overflow-x: auto;
  margin: 0;
  box-shadow: var(--shadow);
}
.code .c-kw  { color: oklch(0.78 0.13 152); }   /* keyword / func */
.code .c-str { color: oklch(0.82 0.10 70); }    /* string */
.code .c-num { color: oklch(0.80 0.11 40); }    /* number */
.code .c-com { color: #8a8170; font-style: italic; } /* comment */
.code .c-fn  { color: oklch(0.80 0.10 230); }   /* call */
.code-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint);
  margin-bottom: 8px;
}
.code-head .dots { display: flex; gap: 5px; }
.code-head .dots i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
