/* ── WHATSAPP ORDERING + MOTION LAYER ─────────────────────────
   Shared by every page. Behaviour lives in whatsapp-order.js.  */

:root {
  --wa:       #25D366;
  --wa-dark:  #128C7E;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* ── Press feedback on every tappable thing ── */
.btn, .nav-cta, .whatsapp-order, .wa-btn, .float-icon-btn, .tab-btn,
.wo-add, .wo-tray, .wo-send, .wo-qty button, .wo-seg button {
  -webkit-tap-highlight-color: transparent;
}
.btn:active, .nav-cta:active, .whatsapp-order:active, .tab-btn:active,
.wo-send:active, .wo-seg button:active { transform: scale(.97) !important; transition-duration: .08s; }
.wa-btn:active, .float-icon-btn:active { transform: scale(.92) !important; }

/* ── WhatsApp CTA buttons ── */
.btn-wa {
  background: var(--wa);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(37,211,102,.45);
}
.btn-wa svg { flex-shrink: 0; }
/* light sweep across the button every few seconds */
.btn-wa::after, .whatsapp-order::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.45) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: woShine 4.5s var(--ease-out) 1.5s infinite;
  pointer-events: none;
}
.whatsapp-order { position: relative; overflow: hidden; }
@keyframes woShine {
  0%   { transform: translateX(-120%); }
  25%, 100% { transform: translateX(120%); }
}

/* ── Live open / closed status pill ── */
.wo-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wo-status .wo-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #ff5a4f;
  flex-shrink: 0;
}
.wo-status.is-open .wo-dot {
  background: var(--wa);
  box-shadow: 0 0 0 0 rgba(37,211,102,.7);
  animation: woLive 1.8s ease-out infinite;
}
@keyframes woLive {
  0%   { box-shadow: 0 0 0 0 rgba(37,211,102,.7); }
  70%  { box-shadow: 0 0 0 9px rgba(37,211,102,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}

/* ── Floating WhatsApp button: real WhatsApp glyph ── */
.wa-float .wa-btn { background: var(--wa); }
.wa-float .wa-btn svg { transition: transform .35s var(--ease-spring); }
.wa-float .wa-btn:hover svg { transform: rotate(-12deg) scale(1.08); }

/* nudge chat bubble beside the floating button */
.wo-nudge {
  position: fixed;
  right: 28px;
  bottom: 100px;
  z-index: 998;
  max-width: 270px;
  background: #fff;
  color: #1a1a1a;
  border-radius: 16px 16px 4px 16px;
  padding: 12px 34px 12px 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.22);
  font-size: .9rem;
  line-height: 1.45;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px) scale(.95);
  transform-origin: bottom right;
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
  pointer-events: none;
}
.wo-nudge.show { opacity: 1; transform: none; pointer-events: auto; }
.wo-nudge strong { display: block; color: var(--wa-dark); margin-bottom: 2px; }
.wo-nudge .wo-x {
  position: absolute; top: 6px; right: 8px;
  background: none; border: 0; font-size: 1.1rem; line-height: 1;
  color: #999; cursor: pointer; padding: 4px;
}

/* ── Add-to-order button on menu items ── */
.menu-item { position: relative; transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out); }
@media (hover: hover) {
  .menu-item:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.12); }
}
.menu-item.wo-has-add { padding-bottom: 3.1rem; }
.wo-add {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--wa);
  color: #fff;
  font: 700 .82rem/1 inherit;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(37,211,102,.35);
  transition: transform .15s var(--ease-out), background .2s;
}
.wo-add:hover { background: #1ebe5d; }
.wo-add:active { transform: scale(.92); }
.wo-add .wo-plus { font-size: 1.15rem; transition: transform .3s var(--ease-spring); }
.wo-add.added .wo-plus { transform: rotate(360deg); }
.wo-add .wo-count {
  display: none;
  min-width: 20px; height: 20px;
  border-radius: 999px;
  background: #fff;
  color: var(--wa-dark);
  font-size: .75rem;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}
.wo-add.in-basket .wo-count { display: inline-flex; }

/* ── Cakes gallery order buttons ── */
.wo-cake-btn {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--wa);
  color: #fff;
  font-family: inherit;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
  transition: transform .2s var(--ease-out), background .2s;
  -webkit-tap-highlight-color: transparent;
}
.wo-cake-btn:hover { background: #1ebe5d; }
@media (hover: hover) {
  .cake-card:hover .wo-cake-btn { transform: translateY(-2px); }
}
.wo-cake-btn:active { transform: scale(.94) !important; }
/* move "View" to the right so it doesn't sit under the order button */
.cake-card-overlay { justify-content: flex-end; padding-right: 14px; }
.wo-lb-order {
  left: 50%;
  bottom: 52px;
  transform: translateX(-50%);
  padding: 13px 22px;
  font-size: .98rem;
  box-shadow: 0 8px 28px rgba(37,211,102,.45);
}
.wo-lb-order:active { transform: translateX(-50%) scale(.96) !important; }

/* flying dot from item to the tray */
.wo-fly {
  position: fixed;
  z-index: 1002;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--wa);
  box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(0,0,0,.3);
  pointer-events: none;
}

