/* Maymoun's shared pages. Tokens follow the app's AppColors and
   AppTextStyles (lib/core/theme), so a shared offer looks like the app. */

@font-face {
  font-family: 'Tajawal';
  src: url('/fonts/Tajawal-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/fonts/Tajawal-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/fonts/Tajawal-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/fonts/Tajawal-Black.ttf') format('truetype');
  font-weight: 900;
  font-display: swap;
}

:root {
  --primary: #d62839;
  --primary-dark: #a51c2b;
  --primary-soft: #fdecee;
  --primary-tint: #f9c9cf;
  --stripe: #fadfe3;
  --on-primary: #ffffff;
  --surface: #ffffff;
  --background: #fbfbfc;
  --ink: #1e1e22;
  --ink-soft: #414146;
  --ink-muted: #5d5d65;
  --ink-faint: #71717a;
  --surface-muted: #f5f5f6;
  --tonal: #e8e8eb;
  --outline: #e0e0e3;
  --star: #f5a524;
  --card-shadow: 0 6px 18px rgb(30 30 34 / 0.08);
  --bar-shadow: 0 -6px 24px rgb(30 30 34 / 0.1);
  --radius: 18px;
  --radius-large: 24px;
  --gutter: 16px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--ink);
  font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

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

:focus-visible {
  outline: 3px solid var(--primary-tint);
  outline-offset: 2px;
  border-radius: 8px;
}

.wrap {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon {
  flex: none;
}

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

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--outline);
}

.top-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand img {
  height: 36px;
  width: auto;
}

/* Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 16px;
  font: inherit;
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
  white-space: nowrap;
  transition: transform 120ms ease, background-color 120ms ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 8px 20px rgb(214 40 57 / 0.28);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn-small {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 14px;
}

.open-app-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #fff;
  padding: 1px;
}

/* "Open in the app" makes no sense on a computer: the footer offers the
   download links there instead. */
html[data-platform='desktop'] .open-app,
html[data-platform='desktop'] .open-bar {
  display: none;
}

.open-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 20;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  box-shadow: var(--bar-shadow);
}

.open-bar .btn {
  width: 100%;
}

body.has-open-bar {
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

html[data-platform='desktop'] body.has-open-bar {
  padding-bottom: 0;
}

/* The bar already offers it on phones. */
@media (max-width: 879px) {
  .actions .open-app {
    display: none;
  }
}

@media (min-width: 880px) {
  .open-bar {
    display: none;
  }

  body.has-open-bar {
    padding-bottom: 0;
  }
}

/* Pictures -------------------------------------------------------------- */

.placeholder {
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(
    135deg,
    var(--primary-soft) 0 14px,
    var(--stripe) 14px 28px
  );
}

.placeholder img {
  width: 42%;
  max-width: 160px;
  opacity: 0.35;
}

/* Chips and badges ------------------------------------------------------ */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.chip-tonal {
  background: var(--tonal);
  color: var(--ink);
}

.chip-urgent {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.chip-ended {
  background: var(--ink);
  color: #fff;
}

.badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  padding: 5px 10px 3px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.4;
}

.badge-large {
  top: 16px;
  inset-inline-start: 16px;
  padding: 7px 14px 5px;
  font-size: 15px;
}

/* Price ----------------------------------------------------------------- */

.price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.price-now {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--primary);
}

.price-now b {
  font-weight: 900;
  font-size: 18px;
  line-height: 1.15;
}

.price-now small {
  font-size: 11px;
  font-weight: 700;
}

.price-old {
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 500;
}

.price-page .price-now b {
  font-size: 34px;
  line-height: 1;
}

.price-page .price-now small {
  font-size: 14px;
}

.price-page .price-old {
  font-size: 16px;
}

/* Offer page ------------------------------------------------------------ */

.offer {
  padding-top: 0;
}

.gallery {
  position: relative;
  margin-inline: calc(var(--gutter) * -1);
  background: var(--surface-muted);
}

.gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-slide,
.gallery-track > .placeholder {
  flex: 0 0 100%;
  scroll-snap-align: center;
}

.gallery-picture {
  width: 100%;
  aspect-ratio: 1;
  max-height: 72vh;
  object-fit: cover;
}

.gallery.is-ended .gallery-picture {
  filter: grayscale(0.7);
}

.gallery-dots {
  position: absolute;
  bottom: 14px;
  inset-inline: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}

.gallery-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.6);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: width 160ms ease;
}

.gallery-dots span.on {
  width: 20px;
  background: #fff;
}

.offer-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding-top: 20px;
}

.store-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--outline);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
}

a.store-chip:hover {
  border-color: var(--primary-tint);
  color: var(--primary-dark);
}

.store-chip-logo {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--surface-muted);
}

.store-chip-icon {
  display: grid;
  place-items: center;
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.offer-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.35;
  text-wrap: balance;
}

