/* ===========================================================================
   reference.css — the reference storefront's own stylesheet, lifted.
   ---------------------------------------------------------------------------
   Grocery-app register: a search-first header, a compact hero band with a
   benefit strip welded underneath, a sticky category SIDEBAR beside the page
   (a narrow rail on phones), and a phone tab bar with the cart on the far
   right. The product card is the grocery-app tile — square grey media, a
   circular + top-right, price, a two-line title — three across on phones.
   Token values below are the defaults; the theme editor's colour settings
   override them from layout/theme.liquid (snippets/theme-colors).
   =========================================================================== */

:root {
  /* ── colour ──────────────────────────────────────────────────────────────
     #284c22  dark forest accent         white-on 9.8 ✓
     #72bc46  leaf green                 black-on 7.5 ✓ · NEVER carries white
     #d4eac7  pale mint                  accent-on 7.6 ✓
     #ffd348  pop yellow                 black-on 12.2 ✓ — the one loud accent */
  --c-bg:            #ffffff;
  --c-surface:       #ffffff;
  --c-surface-2:     #f2f3f1;
  --c-ink:           #16210f;
  --c-ink-muted:     #5b6455;
  --c-ink-subtle:    #69705f;
  --c-line:          #e6e9e3;
  --c-accent:        #284c22;
  --c-accent-ink:    #ffffff;
  --c-accent-soft:   #d4eac7;
  --c-sale:          #a02020;
  --c-success:       #2f6b34;

  --c-announce-bg:   #284c22;
  --c-announce-ink:  #ffffff;
  --c-header-bg:     #ffffff;   /* light: an opaque logo file is never inverted */
  --c-header-ink:    #16210f;
  --c-footer-bg:     #1e3a1a;
  --c-footer-ink:    #e8f0e2;

  /* extras, derived from the four palette colours */
  --c-leaf:          #72bc46;
  --c-pop:           #ffd348;
  --c-pop-ink:       #16210f;
  --c-mint-2:        #eef7e8;
  --c-accent-hover:  #1c3818;
  --c-scrim:         rgb(22 33 15 / 0.55);
  --c-hero-edge:     #21411c;

  /* ── type ────────────────────────────────────────────────────────────────
     Bilingual — labels pair 中文 with English. The CJK faces lead the stack or
     Latin fallbacks render the Chinese in a mismatched weight. */
  --font-display: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei",
                  ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  --font-body:    "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei",
                  system-ui, -apple-system, "Segoe UI", sans-serif;

  --fs-hero:   clamp(1.5rem, 2.8vw, 2.5rem);   /* one line in a compact band */
  --fs-h1:     clamp(1.5rem, 3vw, 2.25rem);
  --fs-h2:     clamp(1.25rem, 2vw, 1.625rem);
  --fs-h3:     1.0625rem;
  --fs-body:   1rem;
  --fs-small:  0.8125rem;
  --fs-micro:  0.6875rem;

  --lh-tight:   1.08;
  --lh-heading: 1.25;
  --lh-body:    1.55;

  --tracking-display: -0.02em;
  --tracking-caps:     0.06em;

  --fw-display: 700;
  --fw-body:    400;
  --fw-bold:    600;

  /* ── space ─────────────────────────────────────────────────────────────── */
  --gutter:          0.625rem;
  --gutter-lg:       1.25rem;
  --section-y:       clamp(2rem, 4vw, 3.25rem);
  --section-y-tight: clamp(1.25rem, 2.5vw, 2rem);
  --container:        1320px;
  --container-narrow:  760px;

  /* ── shape · rounded cards, pill buttons ─────────────────────────────────── */
  --radius-card:   12px;
  --radius-button: 999px;
  --radius-input:  999px;
  --radius-pill:   999px;
  --border-width:  1px;

  /* ── elevation & motion ────────────────────────────────────────────────── */
  --shadow-card: 0 1px 2px rgb(22 33 15 / 0.05);
  --shadow-pop:  0 10px 30px rgb(22 33 15 / 0.16);
  --shadow-float:       0 6px 18px rgb(11 20 6 / 0.28);   /* packshots over the hero */
  --shadow-float-hover: 0 14px 30px rgb(11 20 6 / 0.42);  /* …lifted on hover  */
  --shadow-tabbar:      0 -4px 16px rgb(22 33 15 / 0.06);  /* the phone tab bar */
  --ease:        cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur:         200ms;

  /* ── layout ──────────────────────────────────────────────────────────────
     --grid-cols-sm is 3, not 2: the grocery-app grid, three packshots across
     a 390pt phone. */
  --grid-cols-lg: 4;
  --grid-cols-md: 3;
  --grid-cols-sm: 3;

  /* The hero band's ratio from 768px up — the figure is placed at its native
     1:1 inside it, so nothing is ever cropped. COMPACT: 5:1 is ~200px in the
     1004px column at 1440, so the first product row is inside a 900px fold.
     Under 768px the band has no ratio at all — it is laid out in flow and is
     as tall as its copy — so --hero-ratio-sm is kept only for the contract. */
  --hero-ratio-lg: 5 / 1;
  --hero-ratio-sm: 9 / 8;
  --card-ratio:    1 / 1;

  /* chrome budget on a 900px laptop: 34 + 62 = 96px at rest (11%), 54px stuck
     (6%). The category rail that sat under the header is now the sidebar, so
     the header is one row. Phones add the tab bar at the foot: 34 + 56 + 58 =
     148px of an 812px screen (18%) at rest, 48 + 58 stuck. */
  --h-announce:     34px;
  --h-header:       62px;
  --h-header-stuck: 54px;
  --h-tabbar:       58px;
  --h-header-sm:    56px;   /* phone header, one row */
  --h-header-stuck-sm: 48px;
  --w-sidenav:      232px;  /* the desktop panel */
  --w-rail:         92px;   /* the phone / tablet rail */

  --tokens-filled: 1;
}

/* ═══ primitives ═══════════════════════════════════════════════════════════ */

body { font-feature-settings: "tnum" 0; }

.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(0.75rem, 3vw, 2rem);
}

