/* 6M Rewards launcher — Smile.io-style pill + right-side drawer.
 *
 * Ported verbatim from the live Shopify app's own stylesheet
 * (cdn.shopify.com/extensions/019f78fe-c711-79f0-b4f7-635721646db1/6m-rewards-18/assets/launcher.css),
 * so the launcher, nudge and drawer look exactly as they did on 6ixmerchandise.ca.
 *
 * Two sections are deliberately absent because the features behind them are
 * not ported (see FRONTEND_DECISIONS.md decision 25): the refer view, which
 * needs a referral engine, and the custom-perk request form, which needs a
 * fulfilment backend. Everything else is byte-identical apart from the two
 * comments that named the app's old Shopify host theme.
 */
#sixm-launcher {
  position: fixed;
  /* 180px, verbatim from the live app. On Shopify it cleared Minimog's mobile
     sticky nav; here it clears this theme's own 56px + safe-area .s6m-tabbar
     and the PDP's ~90px .sticky-atc with room to spare, and it is the position
     the owner asked to have transferred, so it is not re-tuned.
     safe-area-inset-bottom is additive for notched devices. */
  bottom: calc(180px + env(safe-area-inset-bottom, 0px));
  right: 24px;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #111;
}

/* Desktop has no sticky nav and plenty of room — sit at standard floating-CTA
   position to match every other rewards launcher pattern users have seen. */
@media (min-width: 1025px) {
  #sixm-launcher {
    bottom: 24px;
  }
}

/* ------------------------------------------------------------------ */
/* Floating pill                                                       */
/* ------------------------------------------------------------------ */

#sixm-launcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--sixm-primary);
  color: var(--sixm-text-on-primary);
  border: 0;
  border-radius: 999px;
  padding: 14px 22px 14px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--sixm-shadow);
  /* Animate width/padding/font-size collapse smoothly when the page scrolls
     past COLLAPSE_AT in launcher.js. transform/background stay snappy. */
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    padding 0.25s ease,
    font-size 0.25s ease,
    width 0.25s ease;
}

/* Scroll-collapsed state — full pill on initial viewport, icon-only circle
   after the user starts scrolling. Less visual weight on tall pages where
   the pill would otherwise sit mid-screen due to its 180px bottom offset. */
#sixm-launcher.sixm-collapsed #sixm-launcher-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
  gap: 0;
}
#sixm-launcher.sixm-collapsed .sixm-launcher-label {
  display: none;
}
#sixm-launcher.sixm-collapsed .sixm-launcher-icon {
  font-size: 20px;
}

#sixm-launcher-btn:hover {
  transform: translateY(-1px);
}

#sixm-launcher-btn:focus-visible {
  outline: 2px solid var(--sixm-accent);
  outline-offset: 2px;
}

.sixm-launcher-icon {
  color: var(--sixm-accent);
  font-size: 16px;
  line-height: 1;
}

/* ------------------------------------------------------------------ */
/* Nudge — reminder bubble above the pill (Smile "Nudges" parity)      */
/* ------------------------------------------------------------------ */

#sixm-nudge {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: max-content;
  max-width: min(300px, calc(100vw - 48px));
  background: #fff;
  color: #111;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  animation: sixm-nudge-in 0.3s ease;
}

@keyframes sixm-nudge-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  #sixm-nudge { animation: none; }
}

#sixm-nudge-body {
  display: block;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  color: inherit;
  padding: 14px 34px 14px 16px;
  cursor: pointer;
}

#sixm-nudge-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: transparent;
  border: 0;
  font-size: 16px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 4px 6px;
}

/* Speech-bubble tail pointing at the pill */
#sixm-nudge::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 22px;
  border: 7px solid transparent;
  border-top-color: #fff;
}

/* ------------------------------------------------------------------ */
/* Drawer                                                              */
/* ------------------------------------------------------------------ */

#sixm-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: min(400px, calc(100vw - 32px));
  background: #f5f5f7;
  border-radius: var(--sixm-radius);
  box-shadow: var(--sixm-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 2147483001;
  /* Slide in from the right like Smile. visibility gates interaction while
     keeping the transform transition (display:none would kill it). */
  transform: translateX(calc(100% + 32px));
  visibility: hidden;
  pointer-events: none;
  /* display:none while closed: a transformed off-canvas box still counts
     toward the document's scrollable width (it added 209px of horizontal
     scroll on the collection template at 390px). `allow-discrete` +
     @starting-style keep the slide animation where supported; elsewhere the
     drawer simply appears/disappears. */
  display: none;
  transition:
    transform 0.28s cubic-bezier(0.32, 0.72, 0.28, 1),
    visibility 0s linear 0.28s,
    display 0.28s allow-discrete;
}

#sixm-panel[data-open="true"] {
  display: flex;
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition:
    transform 0.28s cubic-bezier(0.32, 0.72, 0.28, 1),
    visibility 0s,
    display 0.28s allow-discrete;
}

