#!/usr/bin/env python3
"""
Week 16: Telling Time β€” Hour, Half-Hour, Quarter-Hour, Nearest 5 Minutes
Phase 3: Measurement, Time & Money
Standards: 2.MD.C.7 (tell and write time to nearest 5 minutes, AM/PM)

New Standard:
- Reduced drill (40% fewer problems)
- Estimation before calculating (about what time is it?)
- Multiple strategies encouraged (count by 5s, quarter vocabulary, digital/analog)
- Better word problems (reasoning over keywords)
- Real challenges (open-ended thinking)
- Number talks (reason about time without counting every tick)
- Friday self-check with reflection
- Fact fluency warmup daily (skip counting by 5s supports clock reading)
- Word problems every day
"""

import os
import glob
from weasyprint import HTML

from math_helpers import (
    CSS, TEACHER_CSS,
    page, page_multi, hdr, sec, b, bw, bl,
    tg_page_multi, tg_sec, tg_note, tg_section_title,
    clock_svg,
)
from activity_builders import (
    build_clock_telling,
)

BASE = os.path.expanduser("~/Home_School/2nd_Grade/Math")
WEEK = os.path.join(BASE, "Week_16")


# ═══════════════════════════════════════════════════
# MONDAY β€” Hour and Half-Hour
# ═══════════════════════════════════════════════════
def monday():
    # 1: Fluency warmup β€” skip count by 5 (clock foundation)
    s1 = '<div class="abox" style="background:#e8f5e9;">'\
         '<p><b>2-min Fluency Warm-up</b> β€” Count by 5s. Fill in the missing numbers.</p>'\
         '<div class="mgrid c3">'
    for seq in ["5, 10, ___, 20", "25, ___, 35, 40", "___, 50, 55, 60", "10, 15, 20, ___"]:
        s1 += f'<div class="abox"><p>{seq}</p></div>'
    s1 += '</div></div>'

    # 2: Meet the clock β€” guided intro
    s2 = '<p class="note">The <b>short hand</b> is the hour hand. The <b>long red hand</b> is the minute hand. '\
         'When the minute hand points straight up at 12, it is <b>o\'clock</b>.</p>'
    s2 += '<div class="mgrid c2">'
    s2 += f'<div class="abox" style="text-align:center;">{clock_svg(3, 0, size=60)}<p>Hour hand on 3, minute hand on 12.</p><p><b>3:00 β€” "three o\'clock"</b></p></div>'
    s2 += f'<div class="abox" style="text-align:center;">{clock_svg(7, 30, size=60)}<p>Minute hand on 6 = 30 minutes.</p><p><b>7:30 β€” "half past seven"</b></p></div>'
    s2 += '</div>'

    # 3: Read the clocks β€” hours and half-hours (reduced from 8 to 4)
    s3 = build_clock_telling({
        "times": [
            {"hour": 5, "minute": 0, "blank": True},
            {"hour": 9, "minute": 30, "blank": True},
            {"hour": 11, "minute": 0, "blank": True},
            {"hour": 2, "minute": 30, "blank": True},
        ],
        "note": "Write the time shown on each clock. Look at the short hand first!"
    })

    # 4: Number Talk β€” reason about the hands WITHOUT counting ticks
    s4 = '<div class="abox" style="background:#e3f2fd;">'\
         '<p><b>Number Talk</b> β€” Explain WITHOUT calculating or counting ticks.</p>'\
         '<div class="mgrid c2">'
    s4 += '<div class="abox"><p>At 6:30, why is the hour hand <b>between</b> the 6 and the 7, not right on the 6?</p><p style="font-size:11px;">My thinking: ' + bw() + '</p></div>'
    s4 += '<div class="abox"><p>Which is later in the morning: 8:00 or 8:30? How do you know without a clock?</p><p style="font-size:11px;">My thinking: ' + bw() + '</p></div>'
    s4 += '</div></div>'

    # 5: Word problem
    s5 = '<div class="wp">'\
         '<p class="note">Read carefully. Think about what is happening.</p>'\
         '<div class="abox"><p style="font-size:0.95em;">Maya\'s soccer practice starts when the short hand points at 4 '\
         'and the long hand points straight up at 12. What time does practice start? Write it two ways: with numbers and with words.</p>'\
         '<p>Numbers: ' + b("4em") + '&nbsp;&nbsp; Words: ' + bw() + '</p></div></div>'

    return page(16, "Monday", "Telling Time: Hour and Half-Hour",
        f'''{sec(1, "Warm-up: Count by 5s", s1)}
{sec(2, "Meet the Clock", s2)}
{sec(3, "Read the Clocks", s3)}
{sec(4, "Number Talk: Thinking About the Hands", s4)}
{sec(5, "Word Problem", s5)}''')


