@font-face {
  font-family: "Chivo";
  src: url("/fonts/chivo.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #131d27;
  --surface: #1c2834;
  --surface-2: #263443;
  --border: #4a5b6b;
  --text: #eee9df;
  --text-2: #b9c0c6;
  --muted: #97a1aa;
  --accent: #f5b43c;
  --on-accent: #14202b;
  --success: #7ed3a1;
  --danger: #ff8f80;

  --font-display: "Chivo", "Arial Narrow", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;

  --size-display: clamp(2.6rem, 7vw, 6.5rem);
  --size-h1: clamp(2rem, 5vw, 4.5rem);
  --size-h2: clamp(1.5rem, 3.2vw, 3rem);
  --size-body-l: clamp(1.15rem, 2.3vw, 2.25rem);
  --size-body-m: clamp(1rem, 1.8vw, 1.75rem);
  --size-caption: clamp(0.9rem, 1.2vw, 1.15rem);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --slide-pad: clamp(24px, 5vw, 96px);

  --radius-sm: 8px;
  --radius-md: 16px;
  --z-nav: 10;
}

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

html {
  background: var(--bg);
  scroll-behavior: auto;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--size-body-m);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd,
figure {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}

a:hover {
  text-decoration-thickness: 3px;
}

a:active {
  color: var(--text);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.skip {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-sm);
  z-index: var(--z-nav);
}

.skip:focus {
  top: var(--space-4);
}

/* Roles tipográficos */
.display,
.h1,
.h2 {
  font-family: var(--font-display);
  text-wrap: balance;
}

.display {
  font-size: var(--size-display);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 22ch;
}

.h1 {
  font-size: var(--size-h1);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -0.015em;
  max-width: 28ch;
}

.h2 {
  font-size: var(--size-h2);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.lead {
  font-size: var(--size-body-l);
  line-height: 1.35;
  max-width: 46ch;
  text-wrap: pretty;
}

.body {
  font-size: var(--size-body-m);
  color: var(--text-2);
  max-width: 46ch;
  text-wrap: pretty;
}

.caption,
.source {
  font-size: var(--size-caption);
  font-weight: 600;
  color: var(--muted);
}

.takeaway {
  font-size: var(--size-body-l);
  line-height: 1.3;
  font-weight: 700;
  max-width: 40ch;
  margin-top: var(--space-3);
}

/* Slide: modo lectura por defecto (celular y sin JavaScript) */
.slide {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-5);
  padding: var(--space-7) var(--slide-pad);
  border-bottom: 1px solid var(--border);
  max-width: 1600px;
  margin-inline: auto;
}

/* La slide recibe foco por código al navegar, para que el lector de pantalla la siga; no lleva anillo. */
.slide:focus {
  outline: none;
}

.slide--statement .display,
.slide--statement .h1 {
  max-width: 20ch;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--size-h2);
}

.brand__data {
  color: var(--accent);
}

/* Juego y contacto: texto y QR */
.game {
  display: grid;
  gap: var(--space-6);
  align-items: center;
}

.game__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.rules,
.facts,
.contact {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-left: 1.2em;
  font-size: var(--size-body-l);
  max-width: 40ch;
}

.contact {
  list-style: none;
  padding-left: 0;
}

.rules strong {
  color: var(--accent);
}

.qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  justify-self: center;
}

.qr img {
  display: block;
  width: min(70vw, 320px);
  height: auto;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
}

.qr figcaption {
  font-size: var(--size-body-l);
  font-weight: 600;
}

/* Cronología, cifras y tarjetas */
.timeline {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-4);
  max-width: 60ch;
}

.timeline li {
  display: grid;
  gap: var(--space-1);
  color: var(--text-2);
}

.timeline__when {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
}

.figure-row {
  display: grid;
  gap: var(--space-6);
  align-items: center;
}

.stat {
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat__label,
.stat__context {
  font-variant-numeric: tabular-nums;
  font-size: var(--size-body-m);
  color: var(--text-2);
}

.stat__value {
  font-family: var(--font-display);
  font-size: var(--size-display);
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat--inline .stat__value {
  font-variant-numeric: tabular-nums;
  font-size: var(--size-h1);
}

.cards {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-md);
}

.habits {
  display: grid;
  gap: var(--space-4);
  padding-left: 1.4em;
  max-width: 62ch;
  color: var(--text-2);
}

.habits strong {
  color: var(--text);
}

.questions {
  display: grid;
  gap: var(--space-3);
  padding-left: 1.4em;
  font-family: var(--font-display);
  font-size: var(--size-h1);
  font-weight: 800;
  line-height: 1.1;
}

.split {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
}

.split__side {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--surface);
  border-radius: var(--radius-md);
}

.split__label {
  font-family: var(--font-display);
  font-size: var(--size-h2);
  font-weight: 700;
}

.split__side--model .split__label {
  color: var(--danger);
}

.split__side--code .split__label {
  color: var(--success);
}

.chips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.chips li {
  padding: var(--space-2) var(--space-4);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: var(--size-body-m);
}

.takeaways {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.takeaways div {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--surface);
  border-radius: var(--radius-md);
}

.takeaways dt {
  font-size: var(--size-caption);
  font-weight: 600;
  color: var(--muted);
}

.takeaways dd {
  font-size: var(--size-body-l);
  font-weight: 600;
  line-height: 1.3;
}

.sources {
  display: grid;
  gap: var(--space-2);
  padding-left: 1.2em;
  color: var(--text-2);
  max-width: 90ch;
}

.slide--sources .sources {
  font-size: var(--size-caption);
}

/* Navegación: solo en modo proyector y solo si corre el script */
.deck-nav {
  display: none;
}

/* Modo proyector: una slide por pantalla */
@media (min-width: 1024px) {
  .slide {
    min-height: 100svh;
    border-bottom: 0;
    padding-block: var(--space-8);
    scroll-margin-top: 0;
  }

  .game {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  }

  .qr img {
    width: min(30vw, 46svh);
  }

  .figure-row {
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--space-8);
  }

  .js .deck-nav {
    display: flex;
    gap: var(--space-2);
    position: fixed;
    right: var(--space-5);
    bottom: var(--space-5);
    z-index: var(--z-nav);
  }

  .deck-nav__btn {
    font: 600 var(--size-caption) / 1 var(--font-body);
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
    touch-action: manipulation;
  }

  .deck-nav__btn:hover {
    background: var(--surface-2);
    color: var(--text);
  }

  .deck-nav__btn:active {
    transform: scale(0.97);
  }

  .deck-nav__btn[aria-disabled="true"],
  .deck-nav__btn:disabled {
    opacity: 0.4;
    cursor: default;
  }
}

@media print {
  .deck-nav,
  .skip {
    display: none;
  }

  .slide {
    min-height: auto;
    break-after: page;
  }
}

@media (prefers-reduced-motion: reduce) {
  .deck-nav__btn:active {
    transform: none;
  }
}
