/* Customer ordering page (mobile first). */

.app {
  max-width: 980px; margin: 0 auto;
  padding: calc(14px + var(--safe-t)) 18px calc(120px + var(--safe-b));
}

/* ---------- splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: linear-gradient(180deg, #fbf6ee 0%, #f3e7d3 55%, #e6d2b2 100%);
  transition: opacity 0.6s var(--ease), visibility 0s linear 0.6s;
}
.splash.gone { opacity: 0; visibility: hidden; }
.splash-inner { text-align: center; animation: rise 0.9s var(--ease) both; }
.splash-name { font-size: clamp(24px, 7vw, 34px); }
.splash-mark { width: 54px; height: 54px; margin: 14px auto 10px; animation: beanIn 1s 0.3s var(--spring) both; }
@keyframes beanIn { from { opacity: 0; transform: scale(0.4) rotate(-30deg); } to { opacity: 1; transform: none; } }
/* Small KG logo at the bottom of the opening screen */
.splash-logo {
  position: absolute; left: 50%; bottom: calc(36px + var(--safe-b)); width: 64px;
  transform: translateX(-50%); animation: fadeUp 0.8s 0.5s var(--ease) both;
}
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.splash-sub { font-family: var(--font-display); color: var(--muted); letter-spacing: 0.4em; text-transform: uppercase; font-size: 13px; }

/* ---------- header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; animation: rise 0.6s var(--ease) both; }
.brand-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-row .brand-mark { width: 30px; height: 30px; flex: 0 0 30px; }
.brand-row .brand-name { font-size: 14px; letter-spacing: 0.1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions .loc-pill { max-width: 170px; }
@media (max-width: 480px) {
  .brand-row .brand-name { font-size: 12px; letter-spacing: 0.07em; }
  .brand-row { gap: 8px; }
  .brand-row .brand-mark { width: 26px; height: 26px; flex-basis: 26px; }
  .top-actions .loc-pill { max-width: 104px; padding: 9px 11px; }
}
@media (max-width: 350px) { .brand-row .brand-name { display: none; } }
.loc-pill {
  display: flex; align-items: center; gap: 6px; flex: 0 1 auto; max-width: 48%;
  padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--coffee);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--spring);
}
.loc-pill svg { flex: 0 0 auto; }
.loc-pill:active { transform: scale(0.95); }
.loc-pill #locName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-pill.needed { border-color: var(--warn); color: var(--warn); animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(201, 131, 39, 0.4); } 50% { box-shadow: 0 0 0 6px rgba(201, 131, 39, 0); } }

.greet { margin: 0 2px 18px; animation: rise 0.6s 0.05s var(--ease) both; }
.hello { font-size: 14px; font-weight: 500; color: var(--muted); }
.greet h1 { margin: 6px 0 0; font-size: clamp(30px, 8.6vw, 42px); line-height: 1.08; color: var(--coffee); font-weight: 300; }

/* ---------- my orders button (header) ---------- */
.top-actions { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; justify-content: flex-end; }
.orders-btn {
  position: relative; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; color: var(--coffee);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--spring);
}
.orders-btn:active { transform: scale(0.92); }
.orders-btn.appear { animation: pop 0.6s var(--spring); }
.orders-btn.active { background: var(--coffee); color: var(--cream); border-color: var(--coffee); }
.orders-btn.active::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--coffee);
  opacity: 0; animation: ring 2s ease-out infinite;
}
@keyframes ring { 0% { opacity: 0.5; transform: scale(0.9); } 100% { opacity: 0; transform: scale(1.35); } }
.orders-badge {
  position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--warn); color: #fff; border: 2px solid var(--bg);
}
.orders-badge:empty { display: none; }

