/* Backd phone demo: a phone that starts tilted back, straightens and climbs over the headline as you scroll,
   with a replica of the real Support widget flow playing on its screen (thread "Build the phone demo section").
   Plain CSS rebuild of the phone-scroll-hero design (no React/Tailwind/framer-motion). Every class starts with .bk-phone.
   Reads the site tokens from site.css (--bg --card --line --text --muted --faint --font-sans --font-mono, --g1..--g5)
   and uses the site's .rainbow for the two host-app buttons (Support launcher, Unlock). Popup buttons stay plain,
   with the rainbow glow around the card, exactly like the real widget.
   Markup: index.html between <!-- PHONE DEMO --> and <!-- /PHONE DEMO -->. Behaviour: the inline "Backd phone demo" script at the end of index.html
   (inline because website/ holds no .js files by design).
   Scroll motion is driven by one variable, --p (0 to 1), set by that script. Without JS or with reduced motion
   the phone is flat and still and the screen shows one still frame of the popup. */

.bk-phone {
  --p: 1;                                   /* scroll progress, 0 = tilted back, 1 = flat and climbed */
  --bk-w: clamp(236px, 64vw, 300px);        /* phone width */
  --bk-climb: calc(var(--bk-w) * .3);       /* how far the phone climbs over the headline */
  position: relative; overflow-x: clip;
  padding: clamp(72px, 10vw, 112px) 20px 0;
  --bk-after: 48px;                         /* room under the Pause button; with #how's 96px top = the 144px section gap on phones */
  margin-bottom: calc(var(--bk-climb) * -1 + var(--bk-after));
  text-align: center; font-family: var(--font-sans);
}
.js .bk-phone[data-live] { --p: 0; }
.bk-phone__stage { perspective: 1200px; }

/* headline: sits behind the phone and drifts up a little */
.bk-phone__head { position: relative; z-index: 0; max-width: 820px; margin: 0 auto;
  transform: translate3d(0, calc(var(--p) * -24px), 0); }
.bk-phone__head h2 { margin: 0 auto; max-width: 13em; font-size: clamp(40px, 7vw, 80px); letter-spacing: -.045em; line-height: 1; }
.bk-phone__head h2 span { color: var(--faint); }

/* the phone: climbs (move), then tilts and scales (tilt) */
.bk-phone__move { position: relative; z-index: 1; margin-top: clamp(28px, 5vw, 48px);
  transform: translate3d(0, calc(var(--p) * var(--bk-climb) * -1), 0); will-change: transform; }
.bk-phone__tilt { transform: rotateX(calc((1 - var(--p)) * 22deg)) scale(calc(.94 + var(--p) * .06));
  transform-origin: 50% 30%; will-change: transform; }

.bk-phone__device { position: relative; width: var(--bk-w); margin: 0 auto; aspect-ratio: 9 / 19.5;
  border-radius: calc(var(--bk-w) * .16); padding: calc(var(--bk-w) * .022);
  background: linear-gradient(145deg, color-mix(in srgb, var(--text) 14%, var(--card)), color-mix(in srgb, var(--text) 4%, var(--card)) 40%, color-mix(in srgb, var(--text) 12%, var(--card)));
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--card) 60%, transparent),
    0 10px 20px rgba(0,0,0,.10), 0 40px 70px -24px rgba(0,0,0,.30); }
.bk-phone__device > i { position: absolute; width: 3px; border-radius: 2px; background: var(--line-strong); }
.bk-phone__device > i:nth-child(1) { left: -3px; top: 17%; height: 4%; }
.bk-phone__device > i:nth-child(2) { left: -3px; top: 24%; height: 7.5%; }
.bk-phone__device > i:nth-child(3) { right: -3px; top: 22%; height: 10%; }
.bk-phone__screen { position: relative; height: 100%; overflow: hidden; border-radius: calc(var(--bk-w) * .14);
  container-type: inline-size; isolation: isolate; }

/* pause under the phone (the devnet caption was removed, Tristan 2026-12-04; the hero fine print and closing line still say test network) */
.bk-phone__cap { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 28px auto 0;
  font-size: 13.5px; color: var(--faint); }
