/* AMARA · shared tokens, glass material and primitives (store + admin) */
/* Brand face. Brown Sugar by Muntab Art: personal-use licence only; buy the commercial licence before launch. */
@font-face { font-family: "Brown Sugar"; src: url("/assets/fonts/BrownSugar.woff2") format("woff2"); font-display: swap; }
:root {
  --canvas: #f6f3ee;
  --surface: #ffffff;
  --ink: #141312;
  --ink-soft: #5f5a54;
  --line: rgba(20, 19, 18, 0.12);
  --line-strong: rgba(20, 19, 18, 0.22);
  --accent: #141312;
  --accent-ink: #ffffff;
  --sale: #b3261e;
  --ok: #1f7a4d;
  --warn: #9a6200;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --font-display: "Jost", "Futura", system-ui, sans-serif;
  --font-text: "Manrope", system-ui, sans-serif;
  --font-brand: "Brown Sugar", var(--font-display);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --e1: 0 1px 2px rgba(40, 30, 20, 0.06), 0 2px 8px rgba(40, 30, 20, 0.05);
  --e2: 0 6px 18px rgba(40, 30, 20, 0.10), 0 2px 6px rgba(40, 30, 20, 0.06);
  --e3: 0 24px 60px rgba(30, 22, 14, 0.22), 0 8px 20px rgba(30, 22, 14, 0.10);
  --gutter: clamp(16px, 4vw, 48px);
  --maxw: 1440px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font: 400 15px/1.6 var(--font-text); letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.06; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
::selection { background: var(--ink); color: var(--canvas); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
input, textarea { caret-color: var(--ink); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nums { font-variant-numeric: tabular-nums; }
* { scrollbar-width: thin; scrollbar-color: rgba(20,19,18,.28) transparent; }

/* ---------- Liquid glass material ---------- */
.glass {
  --glass-tint: 255, 255, 255;
  --glass-alpha: 0.22;
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(135deg, rgba(var(--glass-tint), calc(var(--glass-alpha) + 0.14)) 0%, rgba(var(--glass-tint), var(--glass-alpha)) 45%, rgba(var(--glass-tint), calc(var(--glass-alpha) * 0.6)) 100%);
  -webkit-backdrop-filter: blur(18px) saturate(185%);
  backdrop-filter: blur(18px) saturate(185%);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 0 rgba(255, 255, 255, 0.18),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.25),
    0 10px 30px rgba(30, 22, 14, 0.14),
    0 2px 6px rgba(30, 22, 14, 0.08);
}
/* specular rim: brighter on the lit corner, follows the pointer on desktop */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background:
    radial-gradient(120% 80% at var(--gx, 18%) var(--gy, 0%), rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 55%);
  mix-blend-mode: soft-light; opacity: 0.9;
}
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255,255,255,.9), rgba(255,255,255,0) 30%, rgba(255,255,255,0) 70%, rgba(255,255,255,.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.glass--dark { --glass-tint: 22, 20, 18; --glass-alpha: 0.32; border-color: rgba(255, 255, 255, 0.18); color: #fff; }
.glass--clear { --glass-alpha: 0.08; }
.glass--solid { --glass-alpha: 0.62; }
/* Chromium gets genuine refraction on top of the frost */
html.lg-refract .glass--lens {
  -webkit-backdrop-filter: url(#lg-refract) blur(10px) saturate(190%) brightness(1.04);
  backdrop-filter: url(#lg-refract) blur(10px) saturate(190%) brightness(1.04);
}
@media (prefers-reduced-transparency: reduce) {
  .glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(var(--glass-tint), 0.92); }
}

/* ---------- Buttons ---------- */
.btn {
  --b-bg: var(--ink); --b-fg: var(--canvas);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: var(--radius-pill);
  background: var(--b-bg); color: var(--b-fg);
  font: 500 13px/1 var(--font-text); letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  transition: transform 140ms var(--ease-out), background-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), opacity 160ms;
  box-shadow: var(--e1);
}
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .btn:hover { box-shadow: var(--e2); transform: translateY(-1px); } }
.btn--light { --b-bg: #fff; --b-fg: var(--ink); }
.btn--ghost { --b-bg: transparent; --b-fg: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn--block { width: 100%; }
.btn--sm { min-height: 38px; padding: 0 16px; font-size: 12px; }
.btn--wa { --b-bg: #1f8f4e; --b-fg: #fff; }
.glass-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: var(--radius-pill);
  font: 500 13px/1 var(--font-text); letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  color: inherit; transition: transform 140ms var(--ease-out);
}
.glass-btn:active { transform: scale(0.97); }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--radius-pill); display: inline-grid; place-items: center; position: relative;
  transition: background-color 150ms var(--ease-out), transform 140ms var(--ease-out);
}
.icon-btn:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: rgba(20, 19, 18, 0.06); } }
.count-dot {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--ink); color: var(--canvas); font: 600 10px/18px var(--font-text); text-align: center;
}

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; align-content: start; }
/* label · value rows (bag, checkout, order detail, simulators) */
.sumrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; }
.sumrow > :last-child { text-align: right; flex: none; }
.sumrow--save { color: var(--sale); font-weight: 600; }
.sumrow--total { font: 600 18px/1.2 var(--font-text); }
.field > span, .label { font: 600 11px/1.2 var(--font-text); letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-soft); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 16px; /* 16px stops iOS zoom */
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20, 19, 18, 0.10); }
.input[aria-invalid="true"] { border-color: var(--sale); }
.hint { font-size: 13px; color: var(--ink-soft); }
/* helper and error text under a field read as sentences, not as labels */
.field > span.help, .field > span.err, .field > span.hint { font: 400 13px/1.45 var(--font-text); letter-spacing: 0; text-transform: none; }
.field > span.err { color: var(--sale); }
.err { font-size: 13px; color: var(--sale); }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: 14px; line-height: 1.45; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); }

/* ---------- Brand ---------- */
.wordmark { width: auto; height: 22px; overflow: visible; }
.pay-logos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pay-logos li { display: grid; place-items: center; height: 40px; padding: 0 12px; background: #fff; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.brand-logo { display: block; }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 9000; display: grid; gap: 8px; pointer-events: none; width: min(92vw, 420px); }
.toast { pointer-events: auto; padding: 14px 18px; border-radius: 16px; font-size: 14px; display: flex; gap: 10px; align-items: center; animation: toast-in 260ms var(--ease-out); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } }

/* "reduce motion" in the OS: everything still. Not inside the designer preview (html.force-motion), where the owner
   has to see what she is designing, nor in the admin's little animation demos. */
@media (prefers-reduced-motion: reduce) {
  html:not(.force-motion) *:not(.mo__demo *), html:not(.force-motion) *::before, html:not(.force-motion) *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