/* ── Order tray (bottom bar) ── */
.wo-tray {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 18px;
  border: 0;
  border-radius: 999px;
  background: #1c3a2c;
  color: #fff;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 36px rgba(0,0,0,.35);
  transform: translate(-50%, 140%);
  transition: transform .45s var(--ease-spring);
}
.wo-tray.show { transform: translate(-50%, 0); }
.wo-tray.bump .wo-badge { animation: woBump .4s var(--ease-spring); }
@keyframes woBump {
  0% { transform: scale(1); } 40% { transform: scale(1.45); } 100% { transform: scale(1); }
}
.wo-badge {
  min-width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--wa);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
}
.wo-tray-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--wa);
  border-radius: 999px;
  padding: 8px 14px;
  white-space: nowrap;
}
body.wo-sheet-open .wa-float { opacity: 0; pointer-events: none; }
body.wo-tray-visible .wa-float { bottom: 92px; transition: bottom .3s var(--ease-out); }

/* ── Order sheet ── */
.wo-backdrop {
  position: fixed; inset: 0; z-index: 1001;
  background: rgba(0,0,0,.45);
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.wo-backdrop.open { opacity: 1; visibility: visible; }
.wo-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 1002;
  width: min(480px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #1a1a1a;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  transform: translate(-50%, 105%);
  transition: transform .4s var(--ease-out);
}
.wo-sheet.open { transform: translate(-50%, 0); }
.wo-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 10px;
}
.wo-sheet-head h2 { font-family: 'Playfair Display', serif; font-size: 1.35rem; color: #1c3a2c; }
.wo-close { background: #f1f1f1; border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; }
.wo-sheet-body { overflow-y: auto; padding: 0 20px 12px; }
.wo-line {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  animation: woLineIn .3s var(--ease-out) both;
}
@keyframes woLineIn { from { opacity: 0; transform: translateY(6px); } }
.wo-line-name { flex: 1; font-size: .92rem; font-weight: 600; }
.wo-line-price { font-weight: 700; color: #1c3a2c; min-width: 58px; text-align: right; font-size: .92rem; }
.wo-qty { display: inline-flex; align-items: center; gap: 2px; background: #f3f3f3; border-radius: 999px; }
.wo-qty button { width: 30px; height: 30px; border: 0; background: none; font-size: 1rem; font-weight: 700; cursor: pointer; border-radius: 50%; }
.wo-qty span { min-width: 18px; text-align: center; font-weight: 700; font-size: .9rem; }
.wo-label { display: block; font-size: .78rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #777; margin: 16px 0 8px; }
.wo-seg { display: flex; background: #f1f1f1; border-radius: 12px; padding: 4px; position: relative; }
.wo-seg button {
  flex: 1; border: 0; background: none; padding: 10px; border-radius: 9px;
  font-family: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; color: #555;
  position: relative; z-index: 1; transition: color .2s;
}
.wo-seg button[aria-pressed="true"] { color: #1c3a2c; }
.wo-seg-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  background: #fff; border-radius: 9px; box-shadow: 0 2px 8px rgba(0,0,0,.12);
  transition: transform .3s var(--ease-out);
}
.wo-seg.delivery .wo-seg-pill { transform: translateX(100%); }
.wo-sheet textarea {
  width: 100%; min-height: 64px; resize: vertical;
  border: 1px solid #ddd; border-radius: 10px; padding: 10px;
  font-family: inherit; font-size: .9rem;
}
.wo-min {
  margin-top: 12px; font-size: .85rem; color: #555;
}
.wo-min-bar { height: 6px; background: #eee; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.wo-min-bar i { display: block; height: 100%; background: var(--wa); border-radius: 999px; transition: width .5s var(--ease-out); }
.wo-sheet-foot { padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid #eee; }
.wo-total { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 12px; font-size: 1.05rem; }
.wo-send {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 14px; padding: 15px; background: var(--wa); color: #fff;
  font-family: inherit; font-size: 1.05rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 20px rgba(37,211,102,.4);
  transition: transform .15s var(--ease-out), background .2s;
}
.wo-send:hover { background: #1ebe5d; }
.wo-note-small { text-align: center; font-size: .78rem; color: #888; margin-top: 8px; }
.wo-empty { text-align: center; color: #777; padding: 24px 0; }

/* ── Scroll reveal ── */
.wo-reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); transition-delay: var(--wo-delay, 0s); }
.wo-reveal.in { opacity: 1; transform: none; }

@media (max-width: 680px) {
  .wo-nudge { right: 16px; bottom: 96px; }
  .wo-tray { bottom: 14px; width: calc(100% - 28px); justify-content: space-between; }
  body.wo-tray-visible .wa-float { bottom: 84px; }
}

/* ── Respect reduced-motion: keep feedback, drop movement ── */
@media (prefers-reduced-motion: reduce) {
  .btn-wa::after, .whatsapp-order::after { animation: none; }
  .wo-status.is-open .wo-dot { animation: none; }
  .wo-reveal { opacity: 1; transform: none; transition: none; }
  .wo-tray, .wo-sheet, .wo-nudge { transition-duration: .01s; }
  .wo-line { animation: none; }
}

/* keep the order tray out of the way while the cakes lightbox is open */
.lightbox.open ~ .wo-tray { transform: translate(-50%, 140%); }
