/* ============================================================
   app-store.css — "Get the App" Surfaces (Shared)
   ─────────────────────────────────────────────────
   PURPOSE : Store badges, the Home "Get the app" card (#getApp), the
             hero chip and the phone smart banner.
   SIGNAL  : html[data-platform="ios|android|desktop"] and
             html[data-in-app] come from js/shared/app-store/app-promo.js;
             html.embedded is set by the Flutter host before first paint.
             Without JS, everything shows (both stores + QR).
   RULE    : Never shown inside the app itself.
   ============================================================ */

html.embedded .ga,
html.embedded .home-hero__app,
html.embedded .app-banner,
html[data-in-app] .ga,
html[data-in-app] .home-hero__app,
html[data-in-app] .app-banner {
  display: none !important;
}

html[lang="ar"] .ga [data-show-in="en"],
html:not([lang="ar"]) .ga [data-show-in="ar"] {
  display: none;
}

/* ── Store badge ──────────────────────────────────────────────── */
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 172px;
  height: 56px;
  padding: 0 18px 0 14px;
  border-radius: 14px;
  background: #0b0b0c;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.08) inset, 0 8px 20px -10px rgb(0 0 0 / 0.55);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.store-badge:hover {
  background: #1a1a1c;
  transform: translateY(-2px);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.08) inset, 0 14px 28px -12px rgb(0 0 0 / 0.6);
}

.store-badge:active {
  transform: scale(0.96);
  transition-duration: 0.1s;
}

.store-badge:focus-visible {
  outline: 3px solid var(--mark-catch, #FEB536);
  outline-offset: 3px;
}

.store-badge__logo {
  flex: none;
  width: 28px;
  height: 28px;
}

.store-badge__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
  direction: ltr;
}

.store-badge__text small {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.88;
}

html[lang="ar"] .store-badge__text small {
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  font-size: 0.74rem;
  letter-spacing: normal;
}

.store-badge__text b {
  font-family: -apple-system, 'SF Pro Display', 'Inter', system-ui, sans-serif;
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ── Home card ────────────────────────────────────────────────── */
.ga__card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--border-soft);
  border-radius: 28px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgb(254 181 54 / 0.16), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgb(5 90 85 / 0.12), transparent 60%),
    var(--surface);
  box-shadow: 0 30px 60px -40px rgb(4 62 61 / 0.45);
  transition: box-shadow 0.6s ease;
}

.ga.is-highlighted .ga__card {
  animation: ga-pulse 1.6s cubic-bezier(0.16, 1, 0.3, 1) 0.35s;
}

@keyframes ga-pulse {
  0%   { box-shadow: 0 0 0 0 rgb(254 181 54 / 0.55), 0 30px 60px -40px rgb(4 62 61 / 0.45); }
  100% { box-shadow: 0 0 0 18px rgb(254 181 54 / 0), 0 30px 60px -40px rgb(4 62 61 / 0.45); }
}

.ga__title {
  margin: 10px 0 0;
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--text);
  text-wrap: balance;
}

.ga__title em {
  font-style: italic;
  color: var(--accent);
}

html[dir="rtl"] .ga__title {
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.35;
}

html[dir="rtl"] .ga__title em { font-style: normal; }

.ga__lead {
  max-width: 46ch;
  margin: 14px 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-soft);
  text-wrap: pretty;
}

.ga__points {
  display: grid;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text);
  font-size: 0.97rem;
}

.ga__points li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ga__points li::before {
  content: '';
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.4l2.6 2.6L14 7.6' fill='none' stroke='%231F4B4C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat;
}

.ga__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.ga__more {
  margin: 16px 0 0;
  font-size: 0.92rem;
}

.ga__more a {
  color: var(--accent);
  font-weight: 600;
  text-underline-offset: 3px;
}

