/* ============================================================
   Sistema de diseño — Curso ESAN "Chatbots RAG para Servicio al Cliente y QoS"
   Paleta coherente con las diapositivas (01_Slides/_build/theme.js).
   Vanilla CSS, sin dependencias externas. Funciona offline.
   ============================================================ */

:root {
  --navy:   #1E2761;
  --navy2:  #2E3A86;
  --teal:   #0E8F8C;
  --teal-d: #0B7370;
  --teal-lt:#D6ECEB;
  --amber:  #C9772E;   /* levemente oscurecido vs slides para contraste AA sobre claro */
  --amber-lt:#FBE9D6;
  --ice:    #E9EEF8;
  --light:  #F6F8FC;
  --ink:    #232832;
  --muted:  #5B6470;
  --line:   #D7DEEA;
  --white:  #FFFFFF;
  --ok:     #1E7d55;
  --err:    #B23A3A;

  --serif: Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --fs-base: clamp(17px, 1.05vw + 12px, 20px);
  --maxw: 1100px;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(30,39,97,.08);
  --shadow-lg: 0 8px 28px rgba(30,39,97,.14);
}

/* Modo aula: sube tamaño base y contraste para proyección en cañón */
html.aula {
  --fs-base: clamp(21px, 1.3vw + 14px, 25px);
  --muted: #434b57;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--light);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); color: var(--navy); line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 3.5vw, 2.7rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 1.8em 0 .5em; }
h3 { font-size: clamp(1.2rem, 1.8vw, 1.45rem); margin: 1.4em 0 .4em; }
h4 { font-size: 1.1rem; margin: 1.2em 0 .3em; color: var(--navy2); }
p  { margin: 0 0 1em; }
a  { color: var(--teal-d); }
strong { color: var(--navy); }
ul, ol { margin: 0 0 1em; padding-left: 1.4em; }
li { margin: .3em 0; }
code {
  font-family: Consolas, "SF Mono", Menlo, monospace;
  background: var(--ice); padding: .1em .4em; border-radius: 5px;
  font-size: .9em; color: var(--navy2);
}

/* ---------- Barra de navegación ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--navy); color: var(--white);
  box-shadow: var(--shadow);
}
.topbar .inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: .8rem;
  padding: .55rem 1rem;
}
.brand {
  font-family: var(--serif); font-weight: bold; color: var(--white);
  text-decoration: none; font-size: 1.05rem; white-space: nowrap;
  display: flex; align-items: center; gap: .5rem;
}
.brand .dot { width: .7rem; height: .7rem; background: var(--teal); border-radius: 50%; flex: none; }
.nav { display: flex; gap: .15rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a {
  color: #CFD6EC; text-decoration: none; font-family: var(--sans);
  font-size: .82rem; padding: .35rem .6rem; border-radius: 6px; white-space: nowrap;
}
.nav a:hover { background: var(--navy2); color: var(--white); }
.nav a.active { background: var(--teal); color: var(--white); }

/* Botón Modo aula */
.aula-btn {
  border: 1.5px solid var(--teal); background: transparent; color: #CFD6EC;
  font-family: var(--sans); font-size: .78rem; font-weight: 600;
  padding: .32rem .7rem; border-radius: 20px; cursor: pointer; white-space: nowrap;
}
.aula-btn:hover { background: var(--teal); color: var(--white); }
html.aula .aula-btn { background: var(--amber); border-color: var(--amber); color: var(--white); }

/* menú hamburguesa (móvil) */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: .3rem; margin-left: auto; }
.nav-toggle svg { stroke: var(--white); }

/* ---------- Contenedor ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.1rem 4rem; }

/* ---------- Encabezado de día ---------- */
.day-head {
  background: linear-gradient(135deg, var(--navy), var(--navy2));
  color: var(--white); border-radius: var(--radius);
  padding: 1.6rem 1.6rem; margin-bottom: 1.5rem; position: relative; overflow: hidden;
}
.day-head::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--teal);
}
.day-head .kicker { color: var(--teal-lt); font-family: var(--sans); font-weight: 700;
  letter-spacing: .12em; font-size: .8rem; text-transform: uppercase; }
