/* ==========================================================================
   Curso de IA — estilos compartidos
   Marca personal de carloscasanova.dev: tema "space" (oscuro, por defecto)
   y tema "gold" (claro, para salas con mucha luz). Tecla T para alternar.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tipografías (autoalojadas, SIL OFL 1.1 — ver assets/fonts/LICENSE.md)
   -------------------------------------------------------------------------- */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Paleta de marca (valores de carloscasanova.dev) */
  --space-900: #060d18;
  --space-400: #6b8cce;
  --sun: #ffcc4d;
  --orange: #ff9a1f;
  --gold-50: #fffdf0;
  --gold-400: #facc15;
  --gold-600: #ca8a04;
  --gold-700: #a16207;
  --slate-50: #f8fafc;
  --slate-100: #e2e8f0;
  --slate-200: #cbd5e1;
  --slate-300: #94a3b8;
  --slate-500: #475569;
  --slate-600: #334155;
  --slate-700: #1e293b;
  --slate-800: #0f172a;
  --slate-900: #030712;

  /* Tema "space" (por defecto) */
  --bg: var(--slate-900);
  --surface: rgb(15 23 42 / 0.55);          /* dark-800/50 */
  --surface-solid: var(--slate-800);
  --text: var(--slate-50);
  --text-soft: var(--slate-200);
  --muted: var(--slate-300);
  --border: var(--slate-700);
  --border-strong: var(--slate-600);
  --accent: var(--sun);                      /* texto y detalles */
  --accent-strong: var(--orange);
  --accent-fill: var(--sun);                 /* fondos de botón/insignia */
  --on-accent: var(--slate-900);
  --secondary: var(--space-400);
  --glow: 0 0 15px rgb(255 154 31 / 0.12), inset 0 0 15px rgb(107 140 206 / 0.06);
  --glow-strong: 0 0 25px rgb(255 154 31 / 0.2), inset 0 0 25px rgb(107 140 206 / 0.08);
  --stars: rgb(255 255 255 / 0.55);
  --nebula-1: rgb(61 90 158 / 0.18);
  --nebula-2: rgb(255 154 31 / 0.06);
  --notes-bg: var(--slate-800);
  --notes-text: var(--slate-100);

  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --slide-pad: clamp(1.5rem, 6vw, 6rem);
  --step-0: clamp(0.8rem, 1vw, 0.95rem);     /* etiquetas */
  --step-1: clamp(1.1rem, 1.6vw, 1.5rem);    /* texto */
  --step-2: clamp(1.4rem, 2.4vw, 2.1rem);    /* h3 / subtítulo */
  --step-3: clamp(1.9rem, 3.8vw, 3.3rem);    /* h2 */
  --step-4: clamp(2.6rem, 6.5vw, 5.5rem);    /* h1 */

  color-scheme: dark;
}

/* Tema "gold" (claro) */
:root[data-theme="light"] {
  --bg: var(--gold-50);
  --surface: rgb(255 255 255 / 0.85);
  --surface-solid: #ffffff;
  --text: var(--slate-800);
  --text-soft: var(--slate-600);
  --muted: var(--slate-500);
  --border: #f1e3a6;
  --border-strong: #e7cf6b;
  --accent: var(--gold-700);
  --accent-strong: var(--gold-600);
  --accent-fill: var(--gold-400);
  --on-accent: var(--slate-900);
  --secondary: #3d5a9e;
  --glow: 0 1px 3px rgb(161 98 7 / 0.08);
  --glow-strong: 0 4px 16px rgb(161 98 7 / 0.14);
  --stars: transparent;
  --nebula-1: rgb(250 204 21 / 0.10);
  --nebula-2: rgb(107 140 206 / 0.06);
  --notes-bg: var(--slate-800);
  --notes-text: var(--slate-100);

  color-scheme: light;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background-color: var(--bg);
  /* Nebulosas + campo de estrellas (solo CSS) */
  background-image:
    radial-gradient(ellipse 60% 50% at 15% 20%, var(--nebula-1), transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 85%, var(--nebula-2), transparent 70%),
    radial-gradient(1px 1px at 12% 18%, var(--stars), transparent),
    radial-gradient(1px 1px at 27% 72%, var(--stars), transparent),
    radial-gradient(1px 1px at 41% 33%, var(--stars), transparent),
    radial-gradient(1px 1px at 58% 88%, var(--stars), transparent),
    radial-gradient(1px 1px at 66% 12%, var(--stars), transparent),
    radial-gradient(1px 1px at 79% 47%, var(--stars), transparent),
    radial-gradient(1px 1px at 91% 23%, var(--stars), transparent),
    radial-gradient(1.5px 1.5px at 35% 55%, var(--stars), transparent),
    radial-gradient(1.5px 1.5px at 72% 65%, var(--stars), transparent);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-1);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgb(255 204 77 / 0.35); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