# ═══════════════════════════════════════════════════
# TUESDAY β€” Quarter Hours + Estimation
# ═══════════════════════════════════════════════════
def tuesday():
    # 1: Fluency warmup β€” count by 5s starting anywhere
    s1 = '<div class="abox" style="background:#e8f5e9;">'\
         '<p><b>2-min Fluency Warm-up</b> β€” Keep counting by 5s.</p>'\
         '<div class="mgrid c3">'
    for start in [15, 30, 40, 5]:
        s1 += f'<div class="abox"><p>{start}, {start+5}, {b("3em")}, {b("3em")}</p></div>'
    s1 += '</div></div>'

    # 2: Quarter past / quarter to β€” guided
    s2 = '<p class="note">The clock face can be cut into <b>quarters</b>. Minute hand on the 3 = <b>quarter past</b> (15 min). '\
         'Minute hand on the 9 = <b>quarter to</b> the next hour (45 min).</p>'
    s2 += '<div class="mgrid c2">'
    s2 += f'<div class="abox" style="text-align:center;">{clock_svg(4, 15, size=60)}<p><b>4:15 β€” "quarter past four"</b></p></div>'
    s2 += f'<div class="abox" style="text-align:center;">{clock_svg(8, 45, size=60)}<p><b>8:45 β€” "quarter to nine"</b></p></div>'
    s2 += '</div>'

    # 3: Estimate First! β€” about what time is it?
    s3 = '<div class="abox" style="background:#fff3e0;">'\
         '<p><b>Estimate First!</b> Before reading exactly, look at the hour hand only. '\
         'ABOUT what time is it? Then write the exact time.</p>'\
         '<div class="mgrid c2">'
    for h, m in [(3, 15), (10, 45), (6, 15), (1, 45)]:
        s3 += f'<div class="abox" style="text-align:center;">{clock_svg(h, m, size=55)}'\
              f'<p>About: {b("4em")} o\'clock-ish</p>'\
              f'<p>Exact: {b("2em")}:{b("2em")}</p></div>'
    s3 += '</div></div>'

    # 4: Match analog to words (reduced from 8 to 4)
    s4 = '<p class="note">Draw a line, or write the letter of the matching words next to each clock.</p>'\
         '<div class="mgrid c2">'
    pairs = [
        (7, 15, "A. quarter past seven"),
        (2, 45, "B. quarter to three"),
        (12, 30, "C. half past twelve"),
        (5, 45, "D. quarter to six"),
    ]
    for h, m, label in pairs:
        s4 += f'<div class="abox" style="text-align:center;">{clock_svg(h, m, size=50)}<p>Matches: {b("2em")}</p></div>'
    s4 += '</div>'\
          '<p style="font-size:12px;">A. quarter past seven &nbsp; B. quarter to three &nbsp; C. half past twelve &nbsp; D. quarter to six</p>'

    # 5: Word problem
    s5 = '<div class="wp">'\
         '<p class="note">Read carefully. Think about what is happening.</p>'\
         '<div class="abox"><p style="font-size:0.95em;">Dad says dinner is at "quarter to six." Ben looks at the clock and it shows 5:45. '\
         'Is it dinner time? Explain how you know.</p>'\
         '<p style="font-size:11px;">My thinking: ' + bw() + '</p>'\
         '<p>Yes or no: ' + b("3em") + '</p></div></div>'

    return page(16, "Tuesday", "Quarter Past and Quarter To",
        f'''{sec(1, "Warm-up: Count by 5s", s1)}
{sec(2, "Quarters of the Clock", s2)}
{sec(3, "Estimate First!", s3)}
{sec(4, "Match Clocks to Words", s4)}
{sec(5, "Word Problem", s5)}''')


