/* J&C Impresores — estilos de la calculadora. Colores del logo: negro, amarillo y rojo. */

:root {
  --papel: #f4f2ec;
  --superficie: #ffffff;
  --tinta: #141414;
  --tinta-suave: #57534b;
  --linea: #dedad1;
  --borde-campo: #c4beb1;
  --amarillo: #f6c200;
  --amarillo-hover: #ffd23a;
  --amarillo-suave: #fbefc2;
  --sobre-amarillo: #141414;
  --rojo: #c8141d;
  --aviso-fondo: #fbe8e6;
  --negro: #0b0b0b;
  --rollo: #e7e3d9;
  --rollo-borde: #a39d90;
  --radio: 6px;
  --sombra-barra: 0 -6px 20px rgba(20, 18, 12, 0.14);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papel: #121211;
    --superficie: #1c1b19;
    --tinta: #f1eee7;
    --tinta-suave: #b3aea3;
    --linea: #312f2b;
    --borde-campo: #4a4740;
    --amarillo-suave: #3b3317;
    --rojo: #ff7a6e;
    --aviso-fondo: #3a1e1b;
    --rollo: #2b2a26;
    --rollo-borde: #6f6a60;
    --sombra-barra: 0 -6px 20px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --papel: #121211;
  --superficie: #1c1b19;
  --tinta: #f1eee7;
  --tinta-suave: #b3aea3;
  --linea: #312f2b;
  --borde-campo: #4a4740;
  --amarillo-suave: #3b3317;
  --rojo: #ff7a6e;
  --aviso-fondo: #3a1e1b;
  --rollo: #2b2a26;
  --rollo-borde: #6f6a60;
  --sombra-barra: 0 -6px 20px rgba(0, 0, 0, 0.45);
  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: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

img { max-width: 100%; }

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

/* ---------- Encabezado (siempre negro, como la lista de precios) ---------- */

.encabezado { background: var(--negro); color: #fff; }

.encabezado-dentro {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.encabezado .logo { width: 150px; height: auto; display: block; }
.lema p { margin: 0; }
.lema-titulo {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.1;
  color: var(--amarillo);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.lema-texto { font-size: 15px; color: #d9d5cc; line-height: 1.3; margin-top: 4px !important; }

.franja {
  height: 10px;
  background: repeating-linear-gradient(-45deg, var(--amarillo) 0 12px, var(--negro) 12px 24px);
}

@media (max-width: 420px) {
  .encabezado-dentro { gap: 14px; }
  .encabezado .logo { width: 116px; }
  .lema-titulo { font-size: 1.1rem; }
  .lema-texto { font-size: 14px; }
}

/* ---------- 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;
  }
}

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

h1 { font-size: clamp(2rem, 6vw, 2.6rem); text-transform: uppercase; margin: 22px 0 18px; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.35rem; }

/* ---------- Campos ---------- */

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

.campo-material select {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--tinta);
  background-color: var(--superficie);
  border: 2px solid var(--borde-campo);
  border-radius: var(--radio);
  min-height: 54px;
  padding: 8px 40px 8px 12px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--tinta) 50%), linear-gradient(135deg, var(--tinta) 50%, transparent 50%);
  background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.campo-material select:focus { border-color: var(--tinta); outline: none; box-shadow: 0 0 0 3px var(--amarillo); }

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

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

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

.por {
  font-family: "Oswald", sans-serif;
  font-size: 1.75rem;
  color: var(--tinta-suave);
  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: 6px 0 0; line-height: 1.4; }
.fila-cantidad .pista { margin-bottom: 8px; }

.grupo-opciones { border: 0; margin: 18px 0 0; padding: 0; min-width: 0; }
.grupo-opciones legend { padding: 0; }

.segmentos {
  display: grid;
  border: 2px solid var(--borde-campo);
  border-radius: var(--radio);
  overflow: hidden;
  background: var(--superficie);
}

.segmentos.tres { grid-template-columns: repeat(3, 1fr); }
.segmentos.dos { grid-template-columns: repeat(2, 1fr); }
.segmentos input { position: absolute; opacity: 0; pointer-events: none; }

.segmentos label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 46px;
  padding: 8px 6px;
  font-weight: 600;
  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(--amarillo); color: var(--sobre-amarillo); }
.segmentos input:focus-visible + label { outline: 3px solid var(--tinta); outline-offset: -5px; }

/* ---------- Dibujo del rollo ---------- */

.plano { margin: 6px 0 0; }

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

.dibujo-rollo { width: 100%; height: auto; max-height: 240px; display: block; }
.dibujo-rollo .rollo { fill: var(--rollo); }
.dibujo-rollo .borde-rollo { stroke: var(--rollo-borde); stroke-width: 1.4; fill: none; }
.dibujo-rollo .sigue { stroke: var(--rollo-borde); stroke-width: 1.4; stroke-dasharray: 4 4; fill: none; }
.dibujo-rollo .cobrado { fill: url(#rayado); stroke: var(--tinta); stroke-width: 1.6; stroke-dasharray: 6 4; }
.dibujo-rollo .rayas { stroke: var(--amarillo); stroke-width: 3; opacity: 0.55; }
.dibujo-rollo .pieza { fill: var(--amarillo); stroke: var(--tinta); stroke-width: 2; }
.dibujo-rollo .cota line { stroke: var(--tinta-suave); stroke-width: 1.2; }
.dibujo-rollo .cota-texto { fill: var(--tinta); font-family: "Oswald", sans-serif; font-size: 16px; font-weight: 500; }
.dibujo-rollo .texto-pieza { fill: var(--sobre-amarillo); font-family: "Oswald", sans-serif; font-size: 15px; font-weight: 600; }

.plano figcaption { font-size: 14px; color: var(--tinta-suave); padding: 6px 0 0; line-height: 1.4; text-align: center; }

.leyenda { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; white-space: nowrap; }
.muestra { width: 16px; height: 12px; border: 1.5px solid var(--tinta); border-radius: 2px; display: inline-block; }
.muestra.pieza { background: var(--amarillo); }
.muestra.cobrado { border-style: dashed; background: repeating-linear-gradient(-45deg, var(--amarillo-suave) 0 3px, transparent 3px 6px); }

/* ---------- Precio ---------- */

.tarjeta-precio {
  background: var(--superficie);
  border: 2px solid var(--tinta);
  border-top: 8px solid var(--amarillo);
  border-radius: var(--radio);
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

@media (min-width: 960px) {
  .tarjeta-precio { margin-top: 22px; }
  .mensaje-medida { margin-top: 22px !important; }
}

.precio {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-size: clamp(2.4rem, 12vw, 3.2rem);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 0;
}

.precio small { font-family: "Source Sans 3", sans-serif; font-size: 15px; font-weight: 600; color: var(--tinta-suave); margin-left: 8px; white-space: nowrap; display: inline-block; }
.precio-total { margin: 0; font-size: 16px; font-weight: 600; }
.precio-total:empty { display: none; }

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

.notas { margin: 0; padding-left: 18px; font-size: 14px; color: var(--tinta-suave); }
.notas:empty { display: none; }
.notas li { margin: 2px 0; }

.boton {
  appearance: none;
  border: 2px solid var(--amarillo);
  background: var(--amarillo);
  color: var(--sobre-amarillo);
  font: inherit;
  font-weight: 700;
  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: 6px;
}

.boton:hover { background: var(--amarillo-hover); border-color: var(--amarillo-hover); }
.boton[disabled] { background: var(--linea); border-color: var(--linea); color: var(--tinta-suave); cursor: not-allowed; }
.boton.ancho { width: 100%; }

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

.mensaje-medida p { margin: 0; }
.mensaje-medida .boton { margin-top: 12px; }

/* ---------- 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: 700; }
.linea .detalle { grid-column: 1; font-size: 14px; color: var(--tinta-suave); line-height: 1.35; }
.linea .valor { font-family: "Oswald", sans-serif; font-size: 1.3rem; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.linea .quitar { grid-column: 2; justify-self: end; background: none; border: 0; color: var(--tinta); font: inherit; font-size: 14px; font-weight: 600; padding: 4px 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--rojo); text-underline-offset: 3px; }

.linea.nueva { animation: resaltar 1.4s ease-out; }
@keyframes resaltar { from { background: var(--amarillo-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; }
.totales .fila.total { font-family: "Oswald", sans-serif; font-size: 1.7rem; 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(--borde-campo);
  border-radius: var(--radio);
  background: var(--superficie);
  color: var(--tinta);
  min-height: 48px;
}

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

.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 h3 { color: var(--tinta); }
.condiciones ul { margin: 6px 0 0; padding-left: 18px; }
.condiciones li { margin: 3px 0; }
.contacto { margin: 12px 0 0; }
.contacto a { color: var(--tinta); font-weight: 600; }

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

.barra-pedido {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--superficie);
  box-shadow: var(--sombra-barra);
  border-top: 4px solid var(--amarillo);
  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: "Oswald", sans-serif; font-size: 1.4rem; font-weight: 600; }
.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; }
