/*
 * Shared customer components (header, tabs, cards, offers, badges), used by the menu page and
 * the approved reference screen. Mobile first, RTL by logical properties only (inline/block,
 * start/end): no physical directions. Every color, size, space, radius and shadow is a token
 * from tokens.css; branding changes token values only.
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The hidden attribute always wins over any display a component sets (one rule for every page). */
[hidden] {
  display: none !important;
}

html {
  font-family: var(--font-family);
  font-size: 100%;
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-background);
  -webkit-text-size-adjust: 100%;
}

/* Pages use viewport-fit=cover: keep content clear of the iPhone home indicator. */
body {
  margin: 0;
  min-block-size: 100vh;
  padding-block-end: env(safe-area-inset-bottom, 0px);
}

img {
  display: block;
  max-inline-size: 100%;
}

h1,
h2,
h3,
p {
  margin: 0;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  padding-block: var(--space-4) var(--space-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-inline-size: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.brand__logo {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: 3rem;
  block-size: 3rem;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.brand__name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  line-height: 1.3;
  color: var(--color-text);
}

.brand__tagline {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ---------- category tabs ---------- */

.tabs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  max-inline-size: var(--content-max);
  margin-inline: auto;
  margin-block-start: var(--space-3);
  padding-inline: var(--space-4);
  padding-block-end: var(--space-2);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: none;
  min-block-size: var(--touch-target);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  padding-block: var(--space-2);
  padding-inline: var(--space-4);
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}

.tab:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------- content ---------- */

.content {
  max-inline-size: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
  padding-block: var(--space-5);
  display: grid;
  gap: var(--space-6);
}

.section-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  margin-block-end: var(--space-3);
}

/* ---------- offers ---------- */

.offers__list {
  display: grid;
  gap: var(--space-3);
}

.offer {
  background: var(--color-offer-bg);
  color: var(--color-offer-text);
  border-radius: var(--radius-lg);
  padding-block: var(--space-4);
  padding-inline: var(--space-4);
  display: grid;
  gap: var(--space-1);
}

.offer__title {
  font-weight: var(--font-weight-bold);
}

.offer__description {
  font-size: var(--font-size-sm);
}

.offer__price {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
}

/* ---------- products ---------- */

.products {
  display: grid;
  gap: var(--space-3);
}

/* Compact horizontal card: a small square thumbnail at inline-start, then name, description, price. */
.product {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-block-size: var(--touch-target);
  padding-block: var(--space-3);
  padding-inline: var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.product__image {
  flex: none;
  inline-size: var(--thumb-size);
  block-size: var(--thumb-size);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--color-image-placeholder);
}

.product__body {
  flex: 1;
  min-inline-size: 0;
  display: grid;
  gap: var(--space-1);
}

.product__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.product__name {
  flex: 1;
  min-inline-size: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.product__price {
  flex: none;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  white-space: nowrap;
}

.product__description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* Sold out: still listed, dimmed by color (not opacity, which would break contrast), labelled. */
.product.is-sold-out .product__name,
.product.is-sold-out .product__price {
  color: var(--color-text-muted);
}

.product.is-sold-out .product__image {
  filter: grayscale(1);
}

.badge {
  justify-self: start;
  border-radius: var(--radius-pill);
  background: var(--color-sold-out-bg);
  color: var(--color-sold-out-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  padding-block: var(--space-1);
  padding-inline: var(--space-3);
}

.empty {
  color: var(--color-text-muted);
  text-align: center;
}

/* Plain platform pages (the neutral home page "/" and "page not found"): centred short text. */
.plain-page {
  display: grid;
  gap: var(--space-3);
  max-inline-size: var(--content-max);
  margin-inline: auto;
  padding-block: var(--space-6);
  padding-inline: var(--space-4);
  text-align: center;
}

.plain-page__mark {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-accent);
}

.plain-page__title {
  margin: 0;
  font-size: var(--font-size-xl);
}

.plain-page__line {
  margin: 0;
  color: var(--color-text-muted);
}

.plain-page__link {
  justify-self: center;
  color: var(--color-accent);
}
