/*
 * Manual ilustrado de Mi Ranchito. Una sola hoja para la pantalla (teléfono y computadora) y para el PDF
 * (tamaño carta). Las capturas llevan encima marcas en SVG: amarillo «crayón de marcar ganado» con
 * contorno oscuro, y el mismo número que el paso del texto.
 */
@font-face {
  font-family: 'Bitter';
  src: url('fonts/bitter-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Bitter';
  src: url('fonts/bitter-latin-800-normal.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('fonts/atkinson-hyperlegible-next-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('fonts/atkinson-hyperlegible-next-latin-400-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('fonts/atkinson-hyperlegible-next-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --cal: #f2f4ef; /* fondo: pared de cal */
  --hoja: #ffffff;
  --monte: #0b4a35; /* verde de la marca */
  --monte-2: #14513a;
  --pasto: #dde9e1;
  --tinta: #17221c;
  --tierra: #46524b;
  --maiz: #ffc21a; /* marcas y números de paso */
  --maiz-claro: #fff4d1;
  --chile: #a32a1d;
  --chile-claro: #fcebe7;
  --linea: #c9d2cc;
  --titulo: 'Bitter', 'Rockwell', 'Georgia', serif;
  --texto: 'Atkinson Hyperlegible Next', 'Segoe UI', 'Roboto', 'Arial', sans-serif;
  --medida: 40rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--cal);
  color: var(--tinta);
  font-family: var(--texto);
  font-size: 1.125rem; /* 18 px */
  line-height: 1.55;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--monte);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--tinta);
  outline-offset: 3px;
  border-radius: 4px;
  box-shadow: 0 0 0 6px var(--maiz);
}

strong {
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.saltar {
  position: absolute;
  left: 1rem;
  top: -10rem;
  background: var(--maiz);
  color: var(--tinta);
  padding: 0.75rem 1rem;
  font-weight: 700;
  z-index: 10;
}
.saltar:focus {
  top: 1rem;
}

/* ───────────── Portada ───────────── */

.portada {
  background: var(--monte);
  color: #fff;
  overflow: hidden;
}
.portada-texto {
  max-width: 68rem;
  margin: 0 auto;
  padding: 3rem 1rem 0.5rem;
}
.portada h1 {
  font-family: var(--titulo);
  font-weight: 800;
  font-size: clamp(2.6rem, 9vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  max-width: 12ch;
}
.portada .bajada {
  font-size: 1.3rem;
  line-height: 1.4;
  max-width: 34rem;
  margin: 0 0 1.5rem;
  color: #e9f2ec;
}
.portada .acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.boton {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid currentColor;
}
.boton-maiz {
  background: var(--maiz);
  color: var(--tinta);
  border-color: var(--maiz);
}
.boton-claro {
  color: #fff;
}
.portada .edicion {
  font-size: 0.95rem;
  color: #cfe3d7;
  margin: 0;
}
.portada-paisaje {
  display: block;
  width: 100%;
  height: auto;
  margin-top: -1rem;
}

/* ───────────── Índice ───────────── */

.indice {
  max-width: 68rem;
  margin: 0 auto;
  padding: 2.5rem 1rem 1rem;
}
.indice h2,
.leer h2 {
  font-family: var(--titulo);
  font-weight: 800;
  font-size: 2rem;
  margin: 0 0 1rem;
}
.indice ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0 2rem;
}
.indice li {
  border-bottom: 1px solid var(--linea);
}
.indice a {
  display: grid;
  grid-template-columns: 2.6rem 1fr auto;
  align-items: baseline;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.6rem 0;
  color: var(--tinta);
  text-decoration: none;
  font-weight: 700;
}
.indice a:hover .cap-nombre {
  text-decoration: underline;
}
.indice .cap-n {
  font-family: var(--titulo);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--monte);
}
.indice .pag {
  font-variant-numeric: tabular-nums;
  color: var(--tierra);
  font-weight: 400;
}

/* ───────────── Cómo leer ───────────── */

.leer {
  max-width: 68rem;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
}
.leer-caja {
  background: var(--hoja);
  border-radius: 1rem;
  padding: 1.25rem 1.25rem 0.5rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
.leer-caja p {
  margin: 0 0 0.9rem;
  max-width: var(--medida);
}
.muestra {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--maiz);
  border: 2.5px solid var(--tinta);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
  vertical-align: middle;
  margin: 0 0.15rem;
}

/* ───────────── Capítulos ───────────── */

main {
  display: block;
}
.capitulo {
  max-width: 68rem;
  margin: 3rem auto 0;
  padding: 0 1rem;
}
.cap-cab {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 1rem;
  align-items: end;
  border-bottom: 6px solid var(--monte);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}
.cap-num {
  font-family: var(--titulo);
  font-weight: 800;
  font-size: clamp(4rem, 14vw, 6.5rem);
  line-height: 0.8;
  color: var(--monte);
  margin: 0;
}
.cap-cab h2 {
  font-family: var(--titulo);
  font-weight: 800;
  font-size: clamp(1.8rem, 5.5vw, 2.6rem);
  line-height: 1.08;
  margin: 0;
}
.cap-lead {
  grid-column: 1 / -1;
  font-size: 1.25rem;
  line-height: 1.45;
  margin: 0.9rem 0 0;
  max-width: var(--medida);
  color: var(--tierra);
}

