/* Abarrotes La Esquina — la hoja de contactos.
   Dirección: "The contact sheet". Todo el surtido a la vista, por pasillos; un toque agrega. Tipografía: Hanken Grotesk (500 y 400).
   Colores: escarcha y pizarra, un acento verde azulado. Reglas de la casa: sin gradientes, sin sombras en reposo, sin líneas finas,
   una sola forma de botón (rectángulo), una sola esquina (recta). */

@font-face {
  font-family: 'Hanken Grotesk';
  src: url('fonts/hanken-grotesk-latin.woff2') format('woff2');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f7f9fa;
  --surface: #ecf0f2;
  --ink: #1f3038;
  --muted: #4f5d64;
  --accent: #0d7480;
  --accent-ink: #ffffff;

  --step-small: 1rem;
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.375rem, 1.1rem + 0.9vw, 1.75rem);
  --step-display: clamp(2.9rem, 1.1rem + 8.2vw, 9.5rem);

  --margin: clamp(16px, 2.2vw, 32px);
  --gap: 8px;
  --tile: 164px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dock-h: 128px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: var(--step-body);
  line-height: 1.45;
  letter-spacing: -0.005em;
  padding-bottom: calc(var(--dock-h) + 24px);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.sr { 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: 8px; top: -80px; z-index: 100; background: var(--ink); color: var(--bg); padding: 12px 16px; text-decoration: none; }
.saltar:focus { top: 8px; }
.suave { color: var(--muted); font-size: var(--step-small); }

/* ---------- botones: una sola forma, rectángulo recto ---------- */
.boton-ink, .boton-papel, .boton-acento, .flecha {
  appearance: none; border: 0; border-radius: 0; cursor: pointer;
  min-height: 44px; padding: 0 20px; font-weight: 500; font-size: var(--step-small);
  transition: transform 0.18s var(--ease), opacity 0.18s var(--ease);
}
.boton-ink { background: var(--ink); color: var(--bg); }
.boton-papel { background: var(--bg); color: var(--ink); min-height: 52px; padding: 0 28px; font-size: var(--step-body); }
.boton-acento { background: var(--accent); color: var(--accent-ink); width: 100%; min-height: 56px; font-size: var(--step-body); }
.boton-ink:hover, .boton-papel:hover, .boton-acento:hover { opacity: 0.88; }
.boton-ink:active, .boton-papel:active, .boton-acento:active, .flecha:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.cuenta-top { display: inline-block; min-width: 1.4em; text-align: center; }

/* ---------- barra superior: marca, dos enlaces, una acción ---------- */
.barra { background: var(--bg); }
.barra-fila { display: grid; grid-template-columns: 1fr auto auto; align-items: center; column-gap: 24px; min-height: 60px; padding: 8px var(--margin); }
.marca { font-weight: 500; font-size: var(--step-body); text-decoration: none; letter-spacing: -0.02em; }
.enlaces { display: flex; gap: 24px; font-size: var(--step-small); }
.enlaces a { text-decoration: none; color: var(--muted); padding: 10px 0; }
.enlaces a:hover { color: var(--ink); }
.pasillos { position: sticky; top: 0; z-index: 30; display: flex; gap: 22px; overflow-x: auto; padding: 0 var(--margin); height: 46px; align-items: center; scrollbar-width: none; background: var(--surface); }
.pasillos::-webkit-scrollbar { display: none; }
.pasillos a { flex: none; text-decoration: none; color: var(--muted); font-size: var(--step-small); padding: 12px 0; transition: color 0.2s; }
.pasillos a:hover { color: var(--ink); }
.pasillos a[aria-current='true'] { color: var(--ink); font-weight: 500; }