@starting-style {
  #sixm-panel[data-open="true"] {
    transform: translateX(calc(100% + 32px));
    visibility: hidden;
  }
}

/* Must also name the open-state selector: #sixm-panel[data-open="true"]
   re-declares transition at higher specificity and would out-specificize a
   bare #sixm-panel override, leaving the OPEN animation running. */
@media (prefers-reduced-motion: reduce) {
  #sixm-panel,
  #sixm-panel[data-open="true"] {
    transition: none;
  }
}

/* Header band + hero share the brand background */
.sixm-panel-top {
  background: var(--sixm-primary);
  color: var(--sixm-text-on-primary);
  flex-shrink: 0;
}

/* Full padding on all sides — sub-views hide the hero below, so the header
   can't rely on the hero's top padding for breathing room under the buttons. */
.sixm-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px;
  min-height: 44px;
}

.sixm-panel-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sixm-back,
#sixm-panel-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  border-radius: 999px;
  color: var(--sixm-text-on-primary);
  cursor: pointer;
  padding: 0;
}

#sixm-back:hover,
#sixm-panel-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Back arrow only appears inside sub-views; on home an invisible spacer keeps
   the title centered. */
#sixm-panel[data-view="home"] #sixm-back {
  visibility: hidden;
}

.sixm-hero {
  padding: 6px 20px 22px 20px;
  text-align: left;
}

/* Sub-views collapse the hero — the header title becomes "{points} points",
   exactly like Smile's sub-view header. */
#sixm-panel:not([data-view="home"]) .sixm-hero {
  display: none;
}

.sixm-hero-points {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.sixm-hero-star {
  color: var(--sixm-accent);
  margin-right: 6px;
}

.sixm-hero-sub {
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.75;
}

.sixm-tier-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
}

