/* LoyalStar — Toast, celebrate modal, order pill (Phase 1) */

.loyalstar-toast-region {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: var(--ls-s-xs, 8px);
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.loyalstar-toast {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  /* White paper card, 3px sage left accent, shadow-float */
  background: var(--ls-paper, #ffffff);
  border: 1px solid var(--ls-linen-line, #ececec);
  border-left: 3px solid var(--ls-sage, #f0fdf4);
  border-radius: var(--ls-r-sm, 8px);
  box-shadow: var(--ls-shadow-float, 0 8px 30px rgba(26,26,23,0.06));
  color: var(--ls-ink, #18181b);
  font: inherit;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(18px);
  transition: opacity 200ms var(--ls-ease-float, ease), transform 200ms var(--ls-ease-float, ease);
}

.loyalstar-toast--visible {
  opacity: 1;
  transform: translateX(0);
}

.loyalstar-toast--leaving {
  opacity: 0;
  transform: translateX(18px);
}

.loyalstar-toast:focus-visible {
  outline: 2px solid var(--ls-ink);
  outline-offset: 2px;
}

.loyalstar-toast__icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--ls-sage, #f0fdf4);
  color: var(--ls-sage-ink, #166534);
  font-size: 15px;
  font-weight: 700;
}

.loyalstar-toast__icon::before {
  content: "+";
}

/* Tier-up toast: use sage accent (consistent with the left border) */
.loyalstar-toast--tier {
  border-left-color: var(--ls-ink, #18181b);
}

.loyalstar-toast--tier .loyalstar-toast__icon {
  background: var(--ls-linen, #fafafa);
  color: var(--ls-ink, #18181b);
}

.loyalstar-toast--tier .loyalstar-toast__icon::before {
  content: "★";
}

/* Milestone: sage */
.loyalstar-toast--milestone {
  border-left-color: var(--ls-sage, #f0fdf4);
}

.loyalstar-toast--milestone .loyalstar-toast__icon {
  background: var(--ls-sage, #f0fdf4);
  color: var(--ls-sage-ink, #166534);
}

.loyalstar-toast--milestone .loyalstar-toast__icon::before {
  content: "✓";
}

.loyalstar-toast__body {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#loyalstar-celebrate-modal-root {
  position: relative;
  z-index: 9999;
}

.loyalstar-celebrate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.loyalstar-celebrate--visible {
  opacity: 1;
  pointer-events: auto;
}

.loyalstar-celebrate__backdrop {
  position: absolute;
  inset: 0;
  /* Low-opacity ink wash */
  background: rgba(26, 26, 23, 0.4);
  backdrop-filter: blur(3px);
}

.loyalstar-celebrate__dialog {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: var(--ls-s-lg, 40px) var(--ls-s-md, 24px) var(--ls-s-md, 24px);
  border-radius: var(--ls-r-md, 12px);
  background: var(--ls-paper, #ffffff);
  color: var(--ls-ink, #18181b);
  box-shadow: var(--ls-shadow-float, 0 8px 30px rgba(26,26,23,0.06));
  text-align: center;
  transform: translateY(12px) scale(0.98);
  transition: transform 200ms var(--ls-ease-float, ease);
}

.loyalstar-celebrate--visible .loyalstar-celebrate__dialog {
  transform: translateY(0) scale(1);
}

.loyalstar-celebrate__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ls-muted, #71717a);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
}

.loyalstar-celebrate__close:hover,
.loyalstar-celebrate__close:focus-visible {
  background: var(--ls-linen, #fafafa);
  outline: none;
}

/* Large decorative serif tier-initial hero in a linen double-ring */
.loyalstar-celebrate__badge {
  display: inline-grid;
  place-items: center;
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: var(--ls-s-sm, 16px);
  border-radius: 999px;
  background: var(--ls-linen, #fafafa);
  /* Outer ring */
  box-shadow: 0 0 0 4px var(--ls-linen, #fafafa), 0 0 0 6px var(--ls-linen-line, #ececec);
  /* The ★ from JS is replaced visually; keep it for screen readers */
  font-size: 32px;
  color: var(--ls-ink, #18181b);
}

.loyalstar-celebrate__eyebrow {
  margin: 0 0 var(--ls-s-2xs, 4px);
  color: var(--ls-muted, #71717a);
  font-size: var(--ls-fs-label, 0.6875rem);
  letter-spacing: var(--ls-tracking-label, 0.08em);
  font-weight: 500;
  text-transform: uppercase;
}

.loyalstar-celebrate__title {
  margin: 0;
  color: var(--ls-ink, #18181b);
  font-size: var(--ls-fs-display-lg, 2rem);
  font-weight: 500;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.loyalstar-celebrate__multiplier {
  margin: var(--ls-s-xs, 8px) 0 0;
  color: var(--ls-sage-ink, #166534);
  font-weight: 600;
  font-size: var(--ls-fs-sm, 0.8125rem);
}

.loyalstar-celebrate__perks {
  display: grid;
  gap: var(--ls-s-xs, 8px);
  margin: var(--ls-s-sm, 16px) 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.loyalstar-celebrate__perks li {
  padding: var(--ls-s-xs, 8px) var(--ls-s-sm, 16px);
  border: 1px solid var(--ls-linen-line, #ececec);
  border-radius: var(--ls-r-sm, 8px);
  background: var(--ls-linen, #fafafa);
  font-size: var(--ls-fs-sm, 0.8125rem);
  color: var(--ls-ink, #18181b);
  line-height: 1.45;
}

.loyalstar-celebrate__share {
  margin-top: var(--ls-s-sm, 16px);
  min-height: 44px;
  padding: 0 var(--ls-s-sm, 16px);
  border: 0;
  border-radius: var(--ls-r-pill, 9999px);
  background: var(--ls-ink, #18181b);
  color: var(--ls-paper, #ffffff);
  font: inherit;
  font-size: var(--ls-fs-label, 0.6875rem);
  letter-spacing: var(--ls-tracking-label, 0.08em);
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
}

.loyalstar-order-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--ls-s-xs, 8px);
  margin: var(--ls-s-sm, 16px) 0;
  padding: var(--ls-s-xs, 8px) var(--ls-s-sm, 16px);
  border: 1px solid var(--ls-linen-line, #ececec);
  border-radius: var(--ls-r-pill, 9999px);
  background: var(--ls-sage, #f0fdf4);
  color: var(--ls-ink, #18181b);
  font-size: var(--ls-fs-sm, 0.8125rem);
  line-height: 1.2;
}

.loyalstar-order-pill__icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--ls-ink, #18181b);
  color: var(--ls-paper, #ffffff);
  font-size: 12px;
}

.loyalstar-order-pill strong {
  white-space: nowrap;
  color: var(--ls-ink, #18181b);
}

.loyalstar-order-pill__sub {
  color: var(--ls-muted, #71717a);
}

@media (max-width: 520px) {
  .loyalstar-toast-region {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .loyalstar-celebrate {
    padding: 14px;
  }

  .loyalstar-celebrate__dialog {
    padding: 26px 18px;
  }

  .loyalstar-celebrate__title {
    font-size: 25px;
  }

  .loyalstar-order-pill {
    align-items: flex-start;
    border-radius: 8px;
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loyalstar-toast,
  .loyalstar-celebrate,
  .loyalstar-celebrate__dialog {
    transition: none;
    transform: none;
  }
}
