/* DigiSnap vending - mengikuti dunia visual digisnap.id (cream, espresso, terracotta; Spectral + Figtree) */
:root {
  color-scheme: light;
  --cream: #fbf6ec;
  --cream-hi: #fffdf8;
  --sand: #f3ead8;
  --hairline: #e7d9c2;
  --espresso: #3a2a1a;
  --cocoa: #6b5743;
  --terracotta: #b5651d;
  --terracotta-deep: #9a5214;
  --terracotta-glow: rgba(181, 101, 29, .22);
  --ok: #3f6b3a;
  --ok-bg: #e6eedc;
  --bad: #9b2c1f;
  --bad-bg: #f6e1d9;
  --font-body: "Figtree", system-ui, sans-serif;
  --font-display: "Spectral", Georgia, "Times New Roman", serif;
  --r-sm: 8px; --r-md: 16px; --r-lg: 24px; --r-pill: 999px;
  --shadow-frame: 0 12px 30px -12px rgba(58, 42, 26, .28);
  --shadow-lift: 0 18px 44px -14px rgba(58, 42, 26, .34);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--hairline) var(--cream); }
body {
  margin: 0;
  background: var(--cream);
  color: var(--espresso);
  font: 400 1.0625rem/1.55 var(--font-body);
  caret-color: var(--terracotta);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--terracotta-glow); color: var(--espresso); }
img { display: block; max-width: 100%; }
a { color: var(--terracotta-deep); text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 3px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums lining-nums; }
[hidden] { display: none !important; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 8px; }
.top img { height: 30px; width: auto; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--cream-hi); border: 1px solid var(--hairline); font-size: .875rem; color: var(--cocoa); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hairline); }
.pill[data-state="online"] .dot { background: #4f8a45; box-shadow: 0 0 0 3px rgba(79, 138, 69, .18); }
.pill[data-state="offline"] .dot { background: var(--bad); }

/* Intro */
h1, h2 { font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.5rem + 2.6vw, 2.75rem); margin-top: 28px; }
h1 em, h2 em { font-style: italic; color: var(--terracotta-deep); }
h2 { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2rem); }
.lead { color: var(--cocoa); margin: 14px 0 0; max-width: 46ch; }
.note {
  margin: 18px 0 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--sand);
  color: var(--cocoa); font-size: .9375rem; display: flex; gap: 10px; align-items: flex-start;
}
.note svg { flex: none; margin-top: 2px; }
.note.bad { background: var(--bad-bg); color: var(--bad); }

