/*
  Manual de uso (manual.html). Se apoya en css/estilo.css.

  Dos columnas: índice pegajoso a la izquierda, hojas a la derecha. En el
  celular pasa a una sola columna con el índice arriba, plegado.
  Al final están las reglas de impresión, que son las que usa el PDF.
*/

.manual {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 46px);
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 26px clamp(16px, 2.4vw, 38px) 60px;
  align-items: start;
}

/* ------------------------------------------------------------------ índice */

.indice {
  position: sticky;
  top: 86px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radio);
  padding: 16px 18px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.indice > summary {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin-bottom: 10px;
  cursor: pointer;
  list-style: none;
}

.indice > summary::-webkit-details-marker {
  display: none;
}

.indice > summary::after {
  content: ' ▾';
  color: var(--text-faint);
}

.indice:not([open]) > summary {
  margin-bottom: 0;
}

.indice:not([open]) > summary::after {
  content: ' ▸';
}

.indice ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 2px;
}

.indice li::marker {
  color: var(--text-faint);
  font-size: 12px;
}

.indice a {
  display: block;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 8px;
  line-height: 1.35;
}

.indice a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.indice a.activo {
  color: var(--text);
  background: var(--primary-soft);
  font-weight: 700;
}

/* ------------------------------------------------------------------- hojas */

.hojas {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radio-lg);
  padding: clamp(22px, 3.4vw, 46px);
}

.hojas section {
  padding-top: 18px;
  /* Que el ancla no quede tapada por la barra pegajosa. */
  scroll-margin-top: 90px;
}

.hojas section + section {
  margin-top: 34px;
  border-top: 1px solid var(--border);
}

.hojas h2 {
  font-size: clamp(21px, 2.4vw, 27px);
  line-height: 1.25;
  margin: 8px 0 14px;
  letter-spacing: -0.3px;
}

.hojas h3 {
  font-size: 16px;
  margin: 24px 0 8px;
  color: var(--primary);
  letter-spacing: -0.1px;
}

.hojas p,
.hojas li {
  max-width: 68ch;
}

.hojas p {
  margin: 0 0 12px;
  color: var(--text-dim);
}

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

.hojas ul,
.hojas ol {
  margin: 0 0 14px;
  padding-left: 22px;
  display: grid;
  gap: 7px;
  color: var(--text-dim);
}

.hojas li::marker {
  color: var(--text-faint);
}

.hojas em {
  color: var(--text);
  font-style: normal;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  padding: 1px 5px;
}

/* --------------------------------------------------------------------- tapa */

.tapa {
  text-align: center;
  padding: 10px 0 30px;
  border-bottom: 1px solid var(--border);
}

.tapa img {
  border-radius: 18px;
}

.tapa h1 {
  font-size: clamp(28px, 4.6vw, 42px);
  margin: 10px 0 8px;
  letter-spacing: -0.8px;
}

.tapa .bajada {
  max-width: 54ch;
  margin: 0 auto 10px;
  color: var(--text-dim);
  font-size: 16px;
}

/* El índice del PDF solo existe al imprimir. */
.indice-pdf {
  display: none;
}

/* ------------------------------------------------------------------- avisos */

.aviso-m {
  background: rgba(255, 176, 32, 0.1);
  border: 1px solid rgba(255, 176, 32, 0.4);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 11px 14px;
  margin: 14px 0 16px;
  color: var(--text-dim);
  max-width: 68ch;
}

.aviso-m strong {
  color: var(--warning-txt, #b45f00);
}

/* ---------------------------------------------------------------------- faq */

.faq {
  margin: 0;
  display: grid;
  gap: 14px;
  max-width: 68ch;
}

.faq dt {
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.faq dt::before {
  content: '▸ ';
  color: var(--primary);
}

.faq dd {
  margin: 0 0 0 16px;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------- pie */

footer .enlace-pie {
  color: var(--text-faint);
}

.pie-manual {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* ----------------------------------------------------------------- celular */

@media (max-width: 860px) {
  .manual {
    grid-template-columns: 1fr;
    padding-top: 16px;
    gap: 14px;
  }

  .indice {
    position: static;
    max-height: none;
    padding: 12px 14px;
  }

  .indice ol {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    padding-top: 4px;
  }

  .hojas {
    border-radius: var(--radio);
  }

  /* La barra de arriba se pasaba del ancho del teléfono. */
  header.barra {
    padding: 10px 14px;
    flex-wrap: wrap;
  }

  header.barra nav {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .ocultar-movil {
    display: none;
  }
}

/* --------------------------------------------------------- impresión y PDF */

@media print {
  @page {
    size: A4;
    margin: 16mm 14mm 18mm;
  }

  html,
  body {
    background: #fff !important;
    background-image: none !important;
    color: #1f2431;
  }

  .no-imprimir,
  header.barra,
  footer {
    display: none !important;
  }

  .manual {
    display: block;
    max-width: none;
    padding: 0;
  }

  .hojas {
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .hojas p,
  .hojas li,
  .faq dd,
  .aviso-m {
    color: #394359;
    max-width: none;
  }

  .hojas strong,
  .faq dt,
  .tapa h1,
  .hojas h2 {
    color: #121620;
  }

  .hojas h3 {
    color: #b34e0f;
  }

  .hojas em {
    background: #faf8f7;
    color: #1f2431;
  }

  .hojas section {
    /* Cada capítulo arranca en hoja nueva; el primero no. */
    break-before: page;
    page-break-before: always;
    padding-top: 0;
    border-top: 0;
  }

  .hojas section + section {
    margin-top: 0;
    border-top: 0;
  }

  .hojas h2,
  .hojas h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .hojas li,
  .faq dt,
  .faq dd,
  .aviso-m,
  .tapa {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .tapa {
    border-bottom: 1px solid #e4d8cc;
    padding-top: 60px;
    padding-bottom: 50px;
  }

  .tapa .bajada,
  .tapa .nota {
    color: #4c5876;
  }

  .indice-pdf {
    display: block;
    padding-top: 26px;
  }

  .indice-pdf h2 {
    font-size: 18px;
    margin: 0 0 10px;
  }

  .indice-pdf ol {
    padding-left: 34px;
    display: grid;
    gap: 5px;
    color: #394359;
  }

  .aviso-m {
    background: #fff7e6;
    border-color: #e0a92c;
  }

  .aviso-m strong {
    color: #8a5a00;
  }

  .pie-manual {
    border-top: 1px solid #e4d8cc;
    color: #65759c;
  }

  a {
    color: #b34e0f;
    text-decoration: none;
  }
}
