/* Estilos que Tailwind no cubre: fuentes, íconos, diálogos, muestras de color, etiquetas, mosaico y movimiento. */

/* Fuentes alojadas en la tienda (licencia SIL OFL, ver carpeta fuentes) */
@font-face { font-family: "Young Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fuentes/young-serif-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fuentes/source-serif-4-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fuentes/source-serif-4-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fuentes/source-serif-4-latin-600-normal.woff2") format("woff2"); }

:root {
  /* Escala tipográfica (cinco pasos) */
  --paso-chico: 0.875rem;                               /* 14px: datos de etiqueta, notas */
  --paso-texto: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem); /* 16–17px: texto */
  --paso-entrada: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --paso-titulo: clamp(2rem, 1.3rem + 3.2vw, 3.5rem);
  --paso-portada: clamp(2.6rem, 1.7rem + 3.2vw, 4.25rem);
  color-scheme: light;
}
body { font-size: var(--paso-texto); line-height: 1.55; font-synthesis: none; }
.t-titulo { font-family: "Young Serif", Georgia, serif; font-size: var(--paso-titulo); line-height: .98; letter-spacing: -0.02em; text-wrap: balance; }
.t-portada { font-family: "Young Serif", Georgia, serif; font-size: var(--paso-portada); line-height: .95; letter-spacing: -0.025em; text-wrap: balance; }
.t-entrada { font-size: var(--paso-entrada); line-height: 1.35; }

