:root {
  --azul: #1b2333;
  --azul-2: #273248;
  --rojo: #c8401e;
  --rojo-oscuro: #a2321a;
  --verde-wa: #1f9d55;
  --verde-wa-oscuro: #17803f;
  --fondo: #f4f5f7;
  --tarjeta: #ffffff;
  --texto: #1d232c;
  --suave: #5b6573;
  --borde: #dde1e6;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(20, 28, 40, .06), 0 4px 16px rgba(20, 28, 40, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--texto);
  background: var(--fondo);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
a { color: var(--rojo); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.contenedor { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- Cabecera y pestañas ---------- */
.cabecera { background: var(--azul); color: #fff; position: sticky; top: 0; z-index: 10; }
.cabecera__fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.marca { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.marca img { width: 40px; height: auto; }
.marca span { display: flex; flex-direction: column; line-height: 1.15; }
.marca strong { font-size: 1.05rem; letter-spacing: .02em; }
.marca small { color: #b9c2d0; font-size: .78rem; }
.pestanas { background: var(--azul-2); }
.pestanas__fila { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.pestanas__fila::-webkit-scrollbar { display: none; }
.pestanas a {
  flex: none; color: #d5dbe5; text-decoration: none; font-weight: 600; font-size: .92rem;
  padding: 12px 12px 10px; border-bottom: 3px solid transparent; white-space: nowrap;
}
.pestanas .corto { display: none; }
.pestanas a:hover { color: #fff; }
.pestanas a.activa { color: #fff; border-bottom-color: var(--rojo); }

.aviso-borrador { background: #fff3cd; color: #7a5b00; text-align: center; font-size: .85rem; padding: 4px 8px; }

/* ---------- Portada ---------- */
.portada { position: relative; background: var(--azul); }
.portada img { width: 100%; height: clamp(220px, 42vw, 440px); object-fit: cover; opacity: .9; }
.portada__texto { position: absolute; left: 0; right: 0; bottom: 0; padding-bottom: 20px; color: #fff; }
.portada__texto h1 { font-size: clamp(1.4rem, 4vw, 2.4rem); text-shadow: 0 2px 12px rgba(0, 0, 0, .55); max-width: 18em; }
.portada__texto p { margin: 0; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); max-width: 36em; }
.portada::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, rgba(10, 14, 22, .7)); pointer-events: none; }
.portada__texto { z-index: 1; }

/* ---------- Secciones ---------- */
.seccion { padding-top: 28px; padding-bottom: 40px; scroll-margin-top: 110px; }
.seccion h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
.nota-precio { color: var(--suave); font-size: .88rem; margin: 0 0 18px; }
.rejilla { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.rejilla--maquinas { grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 600; font-size: .95rem;
  text-decoration: none; cursor: pointer; min-height: 44px; text-align: center;
}
.boton--wa { background: var(--verde-wa); color: #fff; }
.boton--wa:hover { background: var(--verde-wa-oscuro); }
.boton--wa::before {
  content: ""; width: 18px; height: 18px; flex: none;
  background: currentColor;
  -webkit-mask: url("../img/whatsapp.svg") center / contain no-repeat;
  mask: url("../img/whatsapp.svg") center / contain no-repeat;
}
.boton--claro { background: #fff; color: var(--azul); border: 1px solid var(--borde); }
.boton--claro:hover { border-color: var(--azul); }
.boton--chico { padding: 6px 14px; font-size: .88rem; min-height: 38px; }

/* ---------- Tarjeta de máquina ---------- */
.maquina { background: var(--tarjeta); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; display: flex; flex-direction: column; }
.maquina__fotos { background: #e4e5e6; }
.maquina__foto { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.miniaturas { display: flex; gap: 6px; padding: 8px; background: #fff; border-bottom: 1px solid var(--borde); }
.miniaturas button { padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: none; cursor: pointer; width: 72px; }
.miniaturas button.activa { border-color: var(--rojo); }
.miniaturas img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.maquina__cuerpo { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.maquina__cuerpo p { margin: 0; color: var(--suave); }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 10px; }
.precio { font-size: 1.35rem; font-weight: 800; color: var(--azul); }
.precio--cotizar { font-size: 1rem; color: var(--suave); font-weight: 600; }

/* ---------- Tarjeta simple (estructuras) ---------- */
.tarjeta { background: var(--tarjeta); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; display: flex; flex-direction: column; gap: 6px; border-top: 4px solid var(--rojo); }
.tarjeta h3 { font-size: 1.05rem; }
.tarjeta p { margin: 0; color: var(--suave); font-size: .92rem; }
.tarjeta__pie { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tarjeta .precio { font-size: 1.15rem; }

/* ---------- Minería ---------- */
.buscador input {
  width: 100%; font: inherit; font-size: 1rem; padding: 12px 16px; border-radius: 999px;
  border: 1px solid var(--borde); background: #fff; outline: none;
}
.buscador input:focus { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(27, 35, 51, .12); }
.grupos { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: thin; }
.chip {
  flex: none; font: inherit; font-size: .85rem; border: 1px solid var(--borde); background: #fff;
  color: var(--texto); border-radius: 999px; padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
.chip.activa { background: var(--azul); border-color: var(--azul); color: #fff; }
.contador { color: var(--suave); font-size: .85rem; margin: 8px 0; }
.lista-mineria { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.fila {
  background: var(--tarjeta); border-radius: 10px; box-shadow: var(--sombra); padding: 10px 12px;
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "texto texto" "precio boton"; gap: 6px 10px; align-items: center;
}
.fila__texto { grid-area: texto; }
.fila h3 { font-size: .98rem; margin: 0; }
.fila small { color: var(--suave); font-size: .78rem; }
.fila .precio { grid-area: precio; font-size: 1.05rem; }
.fila .boton { grid-area: boton; }
.vacio { background: #fff; border-radius: 10px; padding: 16px; }

/* ---------- Contacto ---------- */
.contacto { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 20px; }
.contacto p { margin-top: 0; }
.datos { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.datos li { display: flex; flex-direction: column; }
.datos b { font-size: .8rem; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; }
.datos a { font-size: 1.1rem; font-weight: 600; }

/* ---------- Pie ---------- */
.pie { background: var(--azul); color: #b9c2d0; font-size: .85rem; }
.pie__fila { display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }
.firma { margin-left: auto; color: #fff; }

/* ---------- Ventana 3D ---------- */
.ventana3d { width: min(960px, 100vw - 16px); max-height: calc(100dvh - 16px); padding: 0; border: 0; border-radius: var(--radio); overflow: hidden; }
.ventana3d::backdrop { background: rgba(10, 14, 22, .7); }
.ventana3d__barra { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 8px 16px; background: var(--azul); color: #fff; }
.cerrar { background: none; border: 0; color: #fff; font-size: 1.3rem; width: 44px; height: 44px; cursor: pointer; }
.ventana3d__lienzo { position: relative; height: min(70dvh, 620px); background: #eef1f4; touch-action: none; }
.ventana3d__lienzo canvas { width: 100%; height: 100%; display: block; }
.cargando { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--suave); }
.ventana3d__ayuda { margin: 0; padding: 8px 16px; font-size: .82rem; color: var(--suave); text-align: center; }

@media (max-width: 480px) {
  .marca small { display: none; }
  .pestanas .largo { display: none; }
  .pestanas .corto { display: inline; }
  .pestanas a { padding-left: 7px; padding-right: 7px; font-size: .86rem; }
  .pestanas__fila { gap: 0; padding: 0 9px; }
  .cabecera .boton--chico { padding: 6px 12px; }
  .acciones .boton { flex: 1 1 100%; }
}
