/* LA FABRICA — estilos de la calculadora (publicistas y taller) */

:root {
  --papel: #e9edef;
  --superficie: #ffffff;
  --tinta: #1c2124;
  --tinta-suave: #4f5a60;
  --acero: #8d989e;
  --acero-claro: #c3cbcf;
  --linea: #cfd6d9;
  --teal: #1d5b6a;
  --teal-hover: #164a57;
  --teal-suave: #dcebee;
  --sobre-teal: #ffffff;
  --chispa: #d9541e;
  --aviso: #8a3b12;
  --aviso-fondo: #fbeee6;
  --logo-filtro: none;
  --radio: 6px;
  --sombra-barra: 0 -6px 20px rgba(20, 30, 35, 0.12);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papel: #13181a;
    --superficie: #1b2225;
    --tinta: #e6ebed;
    --tinta-suave: #a5b1b6;
    --acero: #6f7c82;
    --acero-claro: #3e4a4f;
    --linea: #2f393d;
    --teal: #5fb0c1;
    --teal-hover: #7cc1cf;
    --teal-suave: #1f3940;
    --sobre-teal: #0e1a1d;
    --chispa: #f07a45;
    --aviso: #f3a77f;
    --aviso-fondo: #3a2219;
    --logo-filtro: invert(1);
    --sombra-barra: 0 -6px 20px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --papel: #13181a;
  --superficie: #1b2225;
  --tinta: #e6ebed;
  --tinta-suave: #a5b1b6;
  --acero: #6f7c82;
  --acero-claro: #3e4a4f;
  --linea: #2f393d;
  --teal: #5fb0c1;
  --teal-hover: #7cc1cf;
  --teal-suave: #1f3940;
  --sobre-teal: #0e1a1d;
  --chispa: #f07a45;
  --aviso: #f3a77f;
  --aviso-fondo: #3a2219;
  --logo-filtro: invert(1);
  --sombra-barra: 0 -6px 20px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font-family: "Barlow", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

img { max-width: 100%; }

.condensada {
  font-family: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
}

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

/* ---------- Encabezado ---------- */

.encabezado {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 6px;
}

.encabezado .marca { height: 44px; width: auto; filter: var(--logo-filtro); }
.encabezado .nombre { height: 17px; width: auto; filter: var(--logo-filtro); display: block; }
.encabezado .lema { margin: 4px 0 0; font-size: 14px; color: var(--tinta-suave); line-height: 1.3; }

/* ---------- Estructura de la página ---------- */

.pagina {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 16px 120px;
  display: grid;
  gap: 28px;
}

@media (min-width: 960px) {
  .pagina {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: start;
    gap: 40px;
    padding-bottom: 64px;
  }
  .columna-medida { position: sticky; top: 16px; }
}

h1, h2, h3 { font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 600; line-height: 1.1; margin: 0; }

h1 { font-size: clamp(2rem, 6vw, 2.75rem); letter-spacing: -0.01em; margin: 18px 0 18px; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }

/* ---------- Medidas ---------- */

.campos {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: end;
}

.campo label, .etiqueta {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--tinta-suave);
  margin-bottom: 4px;
}

.campo input {
  width: 100%;
  font: inherit;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--tinta);
  background: var(--superficie);
  border: 2px solid var(--acero-claro);
  border-radius: var(--radio);
  padding: 6px 12px;
  min-height: 56px;
}

.campo input:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-suave); }
.campo input[aria-invalid="true"] { border-color: var(--chispa); }

.por {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.75rem;
  color: var(--acero);
  padding-bottom: 10px;
}

.fila-cantidad {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: end;
  margin-top: 14px;
}

.pista { font-size: 14px; color: var(--tinta-suave); margin: 0 0 12px; line-height: 1.35; }

.acabados { border: 0; margin: 18px 0 0; padding: 0; }
.acabados legend { padding: 0; }

.segmentos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 2px solid var(--acero-claro);
  border-radius: var(--radio);
  overflow: hidden;
  background: var(--superficie);
}

.segmentos input { position: absolute; opacity: 0; pointer-events: none; }

.segmentos label {
  display: block;
  text-align: center;
  padding: 11px 6px;
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  border-left: 1px solid var(--linea);
  line-height: 1.2;
}

.segmentos label:first-of-type { border-left: 0; }
.segmentos input:checked + label { background: var(--teal); color: var(--sobre-teal); }
.segmentos input:focus-visible + label { outline: 3px solid var(--teal); outline-offset: -5px; }

/* ---------- Plano ---------- */

.plano {
  margin: 22px 0 0;
  background: var(--superficie);
  border: 2px solid var(--linea);
  border-radius: var(--radio);
  padding: 10px 10px 12px;
}

.plano .lienzo { display: flex; justify-content: center; }

.bastidor { width: 100%; height: auto; max-height: 360px; display: block; }
.bastidor .tubo { fill: var(--acero-claro); stroke: var(--tinta); stroke-width: 1.4; }
.bastidor .soldadura { fill: var(--chispa); }
.bastidor .cota line { stroke: var(--acero); stroke-width: 1.2; }
.bastidor .cota-texto { fill: var(--tinta); font-family: "Barlow Condensed", sans-serif; font-size: 17px; font-weight: 600; }
.bastidor .cota-texto.pequena { fill: var(--tinta-suave); font-size: 13px; font-weight: 500; }

.plano figcaption { font-size: 15px; color: var(--tinta-suave); padding: 4px 6px 0; }

