/* ============================================================
   Headspace Jr. · Badge reward → Buddy avatar — prototype shell
   Builds on Headspace Design System tokens (../colors_and_type.css).
   Stage + phone frame follow Ebb Native Prototype 2.3.
   ============================================================ */

html, body { margin: 0; padding: 0; height: 100%; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  background: #f9f4f2;
  color: #000;
  font-family: var(--hs-font-sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font: inherit; color: inherit; }

.stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #f9f4f2;
}

/* ---------- Phone shell (375 × 812 — matches the Figma frames) ---------- */
.phone {
  position: relative;
  width: 375px; height: 812px;
  background: #fff;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 0 0 11px #19181a, 0 0 0 13px #2c2a2d, 0 40px 80px -24px rgba(20, 19, 19, .45);
  transform-origin: center center;
  isolation: isolate;
}

.screens { position: absolute; inset: 0; }
.scr { position: absolute; inset: 0; overflow: hidden; background: #fff; }

/* dynamic island */
.island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 118px; height: 33px; background: #0a0909; border-radius: 20px; z-index: 60;
  pointer-events: none;
}

/* status bar — iPhone (Figma "Status Bar - OS X", 44px) */
.statusbar {
  position: absolute; top: 0; left: 0; right: 0; height: 44px; z-index: 55;
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 24px 0 33px; pointer-events: none;
  font: 600 16px/22px -apple-system, "SF Pro Text", system-ui; letter-spacing: -0.3px;
  color: #000;
  transition: color .2s linear;
}
.statusbar .sb-icons { display: flex; gap: 5px; align-items: center; }
.statusbar svg { display: block; }
.phone[data-status="light"] .statusbar { color: #fff; }
.phone[data-status="none"] .statusbar { display: none; }

/* home indicator */
.home-bar {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: 999px; background: #000;
  z-index: 58; pointer-events: none;
}
.phone[data-homebar="light"] .home-bar { background: #fff; }
.phone[data-homebar="none"] .home-bar { display: none; }

/* Hotspot hint (Figma-style) — tapping a dead area flashes everything tappable */
.phone.jr-hint [data-go],
.phone.jr-hint [data-tap] {
  outline: 2px solid rgba(0, 97, 239, .55);
  outline-offset: 2px;
  background-color: rgba(0, 97, 239, .08);
  transition: outline-color .2s linear;
}
[data-go], [data-tap] { cursor: pointer; }

/* Shared motion: the badge "little shake and pop into position" (sticky notes) */
@keyframes jr-badge-pop {
  0%   { transform: scale(0) rotate(0deg); opacity: 0; }
  45%  { transform: scale(1.18) rotate(-8deg); opacity: 1; }
  60%  { transform: scale(1.06) rotate(7deg); }
  72%  { transform: scale(1.1) rotate(-5deg); }
  84%  { transform: scale(.97) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.jr-badge-pop { animation: jr-badge-pop 900ms cubic-bezier(0.32, 0.96, 0.4, 1) both; }

/* Hide scrollbars inside the phone, keep scrolling */
.phone * { scrollbar-width: none; }
.phone *::-webkit-scrollbar { display: none; }

/* ---------- Floating flow picker (left of the phone, Ebb 2.3 pattern) ---------- */
.flow-select {
  position: fixed; left: 26px; top: 50%; transform: translateY(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 6px; width: 216px;
}
.flow-select-h {
  font: 400 11px/1 var(--hs-font-mono); letter-spacing: .16em; text-transform: uppercase;
  color: rgba(0, 0, 0, .55); padding: 0 10px 6px;
}
.flow-link {
  display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer;
  background: none; border: none; padding: 9px 10px; border-radius: 12px;
  transition: background .15s var(--hs-ease-standard);
}
.flow-link:hover { background: rgba(245, 139, 68, .14); }
.flow-link.on { background: #fff; box-shadow: 0 0 8px rgba(20, 19, 19, .08); }
/* Styled like the HSDS "Marker" (Design System Guidelines 2635:8179), scaled from 32px to 24px */
.flow-num {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font: 700 12px/1.2 var(--hs-font-sans); letter-spacing: -0.03em; color: rgba(0, 0, 0, .6);
  border: 1.5px solid rgba(0, 0, 0, .2);
}
.flow-link.on .flow-num { background: #ff5a5a; color: #fff; border-color: #ff5a5a; }
.flow-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flow-lab { font: 700 14px/1.15 var(--hs-font-sans); letter-spacing: -.01em; color: rgba(0, 0, 0, .62); }
.flow-link.on .flow-lab { color: #000; }
.flow-sub { font: 400 11px/1.25 var(--hs-font-sans); color: rgba(0, 0, 0, .5); }
.flow-foot { font: 400 11px/1.35 var(--hs-font-sans); color: rgba(0, 0, 0, .45); padding: 12px 10px 0; }

/* Title card (top-right) — from the Figma section header */
/* Hidden for now; remove display: none to bring the title card back */
.proto-title {
  display: none;
  position: fixed; right: 32px; top: 32px; text-align: right; z-index: 200;
}
.proto-title .eyebrow { font: 400 11px/1 var(--hs-font-mono); letter-spacing: .16em; text-transform: uppercase; color: rgba(0, 0, 0, .55); }
.proto-title .name { font: 500 18px/1.25 var(--hs-font-sans); letter-spacing: -.02em; color: #000; margin-top: 6px; }
.proto-title .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #f58b44; margin-right: 8px; vertical-align: 1px; }
@media (max-width: 1100px) { .proto-title { display: none; } }

/*
 * Narrow viewports: phone is centered at 375px, so a left-rail Flows list
 * overlaps once width drops below ~phone + 2×(rail + gutter). Stack Flows
 * under the phone and let the stage scroll.
 */
@media (max-width: 920px) {
  body { overflow: auto; }
  .stage {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 28px 16px 40px;
    gap: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .phone {
    order: 1;
    flex-shrink: 0;
    transform-origin: top center;
  }
  .flow-select {
    position: static;
    transform: none;
    order: 2;
    width: min(280px, 100%);
    margin: 0 auto;
  }
  .flow-foot {
    text-align: center;
  }
}
