/* ============================================================================
   Nova storefront styles
   Colours you might tweak live at the top of config.js (accent) — the rest of
   the palette is here in :root if you ever want to go further.
   ========================================================================== */

:root {
  --bg:        #ffffff;
  --surface:   #f5f5f3;   /* chips, image backdrops */
  --surface-2: #ececea;
  --ink:       #16161a;   /* primary text */
  --muted:     #6c6c74;   /* secondary text */
  --line:      #e6e6e2;   /* hairlines */
  --accent:    #101014;   /* overridden by config.js */
  --accent-ink:#ffffff;   /* text that sits on the accent */
  --wa:        #25d366;   /* WhatsApp green — deliberate, do not rebrand */
  --wa-dark:   #1da851;
  --danger:    #b23b3b;

  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(20,20,26,.05), 0 8px 30px rgba(20,20,26,.06);
  --maxw:      1120px;
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 16px;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select, button { font-size: 16px; } /* stops iOS zoom-on-focus */

/* ---- Header ---------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row {
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
}
.wordmark {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; letter-spacing: -.02em; font-size: 20px;
  color: var(--ink); text-decoration: none; margin-right: auto;
}
.wordmark img { height: 30px; width: auto; }

.cart-btn {
  position: relative;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--ink);
  height: 44px; padding: 0 16px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px; font-weight: 600;
  transition: border-color .15s ease, transform .05s ease;
}
.cart-btn:hover { border-color: var(--ink); }
.cart-btn:active { transform: scale(.98); }
.cart-count {
  min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; font-size: 12px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}
.cart-count.show { display: inline-flex; }

/* ---- Search + categories --------------------------------------------- */
.controls { max-width: var(--maxw); margin: 0 auto; padding: 16px 18px 0; }
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid transparent;
  border-radius: 999px; padding: 0 16px; height: 48px;
  transition: border-color .15s ease, background .15s ease;
}
.search:focus-within { background: var(--bg); border-color: var(--ink); }
.search svg { flex: none; color: var(--muted); }
.search input {
  border: 0; background: transparent; outline: none;
  width: 100%; height: 100%; color: var(--ink);
}

.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--bg);
  color: var(--muted); height: 38px; padding: 0 16px; border-radius: 999px;
  font-weight: 600; white-space: nowrap; transition: all .15s ease;
}
.chip[aria-pressed="true"] {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}

/* ---- Product grid ---------------------------------------------------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 8px 18px 120px; }
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 18px;
}
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
@media (min-width: 900px)  { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); overflow: hidden; display: flex; flex-direction: column;
}
.card-media { position: relative; aspect-ratio: 1/1; background: var(--surface); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; top: 10px; left: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .01em;
  padding: 5px 9px; border-radius: 999px; background: var(--ink); color: #fff;
}
.badge.sale   { background: var(--accent); color: var(--accent-ink); }
.badge.out    { background: #fff; color: var(--muted); border: 1px solid var(--line); }
.badge.low    { background: #fff; color: var(--ink); border: 1px solid var(--ink); }

.card-body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-name { font-weight: 700; letter-spacing: -.01em; }
.card-desc {
  color: var(--muted); font-size: 13.5px; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.price { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.price .now { font-weight: 800; }
.price .was { color: var(--muted); text-decoration: line-through; font-size: 14px; }

.card select {
  margin-top: 6px; width: 100%; height: 40px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink);
}

.card-actions { margin-top: auto; padding-top: 10px; }
.add-btn {
  width: 100%; height: 44px; border-radius: var(--radius-sm);
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  font-weight: 700; transition: transform .05s ease, opacity .15s ease;
}
.add-btn:hover { opacity: .9; }
.add-btn:active { transform: scale(.98); }
.add-btn[disabled] {
  background: var(--surface); color: var(--muted);
  border-color: var(--line); cursor: not-allowed;
}
.add-btn.added { background: var(--wa); border-color: var(--wa); }

.empty {
  text-align: center; color: var(--muted); padding: 60px 20px;
  grid-column: 1 / -1;
}
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; font-size: 18px; }

/* ---- Cart / checkout drawer ------------------------------------------ */
.overlay {
  position: fixed; inset: 0; background: rgba(20,20,26,.4);
  opacity: 0; visibility: hidden; transition: opacity .2s ease; z-index: 50;
}
.overlay.open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed; z-index: 60; background: var(--bg);
  display: flex; flex-direction: column;
  right: 0; top: 0; bottom: 0; width: min(440px, 100%);
  transform: translateX(100%); transition: transform .25s ease;
  box-shadow: -10px 0 40px rgba(20,20,26,.12);
}
.drawer.open { transform: translateX(0); }
@media (max-width: 560px) {
  .drawer { top: auto; height: 92vh; width: 100%; border-radius: 20px 20px 0 0;
            transform: translateY(100%); }
  .drawer.open { transform: translateY(0); }
}

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.icon-btn {
  border: 0; background: transparent; color: var(--muted);
  width: 36px; height: 36px; border-radius: 999px; font-size: 20px; line-height: 1;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.back-btn { border: 0; background: transparent; color: var(--muted); font-weight: 600; padding: 0; }
.back-btn:hover { color: var(--ink); }

.drawer-body { flex: 1; overflow-y: auto; padding: 14px 20px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 16px 20px; }

.line {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 12px;
  align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.line img { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; background: var(--surface); }
.line-name { font-weight: 700; font-size: 14.5px; }
.line-variant { color: var(--muted); font-size: 13px; }
.line-price { color: var(--muted); font-size: 13px; margin-top: 2px; }
.line-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.line-total { font-weight: 700; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.stepper button {
  width: 30px; height: 30px; border: 0; background: transparent; color: var(--ink);
  font-size: 17px; line-height: 1; border-radius: 999px;
}
.stepper button:disabled { color: var(--surface-2); }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; font-size: 14px; }
.remove { border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; padding: 0; }
.remove:hover { color: var(--danger); }

.totals { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.totals .t-label { color: var(--muted); }
.totals .t-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field label .opt { color: var(--muted); font-weight: 500; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--ink); }
.field textarea { resize: vertical; min-height: 74px; }
.field .err { color: var(--danger); font-size: 13px; margin-top: 6px; display: none; }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }

.btn-primary {
  width: 100%; height: 52px; border: 0; border-radius: var(--radius-sm);
  background: var(--ink); color: #fff; font-weight: 700; font-size: 16px;
  transition: transform .05s ease, opacity .15s ease;
}
.btn-primary:hover { opacity: .92; }
.btn-primary:active { transform: scale(.99); }
.btn-primary[disabled] { background: var(--surface); color: var(--muted); cursor: not-allowed; }

.btn-wa {
  width: 100%; height: 54px; border: 0; border-radius: var(--radius-sm);
  background: var(--wa); color: #fff; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .15s ease, transform .05s ease;
}
.btn-wa:hover { background: var(--wa-dark); }
.btn-wa:active { transform: scale(.99); }

.wa-warn {
  background: #fff8e6; border: 1px solid #f0dfa8; color: #7a5c00;
  font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 12px;
}

.foot-note { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 10px; }

/* ---- Accessibility --------------------------------------------------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
