/* Toolbox: estilos ("Taller nocturno"). Los colores, tamaños y sombras vienen de assets/tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--carbon);
  color: var(--texto);
  font-family: var(--fuente-texto);
  font-size: var(--t-base);
  line-height: var(--interlinea);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, p, li { overflow-wrap: anywhere; }
h1, h2, h3 { font-family: var(--fuente-titulo); font-weight: var(--peso-subtitulo); line-height: var(--interlinea-titulo); margin: 0; }
p { margin: 0 0 var(--e-4); }
a { color: var(--magenta-texto); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 4px; text-decoration-color: var(--magenta); }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
main:focus, h1:focus, #transparencia:focus { outline: none; }

.solo-lector {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.saltar {
  position: absolute; left: var(--e-3); top: -4rem; z-index: 10;
  background: var(--carbon-2); border: var(--borde); border-radius: var(--r-md);
  padding: var(--e-2) var(--e-4); color: var(--texto);
}
.saltar:focus { top: var(--e-3); }

/* Cabecera */
.cabecera {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-3) var(--e-5);
  max-width: var(--ancho-max); width: 100%; margin: 0 auto;
  padding: var(--e-4);
}
#marca {
  display: flex; align-items: center; gap: var(--e-3); margin-right: auto;
  font-family: var(--fuente-titulo); font-weight: var(--peso-titulo); font-size: var(--t-marca);
  line-height: 1; color: var(--texto); text-decoration: none; text-shadow: 2px 2px 0 var(--magenta);
}
#marca:hover { text-decoration: none; }
#marca img { width: 40px; height: 40px; }
#menu { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2) var(--e-5); font-size: var(--t-sm); }
#menu a { color: var(--texto); font-weight: 600; padding: var(--e-2) 0; text-decoration: none; border-bottom: 4px solid transparent; }
#menu a:hover { color: var(--magenta-texto); }
#menu a[aria-current="page"] { border-bottom-color: var(--magenta); }
#selector-idioma { display: flex; border: var(--borde); border-radius: var(--r-md); overflow: hidden; }
#selector-idioma button {
  font: inherit; font-size: var(--t-sm); font-weight: 700; min-width: 44px; min-height: 40px;
  border: 0; background: var(--carbon-2); color: var(--texto); cursor: pointer;
}
#selector-idioma button + button { border-left: var(--borde); }
#selector-idioma button[aria-pressed="true"] { background: var(--magenta); color: var(--sobre-acento); }

main { flex: 1; min-width: 0; width: 100%; max-width: var(--ancho-max); margin: 0 auto; padding: var(--e-4) var(--e-4) var(--e-7); }

/* Botones */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e-2);
  min-height: 44px; padding: var(--e-2) var(--e-5);
  background: var(--magenta); color: var(--sobre-acento); border: 2px solid var(--texto); border-radius: var(--r-md);
  box-shadow: 4px 4px 0 var(--texto); font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
  transition: transform var(--dur-media) var(--curva), box-shadow var(--dur-media) var(--curva), background var(--dur-media);
}
.boton:hover { background: var(--magenta-hover); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--texto); text-decoration: none; }
.boton:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--texto); }
.boton.contacto, .no-encontrada .boton {
  background: var(--carbon-2); color: var(--texto); border: var(--borde); box-shadow: var(--sombra-suave); font-weight: 700;
}
.boton.contacto:hover, .no-encontrada .boton:hover { background: var(--carbon-2); border-color: var(--magenta-texto); box-shadow: var(--sombra-suave); }
[data-campo="comprar-texto"]::after { content: " \2197"; }

/* Estados */
#estado {
  max-width: var(--ancho-texto); margin: var(--e-6) auto; padding: var(--e-5);
  border: 2px dashed var(--linea); border-radius: var(--r-md); background: var(--carbon-2);
  text-align: center; font-family: var(--fuente-titulo); font-size: var(--t-lg);
}
body[data-vista="estado"] #estado { animation: pulso 1.2s ease-in-out infinite alternate; }
@keyframes pulso { from { opacity: 0.6; } to { opacity: 1; } }
.aviso-sin-js { padding: var(--e-5); border: 2px solid var(--cyan); border-radius: var(--r-md); background: var(--carbon-2); color: var(--texto); }
.estado-acciones { margin: 0; text-align: center; }

/* Portada */
.portada { padding: var(--e-6) 0 var(--e-5); max-width: 52rem; }
#portada-titulo {
  font-size: var(--t-3xl); font-weight: var(--peso-titulo); margin-bottom: var(--e-4);
  color: var(--texto); text-shadow: var(--sombra-titulo);
}
.portada-lema { color: var(--texto-suave); font-size: var(--t-lg); max-width: 32rem; margin-top: var(--e-5); }
.titulo-seccion {
  font-size: var(--t-xl); margin: var(--e-6) 0 var(--e-5);
  padding-bottom: var(--e-2); border-bottom: var(--borde);
}

