/* ============================================================
   Apna Bazaar — storefront styles
   Tokens → layout → components. Light + dark themes.
   ============================================================ */

:root {
  --brand:        #1f8a4c;
  --brand-dark:   #17703d;
  --brand-soft:   #e8f6ee;
  --accent:       #ff6b35;
  --accent-soft:  #fff1ea;

  --bg:           #f6f7f5;
  --surface:      #ffffff;
  --surface-2:    #fafbfa;
  --border:       #e4e7e3;
  --border-strong:#cfd4cc;

  --text:         #15211a;
  --text-2:       #5b6961;
  --text-3:       #8b9790;

  --star:         #f5a524;
  --danger:       #d92d20;

  --shadow-sm: 0 1px 2px rgba(21, 33, 26, .06);
  --shadow:    0 4px 14px rgba(21, 33, 26, .08);
  --shadow-lg: 0 18px 44px rgba(21, 33, 26, .16);

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --r-pill: 999px;

  --header-h: 68px;
  --maxw: 1360px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --brand:        #35c46f;
  --brand-dark:   #2aa85c;
  --brand-soft:   #16281d;
  --accent:       #ff8354;
  --accent-soft:  #2a1810;

  --bg:           #0e1310;
  --surface:      #161d18;
  --surface-2:    #1b231d;
  --border:       #29332b;
  --border-strong:#3a473d;

  --text:         #e9efea;
  --text-2:       #9fb0a5;
  --text-3:       #71837a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 4px 14px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.shell { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- Announcement bar ---------------- */

.announce {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .01em;
}
.announce__inner {
  position: relative;
  height: 34px; overflow: hidden;
}
/* Each line is stacked and cross-faded, so one message shows at a time —
   which is also what makes this work on a narrow phone. */
.announce__item {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px; text-align: center;
  opacity: 0; transform: translateY(7px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
  pointer-events: none;
}
.announce__item.is-on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .announce__item { transition: none; transform: none; }
}

/* ---------------- Header ---------------- */

.header {
  position: sticky; top: 0; z-index: 60;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header__inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
}

.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo__mark {
  width: 38px; height: 38px; border-radius: 11px;
  /* The mark is navy+green on white, so it needs a light tile to sit on —
     including on the dark footer band, where it reads as a badge. */
  background: #fff;
  border: 1px solid var(--border);
  display: grid; place-items: center;
  overflow: hidden; flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.logo__mark img { width: 100%; height: 100%; object-fit: contain; padding: 2px; display: block; }
.footer .logo__mark { border-color: rgba(255,255,255,.25); }
.logo__text { display: none; line-height: 1.15; }
@media (min-width: 640px) { .logo__text { display: block; } }
.logo__name { font-weight: 750; font-size: 17px; letter-spacing: -.02em; }
.logo__tag { font-size: 11px; color: var(--text-3); font-weight: 500; }

.locate {
  display: none; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  flex-shrink: 0; transition: border-color .15s var(--ease);
}
.locate:hover { border-color: var(--border-strong); }
@media (min-width: 1080px) { .locate { display: flex; } }
.locate__label { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.locate__value { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 5px; }

.search { position: relative; flex: 1; min-width: 0; }
.search__field {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.search__field:focus-within { border-color: var(--brand); background: var(--surface); }
.search input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 14.5px;
}
.search input::placeholder { color: var(--text-3); }
.search__clear {
  color: var(--text-3); font-size: 17px; line-height: 1; padding: 4px;
  border-radius: 50%; display: grid; place-items: center;
}
.search__clear:hover { color: var(--text); background: var(--border); }

.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 70;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  max-height: 380px; overflow-y: auto; padding: 6px;
}
.suggest__item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 10px; border-radius: var(--r-sm); text-align: left;
}
.suggest__item:hover, .suggest__item[aria-selected="true"] { background: var(--surface-2); }
.suggest__thumb {
  position: relative; overflow: hidden;
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: grid; place-items: center; font-size: 20px; flex-shrink: 0;
}
.suggest__name { font-size: 13.5px; font-weight: 600; }
.suggest__meta { font-size: 11.5px; color: var(--text-3); }
.suggest__price { margin-left: auto; font-size: 13.5px; font-weight: 700; }
.suggest__empty { padding: 22px; text-align: center; color: var(--text-3); font-size: 13.5px; }

.header__actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.icon-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: var(--r-sm);
  display: grid; place-items: center; font-size: 18px;
  color: var(--text-2);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.pip {
  position: absolute; top: 3px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
  border: 2px solid var(--surface);
  transform: scale(0); transition: transform .22s var(--ease);
}
.pip.is-on { transform: scale(1); }

.cart-btn {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  height: 40px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--brand); color: #fff; font-weight: 650; font-size: 14px;
  transition: background .15s var(--ease), transform .12s var(--ease);
}
.cart-btn:hover { background: var(--brand-dark); }
.cart-btn:active { transform: scale(.97); }
.cart-btn__total { display: none; }
@media (min-width: 760px) { .cart-btn__total { display: inline; } }
.cart-btn .pip { border-color: var(--brand); background: var(--accent); }