# ═══════════════════════════════════════════════════
# WEDNESDAY β€” Nearest 5 Minutes + Two Ways
# ═══════════════════════════════════════════════════
def wednesday():
    # 1: Fluency warmup
    s1 = '<div class="abox" style="background:#e8f5e9;">'\
         '<p><b>2-min Fluency Warm-up</b> β€” How many minutes?</p>'\
         '<div class="mgrid c3">'
    for q in ["Minute hand on 1 = ___ min", "Minute hand on 4 = ___ min",
              "Minute hand on 7 = ___ min", "Minute hand on 10 = ___ min"]:
        s1 += f'<div class="abox"><p style="font-size:0.9em;">{q}</p></div>'
    s1 += '</div></div>'

    # 2: Read to nearest 5 minutes (reduced from 9 to 5)
    s2 = build_clock_telling({
        "times": [
            {"hour": 3, "minute": 20, "blank": True},
            {"hour": 7, "minute": 55, "blank": True},
            {"hour": 10, "minute": 5, "blank": True},
            {"hour": 1, "minute": 40, "blank": True},
            {"hour": 6, "minute": 35, "blank": True},
        ],
        "note": "Count by 5s around the clock to read each time."
    })

    # 3: Two Ways β€” say the same time two different ways
    s3 = '<div class="abox">'\
         '<p class="note"><b>Two Ways</b> β€” Show two different ways to say each time.</p>'\
         '<div class="mgrid c2">'
    for h, m, hint in [(4, 30, "half past…"), (9, 45, "quarter to…")]:
        s3 += f'<div class="abox" style="text-align:center;">{clock_svg(h, m, size=55)}'\
              '<p style="font-size:11px; text-align:left;">Strategy 1 (digits): ' + b("5em") + '</p>'\
              f'<p style="font-size:11px; text-align:left;">Strategy 2 (words, like "{hint}"): ' + bw() + '</p></div>'
    s3 += '</div></div>'

    # 4: Word problems
    s4 = '<div class="wp">'\
         '<p class="note">Read carefully. Think about what is happening. Draw a clock if it helps!</p>'\
         '<div class="mgrid c2">'
    problems = [
        ("The school bus comes at 8:15. Right now the clock shows 8:05. Has the bus already come, or is it still coming? Explain.", ""),
        ("Nia\u2019s piano lesson starts at 3:30 and her clock shows the hour hand between 3 and 4, minute hand on the 6. Is it time for her lesson?", ""),
    ]
    for text, unit in problems:
        s4 += f'<div class="abox"><p style="font-size:0.95em;">{text}</p>'\
              '<p style="font-size:11px;">Draw or write your thinking: ' + bw() + '</p>'\
              '<p>Answer: ' + bw() + '</p></div>'
    s4 += '</div></div>'

    # 5: Challenge β€” Create Your Own
    s5 = '<div class="abox" style="background:#f3e5f5;">'\
         '<p><b>Create Your Own</b></p>'\
         '<p>Draw hands on this blank clock to show YOUR favorite time of day. Then write the time and what you do then.</p>'\
         '<div style="text-align:center;"><svg viewBox="0 0 50 50" width="70" height="70">'\
         '<circle cx="25" cy="25" r="22" fill="#fff" stroke="#333" stroke-width="1.5"/>'\
         '<line x1="25" y1="3" x2="25" y2="7" stroke="#333" stroke-width="1.5"/>'\
         '<line x1="25" y1="43" x2="25" y2="47" stroke="#333" stroke-width="1.5"/>'\
         '<line x1="3" y1="25" x2="7" y2="25" stroke="#333" stroke-width="1.5"/>'\
         '<line x1="43" y1="25" x2="47" y2="25" stroke="#333" stroke-width="1.5"/>'\
         '<circle cx="25" cy="25" r="2" fill="#333"/></svg></div>'\
         '<p>My time: ' + b("4em") + '&nbsp;&nbsp; What I do: ' + bw() + '</p>'\
         '</div>'

    return page(16, "Wednesday", "Time to the Nearest 5 Minutes",
        f'''{sec(1, "Warm-up: Minute Hand Facts", s1)}
{sec(2, "Read to the Nearest 5 Minutes", s2)}
{sec(3, "Two Ways to Say a Time", s3)}
{sec(4, "Word Problems", s4)}
{sec(5, "Challenge: Create Your Own", s5)}''')


