/* CuántosMateriales — hoja de estilos principal
   Paleta: ámbar de obra + gris piedra. Sin dependencias externas. */

:root {
  --pred-terracota: #8a3a1f;
  --pred-terracota-fuerte: #5f2612;
  --pred-terracota-medio: #a9552f;
  --pred-terracota-suave: #f6ece2;
  --pred-terracota-linea: #e2cbb8;

  --pred-tinta: #2b2320;
  --pred-tinta-suave: #5b514c;
  --pred-tinta-tenue: #7c716a;

  --pred-fondo: #faf8f4;
  --pred-panel: #ffffff;
  --pred-hundido: #f2ece3;
  --pred-trazo: #e3dacd;
  --pred-trazo-fino: #d3c7b7;

  --pred-bueno: #2f6b4f;
  --pred-bueno-fondo: #eef5f0;
  --pred-bueno-linea: #c3ddcd;

  --pred-dato: #2f5566;
  --pred-dato-fondo: #ecf2f5;
  --pred-dato-linea: #c6d8e0;

  --pred-alerta-fondo: #fdf3ec;
  --pred-alerta-linea: #e6cdb9;
  --pred-alerta: #8a3a1f;

  --pred-redondeo: 6px;
  --pred-redondeo-grande: 10px;
  --pred-ancho: 1040px;
  --pred-lectura: 72ch;

  --pred-letra: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pred-cifras: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--pred-letra);
  font-size: 16px;
  line-height: 1.65;
  color: var(--pred-tinta);
  background: var(--pred-fondo);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--pred-dato); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; margin-top: 2em; }
h3 { font-size: 1.1rem; margin-top: 1.6em; }
p { margin: 0 0 1em; }

.predio-marco { width: 100%; max-width: var(--pred-ancho); margin: 0 auto; padding: 0 20px; }

.brinca-lindero {
  position: absolute; left: -9999px; top: 0; background: var(--pred-terracota); color: #fff;
  padding: 10px 16px; z-index: 100; border-radius: 0 0 var(--pred-redondeo) 0;
}
.brinca-lindero:focus { left: 0; }

/* ---------- Cabecera ----------
   Escritorio: marca + fila horizontal de secciones.
   Móvil con JS: botón hamburguesa + panel desplegable a pantalla completa.
   Móvil sin JS: la fila se envuelve (nunca queda inaccesible). */
.lindero-franja {
  border-bottom: 1px solid var(--pred-trazo);
  background: var(--pred-fondo);
  position: sticky; top: 0; z-index: 60;
}
.lindero-franja > .predio-marco { display: flex; align-items: center; gap: 12px; min-height: 60px; position: relative; }