/* Filtro por tipo */
.filtro { display: flex; flex-wrap: wrap; gap: var(--e-2); margin: 0 0 var(--e-5); }
.filtro-boton {
  font: inherit; font-family: var(--fuente-mono); font-size: var(--t-sm); font-weight: 700;
  min-height: 44px; padding: var(--e-1) var(--e-4); cursor: pointer;
  background: var(--carbon); color: var(--cyan); border: 2px solid var(--cyan); border-radius: 999px;
  transition: background var(--dur-rapida), color var(--dur-rapida);
}
.filtro-boton:hover { background: var(--cyan-suave); }
.filtro-boton[aria-pressed="true"] { background: var(--cyan); color: var(--sobre-acento); border-color: var(--texto); }

/* Tarjetas */
.tarjetas {
  list-style: none; margin: 0 0 var(--e-8); padding: 0 var(--e-2) var(--e-2) 0;
  display: grid; gap: var(--e-6) var(--e-5);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}
.tarjeta {
  background: var(--carbon-2); border: var(--borde); border-radius: var(--r-md); box-shadow: var(--sombra-suave);
  transition: transform var(--dur-media) var(--curva), box-shadow var(--dur-media) var(--curva), border-color var(--dur-media);
  animation: entrada var(--dur-lenta) var(--curva-suave) both;
}
.tarjeta:nth-child(2) { animation-delay: 60ms; }
.tarjeta:nth-child(3) { animation-delay: 120ms; }
.tarjeta:nth-child(4) { animation-delay: 180ms; }
.tarjeta:nth-child(5) { animation-delay: 240ms; }
.tarjeta:nth-child(n+6) { animation-delay: 300ms; }
.tarjeta:hover, .tarjeta:focus-within { transform: translate(0, -2px); border-color: var(--magenta); box-shadow: var(--sombra); }
body[data-sin-entrada] .tarjeta { animation: none; }
@keyframes entrada { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
.tarjeta-enlace {
  position: relative; display: block; height: 100%; padding-bottom: var(--e-4);
  color: var(--texto); text-decoration: none; border-radius: var(--r-md);
}
.tarjeta-enlace:hover { text-decoration: none; }
.tarjeta-imagen {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--carbon-3);
  border-bottom: var(--borde-suave); border-radius: var(--r-md) var(--r-md) 0 0;
}
.tarjeta--sin-imagen .tarjeta-imagen { display: none; }
.tarjeta--sin-imagen .tarjeta-enlace::before, .detalle--sin-imagen .detalle-cabecera::before {
  content: ""; display: block; aspect-ratio: 4 / 3; border-bottom: var(--borde-suave);
  background: repeating-linear-gradient(45deg, var(--carbon-3) 0 10px, var(--carbon-2) 10px 20px);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.etiqueta-tipo, .sello {
  display: inline-block; margin: var(--e-3) 0 0 var(--e-4); padding: 0 var(--e-2);
  font-family: var(--fuente-mono); font-size: var(--t-xs); font-weight: 700; line-height: 1.6;
  text-transform: uppercase; letter-spacing: 0.04em; border-radius: var(--r-sm);
  background: var(--cyan); color: var(--sobre-acento); border: 2px solid var(--cyan);
}
.detalle-datos .etiqueta-tipo { margin: 0 0 var(--e-2); }
.sello[data-campo="ejemplo"] { background: transparent; color: var(--cyan); }
.tarjeta-nombre, .tarjeta-resumen, .tarjeta-precio { margin: 0; padding: 0 var(--e-4); }
.tarjeta-nombre {
  font-size: var(--t-lg); margin-top: var(--e-3);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.tarjeta-resumen {
  margin-top: var(--e-2); color: var(--texto-suave); font-size: var(--t-sm);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
.tarjeta-precio { margin-top: var(--e-3); font-weight: 700; }
.tarjeta-precio:empty { display: none; }

/* Sección "Cómo se hacen" */
.franja {
  position: relative; background: var(--carbon-3); border: solid var(--linea-suave); border-width: 2px 0;
  padding: var(--e-6) var(--e-5); margin: 0 calc(var(--e-4) * -1);
}
.franja h2 { font-size: var(--t-xl); margin-bottom: var(--e-4); }
.franja p { max-width: var(--ancho-texto); }
.franja p:not(:last-of-type) { padding-left: var(--e-4); border-left: 4px solid var(--magenta); }
.franja .boton { margin-top: var(--e-3); }

/* Detalle */
.detalle { padding-top: var(--e-2); }
.detalle-volver { display: inline-block; margin: var(--e-3) 0 var(--e-5); font-weight: 600; }
.detalle-cabecera { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--e-5); align-items: start; margin-bottom: var(--e-5); }
.detalle-imagen {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--carbon-3);
  border: var(--borde); border-radius: var(--r-md); box-shadow: var(--sombra);
}
.detalle--sin-imagen .detalle-imagen { display: none; }
.detalle--sin-imagen .detalle-cabecera::before { border: var(--borde); border-radius: var(--r-md); box-shadow: var(--sombra); }
.detalle-nombre { font-size: var(--t-2xl); margin-bottom: var(--e-3); }
.detalle-resumen { color: var(--texto-suave); font-size: var(--t-lg); }
.detalle-precio { font-size: var(--t-xl); font-weight: 800; margin-bottom: var(--e-1); }
.detalle-precio:empty, .detalle-precio:empty + .detalle-nota-precio { display: none; }
.detalle-nota-precio { color: var(--texto-suave); font-size: var(--t-sm); }
.detalle-aviso {
  display: inline-block; padding: var(--e-2) var(--e-3); border: 2px dashed var(--linea);
  border-radius: var(--r-md); background: var(--carbon-2); font-size: var(--t-sm);
}
.detalle-aviso[data-campo="ejemplo"] { color: var(--cyan); border-style: solid; border-color: var(--cyan); background: transparent; }
.detalle-bloque { margin: var(--e-6) 0; }
.detalle-bloque h2 { font-size: var(--t-xl); margin-bottom: var(--e-3); }
.texto-largo { max-width: var(--ancho-texto); }
.detalle-bloque-uso .texto-largo { border-left: 3px solid var(--magenta); padding-left: var(--e-4); font-style: italic; color: var(--texto-suave); }
.requisitos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--e-2); }
.requisitos li {
  background: var(--carbon-3); border: var(--borde-suave); border-radius: var(--r-sm);
  padding: var(--e-1) var(--e-3); font-family: var(--fuente-mono); font-size: var(--t-xs); color: var(--texto);
}
.capturas { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--e-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.captura-boton {
  display: block; width: 100%; padding: 0; margin: 0; background: none; border: 0; font: inherit; color: inherit;
  cursor: zoom-in; border-radius: var(--r-md);
}
.captura img { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; background: var(--carbon-3); border: var(--borde); border-radius: var(--r-md); box-shadow: var(--sombra-suave); }
.captura-boton:hover img { border-color: var(--magenta); }

/* Cambios (historial) */
.cambios { list-style: none; margin: 0; padding: 0 0 0 var(--e-5); border-left: 2px solid var(--linea-suave); max-width: var(--ancho-texto); }
.cambio { position: relative; padding-bottom: var(--e-5); }
.cambio:last-child { padding-bottom: 0; }
.cambio::before {
  content: ""; position: absolute; left: calc(var(--e-5) * -1 - 7px); top: 0.45rem;
  width: 12px; height: 12px; border-radius: 50%; background: var(--cyan);
}
.cambio-cabecera { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--e-1) var(--e-2); font-family: var(--fuente-mono); margin-bottom: var(--e-1); }
.cambio-version { color: var(--cyan); font-weight: 700; }
.cambio-fecha { color: var(--texto-suave); font-size: var(--t-sm); }
.cambio-texto p:last-child { margin-bottom: 0; }

