/* ============================================================
   Especial "Agosto, mes de Huánuco"
   Paleta heredada del fondo del header del diario.
   ============================================================ */

:root {
  --tinta:        #12241c;
  --tinta-suave:  #3a564a;
  --verde:        #28644b;
  --verde-hondo:  #163f2e;
  --crema:        #fbfbcb;
  --papel:        #f7f3e7;
  --papel-hondo:  #ece5d1;
  --sol:          #8a5804;
  --linea:        #d9d0b7;
  --hondo:        #112e22;
  --hondo-texto:  #e6f0e8;
  --hondo-suave:  #b8ccbf;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 400 18px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 1.18;
  margin: 0 0 .55em;
  letter-spacing: -0.01em;
  color: var(--verde-hondo);
}

p { margin: 0 0 1.1em; }
img { display: block; max-width: 100%; }
strong { color: var(--verde-hondo); }

a { color: var(--verde); }
a:hover { color: var(--verde-hondo); }

.ancho-texto {
  width: min(760px, 100% - 48px);
  margin: 0 auto;
}

/* ------------------------- PORTADA ------------------------- */

.portada {
  position: relative;
  min-height: clamp(380px, 58vh, 580px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background: #1d3a30;
}

.portada-foto {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 60%;
}

/* Franja de papel detrás del texto: sin esto el titular cae sobre la foto y no
   se lee. Se disuelve hacia la derecha para dejar ver la imagen. */
.portada-envoltura {
  position: relative;
  z-index: 1;
  width: 100%;
  background: linear-gradient(
    to bottom,
    rgba(247, 243, 231, 0) 0%,
    rgba(247, 243, 231, .94) 26%,
    rgba(247, 243, 231, .98) 100%
  );
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 58%, rgba(0, 0, 0, .4) 82%, transparent 99%);
  mask-image: linear-gradient(to right, #000 0%, #000 58%, rgba(0, 0, 0, .4) 82%, transparent 99%);
}

.portada-texto {
  width: min(760px, 100% - 48px);
  margin: 0 auto;
  padding: clamp(24px, 3.5vw, 40px) 0 clamp(24px, 3.5vw, 42px);
}

.kicker {
  margin: 0 0 .5em;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--verde-hondo);
}

.portada h1 {
  font-size: clamp(32px, 5.4vw, 58px);
  max-width: 16ch;
}

.bajada {
  max-width: 54ch;
  font-size: clamp(16.5px, 2vw, 19px);
  color: #16382a;
}

.indice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 1.1em;
}

.indice a {
  padding: 7px 14px;
  border: 1px solid var(--verde);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .05em;
  text-decoration: none;
  color: var(--verde);
  background: rgba(247, 243, 231, .75);
}

.indice a:hover { background: var(--verde); color: var(--papel); }

/* --------------------------- BLOQUES --------------------------- */

.bloque {
  padding: clamp(52px, 8vw, 100px) 0;
  border-bottom: 1px solid var(--linea);
}

.bloque:last-of-type { border-bottom: none; }

.bloque-claro { background: var(--papel-hondo); }

.bloque-oscuro {
  background: var(--hondo);
  border-bottom: none;
}

.bloque-oscuro h2,
.bloque-oscuro h3 { color: var(--crema); }

.bloque-oscuro p,
.bloque-oscuro figcaption { color: var(--hondo-texto); }

.bloque-oscuro strong { color: #ffffff; }
.bloque-oscuro .seccion-num { color: #e0b154; }
.bloque-oscuro .credito { color: var(--hondo-suave); }

.seccion-num {
  margin: 0 0 .4em;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .24em;
  color: var(--sol);
}

.bloque h2 { font-size: clamp(28px, 4vw, 42px); }

.entradilla {
  max-width: 56ch;
  font-size: clamp(17px, 2vw, 19.5px);
  color: var(--tinta-suave);
}

/* ---------------------- LÍNEA DE TIEMPO ---------------------- */

.linea-tiempo { margin-top: clamp(28px, 4vw, 44px); }

.linea-ayuda {
  margin: 0 0 .6em;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sol);
}

.linea-pista {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--linea);
}

.hito-btn {
  position: relative;
  padding: 9px 16px;
  border: 1px solid var(--linea);
  border-radius: 999px;
  background: #fffdf6;
  color: var(--tinta-suave);
  font: 600 14px/1 inherit;
  font-family: inherit;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.hito-btn:hover { border-color: var(--verde); color: var(--verde-hondo); }

.hito-btn.activo {
  background: var(--verde);
  border-color: var(--verde);
  color: #fffdf6;
}

.hito-btn.activo::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -20px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: var(--verde);
  border-radius: 50%;
}

.linea-detalle {
  padding: 22px 0 0;
  min-height: 120px;
}

.linea-detalle h3 { font-size: 22px; margin-bottom: .3em; }
.linea-detalle p { margin: 0; color: var(--tinta-suave); }

/* ------------------------- COMPARADOR ------------------------- */