.tarea {
  background: var(--hoja);
  border-radius: 1.25rem;
  padding: 1.25rem 1rem 1rem;
  margin: 0 0 1.25rem;
}
.tarea > h3 {
  font-family: var(--titulo);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 0.75rem;
}
.tarea > p,
.tarea > ul,
.paso-a-paso p {
  max-width: var(--medida);
}
.tarea > p {
  margin: 0 0 0.9rem;
}

.paso-a-paso {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
  margin: 0.5rem 0 1rem;
}
.paso-a-paso + .paso-a-paso {
  border-top: 1px dashed var(--linea);
  padding-top: 1.25rem;
}

/* Pasos con el mismo número que la marca de la captura */
ol.pasos {
  list-style: none;
  counter-reset: paso;
  margin: 0;
  padding: 0;
}
ol.pasos > li {
  counter-increment: paso;
  position: relative;
  padding: 0 0 0 3.1rem;
  margin: 0 0 1rem;
  min-height: 2.3rem;
}
ol.pasos > li::before {
  content: counter(paso);
  position: absolute;
  left: 0;
  top: -0.1rem;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: var(--maiz);
  border: 2.5px solid var(--tinta);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
}
.pasos .detalle {
  display: block;
  color: var(--tierra);
  font-size: 1rem;
  margin-top: 0.15rem;
}

ul.puntos {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}
ul.puntos li {
  margin-bottom: 0.4rem;
}

/* Captura de pantalla con marcas */
figure {
  margin: 0;
}
.shot {
  width: min(100%, 20rem);
  justify-self: center;
}
.pantalla {
  /* aspect-ratio vale para el contenido (sin el marco), igual que la imagen y las marcas */
  box-sizing: content-box;
  position: relative;
  overflow: hidden;
  border: 7px solid var(--tinta);
  border-radius: 1.6rem;
  background: #fff;
  aspect-ratio: var(--ar);
}
.pantalla.corte-arriba {
  border-top-width: 3px;
  border-top-left-radius: 0.4rem;
  border-top-right-radius: 0.4rem;
}
.pantalla.corte-abajo {
  border-bottom-width: 3px;
  border-bottom-left-radius: 0.4rem;
  border-bottom-right-radius: 0.4rem;
}
.pantalla img {
  position: absolute;
  left: 0;
  width: 100%;
  height: auto;
  max-width: none;
  display: block;
}
.pantalla svg.marcas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.pantalla.corte-arriba::before,
.pantalla.corte-abajo::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1.6rem;
  pointer-events: none;
}
.pantalla.corte-arriba::before {
  top: 0;
  background: linear-gradient(#fff, rgba(255, 255, 255, 0));
}
.pantalla.corte-abajo::after {
  bottom: 0;
  background: linear-gradient(rgba(255, 255, 255, 0), #fff);
}
.shot figcaption,
.dibujo figcaption {
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--tierra);
  margin-top: 0.5rem;
  text-align: center;
}
.shot-ancha {
  width: 100%;
  max-width: 24.375rem;
}
.tira {
  border: 4px solid var(--tinta);
  border-radius: 0.8rem;
  overflow: hidden;
  background: #fff;
}
.tira img {
  display: block;
  width: 100%;
  height: auto;
}

/* Dibujos (SVG) */
.dibujo {
  justify-self: center;
  width: min(100%, 22rem);
}
.dibujo img {
  display: block;
  width: 100%;
  height: auto;
}
.dibujo-ancho {
  width: min(100%, 36rem);
}

/* Estados del indicador */
.estados {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.estados li {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--linea);
  border-radius: 0.9rem;
  padding: 0.75rem;
}
.estados .tira {
  border-width: 3px;
}
.estados p {
  margin: 0;
}
.estado-nombre {
  font-weight: 700;
  display: block;
}

/* Consejo y Ojo */
.nota {
  border-radius: 0.9rem;
  padding: 0.9rem 1rem 0.9rem 3.5rem;
  margin: 0.25rem 0 1rem;
  position: relative;
  max-width: 46rem;
}
.nota p {
  margin: 0;
}
.nota p + p {
  margin-top: 0.4rem;
}
.nota .nota-t {
  font-weight: 700;
}
.nota::before {
  content: '';
  position: absolute;
  left: 0.9rem;
  top: 0.95rem;
  width: 1.8rem;
  height: 1.8rem;
  background-repeat: no-repeat;
  background-size: contain;
}
.consejo {
  background: var(--pasto);
}
.consejo::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b4a35' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2.1h5c0-.9.4-1.6 1-2.1A6 6 0 0 0 12 3z'/%3E%3C/svg%3E");
}
.ojo {
  background: var(--chile-claro);
  border-left: 6px solid var(--chile);
}
.ojo::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a32a1d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}
.ojo .nota-t {
  color: var(--chile);
}