/* ---------- portada: el nombre y cuatro datos cortos ---------- */
.portada { padding: clamp(28px, 4vw, 56px) var(--margin) 0; }
.nombre {
  font-weight: 500; font-size: var(--step-display); line-height: 0.9; letter-spacing: -0.05em;
  text-wrap: balance; max-width: 16ch;
}
.lema { font-size: var(--step-lead); line-height: 1.12; letter-spacing: -0.03em; font-weight: 500; max-width: 22ch; margin: clamp(20px, 2.4vw, 32px) 0 clamp(28px, 3.4vw, 48px); text-wrap: balance; }
.datos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px var(--gap); }
.dato p:first-child { font-size: var(--step-body); font-weight: 500; line-height: 1.3; }
.dato .suave { margin-top: 2px; color: var(--ink); }
.estado { display: flex; align-items: baseline; gap: 10px; }
.punto { flex: none; width: 10px; height: 10px; background: var(--accent); align-self: center; }
.estado.cerrado .punto { background: var(--muted); }
.buscar { margin-top: clamp(24px, 3vw, 40px); }
.buscar input {
  width: 100%; min-height: 52px; padding: 0 16px; background: var(--bg); color: var(--ink);
  border: 1px solid var(--muted); border-radius: 0; font-size: var(--step-body);
}
.buscar input::placeholder { color: var(--muted); }

/* ---------- la hoja: pasillos en corridas de cuadros ---------- */
.hoja { padding: clamp(40px, 5vw, 72px) var(--margin) 0; }
.corridas { display: grid; gap: clamp(48px, 6vw, 88px); }
.corridas:has(.corrida:hover) .corrida:not(:hover) { opacity: 0.5; }
.corrida { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); transition: opacity 0.24s var(--ease); scroll-margin-top: 64px; }
.corrida[hidden] { display: none; }
.cab { grid-column: 1 / span 3; padding-right: 16px; display: flex; flex-direction: column; gap: 8px; }
.cab h2 { font-weight: 500; font-size: var(--step-lead); line-height: 1.05; letter-spacing: -0.03em; }
.cab .desc { font-size: var(--step-small); }
.cab .cuenta { margin-top: auto; color: var(--muted); font-size: var(--step-small); }
.cab .acciones { display: flex; align-items: center; gap: var(--gap); flex-wrap: wrap; margin-top: 4px; }
.ver-todo { appearance: none; background: none; border: 0; padding: 0 14px 0 0; min-height: 44px; font-weight: 500; font-size: var(--step-small); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.flecha-c { width: 44px; min-height: 44px; padding: 0; background: var(--surface); color: var(--ink); font-size: 1.15rem; }
.flecha-c:hover { background: var(--ink); color: var(--bg); opacity: 1; }

/* pasillo abierto: todos los productos en rejilla */
.corrida.abierta .cuadros { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); gap: 20px var(--gap); align-items: start; overflow: visible; }
.corrida.abierta .cuadro, .corrida.abierta .cuadro.grande { width: auto; }
.corrida.abierta .cuadro.grande { grid-column: span 2; grid-row: span 2; }
.corrida.abierta .flecha-c { display: none; }
/* al buscar se ve todo en rejilla */
.buscando .corrida .cuadros { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); gap: 20px var(--gap); align-items: start; overflow: visible; }
.buscando .cuadro, .buscando .cuadro.grande { width: auto; }
.buscando .cuadro.grande { grid-column: auto; grid-row: auto; }
.buscando .cuadro.grande .foto { aspect-ratio: 1; }
.buscando .acciones { display: none; }
.cuadros { grid-column: 4 / -1; min-width: 0; display: flex; align-items: flex-end; gap: var(--gap); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding-bottom: 2px; }
.cuadros::-webkit-scrollbar { display: none; }

.cuadro { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: none; width: var(--tile); scroll-snap-align: start; }
.cuadro[hidden] { display: none; }
.foto { position: relative; aspect-ratio: 1; background: var(--surface); overflow: hidden; }
.cuadro.grande { width: calc(var(--tile) * 2 + var(--gap)); }
.agregar { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; display: block; }
.agregar img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.agregar:hover img { transform: scale(1.04); }
.agregar:active img { transform: scale(0.97); }
.cuadro.grande .agregar img { animation: deriva 16s ease-in-out infinite alternate; }
@keyframes deriva { from { transform: scale(1); } to { transform: scale(1.07); } }
.cuadro.grande .agregar:hover img { animation-play-state: paused; }

