/* Bocadito Dulce — order page. Brand kit tokens are the only colors on the page. */

:root {
  --cream: #FCF4EC;
  --cream-2: #F7EBDF;      /* cream, one step deeper: hairlines on cream, sticky bar edge */
  --cacao: #643420;
  --cacao-70: #8A5A47;     /* secondary text, labels, placeholders, resting underline; tinted from Cacao, never gray */
  --cacao-40: #B89683;     /* disabled stepper glyph only; never text, never a fill under text */
  --blush: #CF8076;
  --blush-20: #F3D9D3;     /* stepper disc, selected chip ring */
  --blush-10: #F9ECE8;

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Manrope", "Segoe UI", Arial, sans-serif;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 180ms;
  --t: 320ms;

  --gutter: 20px;
  --col: 560px;
  --radius: 18px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--cream);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--cacao);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--blush);
  padding-bottom: env(safe-area-inset-bottom);
}

::selection { background: var(--blush-20); color: var(--cacao); }
:focus-visible { outline: 2px solid var(--blush); outline-offset: 3px; border-radius: 4px; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: var(--blush); text-underline-offset: 0.18em; text-decoration-thickness: 1.5px; }
a:hover { text-decoration-color: var(--cacao); }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 600; line-height: 1; text-wrap: balance; }
strong { font-weight: 600; }
button { font: inherit; color: inherit; }
svg { display: block; }

.skip {
  position: absolute; left: var(--gutter); top: -60px;
  background: var(--cacao); color: var(--cream); padding: 10px 14px; border-radius: 999px;
  z-index: 50; transition: top var(--t-fast) var(--ease);
}
.skip:focus { top: 12px; }

/* ---------- Layout ---------- */

.page {
  width: min(100%, var(--col));
  margin: 0 auto;
}

/* ---------- Masthead ---------- */

.masthead {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px var(--gutter) 0;
}
.brand { display: block; width: 190px; flex: none; }
.brand img { width: 100%; }
.place {
  margin-top: 10px;
  font-size: 0.875rem; font-weight: 500; letter-spacing: 0.01em; line-height: 1.35;
  color: var(--cacao-70); text-align: right;
}

/* ---------- The promise ---------- */

.promise { padding: 28px var(--gutter) 0; }
.promise__lead { font-size: 1.125rem; font-weight: 500; line-height: 1.3; }
.promise__date {
  margin: 2px 0 0;
  font-family: var(--serif); font-weight: 600; line-height: 1; /* explicit: on /gracias/ this is a <p>, not a heading */
  font-size: clamp(4.25rem, 21vw, 6rem);
  letter-spacing: -0.02em;
  display: flex; align-items: baseline; gap: 0.12em; flex-wrap: wrap;
}
.promise__date em { font-style: italic; font-weight: 600; }
.promise__day { font-variant-numeric: lining-nums; }
.promise__line { margin-top: 2px; font-size: 1.125rem; font-weight: 500; line-height: 1.3; text-wrap: balance; }
.promise__cutoff {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--blush);
  font-size: 1rem; line-height: 1.5; color: var(--cacao-70);
  text-wrap: pretty;
}

/* ---------- Hero ---------- */

.hero { margin: 24px 0 0; }
.hero img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }

/* ---------- Sections ---------- */

.section-title {
  font-family: var(--serif); font-weight: 600; line-height: 1;
  font-size: 2.125rem;
  padding: 0;
  margin: 0 0 14px;
}
.products, .datos { padding: 36px var(--gutter) 0; }
.pago { border: 0; min-width: 0; margin: 36px 0 0; padding: 0 var(--gutter); }
.pago legend { padding: 0; float: left; width: 100%; } /* float: fieldset draws legend in its border otherwise */
.pago legend + * { clear: both; }

/* ---------- Products ---------- */