.skip {
  position: absolute; left: 0.5rem; top: -3rem; z-index: 200;
  background: var(--c-accent); color: var(--c-accent-ink);
  padding: 0.5rem 0.875rem; border-radius: var(--radius-button);
  transition: top var(--dur) var(--ease);
}
.skip:focus { top: 0.5rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: var(--c-accent); color: var(--c-accent-ink);
  font-weight: var(--fw-bold); font-size: var(--fs-small);
  padding: 0.8125rem 1.375rem;
  border-radius: var(--radius-button);
  transition: background var(--dur) var(--ease);
}
.btn:hover { background: var(--c-accent-hover); }
.btn--full { width: 100%; }
.btn--ghost {
  background: var(--c-surface); color: var(--c-accent);
  box-shadow: inset 0 0 0 var(--border-width) var(--c-accent);
}
.btn--ghost:hover { background: var(--c-mint-2); }

/* ═══ announcement ═════════════════════════════════════════════════════════ */

.announce {
  background: var(--c-announce-bg);
  color: var(--c-announce-ink);
  height: var(--h-announce);
  display: grid; place-items: center;
  overflow: hidden;
}
.announce__track { position: relative; width: 100%; }
.announce__item {
  text-align: center;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-caps);
  line-height: var(--h-announce);
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  padding-inline: 1rem;
}
.announce__sep { opacity: 0.5; margin-inline: 0.375rem; }
/* Both halves of a bilingual line do not fit 375px; the English half drops
   rather than being cut off mid-word by the ellipsis. */
@media (max-width: 560px) { .announce__en { display: none; } }

/* ═══ header · search is the primary object ══════════════════════════════ */

.header {
  position: sticky; top: 0; z-index: 90;
  background: var(--c-header-bg);
  color: var(--c-header-ink);
  border-bottom: var(--border-width) solid var(--c-line);
}
/* An opaque ground on every page, not only when floating. */

.header__row {
  display: flex; align-items: center; gap: clamp(0.5rem, 1.6vw, 1.25rem);
  height: var(--h-header);
  width: 100%; max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(0.75rem, 3vw, 2rem);
  transition: height var(--dur) var(--ease);
}

/* The categories button: opens the sidebar as a drawer. Hidden wherever the
   persistent sidebar is already on screen (home + collection at ≥1024px) and
   on phones, where the tab bar's 分类 does the same job. */
