/* Public shop page (docs/marketing-tools.md, part C). Mobile first; the seller's accent color
   arrives at runtime as --accent. */
:root {
  --accent: #15171c;
  --accent-ink: #ffffff;
  --ink: #15171c;
  --muted: #68707c;
  --line: #e4e7ec;
  --canvas: #f6f7f9;
  --paper: #ffffff;
  --soft: #f1f2f5;
  --danger: #c0362c;
  --success: #1f7a46;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 17, 21, .05), 0 6px 18px rgba(15, 17, 21, .06);
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f3f4f6;
    --muted: #a3aab5;
    --line: #2c313a;
    --canvas: #0f1115;
    --paper: #181b21;
    --soft: #20242c;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
html[lang="en"] body { font-family: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

#app { max-width: 620px; margin: 0 auto; padding: 0 16px calc(120px + env(safe-area-inset-bottom)); min-height: 100vh; }

/* Header */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 0 6px; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); font-weight: 700; font-size: 14px;
}
.icon-btn svg { width: 18px; height: 18px; }
.hero { padding: 8px 0 18px; display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.logo {
  width: 72px; height: 72px; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  font-weight: 700; font-size: 28px; border: 3px solid var(--paper); box-shadow: var(--shadow);
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.bio { margin: 4px 0 0; color: var(--muted); font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.chip svg { width: 15px; height: 15px; flex: none; }
.chip a { text-decoration: none; color: var(--ink); font-weight: 700; }

/* Products */
.section-title { font-size: 17px; font-weight: 700; margin: 6px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 540px) { .grid { gap: 16px; } }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.card.off { opacity: .6; }
.photo { aspect-ratio: 1 / 1; background: var(--soft); position: relative; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .ph {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 38px; font-weight: 700;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--paper));
}
.badge {
  position: absolute; top: 8px; inset-inline-start: 8px; padding: 3px 10px; border-radius: 999px;
  background: rgba(21, 23, 28, .78); color: #fff; font-size: 12px; font-weight: 700;
}
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-body h3 { margin: 0; font-size: 15px; line-height: 1.35; font-weight: 700; overflow-wrap: anywhere; }
.desc {
  margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 15px; }
.add {
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  height: 34px; padding: 0 14px; font-weight: 700; font-size: 14px;
}
.add:disabled { background: var(--soft); color: var(--muted); cursor: not-allowed; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; height: 34px; }
.stepper button { width: 34px; height: 32px; border: 0; background: none; font-size: 18px; font-weight: 700; line-height: 1; }
.stepper output { min-width: 22px; text-align: center; font-weight: 700; font-size: 14px; }

/* Cart bar */
.cartbar {
  position: fixed; inset-inline: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--canvas) 70%, transparent); pointer-events: none;
}
.cartbar button {
  pointer-events: auto; width: 100%; max-width: 588px; margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; border: 0; border-radius: var(--radius); padding: 14px 18px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px;
  box-shadow: 0 10px 24px rgba(15, 17, 21, .18);
}
.cartbar .count {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .22); font-size: 14px;
}

/* Footer */
.footer { margin: 36px 0 12px; text-align: center; color: var(--muted); font-size: 13px; display: grid; gap: 8px; }
.powered {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 auto; padding: 8px 14px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 13px;
}
.powered b { font-weight: 700; }
.powered img { width: 20px; height: 20px; }
.footer .report { color: var(--muted); font-size: 12px; }

/* States */
.state { min-height: 70vh; display: grid; place-content: center; text-align: center; gap: 12px; padding: 24px 8px; }
.state h1 { margin: 0; font-size: 22px; }
.state p { margin: 0; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--paper); font-weight: 700;
  text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.wa { background: #1f9d55; color: #fff; border-color: transparent; }
.btn svg { width: 20px; height: 20px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.skeleton { background: linear-gradient(90deg, var(--soft), var(--paper), var(--soft)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Sheet */
dialog#sheet {
  border: 0; padding: 0; width: 100%; max-width: 620px; max-height: 92vh; margin: auto auto 0;
  border-radius: 22px 22px 0 0; background: var(--paper); color: var(--ink);
}
@media (min-width: 640px) { dialog#sheet { margin: auto; border-radius: 22px; } }
dialog#sheet::backdrop { background: rgba(10, 12, 16, .45); }
.sheet-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 18px 12px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-body { padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.line .name { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.line .sub { color: var(--muted); font-size: 13px; }
.total { display: flex; justify-content: space-between; font-weight: 700; font-size: 17px; padding-top: 10px; border-top: 1px solid var(--line); }
.field { display: grid; gap: 6px; }
.field label, .field legend { font-weight: 700; font-size: 14px; }
.field legend { padding: 0; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 12px; }
.field input, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--canvas); font-size: 16px;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset.field { border: 0; margin: 0; padding: 0; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.seg label {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--canvas); font-weight: 700; font-size: 14px; cursor: pointer;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--accent-ink); }
.seg label:has(input:checked) { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.error { color: var(--danger); font-size: 13px; font-weight: 700; }
.note { color: var(--muted); font-size: 13px; }
.done { text-align: center; display: grid; gap: 10px; padding: 8px 0 4px; }
.done .tick {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--success) 14%, var(--paper)); color: var(--success);
}
.done .tick svg { width: 34px; height: 34px; }
.done h3 { margin: 0; font-size: 20px; }
.done .ref { font-size: 26px; font-weight: 700; letter-spacing: .04em; }

#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #15171c; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
