.menu-page {
  --menu-gutter: max(clamp(1rem, 5vw, 5.5rem), calc((100% - 78rem) / 2));
  --menu-section-space: clamp(3rem, 6vw, 6rem);
  --line: #e5c3b9;
}

.menu-nav,
.menu-hero,
.sweets-section,
.cake-builder {
  padding-inline: var(--menu-gutter);
}

.menu-nav {
  display: flex;
  align-items: center;
  gap: clamp(.65rem, 3vw, 2rem);
  min-height: 4.25rem;
  padding-block: .5rem;
  background: var(--cream);
}
.menu-nav .brand-logo { margin-right: auto; }
.menu-nav img { width: clamp(5.25rem, 14vw, 7.5rem); height: auto; }
.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.cart-button,
.add-sweets,
.next-step,
.cart-footer button,
.sweet-limit-modal button {
  min-height: 46px;
  border: 0;
  border-radius: 2rem;
  padding: .75rem 1.25rem;
  background: var(--red);
  color: var(--cream);
  font: 700 .9rem/1.35 var(--sans);
  cursor: pointer;
}

.cart-button { display: inline-flex; align-items: center; gap: .5rem; }
.cart-button span {
  min-width: 1.3rem;
  border-radius: 2rem;
  padding-inline: .2rem;
  background: var(--cream);
  color: var(--red);
  line-height: 1.3rem;
  text-align: center;
}
.cart-fab {
  position: fixed;
  z-index: 20;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  width: 3.5rem;
  min-height: 3.5rem;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 .7rem 1.6rem #6d151940;
}
.cart-fab svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}
.cart-fab span {
  position: absolute;
  top: -.3rem;
  right: -.3rem;
  min-width: 1.45rem;
  line-height: 1.45rem;
  border: 2px solid var(--cream);
}
.menu-page button:disabled { opacity: .55; cursor: default; }

.menu-hero,
.sweets-section,
.cake-builder {
  padding-block: var(--menu-section-space);
}
.menu-hero {
  display: grid;
  gap: 1.75rem;
  align-items: center;
  background: var(--pink);
}
.menu-hero h1,
.sweets-heading h2,
.builder-heading h2 {
  margin: 0;
  font: 600 clamp(2.65rem, 7vw, 6rem)/.98 var(--serif);
  letter-spacing: -.055em;
  overflow-wrap: break-word;
}
.menu-hero em,
.sweets-heading em { color: var(--red); font-style: normal; }
.menu-hero > div > p:not(.eyebrow),
.sweets-heading > p,
.builder-heading > p:not(.eyebrow) {
  max-width: 48ch;
  line-height: 1.6;
}
.menu-shortcuts { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; }
.menu-shortcuts a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-weight: 700;
  text-underline-offset: .25em;
}
.menu-hero-note {
  max-width: 26ch;
  margin: 0;
  border-left: 2px solid var(--red);
  padding-left: 1rem;
  color: var(--ink);
  font: 1.15rem/1.45 var(--serif);
}

.sweets-heading { display: grid; gap: 1rem; align-items: end; }
.sweets-heading > p { margin: 0; }
.sweet-rule {
  display: inline-block;
  margin: 1.5rem 0;
  border-radius: 2rem;
  padding: .55rem .9rem;
  background: var(--pink);
  color: var(--ink);
  font-size: .85rem;
  font-weight: 700;
}
.sweet-list { display: grid; gap: 2rem; align-items: start; }
.sweet-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem 1rem;
  margin-bottom: .65rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: .65rem;
}
.sweet-group-head h3 { margin: 0; font: 1.65rem var(--serif); }
.sweet-group-head b { font-size: .88rem; }
.sweet-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .45rem;
  border: 1px solid var(--line);
  padding: .45rem clamp(.45rem, 2vw, 1rem);
  background: #fffaf2;
}
.sweet-card + .sweet-card { margin-top: .4rem; }
.sweet-card.selected { border-color: var(--red); background: #fde3dc; }
.sweet-card strong { font: 1.13rem/1.2 var(--serif); overflow-wrap: break-word; }
.sweet-quantity { display: inline-flex; align-items: center; }
.sweet-quantity button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--red);
  font: 600 1.35rem/1 var(--sans);
  cursor: pointer;
}
.sweet-quantity button:enabled:hover { background: var(--pink); }
.sweet-quantity b { min-width: 1.4rem; color: var(--ink); text-align: center; }
.add-sweets { margin-top: 1.5rem; }