.emblema-lote { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.06rem; color: var(--pred-tinta); letter-spacing: -.02em; flex: none; }
.emblema-lote:hover { text-decoration: none; }
.emblema-mojon {
  width: 26px; height: 26px; border-radius: 6px; background: var(--pred-terracota);
  display: grid; place-items: center; flex: none;
}
.emblema-mojon span { width: 12px; height: 12px; border: 2px solid #fff; border-radius: 2px; display: block; }
.emblema-lote b { color: var(--pred-terracota-fuerte); }

/* --- Botón hamburguesa: solo existe si hay JS y la pantalla es angosta --- */
.abre-lindero {
  display: none; margin-left: auto; padding: 0; flex: none;
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  border: 1px solid var(--pred-trazo-fino); border-radius: 9px;
  background: var(--pred-fondo); color: var(--pred-tinta); cursor: pointer;
}
.abre-lindero:hover { background: var(--pred-hundido); }
.abre-lindero:focus-visible { outline: 2px solid var(--pred-terracota-medio); outline-offset: 2px; }
.abre-lindero-rayas { display: block; position: relative; width: 20px; height: 14px; }
.abre-lindero-rayas i {
  position: absolute; left: 0; right: 0; height: 2px; border-radius: 2px;
  background: currentColor; transition: transform .18s ease, opacity .18s ease;
}
.abre-lindero-rayas i:nth-child(1) { top: 0; }
.abre-lindero-rayas i:nth-child(2) { top: 6px; }
.abre-lindero-rayas i:nth-child(3) { top: 12px; }
.abre-lindero[aria-expanded="true"] .abre-lindero-rayas i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.abre-lindero[aria-expanded="true"] .abre-lindero-rayas i:nth-child(2) { opacity: 0; }
.abre-lindero[aria-expanded="true"] .abre-lindero-rayas i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Velo que cubre la página mientras el panel está abierto */
.velo-lindero {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  height: 100vh; height: 100dvh;
  background: rgba(28, 25, 23, .42); z-index: 1;
}

.lindero-ruta { margin-left: auto; }
.lindero-lista { list-style: none; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 0; padding: 0; }
.lindero-lista a {
  display: block; color: var(--pred-tinta-suave); font-size: .9rem;
  padding: 7px 11px; border-radius: 7px; white-space: nowrap;
}
.lindero-lista a:hover { background: var(--pred-hundido); color: var(--pred-tinta); text-decoration: none; }
.lindero-lista a[aria-current] { color: var(--pred-terracota-fuerte); background: var(--pred-terracota-suave); font-weight: 600; }

@media (max-width: 899px) {
  .js .abre-lindero { display: inline-flex; }

  /* El panel se ancla al borde inferior de la cabecera y ocupa todo el ancho */
  .js .lindero-ruta {
    display: none; position: absolute; top: 100%; left: -20px; right: -20px;
    z-index: 2; margin-left: 0;
    padding: 8px 12px 14px;
    background: var(--pred-fondo);
    border-top: 1px solid var(--pred-trazo);
    border-bottom: 1px solid var(--pred-trazo);
    box-shadow: 0 20px 34px -20px rgba(28, 25, 23, .5), 0 1px 3px rgba(28, 25, 23, .1);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .js .lindero-ruta.lindero-desplegado { display: block; }
  .js.lindero-abierto .velo-lindero { display: block; }
  .js.lindero-abierto body { overflow: hidden; }

  .js .lindero-lista { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 0; }
  .js .lindero-lista li:not(:last-child) { border-bottom: 1px solid var(--pred-trazo); }
  .js .lindero-lista a {
    display: flex; align-items: center; min-height: 48px;
    padding: 11px 14px; font-size: .98rem; border-radius: 8px;
    white-space: normal;
  }
  .js .lindero-lista a[aria-current] { background: var(--pred-terracota-suave); box-shadow: inset 3px 0 0 var(--pred-terracota); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .abre-lindero-rayas i { transition: none; }
}

/* Los enlaces a anclas no deben quedar tapados por la cabecera fija */
[id] { scroll-margin-top: 74px; }

/* ---------- Miga de pan ---------- */
.migas-lindero { font-size: .82rem; color: var(--pred-tinta-tenue); padding: 14px 0 0; }
.migas-lindero ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.migas-lindero li::after { content: "/"; margin-left: 6px; color: var(--pred-trazo-fino); }
.migas-lindero li:last-child::after { content: ""; }
.migas-lindero a { color: var(--pred-tinta-tenue); }

/* ---------- Hero ---------- */
.lindero-alto { padding: 42px 0 30px; border-bottom: 1px solid var(--pred-trazo); background: linear-gradient(180deg, var(--pred-terracota-suave), var(--pred-fondo)); }
.lindero-alto h1 { font-size: 2.15rem; max-width: 22ch; }
.lindero-alto .copete-predio { font-size: 1.08rem; color: var(--pred-tinta-suave); max-width: 62ch; margin-bottom: 0; }
.lindero-cintilla { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.cintilla-predio {
  font-size: .8rem; color: var(--pred-terracota-fuerte); background: var(--pred-fondo);
  border: 1px solid var(--pred-terracota-linea); padding: 4px 11px; border-radius: 999px; font-weight: 500;
}

/* ---------- Secciones ---------- */
.tramo-predio { padding: 40px 0; }
.tramo-predio > .predio-marco > h2:first-child { margin-top: 0; }
.tramo-rotulo { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.tramo-rotulo h2 { margin: 0; }
.tramo-rotulo p { margin: 0; color: var(--pred-tinta-suave); font-size: .92rem; }

/* ---------- Rejilla de herramientas ---------- */
.rejilla-lote { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .rejilla-lote { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 940px) { .rejilla-lote { grid-template-columns: repeat(3, 1fr); } }

.parcela {
  display: block; border: 1px solid var(--pred-trazo); border-radius: var(--pred-redondeo-grande);
  padding: 18px; background: var(--pred-fondo); color: inherit; transition: border-color .15s, transform .15s;
}
.parcela:hover { text-decoration: none; border-color: var(--pred-terracota-linea); transform: translateY(-2px); }
.parcela h3 { margin: 0 0 6px; font-size: 1.02rem; color: var(--pred-terracota-fuerte); }
.parcela p { margin: 0; font-size: .89rem; color: var(--pred-tinta-suave); line-height: 1.55; }
.parcela .rotero-predio { margin-top: 10px; font-size: .77rem; color: var(--pred-tinta-tenue); font-family: var(--pred-cifras); }

/* ---------- Panel calculadora ---------- */
.avaluo {
  border: 1px solid var(--pred-trazo-fino); border-radius: var(--pred-redondeo-grande); overflow: hidden;
  background: var(--pred-fondo); margin: 26px 0 8px;
}
.avaluo-frente {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  background: var(--pred-hundido); border-bottom: 1px solid var(--pred-trazo);
  font-size: .88rem; font-weight: 600; color: var(--pred-tinta-suave);
}
.avaluo-frente .punto-lindero { width: 8px; height: 8px; border-radius: 50%; background: var(--pred-terracota-medio); flex: none; }
.avaluo-cuerpo { display: grid; grid-template-columns: 1fr; }
@media (min-width: 840px) { .avaluo-cuerpo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.avaluo-tomas { padding: 20px 18px; border-bottom: 1px solid var(--pred-trazo); }
@media (min-width: 840px) { .avaluo-tomas { border-bottom: 0; border-right: 1px solid var(--pred-trazo); } }

.casillero-lote { margin-bottom: 15px; }
.casillero-lote:last-child { margin-bottom: 0; }
.casillero-lote label { display: block; font-size: .84rem; font-weight: 600; color: var(--pred-tinta-suave); margin-bottom: 5px; }
.casillero-lote .pista-predio { font-size: .76rem; color: var(--pred-tinta-tenue); font-weight: 400; display: block; margin-top: 5px; }

.casillero-conjunto { border: 0; padding: 0; margin: 0 0 15px; }
.casillero-conjunto legend { display: block; font-size: .84rem; font-weight: 600; color: var(--pred-tinta-suave); margin-bottom: 5px; padding: 0; }
.casillero-conjunto .pista-predio { font-size: .76rem; color: var(--pred-tinta-tenue); display: block; margin-top: 5px; }

.casillero-dato, .listado-predio {
  width: 100%; padding: 9px 11px; font-family: inherit; font-size: .95rem;
  border: 1px solid var(--pred-trazo-fino); border-radius: 8px; background: var(--pred-fondo); color: var(--pred-tinta);
}
.casillero-dato:focus, .listado-predio:focus { outline: 2px solid var(--pred-terracota-medio); outline-offset: -1px; border-color: var(--pred-terracota-medio); }

.dos-casilleros { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.visto-lindero { display: flex; align-items: flex-start; gap: 9px; font-size: .87rem; color: var(--pred-tinta-suave); margin-bottom: 11px; }
.visto-lindero:last-child { margin-bottom: 0; }
.visto-lindero input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; accent-color: var(--pred-terracota); }

.avaluo-salida { padding: 20px 18px; background: var(--pred-panel); }
.cifra-catastro {
  background: var(--pred-fondo); border: 1px solid var(--pred-bueno-linea); border-radius: var(--pred-redondeo);
  padding: 15px 16px; margin-bottom: 16px;
}
.cifra-catastro .etiqueta-predio { font-size: .77rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pred-tinta-tenue); font-weight: 600; }
.cifra-catastro .valor-predio { font-size: 1.85rem; font-weight: 700; color: var(--pred-bueno); line-height: 1.15; margin-top: 3px; }
.cifra-catastro .debajo-predio { font-size: .84rem; color: var(--pred-tinta-suave); margin-top: 3px; }

.tabla-unidades { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--pred-fondo); }
.tabla-unidades caption { text-align: left; font-size: .77rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pred-tinta-tenue); font-weight: 600; padding-bottom: 7px; }
.tabla-unidades th, .tabla-unidades td { padding: 8px 10px; border-bottom: 1px solid var(--pred-trazo); text-align: left; }
.tabla-unidades th { font-size: .78rem; color: var(--pred-tinta-tenue); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tabla-unidades td:last-child, .tabla-unidades th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-unidades tbody tr:last-child td { border-bottom: 0; }
.tabla-unidades .rubro-predio { font-weight: 600; color: var(--pred-tinta); }
.tabla-unidades .aclaracion-predio { display: block; font-size: .76rem; color: var(--pred-tinta-tenue); font-weight: 400; }

.avaluo-botonera { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.boton-avaluo {
  font: inherit; font-size: .87rem; font-weight: 600; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--pred-trazo-fino); background: var(--pred-fondo); color: var(--pred-tinta-suave); cursor: pointer;
}
.boton-avaluo:hover { background: var(--pred-hundido); }
.boton-avaluo-fuerte { background: var(--pred-terracota); border-color: var(--pred-terracota); color: #fff; }
.boton-avaluo-fuerte:hover { background: var(--pred-terracota-fuerte); }

/* ---------- Prosa ---------- */
.lectura-predio { max-width: var(--pred-lectura); }
.lectura-predio h2 + p, .lectura-predio h3 + p { margin-top: .2em; }
.lectura-predio ul, .lectura-predio ol { padding-left: 1.3em; margin: 0 0 1em; }
.lectura-predio li { margin-bottom: .35em; }
.lectura-predio strong { font-weight: 650; }

.ecuacion-gravamen {
  font-family: var(--pred-cifras); font-size: .86rem; background: var(--pred-hundido);
  border-left: 3px solid var(--pred-terracota-medio); border-radius: 0 8px 8px 0;
  padding: 12px 15px; margin: 0 0 1.2em; overflow-x: auto; line-height: 1.7;
}

/* ---------- Tablas de datos ---------- */
.tabla-gravamen { width: 100%; border-collapse: collapse; font-size: .88rem; margin: 0 0 1.4em; }
.tabla-gravamen caption { text-align: left; font-size: .82rem; color: var(--pred-tinta-tenue); padding-bottom: 8px; }
.tabla-gravamen th, .tabla-gravamen td { padding: 9px 11px; border: 1px solid var(--pred-trazo); text-align: left; vertical-align: top; }
.tabla-gravamen thead th { background: var(--pred-hundido); font-size: .8rem; color: var(--pred-tinta-suave); font-weight: 650; }
.tabla-gravamen tbody tr:nth-child(even) { background: var(--pred-panel); }
.tabla-gravamen td.cifra-predio { font-variant-numeric: tabular-nums; white-space: nowrap; }
.desliza-gravamen { overflow-x: auto; margin-bottom: 1.4em; }
.desliza-gravamen .tabla-gravamen { margin-bottom: 0; min-width: 520px; }

/* ---------- Avisos ---------- */
.aviso-lindero {
  border: 1px solid var(--pred-dato-linea); background: var(--pred-dato-fondo);
  border-radius: var(--pred-redondeo); padding: 14px 16px; margin: 0 0 1.4em; font-size: .91rem; color: #1e3a8a;
}
.aviso-lindero p:last-child { margin-bottom: 0; }
.aviso-lindero strong { font-weight: 650; }
.aviso-lindero.alerta-predio { border-color: var(--pred-alerta-linea); background: var(--pred-alerta-fondo); color: var(--pred-alerta); }
.aviso-lindero.bueno-predio { border-color: var(--pred-bueno-linea); background: var(--pred-bueno-fondo); color: #14532d; }

/* ---------- FAQ ---------- */
.dudas-predio { max-width: var(--pred-lectura); }
.dudas-predio details { border-bottom: 1px solid var(--pred-trazo); }
.dudas-predio summary {
  cursor: pointer; padding: 14px 30px 14px 0; font-weight: 600; font-size: .97rem;
  list-style: none; position: relative; color: var(--pred-tinta);
}
.dudas-predio summary::-webkit-details-marker { display: none; }
.dudas-predio summary::after {
  content: "+"; position: absolute; right: 4px; top: 12px; font-size: 1.25rem;
  font-weight: 400; color: var(--pred-terracota-medio); line-height: 1;
}
.dudas-predio details[open] summary::after { content: "\2212"; }
.dudas-predio .respuesta-catastro { padding: 0 0 16px; font-size: .93rem; color: var(--pred-tinta-suave); max-width: 68ch; }
.dudas-predio .respuesta-catastro p:last-child { margin-bottom: 0; }

/* ---------- Enlaces relacionados ---------- */
.anexos-lote { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .anexos-lote { grid-template-columns: repeat(2, 1fr); } }
.vinculos-lote {
  display: block; border: 1px solid var(--pred-trazo); border-left: 3px solid var(--pred-terracota-medio);
  border-radius: 8px; padding: 13px 15px; color: inherit; background: var(--pred-panel);
}
.vinculos-lote:hover { text-decoration: none; background: var(--pred-terracota-suave); border-color: var(--pred-terracota-linea); border-left-color: var(--pred-terracota); }
.vinculos-lote b { display: block; font-size: .93rem; color: var(--pred-terracota-fuerte); }
.vinculos-lote span { font-size: .82rem; color: var(--pred-tinta-tenue); }

/* ---------- Espacios publicitarios (marcadores) ---------- */
.hueco-avaluo {
  border: 1px dashed var(--pred-trazo-fino); border-radius: var(--pred-redondeo); background: var(--pred-panel);
  padding: 18px; text-align: center; color: var(--pred-tinta-tenue); font-size: .8rem; margin: 28px 0;
}
.hueco-avaluo b { display: block; font-size: .85rem; color: var(--pred-tinta-suave); font-weight: 600; margin-bottom: 3px; }

/* ---------- Pie ---------- */
.pie-catastro { border-top: 1px solid var(--pred-trazo); background: var(--pred-panel); margin-top: 50px; padding: 40px 0 26px; font-size: .87rem; }
.pie-parcelas { display: grid; gap: 26px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .pie-parcelas { grid-template-columns: 1.4fr 1fr 1fr; } }
.pie-catastro h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pred-tinta-tenue); margin-bottom: 10px; }
.pie-catastro ul { list-style: none; margin: 0; padding: 0; }
.pie-catastro li { margin-bottom: 6px; }
.pie-catastro a { color: var(--pred-tinta-suave); }
.pie-aviso-catastro { border-top: 1px solid var(--pred-trazo); margin-top: 28px; padding-top: 18px; color: var(--pred-tinta-tenue); font-size: .8rem; }
.pie-aviso-catastro p { margin-bottom: .6em; }

/* ---------- Utilidades ---------- */
.fecha-catastro { font-size: .82rem; color: var(--pred-tinta-tenue); border-top: 1px solid var(--pred-trazo); padding-top: 12px; margin-top: 34px; }
.fecha-catastro b { color: var(--pred-tinta-suave); font-weight: 600; }
.oculto-lindero {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
main { display: block; }