.bloque-interno { margin-top: clamp(36px, 6vw, 72px); }
.bloque-interno h3 { font-size: clamp(23px, 2.8vw, 32px); }
.bloque-interno p { color: var(--tinta-suave); }

.comparador {
  width: min(1180px, 100% - 48px);
  margin: clamp(24px, 4vw, 40px) auto 0;
}

.comparador-marco {
  position: relative;
  height: clamp(240px, 40vw, 460px);
  overflow: hidden;
  border-radius: 4px;
  background: #2a2620;
}

.comparador-carro {
  height: 100%;
  cursor: grab;
  touch-action: pan-y;
}

.comparador-carro:active { cursor: grabbing; }

.comparador-carro img {
  height: 100%;
  width: auto;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

.comparador-antes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #efe7d5;
  transition: opacity .45s ease;
}

.comparador-marco[data-vista="ahora"] .comparador-antes {
  opacity: 0;
  pointer-events: none;
}

.comparador-sello {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 6px 12px;
  border-radius: 3px;
  background: rgba(17, 46, 34, .88);
  color: var(--crema);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
}

.comparador-botones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.epoca {
  padding: 9px 18px;
  border: 1px solid var(--linea);
  border-radius: 999px;
  background: #fffdf6;
  color: var(--tinta-suave);
  font: 600 14px/1 inherit;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.epoca:hover { border-color: var(--verde); color: var(--verde-hondo); }

.epoca.activo {
  background: var(--verde);
  border-color: var(--verde);
  color: #fffdf6;
}

.comparador figcaption {
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--tinta-suave);
}

/* ---------------------------- LUPA ---------------------------- */

.lupa {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px;
  background: rgba(9, 22, 16, .93);
}

.lupa[hidden] { display: none; }

.lupa img {
  max-width: min(1200px, 100%);
  max-height: 76vh;
  object-fit: contain;
  border-radius: 3px;
}

.lupa-pie {
  margin: 0;
  max-width: 70ch;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  color: #d8e6dc;
}

.lupa-cerrar {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 9px 16px;
  border: 1px solid #6f8a7a;
  border-radius: 999px;
  background: transparent;
  color: #e6f0e8;
  font: 600 13px/1 inherit;
  font-family: inherit;
  letter-spacing: .08em;
  cursor: pointer;
}

.lupa-cerrar:hover { background: #1d4736; }

.ampliable { cursor: zoom-in; }

/* ---------------------------- HITOS ---------------------------- */

.hito {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  width: min(1180px, 100% - 48px);
  margin: clamp(36px, 6vw, 72px) auto 0;
}

.hito-invertido .hito-foto { order: 2; }

.hito-foto { margin: 0; }

.hito-foto img {
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.hito-foto figcaption {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--tinta-suave);
}

.credito {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: .02em;
  color: #5b6b61;
}

.hito-fecha {
  margin: 0 0 .4em;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sol);
}

.hito-texto h3 { font-size: clamp(23px, 2.8vw, 32px); }
.hito-texto p { color: var(--tinta-suave); }
.hito-texto p:last-child { margin-bottom: 0; }

.destacado {
  width: min(760px, 100% - 48px);
  margin: clamp(36px, 6vw, 72px) auto 0;
  padding: clamp(24px, 4vw, 36px);
  background: var(--papel-hondo);
  border-left: 4px solid var(--verde);
  border-radius: 3px;
}

.destacado h3 { font-size: clamp(22px, 2.6vw, 28px); }
.destacado p { color: var(--tinta-suave); }
.destacado p:last-child { margin-bottom: 0; }

/* --------------------------- REJILLA --------------------------- */

.rejilla {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(20px, 3vw, 36px);
  width: min(1180px, 100% - 48px);
  margin: clamp(32px, 5vw, 60px) auto 0;
}

.rejilla-tres { grid-template-columns: repeat(3, 1fr); }

.tarjeta {
  margin: 0;
  background: #fffdf6;
  border: 1px solid var(--linea);
  border-radius: 4px;
  overflow: hidden;
}

.tarjeta img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.tarjeta figcaption { padding: 18px 20px 20px; }
.tarjeta h3 { font-size: 21px; margin-bottom: .45em; }
.tarjeta p { margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--tinta-suave); }
.tarjeta .credito { margin-top: 12px; }

/* ------------------- CERRO CON FIGURA REVELABLE ------------------- */

.revelar {
  width: min(1180px, 100% - 48px);
  margin: clamp(28px, 5vw, 52px) auto 0;
}

.revelar-lienzo {
  cursor: ew-resize;
  touch-action: none;
  border-radius: 4px;
  overflow: hidden;
}

.revelar svg {
  display: block;
  width: 100%;
  height: auto;
}

.trazo {
  fill: none;
  stroke: #ffe066;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* Valor alto de arranque: app.js lo reemplaza por la longitud real del trazo. */
  stroke-dasharray: 3000;
  stroke-dashoffset: 3000;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, .55));
}