h1, h2, h3 { line-height: 1.12; margin: 0 0 0.55em; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); font-weight: 600; }
p { margin: 0 0 0.9em; color: var(--text-soft); }
strong { color: var(--text); font-weight: 600; }
em { color: var(--text); }
a { color: var(--accent); text-underline-offset: 3px; }
img, svg, video { max-width: 100%; height: auto; }

code, pre, kbd { font-family: var(--font-mono); font-size: 0.9em; }
:not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
}
pre {
  margin: 0 0 1em;
  padding: 1em 1.25em;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  line-height: 1.5;
}

/* Listas con la viñeta ▹ de la marca */
.slide ul { list-style: none; padding: 0; margin: 0 0 1em; }
.slide ul > li { position: relative; padding-left: 1.6em; margin: 0.45em 0; color: var(--text-soft); }
.slide ul > li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }
.slide ol { padding-left: 1.4em; margin: 0 0 1em; color: var(--text-soft); }
.slide ol > li { margin: 0.45em 0; padding-left: 0.3em; }
.slide ol > li::marker { color: var(--accent); font-family: var(--font-mono); font-weight: 500; }

/* --------------------------------------------------------------------------
   Componentes de marca
   -------------------------------------------------------------------------- */

/* Etiqueta monoespaciada en acento: "Hola, soy", "// módulo 01" */
.kicker {
  font-family: var(--font-mono);
  font-size: var(--step-0);
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 0.8em;
  letter-spacing: 0.02em;
}

/* Subtítulo monoespaciado en acento (como el cargo en la web) */
.subtitle {
  font-family: var(--font-mono);
  font-size: var(--step-2);
  font-weight: 400;
  color: var(--accent);
  margin: 0 0 0.6em;
}

/* Logo <CC /> */
.brand {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
}

/* Resaltado en acento dentro de un texto */
.hl { color: var(--accent); }

/* Tarjeta con brillo; data-file="about.md" añade una pestaña tipo fichero */
.card {
  position: relative;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glow);
  backdrop-filter: blur(4px);
}
.card > :last-child { margin-bottom: 0; }
.card[data-file] { padding-top: 1.75rem; }
.card[data-file]::before {
  content: attr(data-file);
  position: absolute;
  top: -0.8em;
  left: 1rem;
  padding: 0.1em 0.6em;
  font-family: var(--font-mono);
  font-size: var(--step-0);
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
}

/* Rejilla de tarjetas */
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); }

/* Cifra destacada (como "7+ años de experiencia") */
.stat {
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.stat b {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--step-3);
  font-weight: 500;
  line-height: 1.1;
  color: var(--accent);
}
.stat span { font-size: var(--step-0); color: var(--muted); }

/* Insignia / chip */
.badge {
  display: inline-block;
  padding: 0.15em 0.6em;
  font-family: var(--font-mono);
  font-size: var(--step-0);
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}

/* Dos columnas (se apilan en pantallas estrechas) */
.cols { display: grid; gap: clamp(1.25rem, 3vw, 3rem); grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); align-items: start; }

/* Flujo de cajas con flechas: <div class="flow"><span class="box">…</span><span class="arrow">→</span>… */
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; margin: 0 0 1.25rem; }
.flow .box {
  padding: 0.55em 1em;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.flow .box--accent { color: var(--on-accent); background: var(--accent-fill); border-color: var(--accent-fill); font-weight: 700; }
.flow .arrow, .flow .op { font-family: var(--font-mono); color: var(--accent); font-weight: 700; }
.flow-label { font-family: var(--font-mono); font-size: var(--step-0); color: var(--muted); margin: 0 0 0.4rem; }

/* Línea temporal: <ol class="timeline"><li><b>1943</b><span>…</span></li></ol> */
.slide ol.timeline, ol.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border-strong); }
ol.timeline > li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; align-items: baseline; position: relative; padding: 0.45rem 0 0.45rem 1.4rem; margin: 0; }
ol.timeline > li::before { content: ""; position: absolute; left: -0.42rem; top: 0.95rem; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgb(255 204 77 / 0.6); }
ol.timeline > li::marker { content: none; }
ol.timeline b { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }
ol.timeline span { color: var(--text-soft); }

