/*
 * Páginas de amigurumi (patrones/<patrón>/index.html con pagina.js): lo que no está en comun/estilos.css.
 * Usa sus tokens --yec-* y sus clases pp-; las propias empiezan por ag-.
 */

/* El 3D: un canvas que se gira arrastrando. En vertical el dedo sigue moviendo la página. */
.ag-lienzo { display: block; width: 100%; aspect-ratio: 4 / 3; background: var(--yec-papel); touch-action: pan-y; cursor: grab; }
.ag-lienzo:active { cursor: grabbing; }

/* Portada */
.ag-polaroid .ag-lienzo { border: 1px solid var(--yec-kraft); }
.ag-cinta { background: rgba(191, 227, 200, 0.92); }

/* Paso 1: tu cocodrilo */
.ag-muestra { background: var(--yec-papel); }
.ag-muestra-cuerpo { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; }
.ag-muestra-cuerpo > p:first-child { margin: 0; font-size: 14px; line-height: 1.5; }
.ag-muestra-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ag-muestra-campos .campo { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.ag-muestra-campos label { font-weight: 700; font-size: 14px; margin: 0; }
.ag-muestra .campo input[aria-invalid="true"] { border-color: var(--yec-error); background: var(--yec-error-fondo); }
.ag-muestra .error { margin: 0; }
.ag-resumen { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: var(--yec-radio); background: var(--yec-hecho-fondo); border: 2px solid var(--yec-tapete); }
.ag-resumen p { margin: 0; font-size: 14px; line-height: 1.5; }
.ag-resumen p:first-child { font-size: 16px; }
.ag-avisos { display: flex; flex-direction: column; gap: 10px; }
.ag-avisos:empty { display: none; }
.ag-avisos p { margin: 0; font-size: 14px; line-height: 1.5; padding: 10px 14px; border-radius: 12px; background: var(--yec-aviso-fondo); border: var(--yec-borde); }

.ag-figura { margin: 0; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.ag-lienzo-marco { position: relative; border: var(--yec-borde); border-radius: 12px; overflow: hidden; background: var(--yec-papel); }
.ag-girar { position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff; border: var(--yec-borde); font-size: 14px; font-weight: 700; pointer-events: none; }
.ag-girar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ag-figura-pie { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.ag-figura-pie > span { font-size: 15px; line-height: 1.5; max-width: 340px; }
.ag-chip-enlace { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: var(--yec-borde); background: var(--yec-papel); font-weight: 800; font-size: 14px; text-decoration: none; }

/* Antes de empezar */
.ag-antes-seccion { padding: 24px 0 48px; }
.ag-antes { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; box-shadow: none; }
.ag-antes-lista { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ag-antes-lista h2 { font-size: 40px; }
.ag-antes-puntos { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ag-antes-puntos h3 { font-size: 20px; font-weight: 800; }
.ag-puntos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 10px; }
.ag-puntos li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--yec-radio); border: var(--yec-borde); background: var(--yec-papel); }
.ag-puntos li > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.ag-puntos strong { font-size: 15px; }
.ag-puntos li > span:last-child > span { font-size: 14px; line-height: 1.45; color: var(--yec-lapiz); }
.ag-punto-icono { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; background: #fff; border: var(--yec-borde); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; line-height: 1; }
.ag-punto-icono svg { width: 22px; height: 22px; fill: none; stroke: var(--yec-tinta); stroke-width: 2.4; stroke-linecap: round; }
.ag-c-aum { color: var(--yec-tapete); }
.ag-c-dis { color: var(--yec-error); }

/* Paso 2: las piezas, vuelta a vuelta */
.ag-piezas-fila { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
@media (min-width: 1000px) { .ag-piezas-fila { grid-template-columns: minmax(0, 3fr) minmax(340px, 2fr); } }
.ag-piezas-lista { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ag-pestanas { display: flex; flex-wrap: wrap; gap: 8px; }
.ag-pestana { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 999px; border: var(--yec-borde); background: #fff; color: var(--yec-tinta); font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.ag-pestana span { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--yec-kraft); color: var(--yec-tinta); }
.ag-pestana[aria-selected="true"] { background: var(--yec-tinta); color: var(--yec-papel); }
.ag-pestana[aria-selected="true"] span { background: var(--yec-mostaza); }
.ag-pieza-cabecera { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.ag-pieza-titulo { margin: 0; font-size: 16px; font-weight: 700; }
.ag-progreso { display: flex; align-items: center; gap: 10px; min-width: 220px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.ag-progreso .pp-progreso-pista { flex: 1 1 auto; height: 12px; }
.ag-vueltas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: var(--yec-borde); }
.ag-vueltas[hidden], .ag-montaje-lista[hidden] { display: none; }
.ag-vuelta { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--yec-kraft); background: #fff; scroll-margin-top: 80px; }
.ag-vuelta.hecha { background: #F7F1E6; }
.ag-vuelta.actual { background: var(--yec-aviso-fondo); box-shadow: inset 5px 0 0 var(--yec-mostaza); }
.ag-vuelta-fila { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.ag-caja { width: 44px; height: 44px; border-radius: 12px; border: var(--yec-borde); background: #fff; display: flex; align-items: center; justify-content: center; padding: 0; color: var(--yec-tinta); cursor: pointer; }
.ag-caja svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.ag-caja[aria-pressed="true"] { background: var(--yec-menta); }
.ag-caja[aria-pressed="true"] svg { visibility: visible; }
.ag-vuelta-ir { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 10px; align-items: center; padding: 4px 0; border: 0; background: none; font: inherit; color: var(--yec-tinta); text-align: left; cursor: pointer; min-height: 44px; }
.ag-vuelta-ir:hover .ag-txt { text-decoration: underline; text-decoration-color: var(--yec-tapete); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.ag-etq { font-size: 24px; line-height: 1; }
.ag-txt { font-size: 17px; line-height: 1.4; }
.ag-vuelta.hecha .ag-etq, .ag-vuelta.hecha .ag-txt { color: var(--yec-lapiz); }
.ag-chip-puntos { font-size: 14px; font-weight: 800; padding: 3px 10px; border-radius: 999px; border: var(--yec-borde); background: #fff; white-space: nowrap; }
.ag-marca { margin: 0 0 0 54px; display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--yec-rosa); border: var(--yec-borde); font-size: 14px; font-weight: 700; line-height: 1.3; }
.ag-marca svg { width: 14px; height: 14px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ag-nota { margin: 0 0 0 54px; font-size: 15px; line-height: 1.5; color: var(--yec-tapete); font-weight: 700; }
.ag-ayuda-lista { margin: 0; }
.ag-montaje-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ag-paso-montaje { width: 100%; display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: var(--yec-radio); border: var(--yec-borde); background: var(--yec-papel); font: inherit; color: var(--yec-tinta); text-align: left; cursor: pointer; }
.ag-paso-montaje[aria-current="step"] { background: var(--yec-aviso-fondo); box-shadow: inset 5px 0 0 var(--yec-mostaza); }
.ag-paso-montaje .cond { font-size: 28px; line-height: 1; color: var(--yec-tapete); flex: 0 0 auto; }
.ag-paso-montaje span:last-child { font-size: 16px; line-height: 1.55; }

.ag-vav { min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: var(--yec-radio-m); border: var(--yec-borde); background: var(--yec-papel); box-shadow: var(--yec-sombra); scroll-margin-top: 16px; }
@media (min-width: 1000px) and (min-height: 700px) { .ag-vav { position: sticky; top: 16px; } }
.ag-vav-etq { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--yec-lapiz); }
.ag-vav h3 { font-size: 30px; line-height: 0.95; }
.ag-vav-vistas { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; align-items: center; }
.ag-vav-vistas.sin-esquema { grid-template-columns: minmax(0, 1fr); }
.ag-vav-vistas.sin-esquema svg { display: none; }
.ag-vav-vistas .ag-lienzo, .ag-vav-vistas svg { border: var(--yec-borde); border-radius: 10px; background: var(--yec-papel); }
.ag-vav-vistas svg { display: block; width: 100%; height: auto; }
.ag-vav-texto { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.35; }
.ag-vav-punto { margin: 0; font-size: 15px; line-height: 1.5; }
.ag-vav-punto b { padding: 1px 8px; border-radius: 999px; background: var(--yec-rosa); }
.ag-vav-nota { margin: 0; font-size: 15px; line-height: 1.5; color: var(--yec-tapete); font-weight: 700; }
.ag-vav p:empty { display: none; }
.ag-leyenda { margin: 0; font-size: 13px; line-height: 1.45; color: var(--yec-lapiz); }
.ag-vav-mandos { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ag-redondo { width: 52px; height: 52px; flex: 0 0 auto; border-radius: 999px; border: var(--yec-borde); background: #fff; color: var(--yec-tinta); display: grid; place-items: center; padding: 0; cursor: pointer; box-shadow: 3px 3px 0 var(--yec-tinta); }
.ag-redondo:disabled { opacity: 0.35; cursor: default; box-shadow: none; }
.ag-redondo svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ag-vav-contador { flex: 1 1 220px; justify-content: center; text-align: center; }

/* Monta y borda: el 3D de cada tarjeta, sobre papel */
.ag-tarjeta-figura { background: var(--yec-papel); }
.ag-tarjeta-figura .ag-lienzo { width: 100%; height: 100%; aspect-ratio: auto; }

/* Contador de puntos a pantalla completa (usa el visor del modo taller: .pp-visor) */
.ag-cont-v { font-size: 30px; line-height: 1; color: var(--yec-papel); flex: 0 0 auto; }
.ag-contador .pp-visor-cuerpo { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 680px; margin: 0 auto; padding: 14px 16px 16px; }
.ag-contador .pp-visor-marcas { gap: 2px; }
.ag-cont-titulo { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ag-cont-titulo h2 { font-size: 40px; line-height: 0.9; margin: 0; }
.ag-cont-titulo h2 span { color: var(--yec-lapiz); }
.ag-cont-instr { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.4; }
.ag-cont-marca { margin: 0; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--yec-rosa); border: var(--yec-borde); font-size: 15px; font-weight: 700; }
.ag-cont-marca svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ag-tira { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; border-radius: var(--yec-radio); border: var(--yec-borde); background: #fff; }
.ag-tira span { min-width: 30px; height: 30px; padding: 0 2px; border-radius: 8px; border: 2px solid var(--yec-kraft); background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; }
.ag-tira .dis { color: var(--yec-error); }
.ag-tira .hecho { background: var(--yec-menta); border-color: var(--yec-tapete); color: var(--yec-tinta); }
.ag-tira .actual { background: var(--yec-mostaza); border-color: var(--yec-tinta); }
.ag-cont-llevas { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--yec-radio); background: var(--yec-mostaza); border: var(--yec-borde); }
.ag-cont-llevas p { margin: 0; font-size: 17px; line-height: 1.4; }
.ag-cont-llevas p:first-child { font-size: 15px; font-weight: 700; }
.ag-cont-llevas .cond { font-size: 26px; }
.ag-cont-nota { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--yec-hecho-fondo); border: 2px solid var(--yec-tapete); font-size: 15px; font-weight: 700; color: var(--yec-tapete); line-height: 1.4; }
.ag-contador .pp-visor-nav { grid-template-columns: 76px 1fr; }
.ag-contador .pp-visor-ant { font: inherit; font-weight: 800; font-size: 24px; min-height: 84px; }
.ag-contador .pp-visor-sig { min-height: 84px; flex-direction: column; gap: 2px; font-size: 22px; }
.ag-contador .pp-visor-sig small { font-size: 14px; font-weight: 600; color: var(--yec-migas-tapete); }
@media (min-width: 900px) { .ag-contador .pp-visor-nav { grid-template-columns: 96px minmax(0, 460px); justify-content: center; } }

/* Hoja A4 para imprimir: una sola página. --esc la encoge si el patrón es largo (pagina.js la mide antes). */
.ag-hoja { --esc: 1; width: 210mm; height: 296mm; padding: 10mm 11mm; box-sizing: border-box; overflow: hidden; background: #fff; color: var(--yec-tinta);
  display: flex; flex-direction: column; gap: calc(3mm * var(--esc)); font: 400 calc(9.4pt * var(--esc))/1.35 var(--yec-fuente); }
.ag-hoja p, .ag-hoja h1, .ag-hoja ol, .ag-hoja ul { margin: 0; }
.ag-hoja-cab { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 2mm; border-bottom: 0.5mm solid var(--yec-tinta); }
.ag-hoja-cab .cond { font-size: 16.5pt; line-height: 1; }
.ag-hoja-cab small { font-size: 9pt; color: var(--yec-lapiz); margin-left: 2mm; }
.ag-hoja-web { font-size: 9pt; font-weight: 700; }
.ag-hoja-titulo { display: flex; justify-content: space-between; align-items: flex-end; gap: 4mm; }
.ag-hoja-titulo h1 { font-size: 31pt; line-height: 0.88; color: var(--yec-tinta); }
.ag-hoja-datos { font-size: 9pt; line-height: 1.45; text-align: right; }
.ag-hoja-sec { font-size: calc(8.5pt * var(--esc)); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--yec-lapiz); margin-bottom: 1.2mm !important; }
.ag-hoja-dos { display: grid; grid-template-columns: 1.35fr 1fr; gap: 5.5mm; align-items: start; }
.ag-hoja-2col .ag-hoja-dos { grid-template-columns: 2fr 1fr; }
.ag-hoja-2col .ag-hoja-cuerpo ol { column-count: 2; column-gap: 5mm; }
.ag-hoja-col { display: flex; flex-direction: column; gap: calc(3.4mm * var(--esc)); min-width: 0; }
.ag-hoja ol.ag-hoja-v { list-style: none; padding: 0; }
.ag-hoja-v li { break-inside: avoid; padding: calc(0.45mm * var(--esc)) 0; }
.ag-hoja-v .fila { display: flex; gap: 1.8mm; align-items: flex-start; }
.ag-hoja-v .e { flex: 0 0 calc(17mm * var(--esc)); }
.ag-hoja-corta .e { flex-basis: calc(12mm * var(--esc)); }
.ag-hoja-v .t { flex: 1 1 auto; min-width: 0; }
.ag-hoja-v .n { flex: 0 0 auto; }
.ag-hoja-caja { width: calc(3.4mm * var(--esc)); height: calc(3.4mm * var(--esc)); border: 0.4mm solid var(--yec-tinta); border-radius: 0.8mm; flex: 0 0 auto; margin-top: 0.3mm; background: #fff; }
.ag-hoja-marca { display: inline-block; margin: 0.4mm 0 0 calc(5.2mm * var(--esc) + 17mm * var(--esc)); padding: 0 2mm; border-radius: 1.6mm; background: var(--yec-rosa); border: 0.25mm solid var(--yec-tinta); font-weight: 700; font-size: 0.95em; }
.ag-hoja-nota { margin: 0.4mm 0 0 calc(22.2mm * var(--esc)) !important; font-weight: 700; color: var(--yec-tapete); font-size: 0.95em; }
.ag-hoja-corta .ag-hoja-nota { margin-left: calc(17.2mm * var(--esc)) !important; }
.ag-hoja-montaje { padding-left: 4mm !important; display: flex; flex-direction: column; gap: 0.8mm; }
.ag-hoja-abrev { list-style: none; padding: 0 !important; display: flex; flex-direction: column; gap: 0.5mm; }
.ag-hoja-aviso { padding: 1.8mm 2.4mm; border: 0.4mm solid var(--yec-tinta); border-radius: 2mm; background: var(--yec-aviso-fondo); }
.ag-hoja-pie { display: flex; justify-content: space-between; align-items: center; gap: 4mm; padding-top: 2.2mm; border-top: 0.5mm solid var(--yec-tinta); margin-top: auto; font-size: 8.6pt; }
.ag-hoja-pie p { max-width: 130mm; }
.ag-hoja-pie .hand { font-size: 15pt; white-space: nowrap; }
#impresion.ag-midiendo { display: block; position: absolute; left: -10000px; top: 0; }
@media print {
  .ag-hoja { padding: 10mm 11mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Lámina para tools/patrones/imagenes.mjs: solo el 3D */
.modo-lamina > #vista .ag-lienzo { cursor: default; }

@media (max-width: 640px) {
  .ag-antes-lista h2 { font-size: 34px; }
  .ag-vuelta { padding: 10px 8px; }
  .ag-vuelta-fila { gap: 8px; }
  .ag-vuelta-ir { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ag-etq { font-size: 20px; }
  .ag-txt { font-size: 16px; }
  .ag-marca, .ag-nota { margin-left: 52px; }
  .ag-vav { padding: 16px; }
  .ag-figura { padding: 14px; }
  .ag-cont-titulo h2 { font-size: 34px; }
  .ag-luz-texto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ag-contador .pp-visor-luz { padding: 6px; }
}
