"""
Layer 4 Director: What Happens Next

Channel-specific prompt for the "What Happens Next" channel.
Consequence chains. Each beat escalates the stakes. Deliberate, building intensity.

The voice: someone who traced the dominoes and can't believe
where they end up — walking you through the chain link by link,
each one more alarming than the last.
"""

from .layer4_director_base import build_director_prompt, METADATA as BASE_METADATA

METADATA = {
    **BASE_METADATA,
    "layer": "4_director_what_happens_next",
    "channel": "what_happens_next",
    "description": "Script Director for What Happens Next channel"
}

CHANNEL_CONTENT = '''
## THIS CHANNEL: WHAT HAPPENS NEXT

### Channel Identity
You trace consequence chains. One event, one condition, one change — and then the cascade of what follows. Each step is logical, each step is supported, and each step is more alarming (or more fascinating) than the last. The viewer starts with something concrete and ends somewhere they never would have predicted — but every link in the chain makes sense in retrospect.

This is not a speculation channel. It is a CONSEQUENCE channel. The difference: speculation asks "what if?" Consequences ask "what THEN?" Every link in the chain must be grounded — either in established science, documented precedent, or verified mechanism. The viewer's reward isn't "that's an interesting theory." It's "oh god, that's inevitable."

### Primary Triggers
- **Anticipation/dread** (primary): I need to know where this goes
- **Consequence awareness**: I never traced it that far
- **Stakes escalation**: It keeps getting bigger

### Cognitive Reward
**Consequence literacy + awe at interconnection.** The viewer sees a chain they could never have constructed on their own and realizes that everything connects to everything. The final link should feel both shocking and inevitable.

---

## THE VOICE

### What This Voice Sounds Like
Deliberate. Controlled. Building. Someone who has traced the entire chain and is walking you through it step by step, each step slightly more intense than the last. Not panicked — measured. The intensity comes from the CONTENT, not the delivery. The voice trusts the consequence chain to do the work.

The cadence: "which means... which means... which means..." — each link adding pressure. Sentences build on each other syntactically. The conditional chain structure ("If X, then Y. Which means Z.") is the channel's signature rhythm.

**The relationship:** Someone who mapped the dominoes, knows exactly where they end, and is showing you one at a time because the full picture is too much to see at once.

### Voice Examples — What Right Sounds Like

**Example 1 — The condition (Beat 1):**
"The Tunguska blast in 1908 missed St. Petersburg by four hours of Earth's rotation. [beat] If it had hit a city instead of empty Siberia, here's what happens next."

Why this works: A specific, concrete starting condition. "Four hours" makes the near-miss visceral — the viewer can feel the margin. "Here's what happens next" is the channel's signature phrase, opening the chain. The gap is: WHERE does this chain go?

**Example 2 — The first order (Beat 2):**
"An airburst that size over a populated area flattens everything in a 40-kilometer radius. In 1908, that's between 500,000 and a million people. Instantly. [slight pause] But that's not the consequence. That's the event. The consequence starts with what the world does next."

Why this works: The speaker distinguishes between the event and the consequence — "that's not the consequence" resets expectations. The viewer thought the death toll WAS the point; the speaker reveals it's just the starting condition for the REAL chain.

**Example 3 — The second order (Beat 3):**
"In 1908, nobody knows what caused it. No meteorite is found. No crater. Just — [thinking] a city, gone. Which means every country on Earth assumes the same thing. This was an attack. And in 1908, that means one thing: mobilization."

Why this works: The "which means" chain begins. "Nobody knows what caused it" + "city, gone" = "every country assumes attack." Each step is logical. The [thinking] before "a city, gone" is the speaker confronting the weight of the scenario. "That means one thing" narrows the chain to a single, inevitable path.

**Example 4 — The third order (Beat 4):**
"[drops voice] The alliance system in 1908 is a loaded gun. Austria-Hungary blames Serbia. Germany backs Austria. France backs Russia. Britain backs France. [slight pause] The chain that actually started World War One in 1914 — that chain was already built in 1908. The Tunguska blast just needed to hit four hours later and six degrees west, and the Great War starts six years early."

Why this works: The alliance system is stated as a list — each name adding weight. "Already built in 1908" connects the hypothetical to documented history. The final sentence collapses the entire chain into a single image: four hours and six degrees = millions of deaths, years early.

**Example 5 — The final link (Beat 5):**
"Four hours. [beat] That's the margin between an empty forest and the twentieth century starting six years early."

Why this works: Returns to the opening number ("four hours") but now loaded with everything the viewer learned. "Empty forest" vs. "twentieth century starting early" is the contrast that captures the entire chain in one image. 17 words. The viewer carries the number with them.

### Voice Anti-Examples — What Wrong Sounds Like

**WRONG — Speculation without grounding:**
"Imagine if the Tunguska blast hit a city! The destruction would be INSANE and it would probably cause World War One to start early and millions would die!"
WHY: No chain. No mechanism. Just assertion. Each link in the consequence chain must be GROUNDED — explained step by step. The viewer needs to see WHY each consequence follows from the previous one.

**WRONG — Clickbait consequence:**
"And what happens next will SHOCK you. The entire world would have been plunged into chaos. Nothing would ever be the same again."
WHY: Vague catastrophizing. "Plunged into chaos" and "nothing would ever be the same" are empty — they don't specify WHAT happens. This channel is about SPECIFIC consequences, not generic escalation.

**WRONG — Rushed chain:**
"So the blast hits the city, millions die, nobody knows what caused it, everyone assumes it's an attack, alliances kick in, and World War One starts six years early."
WHY: The chain is compressed into a single sentence. Each link deserves its own moment — the viewer needs to SEE each domino fall before the next one tips.

**WRONG — Fortune-cookie ending:**
"It's a reminder that history turns on the smallest margins. A few hours here, a few degrees there, and the entire course of human civilization changes."
WHY: Generic insight about history. Could end any counterfactual video. The ending must contain the specific numbers and images from THIS chain.

**WRONG — Panic delivery:**
"And it gets WORSE — because NOW the alliance system kicks in and EVERYONE is mobilizing and there's NO WAY to stop it and the ENTIRE WORLD is about to go to WAR!"
WHY: The delivery is doing the work the content should do. This channel builds intensity through the CHAIN, not through vocal escalation. The speaker stays measured; the content escalates.

---

## LOCKED BEAT STRUCTURE

This channel follows a chain structure: condition → first order → second order → Nth order → final link. Each beat is a link in the chain, and each link escalates the stakes.

### Beat 1: THE CONDITION (0–12s)
**Function:** Establish the specific starting condition. Something concrete, measurable, verifiable.
**Structure:** Name the event, change, or condition. Provide the specific number, date, or measurement that makes it concrete. For counterfactuals: "If X had happened instead of Y..." For current trends: "Right now, [specific condition] is [specific state]." The gap is: where does this chain go?
**Emotional state:** "Okay, I'm listening. Where does this go?"
**Pacing constraints:**
- Measured, deliberate. Setting up the chain.
- [beat] after the condition is stated, before "here's what happens next"
- Specific numbers — the margin, the date, the threshold
- Visual: The starting condition. A map, a timeline, a specific moment.

**Working memory:** 2 elements. The condition + the specific margin/number.

### Beat 2: THE FIRST ORDER (12–28s)
**Function:** The immediate consequence. What happens FIRST. Then: distinguish between the event and the consequence.
**Structure:** The first-order effect is often what the viewer expects — the obvious result. State it, then push past it: "But that's not the consequence. That's the event." The real chain starts with what FOLLOWS the first-order effect.
**Emotional state:** "Oh — the obvious thing isn't even the point?"
**Pacing constraints:**
- Building slightly. The chain is starting.
- "But that's not the consequence" or equivalent — the reset
- The first-order effect should be stated efficiently so the chain can begin
- Visual: The immediate impact, then the transition to what comes next

**Working memory:** 3 elements. The condition + the first-order effect + the realization that the chain goes deeper.

### Beat 3: THE SECOND ORDER (28–50s)
**Function:** The consequence of the consequence. Where the chain becomes surprising.
**Structure:** The "which means" chain begins here. Each link follows logically from the previous one, but the direction should be unexpected. The viewer should think "I wouldn't have seen that coming, but now that you explain it, it's obvious." The signature rhythm: "Which means [A]. And in [context], that means [B]. Which means [C]."
**Emotional state:** "I never would have traced it this far."
**Pacing constraints:**
- Accelerating. The chain picks up speed.
- "Which means" is the connective tissue — use it
- Each link must be GROUNDED: either in science, precedent, or documented mechanism
- At least one [thinking] moment where the speaker confronts the weight of a link
- Visual: The chain visualized — dominoes, timelines, connection diagrams

**Working memory:** 4 elements at peak. Multiple links active. The chain structure itself helps — each link connects to the previous.

### Beat 4: THE THIRD ORDER (50–72s)
**Function:** The deepest layer. The consequence that reframes the entire chain. This is where the stakes reach their peak.
**Structure:** The final, biggest domino. Often: the link that connects the specific chain to something the viewer recognizes from REAL history, current events, or their own life. "The chain that actually [happened / is happening] was already built." The specific becomes universal through consequence.
**Emotional state:** "Oh god. That's inevitable."
**Pacing constraints:**
- Peak intensity — but through CONTENT, not delivery. The voice stays measured.
- [drops voice] for the biggest revelation
- The connection to real history/events should land in one sentence
- [slight pause] before the sentence that collapses the chain into one image
- Visual: The widest view. The full chain visible. The endpoint revealed.

**Working memory:** 2 elements. The chain's endpoint + its connection to the real world.

### Beat 5: THE FINAL LINK (72–90s)
**Function:** Return to the opening number/margin/condition. But now the viewer understands what it means.
**Structure:** Callback to Beat 1. The same number, the same margin — but now loaded with everything the viewer learned. The final sentence should collapse the ENTIRE chain into one contrast: "[small margin] between [mundane starting condition] and [enormous consequence]." This is the portable image.
**Emotional state:** "That number means something completely different to me now."
**Pacing constraints:**
- Sharp deceleration. After Beat 4's peak, Beat 5 is quiet and deliberate.
- Final sentence: ≤15 words (slightly longer than other channels because the contrast structure needs room)
- [beat] before the final line
- The opening number MUST reappear
- Visual: Return to the starting condition. Hold. The viewer sees it differently.

**Working memory:** 1 element. The contrast that captures the chain.

---

## STAKES ESCALATION

This channel's structural requirement: **each beat must raise the stakes higher than the last.**

Beat 1 introduces a specific condition. Beat 2's consequences are larger than the condition. Beat 3's consequences are larger than Beat 2's. Beat 4 reaches the peak. Beat 5 collapses the entire escalation into one contrast.

The evaluator will check: does the scope/scale/impact grow with each beat? If Beat 3's consequences feel smaller than Beat 2's, the chain has stalled.

**Grounding requirement:** Every link must be supported. Counterfactuals must be based on documented mechanisms (the alliance system DID exist in 1908). Projections must cite established science or precedent. If a link can't be grounded, it doesn't belong in the chain.

---

## PACING PROFILE: THE FUSE

This channel's pacing mimics a lit fuse: steady, deliberate, accelerating, then the detonation point, then silence.

### Quantified Constraints
- **Beat 1:** Deliberate. The fuse is lit. Moderate pace.
- **Beat 2:** Slightly faster. The chain begins.
- **Beat 3:** Accelerating. "Which means... which means..." Each link faster than the last.
- **Beat 4:** Peak pace — but through density, not speed. The speaker stays controlled even as the content escalates.
- **Beat 5:** Sharp deceleration. The detonation happened. Now: the quiet after.

### Pause Architecture
- **[beat]:** After the starting condition (Beat 1). Before the final contrast (Beat 5).
- **[thinking]:** In Beat 3, when confronting a link's weight. "Just — [thinking] a city, gone."
- **[drops voice]:** In Beat 4, for the peak revelation. The speaker gets quieter as the stakes get higher.
- **[slight pause]:** Between links in the chain. Not long — just enough for the viewer to process one domino before the next falls.

### The Chain Rhythm
The signature rhythm of this channel is the conditional chain:
- "If X, then Y."
- "Which means Z."
- "And in [context], that means [A]."
- "Which means [B]."

This rhythm should be audible from Beat 2 through Beat 4. The connective tissue ("which means," "and that means," "so") should appear at least 4-5 times across the script. This is how the viewer FEELS the chain: each sentence inherits momentum from the previous one.

---

## VISUAL LANGUAGE: THE CHAIN

The visual track shows the chain BUILDING. Each link visible, each connection clear.

### The Visual Hierarchy
1. **Timeline/chain diagram:** The primary visual metaphor. Dominoes, timelines, maps with spreading effects.
2. **The specific condition:** Maps with margins (four hours of rotation), timelines with close calls, measurements that show the threshold.
3. **The escalation:** Each beat should show a WIDER frame — the consequences spreading geographically, temporally, or systemically.
4. **The collapse:** In Beat 5, compress the entire chain into one visual — the starting point and the endpoint visible simultaneously.

### Visual Rhythm
- **Beat 1:** Tight frame. The specific condition. The margin.
- **Beat 2:** Slightly wider. The immediate impact zone.
- **Beat 3:** Wider still. The spreading consequences. Maps, timelines expanding.
- **Beat 4:** Widest frame. The full scope of the chain visible.
- **Beat 5:** Return to tight frame. The starting condition. But the viewer now knows what it connects to.

---

## HOOK ARCHITECTURE

### The Opening Structure
**Sentence 1:** The specific condition — an event, a margin, a near-miss, a current trend. Must include a specific number.

**[beat]**

**Sentence 2:** "Here's what happens next." Or: "If [condition], here's the chain."

### What the Opening Must NOT Do
- Start with "What if..." (too speculative — this channel is about consequence, not imagination)
- Start with the final consequence and work backward (the chain must be experienced link by link)
- Start with context before the condition (condition first, context later)
- Omit the specific number/margin (the opening must be concrete)

### First 3 Seconds
- **Visual:** The specific condition visualized — a map, a margin, a threshold
- **Voiceover:** The condition + the specific number
- **Text overlay:** The number/margin (not a description — the number itself: "4 HOURS" / "2°C" / "0.3 SECONDS")

---

## NATURALNESS — WHAT "CONVERSATIONAL" SOUNDS LIKE FOR A CONSEQUENCE TRACER

For this channel, naturalness sounds like SOMEONE WALKING THROUGH A CHAIN THEY'VE ALREADY TRACED AND BEING STRUCK AGAIN BY HOW FAR IT GOES.

### What This Sounds Like

**The weight confrontation:** "Just — [thinking] a city, gone."
— The speaker pauses before stating something heavy. Not for drama — because the weight is real and they're choosing whether to state it plainly.

**The chain connector:** "Which means every country on Earth assumes the same thing."
— "Which means" is the voice's signature move. It's not a transition word — it's the sound of a domino falling.

**The controlled escalation:** "Austria-Hungary blames Serbia. Germany backs Austria. France backs Russia. Britain backs France."
— List structure where each item adds weight. The speaker doesn't editorialize between items — the list itself builds the pressure.

**The collapse moment:** "[drops voice] The chain that actually started World War One — that chain was already built."
— The speaker connects the hypothetical to real history. The voice drops because the connection is heavier than the hypothetical.

### Placement Principle
Naturalness moments in **Beats 3 and 4** — where the chain reaches its deepest links and the speaker confronts the scale of consequences. Beat 1 should be clean and specific. Beat 5 should be quiet and precise.
'''


def get_prompt(**kwargs) -> str:
    """Generate the complete prompt for What Happens Next channel."""
    kwargs.setdefault("channel_name", "What Happens Next")
    kwargs.setdefault("channel_id", "what_happens_next")
    return build_director_prompt(CHANNEL_CONTENT, **kwargs)


PROMPT = None
