/* ============================================================
   Furgovolta — "manual de campo" editorial
   Dirección: papel cálido + tinta + acento sol; Fraunces
   (display) · Archivo (texto) · IBM Plex Mono (datos/etiquetas).
   Mobile-first. Sin frameworks. Sin JS de estilo.
   ============================================================ */

:root {
  /* paleta */
  --papel:      #F6F1E7;
  --papel-2:    #EFE7D6;
  --tinta:      #16130F;
  --tinta-2:    #453C31;
  --tinta-3:    #6E6355;
  --linea:      #D9CDB8;
  --linea-2:    #C4B79E;
  --sol:        #E2622B;
  --sol-osc:    #C4501C;
  --verde:      #2F5D3A;
  --ambar:      #A96A00;

  /* tipografía */
  --display: "Fraunces", "Georgia", serif;
  --texto:   "Archivo", "Helvetica Neue", sans-serif;
  --mono:    "IBM Plex Mono", "SFMono-Regular", monospace;

  /* escala fluida */
  --fs-h1:    clamp(2.6rem, 7vw + 1rem, 5rem);
  --fs-h2:    clamp(1.55rem, 2.2vw + 1rem, 2.35rem);
  --fs-h3:    clamp(1.1rem, 1vw + .9rem, 1.3rem);
  --fs-base:  clamp(1rem, .3vw + .95rem, 1.1rem);
  --fs-small: .82rem;

  --medida: 68ch;
  --radio: 4px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: var(--fs-base)/1.65 var(--texto);
  color: var(--tinta);
  background: var(--papel);
  text-rendering: optimizeLegibility;
}

/* grano sutil de papel (solo atmósfera, no intercepta clics) */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- enlaces ---------- */
a {
  color: var(--tinta);
  text-decoration: none;
  border-bottom: 2px solid var(--sol);
  transition: background-color .15s ease, border-color .15s ease;
}
a:hover { background: rgba(226, 98, 43, .14); border-color: var(--sol-osc); }
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--sol);
  outline-offset: 2px;
}

/* ---------- cabecera / hero ---------- */
header {
  background: var(--tinta);
  color: var(--papel);
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 5vw, 3rem) clamp(1.5rem, 4vw, 2.5rem);
  border-bottom: 4px solid var(--sol);
  position: relative;
  overflow: hidden;
}
/* filete técnico superior tipo manual */
header::before {
  content: "MANUAL DE CAMPO — ENERGÍA OFF-GRID";
  display: block;
  font: 600 .68rem/1 var(--mono);
  letter-spacing: .28em;
  color: var(--sol);
  margin-bottom: clamp(1rem, 3vw, 2rem);
}
/* panel solar decorativo: rejilla de celdas inclinada (temático, no genérico) */
header::after {
  content: "";
  position: absolute;
  right: clamp(-24px, -1vw, 0px);
  top: clamp(14px, 3vw, 34px);
  width: clamp(140px, 24vw, 260px);
  height: clamp(90px, 15vw, 165px);
  background:
    repeating-linear-gradient(90deg, rgba(246, 241, 231, .12) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(0deg, rgba(246, 241, 231, .12) 0 1px, transparent 1px 34px),
    linear-gradient(135deg, rgba(226, 98, 43, .22), rgba(47, 93, 58, .3));
  border: 1px solid rgba(246, 241, 231, .2);
  border-radius: 2px;
  transform: rotate(-4deg);
  box-shadow: 0 24px 44px -28px rgba(0, 0, 0, .9);
  opacity: .75;
  pointer-events: none;
}
header h1 {
  font: 900 var(--fs-h1)/1.04 var(--display);
  font-variation-settings: "SOFT" 30, "WONK" 1;
  letter-spacing: -.015em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
header .claim {
  font: italic 400 clamp(1.05rem, 1.6vw, 1.35rem)/1.55 var(--display);
  color: rgba(246, 241, 231, .9);
  max-width: 46ch;
  margin: 0 0 1.9rem;
}
header .aviso {
  font: 500 .87rem/1.6 var(--texto);
  color: rgba(246, 241, 231, .92);
  border-left: 3px solid var(--sol);
  padding: .45rem 0 .45rem .85rem;
  margin: 0;
  max-width: 58ch;
}
header .aviso a { color: var(--papel); border-color: rgba(246,241,231,.5); }
header .aviso a:hover { border-color: var(--sol); }

/* ---------- cuerpo ---------- */
main {
  max-width: calc(var(--medida) + 6rem);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 5vw, 2rem) 0;
  counter-reset: seccion;
}

h1, h2, h3 { text-wrap: balance; }

h2 {
  font: 800 var(--fs-h2)/1.12 var(--display);
  font-variation-settings: "SOFT" 20;
  letter-spacing: -.01em;
  margin: 0 0 .55em;
  color: var(--tinta);
}

h3 {
  font: 700 var(--fs-h3)/1.3 var(--texto);
  margin: 1.6em 0 .5em;
}

p { margin: 0 0 1em; max-width: var(--medida); }

/* secciones: paneles de manual con numeración */
section {
  counter-increment: seccion;
  position: relative;
  background: #FDFBF6;
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  padding: clamp(1.1rem, 3vw, 1.8rem);
  margin: 0 0 clamp(1rem, 3vw, 1.6rem);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
section::before { content: none; }
/* el número va DENTRO del H2 (chip): jerarquía conectada, no suelto en la esquina */
section h2::before {
  content: counter(seccion, decimal-leading-zero);
  display: inline-block;
  font: 600 .46em/1 var(--mono);
  letter-spacing: .1em;
  color: var(--sol);
  background: rgba(226, 98, 43, .1);
  border: 1px solid rgba(226, 98, 43, .4);
  border-radius: 3px;
  padding: .3em .5em;
  margin-right: .75em;
  vertical-align: .3em;
}
section:hover {
  border-color: #E4B79A;
  box-shadow: 0 14px 34px -18px rgba(22, 19, 15, .5);
  transform: translateY(-2px);
}
/* ritmo: el último bloque nunca deja hueco extra dentro del panel */
section p:last-child,
section ul:last-child,
section ol:last-child,
section table:last-child { margin-bottom: 0; }

/* ---------- listas ---------- */
main ul, main ol { padding-left: 1.3em; max-width: var(--medida); }
main li { margin-bottom: .45em; }
main li::marker { color: var(--sol); font-weight: 700; }

/* ---------- tablas ---------- */
table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: .95rem;
  margin: 0 0 1.2em;
  -webkit-overflow-scrolling: touch;
}
caption {
  caption-side: top;
  text-align: left;
  font: 500 var(--fs-small)/1.4 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tinta-3);
  padding-bottom: .5rem;
}
th, td {
  border-bottom: 1px solid var(--linea);
  padding: .6rem .75rem;
  text-align: left;
  vertical-align: top;
  min-width: 8.5rem;
}
thead th,
table tr:first-child th {
  background: var(--tinta);
  color: var(--papel);
  font: 600 .78rem/1.3 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 3px solid var(--sol);
}
tbody tr:nth-child(even) { background: var(--papel-2); }
tbody td:first-child { font-weight: 600; }
/* el párrafo que abre cada panel va en gris: el H2 manda */
h2 + p { color: var(--tinta-2); }

