/* ============================================================
   In-Store Radio widget (shared component, rw- namespace)
   Injected on every page via radio-widget.js.
   Carries its own warm palette so it reads as a real feature
   even on the grayscale wireframe. Sits bottom-left, stacked
   above the accessiBe FAB, and lifts when the store bar docks.
   The expanded card hosts Spotify's official playlist embed.
   ============================================================ */
.rw-root {
  --rw-bg: #fffdf9;
  --rw-fg: #2b1a12;
  --rw-muted: #7a6357;
  --rw-line: #e4d8cc;
  --rw-brand: #612917;
  --rw-ink: #ffffff;
  --rw-accent: #b23a1f;      /* fill + link: white on this = 5.98:1, on light bg = 5.89:1 */
  --rw-on-accent: #ffffff;   /* text/icon color placed on an accent fill */
  --rw-ok: #1f6b3f;
  --rw-shadow: 0 12px 32px rgba(61, 30, 15, .18);
  --rw-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  position: fixed;
  left: 20px;
  bottom: 84px; /* clears the 52px accessiBe FAB (bottom:20) + gap */
  z-index: 58;  /* above store bar (50), below FAB stack (60) */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--rw-ui);
  transition: bottom 0.28s ease;
  color: var(--rw-fg);
}
@media (prefers-color-scheme: dark) {
  .rw-root:not([data-rw-theme="light"]) {
    --rw-bg: #261a14; --rw-fg: #f3e9df; --rw-muted: #c4ad9e; --rw-line: #3d2b22;
    --rw-brand: #8a3d22; --rw-accent: #ef7357; --rw-on-accent: #2a1810; --rw-ok: #6fc48e;
    --rw-shadow: 0 12px 32px rgba(0,0,0,.5);
  }
}

/* Lift above the docked store bar (shell pages use sh-storebar-docked,
   homepage uses storebar-docked). */
body.sh-storebar-docked .rw-root,
body.storebar-docked .rw-root { bottom: 164px; }

.rw-root * { box-sizing: border-box; }
.rw-root button { font: inherit; cursor: pointer; }
/* The wireframe's tokens.css sets `svg { max-width: 100%; height: auto }` globally,
   which collapses icons inside small grid buttons to 0px. Pin icon size here. */
.rw-root button svg { display: block; flex: none; width: 16px; height: 16px; max-width: none; }
.rw-root button:focus-visible { outline: 2px solid var(--rw-accent); outline-offset: 2px; }
.rw-eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--rw-muted); }

/* ---- Invitation toast (first visit) ---- */
.rw-invite {
  background: var(--rw-bg); border: 1px solid var(--rw-line); border-radius: 14px;
  padding: 14px; box-shadow: var(--rw-shadow); width: 300px; max-width: 100%;
  display: flex; flex-direction: column; gap: 12px; color: var(--rw-fg);
  animation: rw-rise .4s ease;
}
@keyframes rw-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rw-invite .rw-invite-main { display: flex; gap: 12px; align-items: center; }
.rw-invite .rw-txt { min-width: 0; }
.rw-invite b { display: block; font-size: 14px; line-height: 1.3; }
.rw-invite span { font-size: 12.5px; color: var(--rw-muted); }
.rw-invite .rw-actions { display: flex; gap: 8px; align-items: center; }
.rw-btn-sm { flex: 1; border: 0; border-radius: 999px; padding: 9px 14px; font-size: 13px; font-weight: 600; background: var(--rw-accent); color: var(--rw-on-accent); white-space: nowrap; }
.rw-btn-sm:hover { filter: brightness(1.06); }
.rw-btn-ghost { flex: none; background: transparent; color: var(--rw-muted); border: 0; border-radius: 999px; padding: 9px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.rw-btn-ghost:hover { background: color-mix(in srgb, var(--rw-muted) 12%, transparent); color: var(--rw-fg); }

/* ---- Collapsed pill ---- */
.rw-pill {
  display: flex; align-items: center; gap: 10px; background: var(--rw-brand); color: var(--rw-ink);
  border: 0; border-radius: 999px; padding: 8px 14px 8px 8px; box-shadow: var(--rw-shadow);
  font-weight: 600; font-size: 13.5px;
}
.rw-pill .rw-lbl { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Dismissed puck (redesigned: a small sticky round button, not a text line) ---- */
.rw-puck {
  position: relative; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--rw-brand); color: var(--rw-ink); box-shadow: var(--rw-shadow);
  display: grid; place-items: center; padding: 0;
}
.rw-puck .rw-vinyl { width: 30px; height: 30px; }
/* small "off" badge in the corner of the puck */
.rw-puck::after {
  content: ""; position: absolute; right: -2px; top: -2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--rw-bg); border: 1px solid var(--rw-line);
  background-image: linear-gradient(45deg, transparent 44%, var(--rw-muted) 44%, var(--rw-muted) 56%, transparent 56%);
}
.rw-puck:hover { filter: brightness(1.08); }
.rw-puck .rw-tip {
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  white-space: nowrap; background: var(--rw-fg); color: var(--rw-bg); font-size: 12px; font-weight: 600;
  padding: 5px 9px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.rw-puck:hover .rw-tip, .rw-puck:focus-visible .rw-tip { opacity: 1; }

/* ---- Vinyl icon ---- */
.rw-vinyl {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: radial-gradient(circle, var(--rw-accent) 0 18%, #1a100c 19% 100%); position: relative;
}
.rw-vinyl::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); }

/* ---- Expanded card: wraps Spotify's official embed (never styled inside) ---- */
.rw-player {
  width: 320px; max-width: 100%; background: var(--rw-bg); color: var(--rw-fg);
  border: 1px solid var(--rw-line); border-radius: 14px; box-shadow: var(--rw-shadow);
  padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; animation: rw-rise .3s ease;
}
.rw-player .rw-head { display: flex; justify-content: space-between; align-items: center; }
.rw-icon-btn { background: transparent; border: 0; padding: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--rw-muted); }
.rw-icon-btn:hover { background: color-mix(in srgb, var(--rw-fg) 12%, transparent); color: var(--rw-fg); }
.rw-head-actions { display: flex; align-items: center; gap: 2px; }
/* Slot reserves the embed height so the card doesn't jump while Spotify loads */
.rw-embed-slot { border-radius: 12px; background: color-mix(in srgb, var(--rw-fg) 8%, transparent); overflow: hidden; }
.rw-embed { display: block; width: 100%; border: 0; border-radius: 12px; }
.rw-foot { display: flex; justify-content: flex-end; align-items: center; border-top: 1px solid var(--rw-line); padding-top: 10px; font-size: 12.5px; }
.rw-foot a { color: var(--rw-accent); font-weight: 600; text-decoration: none; }
.rw-foot a:hover { text-decoration: underline; }
.rw-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Toast ---- */
.rw-toast {
  position: fixed; left: 20px; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--rw-fg); color: var(--rw-bg); padding: 8px 14px; border-radius: 999px;
  font-size: 13px; z-index: 60; animation: rw-rise .3s ease; font-family: var(--rw-ui);
}

/* ---- Mobile ---- */
@media (max-width: 500px) {
  .rw-root { left: 12px; bottom: 78px; }
  body.sh-storebar-docked .rw-root,
  body.storebar-docked .rw-root { bottom: 150px; }
  .rw-player { width: min(320px, calc(100vw - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
  .rw-invite, .rw-player, .rw-toast { animation: none; }
}