.ga__other {
  display: none;
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.ga__other a {
  color: var(--accent);
  font-weight: 600;
  text-underline-offset: 3px;
}

/* Right column */
.ga__aside {
  display: flex;
  justify-content: center;
}

.ga__qr {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 22px 18px;
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 40px -26px rgb(4 62 61 / 0.5);
  text-align: center;
  transform: rotate(-2deg);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ga__card:hover .ga__qr { transform: rotate(0deg) translateY(-3px); }

.ga__qr img {
  width: 168px;
  height: 168px;
  image-rendering: pixelated;
}

.ga__qr figcaption {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.ga__short {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
}

.ga__short:hover { color: var(--accent); text-decoration: underline; }

.ga__icon {
  display: none;
  position: relative;
}

.ga__icon::before {
  content: '';
  position: absolute;
  inset: -22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(254 181 54 / 0.35), transparent 65%);
  filter: blur(8px);
}

.ga__icon img {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 26px;
  box-shadow: 0 20px 40px -18px rgb(4 62 61 / 0.6), 0 0 0 1px rgb(0 0 0 / 0.04);
}

/* ── Device emphasis ──────────────────────────────────────────── */
html[data-platform="ios"] .store-badge--android,
html[data-platform="android"] .store-badge--ios,
html[data-platform="ios"] .ga__qr,
html[data-platform="android"] .ga__qr {
  display: none;
}

html[data-platform="ios"] .ga__other--for-ios,
html[data-platform="android"] .ga__other--for-android {
  display: block;
}

html[data-platform="ios"] .ga__icon,
html[data-platform="android"] .ga__icon {
  display: block;
}

@media (max-width: 760px) {
  .ga__card {
    grid-template-columns: minmax(0, 1fr);
    text-align: center;
    border-radius: 24px;
  }

  .ga__lead { margin-inline: auto; }
  .ga__points { justify-items: center; }
  .ga__badges { justify-content: center; }

  /* On a phone the icon leads the card. */
  .ga__aside { order: -1; }

  html[data-platform="ios"] .store-badge,
  html[data-platform="android"] .store-badge {
    width: min(100%, 300px);
    justify-content: center;
    height: 60px;
  }

  .ga__qr { transform: none; }
}

/* ── Hero chip ────────────────────────────────────────────────── */
.home-hero__app {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 7px 14px 7px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.home-hero__app:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -16px rgb(4 62 61 / 0.6);
}

.home-hero__app:active { transform: scale(0.97); }

.home-hero__app-logos {
  display: inline-flex;
  gap: 2px;
  padding: 5px 7px;
  border-radius: 999px;
  background: #0b0b0c;
  color: #fff;
}

.home-hero__app-logos svg {
  width: 15px;
  height: 15px;
}

html[data-platform="ios"] .home-hero__app-logos svg:last-child,
html[data-platform="android"] .home-hero__app-logos svg:first-child {
  display: none;
}

.home-hero__app-arrow {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
  transition: transform 0.25s ease;
}

.home-hero__app:hover .home-hero__app-arrow { transform: translateX(3px); }
html[dir="rtl"] .home-hero__app-arrow { transform: scaleX(-1); }
html[dir="rtl"] .home-hero__app:hover .home-hero__app-arrow { transform: scaleX(-1) translateX(3px); }

/* ── Smart banner (phones, Home only) ─────────────────────────── */
.app-banner {
  position: fixed;
  z-index: 9000;
  inset-inline: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin-inline: auto;
  padding: 10px 10px 10px 8px;
  border: 1px solid rgb(255 255 255 / 0.6);
  border-radius: 22px;
  background: rgb(255 255 255 / 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 24px 48px -20px rgb(4 62 61 / 0.45), 0 2px 6px rgb(0 0 0 / 0.06);
  color: #1c1c1e;
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.32, 1.25, 0.5, 1), opacity 0.3s ease;
  touch-action: pan-x;
}

.app-banner[dir="rtl"] {
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  padding: 10px 8px 10px 10px;
}

.app-banner.is-shown {
  transform: none;
  opacity: 1;
}

.app-banner.is-leaving {
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  transition-duration: 0.35s, 0.25s;
  transition-timing-function: cubic-bezier(0.4, 0, 1, 1), ease;
}

.app-banner__close {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(120 120 128 / 0.14);
  color: #6b6b70;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-banner__close svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.app-banner__icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  box-shadow: 0 0 0 0.5px rgb(0 0 0 / 0.12), 0 4px 10px -4px rgb(4 62 61 / 0.4);
}

.app-banner__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.app-banner__name {
  font-size: 0.98rem;
  font-weight: 700;
}

.app-banner__tagline,
.app-banner__store {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.78rem;
  color: #6b6b70;
}

.app-banner__store { font-size: 0.72rem; }

.app-banner__get {
  flex: none;
  min-width: 76px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--accent, #1F4B4C);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: transform 0.2s ease, background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.app-banner__get:active {
  transform: scale(0.94);
  background: var(--accent-strong, #163938);
}

@media (prefers-reduced-motion: reduce) {
  .app-banner,
  .app-banner.is-leaving { transition: opacity 0.2s ease; transform: none; }
  .store-badge,
  .home-hero__app,
  .ga__qr { transition: none; transform: none; }
  .ga.is-highlighted .ga__card { animation: none; }
}
