:root {
  --green: #1f7a4d;
  --green-dark: #155c39;
  --green-soft: #e7f3ec;
  --orange: #f08a24;
  --ink: #1d2a22;
  --muted: #66746b;
  --line: #e4e9e5;
  --bg: #f7f8f4;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 40, 30, .06), 0 4px 16px rgba(20, 40, 30, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  padding-bottom: 84px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { line-height: 1.25; margin: 0; }

/* ── Top bar ───────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(247, 248, 244, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--green-dark); }
.brand-mark { font-size: 26px; }
.brand-name { font-weight: 800; font-size: 22px; }
.cart-btn {
  position: relative; display: flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 9px 16px;
  background: var(--green); color: #fff; font-weight: 700;
}
.cart-btn:hover { background: var(--green-dark); }
.badge {
  position: absolute; top: -6px; left: -6px;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--orange); color: #fff; font-size: 12px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--bg);
}
.badge.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.35); } }

/* ── Hero ───────────────────────── */
.hero {
  max-width: 1100px; margin: 0 auto; padding: 32px 16px 8px;
  display: grid; gap: 24px;
}
.hero-text {
  background: linear-gradient(135deg, var(--green) 0%, #2f9b62 100%);
  color: #fff; border-radius: 24px; padding: 32px 24px;
  position: relative; overflow: hidden;
}
.hero-text::after {
  content: "🍊🥕🍇🥒"; position: absolute; left: -10px; bottom: -18px;
  font-size: 64px; opacity: .18; letter-spacing: -8px; pointer-events: none;
}
.eyebrow { margin: 0 0 8px; font-weight: 700; color: #c9f0d8; }
.hero h1 { font-size: clamp(26px, 6vw, 42px); font-weight: 800; max-width: 18ch; }
.hero-sub { margin: 12px 0 22px; font-size: 17px; color: #e6f7ec; }
.hero-sub strong { color: #fff; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.perks li {
  display: flex; gap: 10px; align-items: center;
  background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.perks span { font-size: 26px; }
.perks strong { display: block; font-size: 15px; }
.perks small { color: var(--muted); font-size: 13px; }

/* ── Buttons ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; padding: 13px 22px;
  font-weight: 700; font-size: 16px; text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: #d97614; }
.btn-primary:disabled { background: #cfd6d1; color: #fff; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-block { width: 100%; }
.drawer .btn-primary { background: var(--green); }
.drawer .btn-primary:hover:not(:disabled) { background: var(--green-dark); }
.drawer .btn-primary.wa { background: #1fa855; }

/* ── Shop ───────────────────────── */
.shop { max-width: 1100px; margin: 0 auto; padding: 24px 16px; scroll-margin-top: 64px; }
.shop-head { display: grid; gap: 12px; margin-bottom: 16px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px;
  color: var(--muted);
}
.search input { flex: 1; border: 0; outline: 0; background: transparent; padding: 12px 0; font-size: 16px; color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 7px 16px; font-weight: 700; color: var(--muted);
}
.chip[aria-selected="true"] { background: var(--green); border-color: var(--green); color: #fff; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.card .pic {
  aspect-ratio: 4 / 3; border-radius: 12px; display: grid; place-items: center;
  font-size: 64px; background: var(--green-soft);
}
.card[data-cat="fruit"] .pic { background: #fff3e4; }
.card h3 { margin: 4px 0 0; font-size: 17px; }
.price { color: var(--green-dark); font-weight: 800; }
.price small { color: var(--muted); font-weight: 500; }
.add {
  margin-top: auto; border: 0; border-radius: 10px; padding: 10px;
  background: var(--green-soft); color: var(--green-dark); font-weight: 800;
}
.add:hover { background: #d4ecdd; }
.stepper {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  background: var(--green); color: #fff; border-radius: 10px; padding: 4px;
}
.stepper button {
  width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: rgba(255, 255, 255, .18); color: #fff; font-size: 20px; font-weight: 700; line-height: 1;
}
.stepper output { font-weight: 800; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }

/* ── How it works ───────────────────────── */
.how { max-width: 1100px; margin: 0 auto; padding: 16px 16px 32px; }
.how h2 { font-size: 22px; margin-bottom: 12px; }
.how ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.how li { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; }
.how li span {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--green-soft); color: var(--green-dark); font-weight: 800; display: grid; place-items: center;
}

.footer { text-align: center; color: var(--muted); font-size: 14px; padding: 16px; border-top: 1px solid var(--line); }
.footer p { margin: 0; }
.footer__credit { margin-top: 8px !important; font-size: 12px; opacity: .75; }
.footer__credit a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.footer__credit a:hover { color: var(--green-dark); opacity: 1; }

/* ── Bottom cart bar (mobile) ───────────────────────── */
.cart-bar {
  position: fixed; z-index: 25; bottom: 12px; left: 12px; right: 12px;
  margin-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: center; gap: 12px;
  border: 0; border-radius: 14px; padding: 14px 16px;
  background: var(--green); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 8px 24px rgba(21, 92, 57, .35);
}
.cart-bar strong { margin-inline-start: auto; }
.cart-bar-count {
  min-width: 28px; height: 28px; border-radius: 8px; background: rgba(255, 255, 255, .2);
  display: grid; place-items: center; font-weight: 800;
}

/* ── Drawer ───────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10, 25, 15, .45); }
.drawer {
  position: fixed; z-index: 50; top: 0; bottom: 0; left: 0;
  width: min(420px, 100%); background: var(--card);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 20px; }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--bg); font-size: 18px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 16px; }
.lines { list-style: none; margin: 0; padding: 0; }
.line { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line-emoji { font-size: 32px; width: 48px; height: 48px; border-radius: 12px; background: var(--green-soft); display: grid; place-items: center; flex: none; }
.line-info { flex: 1; min-width: 0; }
.line-info strong { display: block; }
.line-info small { color: var(--muted); }
.line .stepper { margin: 0; padding: 2px; gap: 6px; }
.line .stepper button { width: 30px; height: 30px; font-size: 17px; }
.line .stepper output { min-width: 46px; text-align: center; font-size: 14px; }
.empty-cart { text-align: center; color: var(--muted); padding: 48px 0; }

.checkout { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; }
.checkout label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 14px; }
.checkout input, .checkout select, .checkout textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  background: var(--bg); font-size: 16px; font-weight: 400; outline: 0;
}
.checkout input:focus, .checkout select:focus, .checkout textarea:focus { border-color: var(--green); background: #fff; }
.checkout .invalid { border-color: #d64545; }
.slots { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.slots legend { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.slots label { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-weight: 500; }
.slots label:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.slots input { accent-color: var(--green); }
.form-error { color: #c23a3a; font-weight: 700; margin: 0; }

.drawer-foot { border-top: 1px solid var(--line); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 6px; }
.sum { display: flex; justify-content: space-between; color: var(--muted); }
.sum.total { color: var(--ink); font-weight: 800; font-size: 18px; padding-top: 4px; border-top: 1px dashed var(--line); }
.free-hint { margin: 0; font-size: 13px; color: var(--orange); font-weight: 700; }
.free-hint:empty { display: none; }

/* ── Toast ───────────────────────── */
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 90px;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700;
  transition: opacity .2s, transform .2s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Responsive ───────────────────────── */
@media (max-width: 720px) {
  .hero { padding-top: 16px; }
  .perks { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .perks li { flex-direction: column; text-align: center; gap: 4px; padding: 10px 6px; }
  .perks span { font-size: 22px; }
  .perks strong { font-size: 13px; line-height: 1.3; }
  .perks small { font-size: 11px; line-height: 1.3; display: block; }
  .hero-text { padding: 24px 20px; }
  .how ol { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 10px; }
  .card .pic { font-size: 48px; }
  .card h3 { font-size: 15px; }
  .cart-total { display: none; }
  .cart-btn { padding: 9px 12px; }
}
@media (min-width: 721px) {
  body { padding-bottom: 0; }
  .cart-bar { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ── GPS location ───────────────────────── */
.geo { display: grid; gap: 6px; }
.geo-btn {
  border: 1.5px dashed var(--green); background: var(--green-soft); color: var(--green-dark);
  border-radius: 12px; padding: 12px; font-weight: 800; font-size: 15px;
}
.geo-btn:disabled { opacity: .6; cursor: wait; }
.geo.ok .geo-btn { border-style: solid; background: #fff; }
.geo-status { margin: 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.geo-status.ok { color: var(--green-dark); font-weight: 700; }
.geo-status.warn { color: #b8650a; font-weight: 700; }
.geo-status.bad { color: #c23a3a; font-weight: 700; }
.geo-status a, .geo-status button { color: inherit; font: inherit; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; }

/* ── Order placed ───────────────────────── */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.done { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; }
.done-icon { font-size: 56px; }
.done h3 { margin: 0; font-size: 22px; }
.done p { margin: 0; color: var(--muted); }
.done strong { color: var(--ink); }
.done .btn-ghost { color: #1fa855; margin-top: 8px; }
.done .btn-primary { min-width: 160px; }
.btn-primary.loading { opacity: .7; pointer-events: none; }

/* ── Product photos & availability ───────────────────────── */
.card .pic { overflow: hidden; }
.card .pic img, .line-emoji img { width: 100%; height: 100%; object-fit: cover; display: block; }
.line-emoji { overflow: hidden; }
.card.off .pic, .card.off h3, .card.off .price { opacity: .45; filter: grayscale(.8); }
.off-label { margin-top: auto; text-align: center; padding: 10px; border-radius: 10px; background: #f0f2f0; color: var(--muted); font-weight: 700; font-size: 14px; }

/* ── Reorder banner ───────────────────────── */
.reorder {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  background: #fff7ec; border: 1px solid #f7d9b4; border-radius: var(--radius); padding: 14px;
}
.reorder-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.reorder-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reorder .btn { flex: none; padding: 10px 16px; font-size: 15px; }
