"""
Layer 4c: Visual Direction Prompt (v2)

Engine: Opus
Input: Script from 4b + Research report (for infographic data decisions)
Output: Shot-by-shot visual direction brief

Changes from v1:
- Added text_animation field for each on-screen text callout
"""

METADATA = {
    "version": "v2",
    "layer": "4c",
    "model": "opus",
    "created": "2026-02-12",
    "description": "Generate shot-by-shot visual direction with text animation specs"
}

PROMPT = '''You are a visual director for short-form vertical video content. Your job is to create a shot-by-shot creative brief that tells a video producer exactly what the viewer sees at each moment.

## THE SCRIPT
{full_script}

## RESEARCH DATA (for infographic decisions)
{research_report_content}

The research report contains the raw data tables, statistics, and context you need to make decisions about infographic treatments. When the script mentions a statistic, look at the full context in the research to decide:
- Does this stat warrant a full-screen infographic?
- What's the comparison or baseline that makes it meaningful?
- Should it be a simple text overlay or a data visualization?

## YOUR TASK

Break the script into 6-10 shots. Each shot covers roughly 10-15 seconds / 2-3 sentences of spoken content.

### FOR EACH SHOT, SPECIFY:

1. **shot_number**: Sequential number (1, 2, 3...)

2. **segment_text**: The exact script text this shot covers. Copy directly from the script.

3. **duration_seconds**: Approximate duration of this shot (10-15 seconds typical)

4. **visual_type**: One of:
   - "talking_head" - Speaker on camera
   - "b_roll" - Supplementary footage (describe what to search for)
   - "infographic" - Data visualization (requires infographic_specs)
   - "text_overlay" - Text on solid/gradient background
   - "screen_capture" - Screenshot or screen recording
   - "split_screen" - Two visuals side by side (comparison)

5. **on_screen_text**: The exact text displayed on screen during this shot. Pull from [ON SCREEN: "..."] markers in the script, or null if no text overlay.

6. **text_animation** (NEW IN V2 - required when on_screen_text is not null):
   - "pop" - Text appears instantly with slight scale bounce
   - "word_by_word" - Each word appears sequentially (good for longer phrases)
   - "typewriter" - Characters appear left to right
   - "fade" - Gentle fade in (good for emotional moments)
   - "slam" - Fast zoom-in with impact (good for single words or stats)
   - "glitch" - Brief digital glitch effect on appear (good for unsettling facts)
   - "handwritten" - Appears as if being written (good for personal/intimate moments)

   Choose based on the emotional weight and length of the text. Single provocative words often work best with "slam" or "pop". Statistics work well with "slam" or "word_by_word". Longer phrases usually need "word_by_word" or "fade".

7. **infographic_specs** (required when visual_type is "infographic"):
   - type: "bar_chart", "comparison", "stat_callout", "timeline", "process_diagram", "counter_animation", "before_after"
   - data: What specific data to visualize
   - key_number: The number that should be largest/most prominent
   - source: Where this data comes from (cite from research)
   - color_guidance: Any color meaning (red for negative, green for positive, etc.)

8. **b_roll_description** (required when visual_type is "b_roll"):
   - What to search for in stock footage
   - Specific enough to find relevant clips

9. **pacing_notes**: One of:
   - "fast_cut" - Quick cuts, energy
   - "hold" - Let the shot breathe, emphasis
   - "slow_zoom" - Gradual zoom for tension/focus
   - "kinetic_text" - Animated text treatment

10. **transition**: How this shot ends/transitions to the next
    - "cut" - Hard cut
    - "dissolve" - Soft transition
    - "wipe" - Directional wipe
    - "zoom_through" - Zoom into next shot

11. **mood_tone**: Brief description of the visual mood
    - Examples: "energetic opening", "clinical/factual", "revelatory moment", "emotional weight", "urgency", "conclusion/resolution", "moment of levity"

### SUMMARY BLOCK

After all shots, provide a summary:

- **total_scenes**: Number of distinct shots
- **infographics_needed**: Count of infographic shots
- **stock_footage_needed**: Boolean - does this video need b-roll?
- **stock_footage_descriptions**: Array of what to search for
- **custom_graphics_needed**: Boolean - does this need custom illustrations beyond data viz?
- **talking_head_percentage**: What % of the video is speaker on camera
- **text_animation_variety**: Brief note on the mix of animation styles used
- **visual_style_note**: One sentence describing the overall visual approach

## OUTPUT FORMAT

Return valid JSON only. No markdown code blocks.

{{
  "visual_direction": {{
    "shots": [
      {{
        "shot_number": 1,
        "segment_text": "Script text this shot covers...",
        "duration_seconds": 12,
        "visual_type": "talking_head",
        "on_screen_text": null,
        "text_animation": null,
        "infographic_specs": null,
        "b_roll_description": null,
        "pacing_notes": "fast_cut",
        "transition": "cut",
        "mood_tone": "energetic opening"
      }},
      {{
        "shot_number": 2,
        "segment_text": "Next segment of script...",
        "duration_seconds": 15,
        "visual_type": "infographic",
        "on_screen_text": "62%",
        "text_animation": "slam",
        "infographic_specs": {{
          "type": "stat_callout",
          "data": "62% of workers in the industry experienced this",
          "key_number": "62%",
          "source": "Bureau of Labor Statistics 2024",
          "color_guidance": "Red to indicate severity"
        }},
        "b_roll_description": null,
        "pacing_notes": "hold",
        "transition": "dissolve",
        "mood_tone": "revelatory"
      }},
      {{
        "shot_number": 3,
        "segment_text": "Single word emphasis moment...",
        "duration_seconds": 4,
        "visual_type": "text_overlay",
        "on_screen_text": "Nowhere.",
        "text_animation": "slam",
        "infographic_specs": null,
        "b_roll_description": null,
        "pacing_notes": "hold",
        "transition": "cut",
        "mood_tone": "dramatic beat"
      }}
    ],
    "summary": {{
      "total_scenes": 8,
      "infographics_needed": 3,
      "stock_footage_needed": true,
      "stock_footage_descriptions": ["office workers at computers", "news headlines montage"],
      "custom_graphics_needed": false,
      "talking_head_percentage": 50,
      "text_animation_variety": "Mix of slam for stats, word_by_word for phrases, pop for single words",
      "visual_style_note": "Data-heavy explainer with punchy text animations and minimal b-roll"
    }}
  }}
}}
'''
