/* Enroll page theme — design tokens verbatim from docs/00-product-visual-walkthrough.html
   (the canonical visual reference). Customer-facing + MERCHANT-BRANDED: the card preview
   renders in the merchant's own colors (--brand-*), set at runtime from /info; the page
   chrome stays on our clean neutral layout. WCAG 2.2 AA: AA contrast, ≥44px targets,
   visible focus, reduced-motion honored. */

:root {
  --teal: #00695c;
  --teal-light: #e6f3f2;
  --teal-mid: #4daca4;
  --blue: #005eb8;
  --amber: #e67700;
  --red: #c92a2a;
  --green: #2f9e44;

  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-400: #ced4da;
  --gray-600: #868e96;
  --gray-700: #495057; /* AA body/secondary on white (8.18:1) — never use gray-400/600 for text */
  --gray-900: #212529;
  --text: #212529;

  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);

  /* Merchant brand — overridden at runtime from /info; safe neutral defaults. */
  --brand-bg: #00695c;
  --brand-fg: #ffffff;
  --brand-label: #e6f3f2;

  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--gray-50);
  color: var(--text);
  font-size: 16px; /* ≥16px avoids iOS input zoom; comfortable base */
  line-height: 1.65;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.wrap {
  width: 100%;
  max-width: 420px;
  margin: auto;
}

/* The merchant-branded card hero. */
.card {
  background: var(--brand-bg);
  color: var(--brand-fg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
}

.logo {
  font-family: "IBM Plex Sans", Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  margin: 0 0 4px;
  word-break: break-word;
}

.reward {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 16px 0 4px;
}

.reward-sub {
  color: var(--brand-label);
  font-size: 0.95rem;
  margin: 0;
}

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 18px 0 4px;
}
.dot {
  width: 16px;
  height: 16px;
  border-radius: 100px;
  border: 2px solid var(--brand-label);
  opacity: 0.85;
}

/* CTA block: a NEUTRAL surface below the branded card, so the fixed-color official
   wallet badges stay legible over ANY merchant background. */
.cta {
  margin-top: 20px;
  text-align: center;
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Official "Add to {Apple,Google} Wallet" badge artwork. Min 48px tall (Google guideline),
   ≥44px touch target, visible focus. The detected platform's badge is emphasized. */
.wallet-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: var(--radius);
  text-decoration: none;
}
.wallet-badge-img {
  height: 48px;
  width: auto;
  display: block;
}
.wallet-badge.primary {
  transform: scale(1.04);
}
.wallet-badge.loading {
  opacity: 0.6;
  pointer-events: none;
}
/* Accessible text fallback used ONLY until the official artwork is vendored (preview). */
.wallet-badge-fallback {
  min-width: 240px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.wallet-badge-fallback.apple {
  background: #000;
  color: #fff;
}
.wallet-badge-fallback.google {
  background: #fff;
  color: var(--gray-700);
  border-color: var(--gray-400);
}

.note {
  color: var(--gray-700);
  font-size: 0.85rem;
  text-align: center;
  margin: 16px 8px 0;
}

/* The honest identifier notice (GDPR Art. 13/14): a longer paragraph below the one-line hook.
   Left-aligned + tighter for readability of multi-line legal text; gray-700 keeps 8.18:1 (AA). */
.note-fine {
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: left;
  max-width: 34rem;
  margin: 10px auto 0;
}

/* Amber guard-rail callout (in-app webview escape hatch). */
.callout {
  background: #fff4e6;
  color: #b35309; /* AA on the pale amber */
  border: 1px solid #ffd8a8;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.9rem;
  margin: 16px 0 0;
}

/* Desktop: QR + copyable join link. */
.desktop {
  margin-top: 20px;
}
.qr {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px;
  width: 180px;
  height: 180px;
}
.qr svg {
  width: 100%;
  height: 100%;
  display: block;
}
.desktop-cap {
  color: var(--gray-700);
  font-size: 0.9rem;
  margin: 12px 0 8px;
}
.linkrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.join-url {
  color: var(--teal);
  word-break: break-all;
  font-size: 0.85rem;
}
.copy-btn {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--teal);
  background: #fff;
  color: var(--teal);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.desktop-hint {
  background: var(--teal-light);
  color: var(--teal);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: center;
  font-size: 0.9rem;
  margin-top: 16px;
}

/* Focus visibility (2.4.7 AA) — visible, ≥3:1 on the light chrome. */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

/* Loading skeleton + error states. */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100), var(--gray-200), var(--gray-100));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.error {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}
.error h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}
.btn-retry {
  margin-top: 12px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}