/* ---------------- Category rail ---------------- */

.catbar {
  position: sticky; top: var(--header-h); z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.catbar__scroll {
  display: flex; gap: 8px; padding: 11px 0;
  overflow-x: auto; scrollbar-width: none;
}
.catbar__scroll::-webkit-scrollbar { display: none; }
.chip {
  display: flex; align-items: center; gap: 7px; flex-shrink: 0;
  padding: 8px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 13.5px; font-weight: 600; color: var(--text-2); white-space: nowrap;
  transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--brand); color: var(--text); }
.chip.is-active {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.chip__n { font-size: 11px; opacity: .7; font-weight: 600; }

/* ---------------- Hero ---------------- */

.hero { padding: 24px 0 6px; }
.hero__grid {
  display: grid; gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) { .hero__grid { grid-template-columns: 1.65fr 1fr; } }
@media (max-width: 899px) { .hero__side { grid-template-rows: none; } .promo--photo { min-height: 120px; } }

.hero__main {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  padding: 38px 32px;
  /* Gradient stays as the base: it shows before the video loads, on mobile,
     and whenever video is deliberately skipped. */
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,107,53,.28), transparent 55%),
    linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  isolation: isolate;
}

/* ---- hero video layer ---- */
.hero__video { position: absolute; inset: 0; z-index: 0; }
.hero__vid {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.1s var(--ease);
}
.hero__vid.is-on { opacity: 1; }
/* Scrim keeps the headline readable over any frame of either clip. */
.hero__main::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(100deg, rgba(9,32,20,.90) 0%, rgba(9,32,20,.72) 42%, rgba(9,32,20,.42) 100%),
    linear-gradient(180deg, rgba(9,32,20,.25), rgba(9,32,20,.55));
}
.hero__inner { position: relative; z-index: 2; }

/* ---- photo promo cards ---- */
.hero__side { display: grid; gap: 12px; grid-template-rows: repeat(3, 1fr); }

.promo--photo {
  position: relative; overflow: hidden;
  display: flex; align-items: flex-end;
  min-height: 104px; padding: 0; border: 0;
  border-radius: var(--r-lg);
  color: #fff; isolation: isolate;
}
.promo--photo::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background-image: var(--promo-img);
  background-size: cover; background-position: center;
  transform: scale(1.03);
  transition: transform .5s var(--ease);
}
.promo--photo::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(9,26,17,.18) 0%, rgba(9,26,17,.58) 55%, rgba(9,26,17,.92) 100%);
}
.promo--photo:hover::before { transform: scale(1.09); }
.promo__body { position: relative; z-index: 2; padding: 14px 16px; }
.promo--photo .promo__title { color: #fff; font-weight: 750; }
.promo--photo .promo__text  { color: rgba(255,255,255,.86); }
/* Photos vary, so don't rely on the scrim alone to carry contrast. */
.promo--photo .promo__title,
.promo--photo .promo__text { text-shadow: 0 1px 3px rgba(0,0,0,.55); }
.promo--photo .promo__go {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  font-size: 15px; opacity: .75; transition: transform .25s var(--ease);
}
.promo--photo:hover .promo__go { transform: translateX(3px); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .promo--photo::before, .promo--photo:hover::before { transform: none; }
}
.hero__kicker {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.18); backdrop-filter: blur(6px);
  font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
}
.hero__title {
  margin: 14px 0 8px;
  font-size: clamp(26px, 4.2vw, 40px); font-weight: 800;
  letter-spacing: -.03em; line-height: 1.1; max-width: 15ch;
}
.hero__sub { margin: 0 0 22px; font-size: 15px; opacity: .92; max-width: 44ch; }
.hero__cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--r-pill);
  background: #fff; color: var(--brand-dark);
  font-weight: 700; font-size: 14.5px;
  transition: transform .12s var(--ease), box-shadow .15s var(--ease);
}
.hero__cta:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.22); }
.hero__emojis {
  position: absolute; right: -10px; bottom: -18px;
  font-size: 130px; opacity: .16; letter-spacing: -18px; pointer-events: none;
}