.paso { position: absolute; left: 0; right: 0; bottom: 0; height: 48px; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; background: var(--ink); color: var(--bg); }
.paso[hidden] { display: none; }
.paso button { appearance: none; border: 0; border-radius: 0; background: none; color: inherit; height: 48px; font-size: 1.5rem; line-height: 1; cursor: pointer; transition: transform 0.15s var(--ease); }
.paso button:active { transform: scale(0.85); }
.paso output { text-align: center; font-weight: 500; font-size: var(--step-body); font-variant-numeric: tabular-nums; }
.paso output.salto { animation: salto 0.28s var(--ease); }
@keyframes salto { 40% { transform: translateY(-4px); } }

.pie-cuadro { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; font-size: var(--step-small); line-height: 1.3; }
.pie-cuadro .n { grid-column: 1 / -1; font-weight: 500; color: var(--ink); }
.pie-cuadro .pres { color: var(--muted); }
.pie-cuadro .precio { color: var(--ink); font-variant-numeric: tabular-nums; }
.sin-resultados { padding: 32px 0; font-size: var(--step-lead); line-height: 1.2; max-width: 28ch; }

/* ---------- cómo se pide: fila que se arrastra ---------- */
.como { padding: clamp(120px, 14vw, 200px) 0 0; }
.como-cab { display: flex; justify-content: space-between; align-items: end; padding: 0 var(--margin); margin-bottom: 20px; }
.como h2 { font-weight: 500; font-size: var(--step-lead); letter-spacing: -0.03em; line-height: 1.05; }
.flechas { display: flex; gap: var(--gap); }
.flecha { width: 48px; padding: 0; background: var(--ink); color: var(--bg); font-size: 1.25rem; }
.avance { height: 6px; background: var(--surface); margin: 0 var(--margin) 28px; }
.avance span { display: block; height: 100%; width: 20%; background: var(--ink); transition: width 0.2s linear; }
.fila { display: flex; gap: 32px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--margin); padding: 0 var(--margin) 8px; scrollbar-width: none; }
.fila::-webkit-scrollbar { display: none; }
.momento { flex: none; width: 280px; scroll-snap-align: start; display: flex; flex-direction: column; }
.momento h3 { font-weight: 500; font-size: var(--step-body); line-height: 1.25; }
.momento p { font-size: var(--step-small); margin-top: 8px; max-width: 30ch; }
.momento img { margin-top: var(--espacio, 80px); width: 280px; aspect-ratio: 4 / 5; object-fit: cover; background: var(--surface); }
.momento:nth-child(1) { --espacio: 112px; }
.momento:nth-child(2) { --espacio: 48px; }
.momento:nth-child(3) { --espacio: 136px; }
.momento:nth-child(4) { --espacio: 72px; }
.momento:nth-child(5) { --espacio: 104px; }

/* ---------- contacto ---------- */
.contacto { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); align-items: start; padding: clamp(120px, 14vw, 200px) var(--margin) 0; }
.frase { grid-column: 1 / span 5; font-size: clamp(1.5rem, 1.1rem + 0.9vw, 2.1875rem); line-height: 1.12; letter-spacing: -0.03em; font-weight: 500; max-width: 24em; }
.retrato { grid-column: 8 / span 2; width: 160px; height: 160px; object-fit: cover; }
.contacto-enlaces { grid-column: 10 / -1; display: flex; flex-direction: column; gap: 12px; }
.pregunta { font-weight: 500; font-size: var(--step-body); }
.contacto-enlaces a { font-size: var(--step-body); text-decoration: underline; text-underline-offset: 3px; width: fit-content; min-height: 32px; }
.nota-ejemplo { margin-top: 8px; }

/* ---------- pie: una sola línea tranquila ---------- */
.pie { padding-top: clamp(150px, 26svh, 280px); }
.pie-linea { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 24px; padding: 0 var(--margin) 30px; font-size: var(--step-small); color: var(--muted); }
.pie-links { display: flex; gap: 24px; }
.pie-links a { color: var(--ink); text-decoration: none; padding: 8px 0; }
.pie-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pie-anio { text-align: right; }
.creditos { background: var(--ink); padding: 16px var(--margin); display: flex; justify-content: center; }
.hecho-por { display: inline-flex; align-items: center; gap: 12px; color: var(--bg); text-decoration: none; font-size: var(--step-small); min-height: 44px; }
.hecho-por img { height: 28px; width: auto; }