/* Preguntas frecuentes */
.faq {
  background: var(--hoja);
  border-radius: 1.25rem;
  padding: 1.25rem 1rem 0.5rem;
  margin: 0 0 1.25rem;
}
.faq h3 {
  font-family: var(--titulo);
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0 0 0.75rem;
}
.faq dl {
  margin: 0;
}
.faq dt {
  font-weight: 700;
  margin: 0;
}
.faq dd {
  margin: 0.2rem 0 1rem;
  max-width: var(--medida);
}

/* Tabla sencilla */
.tabla {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: 1rem;
}
.tabla th,
.tabla td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--linea);
}
.tabla th {
  background: var(--pasto);
}
.tabla-scroll {
  overflow-x: auto;
}

.pie {
  max-width: 68rem;
  margin: 3rem auto 0;
  padding: 2rem 1rem 3rem;
  border-top: 6px solid var(--monte);
  font-size: 1rem;
  color: var(--tierra);
}
.pie p {
  margin: 0 0 0.6rem;
  max-width: var(--medida);
}

/* ───────────── Computadora ───────────── */

@media (min-width: 52rem) {
  .portada-texto {
    padding-top: 4rem;
  }
  .leer-caja {
    grid-template-columns: 1fr 1fr;
    padding: 1.5rem 1.75rem 0.75rem;
  }
  .tarea,
  .faq {
    padding: 1.75rem 2rem 1.25rem;
  }
  .paso-a-paso {
    grid-template-columns: 20rem 1fr;
    gap: 2.25rem;
  }
  .paso-a-paso.solo-texto {
    grid-template-columns: 1fr;
  }
  .paso-a-paso.dibujo-izq {
    grid-template-columns: 22rem 1fr;
  }
  .shot {
    justify-self: start;
  }
  .dibujo {
    justify-self: start;
  }
}

@media (max-width: 30rem) {
  .estados li {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ───────────── PDF (tamaño carta) ───────────── */

@page {
  size: letter;
  margin: 0.65in 0.7in 0.75in;
  @bottom-center {
    content: 'Manual de Mi Ranchito · página ' counter(page);
    font-family: 'Atkinson Hyperlegible Next', Arial, sans-serif;
    font-size: 9.5pt;
    color: #46524b;
  }
}
@page :first {
  margin: 0;
  @bottom-center {
    content: none;
  }
}

@media print {
  body {
    background: #fff;
    font-size: 11.5pt;
    line-height: 1.45;
  }
  .saltar,
  .solo-pantalla {
    display: none !important;
  }
  a {
    color: inherit;
    text-decoration: none;
  }
  .portada {
    height: 11in;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    break-after: page;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .portada-texto {
    padding: 1.1in 0.8in 0;
    max-width: none;
  }
  .portada h1 {
    font-size: 58pt;
  }
  .portada .bajada {
    font-size: 17pt;
    max-width: 5.8in;
  }
  .portada-paisaje {
    margin-top: 0;
  }
  .indice {
    padding: 0;
    max-width: none;
  }
  .indice h2,
  .leer h2 {
    font-size: 22pt;
  }
  .indice ol {
    display: block;
    columns: 2;
    column-gap: 0.4in;
  }
  .indice li {
    break-inside: avoid;
  }
  .indice a {
    min-height: 0;
    padding: 0.06in 0;
    grid-template-columns: 0.42in 1fr auto;
    font-size: 11.5pt;
  }
  .leer {
    padding: 0;
    margin: 0.3in 0 0;
    max-width: none;
    break-inside: avoid;
    font-size: 11pt;
  }
  .leer-caja {
    grid-template-columns: 1fr 1fr;
    padding: 0;
    gap: 0.3in;
  }
  .capitulo {
    break-before: page;
    margin: 0;
    padding: 0;
    max-width: none;
  }
  .cap-num {
    font-size: 54pt;
  }
  .cap-cab h2 {
    font-size: 24pt;
  }
  .cap-lead {
    font-size: 13pt;
  }
  .tarea,
  .faq {
    padding: 0;
    border-radius: 0;
    margin: 0 0 0.25in;
    background: none;
  }
  .tarea > h3 {
    font-size: 16pt;
    break-after: avoid;
  }
  .paso-a-paso {
    grid-template-columns: 2.55in 1fr;
    gap: 0.3in;
    break-inside: avoid;
  }
  .paso-a-paso.solo-texto {
    grid-template-columns: 1fr;
  }
  .paso-a-paso.dibujo-izq {
    grid-template-columns: 2.9in 1fr;
  }
  .shot {
    width: 2.55in;
    justify-self: start;
  }
  .shot-ancha {
    width: 100%;
  }
  .pantalla {
    border-width: 4px;
    border-radius: 0.2in;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .nota,
  .estados li,
  .faq dt,
  .faq dd,
  figure {
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  ol.pasos > li::before,
  .muestra,
  .tabla th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .faq dt {
    break-after: avoid;
  }
  .pie {
    break-before: avoid;
    border-top-width: 3px;
    padding: 0.2in 0 0;
    margin-top: 0.3in;
  }
}