.hero__side { display: grid; gap: 14px; grid-template-rows: 1fr 1fr; }
.promo {
  border-radius: var(--r-lg); padding: 22px 20px;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; gap: 16px;
}
.promo__icon {
  width: 52px; height: 52px; border-radius: var(--r); flex-shrink: 0;
  display: grid; place-items: center; font-size: 26px;
  background: var(--brand-soft);
}
.promo--warm .promo__icon { background: var(--accent-soft); }
.promo__title { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.promo__text { font-size: 13px; color: var(--text-2); }

/* ---------------- Layout ---------------- */

.layout {
  display: grid; gap: 26px;
  grid-template-columns: 1fr;
  padding: 26px 0 60px;
  align-items: start;
}
@media (min-width: 1000px) { .layout { grid-template-columns: 248px 1fr; } }

/* ---------------- Filter sidebar ---------------- */

.filters {
  position: sticky; top: calc(var(--header-h) + 62px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 4px 18px 18px;
  max-height: calc(100vh - var(--header-h) - 90px); overflow-y: auto;
}
@media (max-width: 999px) {
  .filters {
    position: fixed; inset: 0 auto 0 0; z-index: 90;
    width: min(88vw, 330px); max-height: none; border-radius: 0;
    transform: translateX(-102%); transition: transform .3s var(--ease);
    box-shadow: var(--shadow-lg); padding-top: 18px;
  }
  .filters.is-open { transform: none; }
}

.filters__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 12px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.filters__head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.link-btn {
  font-size: 12.5px; font-weight: 650; color: var(--brand);
  padding: 4px 6px; border-radius: 6px;
}
.link-btn:hover { background: var(--brand-soft); }

.filters__close { display: none; }
@media (max-width: 999px) { .filters__close { display: grid; width: 32px; height: 32px; } }

.fgroup { padding: 16px 0; border-bottom: 1px solid var(--border); }
.fgroup:last-child { border-bottom: 0; }
.fgroup__title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-3); margin-bottom: 12px;
}

.fgroup__note { font-size: 12.5px; color: var(--text-3); padding: 2px 0 4px; }

.check {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; font-size: 13.5px; cursor: pointer; color: var(--text-2);
}
.check:hover { color: var(--text); }
.check input { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }
.check__n { margin-left: auto; font-size: 11.5px; color: var(--text-3); }

.range__row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.range__val {
  flex: 1; text-align: center; font-size: 13px; font-weight: 650;
  padding: 6px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px;
}
.range__dash { color: var(--text-3); }
input[type="range"] { width: 100%; accent-color: var(--brand); cursor: pointer; }

/* ---------------- Toolbar ---------------- */

.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar__title { margin: 0; font-size: 21px; font-weight: 750; letter-spacing: -.025em; }
.toolbar__count { font-size: 13px; color: var(--text-3); margin-left: 2px; }
.toolbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.select {
  height: 38px; padding: 0 32px 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b9790' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select:hover { border-color: var(--border-strong); }

.filter-toggle {
  display: flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13.5px; font-weight: 650;
}
@media (min-width: 1000px) { .filter-toggle { display: none; } }

.rate-notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; margin-bottom: 16px;
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); background: var(--accent-soft);
  font-size: 12.5px; color: var(--text-2); line-height: 1.45;
}
.rate-notice b { color: var(--text); font-weight: 700; }

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