.sixm-tier-local {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sixm-tier-regular {
  background: #cfe8ff;
  color: #0f5cab;
}

.sixm-tier-vip {
  background: #ffe09b;
  color: #7a5800;
}

.sixm-tier-iconic {
  background: var(--sixm-accent);
  color: #fff;
}

/* ------------------------------------------------------------------ */
/* Body: light gray canvas with white cards (Smile home pattern)       */
/* ------------------------------------------------------------------ */

.sixm-panel-body {
  padding: 12px;
  overflow-y: auto;
  /* Keep inner scrolling from chaining to the page — on mobile the drawer is
     effectively full-screen and scroll bleed-through feels broken. */
  overscroll-behavior: contain;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sixm-view {
  display: none;
  flex-direction: column;
  gap: 10px;
}

#sixm-panel[data-view="home"] .sixm-view[data-view="home"],
#sixm-panel[data-view="earn"] .sixm-view[data-view="earn"],
#sixm-panel[data-view="redeem"] .sixm-view[data-view="redeem"],
#sixm-panel[data-view="refer"] .sixm-view[data-view="refer"] {
  display: flex;
}

.sixm-card {
  background: #fff;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
  padding: 16px;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}

/* Navigation cards (home view rows) */
.sixm-card-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.sixm-card-nav:hover {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.sixm-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  /* Static fallback first (default accent at ~12%) — color-mix() with var()
     is invalid-at-computed-value in pre-2023 browsers, which would drop the
     tint entirely without this. */
  background: rgba(230, 57, 70, 0.12);
  background: color-mix(in srgb, var(--sixm-accent) 12%, #fff);
  color: var(--sixm-accent);
  flex-shrink: 0;
}

.sixm-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.sixm-card-title {
  font-size: 15px;
  font-weight: 700;
}

.sixm-card-sub {
  font-size: 12.5px;
  color: #6b6b6b;
}

.sixm-card-chevron {
  color: #b0b0b0;
  flex-shrink: 0;
  display: inline-flex;
}

/* ------------------------------------------------------------------ */
/* List rows (earn + redeem sub-views)                                 */
/* ------------------------------------------------------------------ */

.sixm-list {
  list-style: none;
  margin: 0;
  padding: 0 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

.sixm-list li {
  padding: 14px 0;
  border-bottom: 1px solid #efefef;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.sixm-list li:last-child {
  border-bottom: 0;
}

.sixm-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  /* Static fallback first — see .sixm-card-icon. */
  background: rgba(230, 57, 70, 0.1);
  background: color-mix(in srgb, var(--sixm-accent) 10%, #fff);
  color: var(--sixm-accent);
  flex-shrink: 0;
}

.sixm-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sixm-row-title {
  font-weight: 600;
  line-height: 1.35;
}

.sixm-row-sub {
  font-size: 12.5px;
  color: #6b6b6b;
}

.sixm-row-pts {
  font-weight: 700;
  white-space: nowrap;
  color: var(--sixm-primary);
  flex-shrink: 0;
}

.sixm-redeem-btn {
  background: var(--sixm-accent);
  color: #fff;
  border: 0;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Earn-row Follow + Claim (Smile "Follow → Claim +N" pattern) */
.sixm-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sixm-row-follow {
  font-size: 13px;
  font-weight: 600;
  color: var(--sixm-primary);
  text-decoration: none;
  white-space: nowrap;
}

.sixm-row-follow:hover {
  text-decoration: underline;
}

.sixm-row-claim {
  background: var(--sixm-accent);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.sixm-row-claim:disabled {
  background: #d4d4d4;
  color: #8a8a8a;
  cursor: not-allowed;
}

.sixm-row-claimed {
  font-size: 13px;
  font-weight: 700;
  color: #10b981;
  white-space: nowrap;
  flex-shrink: 0;
}

.sixm-redeem-btn:disabled {
  background: #d4d4d4;
  color: #8a8a8a;
  cursor: not-allowed;
}

.sixm-loading {
  color: #999;
  font-style: italic;
  justify-content: center;
}

/* ------------------------------------------------------------------ */
/* Join (logged-out) card                                              */
/* ------------------------------------------------------------------ */

.sixm-join {
  text-align: center;
  padding: 22px 18px;
}

.sixm-join-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.sixm-join-sub {
  margin: 0 0 14px 0;
  font-size: 13.5px;
  color: #555;
  line-height: 1.5;
}

.sixm-btn {
  display: block;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 999px;
  text-decoration: none;
  text-align: center;
  margin: 8px 0 0 0;
}

.sixm-btn-primary {
  background: var(--sixm-primary);
  color: var(--sixm-text-on-primary);
}

.sixm-btn-primary:hover {
  opacity: 0.9;
}

.sixm-btn-secondary {
  background: transparent;
  color: var(--sixm-primary);
  border: 1.5px solid var(--sixm-primary);
}

.sixm-earn-join {
  margin-top: 2px;
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */

.sixm-powered {
  margin-top: auto;
  padding-top: 14px;
  text-align: center;
  font-size: 11px;
  color: #a5a5a5;
}

/* ------------------------------------------------------------------ */
/* Notices (redeem success/error, referral welcome)                    */
/* ------------------------------------------------------------------ */

.sixm-notice {
  position: relative;
  background: #fff;
  border-left: 3px solid var(--sixm-accent);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
  padding: 12px 32px 12px 14px;
  margin-bottom: 10px;
  font-size: 13px;
  flex-shrink: 0;
}

.sixm-notice[data-tone="success"] {
  background: #ecfdf5;
  border-left-color: #10b981;
}

.sixm-notice[data-tone="error"] {
  background: #fef2f2;
  border-left-color: #ef4444;
}

.sixm-notice-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.sixm-notice-subtitle {
  color: #555;
  font-size: 12px;
  margin-top: 6px;
}

.sixm-notice-code {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.sixm-notice-code input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  font-family: monospace;
  background: #fff;
}

.sixm-notice-copy {
  background: var(--sixm-primary);
  color: var(--sixm-text-on-primary);
  border: 0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sixm-notice-close {
  position: absolute;
  top: 6px;
  right: 6px;
  background: transparent;
  border: 0;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #999;
  padding: 4px 8px;
}

/* Narrow-phone drawer sizing only. DO NOT touch #sixm-launcher's bottom/right
   here — the universal `bottom: calc(180px + safe-area-inset-bottom)` at the
   top of this file is the launcher's position, and any rule with equal
   specificity declared later will silently override it via CSS source-order
   tie-breaking (this exact bug shipped in the app's v4-v7). */
@media (max-width: 480px) {
  #sixm-panel {
    top: 10px;
    right: 10px;
    left: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: auto;
  }
}

/* ------------------------------------------------------------------ */
/* Host-theme reset — the only rules that are NOT in the live file     */
/* ------------------------------------------------------------------ */

/* On Shopify this stylesheet was the only thing styling the drawer. The
   Kadence child theme has global rules of its own, and two of them reached
   inside:

     - `h2` carries an element-level `color`, and an element-level colour beats
       an INHERITED one however specific the ancestor is, so the panel title
       rendered black-on-black in the header band.
     - links styled as buttons pick up the theme's uppercase + 0.04em tracking
       + Inter, so the live "Join now" / "Sign in" came out "JOIN NOW" /
       "SIGN IN" in the wrong face.

   These declarations restore the live rendering and touch nothing else: every
   property named here is one the app's own stylesheet never set on these
   selectors, so no ported value is being overridden. */
#sixm-panel .sixm-panel-header h2 {
  color: inherit;
  font-family: inherit;
  text-transform: none;
  letter-spacing: normal;
}

#sixm-launcher .sixm-btn,
#sixm-launcher .sixm-redeem-btn,
#sixm-launcher .sixm-notice-copy,
#sixm-launcher .sixm-notice-close {
  font-family: inherit;
  text-transform: none;
  letter-spacing: normal;
}