/* ---------- el panel del mandado, anclado abajo ---------- */
.dock {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 24px; margin-inline: auto;
  width: min(820px, calc(100% - 2 * var(--margin)));
  background: var(--ink); color: var(--bg);
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; padding: 18px 24px;
  transition: transform 0.6s var(--ease), opacity 0.6s var(--ease);
}
.js .dock:not(.listo) { transform: translateY(24px); opacity: 0; }
.dock.oculto { transform: translateY(calc(100% + 32px)); opacity: 0; visibility: hidden; transition: transform 0.4s var(--ease), opacity 0.4s var(--ease), visibility 0s 0.4s; }
.dock-frase { font-size: var(--step-body); font-weight: 500; line-height: 1.25; letter-spacing: -0.015em; }
.dock-nota { margin-top: 2px; font-size: var(--step-small); color: #b9c6cc; }

/* ---------- revisar y pedir: una sola hoja ---------- */
.mandado {
  border: 0; padding: 0; margin: 0 0 0 auto; background: var(--bg); color: var(--ink);
  width: min(560px, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
}
.mandado:focus { outline: none; }
.mandado::backdrop { background: rgba(31, 48, 56, 0.55); }
.mandado[open] { animation: entra 0.32s var(--ease); }
@keyframes entra { from { transform: translateX(32px); opacity: 0; } }
.m-cab { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px var(--margin) 12px; }
.m-cab h2 { font-weight: 500; font-size: var(--step-lead); letter-spacing: -0.03em; }
.m-estado { padding: 0 var(--margin) 8px; color: var(--muted); font-size: var(--step-small); }
.m-estado.cerrado { color: var(--ink); background: var(--surface); padding: 12px var(--margin); }
.m-vacio { padding: 24px var(--margin) 48px; font-size: var(--step-lead); line-height: 1.2; }
#m-lleno { padding: 0 var(--margin) 40px; }

.renglones { display: grid; margin: 8px 0 20px; }
.renglon { display: grid; grid-template-columns: 40px 1fr auto; column-gap: 12px; row-gap: 4px; align-items: center; padding: 12px 0; }
.renglon img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.renglon .n { font-weight: 500; line-height: 1.25; }
.renglon .p { color: var(--muted); font-size: var(--step-small); }
.renglon .importe { font-variant-numeric: tabular-nums; text-align: right; }
.stepper { grid-column: 2 / -1; display: inline-grid; grid-template-columns: 44px 44px 44px; align-items: center; background: var(--surface); width: fit-content; }
.stepper button { appearance: none; border: 0; background: none; height: 44px; font-size: 1.4rem; cursor: pointer; border-radius: 0; color: var(--ink); transition: transform 0.15s var(--ease); }
.stepper button:active { transform: scale(0.85); }
.stepper output { text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }

.totales { display: grid; gap: 4px; padding-top: 12px; background: none; }
.totales div { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); }
.totales dd { font-variant-numeric: tabular-nums; }
.totales .gran { color: var(--ink); font-weight: 500; font-size: var(--step-lead); letter-spacing: -0.03em; padding-top: 8px; }
.aviso-minimo { margin-top: 16px; padding: 14px 16px; background: var(--surface); font-weight: 500; }

.entrega { margin-top: 32px; display: grid; gap: 16px; }
.entrega-tit { font-weight: 500; font-size: var(--step-lead); letter-spacing: -0.03em; line-height: 1.1; }
.campo { display: grid; gap: 6px; }
.campo label { font-size: var(--step-small); font-weight: 500; }
.campo .opc { color: var(--muted); font-weight: 400; }
.campo input, .campo select, .campo textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--muted); border-radius: 0; font-size: var(--step-body);
}
.campo textarea { min-height: 84px; resize: vertical; }
.campo [aria-invalid='true'] { border-color: var(--ink); border-width: 2px; }
.error { font-size: var(--step-small); color: var(--ink); background: var(--surface); padding: 8px 12px; }
.error[hidden] { display: none; }