/* ---------- my orders list (inside its sheet) ---------- */
.live-orders { display: flex; flex-direction: column; gap: 10px; }
.live {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 16px; border-radius: 18px; background: var(--coffee); color: var(--cream);
  box-shadow: 0 10px 24px rgba(74, 52, 38, 0.25); animation: rise 0.5s var(--ease) both;
}
.live .dot { width: 10px; height: 10px; border-radius: 50%; background: #f2c27b; flex: 0 0 auto; animation: ping 1.6s infinite; }
.live.preparing .dot { background: #9fd3ff; }
.live.delivered .dot { background: #8fe0a8; animation: none; }
.live.cancelled .dot { background: #ff9c8a; animation: none; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(242, 194, 123, 0.6); } 70%, 100% { box-shadow: 0 0 0 9px rgba(242, 194, 123, 0); } }
.live .txt { flex: 1; min-width: 0; }
.live b { display: block; font-size: 14px; font-weight: 600; }
.live small { opacity: 0.75; font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live .go { opacity: 0.7; font-size: 20px; }

/* ---------- categories ---------- */
.cats-wrap {
  position: sticky; top: 0; z-index: 20; margin: 0 -18px 18px; padding: calc(8px + var(--safe-t)) 18px 8px;
  background: linear-gradient(180deg, var(--bg) 70%, rgba(246, 239, 228, 0));
}
.cats {
  position: relative; display: flex; gap: 6px; padding: 5px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth;
  animation: rise 0.6s 0.1s var(--ease) both;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  position: relative; z-index: 1; flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap;
  transition: color 0.35s var(--ease);
}
.cat .emo { font-size: 18px; transition: transform 0.45s var(--spring); }
.cat.on { color: var(--cream); }
.cat.on .emo { transform: scale(1.15) rotate(-8deg); }
.cat-ind {
  position: absolute; z-index: 0; left: 0; top: 5px; height: 42px; width: 0; border-radius: 999px;
  background: var(--coffee); box-shadow: 0 6px 16px rgba(74, 52, 38, 0.3);
  transition: transform 0.5s var(--spring), width 0.5s var(--spring);
}

/* ---------- item grid ---------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 14px; }
.section-title h2 { margin: 0; font-size: 24px; color: var(--coffee); }
.section-title span { color: var(--muted); font-size: 13px; font-weight: 500; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; --dx: 0px; }
@media (max-width: 330px) { .grid { grid-template-columns: 1fr; } }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; } }

.card {
  position: relative; display: flex; flex-direction: column; gap: 10px; text-align: left;
  padding: 8px 8px 14px; border-radius: 22px; background: var(--surface);
  box-shadow: var(--shadow-sm); border: 1px solid rgba(74, 52, 38, 0.05);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
  animation: cardIn 0.6s var(--spring) backwards; /* not "both": a held end frame would block :active/:hover transforms */
  animation-delay: calc(var(--i, 0) * 50ms);
}
@keyframes cardIn {
  from { opacity: 0; transform: translate(var(--dx), 26px) scale(0.92); }
  to { opacity: 1; transform: none; }
}
.card:active { transform: scale(0.96); }
@media (hover: hover) { .card:hover { transform: translateY(-4px); box-shadow: var(--shadow); } }
.grid.leaving .card { animation: cardOut 0.16s var(--ease) forwards; }
@keyframes cardOut { to { opacity: 0; transform: translate(calc(var(--dx) * -1), 0) scale(0.96); } }

.ph {
  position: relative; aspect-ratio: 1 / 1; border-radius: 16px; overflow: hidden;
  display: grid; place-items: center; font-size: clamp(40px, 12vw, 56px);
  background: linear-gradient(160deg, #f6ead8, #e7d3b5);
}
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
@media (hover: hover) { .card:hover .ph img { transform: scale(1.06); } }
.in-cart {
  position: absolute; left: 8px; top: 8px; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 99px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--cream);
  background: var(--coffee); animation: pop 0.45s var(--spring);
}
.in-cart:empty { display: none; }
.card-row { display: flex; align-items: flex-end; gap: 8px; padding: 0 4px; }
.card-txt { flex: 1; min-width: 0; }
.card .nm { font-family: var(--font-display); font-size: 17px; line-height: 1.15; color: var(--coffee); }
.card .ds {
  margin-top: 3px; font-size: 12px; color: var(--muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.plus {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 20px; line-height: 1; color: var(--cream); background: var(--coffee);
  box-shadow: 0 4px 12px rgba(74, 52, 38, 0.3);
}
.card.off { opacity: 0.6; }
.card.off .ph::after {
  content: 'Out of stock'; position: absolute; inset: auto 8px 8px 8px; padding: 6px; border-radius: 10px;
  text-align: center; font-size: 12px; font-weight: 700; color: var(--cream); background: rgba(58, 40, 28, 0.8);
}
.card.off .plus { visibility: hidden; }

.skel { height: 230px; border-radius: 22px; background: linear-gradient(100deg, #efe4d3 30%, #f8f1e6 50%, #efe4d3 70%); background-size: 300% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.empty { grid-column: 1 / -1; text-align: center; padding: 50px 20px; color: var(--muted); border-radius: 22px; background: var(--surface); }
.empty .big { font-size: 46px; margin-bottom: 10px; }

/* ---------- faded KG signature under the menu ---------- */
.menu-foot { display: flex; justify-content: center; padding: 40px 0 8px; }
.menu-foot img { width: 46px; height: auto; opacity: 0.3; }

/* ---------- cart bar ---------- */
.cart-bar {
  position: fixed; z-index: 30; left: 18px; right: 18px; bottom: calc(14px + var(--safe-b));
  max-width: 520px; margin: 0 auto; height: 62px; padding: 0 10px; border-radius: 999px;
  display: flex; align-items: center; gap: 12px; color: var(--cream); font-weight: 600; font-size: 15px;
  background: var(--coffee); box-shadow: 0 16px 36px rgba(74, 52, 38, 0.4);
  transform: translateY(calc(100% + 40px)); transition: transform 0.55s var(--spring);
}
.cart-bar.show { transform: none; }
.cart-bar.bump { animation: bump 0.45s var(--spring); }
@keyframes bump { 40% { transform: scale(1.05); } }
.cart-count {
  min-width: 44px; height: 44px; padding: 0 10px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cream); color: var(--coffee); font-size: 16px; font-weight: 700;
}
.cart-label { flex: 1; text-align: left; }
.cart-go { padding-right: 10px; font-size: 14px; opacity: 0.85; }

/* ---------- item details (photo on top, coffee panel below) ---------- */
.item-sheet { background: var(--coffee); height: 94vh; height: 94dvh; max-height: none; }
.item-sheet .sheet-body { padding: 0; display: flex; flex-direction: column; }
@media (min-width: 760px) { .item-sheet { height: min(820px, 90vh); } }
.hero {
  position: relative; flex: 1 0 300px; min-height: 300px; overflow: hidden;
  display: grid; place-items: center; font-size: 110px;
  background: linear-gradient(160deg, #f6ead8, #dcc3a0);
}
/* Gentle "camera pan": the photo eases in, then drifts slowly side to side while the item is open. */
.hero img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  will-change: transform;
  animation: heroIn 1.1s var(--ease) both, heroDrift 16s 1.1s ease-in-out infinite alternate;
}
@keyframes heroIn { from { opacity: 0; transform: scale(1.22) translateX(4%); } to { opacity: 1; transform: scale(1.12) translateX(3%); } }
@keyframes heroDrift {
  0%   { transform: scale(1.12) translateX(3%) translateY(0); }
  50%  { transform: scale(1.16) translateX(-1%) translateY(-1.5%); }
  100% { transform: scale(1.12) translateX(-3%) translateY(0); }
}
.hero-top { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; padding: calc(14px + var(--safe-t)) 16px; }
.hero-top .icon-btn { background: rgba(255, 255, 255, 0.85); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 0; }
.hero-grab { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 44px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.7); }

.item-panel {
  position: relative; margin-top: -30px; padding: 26px 22px calc(22px + var(--safe-b));
  border-radius: 30px 30px 0 0; background: var(--coffee); color: var(--cream);
  box-shadow: 0 -12px 30px rgba(46, 34, 25, 0.25);
}
.item-panel .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.item-name { margin: 0; font-size: clamp(28px, 8vw, 36px); font-weight: 300; line-height: 1.05; color: #fff; }
.item-desc { margin: 10px 0 0; color: rgba(243, 230, 209, 0.78); font-size: 14px; line-height: 1.55; }
.item-panel .opt-group { margin-top: 18px; }
.item-panel .label { display: block; margin-bottom: 9px; color: rgba(243, 230, 209, 0.7); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.item-panel .choice { background: transparent; border-color: rgba(243, 230, 209, 0.45); color: var(--cream); }
.item-panel .choice.on { background: var(--cream); border-color: var(--cream); color: var(--coffee); }
.note-in {
  width: 100%; height: 46px; margin-top: 18px; padding: 0 16px; border-radius: 999px; outline: none; font-size: 16px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(243, 230, 209, 0.3); color: var(--cream);
}
.note-in::placeholder { color: rgba(243, 230, 209, 0.5); }
.note-in:focus { border-color: var(--cream); }
.buy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.item-panel .stepper { background: transparent; border-color: rgba(243, 230, 209, 0.5); }
.item-panel .stepper button { color: var(--cream); }
.item-panel .stepper button:active { background: rgba(255, 255, 255, 0.12); }
.item-panel .stepper output { color: #fff; }
.add-btn { flex: 1; max-width: 240px; height: 52px; }
.add-btn .tick {
  width: 24px; height: 24px; border-radius: 50%; display: none; place-items: center; background: var(--coffee); color: var(--cream);
}
.add-btn.added { background: transparent; color: var(--cream); box-shadow: none; border: 1px solid rgba(243, 230, 209, 0.5); }
.add-btn.added .tick { display: grid; background: var(--cream); color: var(--coffee); animation: pop 0.5s var(--spring); }

/* ---------- cart sheet ---------- */
.line {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 18px; margin-bottom: 10px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  animation: rise 0.4s var(--ease) both;
}
.line.removing { animation: lineOut 0.3s var(--ease) forwards; }
@keyframes lineOut { to { opacity: 0; transform: translateX(40px); height: 0; margin: 0; padding: 0; } }
.line .th { position: relative; width: 56px; height: 56px; flex: 0 0 56px; border-radius: 14px; overflow: hidden; display: grid; place-items: center; font-size: 26px; background: linear-gradient(160deg, #f6ead8, #e7d3b5); }
.line .th img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.line .info { flex: 1; min-width: 0; }
.line .info b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 17px; color: var(--coffee); }
.line .info small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.35; }
.deliver {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); margin-bottom: 16px;
}
.deliver .big { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--cream); color: var(--coffee); }
.deliver .txt { flex: 1; }
.deliver small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.deliver b { font-size: 16px; color: var(--coffee); font-weight: 600; }
.deliver .chg { color: var(--coffee-2); font-weight: 700; font-size: 13px; text-decoration: underline; }
.deliver.needed { border-color: var(--warn); }
.divider { height: 1px; background: var(--line); margin: 8px 0 18px; }

/* ---------- location list ---------- */
.loc-list { display: grid; gap: 10px; }
.loc-opt {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 18px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 16px; color: var(--coffee);
  transition: background 0.2s, color 0.2s;
}
.loc-opt.on { background: var(--coffee); color: var(--cream); border-color: var(--coffee); }

/* ---------- tracking ---------- */
.success { text-align: center; padding: 6px 0 4px; }
.check {
  width: 90px; height: 90px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center;
  background: var(--coffee); box-shadow: 0 14px 34px rgba(74, 52, 38, 0.35); animation: pop 0.7s var(--spring) both;
}
.check path { stroke-dasharray: 48; stroke-dashoffset: 48; animation: draw 0.5s 0.35s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.success h3 { margin: 0 0 6px; font-size: 26px; color: var(--coffee); }
.success p { margin: 0; color: var(--muted); font-size: 14px; }
.confetti { position: fixed; top: 0; left: 0; width: 9px; height: 13px; border-radius: 50% / 40%; z-index: 60; pointer-events: none; animation: fall 1.6s var(--ease) forwards; }
@keyframes fall { to { transform: translate(var(--x), 100vh) rotate(var(--r)); opacity: 0; } }

.steps { position: relative; display: flex; justify-content: space-between; margin: 26px 4px 22px; }
.steps::before { content: ''; position: absolute; left: 30px; right: 30px; top: 19px; height: 3px; border-radius: 3px; background: var(--tint-2); }
.steps .bar { position: absolute; left: 30px; top: 19px; height: 3px; border-radius: 3px; background: var(--coffee); transition: width 0.8s var(--ease); }
.step { position: relative; z-index: 1; width: 60px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--faint); text-align: center; }
.step i {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 17px;
  background: var(--surface); border: 2px solid var(--line-strong); transition: background 0.4s, border-color 0.4s, transform 0.4s var(--spring);
}
.step.done { color: var(--coffee); }
.step.done i { background: var(--cream); border-color: var(--coffee); }
.step.now i { transform: scale(1.12); animation: glowPulse 1.8s infinite; }
@keyframes glowPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(74, 52, 38, 0.35); } 50% { box-shadow: 0 0 0 10px rgba(74, 52, 38, 0); } }
.status-msg { text-align: center; font-size: 15px; font-weight: 600; margin-bottom: 18px; color: var(--coffee); }
.status-msg.cancelled { color: var(--danger); }
.summary { padding: 14px 16px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.summary .row { display: flex; gap: 10px; padding: 8px 0; font-size: 14px; }
.summary .row + .row { border-top: 1px dashed var(--line); }
.summary .row b { min-width: 30px; color: var(--coffee); }
.summary .row small { display: block; color: var(--muted); font-size: 12px; }
.meta-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 12px; }