.active-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 11px; border-radius: var(--r-pill);
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 12.5px; font-weight: 650;
}
[data-theme="dark"] .tag { color: var(--brand); }
.tag button { font-size: 14px; line-height: 1; opacity: .65; }
.tag button:hover { opacity: 1; }

/* ---------------- Product grid ---------------- */

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
}

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow); transform: translateY(-3px);
}

.card__media {
  position: relative; aspect-ratio: 1 / .82;
  display: grid; place-items: center; font-size: 56px;
  cursor: pointer; overflow: hidden;
}
.card__media::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: background .18s var(--ease);
}
/* Category photography, dimmed right back so the emoji stays the subject and
   24 sacks don't all look like the same picture. */
.card__media::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-image: var(--cat-img); background-size: cover; background-position: center;
  opacity: .12; filter: saturate(.55) blur(1.5px);
  transform: scale(1.05);   /* hides blur bleed at the edges */
}
/* Cards are small and tile densely on a phone, where the same category photo
   repeats six times on screen. Pull it back further there. */
@media (max-width: 700px) {
  .card__media::before { opacity: .07; }
}
.card__media > span, .card__media .pimg, .card__media .wish { position: relative; z-index: 1; }
.card__media .pimg { position: absolute; }
.card:hover .card__media::after { background: rgba(255,255,255,.06); }
.card__media span { transition: transform .3s var(--ease); }
.card:hover .card__media span { transform: scale(1.09) rotate(-3deg); }

.wish {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px;
  background: rgba(255,255,255,.92); color: #9aa5a0;
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), color .15s var(--ease);
}
[data-theme="dark"] .wish { background: rgba(22,29,24,.9); }
.wish:hover { transform: scale(1.12); }
.wish.is-on { color: var(--danger); }

.pimg {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: contain; padding: 9%;
  background: transparent;
}
.pimg--thumb { padding: 6%; }

.card__body { padding: 12px 13px 13px; display: flex; flex-direction: column; flex: 1; gap: 4px; }
.card__brand { font-size: 11px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.card__name {
  font-size: 13.5px; font-weight: 650; line-height: 1.35; letter-spacing: -.01em;
  cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__name:hover { color: var(--brand); }
.card__unit { font-size: 12px; color: var(--text-3); }

.card__foot { display: flex; align-items: flex-end; gap: 8px; margin-top: auto; padding-top: 10px; }
.price { display: flex; flex-direction: column; line-height: 1.2; }
.price__now { font-size: 16.5px; font-weight: 780; letter-spacing: -.02em; }
.price__was { font-size: 11.5px; color: var(--text-3); text-decoration: line-through; }
.price__note { font-size: 10.5px; color: var(--text-3); letter-spacing: .02em; }

.add {
  margin-left: auto; height: 33px; min-width: 62px; padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--brand); color: var(--brand);
  background: var(--surface);
  font-size: 13px; font-weight: 750; letter-spacing: .02em;
  transition: background .14s var(--ease), color .14s var(--ease), transform .1s var(--ease);
}
.add:hover { background: var(--brand); color: #fff; }
.add:active { transform: scale(.94); }

.stepper {
  margin-left: auto; display: flex; align-items: center;
  height: 33px; border-radius: var(--r-sm); overflow: hidden;
  background: var(--brand); color: #fff;
}
.stepper button {
  width: 30px; height: 100%; color: #fff; font-size: 17px; font-weight: 600;
  display: grid; place-items: center;
  transition: background .14s var(--ease);
}
.stepper button:hover { background: rgba(0,0,0,.16); }
.stepper__n { min-width: 24px; text-align: center; font-size: 13.5px; font-weight: 750; }

.card--out { opacity: .62; }
.card--out .add { border-color: var(--border-strong); color: var(--text-3); pointer-events: none; }

/* ---------------- Empty state ---------------- */

.empty {
  grid-column: 1 / -1; text-align: center; padding: 70px 20px;
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
}
.empty__icon { font-size: 46px; margin-bottom: 12px; }
.empty h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.empty p { margin: 0 0 18px; color: var(--text-2); font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: var(--r-sm);
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
  transition: background .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: scale(.98); }
.btn--ghost {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.btn--ghost:hover { background: var(--surface-2); }
.btn--block { width: 100%; }
.btn--lg { height: 48px; font-size: 15px; }
.btn:disabled { opacity: .5; pointer-events: none; }

.load-more { display: grid; place-items: center; padding: 30px 0 4px; }

/* ---------------- Drawer & modal shell ---------------- */

.scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10, 18, 13, .45); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
}
.scrim.is-open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95;
  width: min(100vw, 420px);
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(102%); transition: transform .32s var(--ease);
  box-shadow: var(--shadow-lg);
}
.drawer.is-open { transform: none; }