/* ---------- entrada de las partes (nada queda oculto si falla el script) ---------- */
.js [data-in] { opacity: 0; transform: translateY(24px); }
.js [data-in].in { opacity: 1; transform: none; transition: opacity 0.6s var(--ease) var(--d, 0ms), transform 0.6s var(--ease) var(--d, 0ms); }

/* ---------- teléfono: su propia composición ---------- */
@media (max-width: 860px) {
  :root { --tile: 150px; --dock-h: 176px; }
  .enlaces { display: none; }
  .barra-fila { grid-template-columns: 1fr auto; min-height: 56px; }
  .datos { grid-template-columns: 1fr 1fr; gap: 20px var(--gap); }
  .nombre { max-width: 9ch; }
  .corrida { grid-template-columns: 1fr; row-gap: 14px; }
  .cab, .cuadros { grid-column: 1 / -1; }
  .cab { display: grid; grid-template-columns: 1fr auto; align-items: baseline; padding-right: 0; row-gap: 4px; }
  .cab .desc { grid-column: 1 / -1; grid-row: 2; }
  .cab .cuenta { margin-top: 0; grid-column: 2; grid-row: 1; }
  .cab .acciones { grid-column: 1 / -1; grid-row: 3; margin-top: 0; }
  .flecha-c { display: none; }
  .momento { width: 72vw; }
  .momento img { width: 100%; }
  .momento:nth-child(n) { --espacio: 40px; }
  .momento:nth-child(2n) { --espacio: 64px; }
  .flechas { display: none; }
  .contacto { grid-template-columns: 96px 1fr; row-gap: 24px; column-gap: 16px; }
  .frase { grid-column: 1 / -1; font-size: 1.5rem; }
  .retrato { grid-column: 1; grid-row: 2; width: 96px; height: 96px; }
  .contacto-enlaces { grid-column: 2; grid-row: 2; }
  .pie-linea { grid-template-columns: 1fr; gap: 8px; }
  .pie-anio { text-align: left; }
  .pie-links { flex-wrap: wrap; gap: 4px 20px; }
  .pie { padding-top: 20svh; }
  .dock { left: 0; right: 0; bottom: 0; width: 100%; margin: 0; grid-template-columns: 1fr; gap: 14px; padding: 16px var(--margin) 18px; }
  .boton-papel { width: 100%; }
  .mandado { width: 100%; margin: 0; }
}
@media (max-width: 600px) {
  :root { --tile: 40vw; }
  .cuadros { margin-inline: calc(var(--margin) * -1); padding-inline: var(--margin); scroll-padding-inline: var(--margin); }
  .cuadro.grande { width: var(--tile); }
  .corrida.abierta .cuadros, .buscando .corrida .cuadros { grid-template-columns: repeat(2, 1fr); margin-inline: 0; padding-inline: 0; }
  .corrida.abierta .cuadro.grande { grid-column: span 2; grid-row: span 1; }
  .corrida.abierta .cuadro.grande .foto { aspect-ratio: 16 / 10; height: auto; }
}
@media (min-width: 861px) and (max-width: 1100px) {
  .cab { grid-column: 1 / span 4; }
  .cuadros { grid-column: 5 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-in] { opacity: 1; transform: none; }
  .js .dock:not(.listo) { transform: none; opacity: 1; }
  .dock.oculto { transform: none; }
  .cuadro.grande .agregar img { animation: none; }
  .mandado[open] { animation: none; }
  .paso output.salto { animation: none; }
  * { transition-duration: 0.01ms !important; }
}


/* vaciar el mandado: botón de texto, con confirmación en el mismo lugar */
.vaciar-caja { display: flex; justify-content: flex-end; margin: -8px 0 8px; }
.vaciar { appearance: none; background: none; border: 0; border-radius: 0; min-height: 44px; padding: 0 0 0 16px; font-weight: 500; font-size: var(--step-small); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.vaciar[hidden], .vaciar-pregunta[hidden] { display: none; }
.vaciar-pregunta { display: inline-flex; align-items: center; gap: 12px; font-size: var(--step-small); }
.vaciar-pregunta .vaciar { padding-left: 4px; padding-right: 4px; }
.vaciar:active { opacity: 0.6; }