.cake-builder {
  display: grid;
  grid-template-areas: "heading" "preview" "controls";
  gap: 1.25rem;
  background: linear-gradient(#b70f18ed, #b70f18ed), url("assets/pattern-cobertura.png") center/cover;
  color: var(--cream);
}
.builder-heading { grid-area: heading; }
.builder-heading h2 em { color: var(--pink); font-style: normal; }
.builder-heading > p:last-child { margin-bottom: 0; }
.builder-controls { grid-area: controls; min-width: 0; }
.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  list-style: none;
  margin: 0 0 .85rem;
  border-bottom: 1px solid #ffffff65;
  padding: 0;
}
.step {
  border-bottom: 3px solid transparent;
  padding: .2rem .1rem .65rem;
  color: #ffd4cb;
  font-size: clamp(.7rem, 2.8vw, .9rem);
  font-weight: 600;
  text-align: center;
}
.step span { display: block; margin-bottom: .2rem; font-size: .75em; }
.step[aria-current] { border-color: var(--pink); color: #fff; }
.option-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.2rem), 1fr));
  gap: .55rem;
}
.decoration-rule { grid-column: 1 / -1; margin: 0 0 .25rem; font-size: .9rem; }
.choice {
  min-width: 0;
  min-height: 62px;
  border: 1px solid #ffffff72;
  padding: .8rem;
  background: transparent;
  color: #fff;
  font: 650 .93rem/1.3 var(--sans);
  text-align: left;
  cursor: pointer;
}
.choice small { display: block; margin-top: .2rem; color: #ffe1da; font-size: .8rem; font-weight: 400; }
.choice-special { border-color: #ffd7aa; }
.choice[aria-pressed="true"] { background: var(--cream); color: var(--red); }
.choice[aria-pressed="true"] small { color: var(--ink); }
.step-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.next-step { background: var(--cream); color: var(--red); }
.prev-step {
  min-height: 44px;
  border: 0;
  padding: .5rem;
  background: none;
  color: var(--cream);
  font: 700 .9rem var(--sans);
  text-decoration: underline;
  text-underline-offset: .2em;
  cursor: pointer;
}

.cake-stage {
  grid-area: preview;
  display: grid;
  grid-template-rows: auto minmax(6.7rem, 1fr) auto;
  justify-items: center;
  align-items: center;
  min-width: 0;
  min-height: 12.5rem;
  border: 1px solid #ffffff45;
  padding: .8rem;
  background: radial-gradient(ellipse at center, #ca2028 30%, #a81018);
}
.stage-caption {
  justify-self: start;
  margin: 0;
  color: #ffddd4;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.cake-wrap {
  position: relative;
  width: var(--cake-width, 54%);
  aspect-ratio: 1.85;
  filter: drop-shadow(0 .45rem .4rem #610e1655);
  transition: width .3s;
}
.cake-wrap.empty::after {
  position: absolute;
  inset: 52% 0 auto;
  height: 20%;
  border: 1px dashed #efb9b2;
  border-radius: 50%;
  content: "";
}
.cake-wrap.empty > * { visibility: hidden; }
.cake-plate {
  position: absolute;
  inset: auto -8% 2%;
  height: 17%;
  border-radius: 50%;
  background: #fff8eb;
  box-shadow: 0 3px #e3aa9b;
}
.cake-top {
  position: absolute;
  inset: 17% 0 8%;
  border: .35rem solid var(--icing, #fff4df);
  border-radius: 18% 18% 12% 12% / 22% 22% 15% 15%;
  background: linear-gradient(110deg, #ffffff33, transparent 50%, #00000015), var(--cake, #fff4df);
  box-shadow: inset -.6rem -.2rem .65rem #00000015;
}
.has-filling .cake-top::before,
.has-filling .cake-top::after {
  position: absolute;
  right: 0;
  left: 0;
  height: 13%;
  border-radius: 15% / 45%;
  background: linear-gradient(0deg, #00000016, transparent 57%, #ffffff60), var(--filling);
  content: "";
}
.has-filling .cake-top::before { top: 28%; }
.has-filling .cake-top::after { top: 63%; }
.has-two-fillings .cake-top::after {
  background: linear-gradient(0deg, #00000016, transparent 57%, #ffffff60), var(--filling-two);
}
.cake-top > span { position: absolute; display: none; }
.decor-chantilly .cake-top { border-top: .5rem dotted #fff8ed; }
.decor-topper .cake-topper { display: block; bottom: 93%; left: 39%; color: #ffcb64; font-size: 1.8rem; }
.decor-flower .cake-flower { display: block; bottom: 74%; left: 17%; color: #ed7994; font-size: 2rem; }
.decor-fruit .cake-fruit {
  display: block;
  bottom: 90%;
  right: 16%;
  width: .85rem;
  height: .85rem;
  border-radius: 50% 50% 65% 45%;
  background: #eb3848;
  box-shadow: -.65rem .18rem #c21e35;
}
.cake-summary {
  max-width: 100%;
  margin: .3rem 0 0;
  color: #ffe1da;
  font-size: .82rem;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}
.cake-summary strong { display: block; color: var(--cream); font-size: 1rem; }

html:has(.menu-page dialog[open]) { overflow: hidden; }
.menu-page dialog { border: 0; background: var(--cream); color: var(--ink); }
.menu-page dialog::backdrop { background: #42111599; }
.cart-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(100%, 29rem);
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100%;
  margin: 0 0 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}
.cart-drawer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.cart-head,
.cart-footer > div { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.cart-head { border-bottom: 1px solid var(--line); padding-block: max(1rem, env(safe-area-inset-top)) 1rem; }
.cart-head .eyebrow { margin-bottom: .45rem; }
.cart-head h2,
.sweet-limit-modal h2 { margin: 0; font: 2.15rem/1.1 var(--serif); }
.cart-head button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--red);
  font-size: 1.5rem;
  cursor: pointer;
}
.cart-items { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.cart-row { border-bottom: 1px solid var(--line); padding: 1rem 0 .5rem; }
.cart-row h3 { margin: 0; font: 1.3rem/1.3 var(--serif); }
.cart-row p,
.cart-empty { margin: .5rem 0; line-height: 1.5; }
.cart-row p { font-size: .92rem; }
.cart-row button {
  min-height: 44px;
  border: 0;
  padding: 0 .35rem;
  background: none;
  color: var(--red);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.cart-footer { border-top: 1px solid var(--line); padding-block: 1rem max(1rem, env(safe-area-inset-bottom)); }
.cart-footer > div { margin-bottom: .75rem; }
.cart-footer strong { font: 1.35rem var(--serif); }
.cart-footer button { width: 100%; }
.cart-footer .continue-shopping {
  margin-bottom: .65rem;
  border: 1px solid var(--red);
  background: transparent;
  color: var(--red);
}
.sweet-limit-modal { width: min(27rem, calc(100% - 2rem)); max-height: 90%; padding: clamp(1.25rem, 4vw, 2rem); }
.sweet-limit-modal p { line-height: 1.55; }

@media (min-width: 48rem) {
  .menu-hero,
  .sweets-heading { grid-template-columns: minmax(0, 1.4fr) minmax(0, .75fr); gap: clamp(2rem, 5vw, 5rem); }
  .sweet-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 56rem) {
  .cake-builder {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-areas: "heading preview" "controls preview";
    align-content: start;
    column-gap: clamp(2rem, 6vw, 6rem);
    row-gap: 1.5rem;
  }
  .cake-stage {
    position: sticky;
    top: 1rem;
    align-self: start;
    min-height: clamp(18rem, 55vh, 31rem);
    padding: 1.5rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cake-wrap { transition: none; }
}