.ico { width: 1em; height: 1em; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.ico:not([class*="text-["]) { width: 1.5rem; height: 1.5rem; }
.sin-barra { scrollbar-width: none; }
.sin-barra::-webkit-scrollbar { display: none; }
:focus-visible { outline: 2px solid #24150C; outline-offset: 3px; }
#barra.con-sombra { background: #F0EDE8; }

/* Diálogos: ficha centrada, carrito y filtros como panel lateral (estos sí flotan) */
dialog { max-height: 100dvh; }
dialog::backdrop { background: rgba(36, 21, 12, .55); }
.dialogo-ficha { margin: auto; max-height: min(92dvh, 760px); overflow: auto; }
.dialogo-lateral { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(100vw, 440px); }
.dialogo-lateral.izquierda { margin: 0 auto 0 0; width: min(90vw, 360px); }
@media (max-width: 767px) {
  .dialogo-ficha { margin: auto 0 0; width: 100vw; max-width: 100vw; max-height: 94dvh; }
}

/* Etiqueta colgante bajo cada foto: foto + etiqueta forman un solo objeto */
.ejemplar { display: block; width: 100%; text-align: left; }
.ejemplar .foto { aspect-ratio: .85; overflow: hidden; }
.ejemplar .foto img { width: 100%; height: 100%; object-fit: cover; }
.ejemplar .colgante { padding: .7rem .8rem .75rem; font-size: var(--paso-chico); line-height: 1.35; font-variant-numeric: tabular-nums; }
.ejemplar .colgante .nombre { font-family: "Young Serif", Georgia, serif; font-size: clamp(1rem, .9rem + .4vw, 1.1875rem); line-height: 1.15; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ejemplar .colgante { background: #E7DACA; color: #24150C; transition: background-color .2s ease; }
.ejemplar:hover .colgante { background: #DECDB9; }
.suave { color: #5B4A3D; }

/* Ficha: miniaturas sobre la foto (solo si hay más de una) y detalles del producto */
.miniaturas { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.miniaturas::-webkit-scrollbar { display: none; }
.miniaturas button { flex: 0 0 auto; width: 52px; height: 61px; border-radius: 8px; overflow: hidden; background: #E7DACA; opacity: .75; outline-offset: 2px; transition: opacity .15s ease, transform .15s ease; }
.miniaturas button:hover { opacity: 1; }
.miniaturas button[aria-pressed="true"] { opacity: 1; box-shadow: 0 0 0 2px #FAF9F7, 0 0 0 4px #24150C; } /* taste-skill-ignore: anillo de selección, como en las muestras de color */
.miniaturas img { width: 100%; height: 100%; object-fit: cover; }
.detalles { display: grid; gap: .35rem; font-size: var(--paso-chico); }
.detalles > div { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .75rem; }
.detalles dt { color: #5B4A3D; }

/* Filtro de color: muestra + nombre */
.filtro-color-fila { display: flex; align-items: center; gap: .55rem; min-width: 0; padding: .3rem .25rem; border-radius: 8px; cursor: pointer; font-size: var(--paso-chico); }
.filtro-color-fila:hover { background: #F0EDE8; }
.filtro-color-fila .nombre-color { line-height: 1.2; overflow-wrap: anywhere; }
.filtro-color:checked ~ .nombre-color { font-weight: 600; }

/* Portada: trío de ejemplares. Uno grande y dos apilados; la foto ocupa siempre el mismo marco 0,85 dentro de su recuadro */
.trio { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 10px; }
.trio .pieza { position: relative; display: flex; flex-direction: column; padding: 7% 7% 0; min-width: 0; min-height: 0; overflow: hidden; }
.trio .p0 { grid-row: 1 / 3; padding: 6% 6% 0; }
.trio .marco { flex: 1; min-height: 0; overflow: hidden; display: block; }
.trio .marco img { width: 100%; height: 100%; object-fit: cover; }
.trio .rotulo { display: flex; justify-content: space-between; gap: .5rem; white-space: nowrap; font-size: var(--paso-chico); line-height: 1; padding: .7rem 0 .8rem; }
.trio .p0 .rotulo { font-size: 1rem; padding: .9rem 0 1rem; }
.trio { height: clamp(380px, 46vw, 600px); }
@media (max-width: 767px) { .trio { height: 108vw; max-height: 520px; gap: 8px; } .trio .pieza { padding: 6% 6% 0; } .trio .rotulo { padding: .55rem 0 .6rem; } }

/* Muestras de color (recortes de cuero) */
.muestra { width: 2.75rem; height: 2.75rem; border-radius: 9999px; position: relative; box-shadow: inset 0 0 0 1px rgba(36, 21, 12, .18); } /* taste-skill-ignore: el anillo deja ver los colores claros (blanco hueso, beige) sobre el fondo claro */
.muestra-input:checked + .muestra { box-shadow: 0 0 0 2px #FAF9F7, 0 0 0 4px #24150C; } /* taste-skill-ignore: el anillo deja ver los colores claros (blanco hueso, beige) sobre el fondo claro */
.muestra-input:focus-visible + .muestra { outline: 2px solid #24150C; outline-offset: 5px; }
.muestra-input:disabled + .muestra { opacity: .45; cursor: not-allowed; }
.agotado::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: #24150C; transform: rotate(45deg); }
.punto { width: .875rem; height: .875rem; border-radius: 9999px; position: relative; box-shadow: inset 0 0 0 1px rgba(36, 21, 12, .2); flex-shrink: 0; } /* taste-skill-ignore: el anillo deja ver los colores claros (blanco hueso, beige) sobre el fondo claro */
.punto.agotado::after { top: -1px; bottom: -1px; width: 1.5px; }
.muestra-filtro { width: 1.5rem; height: 1.5rem; flex-shrink: 0; }
.filtro-color:checked + .muestra-filtro { box-shadow: 0 0 0 2px #FAF9F7, 0 0 0 4px #24150C; } /* taste-skill-ignore: el anillo deja ver los colores claros (blanco hueso, beige) sobre el fondo claro */
.filtro-color:focus-visible + .muestra-filtro { outline: 2px solid #24150C; outline-offset: 5px; }

/* Etiqueta del código: un recorte de cuero con costura */
.etiqueta { background: #4A2A14; color: #F0EDE8; position: relative; padding: 1.25rem 1.25rem 1.1rem; }
.etiqueta::before { content: ""; position: absolute; inset: 6px; border: 1.5px dashed rgba(196, 154, 69, .75); pointer-events: none; }
.etiqueta .codigo { color: #C49A45; font-weight: 600; letter-spacing: .03em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* Mensaje de WhatsApp de ejemplo (Cómo comprar) */
.mensaje { background: #F0EDE8; color: #24150C; padding: 1rem 1.1rem; font-size: var(--paso-chico); line-height: 1.45; max-width: 21rem; }

/* Preguntas: acordeón de recuadros llenos */
.pregunta { background: #F0EDE8; }
.pregunta summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.5rem; padding: 1rem 1.5rem; }
.pregunta summary::-webkit-details-marker { display: none; }
.pregunta .mas { position: relative; width: 16px; height: 16px; flex-shrink: 0; }
.pregunta .mas::before, .pregunta .mas::after { content: ""; position: absolute; left: 0; top: 6.5px; width: 16px; height: 3px; background: currentColor; transition: transform .25s ease; }
.pregunta .mas::after { transform: rotate(90deg); }
.pregunta[open] { background: #4A2A14 url("grano-cuero.png") 0 0 / 220px 220px; color: #F0EDE8; }
.pregunta[open] .mas::after { transform: rotate(0deg); }

/* ---------- Movimiento ---------- */
@media (prefers-reduced-motion: no-preference) {
  .dialogo-lateral[open] { animation: entra-der .28s cubic-bezier(.2, .8, .2, 1); }
  .dialogo-lateral.izquierda[open] { animation: entra-izq .28s cubic-bezier(.2, .8, .2, 1); }
  .dialogo-ficha[open] { animation: aparece .22s ease-out; }
  @keyframes entra-der { from { transform: translateX(100%); } }
  @keyframes entra-izq { from { transform: translateX(-100%); } }
  @keyframes aparece { from { opacity: 0; transform: translateY(12px); } }

  /* Gesto principal: la pieza grande de la portada se abre como un obturador */
  .obturador { animation: obturador 1.1s cubic-bezier(.7, 0, .2, 1) both; }
  .obturador img { animation: asienta 1.4s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes obturador { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
  @keyframes asienta { from { transform: scale(1.12); } to { transform: scale(1); } }

  /* Entradas por sección: título, texto y piezas, escalonadas. Sin JS todo queda visible. */
  .js [data-entra] > * { opacity: 0; transform: translateY(24px); transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1); }
  .js [data-entra].visto > * { opacity: 1; transform: none; }
  .js [data-entra].visto > *:nth-child(2) { transition-delay: 70ms; }
  .js [data-entra].visto > *:nth-child(3) { transition-delay: 140ms; }
  .js [data-entra].visto > *:nth-child(4) { transition-delay: 210ms; }
  .js [data-entra].visto > *:nth-child(5) { transition-delay: 280ms; }
  .js [data-entra].visto > *:nth-child(6) { transition-delay: 350ms; }
  .js [data-entra].visto > *:nth-child(7) { transition-delay: 420ms; }
  .js [data-entra].visto > *:nth-child(n+8) { transition-delay: 490ms; }
  .trio .pieza:not(.p0) { animation: sube .8s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(.35s + var(--i, 0) * 90ms); }
  @keyframes sube { from { opacity: 0; transform: translateY(28px); } }

  /* Respuesta a la mano: botones y piezas */
  .boton { transition: background-color .2s ease, color .2s ease, transform .15s ease; }
  .boton:active { transform: scale(.97); }
  .ejemplar .foto img, .trio .pieza img { transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
  .ejemplar:hover .foto img, .trio .pieza:hover img { transform: scale(1.04); }
  .fila-cat { transition: background-color .2s ease; }
  .flecha { transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
  a:hover > .flecha, a:hover .flecha { transform: translateX(6px); }
}

@media print {
  #barra, footer, .no-imprimir { display: none !important; }
  body { background: #fff; }
}

/* =====================================================================
   Detalles de oficio: grano, costura y perforación
   ===================================================================== */

/* Grano de cuero sobre superficies oscuras (textura propia, estilos/grano-cuero.png) */
.grano { position: relative; isolation: isolate; }
.grano::after { content: ""; position: absolute; inset: 0; z-index: -1; background: url("grano-cuero.png") 0 0 / 220px 220px; opacity: .55; mix-blend-mode: soft-light; pointer-events: none; }

/* Costura: pespunte a 8 px del borde, como en un bolso */
.costura { position: relative; }
.costura::before { content: ""; position: absolute; inset: 9px; border: 1.5px dashed currentColor; opacity: .45; pointer-events: none; } /* taste-skill-ignore: es la costura del cuero, el motivo de la marca */
.costura.oro::before { border-color: #C49A45; opacity: .8; }

/* Etiqueta colgante: perforación con ojal y pespunte en el borde superior */
.ejemplar .colgante { position: relative; padding-left: 2.05rem; }
.ejemplar .colgante::before { content: ""; position: absolute; left: .7rem; top: 1rem; width: .6rem; height: .6rem; border-radius: 50%; background: #FAF9F7; box-shadow: 0 0 0 2px rgba(196, 154, 69, .9); } /* taste-skill-ignore: ojal metálico de la etiqueta */
.ejemplar .colgante::after { content: ""; position: absolute; left: .45rem; right: .45rem; top: .3rem; border-top: 1.5px dashed currentColor; opacity: .28; } /* taste-skill-ignore: pespunte */


/* Vista previa de la categoría al pasar el mouse (escritorio) */
.vista-cat { position: fixed; z-index: 30; width: 180px; aspect-ratio: .85; pointer-events: none; opacity: 0; transform: translate(-50%, -110%) rotate(-3deg) scale(.9); transition: opacity .2s ease, transform .25s cubic-bezier(.2, .7, .2, 1); background: #E7DACA; padding: 8px; }
.vista-cat.on { opacity: 1; transform: translate(-50%, -110%) rotate(-3deg) scale(1); }
.vista-cat img { width: 100%; height: 100%; object-fit: cover; }


/* =====================================================================
   Redondeos (revisión general): nada de cajas rectas.
   Controles 10 px · tarjetas y bloques 16 px · paneles 22 px · filtros e interruptores en píldora.
   ===================================================================== */
:root { --r-control: 10px; --r-tarjeta: 16px; --r-panel: 22px; }

/* Controles */
.boton, #abrir-carrito, #abrir-filtros, #ficha-agregar, #enviar, #orden,
input[type="search"], input[type="text"], input[type="email"], input[type="password"], input:not([type]), textarea, select,
#carrito-cuerpo input { border-radius: var(--r-control); }
#contador { border-radius: 999px; }
[role="group"] { border-radius: var(--r-control); overflow: hidden; }
[data-cat], [data-quitar] { border-radius: 999px; }
[data-cerrar] { border-radius: 999px; }

/* Tarjetas de producto: foto + etiqueta forman un objeto redondeado */
.ejemplar { border-radius: var(--r-tarjeta); overflow: hidden; }
.ejemplar .colgante::after { left: .7rem; right: .7rem; }

/* Portada */
.trio .pieza { border-radius: var(--r-tarjeta); overflow: hidden; }
.trio .marco { border-radius: 8px; }
.costura::before { border-radius: calc(var(--r-tarjeta) - 7px); }
footer > * { border-radius: var(--r-tarjeta); }
.costura.oro::before { border-radius: calc(var(--r-tarjeta) - 7px); }

/* Preguntas */
.pregunta { border-radius: var(--r-tarjeta); overflow: hidden; }

/* Etiqueta del código y mensaje */
.etiqueta { border-radius: var(--r-tarjeta); }
.etiqueta::before { border-radius: calc(var(--r-tarjeta) - 5px); }
.mensaje { border-radius: 14px 14px 14px 4px; }

/* Diálogos */
.dialogo-ficha { border-radius: var(--r-panel); }
.dialogo-lateral { border-radius: var(--r-panel) 0 0 var(--r-panel); }
.dialogo-lateral.izquierda { border-radius: 0 var(--r-panel) var(--r-panel) 0; }
@media (max-width: 767px) { .dialogo-ficha { border-radius: var(--r-panel) var(--r-panel) 0 0; } }
#carrito-cuerpo li { border-radius: 14px; }
#carrito-cuerpo li img { border-radius: 8px; }
#aviso > div { border-radius: 999px; padding-left: 1.25rem; padding-right: 1.4rem; }
.vista-cat { border-radius: 14px; }
.vista-cat img { border-radius: 8px; }

/* Imágenes de las categorías y fotos de la ficha */
.dialogo-ficha > div > div:first-child { overflow: hidden; }

/* Tallas (ficha y filtro): cuadros con el número; la elegida va oscura, la agotada tachada */
.talla { display: grid; place-items: center; min-width: 2.75rem; height: 2.75rem; padding: 0 .6rem; border-radius: 10px; background: #F0EDE8; font-variant-numeric: tabular-nums; transition: background-color .15s ease, color .15s ease; }
.talla-input:checked + .talla { background: #24150C; color: #FAF9F7; }
.talla-input:focus-visible + .talla { outline: 2px solid #24150C; outline-offset: 3px; }
.talla.agotada { text-decoration: line-through; opacity: .5; cursor: not-allowed; }
label:hover > .talla:not(.agotada) { background: #E7DACA; }
label:hover > .talla-input:checked + .talla { background: #24150C; }

/* Pedido realizado: el paso recomendado (enviar el código por WhatsApp) se destaca */
.recomendado { background: #E9D8AE; border-radius: 16px; padding: 1.1rem 1.1rem 1.2rem; }
