@font-face {
  font-family: "Bagel Fat One"; src: url("fuentes/bagel-fat-one.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Figtree"; src: url("fuentes/figtree.woff2") format("woff2");
  font-weight: 400 700; font-display: swap;
}

:root {
  --cereza: #b80f3a;
  --vino: #6b0a26;
  --durazno: #f47a1c;
  --uva: #86bb22;
  --leche: #fff6f4;
  --tinta: #2a0710;
  --suave: #6e4a52;
  --borde: #f0d8d6;
  --campo: #a87a84;
  --elegido: #ffd400;
  --whatsapp: #127a3e;
  --error: #a50d33;
  --curva: 28px;
  --gajo: 68px;
  --salida: cubic-bezier(.23, 1, .32, 1);
  --cajon: cubic-bezier(.32, .72, 0, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 24px; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--vino);
  color: var(--tinta);
  font: 17px/1.5 Figtree, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
h1, h2 { font-family: "Bagel Fat One", Figtree, sans-serif; font-weight: 400; line-height: 1; margin: 0; text-wrap: balance; }
h3 { margin: 0; line-height: 1.2; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
::selection { background: var(--tinta); color: var(--leche); }
:focus-visible { outline: 3px solid var(--tinta); outline-offset: 3px; }
.capa--cereza :focus-visible, .capa--vino :focus-visible { outline-color: var(--leche); }
.barra-carrito:focus-visible, .hoja__cerrar:focus-visible { outline-color: var(--leche); outline-offset: -6px; }

/* Capas: cada sección abre con el borde acanalado del molde y una capa translúcida detrás. */
.capa { --color: var(--leche); position: relative; background: var(--color); padding: 48px 16px 88px; }
.capa::before, .capa::after {
  content: ""; position: absolute; left: 0; right: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 100%, var(--color) 69%, transparent 70%) center bottom / var(--gajo) calc(var(--gajo) / 2) repeat-x;
}
.capa::before { top: calc(var(--gajo) / -2 + 1px); height: calc(var(--gajo) / 2); }
.capa::after {
  top: calc(var(--gajo) * -.85); height: calc(var(--gajo) / 2 + 2px); opacity: .45;
  background-position-x: calc(50% + var(--gajo) / 2);
}
.capa--cereza { --color: var(--cereza); color: #fff; }
.capa--durazno { --color: var(--durazno); }
.capa--uva { --color: var(--uva); }
.capa--leche { --color: var(--leche); }
.capa--vino { --color: var(--vino); color: #ffe9ee; }
.capa__ancho { max-width: 1040px; margin: 0 auto; }
.capa h2 { font-size: clamp(44px, 13vw, 76px); margin-bottom: 24px; }

/* Portada */
.portada { display: flex; flex-direction: column; min-height: 97svh; }
.portada__foto { flex: 1 1 44svh; min-height: 44svh; overflow: hidden; background: var(--cereza); }
.portada__foto img { width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 100%; scale: 1.08; }
.portada__texto { flex: none; padding-top: 12px; padding-bottom: calc(var(--gajo) * .85 + 16px); }
.con-encargo .portada__texto { padding-bottom: 104px; }
.portada h1 { font-size: clamp(56px, 17vw, 132px); letter-spacing: -.01em; line-height: .92; }
.portada__lema { font-size: clamp(18px, 5vw, 24px); line-height: 1.3; font-weight: 500; margin: 14px 0; max-width: 32ch; }

/* Secciones de postres */
.seccion { scroll-margin-top: 44px; }
.rejilla { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; grid-auto-flow: dense; }
.producto {
  display: block; width: 100%; text-align: left; border: 0; padding: 0; background: none;
  align-self: start;
}
.producto--grande { grid-column: span 2; }
.producto__foto { position: relative; display: block; }
.producto__foto .foto {
  width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--curva); border: 4px solid var(--leche);
  box-shadow: 0 10px 24px rgba(42, 7, 16, .22);
  transform-origin: 50% 100%;
  transition: scale 200ms var(--salida);
}
.foto { object-fit: cover; background: var(--leche); }
.foto--vacia { display: block; }
.producto__mas {
  position: absolute; right: 10px; bottom: 10px; width: 44px; height: 44px;
  border-radius: 50%; background: var(--tinta); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(42, 7, 16, .35);
}
.producto__en {
  position: absolute; left: 10px; top: 10px; background: var(--elegido); color: var(--tinta);
  border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 700;
}
.producto__texto { display: block; padding: 10px 4px 0; }
.producto__nombre { display: block; font-size: 17px; font-weight: 700; line-height: 1.2; }
.producto--grande .producto__nombre {
  font-family: "Bagel Fat One", Figtree, sans-serif; font-weight: 400;
  font-size: clamp(30px, 8.6vw, 40px); line-height: 1.02; text-wrap: balance;
}
.producto__precio { display: block; margin-top: 4px; font-weight: 700; }
.producto__precio--pendiente { font-size: 14px; font-weight: 500; }
@media (min-width: 760px) {
  .rejilla { grid-template-columns: 2fr 1fr; gap: 28px 20px; }
  .producto--grande { grid-column: 1; grid-row: span 2; }
  .seccion:nth-of-type(even) .rejilla { grid-template-columns: 1fr 2fr; }
  .seccion:nth-of-type(even) .producto--grande { grid-column: 2; grid-row: 1 / span 2; }
  .rejilla:not(:has(.producto:not(.producto--grande))) { grid-template-columns: 1fr 1fr !important; }
  .rejilla:not(:has(.producto:not(.producto--grande))) .producto--grande { grid-column: auto !important; }
}

/* Cómo encargar */
.como__accion { margin-bottom: 32px; }
.pasos { list-style: none; counter-reset: paso; margin: 0 0 28px; padding: 0; display: grid; gap: 22px; }
.pasos li { counter-increment: paso; display: grid; grid-template-columns: 56px 1fr; column-gap: 14px; align-items: start; }
.pasos li::before {
  content: counter(paso); grid-row: span 3;
  font: 44px/1 "Bagel Fat One", Figtree, sans-serif; color: var(--cereza);
}
.pasos strong { display: block; font-size: 19px; line-height: 1.25; }
.datos { margin: 0; display: grid; gap: 16px; border-top: 2px solid var(--borde); padding-top: 24px; }
.datos dt { font-weight: 700; }
.datos dd { margin: 2px 0 0; color: var(--suave); }
@media (min-width: 760px) {
  .pasos { grid-template-columns: repeat(3, 1fr); gap: 28px; }
  .datos { grid-template-columns: repeat(2, 1fr); gap: 28px; }
}

/* Pie */
.pie { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
.pie p { margin: 0; max-width: 46ch; }
.pie__accion { margin-top: 20px; }
.pie__marca { font: 40px/1 "Bagel Fat One", Figtree, sans-serif; margin-bottom: 12px !important; }

/* Barra del encargo */
.barra-carrito {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; z-index: 10;
  display: flex; align-items: center; gap: 12px; min-height: 58px;
  border: 3px solid var(--leche); border-radius: 999px; padding: 8px 22px 8px 10px;
  background: var(--tinta); color: #fff; font-weight: 700;
  box-shadow: 0 12px 28px rgba(42, 7, 16, .4);
  transform-origin: 50% 100%;
  transition: translate 320ms var(--cajon), opacity 200ms ease-out, scale 140ms var(--salida);
}
@starting-style { .barra-carrito { translate: 0 calc(100% + 24px); opacity: 0; } }
.barra-carrito__cuenta {
  background: var(--elegido); color: var(--tinta); border-radius: 50%;
  width: 36px; height: 36px; display: grid; place-items: center;
}
.barra-carrito__total { margin-left: auto; font-weight: 500; font-size: 15px; white-space: nowrap; }

/* Botones */
.boton {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  border: 0; border-radius: 999px; min-height: 56px; padding: 0 28px;
  font-weight: 700; font-size: 18px;
  transition: scale 140ms var(--salida);
}
.boton--leche { background: var(--leche); color: var(--cereza); }
.boton--primario { background: var(--cereza); color: #fff; }
.boton--whatsapp { width: 100%; background: var(--whatsapp); color: #fff; margin-top: 4px; }

/* Hojas (dialog) */
.hoja {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px;
  max-height: 92dvh; border-radius: 28px 28px 0 0;
  background: var(--leche); color: var(--tinta);
  overscroll-behavior: contain;
  translate: 0 100%;
  transition: translate 200ms var(--salida), overlay 200ms allow-discrete, display 200ms allow-discrete;
}
.hoja[open] { translate: 0 0; transition: translate 340ms var(--cajon), overlay 340ms allow-discrete, display 340ms allow-discrete; }
@starting-style { .hoja[open] { translate: 0 100%; } }
.hoja::backdrop { background: rgba(42, 7, 16, .6); opacity: 0; transition: opacity 200ms ease-out, overlay 200ms allow-discrete, display 200ms allow-discrete; }
.hoja[open]::backdrop { opacity: 1; }
@starting-style { .hoja[open]::backdrop { opacity: 0; } }
@media (min-width: 600px) {
  .hoja { margin: auto; border-radius: 28px; translate: 0 24px; opacity: 0; transition: translate 200ms var(--salida), opacity 160ms ease-out, overlay 200ms allow-discrete, display 200ms allow-discrete; }
  .hoja[open] { translate: 0 0; opacity: 1; transition: translate 280ms var(--salida), opacity 180ms ease-out, overlay 280ms allow-discrete, display 280ms allow-discrete; }
  @starting-style { .hoja[open] { translate: 0 24px; opacity: 0; } }
}
.hoja__cuerpo { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); position: relative; }
.hoja__cerrar {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 44px; height: 44px;
  border-radius: 50%; border: 0; background: var(--tinta); color: #fff;
  display: grid; place-items: center;
}
.hoja__foto { position: relative; margin: -20px -16px 16px; overflow: hidden; border-radius: 28px 28px 0 0; background: var(--cereza); }
.hoja__foto::after, .hoja__cab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 18px;
  background: radial-gradient(circle at 50% 100%, var(--leche) 69%, transparent 70%) center bottom / 36px 18px repeat-x;
}
.hoja__cab { position: relative; margin: -20px -16px 8px; padding: 24px 72px 38px 16px; background: var(--cereza); color: #fff; border-radius: 28px 28px 0 0; }
.hoja__foto .foto { width: 100%; height: min(44dvh, 320px); transform-origin: 50% 100%; scale: 1.08; }
.hoja h2 { font-size: 32px; line-height: 1.04; }
.hoja h3 { font-size: 19px; margin: 24px 0 8px; }
.hoja__acciones {
  position: sticky; bottom: 0; display: flex; gap: 12px; align-items: center;
  background: var(--leche); padding-top: 12px; margin-top: 8px;
}
.hoja__acciones .boton { flex: 1; }

.grupo { border: 0; padding: 0; margin: 16px 0 0; }
.grupo legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.grupo legend small { color: var(--suave); font-weight: 400; }
.opcion { display: flex; align-items: center; gap: 10px; min-height: 48px; border-bottom: 1px solid var(--borde); }
.opcion input { width: 22px; height: 22px; accent-color: var(--cereza); }
.opcion span:last-child { margin-left: auto; color: var(--suave); }

.campo { display: block; margin: 14px 0; border: 0; padding: 0; }
.campo__etiqueta { display: block; font-weight: 700; font-size: 16px; margin-bottom: 6px; padding: 0; }
input:not([type]), input[type="date"], textarea {
  width: 100%; font: inherit; color: var(--tinta); background: #fff;
  border: 2px solid var(--campo); border-radius: 14px; padding: 12px; min-height: 52px;
  caret-color: var(--cereza);
}
input:not([type]):focus-visible, input[type="date"]:focus-visible, textarea:focus-visible { border-color: var(--tinta); outline-offset: 1px; }
::placeholder { color: var(--suave); opacity: 1; }
.opciones-pago { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.opciones-pago label {
  display: flex; gap: 10px; align-items: center; min-height: 52px; padding: 0 12px;
  border: 2px solid var(--campo); border-radius: 14px; background: #fff; font-weight: 500;
}
.opciones-pago label:has(input:checked) { border-color: var(--tinta); background: var(--elegido); }
.opciones-pago input { accent-color: var(--tinta); width: 20px; height: 20px; flex: none; }
.recordar { display: flex; gap: 10px; align-items: center; margin: 8px 0 12px; font-size: 16px; min-height: 44px; }
.recordar input { width: 22px; height: 22px; accent-color: var(--cereza); flex: none; }

.cantidad { display: flex; align-items: center; border: 2px solid var(--campo); border-radius: 999px; background: #fff; }
.cantidad button { width: 48px; height: 48px; border: 0; background: none; display: grid; place-items: center; }
.cantidad output { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.lista-carrito { list-style: none; padding: 0; margin: 12px 0; }
.lista-carrito li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--borde); }
.lista-carrito .detalle { grid-column: 1 / -1; color: var(--suave); font-size: 15px; }
.lista-carrito .controles { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.lista-carrito .controles .cantidad button { width: 44px; height: 44px; }
.quitar { border: 0; background: none; color: var(--error); font-size: 15px; font-weight: 500; margin-left: auto; min-height: 44px; padding: 0 8px; }

.resumen { background: #fff; border: 2px solid var(--borde); border-radius: 16px; padding: 12px 14px; }
.resumen div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.resumen div span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.resumen__total { font-weight: 700; font-size: 19px; }

.texto-suave { color: var(--suave); }
.texto-chico { font-size: 14px; text-align: center; margin: 10px 0 0; }
.ayuda { display: block; font-size: 14px; margin-top: 6px; }
.error { color: var(--error); font-weight: 700; margin: 8px 0 0; }
.error:empty { display: none; }

/* Escritorio: la foto y el nombre comparten la primera pantalla. */
@media (min-width: 900px) {
  .portada { flex-direction: row-reverse; }
  .portada__foto { flex: 1 1 56%; min-height: 97svh; }
  .portada__texto { flex: 1 1 44%; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 48px; }
  .portada__texto::before, .portada__texto::after { display: none; }
  .portada h1 { font-size: clamp(84px, 8.6vw, 132px); }
}

/* Respuesta al dedo: todo lo que se toca se hunde un poco. */
.boton:active, .barra-carrito:active, .hoja__cerrar:active { scale: .97; }
.producto:active .foto { scale: .98; }
.cantidad button:active { scale: .9; }
.hoja__cerrar, .cantidad button { transition: scale 140ms var(--salida); }
@media (hover: hover) and (pointer: fine) {
  .producto:hover .foto { scale: 1.02; }
  .producto:active .foto { scale: .98; }
}

/* La foto de portada se acerca al bajar, sin JavaScript donde el navegador lo permite. */
@supports (animation-timeline: scroll()) {
  .portada__foto img { animation: acercar linear both; animation-timeline: scroll(root); animation-range: 0 100svh; }
  @keyframes acercar { to { translate: 0 8%; scale: 1.2; } }
  /* La capa translúcida se recorre al bajar, como si las capas se deslizaran. */
  .capa { overflow-x: clip; }
  .capa::after { left: calc(var(--gajo) * -2); right: calc(var(--gajo) * -2); animation: deslizar linear both; animation-timeline: scroll(root); }
  @keyframes deslizar { to { translate: calc(var(--gajo) * 2) 0; } }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
