/* Struktur bersama: reset, aksesibilitas, kartu item, dialog, dan bar pilihan.
   Warna, font, dan bentuk diatur variabel serta CSS tiap versi. */
:root {
  --bg: #fff;
  --surface: #fff;
  --ink: #1a1a1a;
  --muted: #555;
  --line: #e5e5e5;
  --accent: #1a1a1a;
  --accent-ink: #fff;
  --radius: 14px;
  --font-body: system-ui, sans-serif;
  --font-display: var(--font-body);
  --focus: #1d4ed8;
  --cart-bg: var(--ink);
  --cart-ink: var(--bg);
  --cart-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
html.is-locked { overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font-body); }
html.has-cart body { padding-bottom: calc(var(--cart-h) + 28px + env(safe-area-inset-bottom)); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.ic { width: 1.25em; height: 1.25em; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 16px; background: var(--ink); color: var(--bg); border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 12px; }
.demo-note { margin: 0; padding: 8px 16px; font-size: 13px; text-align: center; }

/* Kartu item: tombol asli, isi berupa span blok */
.card { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; border: 0; background: none; text-align: left; }
.card-media { display: block; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body, .card-name, .card-desc, .card-meta { display: block; }
.card-body { flex: 1; display: flex; flex-direction: column; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.cat-nav ul { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; }
.cat-nav a { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; text-decoration: none; }
.cat-group { scroll-margin-top: 72px; }

/* Dialog: bottom sheet di mobile, panel tengah di layar lebar */
.sheet { width: 100%; max-width: 480px; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); color: var(--ink); overflow: hidden; }
.sheet::backdrop { background: rgb(0 0 0 / .55); }
.sheet-panel { position: relative; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom); }
.sheet-close { position: absolute; top: 12px; right: 12px; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: 0 2px 10px rgb(0 0 0 / .18); }
.sheet-img { width: 100%; height: auto; max-height: 46dvh; object-fit: cover; }
.sheet-body { display: grid; gap: 14px; padding: 20px 20px 24px; }
.sheet-title { font: 700 24px/1.2 var(--font-display); padding-right: 48px; }
.item-sheet .sheet-title { padding-right: 0; }
.sheet-desc, .cart-note { color: var(--muted); font-size: 15px; }
.sheet-price { font-weight: 700; font-size: 18px; }
.sheet-tag, .sheet-meta { justify-self: start; font-size: 13px; font-weight: 700; }
.sheet-meta { color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.sheet-details { display: grid; gap: 8px; font-size: 15px; }
.sheet-details li { position: relative; padding-left: 22px; }
.sheet-details li::before { content: ''; position: absolute; left: 4px; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.sheet-opts { display: grid; gap: 14px; }
.sheet-opts:empty { display: none; }
@media (min-width: 700px) {
  .sheet { margin: auto; border-radius: var(--radius); }
}

.opt { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.opt-legend { padding: 0; margin-bottom: 8px; font-weight: 700; font-size: 15px; }
.opt-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-choice { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 999px; font-size: 15px; cursor: pointer; }
.opt-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opt-choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 700; }
.opt-choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.opt-add { color: var(--muted); font-size: 13px; }

.qty { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.qty-label { font-weight: 700; font-size: 15px; }
.qty-ctrl { display: inline-flex; align-items: center; gap: 4px; }
.qty-ctrl button, .cart-remove { display: grid; place-items: center; width: 44px; height: 44px; border: 1.5px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 20px; line-height: 1; }
.qty-ctrl button:disabled { opacity: .4; cursor: not-allowed; }
.qty-value { min-width: 2ch; text-align: center; font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 12px 20px; border: 0; border-radius: var(--radius); font-weight: 700; text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.sheet-ask { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; font-weight: 600; font-size: 15px; }

.cart-lines { display: grid; gap: 4px; }
.cart-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line-info { display: grid; gap: 2px; }
.cart-line-name { font-weight: 700; }
.cart-line-opt, .cart-line-price { font-size: 14px; color: var(--muted); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; }
.cart-total[hidden] { display: none; }
.cart-clear { justify-self: center; min-height: 44px; padding: 8px 12px; border: 0; background: none; color: var(--muted); font-size: 14px; text-decoration: underline; }

/* Bar pilihan mengambang */
.cart-bar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20; display: flex; justify-content: center; }
.cart-bar[hidden] { display: none; }
.cart-open { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 480px; min-height: var(--cart-h); padding: 10px 18px 10px 10px; border: 0; border-radius: var(--radius); background: var(--cart-bg); color: var(--cart-ink); text-align: left; box-shadow: 0 10px 30px rgb(0 0 0 / .25); }
.cart-count { display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px; border-radius: calc(var(--radius) - 4px); background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.cart-text { display: grid; flex: 1; line-height: 1.3; }
.cart-title { font-weight: 700; }
.cart-sum { font-size: 13px; opacity: .85; }
.cart-bar.bump .cart-open { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.04); } }

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