/* Cita */
blockquote {
  margin: 0 0 1em;
  padding: 0.2em 0 0.2em 1.25em;
  border-left: 3px solid var(--accent);
  font-size: var(--step-2);
  line-height: 1.35;
  color: var(--text);
}
blockquote + .cite, .cite { font-family: var(--font-mono); font-size: var(--step-0); color: var(--muted); }

/* Botones (demos) */
.btn {
  padding: 0.55rem 1.1rem; font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer;
  color: var(--on-accent); background: var(--accent-fill); border: 0; border-radius: var(--radius);
}
.btn--ghost { color: var(--accent); background: transparent; border: 1px solid var(--border-strong); }

/* Tabla de datos */
table.data { border-collapse: collapse; width: 100%; max-width: 64rem; font-size: 1rem; }
table.data th, table.data td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data th { font-family: var(--font-mono); font-size: var(--step-0); color: var(--muted); font-weight: 500; }
table.data td { color: var(--text-soft); }
table.data td:first-child { color: var(--text); font-weight: 600; }

/* Texto secundario pequeño */
.small { font-size: var(--step-0); color: var(--muted); }

/* --------------------------------------------------------------------------
   Presentación
   -------------------------------------------------------------------------- */

.deck { position: relative; }

.slide {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--slide-pad);
  flex-direction: column;
  justify-content: center;
}
.slide.is-active { display: flex; }
.slide > * { max-width: 72rem; }

.slide--title h1 { margin-bottom: 0.2em; }

.slide--section {
  background: radial-gradient(ellipse 70% 60% at 50% 50%, rgb(255 204 77 / 0.07), transparent 70%);
}
.slide--section h2 { font-size: var(--step-4); }

.slide--center { align-items: center; text-align: center; }
.slide--center > * { margin-left: auto; margin-right: auto; }

/* Elementos que aparecen paso a paso */
.step { opacity: 0; transform: translateY(6px); transition: opacity 0.3s ease, transform 0.3s ease; }
.step.is-visible { opacity: 1; transform: none; }

/* Notas del ponente */
.notes { display: none; }
body.show-notes .slide.is-active .notes {
  display: block;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 35vh;
  max-width: none;
  overflow-y: auto;
  padding: 1rem var(--slide-pad);
  background: var(--notes-bg);
  color: var(--notes-text);
  border-top: 2px solid var(--accent);
  font-size: 1rem;
  z-index: 20;
}

/* Barra de progreso, marca y controles */
.deck-progress {
  position: fixed;
  left: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  box-shadow: 0 0 8px rgb(255 204 77 / 0.5);
  transition: width 0.2s ease;
  z-index: 10;
}
.deck-brand {
  position: fixed;
  left: 1.25rem; bottom: 1rem;
  font-size: 0.9rem;
  z-index: 10;
}
.deck-ui {
  position: fixed;
  right: 1rem; bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  z-index: 10;
}
.deck-ui a, .deck-ui button {
  font: inherit;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 0.35rem;
  padding: 0.2rem 0.55rem;
  text-decoration: none;
  cursor: pointer;
}
.deck-ui a:hover, .deck-ui button:hover { color: var(--accent); border-color: var(--accent); }
body.show-notes .deck-ui,
body.show-notes .deck-brand { bottom: calc(35vh + 1rem); }

/* Impresión / exportar a PDF: todas las pantallas, una por página */
@media print {
  body { background-image: none; }
  .slide { display: flex !important; break-after: page; min-height: 100vh; }
  .step { opacity: 1 !important; transform: none !important; }
  .deck-progress, .deck-ui, .deck-brand, .notes { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .step, .deck-progress { transition: none; }
}

/* --------------------------------------------------------------------------
   Portada del curso (index.html)
   -------------------------------------------------------------------------- */

.portal {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem var(--slide-pad) 4rem;
}
.portal-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(3rem, 10vh, 7rem);
  font-size: 1.1rem;
}
.portal-nav .meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.portal header { margin-bottom: 3rem; }
.portal header p { max-width: 42rem; }
.portal header .subtitle { max-width: none; font-size: clamp(1.1rem, 1.8vw, 1.5rem); }

.modules {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
}
.modules a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.4rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glow);
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.modules a:hover { border-color: var(--accent); box-shadow: var(--glow-strong); }
.modules .num { font-family: var(--font-mono); color: var(--accent); font-size: 0.85rem; }
.modules h3 { margin: 0.35em 0 0.45em; font-size: 1.3rem; }
.modules p { margin: 0 0 1rem; color: var(--muted); font-size: 1rem; }
.modules .week { margin-top: auto; align-self: flex-start; }