.header__cats {
  flex: none;
  display: inline-flex; align-items: center; gap: 0.5rem;
  height: 42px; padding-inline: 0.75rem 0.9375rem;
  border-radius: var(--radius-pill);
  background: var(--c-accent-soft); color: var(--c-accent);
  font-size: var(--fs-small); font-weight: var(--fw-bold);
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.header__cats:hover { background: var(--c-leaf); color: var(--c-ink); }
.header__cats-label span { font-weight: var(--fw-body); opacity: 0.8; }

.header__logo { flex: none; display: block; }
/* Never taller — the header is sticky and the screen is the point. The logo
   height setting re-caps this from transplant.css. */
.header__logo img { height: 44px; width: auto; transition: height var(--dur) var(--ease); }

/* A button dressed as a field: it opens the search panel and focuses its
   input. Text cursor on purpose — the gesture is "tap the field, start
   typing", and that is exactly what happens. */
.hsearch {
  flex: 1 1 auto; min-width: 0;
  position: relative;
  display: flex; align-items: center;
  max-width: 560px;
  height: 42px;
  background: var(--c-surface-2);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-input);
  padding: 0 1rem 0 2.75rem;
  color: var(--c-ink-muted);
  font-size: var(--fs-small);
  text-align: left;
  cursor: text;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.hsearch__icon {
  position: absolute; left: 0.9375rem;
  color: var(--c-ink-subtle);
  pointer-events: none;
}
.hsearch__hint { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hsearch__hint span { color: var(--c-ink-subtle); }
.hsearch:hover,
.hsearch:focus-visible {
  outline: none;
  border-color: var(--c-accent);
  background: var(--c-surface);
}

/* The search field is capped at 560px, so without this the account and cart
   icons sit immediately after it in mid-row instead of on the page's right
   edge — flex leaves the slack at the end of the line rather than inside it. */
.header__tools { flex: none; display: flex; align-items: center; gap: 0.125rem; margin-inline-start: auto; }
.tool {
  position: relative;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: var(--radius-pill);
  color: var(--c-header-ink);
  transition: background var(--dur) var(--ease);
}
.tool:hover { background: var(--c-surface-2); }
.tool__count {
  position: absolute; top: 4px; right: 4px;
  min-width: 17px; height: 17px;
  display: grid; place-items: center;
  padding-inline: 4px;
  background: var(--c-accent); color: var(--c-accent-ink);
  border-radius: var(--radius-pill);
  font-size: 10px; font-weight: var(--fw-bold); line-height: 1;
}
/* the badge hides with [hidden] at zero; an author `display` beats the UA's
   [hidden] rule, so the zero badge would paint anyway. Restate it. */
.tool__count[hidden], .tabbar__count[hidden] { display: none; }

/* stuck: give the screen back (chrome budget) */
.header.is-stuck .header__row  { height: var(--h-header-stuck); }
.header.is-stuck .header__logo img { height: 34px; }

/* ═══ category sidebar ═════════════════════════════════════════════════════
   Categories live in a sidebar, not under the header, at EVERY width:
   - phones + tablets: a narrow sticky rail on the left of the content, under
     the full-width hero (the grocery-app category-page pattern);
   - desktop (≥1024): a sticky white panel beside the whole page (the
     superstore idiom).
   The same list is the slide-in drawer on the product page (and behind the
   tab bar's Categories), rendered from one snippet so they cannot disagree. */

.page--sidebar {
  display: grid;
  grid-template-columns: var(--w-rail) minmax(0, 1fr);
  align-items: start;
}
.page__lead { grid-column: 1 / -1; grid-row: 1; min-width: 0; }
.page__main { grid-column: 2; grid-row: 2; min-width: 0; }
.page--sidebar .sidenav {
  grid-column: 1; grid-row: 2;
  position: sticky; top: var(--h-header-stuck-sm);
  max-height: calc(100dvh - var(--h-header-stuck-sm) - var(--h-tabbar) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  background: var(--c-surface-2);
}
.page--sidebar .sidenav::-webkit-scrollbar { display: none; }
/* a page with the rail on screen does not need the header's button too */
.header--sidebar .header__cats { display: none; }

.sidenav__list { padding-block: 0.25rem; }

/* Rows are tight on purpose: 17 entries have to fit beside a 900px laptop
   screen under the stuck header without the panel scrolling inside itself. */
.sidenav__item, .navdrawer__item {
  display: flex; flex-direction: column; gap: 0;
  min-width: 0;
  padding: 0.3125rem 1rem 0.3125rem calc(1rem - 3px);
  line-height: 1.35;
  border-left: 3px solid transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.sidenav__zh, .navdrawer__zh {
  display: flex; align-items: center; gap: 0.375rem;
  font-size: var(--fs-small); font-weight: var(--fw-bold);
  color: var(--c-ink);
}
.sidenav__en, .navdrawer__en {
  font-size: var(--fs-micro); line-height: 1.3; color: var(--c-ink-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* the rail is 92px wide: the English wraps rather than being cut off, and the
   current row goes white against the rail's grey, the app's own cue */
@media (max-width: 1023px) {
  .page--sidebar .sidenav__item { padding: 0.625rem 0.5rem 0.625rem calc(0.5rem - 3px); }
  .page--sidebar .sidenav__zh { font-size: 0.75rem; flex-wrap: wrap; row-gap: 2px; }
  .page--sidebar .sidenav__en { font-size: 0.625rem; line-height: 1.25; white-space: normal; overflow: visible; }
  .page--sidebar .sidenav__item:hover,
  .page--sidebar .sidenav__item.is-active { background: var(--c-surface); }
}
.sidenav__item:hover, .navdrawer__item:hover { background: var(--c-mint-2); }
.sidenav__item.is-active, .navdrawer__item.is-active {
  background: var(--c-mint-2);
  border-left-color: var(--c-accent);
}
.sidenav__item.is-active .sidenav__zh,
.navdrawer__item.is-active .navdrawer__zh { color: var(--c-accent); }
/* the drawer's rows: a touch taller, with the divider the drawer already had */
.navdrawer__item {
  padding-block: 0.6875rem;
  padding-inline: calc(1.125rem - 3px) 1.125rem;
  border-bottom: var(--border-width) solid var(--c-line);
}

/* ═══ drawers ══════════════════════════════════════════════════════════════ */

/* Open/closed is carried by .is-open, never by [hidden] alone: init.js drops
   the hidden attribute while a drawer is open, so the state class is what
   drives the slide and the scrim. */
.navdrawer, .cart, .searchpanel {
  position: fixed; inset: 0; z-index: 120;
  background: transparent;
  display: flex;
  visibility: hidden;
  pointer-events: none;
  transition: background var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.navdrawer { justify-content: flex-start; }
.cart { justify-content: flex-end; }
.searchpanel { align-items: flex-start; justify-content: center; }
.navdrawer[hidden], .cart[hidden], .searchpanel[hidden] { display: none; }
.navdrawer.is-open, .cart.is-open, .searchpanel.is-open {
  background: var(--c-scrim);
  visibility: visible;
  pointer-events: auto;
}

.navdrawer__panel, .cart__panel {
  background: var(--c-surface);
  width: min(380px, 88vw);
  height: 100%;
  display: flex; flex-direction: column;
  overflow-y: auto;
  transition: transform var(--dur) var(--ease);
}
.navdrawer__panel { transform: translateX(-100%); }
.cart__panel      { transform: translateX(100%); }
.navdrawer.is-open .navdrawer__panel,
.cart.is-open .cart__panel { transform: none; }
.navdrawer__top, .cart__top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.125rem;
  border-bottom: var(--border-width) solid var(--c-line);
}
.navdrawer__title, .cart__title { font-weight: var(--fw-display); font-size: var(--fs-h3); }
.navdrawer__close, .cart__close, .searchpanel__close { color: var(--c-ink); display: grid; place-items: center; width: 36px; height: 36px; }

.navdrawer__list { padding: 0.5rem 0 2rem; }
/* row styles are shared with the sidebar — see "category sidebar" below */

.cart__empty { padding: 2rem 1.125rem; color: var(--c-ink-muted); font-size: var(--fs-small); }
.cart__lines { flex: 1 1 auto; padding: 0.5rem 1.125rem; }
.cart-line {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 0.75rem; align-items: center;
  padding: 0.75rem 0;
  border-bottom: var(--border-width) solid var(--c-line);
}
.cart-line__img { width: 56px; height: 56px; object-fit: contain; background: var(--c-surface-2); border-radius: 8px; }
.cart-line__title { font-size: var(--fs-small); font-weight: var(--fw-bold); }
.cart-line__variant, .cart-line__qty { font-size: var(--fs-micro); color: var(--c-ink-muted); }
.cart-line__price { font-size: var(--fs-small); font-weight: var(--fw-bold); white-space: nowrap; }
.cart-line__remove { color: var(--c-ink-subtle); font-size: var(--fs-micro); text-decoration: underline; }
.cart__foot { padding: 1rem 1.125rem 1.5rem; border-top: var(--border-width) solid var(--c-line); }
.cart__total { display: flex; justify-content: space-between; margin-bottom: 0.75rem; font-size: var(--fs-small); }

.searchpanel__box {
  background: var(--c-surface);
  width: min(680px, 94vw);
  margin-top: clamp(1rem, 8vh, 5rem);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.searchpanel.is-open .searchpanel__box { opacity: 1; transform: none; }
.searchpanel__form {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.875rem 1rem;
  border-bottom: var(--border-width) solid var(--c-line);
  color: var(--c-ink-subtle);
}
.searchpanel__field { flex: 1 1 auto; min-width: 0; border: 0; outline: none; font-size: var(--fs-body); color: var(--c-ink); background: transparent; }
.searchpanel__empty { padding: 1.25rem 1rem; color: var(--c-ink-muted); font-size: var(--fs-small); }
.searchpanel__results { max-height: min(56vh, 420px); overflow-y: auto; }
.search-hit {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 0.75rem; align-items: center;
  padding: 0.625rem 1rem;
  border-bottom: var(--border-width) solid var(--c-line);
}
.search-hit:hover { background: var(--c-mint-2); }
.search-hit__img { width: 44px; height: 44px; object-fit: contain; background: var(--c-surface-2); border-radius: 8px; }
.search-hit__title { font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit__price { font-size: var(--fs-small); font-weight: var(--fw-bold); white-space: nowrap; }

/* ═══ quick view · the card's + opens the buy box, not the cart ════════════ */

/* Same open/closed contract as the other drawers: .is-open carries the state.
   Desktop: a centred dialog, the packshot beside the buy box as on the PDP.
   Phone: a bottom sheet — the grocery-app gesture. The box itself never
   scrolls; the mount does, so the close button stays put. */
.quickview {
  position: fixed; inset: 0; z-index: 120;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  visibility: hidden;
  pointer-events: none;
  transition: background var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.quickview[hidden] { display: none; }
.quickview.is-open { background: var(--c-scrim); visibility: visible; pointer-events: auto; }

.quickview__box {
  position: relative;
  width: min(880px, 100%);
  max-height: min(90vh, 720px);
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--c-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.quickview.is-open .quickview__box { opacity: 1; transform: none; }
.quickview__mount { min-height: 0; overflow-y: auto; }
.quickview__close {
  position: absolute; top: 0.625rem; right: 0.625rem; z-index: 2;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  background: var(--c-surface); color: var(--c-ink);
  box-shadow: var(--shadow-card);
  transition: background var(--dur) var(--ease);
}
.quickview__close:hover { background: var(--c-mint-2); }

/* The body: the PDP buy box in miniature, same swatch / qty / button parts. */
.qv { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.qv__media {
  display: grid; place-items: center;
  background: var(--c-surface-2);
}
.qv__media img {
  width: 100%; aspect-ratio: 1 / 1;
  object-fit: contain;
  padding: 8%;
  mix-blend-mode: multiply;
}
.qv__info {
  min-width: 0;
  display: flex; flex-direction: column;
  padding: 1.75rem 1.75rem 1.5rem;
}
.qv__title {
  padding-right: 2.5rem;              /* clear of the close button */
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-display);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-display);
}
.qv__price {
  margin-top: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-display);
  line-height: 1.2;
  letter-spacing: var(--tracking-display);
}
.qv__info .pdp__axis { margin-top: 1.125rem; }
.qv__variants .swatches { max-height: 13.5rem; }
.qv__buy {
  position: sticky; bottom: 0;        /* reachable under a long swatch list */
  display: flex; gap: 0.625rem;
  padding-block: 0.125rem 0.75rem;
  background: var(--c-surface);
}
.qv__more {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 0.375rem;
  margin-top: 0.25rem;
  font-size: var(--fs-small); font-weight: var(--fw-bold);
  color: var(--c-accent);
  text-decoration: underline; text-underline-offset: 0.2em;
}
.qv__more:hover { color: var(--c-accent-hover); }

@media (max-width: 767px) {
  .quickview { align-items: flex-end; padding: 0; }
  .quickview__box {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    transform: translateY(100%);
    opacity: 1;
  }
  .qv { grid-template-columns: minmax(0, 1fr); }
  /* Flex, not grid: an auto grid row sizes to the packshot's intrinsic square
     (375px) and overflows the band; a flex item's height:100% resolves against
     the band's definite height and stays inside it. */
  .qv__media { display: flex; justify-content: center; align-items: center; height: clamp(160px, 44vw, 220px); }
  .qv__media img { width: auto; height: 100%; max-height: 100%; padding: 6%; }
  .qv__info { padding: 1.125rem 1rem calc(0.75rem + env(safe-area-inset-bottom)); }
  .qv__title { padding-right: 0; }
  .qv__buy { padding-bottom: 0.5rem; }
}

/* ═══ hero · compact band, copy on the content edge ═══════════════════════
   Eyebrow, a one-line title, the search field and one figure — nothing else —
   so the products sit in the fold. Under 768px the band is in FLOW (copy
   left, a 128px figure right, no ratio); from 768px it keeps the absolute
   layout inside a 5:1 band. */

.hero {
  position: relative;
  /* width is pinned so `aspect-ratio` can only resolve the HEIGHT (768+). */
  width: 100%;
  background-color: var(--c-accent);
  background-image: radial-gradient(120% 140% at 88% 30%, var(--c-hero-edge) 0%, var(--c-accent) 58%);
  /* both painted: the colour is the fallback under the gradient */
  color: var(--c-accent-ink);
  overflow: hidden;
}
.hero__inner {
  position: relative;
  display: flex; align-items: center; gap: 0.5rem;
  padding-block: 1rem;
}
.hero__copy {
  position: relative; z-index: 2;
  flex: 1 1 auto; min-width: 0;
  max-width: 30rem;
}
.hero__eyebrow {
  display: inline-block;
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  color: var(--c-accent-soft);
  margin-bottom: 0.5rem;
}
.hero__title {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: var(--fw-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
  margin-bottom: 0.875rem;
}
/* inline-block so the second phrase wraps as a unit on a phone ("中国超市" /
   "送到你家门口"), never "送到你家" / "门口" */
.hero__title span { color: var(--c-leaf); display: inline-block; }

/* A button dressed as a field, like .hsearch: it opens the search panel. */
.herosearch {
  position: relative;
  display: flex; align-items: center;
  width: 100%; max-width: 26rem; height: 44px;
  background: var(--c-surface); color: var(--c-ink-muted);
  border: 0; border-radius: var(--radius-input);
  padding: 0 3.25rem 0 2.875rem;
  font-size: var(--fs-small);
  text-align: left;
  cursor: text;
}
.herosearch__icon { position: absolute; left: 1rem; color: var(--c-ink-subtle); pointer-events: none; }
.herosearch__hint { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.herosearch__hint span { color: var(--c-ink-subtle); }
.herosearch:focus-visible { outline: 2px solid var(--c-leaf); outline-offset: 2px; }
.herosearch__go {
  position: absolute; right: 4px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--c-accent); color: var(--c-accent-ink);
  border-radius: var(--radius-pill);
  pointer-events: none;
}

/* The figure at its own 1:1 ratio, never cropped. Under 768px it is a flex
   item beside the copy; from 768px the art layer is absolute and the figure
   hangs off the band's right edge at the band's full height. */
.hero__art {
  position: relative; z-index: 1;
  flex: none;
  width: 128px; height: 128px;
  pointer-events: none;
}
.hero__figure { position: absolute; inset: 0; }
.hero__mascot {
  position: absolute;
  right: 0; bottom: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: right bottom;
}
/* Packshot links around the figure are not shown in the compact band: at
   ~200px they would be 26px tiles. */
.hero__packshot { display: none; }

/* ═══ benefit strip · welded flush under the hero ══════════════════════════ */

.benefits {
  background: var(--c-mint-2);
  border-bottom: var(--border-width) solid var(--c-line);
}
.benefits__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  padding-block: 0.9375rem;
}
.benefit {
  display: flex; align-items: center; gap: 0.625rem;
  min-width: 0;
}
.benefit__icon { color: var(--c-accent); flex: none; }
.benefit strong { display: block; font-size: var(--fs-small); font-weight: var(--fw-bold); color: var(--c-ink); }
.benefit span { display: block; font-size: var(--fs-micro); color: var(--c-ink-muted); }

/* ═══ sections ═════════════════════════════════════════════════════════════ */

/* The header is sticky, so anything scrolled to by anchor lands underneath it
   without this. 110px clears the announce + header row at rest. */
.section, .section__head, .chead, .pdp, .crumb { scroll-margin-top: 110px; }

.section { padding-block: var(--section-y) 0; }
.section:last-of-type { padding-bottom: var(--section-y); }
/* the first section sits right under the hero block: a tighter gap, so the
   products are in the fold */
.page__main > .section:first-child { padding-top: var(--section-y-tight); }

.section__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.125rem;
}
.section__title {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-display);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-display);
}
.section__title span {
  display: block;
  font-size: var(--fs-small);
  font-weight: var(--fw-body);
  letter-spacing: 0;
  color: var(--c-ink-muted);
}
.section__all {
  flex: none;
  display: inline-flex; align-items: center; gap: 0.3125rem;
  font-size: var(--fs-small); font-weight: var(--fw-bold);
  color: var(--c-accent);
  padding-bottom: 0.125rem;
  border-bottom: 2px solid var(--c-accent-soft);
  transition: border-color var(--dur) var(--ease);
}
.section__all:hover { border-color: var(--c-accent); }

.railctl { flex: none; display: flex; gap: 0.375rem; }
.railbtn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  background: var(--c-surface-2); color: var(--c-ink);
  transition: background var(--dur) var(--ease);
}
.railbtn:hover { background: var(--c-accent-soft); }

.railhost { position: relative; }
.rail {
  display: flex; gap: var(--gutter-lg);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { flex: none; scroll-snap-align: start; }

.raildots {
  display: flex; gap: 0.375rem; justify-content: center;
  margin-top: 0.875rem;
}
.raildots button {
  width: 7px; height: 7px;
  border-radius: var(--radius-pill);
  background: var(--c-line);
  transition: background var(--dur) var(--ease), width var(--dur) var(--ease);
}
.raildots button.is-active { background: var(--c-accent); width: 20px; }

/* ── category tiles · the "shop by category" rail ─────────────────────────────
   Round packshot tiles with the category name centred beneath, in a
   horizontally-scrolling rail (sections/collection-list). */

.cat { width: clamp(96px, 12vw, 132px); }
.cat__link { display: grid; gap: 0.4375rem; justify-items: center; text-align: center; }
.cat__media {
  display: grid; place-items: center;
  width: clamp(78px, 10vw, 108px);
  aspect-ratio: 1 / 1;
  background: var(--c-mint-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  transition: background var(--dur) var(--ease);
}
.cat__media img {
  width: 74%; height: 74%;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.cat__link:hover .cat__media { background: var(--c-accent-soft); }
.cat__zh { font-size: var(--fs-small); font-weight: var(--fw-bold); line-height: 1.25; }
.cat__en { font-size: var(--fs-micro); color: var(--c-ink-muted); line-height: 1.2; }

/* ── brands · packshot tiles ─────────────────────────────────────────────── */

.brand { width: clamp(120px, 14vw, 168px); }
.brand__link { display: grid; gap: 0.5rem; justify-items: center; text-align: center; }
.brand__media {
  display: grid; place-items: center;
  width: 100%; aspect-ratio: 4 / 3;
  background: var(--c-surface-2);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.brand__media img { width: 76%; height: 76%; object-fit: contain; mix-blend-mode: multiply; }
.brand__label { font-size: var(--fs-small); font-weight: var(--fw-bold); }
/* brands is no longer the last section; the promo band is, and
   .section:last-of-type pads it */

/* ═══ the product card · the grocery-app tile ══════════════════════════════ */

.grid {
  display: grid;
  /* minmax(0,1fr), never bare 1fr — a fixed column count of bare tracks cannot
     shrink below min-content and a cell escapes the container silently. */
  grid-template-columns: repeat(var(--grid-cols-sm), minmax(0, 1fr));
  gap: 1.25rem var(--gutter);
}

/* a column, so the add button can sit at the foot: a grid row stretches every
   tile to the tallest one, and the button's margin-top: auto lines the row up */
.card { position: relative; min-width: 0; display: flex; flex-direction: column; }

.card__media {
  position: relative;
  aspect-ratio: var(--card-ratio);
  background: var(--c-surface-2);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.card__media img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 8%;
  /* packshots are usually cut out on white; multiply drops that ground into
     the tile so the card reads as one shape rather than two */
  mix-blend-mode: multiply;
  transition: scale var(--dur) var(--ease);
}
.card__link:hover .card__media img { scale: 1.04; }

/* The badge is a STATUS slot: "Sold out", or nothing. Never a variant count,
   never a purchase counter. */
.card__badge {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--c-ink);
  color: var(--c-surface);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-align: center;
  padding-block: 0.3125rem;
}

/* "Add to cart" in words, on a rectangle across the foot of the tile — shoppers
   did not read the reference's round + on the packshot as an add button. Always
   visible, never hover-revealed (a hover-only control is unreachable on touch),
   and outside both links, because a <button> may not live inside an <a>. */
.card__add {
  display: flex; align-items: center; justify-content: center; gap: 0.375rem;
  width: 100%; min-height: 2.25rem;
  padding: 0.4375rem 0.5rem;
  background: var(--c-accent); color: var(--c-accent-ink);
  border-radius: 8px;
  font-size: var(--fs-small); font-weight: var(--fw-bold); line-height: 1.2;
  transition: background var(--dur) var(--ease);
}
.card__add .icon { width: 1rem; height: 1rem; stroke-width: 2; }
.card__addlabel { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__add:hover { background: var(--c-accent-hover); }
.card__add:disabled { background: var(--c-surface-2); color: var(--c-ink-subtle); cursor: not-allowed; }

.card.is-sold .card__media img { opacity: 0.42; }

.card__body { display: block; margin-top: 0.5rem; }
.card__price {
  font-size: var(--fs-h3);
  font-weight: var(--fw-display);
  line-height: 1.2;
  letter-spacing: var(--tracking-display);
}
.card__from { font-size: var(--fs-micro); font-weight: var(--fw-body); color: var(--c-ink-muted); }
.card__title {
  margin-top: 0.1875rem;
  font-size: var(--fs-small);
  line-height: 1.32;
  color: var(--c-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__size { margin-top: 0.125rem; font-size: var(--fs-micro); color: var(--c-ink-subtle); }

/* ═══ promo tiles · the one loud accent, spent once ════════════════════════ */

.promo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gutter-lg);
}
.promo__tile {
  position: relative;
  display: flex; flex-direction: column; gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-card);
  overflow: hidden;
  min-width: 0;
}
.promo__tile--box { background: var(--c-pop); color: var(--c-pop-ink); }
.promo__flag {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: var(--c-accent); color: var(--c-accent-ink);
  font-size: var(--fs-micro); font-weight: var(--fw-bold);
  padding: 0.1875rem 0.5rem;
  border-radius: var(--radius-pill);
}
.promo__media {
  display: grid; place-items: center;
  aspect-ratio: 16 / 10;
  background: var(--c-surface);
  border-radius: 10px;
  overflow: hidden;
}
.promo__media img { width: 68%; height: 78%; object-fit: contain; mix-blend-mode: multiply; }
.promo__text { display: block; min-width: 0; }
.promo__text strong { display: block; font-size: var(--fs-h3); font-weight: var(--fw-display); }
.promo__en { display: block; font-size: var(--fs-small); }
.promo__note { display: block; margin-top: 0.25rem; font-size: var(--fs-micro); opacity: 0.75; }

.promo__tile--chat {
  grid-column: span 2;
  flex-direction: row; align-items: center; justify-content: space-between;
  gap: 1rem;
  background: var(--c-accent); color: var(--c-accent-ink);
}
.promo__tile--chat .promo__note { opacity: 0.8; }
.promo__qr {
  flex: none;
  /* The file is 1460x751 carrying TWO codes side by side, so the rendered
     height is roughly the size of each individual code. Below ~120px a phone
     camera cannot lock on and the tile becomes a picture of a control rather
     than a control. */
  height: clamp(120px, 15vw, 152px); width: auto;
  border-radius: 8px;
  background: var(--c-surface);
  padding: 8px;
}

/* ═══ collection page ══════════════════════════════════════════════════════ */

.crumb {
  display: flex; align-items: center; gap: 0.375rem;
  padding-block: 0.875rem 0;
  font-size: var(--fs-micro);
  color: var(--c-ink-muted);
}
.crumb a:hover { color: var(--c-accent); }
.crumb .icon { color: var(--c-ink-subtle); }

.chead { padding-block: 1.25rem 0.875rem; }
.chead__title {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: var(--fw-display);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-display);
}
.chead__title span { display: block; font-size: var(--fs-h3); font-weight: var(--fw-body); color: var(--c-ink-muted); }
.chead__blurb { margin-top: 0.625rem; max-width: var(--container-narrow); font-size: var(--fs-small); color: var(--c-ink-muted); }
.chead__blurb span { color: var(--c-ink-subtle); }

.cbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding-block: 0.75rem;
  margin-bottom: 1rem;
  border-block: var(--border-width) solid var(--c-line);
}
.cbar__count { font-size: var(--fs-small); font-weight: var(--fw-bold); }
.cbar__count span { font-weight: var(--fw-body); color: var(--c-ink-muted); }
.cbar__tools { display: flex; gap: 0.5rem; }
.cbar__btn {
  display: inline-flex; align-items: center; gap: 0.375rem;
  height: 34px; padding-inline: 0.75rem;
  background: var(--c-surface-2);
  border-radius: var(--radius-pill);
  font-size: var(--fs-small); font-weight: var(--fw-bold);
  transition: background var(--dur) var(--ease);
}
.cbar__btn:hover { background: var(--c-accent-soft); }

.cmore { padding-block: 2rem 3rem; text-align: center; }

/* ═══ product page ═════════════════════════════════════════════════════════ */

.pdp {
  display: grid;
  /* minmax(0, 1fr), NOT an implicit auto column. A grid with no template gets
     one `auto` track, which sizes to MAX-CONTENT — and the widest child here is
     the 8-thumb gallery row at 568px. `overflow-x: auto` on that row does not
     reduce its max-content contribution, so the single column grew to 568px and
     dragged the stage, the info panel, the swatches and the buy row off the
     right edge of every phone. The ≥768px rule below already sets an explicit
     minmax(0,1fr) template, which is why this only ever broke on mobile. */
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  padding-block: 1rem 0.5rem;
}

.pdp__stage {
  aspect-ratio: 1 / 1;
  background: var(--c-surface-2);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: grid; place-items: center;
}
.pdp__stage img { width: 100%; height: 100%; object-fit: contain; padding: 7%; mix-blend-mode: multiply; }

.pdp__thumbs { display: flex; gap: 0.5rem; margin-top: 0.625rem; overflow-x: auto; scrollbar-width: none; }
.pdp__thumbs::-webkit-scrollbar { display: none; }
.pdp__thumb {
  flex: none;
  width: 64px; aspect-ratio: 1 / 1;
  background: var(--c-surface-2);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px transparent;
  transition: box-shadow var(--dur) var(--ease);
}
.pdp__thumb img { width: 100%; height: 100%; object-fit: contain; padding: 8%; mix-blend-mode: multiply; }
.pdp__thumb.is-active { box-shadow: inset 0 0 0 2px var(--c-accent); }

.pdp__vendor {
  font-size: var(--fs-micro); font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  color: var(--c-accent);
}
.pdp__title {
  margin-top: 0.375rem;
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: var(--fw-display);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-display);
}
.pdp__title span { display: block; font-size: var(--fs-h3); font-weight: var(--fw-body); color: var(--c-ink-muted); }

.pdp__price {
  margin-top: 0.875rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: var(--fw-display);
  letter-spacing: var(--tracking-display);
  display: flex; align-items: baseline; gap: 0.625rem;
}
.pdp__was { font-size: var(--fs-body); font-weight: var(--fw-body); color: var(--c-ink-subtle); }
.pdp__save {
  font-size: var(--fs-micro); font-weight: var(--fw-bold);
  background: var(--c-pop); color: var(--c-pop-ink);
  padding: 0.1875rem 0.5rem; border-radius: var(--radius-pill);
}


.pdp__variants { margin-top: 1.25rem; }
.pdp__axis {
  font-size: var(--fs-micro); font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  color: var(--c-ink-muted);
  margin-bottom: 0.5rem;
}
.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 0.5rem;
  max-height: 20.5rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.swatch {
  display: grid; gap: 0.25rem; justify-items: center;
  padding: 0.375rem 0.25rem 0.4375rem;
  background: var(--c-surface);
  border-radius: 10px;
  box-shadow: inset 0 0 0 var(--border-width) var(--c-line);
  transition: box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.swatch__img { width: 42px; height: 42px; object-fit: contain; mix-blend-mode: multiply; }
.swatch__label {
  font-size: var(--fs-micro); line-height: 1.2; text-align: center;
  color: var(--c-ink-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.swatch:hover { box-shadow: inset 0 0 0 var(--border-width) var(--c-accent); }
.swatch.is-selected {
  box-shadow: inset 0 0 0 2px var(--c-accent);
  background: var(--c-mint-2);
}
.swatch.is-selected .swatch__label { color: var(--c-ink); font-weight: var(--fw-bold); }
.swatch.is-out { opacity: 0.42; }
.swatch.is-out .swatch__img { filter: grayscale(1); }

.pdp__buy { display: flex; gap: 0.625rem; margin-top: 1.25rem; }
.qty {
  flex: none;
  display: flex; align-items: center;
  background: var(--c-surface-2);
  border-radius: var(--radius-pill);
  padding: 0.25rem;
}
.qty__btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  color: var(--c-ink);
  transition: background var(--dur) var(--ease);
}
.qty__btn:hover { background: var(--c-surface); }
.qty__input {
  width: 34px; text-align: center;
  background: transparent; border: 0; outline: none;
  font-size: var(--fs-small); font-weight: var(--fw-bold);
  -moz-appearance: textfield;
}
.qty__input::-webkit-outer-spin-button,
.qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.btn--buy { flex: 1 1 auto; height: 50px; font-size: var(--fs-body); }
.btn--buy:disabled { background: var(--c-ink-subtle); cursor: not-allowed; }

.pdp__meta { margin-top: 1.25rem; display: grid; gap: 0.4375rem; }
.pdp__meta p {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: var(--fs-small); color: var(--c-ink-muted);
}
.pdp__meta .icon { color: var(--c-accent); }

/* ═══ footer ═══════════════════════════════════════════════════════════════ */

.footer { background: var(--c-footer-bg); color: var(--c-footer-ink); margin-top: var(--section-y); }
.footer__top {
  display: grid;
  gap: 1.75rem;
  padding-block: 2.25rem 1.75rem;
}
.footer__logo {
  height: 46px; width: auto;
  background: var(--c-surface);
  border-radius: 8px;
  padding: 5px 8px;
  /* an opaque light JPG: give it its own white plate, never invert it */
}
.footer__blurb { margin-top: 0.75rem; font-size: var(--fs-small); max-width: 22rem; opacity: 0.86; }
.footer__h { font-size: var(--fs-micro); font-weight: var(--fw-bold); letter-spacing: var(--tracking-caps); margin-bottom: 0.75rem; }
.footer__list { display: grid; gap: 0.4375rem; }
.footer__list a { font-size: var(--fs-small); opacity: 0.86; }
.footer__list a:hover { opacity: 1; text-decoration: underline; }
.footer__note { font-size: var(--fs-small); margin-bottom: 0.75rem; }
.footer__note span { opacity: 0.75; font-size: var(--fs-micro); }
.footer__qr { height: 132px; width: auto; background: var(--c-surface); border-radius: 8px; padding: 8px; }

.footer__bottom {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-block: 1rem 1.75rem;
  border-top: var(--border-width) solid rgb(255 255 255 / 0.14);
  font-size: var(--fs-micro);
}
.footer__legal { display: flex; gap: 1rem; }
.footer__legal a { opacity: 0.8; }
.footer__legal a:hover { opacity: 1; text-decoration: underline; }

/* ═══ phone tab bar ════════════════════════════════════════════════════════
   Sticky at the foot of the screen under 768px; the cart is the rightmost
   item. Home / Categories / Account / Cart — Categories opens the category
   drawer and the cart opens the cart drawer, both through [data-drawer-open].
   The header's account and cart icons hide at that width so nothing is on
   screen twice; the header keeps the search field, which the tab bar
   deliberately does not repeat. */

.tabbar { display: none; }

/* ═══ breakpoints ══════════════════════════════════════════════════════════ */

/* ── narrow: the app layout. logo + search pill in one row, the tab bar at
      the foot, three products across. ────────────────────────────────────── */
@media (max-width: 767px) {
  /* one row: logo + search field. Account and cart moved to the tab bar, the
     categories button to its 分类, so the header gives the screen back. */
  .header__row { height: var(--h-header-sm); gap: 0.625rem; }
  .header__cats { display: none; }
  .header__tools { display: none; }
  .header__logo { flex: none; }
  .header__logo img { height: 30px; }
  .hsearch { max-width: none; height: 38px; padding-left: 2.5rem; }
  .hsearch__icon { left: 0.8125rem; }
  .hsearch__hint span { display: none; }   /* the Chinese label is enough at 375px */
  .header.is-stuck .header__row { height: var(--h-header-stuck-sm); }
  .header.is-stuck .header__logo img { height: 24px; }
  .header.is-stuck .hsearch { height: 34px; }

  /* the tab bar, and the room it needs under the last section */
  body { padding-bottom: calc(var(--h-tabbar) + env(safe-area-inset-bottom, 0px)); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(var(--h-tabbar) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--c-surface);
    border-top: var(--border-width) solid var(--c-line);
    box-shadow: var(--shadow-tabbar);
  }
  .tabbar__item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-width: 0;
    color: var(--c-ink-muted);
    font-size: var(--fs-micro); font-weight: var(--fw-bold); line-height: 1.1;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--dur) var(--ease);
  }
  .tabbar__item .icon { width: 22px; height: 22px; }
  .tabbar__label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* beside a 92px rail the column is ~270px: two cards across, not three, and
     the count / filter / sort bar stacks instead of wrapping "Sort" mid-word */
  .page--sidebar .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page--sidebar .cbar { flex-direction: column; align-items: flex-start; gap: 0.625rem; }
  .page--sidebar .cbar__btn { white-space: nowrap; }
  .tabbar__item.is-active { color: var(--c-accent); }
  .tabbar__icon { position: relative; display: grid; place-items: center; }
  .tabbar__count {
    position: absolute; top: -5px; right: -9px;
    min-width: 16px; height: 16px;
    display: grid; place-items: center;
    padding-inline: 4px;
    background: var(--c-accent); color: var(--c-accent-ink);
    border-radius: var(--radius-pill);
    font-size: 10px; font-weight: var(--fw-bold); line-height: 1;
  }

  /* Compact hero: the band is in flow (see the hero rules), so it is only as
     tall as eyebrow + title + search — about 170px — and the figure is a
     128px figure beside the copy. */
  .hero__title { margin-bottom: 0.75rem; }
  .herosearch__hint span { display: none; }   /* the Chinese label is enough at 375px */

  /* benefits: one scrolling row, not a 2×2 block — ~60px instead of ~150, so
     the products are in the fold under the tab bar */
  .benefits__list { display: flex; gap: 1.25rem; overflow-x: auto; padding-block: 0.75rem; scrollbar-width: none; }
  .benefits__list::-webkit-scrollbar { display: none; }
  .benefit { flex: none; }

  .promo { grid-template-columns: minmax(0, 1fr); }
  .promo__tile--chat { grid-column: auto; flex-direction: column; align-items: flex-start; }

  .footer__top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer__brand { grid-column: span 2; }
  .footer__col--contact { grid-column: span 2; }
}

/* very narrow: three across still, but the type has to come down with it */
@media (max-width: 400px) {
  .card__price { font-size: var(--fs-small); }
  .card__title { font-size: var(--fs-micro); }
  .card__size { font-size: 10px; }
  .grid { gap: 1rem 0.5rem; }
}

@media (min-width: 768px) {
  .grid { grid-template-columns: repeat(var(--grid-cols-md), minmax(0, 1fr)); gap: 1.75rem var(--gutter-lg); }
  /* no tab bar from here: the rail sticks under the two-row header */
  .page--sidebar .sidenav { top: var(--h-header-stuck); max-height: calc(100dvh - var(--h-header-stuck)); }
  .benefits__list { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-block: 1.125rem; }
  .promo { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .promo__tile--chat { grid-column: auto; flex-direction: column; align-items: flex-start; justify-content: center; }
  .promo__qr { height: clamp(120px, 13vw, 148px); }
  .hero { aspect-ratio: var(--hero-ratio-lg); min-height: 190px; }
  .hero__inner { position: absolute; inset: 0; padding-block: 0; }
  .hero__art { position: absolute; inset: 0; width: auto; height: auto; overflow: hidden; }
  .hero__figure {
    inset: auto;
    right: clamp(-1rem, 2vw, 3rem);
    bottom: -3%;
    height: 100%;
    aspect-ratio: 1 / 1;
  }
  .herosearch { height: 50px; }
  .herosearch__go { right: 5px; width: 40px; height: 40px; }
  .pdp { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
  .footer__top { grid-template-columns: 1.4fr 1fr 1fr 1.1fr; }
}

@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(var(--grid-cols-lg), minmax(0, 1fr)); }

  /* ── the desktop sidebar layout: home + collection. The sticky category
        panel spans lead + main on the left; the page sits in the column beside
        it. The column IS the container now, so nested .wrap adds nothing; the
        hero becomes a rounded band welded to the benefit strip as one block. */
  .page--sidebar {
    grid-template-columns: var(--w-sidenav) minmax(0, 1fr);
    column-gap: var(--gutter-lg);
    width: 100%; max-width: var(--container);
    margin-inline: auto;
    padding-inline: clamp(0.75rem, 3vw, 2rem);
    padding-top: var(--gutter-lg);
  }
  .page__lead { grid-column: 2; grid-row: 1; }
  .page__main { grid-column: 2; grid-row: 2; }
  .page--sidebar .sidenav {
    grid-column: 1; grid-row: 1 / span 2;
    top: calc(var(--h-header-stuck) + var(--gutter-lg));
    max-height: calc(100dvh - var(--h-header-stuck) - var(--gutter-lg) * 2);
    background: var(--c-surface);
    border: var(--border-width) solid var(--c-line);
    border-radius: var(--radius-card);
  }
  .page--sidebar :is(.page__lead, .page__main) .wrap { padding-inline: 0; max-width: none; }
  .page--sidebar .hero { border-radius: var(--radius-card) var(--radius-card) 0 0; }
  .page--sidebar .page__lead .hero__inner { padding-inline: clamp(1.25rem, 2.6vw, 2.25rem); }
  .page--sidebar .benefits {
    border: var(--border-width) solid var(--c-line); border-top: 0;
    border-radius: 0 0 var(--radius-card) var(--radius-card);
  }
  .page--sidebar .page__lead .benefits__list { padding-inline: clamp(1.25rem, 2.6vw, 2.25rem); }
  /* the column is ~950px at 1280: three cards, not four squeezed to 225px */
  .page--sidebar .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pdp { grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr); gap: 3rem; padding-block: 1.5rem 1rem; }
  .pdp__thumb { width: 72px; }
}

/* From 1400 the column beside the sidebar is wide enough for four cards. */
@media (min-width: 1400px) {
  .page--sidebar .grid { grid-template-columns: repeat(var(--grid-cols-lg), minmax(0, 1fr)); }
}

/* Wide and short: cap a full-bleed hero with an explicit height. `max-height`
   on an element with `aspect-ratio` shrinks the WIDTH instead, which stops a
   full-bleed band short of the right edge. The sidebar pages' hero lives in a
   column capped by the container, so it never needs this; a homepage with the
   sidebar switched off keeps the band compact. */
@media (min-width: 1500px) {
  main:not(:has(.page--sidebar)) .hero { aspect-ratio: auto; height: clamp(260px, 16vw, 320px); }
}

/* ── entrance animation, scoped so a JS failure degrades to "no animation"
      rather than "no content" ───────────────────────────────────────────── */
.dinomart-js [data-reveal] {
  opacity: 0;
  translate: 0 14px;
  transition: opacity 420ms var(--ease), translate 420ms var(--ease);
}
.dinomart-js [data-reveal].is-visible { opacity: 1; translate: 0 0; }

html.dinomart-locked { overflow: hidden; }
