/* The Health Pantry — app styles.
   Palette lifted from the live storefront:
   cream #FCF8DE, deep sage #3F6556, navy ink #0E1B4D, mint #A0C9B4. */

:root {
  --cream: #FCF8DE;
  --cream-deep: #F4EDD3;
  --sage: #3F6556;
  --sage-light: #5C8274;
  --mint: #A0C9B4;
  --ink: #0E1B4D;
  --ink-soft: rgba(14, 27, 77, .66);
  --hairline: rgba(14, 27, 77, .12);
  --surface: #FFFDF4;

  --display: 'Lexend Zetta', Georgia, serif;
  --body: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --topbar-h: 58px;
  --tabbar-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 14px;
  --shadow: 0 2px 14px rgba(14, 27, 77, .07);
}

* { box-sizing: border-box; }

/* Author `display` rules (.btn, .icon-btn) otherwise beat the UA stylesheet's
   [hidden] { display: none }, leaving "hidden" elements visible. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  padding-top: calc(var(--topbar-h) + var(--safe-top));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

/* ---------- top bar ---------- */

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 6px 0;
  display: flex; align-items: center; gap: 4px;
  background: var(--sage);
  color: var(--cream);
}

.wordmark {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  line-height: 1; letter-spacing: .04em;
}
.wm-the { font-family: var(--display); font-size: 9px; opacity: .8; font-style: italic; }
.wm-name {
  font-family: var(--display); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .13em;
}

.icon-btn {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: grid; place-items: center; position: relative;
  background: none; border: 0; cursor: pointer; color: var(--cream);
  border-radius: 50%; -webkit-tap-highlight-color: transparent;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { background: rgba(252, 248, 222, .16); }
/* Keeps the wordmark centred when there is nothing to go back to. */
.back-btn.is-hidden { visibility: hidden; pointer-events: none; }

.badge {
  position: absolute; top: 5px; right: 4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--mint); color: var(--sage);
  font-size: 10px; font-weight: 600; line-height: 17px; text-align: center;
}

/* ---------- bottom tab bar ---------- */

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--hairline);
}
.tabbar a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-soft); font-size: 10px; letter-spacing: .04em;
  -webkit-tap-highlight-color: transparent;
}
.tabbar svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--sage); font-weight: 600; }
.tabbar a[aria-current="page"] svg { stroke-width: 2; }
.tab-badge { top: 6px; right: calc(50% - 22px); background: var(--sage); color: var(--cream); }

/* ---------- layout primitives ---------- */

.wrap { padding: 0 16px; }
.section { padding: 26px 16px 8px; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: .06em; margin: 0; }
h1 { font-size: 19px; text-transform: uppercase; line-height: 1.35; }
h2 { font-size: 15px; text-transform: uppercase; line-height: 1.4; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }

.eyebrow {
  font-family: var(--display); font-size: 9px; font-weight: 400;
  letter-spacing: .22em; text-transform: uppercase; color: var(--sage-light);
  margin: 0 0 8px;
}
.muted { color: var(--ink-soft); }

/* ---------- hero ---------- */

.hero {
  margin: 0 0 6px; padding: 30px 20px 34px;
  background: var(--sage); color: var(--cream);
}
.hero .eyebrow { color: var(--mint); }
.hero h1 { font-size: 23px; line-height: 1.4; margin-bottom: 10px; }
.hero p { margin: 0 0 18px; font-size: 13.5px; opacity: .88; max-width: 30ch; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--mint); color: var(--sage);
  font-family: var(--display); font-size: 10.5px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.975); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-block { display: flex; width: 100%; }
.btn-dark { background: var(--sage); color: var(--cream); }
.btn-ghost { background: transparent; color: var(--sage); border: 1.5px solid var(--sage); }

/* ---------- product grid ---------- */

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.card:active { transform: scale(.985); }
.card-img { aspect-ratio: 1; background: var(--cream-deep); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 10px 11px 13px; }
.card-title { font-family: var(--display); font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; line-height: 1.5; }
.card-price { margin-top: 5px; font-size: 13px; font-weight: 500; color: var(--sage); }
.sold-out { font-size: 10px; color: var(--ink-soft); letter-spacing: .08em; text-transform: uppercase; }

/* collection rail on home */
.rail { display: flex; gap: 10px; overflow-x: auto; padding: 2px 16px 6px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.rail::-webkit-scrollbar { display: none; }
.rail .card { flex: 0 0 62vw; max-width: 240px; scroll-snap-align: start; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 14px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--surface);
  font-family: var(--display); font-size: 9.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; cursor: pointer; color: var(--ink-soft);
}
.chip[aria-pressed="true"] { background: var(--sage); border-color: var(--sage); color: var(--cream); }

/* ---------- product detail ---------- */

.gallery { position: relative; background: var(--cream-deep); }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track img { flex: 0 0 100%; aspect-ratio: 1; object-fit: cover; scroll-snap-align: center; }
.dots {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; padding: 6px 10px; border-radius: 999px;
  background: rgba(14, 27, 77, .38); backdrop-filter: blur(6px);
}
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(252,248,222,.5); transition: background .2s; }
.dots i.on { background: var(--cream); }