/* ---------- checklist ---------- */
ul.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.checklist li {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .55rem .6rem;
  border-bottom: 1px dashed var(--linea-2);
  margin: 0;
}
ul.checklist li:last-child { border-bottom: 0; }
ul.checklist input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 1.15rem; height: 1.15rem;
  margin: .18rem 0 0;
  border: 2px solid var(--tinta);
  border-radius: 3px;
  background: #FFF;
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease;
}
ul.checklist input[type="checkbox"]:checked {
  background-color: var(--verde);
  border-color: var(--verde);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3.2L13 5' fill='none' stroke='%23F6F1E7' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 90%;
  background-position: center;
  background-repeat: no-repeat;
}
ul.checklist li:has(input:checked) {
  color: var(--tinta-3);
  text-decoration: line-through;
  text-decoration-color: var(--linea-2);
}

/* ---------- botones ---------- */
button {
  font: 600 .85rem/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--papel);
  background: var(--tinta);
  border: 2px solid var(--tinta);
  border-radius: var(--radio);
  padding: .85rem 1.4rem;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
button:hover { background: var(--sol); border-color: var(--sol); }
button:active { transform: translateY(1px); }
button::after { content: " →"; letter-spacing: 0; }

/* ---------- aviso (dentro del contenido, sobre papel claro) ---------- */
main .aviso {
  font-size: var(--fs-small);
  color: var(--tinta-2);
  background: var(--papel-2);
  border: 1px solid var(--linea);
  border-left: 3px solid var(--ambar);
  border-radius: var(--radio);
  padding: .7rem .9rem;
}

/* ---------- pie ---------- */
footer {
  background: var(--tinta);
  color: rgba(246, 241, 231, .75);
  margin-top: clamp(2rem, 6vw, 4rem);
  padding: clamp(1.4rem, 4vw, 2.4rem) clamp(1rem, 5vw, 3rem);
  border-top: 4px solid var(--sol);
  font-size: var(--fs-small);
}
footer p { margin: 0 0 .5rem; max-width: none; }
footer a {
  color: var(--papel);
  border-bottom-color: rgba(246, 241, 231, .4);
}
footer a:hover { border-bottom-color: var(--sol); background: rgba(226, 98, 43, .18); }

/* ---------- utilidades ---------- */
strong { font-weight: 700; color: var(--tinta); }
hr { border: 0; border-top: 1px solid var(--linea); margin: 2rem 0; }

/* ---------- movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  section:hover { transform: none; }
}

/* ---------- pantallas estrechas ---------- */
@media (max-width: 480px) {
  header::after { display: none; }
  section::before { top: .6rem; right: .8rem; }
  button { width: 100%; }
}