.offer-price {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.saving {
  padding: 6px 12px 4px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 800;
}

.note {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--ink-muted);
  font-size: 15px;
}

.description {
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-line;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
}

@media (min-width: 880px) {
  .offer {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 44px;
    align-items: start;
    padding-top: 32px;
  }

  .gallery {
    position: sticky;
    top: 92px;
    margin-inline: 0;
    border-radius: var(--radius-large);
    overflow: hidden;
  }

  .offer-summary {
    padding-top: 8px;
  }

  .offer-title {
    font-size: 32px;
  }
}

/* Sections and grids ---------------------------------------------------- */

.section {
  padding-top: 36px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 20px;
  font-weight: 800;
}

.count {
  min-width: 28px;
  padding: 3px 8px 1px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 960px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--card-shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgb(30 30 34 / 0.12);
}

.card-media {
  position: relative;
}

.card-picture {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 12px;
}

.card-store {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding-top: 4px;
}

.card-days {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.empty {
  padding: 28px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px dashed var(--outline);
  color: var(--ink-muted);
  text-align: center;
}

/* Store page ------------------------------------------------------------ */

.store {
  padding-top: 0;
}

.cover {
  margin-inline: calc(var(--gutter) * -1);
  overflow: hidden;
  background: var(--primary-soft);
}

.cover-picture {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 340px;
  object-fit: cover;
}

.store-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: -44px;
  padding: 58px 20px 22px;
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--card-shadow);
  text-align: center;
}

.store-logo {
  position: absolute;
  top: -46px;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  overflow: hidden;
  border-radius: 999px;
  border: 4px solid var(--surface);
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: 0 6px 16px rgb(30 30 34 / 0.12);
}

.store-logo img,
.store-logo .placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-name {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
}

.store-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted);
  font-size: 15px;
}

.store-rating b {
  color: var(--ink);
  font-weight: 800;
}

.stars {
  color: var(--star);
  display: inline-flex;
}

.store-address {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted);
  font-size: 15px;
}

.store-card .description {
  max-width: 560px;
}

.contacts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 64px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.contact-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  transition: background-color 120ms ease;
}

.contact:hover .contact-icon {
  background: var(--primary-tint);
}

.store-card .actions {
  justify-content: center;
}

@media (min-width: 880px) {
  .store {
    padding-top: 24px;
  }

  .cover {
    margin-inline: 0;
    border-radius: var(--radius-large);
  }

  .store-card {
    margin-inline: 40px;
  }
}

/* Campaign page --------------------------------------------------------- */

.banner {
  position: relative;
  margin-inline: calc(var(--gutter) * -1);
  overflow: hidden;
  background: var(--primary-soft);
}

.banner-picture {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 420px;
  object-fit: cover;
}

.banner::after {
  content: '';
  position: absolute;
  inset: 40% 0 0;
  background: linear-gradient(to bottom, rgb(20 20 22 / 0), rgb(20 20 22 / 0.9));
  pointer-events: none;
}

.banner-text {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 1;
  padding: 20px var(--gutter);
  color: #fff;
}

.banner-store {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.85;
}

.banner h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.3;
}

.campaign-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 18px;
}

@media (min-width: 880px) {
  .campaign {
    padding-top: 24px;
  }

  .banner {
    margin-inline: 0;
    border-radius: var(--radius-large);
  }

  .banner-text {
    padding: 28px 32px;
  }

  .banner h1 {
    font-size: 36px;
  }
}

/* Home and messages ----------------------------------------------------- */

.hero,
.message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-block: 56px 40px;
  text-align: center;
}

.hero-logo {
  width: 150px;
  height: 150px;
  border-radius: 36px;
  box-shadow: var(--card-shadow);
}

.hero h1,
.message h1 {
  max-width: 560px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.4;
  text-wrap: balance;
}

.hero p,
.message p {
  max-width: 480px;
  color: var(--ink-muted);
}

.message-icon {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

/* Get the app ----------------------------------------------------------- */

.get-app {
  margin-top: 56px;
  background: var(--primary);
  color: var(--on-primary);
}

.get-app-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-block: 40px 32px;
  text-align: center;
}

/* The logo is drawn without a background: it sits on a white tile, like
   the app's icon. */
.get-app-logo,
.hero-logo {
  background: #fff;
  padding: 6px;
}

.get-app-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}

.get-app h2 {
  font-size: 22px;
  font-weight: 800;
}

.get-app p {
  max-width: 420px;
  opacity: 0.9;
}

.store-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.store-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 176px;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  transition: transform 120ms ease;
}

.store-button:hover {
  transform: translateY(-1px);
}

.store-button span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.store-button small {
  font-size: 11px;
  opacity: 0.8;
}

.store-button b {
  font-size: 18px;
  font-weight: 800;
  direction: ltr;
}

.foot-links {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  font-size: 14px;
  opacity: 0.85;
}

.foot-links a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