.pdp { padding: 20px 16px 8px; }
.pdp h1 { margin-bottom: 8px; }
.price { font-family: var(--display); font-size: 17px; font-weight: 700; color: var(--sage); }
.rte { font-size: 14px; color: var(--ink-soft); }
.rte p { margin: 0 0 11px; }
.rte ol, .rte ul { margin: 0 0 11px; padding-left: 19px; }
.rte li { margin-bottom: 4px; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--hairline); border-radius: 999px; overflow: hidden; background: var(--surface); }
.qty button { width: 42px; height: 42px; border: 0; background: none; font-size: 19px; cursor: pointer; color: var(--sage); }
.qty button:active { background: var(--cream-deep); }
.qty span { min-width: 30px; text-align: center; font-weight: 600; font-size: 15px; }

.buybar { display: flex; gap: 11px; align-items: center; padding: 6px 16px 22px; }
.buybar .btn { flex: 1; }

/* ---------- cart ---------- */

.line { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--hairline); }
.line img { width: 74px; height: 74px; border-radius: 10px; object-fit: cover; flex: 0 0 74px; background: var(--cream-deep); }
.line-main { flex: 1; min-width: 0; }
.line-title { font-family: var(--display); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; line-height: 1.5; }
.line-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.line .qty button { width: 32px; height: 32px; font-size: 16px; }
.line .qty span { min-width: 24px; font-size: 14px; }
.line-price { font-weight: 600; font-size: 14px; color: var(--sage); white-space: nowrap; }

.totals { padding: 16px 0 6px; }
.totals .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.totals .row.grand { font-family: var(--display); font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding-top: 13px; border-top: 1px solid var(--hairline); margin-top: 6px; }

.note { font-size: 11.5px; line-height: 1.6; color: var(--ink-soft); text-align: center; padding: 12px 6px 0; }

.empty { text-align: center; padding: 60px 26px; }
.empty svg { width: 46px; height: 46px; stroke: var(--mint); fill: none; stroke-width: 1.3; margin-bottom: 16px; }
.empty h2 { margin-bottom: 9px; }
.empty p { color: var(--ink-soft); font-size: 14px; margin: 0 0 22px; }

/* ---------- about ---------- */

.about-hero { background: var(--sage); color: var(--cream); padding: 34px 20px; text-align: center; }
.about-hero img { width: 158px; margin: 0 auto 18px; }
.about-hero p { font-size: 13.5px; opacity: .9; margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--hairline); }
.list a, .list button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 0; background: none; border: 0; text-align: left; cursor: pointer; font-size: 14px;
}
.list svg { width: 17px; height: 17px; flex: 0 0 17px; stroke: var(--ink-soft); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.install-card {
  margin: 16px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
  border: 1px solid var(--hairline);
}
.install-card p { font-size: 13px; color: var(--ink-soft); margin: 6px 0 14px; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  transform: translate(-50%, 14px);
  padding: 11px 20px; border-radius: 999px;
  background: var(--ink); color: var(--cream);
  font-size: 12.5px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s;
}
.toast.show { opacity: .96; transform: translate(-50%, 0); }

.offline-bar {
  position: fixed; left: 0; right: 0; z-index: 50;
  top: calc(var(--topbar-h) + var(--safe-top));
  padding: 6px 16px; text-align: center;
  background: var(--mint); color: var(--sage);
  font-size: 11px; letter-spacing: .05em;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- search ---------- */

.searchbar {
  display: flex; align-items: center; gap: 9px;
  margin: 0 16px 14px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 999px; box-shadow: var(--shadow);
}
.searchbar svg { width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: var(--ink-soft); stroke-width: 1.8; stroke-linecap: round; }
.searchbar input {
  flex: 1; min-width: 0; height: 44px;
  border: 0; outline: none; background: none;
  font-family: var(--body); font-size: 15px; color: var(--ink);
}
.searchbar input::placeholder { color: var(--ink-soft); }
.searchbar input::-webkit-search-cancel-button { display: none; }
.searchbar button {
  width: 26px; height: 26px; flex: 0 0 26px;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--cream-deep); color: var(--ink-soft);
  font-size: 17px; line-height: 1; display: grid; place-items: center;
}

/* ---------- contact ---------- */

.contact-actions { display: flex; gap: 10px; margin-bottom: 20px; }
.contact-actions .btn { flex: 1; }

.contact-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  font-family: var(--display); font-size: 9px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--sage-light);
}
.field input, .field textarea {
  width: 100%; padding: 12px 14px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 12px;
  font-family: var(--body); font-size: 15px; outline: none;
  -webkit-appearance: none;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field textarea:focus { border-color: var(--sage); }
.contact-form .btn { margin-top: 4px; }

/* ---------- policy ---------- */

.policy { font-size: 13.5px; line-height: 1.65; }
.policy h2 {
  font-size: 11px; letter-spacing: .1em; color: var(--sage);
  margin: 22px 0 8px;
}
.policy ul, .policy ol { padding-left: 18px; }
.policy li { margin-bottom: 6px; }
.policy strong { color: var(--ink); }