.drawer__head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.drawer__head h2 { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -.02em; }
.drawer__count { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.drawer__close { margin-left: auto; }
.drawer__body { flex: 1; overflow-y: auto; padding: 8px 20px; }
.drawer__foot { border-top: 1px solid var(--border); padding: 16px 20px 20px; background: var(--surface-2); }

/* ---------------- Cart lines ---------------- */

.line { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.line:last-child { border-bottom: 0; }
.line__thumb {
  position: relative; overflow: hidden;
  width: 62px; height: 62px; border-radius: var(--r-sm); flex-shrink: 0;
  display: grid; place-items: center; font-size: 30px;
}
.line__main { flex: 1; min-width: 0; }
.line__name { font-size: 13.5px; font-weight: 650; line-height: 1.35; }
.line__meta { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.line__row { display: flex; align-items: center; margin-top: 9px; gap: 10px; }
.line__price { margin-left: auto; font-size: 14px; font-weight: 750; }
.line .stepper { height: 29px; margin-left: 0; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.line .stepper button { color: var(--text-2); }
.line .stepper button:hover { background: var(--border); color: var(--text); }
.line__remove { font-size: 12px; color: var(--text-3); font-weight: 600; }
.line__remove:hover { color: var(--danger); }

.totals { display: grid; gap: 8px; margin-bottom: 14px; }
.totals__row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--text-2); }
.totals__row strong { color: var(--text); font-weight: 650; }
.totals__row--grand {
  border-top: 1px dashed var(--border); padding-top: 11px; margin-top: 3px;
  font-size: 17px; font-weight: 780; color: var(--text);
}

.freebar { margin-bottom: 14px; }
.freebar__text { font-size: 12.5px; color: var(--text-2); margin-bottom: 7px; }
.freebar__text b { color: var(--brand); }
.freebar__track { height: 6px; border-radius: var(--r-pill); background: var(--border); overflow: hidden; }
.freebar__fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .35s var(--ease); }

/* ---------------- Product modal ---------------- */

.modal {
  position: fixed; z-index: 95;
  left: 50%; top: 50%; transform: translate(-50%, -48%) scale(.97);
  width: min(94vw, 880px); max-height: 88vh;
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.modal.is-open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal__close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-sm);
  display: grid; place-items: center; font-size: 17px;
}
.modal__grid { display: grid; grid-template-columns: 1fr; overflow-y: auto; }
@media (min-width: 720px) { .modal__grid { grid-template-columns: 1fr 1fr; } }
.modal__media {
  position: relative;
  display: grid; place-items: center; font-size: 128px; min-height: 260px; padding: 30px;
}
.modal__info { padding: 28px 30px 30px; }
.modal__brand { font-size: 11.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; }
.modal__name { margin: 7px 0 8px; font-size: 25px; font-weight: 780; letter-spacing: -.03em; line-height: 1.15; }
.modal__desc { color: var(--text-2); font-size: 14px; margin: 14px 0 18px; }
.modal__price { display: flex; align-items: baseline; gap: 10px; margin: 16px 0 6px; }
.modal__price .now { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.modal__price .was { font-size: 15px; color: var(--text-3); text-decoration: line-through; }
.modal__price .off { font-size: 13px; font-weight: 750; color: var(--accent); }
.modal__tax { font-size: 12px; color: var(--text-3); }
.modal__facts { display: grid; gap: 9px; margin: 20px 0 24px; padding: 16px; background: var(--surface-2); border-radius: var(--r); }
.fact { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.fact b { color: var(--text); font-weight: 650; }
.modal__actions { display: flex; gap: 10px; }
.modal__actions .btn { flex: 1; }

/* ---------------- Toast ---------------- */

.toasts {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 9px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 17px; border-radius: var(--r-pill);
  background: var(--text); color: var(--bg);
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in .3s var(--ease);
}
.toast--exit { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(14px) scale(.94); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(10px) scale(.96); } }

/* ---------------- Trust strip + footer ---------------- */

.trust { border-top: 1px solid var(--border); background: var(--surface); }
.trust__grid {
  display: grid; gap: 18px; padding: 34px 0;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.trust__item { display: flex; gap: 13px; align-items: flex-start; }
.trust__icon { font-size: 24px; }
.trust__title { font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.trust__text { font-size: 12.5px; color: var(--text-2); }

/* Photo footer: a fixed dark band regardless of theme, so one scrim works for
   both and the text contrast never depends on the viewer's setting. */
.footer {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--border);
  background-color: #0e1b14;
  color: #eef4f0;
  isolation: isolate;
}
/* The photo is held back to a texture: dimmed, softened and slightly
   desaturated, so link contrast never depends on what is behind a given
   column. scale() hides the blur bleeding in at the edges. */
.footer::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background: url('assets/bg-footer.jpg') center 60% / cover no-repeat;
  filter: blur(2px) saturate(.65) brightness(.75);
  transform: scale(1.06);
  opacity: .3;
}
/* Deepens the top and bottom edges so the border and bottom bar stay crisp. */
.footer::after {
  content: '';
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(9,20,14,.55) 0%, rgba(9,20,14,.15) 40%, rgba(9,20,14,.6) 100%);
}
.footer .shell { position: relative; z-index: 1; }
.footer__top {
  display: grid; gap: 30px; padding: 46px 0 34px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.footer__brand { max-width: 320px; }
.footer__brand p { margin: 12px 0 0; font-size: 13.5px; color: rgba(238,244,240,.78); }
/* .logo__text is hidden under 640px for the header; the footer brand must
   always show its name. */
.footer .logo__text { display: block; }
.footer .logo__name { color: #fff; }
.footer .logo__tag  { color: rgba(232,240,234,.6); }
.footer h4 {
  margin: 0 0 13px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .09em; color: rgba(232,240,234,.55); font-weight: 700;
}
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer li { font-size: 13.5px; color: rgba(238,244,240,.9); }
.footer li a { font-size: 13.5px; color: rgba(238,244,240,.9); }
.footer li a:hover { color: #fff; text-decoration: underline; }
.footer__grid {
  display: grid; gap: 30px; padding: 44px 0 30px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.footer__brand { max-width: 300px; }
.footer__brand p { color: var(--text-2); font-size: 13.5px; margin: 12px 0 0; }
.footer h4 { margin: 0 0 13px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer li { font-size: 13.5px; color: rgba(238,244,240,.9); }
.footer li a { font-size: 13.5px; color: var(--text-2); }
.footer li a:hover { color: var(--brand); }
.footer__bar {
  border-top: 1px solid rgba(232,240,234,.16); padding: 18px 0 26px;
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  font-size: 12.5px; color: rgba(232,240,234,.6);
}
.footer__bar a { color: rgba(232,240,234,.82); }
.footer__bar a:hover { color: #fff; }
.pay { display: flex; gap: 8px; font-size: 17px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   Server-rendered pages: account, auth, checkout, admin panel
   ============================================================ */

.muted { color: var(--text-3); font-size: 12.5px; }
.num   { text-align: right; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px 26px; margin-bottom: 18px;
}
.panel--narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.panel__title { margin: 0; font-size: 21px; font-weight: 780; letter-spacing: -.025em; }
.panel__sub   { margin: 6px 0 18px; color: var(--text-2); font-size: 13.5px; }
.panel__foot  { margin: 16px 0 0; font-size: 13.5px; color: var(--text-2); text-align: center; }
.panel__foot a, .kv__v a { color: var(--brand); font-weight: 650; }

.note {
  padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 14px;
  font-size: 13.5px; border: 1px solid var(--border); border-left-width: 3px;
}
.note--ok  { background: var(--brand-soft); border-left-color: var(--brand); color: var(--text); }
.note--err { background: var(--accent-soft); border-left-color: var(--danger); color: var(--text); }
.note a { color: var(--brand); font-weight: 700; }

.form { display: grid; gap: 14px; }
.form__row { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .form__row { grid-template-columns: 1fr 1fr; } }

.field { display: grid; gap: 6px; }
.field__label { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.field__opt   { font-weight: 500; color: var(--text-3); }

.input {
  width: 100%; padding: 10px 12px; font-size: 14.5px;
  background: var(--surface-2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  outline: none; transition: border-color .15s var(--ease), background .15s var(--ease);
}
.input:focus { border-color: var(--brand); background: var(--surface); }
textarea.input { resize: vertical; font-family: inherit; }
.input--num { max-width: 110px; text-align: right; }

.checkrow { display: flex; flex-wrap: wrap; gap: 18px; padding: 4px 0; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.table th.num { text-align: right; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tfoot td { border-bottom: 0; padding: 7px 12px; color: var(--text-2); }
.table tfoot .tfoot-grand td { font-size: 16px; font-weight: 780; color: var(--text); padding-top: 12px; }
.table--admin td { vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.row--warn { background: var(--accent-soft); }

.pill {
  display: inline-block; padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; text-transform: capitalize;
  background: var(--border); color: var(--text-2);
}
.pill--pending    { background: var(--accent-soft); color: #b45309; }
.pill--confirmed  { background: var(--brand-soft);  color: var(--brand-dark); }
.pill--dispatched { background: #e5f1fb; color: #1d4ed8; }
.pill--delivered  { background: var(--brand); color: #fff; }
.pill--cancelled  { background: #fee; color: var(--danger); }
[data-theme="dark"] .pill--pending   { color: #f5b871; }
[data-theme="dark"] .pill--confirmed { color: var(--brand); }
[data-theme="dark"] .pill--dispatched{ background: #16283d; color: #93c5fd; }
[data-theme="dark"] .pill--cancelled { background: #33191a; color: #fca5a5; }

.tagchip {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 700;
}

.order__head { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; margin-bottom: 16px; }
.order__no { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }

.kv { display: grid; gap: 10px; }
.kv > div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; font-size: 13.5px; }
.kv__k { color: var(--text-3); font-weight: 650; }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 18px; transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.stat:hover { border-color: var(--brand); transform: translateY(-2px); }
.stat__n { font-size: 27px; font-weight: 800; letter-spacing: -.03em; }
.stat__l { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

.adminnav { display: none; gap: 4px; }
@media (min-width: 900px) { .adminnav { display: flex; } }

.adminnav__toggle { display: none; }
.adminnav__extra  { display: none; }
.adminnav__who    { font-size: 12.5px; }

/* Below 900px the inline nav is hidden, so without this the staff panel has
   no way to reach Products / Orders / Customers / Settings at all. */
@media (max-width: 899px) {
  .adminnav__toggle { display: grid; }
  .adminnav__deskonly, .adminnav__who { display: none; }

  .adminnav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px;
    padding: 8px 20px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .adminnav.is-open { display: flex; }
  .adminnav__link { padding: 13px 12px; font-size: 15px; border-radius: var(--r-sm); }

  .adminnav__extra {
    display: flex; flex-direction: column; gap: 2px;
    margin-top: 8px; padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  .adminnav__extra .muted { padding: 4px 12px 6px; }
}
.adminnav__link {
  padding: 8px 13px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 650; color: var(--text-2);
}
.adminnav__link:hover { background: var(--surface-2); color: var(--text); }
.adminnav__link.is-active { background: var(--brand-soft); color: var(--brand-dark); }
[data-theme="dark"] .adminnav__link.is-active { color: var(--brand); }

.filterbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filterbar .chip { text-decoration: none; }

.savebar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  padding: 14px 18px; margin-top: -1px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: var(--shadow);
}
.btn.is-active { border-color: var(--brand); color: var(--brand); }

/* ============================================================
   Touch targets — anything tappable needs real finger area on a
   phone, even where the visual mark stays small.
   ============================================================ */
@media (pointer: coarse), (max-width: 700px) {
  .wish { width: 38px; height: 38px; font-size: 16px; }
  .link-btn { padding: 9px 10px; }
  .search__clear { padding: 8px; }
  .line__remove { padding: 6px 0; }
  .tag button { padding: 4px 6px; margin: -4px -2px; }
}

/* ============================================================
   Mobile header reflow.
   Must live at the end of the file: a media query adds no specificity,
   so the plain `.search { flex: 1 }` rule above would otherwise win on
   source order and keep the input squeezed to ~90px.
   ============================================================ */
@media (max-width: 700px) {
  :root { --header-h: 116px; }
  .header__inner {
    height: auto; min-height: var(--header-h);
    flex-wrap: wrap; align-content: center;
    padding: 10px 0; gap: 10px 12px;
  }
  .header .search { order: 10; flex: 1 0 100%; min-width: 0; }
  .header__actions { margin-left: auto; }
  .logo__text { display: block; }
}

/* ============================================================
   Icons — inline SVG sprite, replaces the emoji set.
   Every icon inherits currentColor, so it themes automatically.
   ============================================================ */
.ic {
  width: 1.15em; height: 1.15em;
  flex-shrink: 0; display: inline-block;
  vertical-align: -.2em;
  stroke: currentColor; fill: none;
}
.ic--sm  { width: 1em;    height: 1em; }
.ic--md  { width: 22px;   height: 22px; }
.ic--lg  { width: 26px;   height: 26px; }

/* Product tile: the category icon stands in where there is no photo. */
.card__media .ic-tile {
  width: 42%; height: 42%;
  stroke-width: 1.25;
  color: var(--cat-ink, var(--text-2));
  opacity: .85;
  transition: transform .3s var(--ease);
}
.card:hover .card__media .ic-tile { transform: scale(1.08) rotate(-2deg); }
.modal__media .ic-tile { width: 44%; height: 44%; stroke-width: 1.1; }
.line__thumb .ic-tile  { width: 55%; height: 55%; stroke-width: 1.5; }
.suggest__thumb .ic-tile { width: 55%; height: 55%; stroke-width: 1.6; }

/* Saved-item star reads filled when active. */
.wish .ic { width: 16px; height: 16px; }
.wish.is-on .ic { fill: currentColor; }

.chip .ic { width: 15px; height: 15px; opacity: .8; }
.chip.is-active .ic { opacity: 1; }
.announce .ic { width: 15px; height: 15px; }
.trust__icon .ic { width: 24px; height: 24px; color: var(--brand); }
.promo__icon .ic { width: 24px; height: 24px; color: var(--brand); }
.fact .ic { width: 17px; height: 17px; color: var(--text-3); }
.hero__kicker .ic { width: 14px; height: 14px; }
.toast .ic { width: 16px; height: 16px; }
.rate-notice .ic { width: 16px; height: 16px; color: var(--accent); margin-top: 1px; }
.empty__icon .ic { width: 42px; height: 42px; color: var(--text-3); stroke-width: 1.3; }
.locate .ic { width: 17px; height: 17px; color: var(--text-3); }
.search__field > .ic { width: 17px; height: 17px; color: var(--text-3); }
.cart-btn .ic, .icon-btn .ic { width: 19px; height: 19px; }
.logo__mark .ic { width: 60%; height: 60%; color: var(--brand); }

/* A wide table must scroll inside its own box, never widen the page. */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Staff panel on small screens */
@media (max-width: 899px) {
  .admin .panel { overflow-x: auto; }
  .admin .panel { padding: 18px 16px; }
  .admin .table--admin { min-width: 620px; }
  .admin .savebar { flex-direction: column; align-items: stretch; gap: 10px; }
  .admin .savebar .btn { width: 100%; }
  .admin .filterbar .input, .admin .filterbar .select { flex: 1 1 140px; min-width: 0; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
}