# ═══════════════════════════════════════════════════
# THURSDAY β€” AM/PM and Real-World Time
# ═══════════════════════════════════════════════════
def thursday():
    # 1: Fluency warmup
    s1 = '<div class="abox" style="background:#e8f5e9;">'\
         '<p><b>2-min Fluency Warm-up</b> β€” Count by 5s backwards!</p>'\
         '<div class="mgrid c3">'
    for start in [60, 45, 30, 55]:
        s1 += f'<div class="abox"><p>{start}, {start-5}, {b("3em")}, {b("3em")}</p></div>'
    s1 += '</div></div>'

    # 2: AM or PM? (reduced from 8 to 5)
    s2 = '<p class="note"><b>AM</b> = midnight to noon (morning). <b>PM</b> = noon to midnight (afternoon and night). '\
         'Write AM or PM for each event.</p>'\
         '<div class="mgrid c2">'
    for event in ["Eating breakfast β€” 7:30 ___", "Bedtime story β€” 8:00 ___",
                  "Recess at school β€” 10:15 ___", "Eating dinner β€” 6:00 ___",
                  "The sun rises β€” 6:30 ___"]:
        s2 += f'<div class="abox"><p>{event}</p></div>'
    s2 += '</div>'

    # 3: Better word problems β€” reasoning about schedules (reduced from 4 to 3)
    s3 = '<div class="wp">'\
         '<p class="note">Read carefully. Think about what is happening in the situation.</p>'\
         '<div class="mgrid c2">'
    problems = [
        "Leo\u2019s library story time starts at 10:30 AM. He arrives when the clock says 10:15 AM. Is he early or late? By how many minutes?",
        "The movie starts at 2:00 PM and lasts one hour. What time does the movie end? Is that AM or PM?",
        "Grandma says she will call at half past four in the afternoon. Write that time with digits and AM or PM.",
    ]
    for text in problems:
        s3 += f'<div class="abox"><p style="font-size:0.95em;">{text}</p>'\
              '<p style="font-size:11px;">Draw or write your thinking: ' + bw() + '</p>'\
              '<p>Answer: ' + bw() + '</p></div>'
    s3 += '</div></div>'

    # 4: Number Talk β€” Explain WITHOUT calculating
    s4 = '<div class="abox" style="background:#e3f2fd;">'\
         '<p><b>Number Talk</b> β€” Explain WITHOUT calculating.</p>'\
         '<div class="mgrid c2">'
    s4 += '<div class="abox"><p>Sam says 11:55 AM is almost lunchtime. Jo says it\u2019s almost midnight. Who is right? Why?</p><p style="font-size:11px;">My thinking: ' + bw() + '</p></div>'
    s4 += '<div class="abox"><p>Which is longer to wait: from 3:00 to 3:15, or from 3:00 to half past 3? How do you know?</p><p style="font-size:11px;">My thinking: ' + bw() + '</p></div>'
    s4 += '</div></div>'

    # 5: Create your own schedule (open-ended challenge)
    s5 = '<div class="abox" style="background:#f3e5f5;">'\
         '<p><b>Create Your Own Word Problem</b></p>'\
         '<p>Write a time word problem about your own day (waking up, meals, play time…). Include AM or PM. Then solve it.</p>'\
         '<p style="min-height:60px; border-bottom:1px solid #333;"></p>'\
         '<p style="min-height:30px; border-bottom:1px solid #333;"></p>'\
         '<p>Answer: ' + bl() + '</p>'\
         '</div>'

    return page(16, "Thursday", "AM, PM & Real-World Time",
        f'''{sec(1, "Warm-up: Count Back by 5s", s1)}
{sec(2, "AM or PM?", s2)}
{sec(3, "Word Problems: Think About What Is Happening", s3)}
{sec(4, "Number Talk: Reasoning About Time", s4)}
{sec(5, "Challenge: Create Your Own", s5)}''')