.day-head h1 { color: var(--white); margin: .2em 0 .3em; }
.day-head p { color: #CADCFC; margin: 0; }

/* ---------- Chip de sesión ---------- */
.chip {
  display: inline-block; background: var(--teal-lt); color: var(--teal-d);
  font-family: var(--sans); font-weight: 700; font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; padding: .28rem .7rem; border-radius: 20px; margin-bottom: .3rem;
}
.chip.amber { background: var(--amber-lt); color: var(--amber); }

/* ---------- Sección de sesión ---------- */
.session {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem 1.7rem; margin: 1.5rem 0; box-shadow: var(--shadow); scroll-margin-top: 70px;
}
.session > h2:first-of-type { margin-top: .2em; }

/* ---------- Objetivos ---------- */
.objetivos { background: var(--ice); border-radius: var(--radius); padding: 1rem 1.3rem; margin: 1rem 0; }
.objetivos h4 { margin-top: 0; color: var(--teal-d); }
.objetivos ul { margin-bottom: 0; }

/* ---------- Callout / frase clave ---------- */
.callout {
  border-left: 5px solid var(--teal); background: var(--teal-lt);
  padding: .9rem 1.2rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.2rem 0;
}
.callout.amber { border-color: var(--amber); background: var(--amber-lt); }
.callout .lbl { font-family: var(--sans); font-weight: 700; font-size: .75rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--teal-d); display: block; margin-bottom: .2rem; }
.callout.amber .lbl { color: var(--amber); }
.callout p { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.12em; color: var(--navy); }

/* ---------- Tarjetas ---------- */
.cards { display: grid; gap: 1rem; margin: 1.2rem 0; }
.cards.c2 { grid-template-columns: repeat(2, 1fr); }
.cards.c3 { grid-template-columns: repeat(3, 1fr); }
.cards.c4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; border-top: 4px solid var(--teal); box-shadow: var(--shadow);
}
.card.amber { border-top-color: var(--amber); }
.card.navy { border-top-color: var(--navy2); }
.card h4 { margin: 0 0 .4rem; }
.card .k { font-family: var(--sans); font-weight: 700; font-size: .72rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--teal-d); }
.card.amber .k { color: var(--amber); }
.card p:last-child { margin-bottom: 0; }

/* ---------- Tablas ---------- */
.tbl-wrap { overflow-x: auto; margin: 1.2rem 0; }
table.data { border-collapse: collapse; width: 100%; font-size: .95em; }
table.data th {
  background: var(--navy); color: var(--white); text-align: left; padding: .6rem .8rem;
  font-family: var(--sans); font-weight: 700; }
