{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"phone-frame","type":"registry:component","title":"Phone Frame","description":"iPhone mockup animation: phone device frame for app screenshots and screen recordings. iPhone-style device frame with a dynamic island and a screen slot — flat or lightly 3D-tilted, with rise, rotate-in, or float entrances and a subtle float loop.","dependencies":["remotion"],"docs":"Needs a Remotion project. If a frame renders black, the component is drawing on a transparent layer: put a background behind it, e.g. <AbsoluteFill style={{ background: \"#faf9f6\" }}><Component /></AbsoluteFill>. Pass mode=\"dark\" for dark frames.","registryDependencies":["https://kuchi.kalarislabs.com/r/kuchi-ui.json"],"files":[{"path":"components/kuchi/phone-frame.tsx","type":"registry:component","target":"components/kuchi/phone-frame.tsx","content":"/*! Portions Copyright (c) 2026 Sri Nath (snap-cn). MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\r\n\r\nimport type { CSSProperties, ReactNode } from \"react\";\r\nimport {\r\n  Easing,\r\n  getRemotionEnvironment,\r\n  Img,\r\n  interpolate,\r\n  OffthreadVideo,\r\n  staticFile,\r\n  useCurrentFrame,\r\n  useVideoConfig,\r\n} from \"remotion\";\r\nimport {\r\n  resolveFont,\r\n  type KuchiTheme,\r\n  useKuchiTheme,\r\n  withAlpha,\r\n} from \"@/lib/kuchi-ui\";\r\n\r\nexport type PhoneFrameVariant = \"flat\" | \"tilt\" | \"showcase\";\r\nexport type PhoneFrameEntrance = \"rise\" | \"rotate-in\" | \"float\";\r\n\r\nexport interface PhoneFrameProps {\r\n  /** Screen content. Falls back to `screenSrc`, then the ride-summary placeholder. */\r\n  children?: ReactNode;\r\n  /**\r\n   * Image *or* video to fill the screen when `children` is omitted. Videos\r\n   * (.mp4/.webm/.mov/.m4v) play via `<OffthreadVideo>`, images via `<Img>` —\r\n   * both cover-fit the screen.\r\n   */\r\n  screenSrc?: string;\r\n  /**\r\n   * `flat` faces the camera; `tilt` adds a static 3D rotateY; `showcase` is a\r\n   * cinematic crane move — the camera starts low at the bottom-left corner of\r\n   * the laid-back device, sweeps up the screen while zooming in, then pulls\r\n   * back and settles on a straight frontal view.\r\n   */\r\n  variant?: PhoneFrameVariant;\r\n  /** How the device enters the frame. */\r\n  entrance?: PhoneFrameEntrance;\r\n  /** Device shell color. Defaults to the theme's `foreground`. */\r\n  bezelColor?: string;\r\n  /** Screen fill behind the children. Defaults to the theme's `card`. */\r\n  screenColor?: string;\r\n  /** Design-system token overrides. */\r\n  theme?: Partial<KuchiTheme>;\r\n  mode?: \"light\" | \"dark\";\r\n  /**\r\n   * The face this scene paints its words in — a label from `fonts.ts`\r\n   * (\"Inter\", \"Space Grotesk\", \"Instrument Serif\") or a CSS family you have\r\n   * loaded yourself. Unset, the scene keeps the face it was designed around.\r\n   *\r\n   * Overrides `theme.fontFamily`, which is how a brand kit re-skins a whole\r\n   * timeline from one value.\r\n   */\r\n  fontFamily?: string;\r\n  /** Outer body corner radius. Defaults to real-device curvature. */\r\n  radius?: number;\r\n  /** Screen corner radius. Defaults to `radius - bezel` (concentric corners). */\r\n  screenRadius?: number;\r\n  /** CSS box-shadow under the device. Empty string disables it. */\r\n  shadow?: string;\r\n  /** Uniform size multiplier for the whole device. */\r\n  scale?: number;\r\n  /** Render the dynamic-island cutout over the screen. */\r\n  showDynamicIsland?: boolean;\r\n  /** Gentle vertical bob after the entrance settles. */\r\n  floatLoop?: boolean;\r\n  /** Peak float displacement in pixels. */\r\n  floatAmplitude?: number;\r\n  /** rotateY angle (degrees) used by the `tilt` variant. */\r\n  tiltAngle?: number;\r\n  speed?: number;\r\n  className?: string;\r\n}\r\n\r\nconst FONT_FAMILY =\r\n  'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif';\r\n\r\n/** Device shell size — matches the ~0.488 width:height ratio of a real iPhone. */\r\nexport const DEVICE_WIDTH = 320;\r\nexport const DEVICE_HEIGHT = 656;\r\n\r\n/** Shell thickness between the body edge and the screen. */\r\nexport const BEZEL_WIDTH = 12;\r\n\r\n/** Outer body curvature: real devices sit near 16.5% of the body width. */\r\nexport const DEVICE_RADIUS_RATIO = 0.165;\r\n\r\n/** Frames the entrance takes before the device is fully settled. */\r\nexport const ENTRANCE_FRAMES = 30;\r\n\r\n/** Seconds per full float-loop cycle. */\r\nexport const FLOAT_PERIOD_SECONDS = 4.5;\r\n\r\n/** Default outer radius for a given device width (real-device curvature). */\r\nexport function deviceRadius(deviceWidth: number): number {\r\n  return Math.round(deviceWidth * DEVICE_RADIUS_RATIO);\r\n}\r\n\r\n/**\r\n * Concentric-corner rule: the screen radius is the body radius minus the\r\n * bezel thickness, floored so tiny radii never go negative.\r\n */\r\nexport function screenRadiusFor(\r\n  radius: number,\r\n  bezel: number = BEZEL_WIDTH,\r\n): number {\r\n  return Math.max(4, radius - bezel);\r\n}\r\n\r\nexport interface EntrancePose {\r\n  opacity: number;\r\n  translateY: number;\r\n  rotateDeg: number;\r\n  scale: number;\r\n}\r\n\r\n/**\r\n * Pure entrance schedule. All three entrances settle to the identity pose by\r\n * `ENTRANCE_FRAMES`, so the float loop can take over without a seam.\r\n */\r\nexport function entrancePose(\r\n  frame: number,\r\n  entrance: PhoneFrameEntrance,\r\n): EntrancePose {\r\n  const clamp = {\r\n    extrapolateLeft: \"clamp\",\r\n    extrapolateRight: \"clamp\",\r\n  } as const;\r\n  const easeOut = Easing.out(Easing.cubic);\r\n\r\n  if (entrance === \"rotate-in\") {\r\n    return {\r\n      opacity: interpolate(frame, [0, 12], [0, 1], clamp),\r\n      translateY: interpolate(frame, [0, 28], [60, 0], {\r\n        ...clamp,\r\n        easing: easeOut,\r\n      }),\r\n      rotateDeg: interpolate(frame, [0, 28], [-8, 0], {\r\n        ...clamp,\r\n        easing: easeOut,\r\n      }),\r\n      scale: interpolate(frame, [0, 28], [0.94, 1], {\r\n        ...clamp,\r\n        easing: easeOut,\r\n      }),\r\n    };\r\n  }\r\n\r\n  if (entrance === \"float\") {\r\n    return {\r\n      opacity: interpolate(frame, [0, 16], [0, 1], clamp),\r\n      translateY: 0,\r\n      rotateDeg: 0,\r\n      scale: interpolate(frame, [0, 24], [0.96, 1], {\r\n        ...clamp,\r\n        easing: easeOut,\r\n      }),\r\n    };\r\n  }\r\n\r\n  // rise (default)\r\n  return {\r\n    opacity: interpolate(frame, [0, 12], [0, 1], clamp),\r\n    translateY: interpolate(frame, [0, 26], [70, 0], {\r\n      ...clamp,\r\n      easing: easeOut,\r\n    }),\r\n    rotateDeg: 0,\r\n    scale: 1,\r\n  };\r\n}\r\n\r\n/**\r\n * Deterministic float-loop offset in pixels. Starts at 0 with an upward\r\n * drift at `startFrame`, so it blends seamlessly out of any entrance.\r\n */\r\nexport function floatOffset(\r\n  frame: number,\r\n  fps: number,\r\n  amplitude: number,\r\n  startFrame = 0,\r\n  periodSeconds: number = FLOAT_PERIOD_SECONDS,\r\n): number {\r\n  const local = Math.max(0, frame - startFrame);\r\n  const value =\r\n    Math.sin((local / (fps * periodSeconds)) * Math.PI * 2) * amplitude;\r\n  // Negative = upward drift; the `=== 0` guard avoids returning -0.\r\n  return value === 0 ? 0 : -value;\r\n}\r\n\r\n/** Side-button spec (position along the edge, length) in body pixels. */\r\nexport const SIDE_BUTTONS: Array<{\r\n  side: \"left\" | \"right\";\r\n  top: number;\r\n  length: number;\r\n}> = [\r\n  { side: \"left\", top: 118, length: 26 }, // action button\r\n  { side: \"left\", top: 166, length: 46 }, // volume up\r\n  { side: \"left\", top: 222, length: 46 }, // volume down\r\n  { side: \"right\", top: 176, length: 68 }, // power\r\n];\r\n\r\n// ─── Ride-summary demo screen ────────────────────────────────────────────────\r\n// A glowing GPS route draws itself across a dark map while stat \"insight\" pills\r\n// pop in along it — the default screen the phone shows off as it rotates.\r\n\r\n/** Screen interior (device minus bezel on both sides). */\r\nconst SCREEN_W = DEVICE_WIDTH - BEZEL_WIDTH * 2; // 296\r\nconst SCREEN_H = DEVICE_HEIGHT - BEZEL_WIDTH * 2; // 632\r\n\r\n/** Route waypoints in screen space; a closed loop drawn head-first from [0]. */\r\nconst ROUTE: ReadonlyArray<readonly [number, number]> = [\r\n  [224, 450],\r\n  [172, 462],\r\n  [116, 460],\r\n  [70, 450],\r\n  [52, 412],\r\n  [74, 382],\r\n  [104, 388],\r\n  [134, 372],\r\n  [162, 380],\r\n  [192, 364],\r\n  [222, 372],\r\n  [248, 396],\r\n  [256, 424],\r\n  [244, 448],\r\n];\r\n\r\n/** Cumulative segment lengths of the closed polyline (last→first closes it). */\r\nfunction routeCumLengths(pts: ReadonlyArray<readonly [number, number]>) {\r\n  const cum = [0];\r\n  let total = 0;\r\n  for (let i = 0; i < pts.length; i++) {\r\n    const a = pts[i];\r\n    const b = pts[(i + 1) % pts.length];\r\n    total += Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n    cum.push(total);\r\n  }\r\n  return { cum, total };\r\n}\r\n\r\nconst ROUTE_LEN = routeCumLengths(ROUTE);\r\n\r\n/** Point at fraction `f` (0..1) along the closed route — the draw head. */\r\nexport function pointAtFraction(\r\n  f: number,\r\n  pts: ReadonlyArray<readonly [number, number]> = ROUTE,\r\n): { x: number; y: number } {\r\n  const { cum, total } = pts === ROUTE ? ROUTE_LEN : routeCumLengths(pts);\r\n  const target = Math.max(0, Math.min(1, f)) * total;\r\n  for (let i = 0; i < pts.length; i++) {\r\n    if (cum[i + 1] >= target) {\r\n      const seg = cum[i + 1] - cum[i] || 1;\r\n      const t = (target - cum[i]) / seg;\r\n      const a = pts[i];\r\n      const b = pts[(i + 1) % pts.length];\r\n      return { x: a[0] + (b[0] - a[0]) * t, y: a[1] + (b[1] - a[1]) * t };\r\n    }\r\n  }\r\n  const last = pts[pts.length - 1];\r\n  return { x: last[0], y: last[1] };\r\n}\r\n\r\n/** Catmull-Rom → cubic-bezier smoothing of a closed point loop into an SVG `d`. */\r\nexport function smoothClosedPath(\r\n  pts: ReadonlyArray<readonly [number, number]>,\r\n): string {\r\n  const n = pts.length;\r\n  const p = (i: number) => pts[((i % n) + n) % n];\r\n  let d = `M ${p(0)[0]} ${p(0)[1]}`;\r\n  for (let i = 0; i < n; i++) {\r\n    const p0 = p(i - 1);\r\n    const p1 = p(i);\r\n    const p2 = p(i + 1);\r\n    const p3 = p(i + 2);\r\n    const c1x = p1[0] + (p2[0] - p0[0]) / 6;\r\n    const c1y = p1[1] + (p2[1] - p0[1]) / 6;\r\n    const c2x = p2[0] - (p3[0] - p1[0]) / 6;\r\n    const c2y = p2[1] - (p3[1] - p1[1]) / 6;\r\n    d += ` C ${c1x} ${c1y} ${c2x} ${c2y} ${p2[0]} ${p2[1]}`;\r\n  }\r\n  return `${d} Z`;\r\n}\r\n\r\nconst ROUTE_PATH = smoothClosedPath(ROUTE);\r\n\r\n/** An \"insight\" pill anchored to a point on the route. */\r\ninterface Pill {\r\n  title: string;\r\n  sub: string;\r\n  icon: \"climb\" | \"heart\" | \"trophy\" | \"bolt\" | \"flame\";\r\n  tint: string;\r\n  x: number;\r\n  y: number;\r\n  anchor: readonly [number, number];\r\n  appear: number;\r\n}\r\n\r\nconst PILLS: Pill[] = [\r\n  {\r\n    title: \"BIG CLIMB\",\r\n    sub: \"+993 ft\",\r\n    icon: \"climb\",\r\n    tint: \"#D2925F\",\r\n    x: 100,\r\n    y: 196,\r\n    anchor: [148, 372],\r\n    appear: 74,\r\n  },\r\n  {\r\n    title: \"SETTLED\",\r\n    sub: \"HR steady at 116\",\r\n    icon: \"heart\",\r\n    tint: \"#84B27C\",\r\n    x: 80,\r\n    y: 234,\r\n    anchor: [132, 374],\r\n    appear: 60,\r\n  },\r\n  {\r\n    title: \"NEW PR\",\r\n    sub: \"Fastest 5 mi\",\r\n    icon: \"trophy\",\r\n    tint: \"#ADA69E\",\r\n    x: 44,\r\n    y: 292,\r\n    anchor: [64, 398],\r\n    appear: 40,\r\n  },\r\n  {\r\n    title: \"FASTEST SPLIT\",\r\n    sub: \"23 mph avg\",\r\n    icon: \"bolt\",\r\n    tint: \"#ADA69E\",\r\n    x: 168,\r\n    y: 300,\r\n    anchor: [242, 378],\r\n    appear: 52,\r\n  },\r\n  {\r\n    title: \"SPRINT\",\r\n    sub: \"Hit 32 mph\",\r\n    icon: \"flame\",\r\n    tint: \"#CC6D5C\",\r\n    x: 158,\r\n    y: 402,\r\n    anchor: [232, 448],\r\n    appear: 22,\r\n  },\r\n];\r\n\r\n/** Small monochrome pill glyphs, tinted per pill. */\r\nfunction PillIcon({ kind, color }: { kind: Pill[\"icon\"]; color: string }) {\r\n  const stroke = {\r\n    width: 11,\r\n    height: 11,\r\n    viewBox: \"0 0 24 24\",\r\n    fill: \"none\",\r\n    stroke: color,\r\n    strokeWidth: 2.4,\r\n    strokeLinecap: \"round\" as const,\r\n    strokeLinejoin: \"round\" as const,\r\n  };\r\n  if (kind === \"climb\") {\r\n    return (\r\n      <svg aria-hidden {...stroke}>\r\n        <title>climb</title>\r\n        <path d=\"M7 17 17 7\" />\r\n        <path d=\"M8 7h9v9\" />\r\n      </svg>\r\n    );\r\n  }\r\n  if (kind === \"trophy\") {\r\n    return (\r\n      <svg aria-hidden {...stroke}>\r\n        <title>trophy</title>\r\n        <path d=\"M7 4h10v5a5 5 0 0 1-10 0z\" />\r\n        <path d=\"M7 6H4v1a3 3 0 0 0 3 3\" />\r\n        <path d=\"M17 6h3v1a3 3 0 0 1-3 3\" />\r\n        <path d=\"M9 20h6M12 14v6\" />\r\n      </svg>\r\n    );\r\n  }\r\n  if (kind === \"heart\") {\r\n    return (\r\n      <svg aria-hidden width={11} height={11} viewBox=\"0 0 24 24\" fill={color}>\r\n        <title>heart</title>\r\n        <path d=\"M12 21S3.5 15.4 3.5 9.4C3.5 6.4 5.6 4.5 8 4.5c1.8 0 3.2 1.1 4 2.4.8-1.3 2.2-2.4 4-2.4 2.4 0 4.5 1.9 4.5 4.9 0 6-8.5 11.6-8.5 11.6z\" />\r\n      </svg>\r\n    );\r\n  }\r\n  if (kind === \"bolt\") {\r\n    return (\r\n      <svg aria-hidden width={11} height={11} viewBox=\"0 0 24 24\" fill={color}>\r\n        <title>bolt</title>\r\n        <path d=\"M13 2 4 14h6l-1 8 9-12h-6z\" />\r\n      </svg>\r\n    );\r\n  }\r\n  return (\r\n    <svg aria-hidden width={11} height={11} viewBox=\"0 0 24 24\" fill={color}>\r\n      <title>flame</title>\r\n      <path d=\"M12 2c1 4 5 5 5 10a5 5 0 0 1-10 0c0-1.6.7-2.8 1.6-3.7.2 1.7 1.2 2.7 2.6 2.7-1-3 1-4 .8-9z\" />\r\n    </svg>\r\n  );\r\n}\r\n\r\n/** iOS-style status-bar right cluster: signal, wifi, battery. */\r\nfunction StatusIcons() {\r\n  return (\r\n    <div style={{ display: \"flex\", alignItems: \"center\", gap: 5 }}>\r\n      <svg aria-hidden width={16} height={11} viewBox=\"0 0 18 12\" fill=\"#fff\">\r\n        <title>signal</title>\r\n        <rect x=\"0\" y=\"8\" width=\"3\" height=\"4\" rx=\"1\" />\r\n        <rect x=\"5\" y=\"5\" width=\"3\" height=\"7\" rx=\"1\" />\r\n        <rect x=\"10\" y=\"2.5\" width=\"3\" height=\"9.5\" rx=\"1\" />\r\n        <rect x=\"15\" y=\"0\" width=\"3\" height=\"12\" rx=\"1\" opacity=\"0.4\" />\r\n      </svg>\r\n      <svg aria-hidden width={15} height={11} viewBox=\"0 0 16 12\" fill=\"#fff\">\r\n        <title>wifi</title>\r\n        <path d=\"M8 2.2c2.7 0 5.2 1 7 2.8l-1.5 1.6A7.8 7.8 0 0 0 8 4.4 7.8 7.8 0 0 0 2.5 6.6L1 5C2.8 3.2 5.3 2.2 8 2.2Z\" />\r\n        <path d=\"M8 6c1.5 0 2.9.6 4 1.6l-1.6 1.6A3.4 3.4 0 0 0 8 8.2c-.9 0-1.7.4-2.4 1L4 7.6A5.7 5.7 0 0 1 8 6Z\" />\r\n        <circle cx=\"8\" cy=\"10.4\" r=\"1.4\" />\r\n      </svg>\r\n      <div\r\n        style={{\r\n          display: \"flex\",\r\n          alignItems: \"center\",\r\n          gap: 1.5,\r\n        }}\r\n      >\r\n        <div\r\n          style={{\r\n            width: 20,\r\n            height: 10,\r\n            borderRadius: 3,\r\n            border: \"1px solid rgba(255,255,255,0.5)\",\r\n            padding: 1.5,\r\n          }}\r\n        >\r\n          <div\r\n            style={{\r\n              width: \"42%\",\r\n              height: \"100%\",\r\n              borderRadius: 1,\r\n              background: \"#fff\",\r\n            }}\r\n          />\r\n        </div>\r\n        <div\r\n          style={{\r\n            width: 1.5,\r\n            height: 4,\r\n            borderRadius: 1,\r\n            background: \"rgba(255,255,255,0.5)\",\r\n          }}\r\n        />\r\n      </div>\r\n    </div>\r\n  );\r\n}\r\n\r\n/** One stat column in the header. */\r\nfunction Stat({\r\n  value,\r\n  unit,\r\n  label,\r\n  accent,\r\n}: {\r\n  value: string;\r\n  unit: string;\r\n  label: string;\r\n  accent?: boolean;\r\n}) {\r\n  const color = accent ? \"#F0842E\" : \"#FFFFFF\";\r\n  const dim = accent ? \"rgba(240,132,46,0.85)\" : \"rgba(255,255,255,0.42)\";\r\n  return (\r\n    <div style={{ display: \"flex\", flexDirection: \"column\", gap: 3 }}>\r\n      <div style={{ display: \"flex\", alignItems: \"baseline\", gap: 2 }}>\r\n        <span\r\n          style={{\r\n            fontSize: 15,\r\n            fontWeight: 700,\r\n            color,\r\n            letterSpacing: \"-0.02em\",\r\n          }}\r\n        >\r\n          {value}\r\n        </span>\r\n        <span style={{ fontSize: 8, fontWeight: 600, color: dim }}>{unit}</span>\r\n      </div>\r\n      <span\r\n        style={{\r\n          fontSize: 7,\r\n          fontWeight: 700,\r\n          letterSpacing: \"0.06em\",\r\n          color: dim,\r\n        }}\r\n      >\r\n        {label}\r\n      </span>\r\n    </div>\r\n  );\r\n}\r\n\r\nexport interface ShowcasePose {\r\n  /** Device orientation (deg), applied inside the perspective. */\r\n  rotateX: number;\r\n  rotateY: number;\r\n  rotateZ: number;\r\n  /** Camera zoom + pan (screen px), applied outside the perspective. */\r\n  zoom: number;\r\n  x: number;\r\n  y: number;\r\n}\r\n\r\n/**\r\n * Keyframes of the `showcase` crane move, on normalized progress 0..1:\r\n * hold low at the bottom-left of the laid-back device → sweep up the screen\r\n * while zooming in → linger near the top → pull back to a straight frontal\r\n * view. Ends exactly at the identity pose, so a float loop can take over.\r\n */\r\nconst SHOWCASE_STOPS = [0, 0.1, 0.42, 0.62, 0.9, 1];\r\nconst SHOWCASE_KEYS: Record<keyof ShowcasePose, number[]> = {\r\n  rotateX: [52, 36, 26, 12, 1.5, 0],\r\n  rotateY: [28, 20, 10, 6, 1, 0],\r\n  rotateZ: [30, 14, 2, 0, 0, 0],\r\n  zoom: [2.6, 1.35, 2.75, 2.3, 1.04, 1],\r\n  x: [60, 30, 0, -10, 0, 0],\r\n  y: [-195, -40, 430, 380, 15, 0],\r\n};\r\n\r\n/**\r\n * Cinematic \"showcase\" pose at `frame`, normalized to the composition length\r\n * so the move always completes regardless of duration. Each keyframe is a\r\n * natural rest point, so per-segment ease-in-out reads as one continuous move.\r\n */\r\nexport function showcasePose(\r\n  frame: number,\r\n  durationInFrames: number,\r\n): ShowcasePose {\r\n  const p = Math.max(0, Math.min(1, frame / Math.max(1, durationInFrames - 1)));\r\n  const easing = Easing.inOut(Easing.cubic);\r\n  const at = (values: number[]) =>\r\n    interpolate(p, SHOWCASE_STOPS, values, { easing });\r\n  return {\r\n    rotateX: at(SHOWCASE_KEYS.rotateX),\r\n    rotateY: at(SHOWCASE_KEYS.rotateY),\r\n    rotateZ: at(SHOWCASE_KEYS.rotateZ),\r\n    zoom: at(SHOWCASE_KEYS.zoom),\r\n    x: at(SHOWCASE_KEYS.x),\r\n    y: at(SHOWCASE_KEYS.y),\r\n  };\r\n}\r\n\r\nconst CLAMP = { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\" } as const;\r\n\r\n/** Default screen: a glowing ride-summary map that draws itself with insight pills. */\r\nfunction RideSummaryDemo({ frame, face }: { frame: number; face: string }) {\r\n  const ease = Easing.bezier(0.2, 0.6, 0.35, 1);\r\n  const draw = interpolate(frame, [12, 128], [0, 1], {\r\n    ...CLAMP,\r\n    easing: ease,\r\n  });\r\n  const fillIn = interpolate(frame, [70, 150], [0, 1], CLAMP);\r\n  const head = pointAtFraction(draw);\r\n  const hint = interpolate(frame, [0, 8, 70, 88], [0, 1, 1, 0], CLAMP);\r\n\r\n  return (\r\n    <div\r\n      style={{\r\n        position: \"absolute\",\r\n        inset: 0,\r\n        overflow: \"hidden\",\r\n        backgroundColor: \"#0A0A0B\",\r\n        fontFamily: face,\r\n        textRendering: \"geometricPrecision\",\r\n        color: \"#fff\",\r\n      }}\r\n    >\r\n      {/* Ambient terrain bleed under the route */}\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          inset: 0,\r\n          opacity: fillIn,\r\n          background:\r\n            \"radial-gradient(120% 55% at 54% 90%, rgba(214,124,54,0.32), transparent 60%), radial-gradient(70% 40% at 46% 62%, rgba(104,158,92,0.24), transparent 62%)\",\r\n        }}\r\n      />\r\n\r\n      {/* Route + glow + draw head */}\r\n      <svg\r\n        width={SCREEN_W}\r\n        height={SCREEN_H}\r\n        viewBox={`0 0 ${SCREEN_W} ${SCREEN_H}`}\r\n        style={{ position: \"absolute\", inset: 0 }}\r\n      >\r\n        <title>ride route</title>\r\n        <defs>\r\n          <linearGradient\r\n            id=\"pf-elev\"\r\n            x1=\"0\"\r\n            y1=\"340\"\r\n            x2=\"0\"\r\n            y2=\"470\"\r\n            gradientUnits=\"userSpaceOnUse\"\r\n          >\r\n            <stop offset=\"0\" stopColor=\"#7FA85E\" stopOpacity=\"0.32\" />\r\n            <stop offset=\"0.55\" stopColor=\"#BE9150\" stopOpacity=\"0.28\" />\r\n            <stop offset=\"1\" stopColor=\"#DE8138\" stopOpacity=\"0.42\" />\r\n          </linearGradient>\r\n          <filter id=\"pf-glow\" x=\"-40%\" y=\"-40%\" width=\"180%\" height=\"180%\">\r\n            <feGaussianBlur stdDeviation=\"4.5\" />\r\n          </filter>\r\n        </defs>\r\n\r\n        <path d={ROUTE_PATH} fill=\"url(#pf-elev)\" opacity={fillIn} />\r\n\r\n        {/* connectors from pills down to the route */}\r\n        {PILLS.map((p) => (\r\n          <line\r\n            key={`c-${p.title}`}\r\n            x1={p.anchor[0]}\r\n            y1={p.anchor[1]}\r\n            x2={p.x + 22}\r\n            y2={p.y + 30}\r\n            stroke=\"rgba(255,255,255,0.28)\"\r\n            strokeWidth={1}\r\n            opacity={interpolate(\r\n              frame,\r\n              [p.appear, p.appear + 10],\r\n              [0, 1],\r\n              CLAMP,\r\n            )}\r\n          />\r\n        ))}\r\n\r\n        {/* glow underlay + crisp stroke, both revealed by the draw */}\r\n        <path\r\n          d={ROUTE_PATH}\r\n          fill=\"none\"\r\n          stroke=\"#FFEBD6\"\r\n          strokeWidth={7}\r\n          strokeLinecap=\"round\"\r\n          opacity={0.55}\r\n          pathLength={1}\r\n          strokeDasharray={1}\r\n          strokeDashoffset={1 - draw}\r\n          filter=\"url(#pf-glow)\"\r\n        />\r\n        <path\r\n          d={ROUTE_PATH}\r\n          fill=\"none\"\r\n          stroke=\"#FFFFFF\"\r\n          strokeWidth={2.4}\r\n          strokeLinecap=\"round\"\r\n          pathLength={1}\r\n          strokeDasharray={1}\r\n          strokeDashoffset={1 - draw}\r\n        />\r\n\r\n        {/* anchor dots where pills attach */}\r\n        {PILLS.map((p) => (\r\n          <circle\r\n            key={`a-${p.title}`}\r\n            cx={p.anchor[0]}\r\n            cy={p.anchor[1]}\r\n            r={2.4}\r\n            fill=\"#EE8348\"\r\n            opacity={interpolate(\r\n              frame,\r\n              [p.appear, p.appear + 8],\r\n              [0, 0.95],\r\n              CLAMP,\r\n            )}\r\n          />\r\n        ))}\r\n\r\n        {/* draw head */}\r\n        {draw > 0 && (\r\n          <>\r\n            <circle\r\n              cx={head.x}\r\n              cy={head.y}\r\n              r={7}\r\n              fill=\"#FFFFFF\"\r\n              filter=\"url(#pf-glow)\"\r\n            />\r\n            <circle cx={head.x} cy={head.y} r={3.4} fill=\"#FFFFFF\" />\r\n          </>\r\n        )}\r\n      </svg>\r\n\r\n      {/* Insight pills */}\r\n      {PILLS.map((p) => {\r\n        const t = interpolate(frame, [p.appear, p.appear + 12], [0, 1], {\r\n          ...CLAMP,\r\n          easing: ease,\r\n        });\r\n        return (\r\n          <div\r\n            key={p.title}\r\n            style={{\r\n              position: \"absolute\",\r\n              left: p.x,\r\n              top: p.y,\r\n              display: \"flex\",\r\n              alignItems: \"center\",\r\n              gap: 6,\r\n              padding: \"4px 9px 4px 4px\",\r\n              borderRadius: 999,\r\n              background: \"rgba(26,24,23,0.82)\",\r\n              border: \"1px solid rgba(255,255,255,0.07)\",\r\n              opacity: t,\r\n              transform: `translateY(${(1 - t) * 6}px)`,\r\n            }}\r\n          >\r\n            <div\r\n              style={{\r\n                width: 18,\r\n                height: 18,\r\n                borderRadius: 999,\r\n                background: \"rgba(255,255,255,0.08)\",\r\n                display: \"flex\",\r\n                alignItems: \"center\",\r\n                justifyContent: \"center\",\r\n              }}\r\n            >\r\n              <PillIcon kind={p.icon} color={p.tint} />\r\n            </div>\r\n            <div\r\n              style={{\r\n                display: \"flex\",\r\n                flexDirection: \"column\",\r\n                lineHeight: 1.15,\r\n              }}\r\n            >\r\n              <span\r\n                style={{\r\n                  fontSize: 8.5,\r\n                  fontWeight: 700,\r\n                  letterSpacing: \"0.04em\",\r\n                  color: \"#F4F1EC\",\r\n                }}\r\n              >\r\n                {p.title}\r\n              </span>\r\n              <span style={{ fontSize: 8, color: \"rgba(232,227,220,0.6)\" }}>\r\n                {p.sub}\r\n              </span>\r\n            </div>\r\n          </div>\r\n        );\r\n      })}\r\n\r\n      {/* Status bar (split around the dynamic island) */}\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          top: 14,\r\n          left: 18,\r\n          right: 16,\r\n          display: \"flex\",\r\n          justifyContent: \"space-between\",\r\n          alignItems: \"center\",\r\n        }}\r\n      >\r\n        <div style={{ display: \"flex\", alignItems: \"center\", gap: 5 }}>\r\n          <span style={{ fontSize: 13, fontWeight: 700 }}>9:41</span>\r\n          <svg\r\n            aria-hidden\r\n            width={12}\r\n            height={12}\r\n            viewBox=\"0 0 24 24\"\r\n            fill=\"none\"\r\n            stroke=\"#fff\"\r\n            strokeWidth={2}\r\n            strokeLinecap=\"round\"\r\n          >\r\n            <title>alerts off</title>\r\n            <path d=\"M6 8a6 6 0 0 1 9-5\" />\r\n            <path d=\"M18 8v5l2 3H8\" />\r\n            <path d=\"M10.5 19a2 2 0 0 0 3 0\" />\r\n            <path d=\"M3 3l18 18\" />\r\n          </svg>\r\n        </div>\r\n        <StatusIcons />\r\n      </div>\r\n\r\n      {/* Nav row */}\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          top: 40,\r\n          left: 18,\r\n          right: 16,\r\n          display: \"flex\",\r\n          justifyContent: \"space-between\",\r\n          alignItems: \"center\",\r\n        }}\r\n      >\r\n        <span style={{ fontSize: 10, color: \"rgba(255,255,255,0.5)\" }}>\r\n          System voice\r\n        </span>\r\n        <span style={{ fontSize: 11, fontWeight: 600, color: \"#fff\" }}>\r\n          Save\r\n        </span>\r\n      </div>\r\n\r\n      {/* Athlete selector */}\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          top: 60,\r\n          right: 16,\r\n          display: \"flex\",\r\n          alignItems: \"center\",\r\n          gap: 3,\r\n          fontSize: 12,\r\n          fontWeight: 600,\r\n        }}\r\n      >\r\n        Eddy\r\n        <svg\r\n          aria-hidden\r\n          width={9}\r\n          height={9}\r\n          viewBox=\"0 0 24 24\"\r\n          fill=\"none\"\r\n          stroke=\"#fff\"\r\n          strokeWidth={3}\r\n          strokeLinecap=\"round\"\r\n          strokeLinejoin=\"round\"\r\n        >\r\n          <title>expand</title>\r\n          <path d=\"M6 9l6 6 6-6\" />\r\n        </svg>\r\n      </div>\r\n\r\n      {/* Stats row + reset */}\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          top: 86,\r\n          left: 18,\r\n          right: 16,\r\n          display: \"flex\",\r\n          alignItems: \"flex-start\",\r\n          justifyContent: \"space-between\",\r\n        }}\r\n      >\r\n        <div style={{ display: \"flex\", gap: 14 }}>\r\n          <Stat value=\"16.5\" unit=\"mph\" label=\"AVG\" />\r\n          <Stat value=\"147\" unit=\"bpm\" label=\"AVG HR •\" accent />\r\n          <Stat value=\"26.0\" unit=\"mph\" label=\"MAX\" />\r\n          <Stat value=\"606\" unit=\"ft\" label=\"ASCENT\" />\r\n        </div>\r\n        <div\r\n          style={{\r\n            width: 26,\r\n            height: 26,\r\n            borderRadius: 999,\r\n            background: \"rgba(255,255,255,0.1)\",\r\n            display: \"flex\",\r\n            alignItems: \"center\",\r\n            justifyContent: \"center\",\r\n          }}\r\n        >\r\n          <svg\r\n            aria-hidden\r\n            width={13}\r\n            height={13}\r\n            viewBox=\"0 0 24 24\"\r\n            fill=\"none\"\r\n            stroke=\"#fff\"\r\n            strokeWidth={2}\r\n            strokeLinecap=\"round\"\r\n            strokeLinejoin=\"round\"\r\n          >\r\n            <title>reset</title>\r\n            <path d=\"M3 12a9 9 0 1 0 3-6.7L3 8\" />\r\n            <path d=\"M3 3v5h5\" />\r\n          </svg>\r\n        </div>\r\n      </div>\r\n\r\n      {/* Scrub hint */}\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          bottom: 54,\r\n          left: 0,\r\n          right: 0,\r\n          textAlign: \"center\",\r\n          fontSize: 9,\r\n          color: \"rgba(255,255,255,0.34)\",\r\n          opacity: hint,\r\n        }}\r\n      >\r\n        Scrub along the bottom · Drag to explore\r\n      </div>\r\n    </div>\r\n  );\r\n}\r\n\r\nconst isVideo = (src: string) => /\\.(mp4|webm|mov|m4v)(\\?|$)/i.test(src);\r\n\r\n/**\r\n * A root-relative asset (`/showcase-mobile-videos/x.mp4`) is served at the\r\n * origin root by Next in the Player, but Remotion Studio and a render serve `public/` through\r\n * `staticFile()` alone — so rewrite local paths everywhere but the Player, and\r\n * pass http(s)/data/blob URLs straight through.\r\n */\r\nfunction resolveSrc(src: string): string {\r\n  const isLocal = src.startsWith(\"/\") && !src.startsWith(\"//\");\r\n  if (!isLocal || getRemotionEnvironment().isPlayer) return src;\r\n  // A value that already came out of staticFile() carries the static base\r\n  // (`/static-<hash>/…`); running it through again would prefix it twice.\r\n  const base = staticFile(\"_\").slice(0, -2);\r\n  if (base && src.startsWith(`${base}/`)) return src;\r\n  try {\r\n    return staticFile(src.replace(/^\\/+/, \"\"));\r\n  } catch {\r\n    return src;\r\n  }\r\n}\r\n\r\n/** Fills the screen with an image or a video, fading and un-blurring it in. */\r\nfunction ScreenMedia({ src, frame }: { src: string; frame: number }) {\r\n  const t = interpolate(frame, [4, 22], [0, 1], CLAMP);\r\n  const style: CSSProperties = {\r\n    position: \"absolute\",\r\n    inset: 0,\r\n    width: \"100%\",\r\n    height: \"100%\",\r\n    // Tailwind's preflight sets `img { max-width: 100% }`, which can collapse a\r\n    // media element we size ourselves to 0px wide. Opt out. (motion-quality skill.)\r\n    maxWidth: \"none\",\r\n    objectFit: \"cover\",\r\n    opacity: t,\r\n    filter: `blur(${(1 - t) * 8}px)`,\r\n  };\r\n  const resolved = resolveSrc(src);\r\n  return isVideo(src) ? (\r\n    <OffthreadVideo src={resolved} muted style={style} />\r\n  ) : (\r\n    <Img src={resolved} style={style} />\r\n  );\r\n}\r\n\r\nexport function PhoneFrame({\r\n  children,\r\n  screenSrc,\r\n  variant = \"flat\",\r\n  entrance = \"rise\",\r\n  bezelColor,\r\n  screenColor,\r\n  theme,\r\n  mode,\r\n  fontFamily,\r\n  radius,\r\n  screenRadius,\r\n  shadow,\r\n  scale = 1,\r\n  showDynamicIsland = true,\r\n  floatLoop = true,\r\n  floatAmplitude = 6,\r\n  tiltAngle = -12,\r\n  speed = 1,\r\n  className,\r\n}: PhoneFrameProps) {\r\n  const frame = useCurrentFrame() * speed;\r\n  const { fps, durationInFrames } = useVideoConfig();\r\n  // The screen carries the app, so it follows the app theme. The body and the\r\n  // Dynamic Island are a physical object: they take the dark end of the system\r\n  // whatever mode the screen is in.\r\n  const t = useKuchiTheme(theme, mode);\r\n  const face = resolveFont(fontFamily ?? t.fontFamily) ?? FONT_FAMILY;\r\n  const island = useKuchiTheme(theme, \"dark\");\r\n  const body = bezelColor ?? t.foreground;\r\n  const glass = screenColor ?? t.card;\r\n  const drop = shadow ?? `0 24px 60px ${withAlpha(t.foreground, 0.18)}`;\r\n\r\n  const bodyRadius = radius ?? deviceRadius(DEVICE_WIDTH);\r\n  const innerRadius = screenRadius ?? screenRadiusFor(bodyRadius);\r\n\r\n  const pose = entrancePose(frame, entrance);\r\n  const floatStart = entrance === \"float\" ? 0 : ENTRANCE_FRAMES;\r\n  const bob = floatLoop\r\n    ? floatOffset(frame, fps, floatAmplitude, floatStart)\r\n    : 0;\r\n\r\n  const crane =\r\n    variant === \"showcase\" ? showcasePose(frame, durationInFrames) : null;\r\n\r\n  return (\r\n    <div\r\n      className={className}\r\n      style={{\r\n        position: \"absolute\",\r\n        inset: 0,\r\n        display: \"flex\",\r\n        alignItems: \"center\",\r\n        justifyContent: \"center\",\r\n        fontFamily: face,\r\n      }}\r\n    >\r\n      {/* Entrance + float rig */}\r\n      <div\r\n        style={{\r\n          opacity: pose.opacity,\r\n          translate: `0px ${pose.translateY + bob}px`,\r\n          rotate: `${pose.rotateDeg}deg`,\r\n          scale: `${pose.scale * scale}`,\r\n        }}\r\n      >\r\n        {/* Camera: pan + zoom in screen space, outside the perspective (showcase only) */}\r\n        <div\r\n          style={{\r\n            transform: crane\r\n              ? `translate(${crane.x}px, ${crane.y}px) scale(${crane.zoom})`\r\n              : undefined,\r\n          }}\r\n        >\r\n          {/* Device orientation: crane pose (showcase), static rotateY (tilt), or flat */}\r\n          <div\r\n            style={{\r\n              transform: `perspective(1400px) rotateX(${\r\n                crane ? crane.rotateX : 0\r\n              }deg) rotateY(${\r\n                crane ? crane.rotateY : variant === \"tilt\" ? tiltAngle : 0\r\n              }deg) rotateZ(${crane ? crane.rotateZ : 0}deg)`,\r\n            }}\r\n          >\r\n            {/* Device body */}\r\n            <div\r\n              style={{\r\n                position: \"relative\",\r\n                width: DEVICE_WIDTH,\r\n                height: DEVICE_HEIGHT,\r\n                borderRadius: bodyRadius,\r\n                backgroundColor: body,\r\n                padding: BEZEL_WIDTH,\r\n                ...(shadow === \"\" ? {} : { boxShadow: drop }),\r\n              }}\r\n            >\r\n              {/* Side buttons */}\r\n              {SIDE_BUTTONS.map((button) => (\r\n                <div\r\n                  key={`${button.side}-${button.top}`}\r\n                  style={{\r\n                    position: \"absolute\",\r\n                    top: button.top,\r\n                    [button.side]: -3,\r\n                    width: 3,\r\n                    height: button.length,\r\n                    borderRadius: 2,\r\n                    backgroundColor: body,\r\n                  }}\r\n                />\r\n              ))}\r\n\r\n              {/* Screen */}\r\n              <div\r\n                style={{\r\n                  position: \"relative\",\r\n                  width: \"100%\",\r\n                  height: \"100%\",\r\n                  borderRadius: innerRadius,\r\n                  backgroundColor: glass,\r\n                  overflow: \"hidden\",\r\n                }}\r\n              >\r\n                {children ??\r\n                  (screenSrc ? (\r\n                    <ScreenMedia src={screenSrc} frame={frame} />\r\n                  ) : (\r\n                    <RideSummaryDemo frame={frame} face={face} />\r\n                  ))}\r\n\r\n                {/* Dynamic island */}\r\n                {showDynamicIsland && (\r\n                  <div\r\n                    style={{\r\n                      position: \"absolute\",\r\n                      top: 10,\r\n                      left: \"50%\",\r\n                      translate: \"-50% 0px\",\r\n                      width: 90,\r\n                      height: 26,\r\n                      borderRadius: 999,\r\n                      backgroundColor: island.background,\r\n                      zIndex: 10,\r\n                      display: \"flex\",\r\n                      alignItems: \"center\",\r\n                      justifyContent: \"flex-end\",\r\n                      paddingRight: 9,\r\n                    }}\r\n                  >\r\n                    {/* Camera lens */}\r\n                    <div\r\n                      style={{\r\n                        width: 9,\r\n                        height: 9,\r\n                        borderRadius: 999,\r\n                        backgroundColor: island.card,\r\n                        border: `1px solid ${island.border}`,\r\n                      }}\r\n                    />\r\n                  </div>\r\n                )}\r\n              </div>\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n  );\r\n}\r\n"}]}