# ═══════════════════════════════════════════════════
# FRIDAY β€” Review & Self-Check
# ═══════════════════════════════════════════════════
def friday():
    # 1: Fluency warmup
    s1 = '<div class="abox" style="background:#e8f5e9;">'\
         '<p><b>2-min Fluency Warm-up</b> β€” Count by 5s. Go fast!</p>'\
         '<div class="mgrid c3">'
    for seq in ["5, 10, 15, ___", "20, 25, ___, 35", "40, ___, 50, 55", "___, 55, 60"]:
        s1 += f'<div class="abox"><p>{seq}</p></div>'
    s1 += '</div></div>'

    # 2: Estimate First! β€” hour hand only
    s2 = '<div class="abox" style="background:#fff3e0;">'\
         '<p><b>Estimate First!</b> Look only at the hour hand. About what time? Then read exactly.</p>'\
         '<div class="mgrid c2">'
    for h, m in [(5, 50), (12, 20), (8, 10), (2, 35)]:
        s2 += f'<div class="abox" style="text-align:center;">{clock_svg(h, m, size=55)}'\
              f'<p>About: {b("4em")}</p>'\
              f'<p>Exact: {b("2em")}:{b("2em")}</p></div>'
    s2 += '</div></div>'

    # 3: Mixed clock review (reduced from 8 to 4)
    s3 = build_clock_telling({
        "times": [
            {"hour": 6, "minute": 0, "blank": True},
            {"hour": 3, "minute": 30, "blank": True},
            {"hour": 9, "minute": 15, "blank": True},
            {"hour": 11, "minute": 45, "blank": True},
        ],
        "note": "Review: write each time. Bonus β€” say each one out loud with quarter/half words!"
    })

    # 4: Word problem review
    s4 = '<div class="wp">'\
         '<p class="note">Read carefully. Show your thinking.</p>'\
         '<div class="mgrid c2">'
    problems = [
        "Art class starts at quarter past one in the afternoon. Write that time with digits and AM or PM.",
        "Mia goes to bed at 8:00 PM. Her clock shows 7:45 PM. How many minutes until bedtime?",
    ]
    for text in problems:
        s4 += f'<div class="abox"><p style="font-size:0.95em;">{text}</p>'\
              '<p style="font-size:11px;">My thinking: ' + bw() + '</p>'\
              '<p>Answer: ' + bw() + '</p></div>'
    s4 += '</div></div>'

    # 5: Self-check with emoji reflection
    s5 = '<div class="selfcheck">'\
         '<p><b>Self-Check: How do you feel about telling time?</b></p>'\
         '<div style="display:flex; gap:20px; flex-wrap:wrap;">'\
         '<div style="background:#fff3e0; padding:10px; border-radius:5px; flex:1; min-width:150px;">'\
         '<p><b>O\'clock &amp; Half Past</b></p>'\
         '<p>😊 I got it!  |  😐 Getting there  |  😟 Need help</p>'\
         '</div>'\
         '<div style="background:#e3f2fd; padding:10px; border-radius:5px; flex:1; min-width:150px;">'\
         '<p><b>Quarter Past / Quarter To</b></p>'\
         '<p>😊 I got it!  |  😐 Getting there  |  😟 Need help</p>'\
         '</div>'\
         '<div style="background:#f3e5f5; padding:10px; border-radius:5px; flex:1; min-width:150px;">'\
         '<p><b>Nearest 5 Minutes &amp; AM/PM</b></p>'\
         '<p>😊 I got it!  |  😐 Getting there  |  😟 Need help</p>'\
         '</div>'\
         '</div>'\
         '<p style="margin-top:10px;"><b>One thing I learned this week:</b> ' + bl() + '</p>'\
         '<p><b>One thing I want to practice more:</b> ' + bl() + '</p>'\
         '<p><b>My favorite time of day is:</b> ' + bl() + '</p>'\
         '</div>'

    return page(16, "Friday", "Week 16 Review & Self-Check",
        f'''{sec(1, "Warm-up: Count by 5s", s1)}
{sec(2, "Estimate First!", s2)}
{sec(3, "Clock Review", s3)}
{sec(4, "Word Problems", s4)}
{sec(5, "Self-Check & Reflection", s5)}''')


