/* Home screen: first-fold hierarchy, category row, one-line location bar, barcode accent, flyer banner slot. Everything reads from
   tokens.css, so the dark theme needs no rules here. */

/* The sticky header covers the top of the page while it scrolls, so the hero starts a full space below it: the title is never hidden under the bar. */
.hero { padding-top: calc(var(--header-h) + var(--sp-4)); scroll-margin-top: calc(var(--header-h) + var(--sp-2)); }
.eyebrow {
  margin: 0 0 var(--sp-1); font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.hero-title { margin: 0 0 var(--sp-1); font-size: var(--text-2xl); line-height: var(--leading-tight); }
.hero-lead { margin: 0 0 var(--sp-4); color: var(--ink-soft); font-size: var(--text-base); }

/* The barcode button is the in-store feature: it gets a visible accent instead of a grey icon. */
.scan-button-highlight {
  background: var(--primary); color: var(--on-primary); border-radius: var(--radius-sm);
  margin-right: var(--sp-1);
}
.scan-button-highlight:hover { background: var(--primary-hover); }

/* Category row: icons with a short label, scrolls sideways inside itself and never widens the page. */
.category-row {
  display: flex; gap: var(--sp-2); overflow-x: auto; overscroll-behavior-x: contain;
  padding: var(--sp-1) 0 var(--sp-3); margin: 0 calc(var(--sp-4) * -1); padding-left: var(--sp-4); padding-right: var(--sp-4);
  scrollbar-width: none; transform: translateZ(0); -webkit-overflow-scrolling: touch;
}
.category-row::-webkit-scrollbar { display: none; }
.category-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: var(--tap); padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface);
  color: var(--ink); text-decoration: none; font-size: var(--text-sm); font-weight: 600; white-space: nowrap;
}
.category-chip:hover { border-color: var(--primary); }
.category-chip-icon { font-size: 1.1rem; line-height: 1; }

/* Location bar: one row, all of it on the same line and centred on its height. The pin, the place and the distance share the
   line; the Alterar action sits at the right with the same vertical centre. The padding is symmetric so the pill has even space
   around its content. */
.location-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}
.location-bar .location-text {
  display: flex; align-items: center; gap: var(--sp-2); flex: 1; min-width: 0;
  font-size: var(--text-sm); white-space: nowrap; overflow: hidden;
}
.location-bar .location-text svg { flex: none; }
.location-bar .location-text strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.location-bar .location-text .muted { flex: none; }
.location-bar .button-link { flex: none; }
.button-link {
  flex: none; min-height: var(--tap); padding: 0 var(--sp-2); border: 0; background: none;
  color: var(--link); font: inherit; font-size: var(--text-sm); font-weight: 600; text-decoration: underline; cursor: pointer;
}

/* Section header with a short supporting line. */
.featured-head { margin: var(--sp-5) 0 var(--sp-1); }
.featured-head h2 { margin: 0; font-size: var(--text-lg); }
.featured-head .hint { margin: var(--sp-1) 0 var(--sp-3); }

/* Reserved flyer banner: renders only when a partner market sells the slot. */
.ad-slot {
  display: flex; flex-direction: column; gap: var(--sp-1); margin: var(--sp-5) 0;
  padding: var(--sp-4); border-radius: var(--radius-lg); background: var(--surface-alt);
  border: 1px dashed var(--line-strong); color: var(--ink); text-decoration: none;
}
.ad-slot-tag {
  align-self: flex-start; padding: 2px var(--sp-2); border-radius: var(--radius-pill);
  background: var(--sample-bg); color: var(--sample-ink); font-size: var(--text-xs); font-weight: 700;
}

/* Long scrollable lists keep the GPU busy so Android does not stutter or flash black while scrolling. */
.market-list.carousel, .category-row { transform: translateZ(0); overscroll-behavior: contain; }

/* Showcase: the featured row drifts sideways by itself (js/showcase.js). Snap is on only while the user drags or swipes: with
   snap on, each small programmatic step would be pulled back to the nearest card and the row would never move. */
.featured .carousel { scroll-snap-type: none; cursor: grab; }
.featured .carousel.dragging { cursor: grabbing; user-select: none; }
.featured .carousel.dragging a { pointer-events: none; }
.showcase-toggle { min-height: var(--tap); padding: 0 var(--sp-2); font-size: var(--text-sm); }

/* Featured card: the product price is the headline, the store is a coloured badge, the action sits at the foot of the card. */
.featured-card { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 12.5rem; transition: transform var(--dur-fast) var(--ease); }
.featured-card:active { transform: scale(.98); }
.featured-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
/* Two lines, always: a longer name is cut with an ellipsis, a shorter one keeps the box, so every price sits at the same height. */
.featured-name {
  margin: 0; font-size: var(--text-base); line-height: var(--leading-tight);
  min-height: calc(var(--text-base) * var(--leading-tight) * 2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.featured-price { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.featured-price .price-amount { font-size: var(--text-2xl); font-weight: 900; color: var(--ink); }
.featured-price .price-unit { font-size: var(--text-sm); color: var(--muted); }
.featured-meta { margin: 0; font-size: var(--text-sm); }

/* Store badges: one flag colour per chain (tokens.css), dark fill and light text, readable on both themes. */
.store-badge {
  display: inline-block; padding: 2px var(--sp-2); border-radius: 6px; text-transform: uppercase; letter-spacing: .06em;
  font-size: 11px; font-weight: 700; color: var(--store-other-ink); background: var(--store-other-bg);
  border: 1px solid rgba(255, 255, 255, .14);
}
.store-nagumo { background: var(--store-nagumo-bg); color: var(--store-nagumo-ink); }
.store-assai { background: var(--store-assai-bg); color: var(--store-assai-ink); }
.store-atacadao { background: var(--store-atacadao-bg); color: var(--store-atacadao-ink); }
.store-coop { background: var(--store-coop-bg); color: var(--store-coop-ink); }
.store-shibata { background: var(--store-shibata-bg); color: var(--store-shibata-ink); }
.store-maximo { background: var(--store-maximo-bg); color: var(--store-maximo-ink); }
.store-tenda { background: var(--store-tenda-bg); color: var(--store-tenda-ink); }
.store-tauste { background: var(--store-tauste-bg); color: var(--store-tauste-ink); }
.store-barbosa { background: var(--store-barbosa-bg); color: var(--store-barbosa-ink); }
.store-simpatia { background: var(--store-simpatia-bg); color: var(--store-simpatia-ink); }
.store-other { background: var(--store-other-bg); color: var(--store-other-ink); }

/* Featured price: the currency mark sits in the text font, close to the digits, which keep the numeric font. */
.featured-price .price-currency {
  font-family: var(--font-sans); font-size: 0.6em; font-weight: 700; letter-spacing: 0; margin-right: 0.15em; color: var(--text-price);
}

/* Footer action of a product card: a discreet link at the foot, not a second button competing with the price. */
.featured-action { margin-top: auto; align-self: flex-start; }