table.data td { padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:nth-child(even) td { background: var(--ice); }
table.data caption { caption-side: bottom; font-size: .85em; color: var(--muted);
  font-style: italic; padding-top: .5rem; text-align: left; }

/* ---------- Fórmula ---------- */
.formula {
  font-family: Consolas, "SF Mono", Menlo, monospace; background: var(--navy); color: var(--white);
  padding: .8rem 1.1rem; border-radius: var(--radius); margin: 1rem 0; font-size: 1.05em;
  display: inline-block; }
.formula .var { color: #8FE3E1; }

/* ---------- Nota / aviso ---------- */
.nota { font-size: .9em; color: var(--muted); border-left: 3px solid var(--line); padding-left: .9rem; margin: 1rem 0; }

/* ---------- Componentes interactivos ---------- */
.interactive {
  border: 2px solid var(--teal); border-radius: var(--radius); padding: 1.3rem;
  margin: 1.5rem 0; background: var(--white); }
.interactive > .tool-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .3rem; }
.interactive .tool-head h4 { margin: 0; color: var(--teal-d); }
.interactive .tool-tag { font-family: var(--sans); font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; background: var(--teal); color: var(--white);
  padding: .15rem .55rem; border-radius: 5px; }
.interactive .tool-hint { font-size: .9em; color: var(--muted); margin: 0 0 1rem; }

.btn {
  font-family: var(--sans); font-weight: 600; font-size: .95rem; cursor: pointer;
  background: var(--teal); color: var(--white); border: none; padding: .5rem 1rem;
  border-radius: 8px; }
.btn:hover { background: var(--teal-d); }
.btn.ghost { background: transparent; color: var(--teal-d); border: 1.5px solid var(--teal); }
.btn.ghost:hover { background: var(--teal-lt); }
.btn.amber { background: var(--amber); } .btn.amber:hover { filter: brightness(.93); }
.btn:disabled { opacity: .5; cursor: default; }

input[type=number], input[type=text], textarea, select {
  font-family: var(--sans); font-size: 1rem; padding: .45rem .6rem; border: 1.5px solid var(--line);
  border-radius: 7px; background: var(--white); color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
label { font-weight: 600; font-size: .92rem; }
input[type=range] { accent-color: var(--teal); }

/* ---------- Quiz ---------- */
.quiz { background: var(--ice); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin: 1.5rem 0; }
.quiz > h4 { margin-top: 0; display: flex; align-items: center; gap: .5rem; }
.quiz .q { margin: 1rem 0; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.quiz .q:last-child { border-bottom: none; padding-bottom: 0; }
.quiz .q .p { font-weight: 600; color: var(--navy); margin-bottom: .6rem; }
.quiz .opt {
  display: block; width: 100%; text-align: left; background: var(--white); border: 1.5px solid var(--line);
  border-radius: 8px; padding: .55rem .8rem; margin: .35rem 0; cursor: pointer;
  font-family: var(--sans); font-size: .96rem; color: var(--ink); }
.quiz .opt:hover:not(:disabled) { border-color: var(--teal); }
.quiz .opt:disabled { cursor: default; }
.quiz .opt.correct { border-color: var(--ok); background: #E9F6EF; }
.quiz .opt.wrong { border-color: var(--err); background: #FBEDED; }
.quiz .fb { font-size: .9em; margin: .5rem 0 0; padding: .6rem .8rem; border-radius: 7px; display: none; }
.quiz .fb.show { display: block; }
.quiz .fb.ok { background: #E9F6EF; color: var(--ok); border: 1px solid #B7E0C9; }
.quiz .fb.no { background: #FBEDED; color: var(--err); border: 1px solid #EBC4C4; }

/* ---------- Cronómetro ---------- */
.timer { text-align: center; }
.timer .display { font-family: var(--serif); font-weight: bold; font-size: clamp(3rem, 10vw, 5.5rem);
  color: var(--navy); line-height: 1; margin: .3rem 0; font-variant-numeric: tabular-nums; }
.timer .display.warn { color: var(--amber); }
.timer .display.done { color: var(--err); }
.timer .controls { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Navegación entre días (pie) ---------- */
.page-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; flex-wrap: wrap; }
.page-nav a { text-decoration: none; color: var(--teal-d); font-weight: 600; padding: .7rem 1.1rem;
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--white); }
.page-nav a:hover { border-color: var(--teal); }

/* ---------- Índice lateral de sesiones (sticky, en páginas de día) ---------- */
.session-toc { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.session-toc a { text-decoration: none; font-size: .85rem; font-weight: 600; color: var(--navy2);
  background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: .4rem .9rem; }
.session-toc a:hover { background: var(--teal-lt); border-color: var(--teal); }

/* ---------- Portada ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%); color: var(--white);
  border-radius: var(--radius); padding: 2.6rem 2rem; margin-bottom: 2rem; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 10px; background: var(--teal); }
.hero::after { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 4px; background: var(--amber); }
.hero .kicker { color: var(--teal-lt); letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700; font-size: .85rem; font-family: var(--sans); }
.hero h1 { color: var(--white); margin: .3em 0; font-size: clamp(2rem, 5vw, 3.2rem); }
.hero .sub { color: #CADCFC; font-size: 1.15em; max-width: 40ch; }
.hero .meta { margin-top: 1.3rem; font-size: .95em; color: #AEB6CC; }

/* hilo narrativo */
.thread { display: flex; gap: .5rem; flex-wrap: wrap; align-items: stretch; margin: 1.2rem 0; }
.thread .step { flex: 1 1 140px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); position: relative; }
.thread .step .n { font-family: var(--serif); font-weight: bold; color: var(--teal); font-size: 1.4rem; }
.thread .step h4 { margin: .2rem 0 .3rem; font-size: 1rem; }
.thread .step p { font-size: .85em; color: var(--muted); margin: 0; }

/* agenda */
.agenda-day { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 1rem 0; box-shadow: var(--shadow); }
.agenda-day summary { background: var(--navy); color: var(--white); padding: .9rem 1.2rem; cursor: pointer;
  font-family: var(--serif); font-size: 1.2rem; font-weight: bold; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.agenda-day summary::-webkit-details-marker { display: none; }
.agenda-day summary .arrow { transition: transform .2s; }
.agenda-day[open] summary .arrow { transform: rotate(90deg); }
.agenda-day .body { padding: 1rem 1.2rem; background: var(--white); }
.agenda-day .body .ses { padding: .5rem 0; border-bottom: 1px dashed var(--line); }
.agenda-day .body .ses:last-child { border-bottom: none; }

/* eval donut row */
.eval-row { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1.2rem 0; }
.eval-item { flex: 1 1 200px; text-align: center; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.eval-item .pct { font-family: var(--serif); font-weight: bold; font-size: 2.6rem; color: var(--teal); }
.eval-item.amber .pct { color: var(--amber); } .eval-item.navy .pct { color: var(--navy2); }

/* ---------- Impresión (talleres) ---------- */
@media print {
  .topbar, .page-nav, .aula-btn, .no-print { display: none !important; }
  body { background: white; font-size: 12pt; }
  .session, .card, .interactive { box-shadow: none; border-color: #999; }
  a { color: var(--ink); text-decoration: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .cards.c3, .cards.c4 { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; position: absolute; top: 100%; right: 0; left: 0; background: var(--navy);
    flex-direction: column; padding: .5rem 1rem 1rem; gap: .1rem; }
  .nav.open { display: flex; }
  .nav a { padding: .6rem; font-size: .95rem; }
  .nav-toggle { display: block; }
}
@media (max-width: 520px) {
  .cards.c2, .cards.c3, .cards.c4 { grid-template-columns: 1fr; }
  .eval-item { flex-basis: 100%; }
}