# ═══════════════════════════════════════════════════
# TEACHER GUIDE
# ═══════════════════════════════════════════════════
def teacher_guide():
    return tg_page_multi(
        "Week 16", "Telling Time β€” Teacher Guide",

        tg_section_title("Monday: Hour and Half-Hour") +
        tg_sec(1, "Warm-up count by 5s", ["15; 30; 45; 25"]) +
        tg_sec(2, "Meet the Clock", ["Guided β€” read together, no answers needed"]) +
        tg_sec(3, "Read the Clocks", ["5:00, 9:30, 11:00, 2:30"]) +
        tg_sec(4, "Number Talk", ["Hour hand moves gradually β€” at 6:30 it is halfway to 7", "8:30 is later; 30 minutes have passed since 8:00"]) +
        tg_sec(5, "Word Problem", ["4:00 β€” four o'clock"]) +
        tg_note("Page break"),

        tg_section_title("Tuesday: Quarter Past and Quarter To") +
        tg_sec(1, "Warm-up", ["20,25; 35,40; 45,50; 10,15"]) +
        tg_sec(2, "Quarters", ["Guided"]) +
        tg_sec(3, "Estimate First", ["About 3 β†’ 3:15; about 11 β†’ 10:45; about 6 β†’ 6:15; about 2 β†’ 1:45"]) +
        tg_sec(4, "Matching", ["7:15β†’A, 2:45β†’B, 12:30β†’C, 5:45β†’D"]) +
        tg_sec(5, "Word Problem", ["Yes β€” quarter to six IS 5:45"]) +
        tg_note("Page break"),

        tg_section_title("Wednesday: Nearest 5 Minutes") +
        tg_sec(1, "Warm-up minute facts", ["5, 20, 35, 50 minutes"]) +
        tg_sec(2, "Read Clocks", ["3:20, 7:55, 10:05, 1:40, 6:35"]) +
        tg_sec(3, "Two Ways", ["4:30 = half past four; 9:45 = quarter to ten"]) +
        tg_sec(4, "Word Problems", ["Bus still coming (8:05 is before 8:15)", "Yes β€” hands show 3:30"]) +
        tg_sec(5, "Create Own", ["Accept any correctly drawn/labeled time"]) +
        tg_note("Page break"),

        tg_section_title("Thursday: AM, PM & Real-World Time") +
        tg_sec(1, "Warm-up count back", ["55,50; 40,35; 25,20; 50,45"]) +
        tg_sec(2, "AM or PM", ["AM, PM, AM, PM, AM"]) +
        tg_sec(3, "Word Problems", ["Early by 15 minutes", "3:00 PM", "4:30 PM"]) +
        tg_sec(4, "Number Talk", ["Sam is right β€” AM means before noon", "Half past 3 (30 min) is longer than 3:15 (15 min)"]) +
        tg_sec(5, "Create Own", ["Accept student-created time problems with AM/PM"]) +
        tg_note("Page break"),

        tg_section_title("Friday: Review & Self-Check") +
        tg_sec(1, "Warm-up", ["20; 30; 45; 50"]) +
        tg_sec(2, "Estimate First", ["Almost 6 β†’ 5:50; a bit past 12 β†’ 12:20; a bit past 8 β†’ 8:10; between 2 and 3 β†’ 2:35"]) +
        tg_sec(3, "Clock Review", ["6:00, 3:30, 9:15, 11:45"]) +
        tg_sec(4, "Word Problems", ["1:15 PM", "15 minutes"]) +
        tg_sec(5, "Self-Check", ["Accept student self-assessment and reflection"])
    )


# ═══════════════════════════════════════════════════
# GENERATE
# ═══════════════════════════════════════════════════
if __name__ == "__main__":
    os.makedirs(WEEK, exist_ok=True)
    for f in glob.glob(os.path.join(WEEK, "*.pdf")):
        os.remove(f)
    for f in glob.glob(os.path.join(WEEK, "*.html")):
        os.remove(f)

    days = [
        (monday, "Monday", "Telling Time: Hour and Half-Hour"),
        (tuesday, "Tuesday", "Quarter Past and Quarter To"),
        (wednesday, "Wednesday", "Time to the Nearest 5 Minutes"),
        (thursday, "Thursday", "AM, PM & Real-World Time"),
        (friday, "Friday", "Week 16 Review & Self-Check"),
    ]

    for lesson_func, day, title in days:
        html = lesson_func()
        fname = f"Week_16_{day}"
        path = os.path.join(WEEK, f"{fname}.html")
        with open(path, "w") as f:
            f.write(html)
        pdf_path = os.path.join(WEEK, f"{fname}.pdf")
        HTML(filename=path).write_pdf(pdf_path)
        print(f"Generated: {pdf_path}")

    html = teacher_guide()
    path = os.path.join(WEEK, "Week_16_Teacher_Guide.html")
    with open(path, "w") as f:
        f.write(html)
    pdf_path = os.path.join(WEEK, "Week_16_Teacher_Guide.pdf")
    HTML(filename=path).write_pdf(pdf_path)
    print(f"Generated: {pdf_path}")

    print("\nWeek 16 (Telling Time, new standard) complete!")