.product {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  grid-template-areas:
    "photo text text"
    "photo price stepper";
  align-items: center;
  column-gap: 16px; row-gap: 8px;
  padding: 16px 0;
  border-top: 1px solid var(--cream-2);
}
.product:first-of-type { border-top: 0; padding-top: 8px; }
.product__photo { grid-area: photo; width: 84px; height: 84px; border-radius: 14px; object-fit: cover; align-self: center; } /* centered on the two-line row, so the stepper never hangs below the photo */
.product__text { grid-area: text; }
.product__name { font-size: 1.5rem; letter-spacing: -0.01em; }
.product__detail { margin-top: 3px; font-size: 0.9375rem; line-height: 1.35; color: var(--cacao-70); }
.product__price { grid-area: price; font-weight: 500; font-size: 1.125rem; line-height: 1; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.stepper { grid-area: stepper; justify-self: end; }

.stepper { display: flex; align-items: center; gap: 2px; }
.stepper__btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--blush-20); color: var(--cacao);
  display: grid; place-items: center; cursor: pointer;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.stepper__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.stepper__btn:hover { background: var(--blush); color: var(--cream); }
.stepper__btn:active { transform: scale(0.92); }
.stepper__btn[disabled] { background: var(--blush-20); color: var(--cacao-40); cursor: default; } /* disc stays, only the glyph fades, so the pair holds */
.stepper__value {
  min-width: 1.6ch; text-align: center;
  font-family: var(--serif); font-weight: 600; font-size: 3rem; line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  transition: color var(--t-fast) var(--ease);
}
.stepper__value.is-zero { color: var(--cacao-70); }
/* Signature moment: the numeral cross-fades through a short rise when it changes. */
.stepper__value.is-bump { animation: numeral var(--t) var(--ease); }
@keyframes numeral {
  0% { opacity: 0; transform: translateY(0.18em); }
  100% { opacity: 1; transform: none; }
}
.products__error { margin-top: 10px; }