.detalle-contacto { margin-top: var(--e-6); }

/* No encontrada */
.no-encontrada {
  max-width: 28rem; margin: var(--e-7) auto; padding: var(--e-6); text-align: center;
  background: var(--carbon-2); border: var(--borde); border-radius: var(--r-md); box-shadow: var(--sombra);
}
.no-encontrada h1 { font-size: var(--t-2xl); margin-bottom: var(--e-3); }

/* Pie */
.pie { border-top: var(--borde-suave); padding: var(--e-5) var(--e-4); text-align: center; color: var(--texto-suave); font-size: var(--t-sm); }
.pie p { margin: 0; }

@media (min-width: 48rem) {
  .detalle-cabecera { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--e-6); }
  .franja { margin: 0; border-width: 2px; border-radius: var(--r-md); }
  main { padding-left: var(--e-5); padding-right: var(--e-5); }
}
@media (max-width: 40rem) {
  #portada-titulo { font-size: var(--t-2xl); text-shadow: 2px 2px 0 var(--magenta); }
  #marca { font-size: 1.75rem; }
  .detalle-nombre { font-size: var(--t-xl); }
  #menu { order: 3; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .tarjeta, .boton, .filtro-boton { transition: none; }
  .tarjeta { animation: none; }
  body[data-vista="estado"] #estado { animation: none; }
}
