/*
 * Hoja de la guía de RutaGas (guia.rutagas.com).
 *
 * Se diseña para el celular: la mayoría de dueños de distribuidoras abre el
 * enlace desde WhatsApp. La misma página sale también en PDF (construir.sh),
 * con hoja de 100 × 178 mm, la proporción de una pantalla de teléfono.
 *
 * Paleta de landing/src/brand.ts (RutaGas).
 */

@page {
  size: 100mm 178mm;
  margin: 9mm 7mm 8mm;
}

:root {
  --bg: #ffffff;
  --ink: #111827;
  --muted: #5b6675;
  --border: #e3e7ed;
  --navy: #071827;
  --naranja: #ff6b00;
  --naranja-osc: #e35f00;
  --crema: #fff4eb;
  --gris: #f5f7fa;
  --ok: #15803d;
  --ok-bg: #edf7ef;
  --ojo-bg: #fff8e6;
  --ojo: #b7791f;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 11pt;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

a {
  color: var(--naranja-osc);
}

/* --- Portada ---------------------------------------------------------- */

.portada {
  background: var(--navy);
  color: #fff;
  border-bottom: 4px solid var(--naranja);
  padding: 6mm 5mm 5mm;
  margin: 0 0 6mm;
  border-radius: 8px;
}

.marca {
  display: flex;
  align-items: center;
  gap: 3mm;
  margin: 0 0 4mm;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.marca img {
  width: 10mm;
  height: 10mm;
  border-radius: 2.5mm;
}

.marca span {
  color: var(--naranja);
}

/* La marca lleva a la portada con todas las guías. */
.marca-link {
  display: flex;
  align-items: center;
  gap: 3mm;
  color: inherit;
  text-decoration: none;
}

.marca small {
  margin-left: 1mm;
  padding-left: 2.5mm;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  color: #c9d3df;
  font-weight: 500;
  font-size: 0.85rem;
}

/* --- Portada: lista de guías (inicio.html) ----------------------------- */

.guias {
  list-style: none;
  padding: 0;
  margin: 0 0 6mm;
}

.guias li {
  margin: 0 0 3mm;
}

.guias a {
  display: block;
  padding: 4mm;
  border: 1px solid var(--border);
  border-left: 4px solid var(--naranja);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.guias a strong {
  display: block;
  font-size: 1.08rem;
  color: var(--navy);
}

.guias a span {
  display: block;
  margin-top: 1mm;
  color: var(--muted);
  font-size: 0.9rem;
}

.guias .para {
  display: inline-block;
  margin-top: 2mm;
  padding: 0 2mm;
  border-radius: 999px;
  background: var(--crema);
  color: var(--naranja-osc);
  font-size: 0.78rem;
  font-weight: 700;
}

h1 {
  font-size: 1.7rem;
  line-height: 1.12;
  margin: 0 0 2.5mm;
  letter-spacing: -0.01em;
}

.lead {
  margin: 0;
  color: #c9d3df;
  font-size: 0.98rem;
}

/* --- Índice ----------------------------------------------------------- */

.indice {
  list-style: none;
  padding: 0;
  margin: 0 0 6mm;
  counter-reset: idx;
}

.indice li {
  counter-increment: idx;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.indice a {
  display: flex;
  align-items: center;
  gap: 3mm;
  padding: 3mm 1mm;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.indice a::before {
  content: counter(idx);
  flex: none;
  width: 7mm;
  height: 7mm;
  border-radius: 50%;
  background: var(--crema);
  color: var(--naranja-osc);
  font-size: 0.82rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.indice small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.82rem;
}

/* --- Texto ------------------------------------------------------------ */

h2 {
  font-size: 1.3rem;
  line-height: 1.2;
  margin: 9mm 0 3mm;
  padding-top: 2mm;
  color: var(--navy);
  break-after: avoid;
  scroll-margin-top: 4mm;
}

h2 .num {
  display: inline-block;
  min-width: 8mm;
  color: var(--naranja);
}

h3 {
  font-size: 1.05rem;
  margin: 7mm 0 2mm;
  color: var(--naranja-osc);
  break-after: avoid;
}

p {
  margin: 0 0 3mm;
}

ul {
  margin: 0 0 3mm;
  padding-left: 5mm;
}

li {
  margin-bottom: 1.5mm;
}

.muted {
  color: var(--muted);
}

/* --- Pasos numerados --- */

.pasos {
  counter-reset: paso;
  list-style: none;
  padding: 0;
  margin: 0 0 4mm;
}

.pasos > li {
  counter-increment: paso;
  position: relative;
  padding-left: 9mm;
  margin-bottom: 3.5mm;
  break-inside: avoid;
}

.pasos > li::before {
  content: counter(paso);
  position: absolute;
  left: 0;
  top: 0.1mm;
  width: 6.4mm;
  height: 6.4mm;
  border-radius: 50%;
  background: var(--naranja);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  line-height: 6.4mm;
}

/* --- Recuadros --- */

.nota,
.ojo,
.clave {
  break-inside: avoid;
  padding: 3mm 3.5mm;
  margin: 0 0 4mm;
  border-radius: 6px;
  font-size: 0.93rem;
}

.nota {
  background: var(--crema);
  border-left: 3px solid var(--naranja);
}

.ojo {
  background: var(--ojo-bg);
  border-left: 3px solid #e5b94a;
}

.clave {
  background: var(--ok-bg);
  border-left: 3px solid var(--ok);
}

.nota p:last-child,
.ojo p:last-child,
.clave p:last-child {
  margin-bottom: 0;
}

.titulito {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 800;
  margin-bottom: 1mm;
  color: var(--naranja-osc);
}

.ojo .titulito {
  color: var(--ojo);
}

.clave .titulito {
  color: var(--ok);
}

/* --- Piezas de la pantalla citadas en el texto --- */

.btn {
  display: inline-block;
  padding: 0 1.8mm;
  border-radius: 4px;
  background: var(--naranja);
  color: #fff;
  font-size: 0.88em;
  font-weight: 700;
  white-space: nowrap;
}

.campo {
  display: inline-block;
  padding: 0 1.5mm;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--gris);
  font-size: 0.9em;
}

.ruta {
  font-weight: 700;
  color: var(--naranja-osc);
}

/* --- Tablas --- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0 0 4mm;
  break-inside: avoid;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 2mm 1.5mm;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

td:first-child {
  font-weight: 700;
  white-space: nowrap;
}

/* --- Capturas ---------------------------------------------------------
 * Fotos del panel real tomadas con el teléfono de 390 px, así que se leen al
 * ancho de la pantalla. Tocar una la abre sola para hacer zoom. */

/* En papel van más angostas: a todo el ancho, una captura alta se come la
 * hoja entera y deja huecos. En pantalla (abajo) se agrandan. */
figure.captura {
  break-inside: avoid;
  margin: 0 auto 5mm;
  width: 64%;
}

figure.captura.chica {
  width: 50%;
}

figure.captura.ancha {
  width: 90%;
}

figure.captura a {
  display: block;
}

figure.captura img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(7, 24, 39, 0.08);
}

figure.captura figcaption {
  margin-top: 1.5mm;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
  text-align: center;
}

/* --- Checklist --- */

.check {
  list-style: none;
  padding: 0;
  margin: 0 0 4mm;
}

.check li {
  position: relative;
  padding: 2.5mm 0 2.5mm 9mm;
  border-bottom: 1px solid var(--border);
  margin: 0;
  break-inside: avoid;
}

.check li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2.8mm;
  width: 5.5mm;
  height: 5.5mm;
  border: 2px solid var(--naranja);
  border-radius: 4px;
}

.check small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

/* --- Cierre --- */

.pie {
  margin-top: 8mm;
  padding-top: 3mm;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

.salto {
  break-before: page;
}

/* Lo que solo tiene sentido en pantalla (el PDF, el botón de subir). Va
 * oculto ANTES del bloque de pantalla: una media query no suma
 * especificidad, y si esta regla fuera después ganaría siempre. */
.solo-pantalla {
  display: none;
}

/* ------------------------------------------------------------- pantalla -- */
@media screen {
  html {
    /* 16 px: el mínimo con el que iOS no hace zoom solo. */
    font-size: 16px;
    background: var(--gris);
    scroll-behavior: smooth;
  }

  body {
    max-width: 36rem;
    margin: 0 auto;
    padding: 0 1.1rem 4rem;
    background: var(--bg);
    min-height: 100vh;
  }

  .portada {
    margin: 0 -1.1rem 1.5rem;
    padding: 1.6rem 1.3rem 1.4rem;
    border-radius: 0;
  }

  figure.captura {
    width: 88%;
  }

  figure.captura.chica {
    width: 68%;
  }

  figure.captura.ancha {
    width: 100%;
  }

  .marca img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .solo-pantalla {
    display: block;
  }

  .descargar {
    margin-top: 1.5rem;
    text-align: center;
  }

  .descargar a {
    display: inline-block;
    padding: 0.7rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
  }

  .ayuda {
    margin-top: 1rem;
    text-align: center;
  }

  .ayuda a {
    display: inline-block;
    padding: 0.8rem 1.3rem;
    border-radius: 10px;
    background: #25d366;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
  }

  .arriba {
    position: fixed;
    right: 14px;
    bottom: 16px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    display: grid;
    place-items: center;
    text-decoration: none;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(7, 24, 39, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  .arriba.ver {
    opacity: 1;
    pointer-events: auto;
  }

  @media (min-width: 40rem) {
    .arriba {
      right: calc(50% - 18rem - 60px);
    }
  }
}