/* ---------- Opciones de precio ---------- */

.opciones { display: grid; gap: 16px; }

@media (min-width: 560px) and (max-width: 959px) {
  .opciones { grid-template-columns: 1fr 1fr; }
}

.opcion {
  background: var(--superficie);
  border: 2px solid var(--tinta);
  border-radius: var(--radio);
  padding: 18px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.opcion .cabeza { display: flex; align-items: center; gap: 12px; }
.opcion .icono { width: 34px; height: 26px; flex: none; }
.opcion .icono .marco { fill: none; stroke: var(--tinta); stroke-width: 2.5; }
.opcion .icono .lona { fill: var(--teal); }
.opcion .descripcion { margin: 0; color: var(--tinta-suave); font-size: 15px; line-height: 1.4; }

.precio {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 3rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 0;
}

.precio small { font-family: "Barlow", sans-serif; font-size: 15px; font-weight: 500; color: var(--tinta-suave); margin-left: 6px; }
.precio-total { margin: 0; font-size: 15px; color: var(--tinta-suave); }
.precio-total:empty { display: none; }

.interruptor { display: flex; align-items: center; gap: 10px; font-size: 16px; cursor: pointer; padding: 4px 0; }
.interruptor input { width: 22px; height: 22px; accent-color: var(--teal); margin: 0; }

.lona {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  background: var(--teal-suave);
  border-radius: 4px;
  padding: 8px 10px;
}

.lona strong { font-variant-numeric: tabular-nums; }

.boton {
  appearance: none;
  border: 2px solid var(--teal);
  background: var(--teal);
  color: var(--sobre-teal);
  font: inherit;
  font-weight: 600;
  font-size: 17px;
  border-radius: var(--radio);
  min-height: 50px;
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
}

.boton:hover { background: var(--teal-hover); border-color: var(--teal-hover); }
.boton[disabled], .boton[aria-disabled="true"] { background: var(--acero-claro); border-color: var(--acero-claro); color: var(--tinta-suave); cursor: not-allowed; }
.boton.secundario { background: transparent; color: var(--teal); }
.boton.secundario:hover { background: var(--teal-suave); }
.boton.ancho { width: 100%; }

.mensaje-medida {
  background: var(--aviso-fondo);
  color: var(--tinta);
  border-left: 4px solid var(--chispa);
  border-radius: 4px;
  padding: 14px 16px;
  margin: 0;
}

.mensaje-medida a { color: var(--teal); font-weight: 600; }

/* ---------- Pedido ---------- */

.pedido {
  margin-top: 28px;
  background: var(--superficie);
  border: 2px solid var(--linea);
  border-radius: var(--radio);
  padding: 18px;
}

.pedido .vacio { color: var(--tinta-suave); margin: 8px 0 0; }
.lineas { list-style: none; margin: 12px 0 0; padding: 0; }

.linea {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 14px;
  padding: 12px 0;
  border-top: 1px solid var(--linea);
}

.linea:first-child { border-top: 0; }
.linea .que { font-weight: 600; }
.linea .detalle { grid-column: 1; font-size: 14px; color: var(--tinta-suave); line-height: 1.35; }
.linea .valor { font-family: "Barlow Condensed", sans-serif; font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.linea .quitar { grid-column: 2; justify-self: end; background: none; border: 0; color: var(--teal); font: inherit; font-size: 14px; font-weight: 600; padding: 4px 0; cursor: pointer; text-decoration: underline; }

.linea.nueva { animation: resaltar 1.4s ease-out; }
@keyframes resaltar { from { background: var(--teal-suave); } to { background: transparent; } }

.totales { border-top: 2px solid var(--tinta); margin-top: 6px; padding-top: 10px; }
.totales .fila { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; color: var(--tinta-suave); }
.totales .fila.total { color: var(--tinta); font-family: "Barlow Condensed", sans-serif; font-size: 1.75rem; font-weight: 600; align-items: baseline; }

.pedido .campo-texto { margin: 16px 0 12px; }
.pedido .campo-texto input {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 2px solid var(--acero-claro);
  border-radius: var(--radio);
  background: var(--superficie);
  color: var(--tinta);
  min-height: 48px;
}

.pedido .campo-texto input:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-suave); }

.nota-envio { font-size: 14px; color: var(--tinta-suave); margin: 10px 0 0; }

/* ---------- Condiciones ---------- */

.condiciones { font-size: 14px; color: var(--tinta-suave); margin-top: 24px; }
.condiciones ul { margin: 6px 0 0; padding-left: 18px; }
.condiciones li { margin: 3px 0; }

/* ---------- Barra fija del pedido (celular) ---------- */

.barra-pedido {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--superficie);
  box-shadow: var(--sombra-barra);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transform: translateY(110%);
  visibility: hidden;
  transition: transform 0.25s ease-out, visibility 0s linear 0.25s;
}

.barra-pedido.visible { transform: none; visibility: visible; transition: transform 0.25s ease-out; }
.barra-pedido .resumen { font-size: 15px; line-height: 1.25; }
.barra-pedido .resumen strong { display: block; font-family: "Barlow Condensed", sans-serif; font-size: 1.4rem; }
.barra-pedido .boton { margin: 0; min-height: 44px; }

@media (min-width: 960px) {
  .barra-pedido { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .barra-pedido { transition: none; }
  .linea.nueva { animation: none; }
}

.oculto { display: none !important; }
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