/* Product list */
.catalog { border: 0; margin: 36px 0 0; padding: 0; display: grid; gap: 22px; }
.catalog legend { font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; margin-bottom: 14px; padding: 0; }
.prod { position: relative; display: block; cursor: pointer; }
.prod input { position: absolute; opacity: 0; pointer-events: none; }
.prod-card {
  display: grid; grid-template-columns: 112px 1fr; gap: 18px; align-items: center;
  padding: 14px; border-radius: var(--r-lg); background: var(--cream-hi);
  border: 1.5px solid var(--hairline);
  transition: border-color .24s var(--ease-out), box-shadow .24s var(--ease-out), transform .24s var(--ease-out);
}
.print {
  background: #fff; padding: 6px 6px 18px; border-radius: 4px; box-shadow: var(--shadow-frame);
  transform: rotate(-2deg); transition: transform .4s var(--ease-out);
}
.prod:nth-child(odd) .print { transform: rotate(1.6deg); }
.print-crop { aspect-ratio: 1 / 1.45; overflow: hidden; border-radius: 2px; background: var(--sand); }
.print-crop img { width: 100%; height: auto; }
.prod-name, .prod-desc { display: block; }
.prod-name { font-family: var(--font-display); font-size: 1.45rem; font-weight: 500; line-height: 1.15; }
.prod-desc { color: var(--cocoa); font-size: .9375rem; margin: 6px 0 10px; }
.prod-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 1.125rem; }
.stock { font-size: .875rem; color: var(--cocoa); }
.stock.low { color: var(--terracotta-deep); font-weight: 600; }
.check {
  position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--terracotta-deep); color: #fff;
  transform: scale(.4); opacity: 0; transition: transform .24s var(--ease-out), opacity .18s;
}
@media (hover: hover) { .prod:hover .prod-card { border-color: #d9c2a0; } }
.prod input:checked + .prod-card { border-color: var(--terracotta); box-shadow: 0 0 0 4px var(--terracotta-glow), var(--shadow-lift); transform: translateY(-2px); }
.prod input:checked + .prod-card .print { transform: rotate(0); }
.prod input:checked + .prod-card .check { transform: scale(1); opacity: 1; }
.prod input:focus-visible + .prod-card { outline: 2px solid var(--terracotta); outline-offset: 3px; }
.prod.out { cursor: not-allowed; }
.prod.out .prod-card { background: var(--sand); }
.prod.out .print { filter: grayscale(.85); opacity: .6; }
.prod.out .price { color: var(--cocoa); text-decoration: line-through; font-weight: 500; }

/* Steps */
.how { margin: 44px 0 0; padding: 22px 20px; border-radius: var(--r-lg); background: var(--sand); }
.how h2 { font-size: 1.35rem; margin-bottom: 12px; }
.how ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.how li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; color: var(--cocoa); font-size: .9375rem; }
.how li svg { color: var(--terracotta-deep); margin-top: 2px; }
.how b { color: var(--espresso); font-weight: 600; }

footer { margin: 48px 0 0; padding: 28px 0 140px; border-top: 1px solid var(--hairline); color: var(--cocoa); font-size: .9375rem; }
footer .sign { font-family: var(--font-display); font-style: italic; font-size: 1.35rem; color: var(--espresso); margin: 0 0 8px; }
footer p { margin: 4px 0; }

/* Sticky pay bar */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255, 253, 248, .94); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--hairline); box-shadow: 0 -12px 30px -18px rgba(58, 42, 26, .25);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
}
.bar .wrap { display: flex; align-items: center; gap: 14px; }
.bar-info { flex: 1; min-width: 0; font-size: .875rem; color: var(--cocoa); line-height: 1.3; }
.bar-info strong { display: block; font-size: 1.0625rem; color: var(--espresso); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Buttons */
.btn {
  appearance: none; border: 0; cursor: pointer; font: 600 1.0625rem/1 var(--font-body);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: var(--r-pill); text-decoration: none;
  background: var(--espresso); color: var(--cream);
  transition: background .18s var(--ease-out), transform .18s var(--ease-out), box-shadow .18s;
}
.btn:hover { background: #4b3825; }
.btn:active { transform: scale(.98); }
.btn:disabled { background: var(--hairline); color: var(--cocoa); cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--espresso); box-shadow: inset 0 0 0 1.5px var(--hairline); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--terracotta); background: var(--cream-hi); }
.btn.block { width: 100%; }
.btn.small { min-height: 44px; font-size: .9375rem; padding: 0 16px; }
.btn.back { margin: 0 0 12px; padding: 0 12px 0 8px; }
.btn .spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Checkout / status views */
.view { padding: 28px 0 60px; }
main:not([hidden]) { animation: rise .32s var(--ease-out); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.summary { display: flex; align-items: center; gap: 14px; margin: 18px 0 0; padding: 12px; border-radius: var(--r-md); background: var(--cream-hi); border: 1px solid var(--hairline); }
.summary .thumb { width: 46px; aspect-ratio: 1 / 1.3; overflow: hidden; border-radius: 4px; flex: none; box-shadow: var(--shadow-frame); }
.summary .thumb img { width: 100%; }
.summary div { flex: 1; }
.summary strong { display: block; }
.summary span { color: var(--cocoa); font-size: .875rem; }
.qr-card { margin: 18px 0 0; padding: 22px 20px 18px; border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow-lift); text-align: center; }
.qr-card img { width: min(260px, 100%); aspect-ratio: 1; margin: 0 auto; image-rendering: pixelated; background: var(--sand); border-radius: var(--r-sm); }
.timer { margin: 14px 0 0; color: var(--cocoa); font-size: .9375rem; }
.timer b { color: var(--espresso); }
.timer.urgent b { color: var(--bad); }
.actions { display: grid; gap: 10px; margin: 18px 0 0; }
.sandbox { margin: 18px 0 0; padding: 16px; border-radius: var(--r-md); border: 1.5px dashed var(--hairline); background: var(--cream-hi); }
.sandbox p { margin: 0 0 10px; color: var(--cocoa); font-size: .9375rem; }
.sandbox .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status { margin: 16px 0 0; text-align: center; color: var(--cocoa); font-size: .9375rem; min-height: 1.5em; }
.status.warn { color: var(--bad); font-weight: 600; }

/* Momen "cetakan keluar" */
.slot-out { position: relative; margin: 26px auto 0; width: 190px; }
.slot-out::before {
  content: ""; position: absolute; left: -14px; right: -14px; top: -6px; height: 12px; border-radius: var(--r-pill);
  background: var(--espresso); box-shadow: inset 0 3px 4px rgba(0, 0, 0, .45); z-index: 2;
}
.slot-out .print { transform: none; clip-path: inset(0 0 100% 0); }
.slot-out.go .print { animation: emerge 2.6s var(--ease-out) .2s forwards; }
.slot-out.done .print { clip-path: inset(0 0 0 0); }
@keyframes emerge { to { clip-path: inset(0 0 0 0); } }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--r-pill); font-size: .875rem; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.wait { background: var(--sand); color: var(--cocoa); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.center { text-align: center; }
.center .lead { margin-left: auto; margin-right: auto; }
.mt { margin-top: 16px; }
.order-id { font-size: .8125rem; color: var(--cocoa); margin-top: 18px; }

.skeleton { height: 150px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--sand), var(--cream-hi), var(--sand)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 360px) {
  .prod-card { grid-template-columns: 88px 1fr; gap: 14px; }
  .prod-name { font-size: 1.25rem; }
}
