/*
 * SHOP-01 (Issue #190, PO decisions D1-D7) - the storefront card and the offer page.
 *
 * Loaded by the Services page, an offer's own page and Staff's card preview (each in its
 * head_extra), and kept out of platform.css on purpose, the same pattern as my-services.css.
 * Every rule is scoped to the storefront's own card (`.offer-card--storefront`, which the owned-
 * service and dashboard cards never carry) or to the offer page (`body.storefront-detail`), so
 * the base card composition, its artwork and accents, both themes and the brand's tokens are
 * read and never redefined. Logical properties only, so Persian (RTL) and English (LTR) mirror
 * without overrides; nothing here moves, so reduced motion needs no rule of its own.
 */

/* -- the card's figures: visibly labelled, each in its own slot (D1, D2) ----------------------- */

/* Two columns, one fixed place per figure - duration and traffic first, bandwidth and users under
   them - so the same figure is in the same place on every card and adjacent offers read across.
   A figure Staff has not entered leaves its place empty: no placeholder and never zero. The
   document order is the same reading order, so a screen reader and the eye agree. */
.offer-card--storefront .offer-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.75rem;
  margin: 0.75rem 0 0;
}

.offer-card--storefront .offer-fact--duration {
  grid-area: 1 / 1;
}

.offer-card--storefront .offer-fact--traffic {
  grid-area: 1 / 2;
}

.offer-card--storefront .offer-fact--bandwidth {
  grid-area: 2 / 1;
}

.offer-card--storefront .offer-fact--users {
  grid-area: 2 / 2;
}

.offer-card--storefront .offer-fact {
  min-inline-size: 0;
}

.offer-card--storefront .offer-fact__label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  color: var(--offer-card-ink-soft);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
}

.offer-card--storefront .offer-fact__icon {
  flex: 0 0 auto;
  inline-size: 0.95rem;
  block-size: 0.95rem;
  color: var(--offer-card-accent);
}

/* The value sits under its label across the slot's full width, so a usual value ("50 Mbps" in
   Persian) stays on one line; a longer one wraps in its own slot rather than overflowing the card
   or being shrunk. */
.offer-card--storefront .offer-fact__value {
  margin: 0.05rem 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* -- the price and the one action (D3) -------------------------------------------------------- */

/* One primary action whoever is looking - "Add to basket" signed in, "Sign in to order" signed
   out - at least 44px tall, so it is an easy target on a phone. Its colour and focus ring are the
   platform's own button. */
.offer-card--storefront .offer-card__buy {
  min-block-size: 2.75rem;
  padding-inline: 1.15rem;
  font-size: 0.92rem;
}

/* -- the stacked card: a shorter banner, the price and action nearer (D4) --------------------- */

/* Only when the card is too narrow for its two halves (a phone, 200% zoom). The scene keeps its
   composition and fade at about 120px instead of 168px, so the price and the action come up the
   screen. The side-by-side card on a wide screen, and its artwork proportion, are unchanged. */
@container offer-card (max-width: 27rem) {
  .offer-card--storefront .offer-card__panel::before {
    block-size: 7.5rem;
  }

  .offer-card--storefront .offer-card__content {
    padding-block-start: 7.75rem;
  }
}

/* -- the offer page (D7) ---------------------------------------------------------------------- */

/* Stored names and summaries carry `dir="auto"`, so a Persian name keeps its word order on the
   English page; they still align with the page, as they do on the card. */
html[dir="rtl"] .storefront-detail :is(.offer__title, .offer__variant, .offer__summary, .offer-plan__name) {
  text-align: right;
}

html[dir="ltr"] .storefront-detail :is(.offer__title, .offer__variant, .offer__summary, .offer-plan__name) {
  text-align: left;
}

/* "Plan specifications": the same figures as the card, as small tiles that flow (one offer, so
   there is nothing to line up against). On the page's own surfaces, so both themes follow. */
.storefront-detail .offer-specs__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: 0.75rem;
  margin: 0;
}

.storefront-detail .offer-fact {
  min-inline-size: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}

.storefront-detail .offer-fact__label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.storefront-detail .offer-fact__icon {
  flex: 0 0 auto;
  inline-size: 1rem;
  block-size: 1rem;
  color: var(--commerce-accent-text);
}

.storefront-detail .offer-fact__value {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