/* ---------- Fields ---------- */

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 20px; }
.field { position: relative; min-width: 0; }
.field__label { display: block; font-size: 0.9375rem; line-height: 1.35; font-weight: 500; color: var(--cacao-70); margin-bottom: 2px; }
.field__input {
  width: 100%; min-height: 44px; padding: 10px 0 8px; margin: 0;
  border: 0; border-bottom: 1.5px solid var(--cacao-70); border-radius: 0;
  background: transparent; color: var(--cacao);
  font: inherit; font-size: 1.0625rem; font-weight: 500;
  transition: border-color var(--t-fast) var(--ease);
}
.field__input::placeholder { color: var(--cacao-70); font-weight: 400; }
.field__input:focus { outline: none; border-bottom-color: var(--cacao); border-bottom-width: 2px; padding-bottom: 7.5px; }
.field.is-invalid .field__input { border-bottom-color: var(--blush); border-bottom-width: 2px; padding-bottom: 7.5px; }
.field.is-invalid .field__label { color: var(--cacao); }
/* Blush marks the field (underline, dot); the words stay Cacao so they pass 4.5:1. */
.field__error { margin-top: 6px; padding-left: 14px; position: relative; font-size: 0.875rem; line-height: 1.4; font-weight: 500; color: var(--cacao); }
.field__error::before { content: ""; position: absolute; left: 0; top: 0.45em; width: 7px; height: 7px; border-radius: 50%; background: var(--blush); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Payment ---------- */

.pago__note { margin: -4px 0 16px; font-size: 1rem; line-height: 1.5; color: var(--cacao-70); } /* the closing sentence is .nowrap in the HTML, so lines break between sentences */
.pago__note strong { color: var(--cacao); }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip { position: relative; display: block; cursor: pointer; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip span {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 14px;
  border: 1.5px solid var(--cacao); border-radius: 999px;
  font-weight: 500; font-size: 1rem; color: var(--cacao);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.chip:hover span { background: var(--blush-10); }
.chip input:checked + span { background: var(--cacao); color: var(--cream); border-color: var(--cacao); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--blush); }

/* ---------- Buttons ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 24px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 500; font-size: 1.0625rem; text-decoration: none; cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.button--primary {
  width: 100%;
  background: var(--cacao); color: var(--cream);
  font-family: var(--serif); font-weight: 600; font-size: 1.5rem; letter-spacing: 0.005em;
  box-shadow: 0 10px 24px -14px rgba(100, 52, 32, 0.55);
}
.button--primary:hover { background: #532A19; }
.button--primary:active { transform: translateY(1px); }
/* Not yet available: a muted fill, never an outline (an outlined pill reads as a payment chip). Still clickable: it validates and scrolls to the products. */
.button--primary.is-idle { background: var(--cacao-70); color: var(--cream); border-color: transparent; box-shadow: none; } /* 5.3:1, visibly "not yet" beside full Cacao */
.button--primary.is-idle:hover { background: var(--cacao); }
.button--primary.is-busy { color: transparent; position: relative; }
.button--primary.is-busy::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--cream); border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
.button--compact { width: auto; min-height: 48px; font-size: 1.25rem; padding: 0 22px; white-space: nowrap; flex: none; }
.button--ghost { background: transparent; color: var(--cacao); border-color: var(--cacao); width: 100%; font-family: var(--serif); font-weight: 600; font-size: 1.375rem; }
.button--ghost:hover { background: var(--blush-10); }
@keyframes spin { to { transform: rotate(360deg); } }

.submit { padding: 36px var(--gutter) 0; }
.submit__total { display: flex; justify-content: flex-start; gap: 8px; align-items: baseline; margin-bottom: 12px; font-weight: 500; }
.submit__total[hidden] { display: none; }
.submit__total span:first-child { color: var(--cacao-70); font-size: 1rem; }
.submit__total strong { font-weight: 500; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.has-sticky .order { padding-bottom: 84px; } /* room for the fixed bar over the last fields */
.submit__error { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--blush-10); font-size: 0.9375rem; font-weight: 500; color: var(--cacao); text-wrap: pretty; }

/* ---------- Footer ---------- */

.foot { padding: 28px var(--gutter) 40px; text-align: center; color: var(--cacao-70); font-size: 1rem; line-height: 1.5; }
.foot__bulk { text-wrap: balance; }
.foot__bulk a { color: var(--cacao); font-weight: 500; white-space: nowrap; }
.foot__contact { margin-top: 8px; font-size: 0.875rem; }

/* ---------- Sticky bar ---------- */

.sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: rgba(252, 244, 236, 0.92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--blush-20); /* visible edge, so content reads as passing under the bar */
  transform: translateY(100%); opacity: 0;
  transition: transform var(--t) var(--ease), opacity var(--t) var(--ease);
}
.sticky.is-on { transform: none; opacity: 1; }
.sticky__inner { width: min(100%, var(--col)); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sticky__total { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.sticky__label { font-size: 0.875rem; font-weight: 500; color: var(--cacao-70); }
.sticky__total strong { font-weight: 500; font-size: 1.25rem; line-height: 1; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }

/* ---------- Confirmation (/gracias/) ---------- */

.page--narrow { display: block; width: min(100%, var(--col)); padding: 0; }
.page--gracias .masthead { padding-top: 20px; }
.done { padding: 32px var(--gutter) 24px; animation: rise var(--t) var(--ease) both; }
.done[hidden] { display: none; }
.done__title { font-size: 2.25rem; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.done__sub { margin-top: 10px; font-size: 1.0625rem; color: var(--cacao-70); }
.done__intro .promise__lead { margin-top: 28px; } /* two groups: greeting, then the delivery promise */
.done__intro .promise__line strong { font-weight: 600; }
.done__title:focus, .done__title:focus-visible { outline: none; } /* focused for screen readers on arrival; a ring on a heading reads as a glitch */
.nowrap { white-space: nowrap; }
/* Photography framing, one rule for both pages: full-bleed below 560px, 18px radius inset from 560px up. */
/* On the phone the photo is 6:5: the whole flat-lay with linen above and below, receipt still inside the first screen; desktop keeps the square. */
.done__photo { width: calc(100% + 2 * var(--gutter)); max-width: none; margin: 22px calc(-1 * var(--gutter)) 0; aspect-ratio: 6 / 5; object-fit: cover; object-position: 50% 50%; } /* tall enough for the whole diagonal flat-lay; the first receipt row still shows in the first screen */
.done__list { list-style: none; margin: 22px 0 0; padding: 0; border-top: 1px solid var(--blush); }
.done__list li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--cream-2); font-size: 1.0625rem; }
.done__list li span:first-child { font-family: var(--serif); font-weight: 600; font-size: 1.375rem; font-variant-numeric: lining-nums tabular-nums; }
.done__list li span:last-child { font-weight: 500; font-variant-numeric: tabular-nums; }
.done__unit { display: block; margin-top: 2px; font-family: var(--sans); font-size: 0.9375rem; font-weight: 500; line-height: 1.35; color: var(--cacao-70); } /* same line as .product__detail on the order page */
.done__list li.done__sum { border-bottom: 0; padding-top: 14px; }
.done__list li.done__sum span:first-child { font-family: var(--sans); font-size: 1rem; font-weight: 500; color: var(--cacao-70); }
.done__list li.done__sum span:last-child { font-size: 1.25rem; }
.done__total { margin-top: 4px; font-size: 1.0625rem; }
.done__note { margin-top: 10px; color: var(--cacao-70); font-size: 1rem; line-height: 1.5; text-wrap: pretty; }
.done__note a { color: var(--cacao); font-weight: 500; white-space: nowrap; }
.done__actions { display: grid; gap: 12px; margin-top: 28px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- 404 ---------- */

.page--404 .masthead { padding-top: 20px; }
/* Full-height column at every width: content centers and the footer settles at the bottom, no cream hanging below it. */
.page--404 .page--narrow { min-height: 100svh; display: flex; flex-direction: column; }
.lost { flex: 1 0 auto; padding: 40px var(--gutter) 8px; }
.lost__title { font-size: clamp(2.5rem, 11vw, 3.5rem); letter-spacing: -0.01em; }
.lost__lead { margin-top: 14px; max-width: 36ch; font-size: 1.0625rem; line-height: 1.5; color: var(--cacao-70); text-wrap: pretty; }
.lost__cta { margin-top: 28px; }
.lost__photo { width: calc(100% + 2 * var(--gutter)); max-width: none; margin: 36px calc(-1 * var(--gutter)) 0; aspect-ratio: 3 / 2; object-fit: cover; }

/* ---------- From 560px the column floats in cream, so photos take the radius ---------- */

@media (min-width: 560px) {
  .hero img { border-radius: var(--radius); }
  .done__photo, .lost__photo { width: 100%; margin-inline: 0; border-radius: var(--radius); }
}

/* Hours read as one row as soon as "4 p. m." fits four across, so they never look like the payment grid below. */
@media (min-width: 381px) {
  .hora .chips { grid-template-columns: repeat(4, 1fr); }
  .hora .chip span { padding: 0 8px; }
}

/* ---------- Desktop ---------- */

@media (min-width: 960px) {
  :root { --gutter: 0px; }
  .page {
    width: min(100% - 96px, 1120px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 72px;
    align-items: stretch;
    padding: 36px 0 60px;
  }
  /* The intro column matches the form column's height; the hero takes whatever is left, so no cream goes unused. */
  .intro { display: flex; flex-direction: column; min-height: 0; }
  /* The photo adds no height of its own: the form column sets the page height and the hero fills what is left. */
  .hero { flex: 1 1 auto; min-height: 320px; display: flex; position: relative; }
  .hero picture { position: absolute; inset: 0; display: flex; width: 100%; }
  .hero img { height: 100%; width: 100%; aspect-ratio: auto; object-position: 50% 50%; } /* 2:3 source for this column; residual crop is linen */
  .masthead { padding: 0; align-items: center; }
  .brand { width: 210px; }
  .place { margin: 0; }
  .promise { padding: 40px 0 0; }
  .promise__date { font-size: clamp(5rem, 7.4vw, 6rem); }
  .hero { margin-top: 32px; }
  .order { padding-top: 0; } /* "Elige tus postres" starts level with the logo */
  .products { padding-top: 0; }
  .section-title { font-size: 2.25rem; }
  /* 960–1199px: the name keeps the full row (no "Arroz / con leche" break); the stepper moves up beside it from 1200px. */
  .product {
    grid-template-columns: 104px 1fr auto;
    grid-template-areas: "photo text text" "photo price stepper";
    column-gap: 20px; row-gap: 6px; padding: 18px 0;
  }
  .has-sticky .order { padding-bottom: 0; } /* the bar is hidden here, so the column must not grow and shrink */
  .product__photo { width: 104px; height: 104px; align-self: center; }
  .product__text { align-self: end; }
  .product__price { align-self: start; }
  .stepper__btn { width: 46px; height: 46px; }
  .stepper__value { font-size: 3.25rem; }
  .foot { text-align: left; padding-bottom: 0; }
  .sticky { display: none; }
  /* Confirmation: same two-column frame as the order page; photo left, the order right. */
  .page--narrow { display: block; width: min(100% - 96px, 1120px); padding: 36px 0 60px; }
  .page--gracias .masthead { padding: 0; }
  .page--gracias .done {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "photo intro" "photo order";
    gap: 0 72px;
    align-items: start;
    padding: 24px 0 0; /* "Hacer otro pedido" stays above the fold on 1024x768 */
  }
  .done__intro .promise__lead { margin-top: 20px; }
  .page--gracias .done__actions { margin-top: 20px; }
  /* Unit sits after the name on desktop: the receipt keeps one line per item and the button stays above the fold at 1024x768. */
  .done__unit { display: inline; margin: 0 0 0 10px; }
  .page--gracias .done__photo { align-self: start; } /* top edge level with "¡Listo, …!" */
  /* Square and uncropped: the flat-lay sources are square, and stretching them to the text column cut the products at 1024px. */
  .done__photo { grid-area: photo; margin: 0; width: 100%; aspect-ratio: 1; }
  .done__intro { grid-area: intro; }
  .done__order { grid-area: order; }
  .done__intro .promise__date { font-size: clamp(5rem, 7.4vw, 6rem); }
  /* Same frame as the order page: masthead spans the left column, footer starts at the right column. */
  /* No order column beside the logo here: the place line sits at the page's top right, level with the right column's edge. */
  .page--gracias .masthead, .page--404 .masthead { width: auto; align-items: flex-start; }
  .page--gracias .place, .page--404 .place { margin-top: 10px; }
  .page--gracias .foot { padding: 28px 0 0 calc(50% + 36px); text-align: left; }
  .page--404 .masthead { padding-top: 0; }
  .lost { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 72px; align-items: center; padding: 40px 0; }
  .lost__title { font-size: 4rem; }
  .lost__lead { max-width: 46ch; }
  .lost__cta { width: auto; min-width: 280px; padding: 0 40px; }
  /* Same frame as /gracias/: photo left under the masthead, text right above the footer. */
  .lost__photo { order: -1; margin: 0; width: 100%; aspect-ratio: 4 / 3; }
  .page--404 .foot { padding: 28px 0 0 calc(50% + 36px); text-align: left; }
}

/* Short laptop screens (1024x768, 1280x800, 1366x768): a little less air so "Hacer otro pedido" clears the fold with room. */
@media (min-width: 960px) and (max-height: 820px) {
  .page--gracias .page--narrow { padding-top: 28px; }
  .done__list li { padding: 9px 0; }
  .done__note { margin-top: 6px; }
}

/* Wide, tall screens: the confirmation scales up so it does not sit small and high. 1280x800 and 1024x768 keep the smaller sizes so "Hacer otro pedido" stays above the fold. */
@media (min-width: 1280px) and (min-height: 860px) {
  .page--gracias .done__intro .promise__date { font-size: 7rem; }
  .page--gracias .done__title { font-size: 2.75rem; }
}

@media (min-width: 1200px) {
  .product { grid-template-areas: "photo text stepper" "photo price stepper"; }
}

/* Payment chips go four across once the column can hold "Bancolombia", matching the hour row above. */
@media (min-width: 1280px) {
  .pago .chips { grid-template-columns: repeat(4, 1fr); }
  .pago .chip span { padding: 0 8px; }
}

@media (max-width: 380px) {
  .fields { grid-template-columns: 1fr; }
  .product { grid-template-columns: 72px 1fr auto; column-gap: 12px; }
  .product__photo { width: 72px; height: 72px; }
  .product__name { font-size: 1.375rem; }
  .sticky__inner { gap: 12px; }
  .button--compact { font-size: 1.125rem; padding: 0 18px; } /* "Enviar pedido" stays on one line beside the total at 320px */
}

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