.bk-phone__cap a { color: var(--muted); text-underline-offset: 3px; }
.bk-phone__cap .mono { font-size: 12px; }
.bk-phone__pause { font: 500 14px/1 var(--font-sans); color: var(--text); background: var(--card); cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 999px; height: 36px; min-width: 84px; padding: 0 18px;
  transition: border-color .15s, transform .15s; }
.bk-phone__pause:hover { border-color: var(--text); }
.bk-phone__pause:active { transform: translateY(1px); }
.bk-phone__pause[hidden] { display: none; }

/* ── the app on the screen ─────────────────────────────────────────────
   Drawn at a 390px-wide phone and scaled with the screen: 1em = 10 "phone pixels". */
.bk-app {
  --a-bg: #F4F4F5; --a-card: #FFFFFF; --a-line: #E4E4E7; --a-text: #18181B; --a-muted: #5B5B63; --a-input: #F4F4F5; --a-on: #18181B; --a-on-text: #FFFFFF; --a-ok: #15803D;
  position: absolute; inset: 0; font-size: 6.6px; font-size: calc(100cqw / 39);
  background: var(--a-bg); color: var(--a-text); text-align: left; line-height: 1.45;
  font-family: var(--font-sans); letter-spacing: -.01em; transition: opacity .45s ease; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk-app {
  --a-bg: #0E0E10; --a-card: #17171A; --a-line: #2A2A2F; --a-text: #F4F4F5; --a-muted: #A1A1AA; --a-input: #0B0B0C; --a-on: #F4F4F5; --a-on-text: #17171A; --a-ok: #4ADE80; } }
:root[data-theme="dark"] .bk-app {
  --a-bg: #0E0E10; --a-card: #17171A; --a-line: #2A2A2F; --a-text: #F4F4F5; --a-muted: #A1A1AA; --a-input: #0B0B0C; --a-on: #F4F4F5; --a-on-text: #17171A; --a-ok: #4ADE80; }
.bk-app[data-fade] { opacity: 0; }
.bk-app * { box-sizing: border-box; }

.bk-app__status { height: 5.4em; display: flex; align-items: center; justify-content: space-between; padding: .6em 3em 0 3.4em;
  font-size: 1em; font-weight: 600; }
.bk-app__status b { font-size: 1.5em; font-weight: 600; }
.bk-app__status svg { width: 6.6em; height: 1.3em; fill: currentColor; }
.bk-app__island { position: absolute; left: 50%; top: 1.1em; width: 11.6em; height: 3.4em; transform: translateX(-50%);
  border-radius: 99em; background: #000; z-index: 9; }

.bk-app__main { padding: 1.6em 1.6em 0; display: flex; flex-direction: column; gap: 1.4em; }
.bk-app__top { display: flex; align-items: center; justify-content: space-between; padding: .4em .2em .6em; }
.bk-app__top strong { font-size: 2.6em; font-weight: 650; letter-spacing: -.03em; }
.bk-app__avatar { width: 3.4em; height: 3.4em; border-radius: 99em; background: linear-gradient(135deg, #D4D4D8, #A1A1AA); }
.bk-app__card { background: var(--a-card); border: 1px solid var(--a-line); border-radius: 1.8em; padding: 2em; display: flex; flex-direction: column; gap: 1.3em; }
.bk-app__card p { margin: 0; font-size: 1.5em; color: var(--a-muted); }
.bk-app__row { display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.bk-app__row strong { font-size: 1.7em; font-weight: 600; }
.bk-app__tag { font-size: 1.2em; font-weight: 600; color: var(--a-muted); border: 1px solid var(--a-line); border-radius: 99em; padding: .3em .9em; transition: color .3s, border-color .3s; }
.bk-app__lines { display: flex; flex-direction: column; gap: .9em; }
.bk-app__lines i { display: block; height: 1.1em; border-radius: 99em; background: var(--a-input); }
.bk-app__lines i:nth-child(2) { width: 82%; } .bk-app__lines i:nth-child(3) { width: 58%; }

.bk-app__swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9em; }
.bk-app__swatches i { aspect-ratio: 1.25; border-radius: 1.1em; border: 1px solid var(--a-line); background: var(--a-input);
  position: relative; overflow: hidden; transition: background .6s ease .05s, border-color .6s; }
.bk-app__swatches i::after { content: ""; position: absolute; inset: 0; margin: auto; width: 1.3em; height: 1.5em; opacity: .55;
  background: currentColor; color: var(--a-muted); transition: opacity .3s;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Crect x='1' y='6' width='10' height='8' rx='2'/%3E%3Cpath d='M3.5 6V4a2.5 2.5 0 0 1 5 0v2' fill='none' stroke='%23000' stroke-width='1.4'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Crect x='1' y='6' width='10' height='8' rx='2'/%3E%3Cpath d='M3.5 6V4a2.5 2.5 0 0 1 5 0v2' fill='none' stroke='%23000' stroke-width='1.4'/%3E%3C/svg%3E") center / contain no-repeat; }
.bk-app[data-unlocked] .bk-app__swatches i::after { opacity: 0; }
.bk-app[data-unlocked] .bk-app__swatches i { border-color: transparent; }
.bk-app[data-unlocked] .bk-app__swatches i:nth-child(1) { background: linear-gradient(135deg, #1E1B4B, #6366F1); }
.bk-app[data-unlocked] .bk-app__swatches i:nth-child(2) { background: linear-gradient(135deg, #064E3B, #34D399); transition-delay: .12s; }
.bk-app[data-unlocked] .bk-app__swatches i:nth-child(3) { background: linear-gradient(135deg, #7C2D12, #FB923C); transition-delay: .19s; }
.bk-app[data-unlocked] .bk-app__swatches i:nth-child(4) { background: linear-gradient(135deg, #831843, #F472B6); transition-delay: .26s; }
.bk-app[data-unlocked] .bk-app__tag { color: var(--a-ok); border-color: color-mix(in srgb, var(--a-ok) 40%, transparent); }

/* host-app rainbow buttons (site .rainbow supplies the colours) */
.bk-app .rainbow { display: inline-flex; align-items: center; justify-content: center; border-radius: 99em; font-weight: 600; }
.bk-app__unlock { align-self: flex-start; height: 4.4em; padding: 0 2.8em; font-size: 1.5em; }
.bk-app__unlock.rainbow { font-size: 1em; } .bk-app__unlock.rainbow span { font-size: 1.5em; }
.bk-app[data-unlocked] .bk-app__unlock { display: none; }

/* launcher: "Backd by N supporters" + Support */
.bk-app__launcher { position: absolute; right: 1.6em; bottom: 3.4em; z-index: 4; display: flex; align-items: center; gap: 1em; height: 4.8em;
  padding: 0 .6em 0 1em; border-radius: 99em; background: var(--a-card); border: 1px solid var(--a-line); box-shadow: 0 .8em 2.4em rgba(0,0,0,.18); }
.bk-app__dots { display: flex; }
.bk-app__dots i { width: 1.8em; height: 1.8em; border-radius: 99em; border: .2em solid var(--a-card); }
.bk-app__dots i + i { margin-left: -.7em; }
.bk-app__count { font-size: 1.3em; font-weight: 500; color: var(--a-muted); white-space: nowrap; display: inline-flex; }
.bk-app__num { display: inline-block; position: relative; overflow: hidden; height: 1.45em; vertical-align: bottom; }
.bk-app__num span { display: block; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.bk-app[data-counted] .bk-app__num span { transform: translateY(-100%); }
.bk-app__count b { font-weight: 500; }
.bk-app__launch { height: 3.6em; padding: 0 1.8em; font-size: 1em; }
.bk-app__launch span { font-size: 1.4em; }
.bk-app__launch.quiet { background: transparent; color: var(--a-text); border: 1px solid var(--a-line); animation: none; }
.bk-app__launch.quiet::before { display: none; }

/* popup: plain pill buttons, rainbow glow around the card */
.bk-pop { position: absolute; right: 1.6em; left: 3.4em; bottom: 9.6em; z-index: 5; border-radius: 1.8em;
  transform: translateY(1.2em) scale(.98); opacity: 0; visibility: hidden; transform-origin: 100% 100%;
  transition: opacity .28s ease, transform .35s cubic-bezier(.2,.8,.2,1), visibility 0s .35s; }
.bk-app[data-open] .bk-pop { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.bk-pop__glow { position: absolute; inset: 0; border-radius: inherit; filter: blur(1.6em); opacity: .7; z-index: 0;
  background: conic-gradient(from 0deg, var(--g1), var(--g2), var(--g3), var(--g4), var(--g5), var(--g1)); }
.bk-pop__card { position: relative; z-index: 1; background: var(--a-card); border: 1px solid var(--a-line); border-radius: 1.8em;
  padding: 2em 1.8em 1.4em; box-shadow: 0 2em 5em rgba(0,0,0,.28); }
.bk-pop__x { position: absolute; top: 1.4em; right: 1.4em; width: 3.2em; height: 3.2em; border-radius: 99em; border: 1px solid var(--a-line);
  display: flex; align-items: center; justify-content: center; }
.bk-pop__x svg { width: 1.6em; height: 1.6em; }
.bk-step { display: none; flex-direction: column; gap: 1.4em; }
.bk-app[data-step="amount"] .bk-step--amount, .bk-app[data-step="pay"] .bk-step--pay, .bk-app[data-step="wait"] .bk-step--pay,
.bk-app[data-step="done"] .bk-step--done { display: flex; animation: bk-step-in .3s ease; }
@keyframes bk-step-in { from { opacity: 0; transform: translateY(.6em); } }
.bk-step h3 { margin: 0; font-size: 1.8em; font-weight: 600; letter-spacing: -.01em; padding-right: 2.2em; }
.bk-step p { margin: 0; font-size: 1.4em; color: var(--a-muted); }
.bk-step .lbl { font-size: 1.3em; font-weight: 500; color: var(--a-muted); margin-bottom: -.4em; }
.bk-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4em; padding: .4em; border-radius: 99em; background: var(--a-input); border: 1px solid var(--a-line); }
.bk-seg i { height: 2.6em; display: flex; align-items: center; justify-content: center; border-radius: 99em; font-style: normal; font-size: 1.5em; font-weight: 600;
  transition: background .2s, color .2s; }
.bk-seg i[data-on] { background: var(--a-on); color: var(--a-on-text); }
.bk-box { display: flex; align-items: center; gap: .8em; height: 4.6em; padding: 0 1.4em; border-radius: 1.2em; background: var(--a-input); border: 1px solid var(--a-line); }
.bk-box span { font-size: 1.6em; } .bk-box em { font-style: normal; font-size: 1.6em; color: var(--a-muted); opacity: .8; flex: 1; }
.bk-box small { font-size: 1.2em; font-weight: 600; color: var(--a-muted); }
.bk-box[data-focus] { outline: .2em solid var(--a-muted); outline-offset: .1em; }
.bk-box .typed { opacity: 1; color: var(--a-text); }
.bk-box .typed:empty::before { content: "you@example.com"; color: var(--a-muted); opacity: .8; }
.bk-box[data-focus] .typed::after { content: ""; display: inline-block; width: .1em; height: 1.1em; margin-left: .1em; vertical-align: -.15em; background: var(--a-text); animation: bk-caret 1s steps(1) infinite; }
@keyframes bk-caret { 50% { opacity: 0; } }
.bk-pill { display: flex; align-items: center; justify-content: center; gap: 1em; height: 4.8em; border-radius: 99em; background: var(--a-on); color: var(--a-on-text);
  font-weight: 600; transition: transform .15s, opacity .15s; }
.bk-pill span { font-size: 1.6em; }
.bk-pill[data-press] { transform: scale(.97); opacity: .85; }
.bk-foot { display: flex; justify-content: space-between; align-items: center; font-size: 1.25em; color: var(--a-muted); }
.bk-foot u { text-underline-offset: .2em; }
.bk-foot b { display: inline-flex; align-items: center; justify-content: center; width: 1.3em; height: 1.3em; margin-right: .5em; border-radius: .4em;
  background: var(--a-text); color: var(--a-card); font-size: .8em; vertical-align: -.1em; }
.bk-step--pay, .bk-step--done { align-items: center; text-align: center; padding-top: 1.4em; }
.bk-step--pay h3, .bk-step--done h3 { padding-right: 0; }
.bk-step--pay > *, .bk-step--done .bk-pill { align-self: stretch; }
.bk-step--pay .big { font-size: 3.6em; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.bk-step--pay .big small { font-size: .42em; font-weight: 600; color: var(--a-muted); letter-spacing: 0; }
.bk-wait { display: none; height: 4.8em; border-radius: 99em; border: 1px solid var(--a-line); align-items: center; justify-content: center; gap: 1em; color: var(--a-muted); }
.bk-wait span { font-size: 1.4em; }
.bk-wait svg { width: 1.6em; height: 1.6em; animation: bk-spin .9s linear infinite; }
@keyframes bk-spin { to { transform: rotate(360deg); } }
.bk-app[data-step="wait"] .bk-wait { display: flex; }
.bk-app[data-step="wait"] .bk-step--pay .bk-pill, .bk-app[data-step="wait"] .bk-step--pay .approve { display: none; }
.bk-ok { width: 5.2em; height: 5.2em; border-radius: 99em; background: var(--a-on); color: var(--a-on-text); display: flex; align-items: center; justify-content: center; align-self: center !important;
  animation: bk-pop-in .45s cubic-bezier(.2,1.4,.4,1); }
.bk-ok svg { width: 2.4em; height: 2.4em; }
@keyframes bk-pop-in { from { transform: scale(.5); opacity: 0; } }

/* the "finger": a soft circle that appears where the demo taps */
.bk-tap { position: absolute; z-index: 8; width: 4.4em; height: 4.4em; margin: -2.2em 0 0 -2.2em; border-radius: 99em; pointer-events: none;
  background: color-mix(in srgb, var(--a-text) 22%, transparent); border: .15em solid color-mix(in srgb, var(--a-card) 80%, transparent);
  box-shadow: 0 .4em 1.2em rgba(0,0,0,.2); opacity: 0; transform: scale(1.4);
  transition: left .5s cubic-bezier(.3,.7,.2,1), top .5s cubic-bezier(.3,.7,.2,1), opacity .25s, transform .25s; }
.bk-tap[data-show] { opacity: 1; transform: scale(1); }
.bk-tap[data-down] { transform: scale(.8); }

.bk-app__home { position: absolute; left: 50%; bottom: .9em; width: 13.4em; height: .5em; border-radius: 99em; transform: translateX(-50%);
  background: var(--a-text); opacity: .85; z-index: 9; }

/* reduced motion: flat, still phone; one still frame on the screen */
@media (prefers-reduced-motion: reduce) {
  .bk-phone, .js .bk-phone[data-live] { --p: 1; }
  .bk-phone__move, .bk-phone__tilt, .bk-phone__head { will-change: auto; }
  .bk-app *, .bk-app { animation: none !important; transition: none !important; }
}
@media (max-width: 640px) {
  .bk-phone { padding-top: 64px; padding-left: 16px; padding-right: 16px; }
  .bk-phone__cap { flex-direction: column; }
}

/* Desktop sizing (2026-12-02): a bigger phone so the app inside reads at ~14px, not ~10px.
   Capped by screen height so the whole phone still fits on a short laptop screen. See site.css. */
@media (min-width: 1024px) {
  .bk-phone { --bk-w: clamp(300px, calc((100svh - 150px) / 2.17), 380px); }
  .bk-phone { --bk-after: 80px; }           /* with the band's 80px top = the 160px section gap on desktop */
  .bk-phone__pause { font-size: 15px; height: 40px; min-width: 92px; padding: 0 20px; }
}