.marcas g { opacity: 0; transition: opacity .35s ease; }
.marcas g.on { opacity: 1; }
.marcas circle { fill: #ffe066; stroke: #12241c; stroke-width: 2.5; }
.marcas text {
  fill: #12241c;
  font: 700 24px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .02em;
  text-anchor: middle;
  paint-order: stroke;
  stroke: #ffe066;
  stroke-width: 7;
  stroke-linejoin: round;
}

.revelar figcaption {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 18px 0 0;
  text-align: center;
}

.revelar label {
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tinta-suave);
}

.revelar input[type="range"] {
  width: min(460px, 100%);
  accent-color: var(--verde);
}

/* -------------------------- CUESTIONARIO -------------------------- */

.quiz { margin-top: clamp(28px, 4vw, 44px); }

.pregunta {
  padding: 22px 24px;
  margin-bottom: 16px;
  background: #fffdf6;
  border: 1px solid var(--linea);
  border-radius: 4px;
}

.pregunta h3 { font-size: 19px; margin-bottom: .8em; }

.opcion {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px 16px;
  text-align: left;
  border: 1px solid var(--linea);
  border-radius: 3px;
  background: var(--papel);
  color: var(--tinta);
  font: 400 16px/1.4 inherit;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.opcion:hover:enabled { border-color: var(--verde); background: #fff; }
.opcion:disabled { cursor: default; }

.opcion.acierto {
  border-color: #1d7a4c;
  background: #e2f2e6;
  color: #104027;
  font-weight: 600;
}

.opcion.error {
  border-color: #a3341f;
  background: #f7e3de;
  color: #7a2716;
}

.respuesta {
  display: none;
  margin: 12px 0 0;
  padding-left: 14px;
  border-left: 3px solid var(--verde);
  font-size: 15px;
  line-height: 1.6;
  color: var(--tinta-suave);
}

.respuesta.visible { display: block; }

.marcador {
  display: none;
  padding: 20px 24px;
  background: var(--verde-hondo);
  border-radius: 4px;
  color: var(--crema);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  text-align: center;
}

.marcador.visible { display: block; }

.reiniciar {
  display: block;
  margin: 14px auto 0;
  padding: 10px 22px;
  border: 1px solid var(--verde);
  border-radius: 999px;
  background: transparent;
  color: var(--verde-hondo);
  font: 600 14px/1 inherit;
  font-family: inherit;
  cursor: pointer;
}

.reiniciar:hover { background: var(--verde); color: #fffdf6; }

/* ---------------------------- DATOS ---------------------------- */

.datos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

.dato {
  padding: 20px;
  background: var(--papel-hondo);
  border-left: 3px solid var(--verde);
  border-radius: 3px;
}

.dato-cifra {
  margin: 0 0 .35em;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-weight: 700;
  color: var(--verde-hondo);
}

.dato-pie { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--tinta-suave); }

/* ----------------------------- PIE ----------------------------- */

.pie {
  background: var(--papel-hondo);
  border-top: 1px solid var(--linea);
  padding: clamp(36px, 6vw, 64px) 0 clamp(32px, 5vw, 56px);
}

.pie h3 { font-size: 19px; }

.pie-nota {
  font-size: 14px;
  line-height: 1.6;
  color: var(--tinta-suave);
}

.creditos {
  margin: 0 0 1.2em;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 32px;
}

.creditos li {
  break-inside: avoid;
  margin-bottom: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--tinta-suave);
}

/* Entrada al hacer scroll */
[data-entra] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s ease, transform .7s ease;
}
[data-entra].visible { opacity: 1; transform: none; }

/* --------- BLOQUE OSCURO: se define al final a proposito ---------
   Las reglas de componente (.hito-texto p, .credito) tienen la misma
   especificidad y van antes, asi que ganarian y dejarian texto verde oscuro
   sobre fondo verde oscuro. Estas suben la especificidad y cierran el tema. */

.bloque-oscuro .entradilla,
.bloque-oscuro .hito-texto p,
.bloque-oscuro .hito-foto figcaption,
.bloque-oscuro .destacado p { color: var(--hondo-texto); }

.bloque-oscuro .hito-foto figcaption .credito,
.bloque-oscuro .credito { color: var(--hondo-suave); }

.bloque-oscuro .hito-fecha { color: #e0b154; }

/* --------------------------- MÓVIL --------------------------- */

@media (max-width: 900px) {
  .portada-envoltura {
    -webkit-mask-image: none;
    mask-image: none;
  }
  .rejilla, .rejilla-tres { grid-template-columns: 1fr; }
  .creditos { columns: 1; }
}

@media (max-width: 760px) {
  body { font-size: 17px; }

  .hito {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hito-invertido .hito-foto { order: 0; }

  .portada { min-height: 62vh; }

  /* El SVG del cerro se achica mucho: las marcas necesitan más cuerpo. */
  .marcas text { font-size: 40px; stroke-width: 10; }
  .marcas circle { r: 12; stroke-width: 4; }
  .trazo { stroke-width: 10; }

  .hito-btn { font-size: 13px; padding: 8px 13px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-entra] { opacity: 1; transform: none; transition: none; }
}
