<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
    <title>Sangha at Home</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link href="https://fonts.googleapis.com/css2?family=Tenor+Sans&family=Inter:wght@400;500&display=swap" rel="stylesheet">
    <style>
    :root {
        --white: #fffcfb;
        --cream: #f7f4ea;
        --coolwhite: #f1eeed;
        --peach: #cca887;
        --terra: #965844;
        --wood: #332a17;
        --charcoal: #242424;
        --sage: #736f5c;
        --grey: #9fa8ae;
        --serif: Optima, "Zapf Humanist 601 BT", "ZapfHumnst Dm BT", "Tenor Sans", Candara, serif;
        --sans: "Suisse Intl", "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
    }

    * {
        box-sizing: border-box
    }

    html, body {
        margin: 0;
        background: var(--cream);
        color: var(--wood);
        font-family: var(--sans);
        font-size: 16px;
        line-height: 1.55;
        -webkit-font-smoothing: antialiased
    }

    body {
        padding-bottom: calc(76px + env(safe-area-inset-bottom))
    }

    a {
        color: var(--terra)
    }

    .wrap {
        max-width: 560px;
        margin: 0 auto;
        padding: calc(20px + env(safe-area-inset-top)) 22px 28px
    }

    h1, h2, h3 {
        font-family: var(--serif);
        font-weight: 400;
        margin: 0;
        letter-spacing: .01em
    }

    h1 {
        font-size: 44px;
        line-height: 1.05
    }

    h2 {
        font-size: 28px;
        line-height: 1.2;
        margin-bottom: 6px
    }

    h3 {
        font-size: 21px;
        line-height: 1.3
    }

    .eyebrow {
        font-size: 12px;
        letter-spacing: .16em;
        text-transform: uppercase;
        color: var(--sage);
        font-weight: 500
    }

    .muted {
        color: var(--sage)
    }

    .card {
        background: var(--white);
        border-radius: 16px;
        padding: 20px;
        margin: 16px 0
    }

    .quote {
        font-family: var(--serif);
        font-size: 22px;
        line-height: 1.4;
        color: var(--terra);
        border-left: 3px solid var(--peach);
        padding-left: 16px;
        margin: 22px 0
    }

    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        border: 0;
        border-radius: 999px;
        padding: 13px 22px;
        font: 500 16px var(--sans);
        cursor: pointer;
        background: var(--terra);
        color: var(--white);
        text-decoration: none
    }

    .btn.ghost {
        background: transparent;
        color: var(--terra);
        border: 1.5px solid var(--terra)
    }

    .btn.small {
        padding: 9px 16px;
        font-size: 14px
    }

    .row {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        align-items: center
    }

    .hero {
        background: var(--wood);
        color: var(--cream);
        margin: -20px -22px 0;
        padding: calc(34px + env(safe-area-inset-top)) 22px 32px;
        border-radius: 0 0 28px 28px
    }

    .hero .eyebrow {
        color: var(--peach)
    }

    .hero h1 {
        color: var(--white);
        margin: 10px 0 8px
    }

    .hero p {
        color: #e9e2d2;
        margin: 0
    }

    ol.practice {
        list-style: none;
        padding: 0;
        margin: 8px 0 0;
        counter-reset: p
    }

    ol.practice li {
        counter-increment: p;
        display: flex;
        gap: 14px;
        padding: 12px 0;
        border-top: 1px solid var(--coolwhite)
    }

    ol.practice li:first-child {
        border-top: 0
    }

    ol.practice li::before {
        content: counter(p);
        flex: 0 0 30px;
        height: 30px;
        border-radius: 50%;
        background: var(--cream);
        color: var(--terra);
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: var(--serif)
    }

    ol.practice b {
        font-weight: 500
    }

    .why {
        display: grid;
        gap: 8px;
        margin-top: 8px
    }

    .why div {
        background: var(--cream);
        border-radius: 12px;
        padding: 10px 14px;
        font-size: 15px
    }

    .why b {
        font-weight: 500;
        color: var(--terra)
    }/* player */

    .player {
        background: var(--wood);
        color: var(--cream);
        border-radius: 22px;
        padding: 24px 20px;
        text-align: center
    }

    .player .eyebrow {
        color: var(--peach)
    }

    .player h2 {
        color: var(--white);
        margin: 8px 0 2px
    }

    .player .btn {
        background: var(--peach);
        color: var(--wood)
    }

    .player .btn.ghost {
        background: transparent;
        color: var(--peach);
        border-color: var(--peach)
    }

    .clock {
        font-family: var(--serif);
        font-size: 64px;
        line-height: 1;
        margin: 16px 0 8px;
        color: var(--white);
        font-variant-numeric: tabular-nums
    }

    input[type=range] {
        width: 100%;
        accent-color: var(--peach)
    }

    .seg {
        display: flex;
        background: rgba(255, 252, 251, .1);
        border-radius: 999px;
        padding: 4px;
        margin: 14px auto 0;
        max-width: 300px
    }

    .seg button {
        flex: 1;
        border: 0;
        background: transparent;
        color: var(--cream);
        font: 500 14px var(--sans);
        padding: 9px 0;
        border-radius: 999px;
        cursor: pointer
    }

    .seg button.on {
        background: var(--peach);
        color: var(--wood)
    }

    textarea {
        width: 100%;
        font: 16px var(--sans);
        color: var(--wood);
        background: var(--cream);
        border: 1.5px solid var(--coolwhite);
        border-radius: 12px;
        padding: 12px 14px;
        margin-top: 12px
    }

    textarea:focus {
        outline: none;
        border-color: var(--peach)
    }

    .prompt {
        font-family: var(--serif);
        font-size: 22px;
        line-height: 1.35;
        margin: 8px 0 0
    }

    .note {
        border-top: 1px solid var(--coolwhite);
        padding: 12px 0;
        font-size: 15px
    }

    .note .muted {
        font-size: 12px
    }/* steps */

    .step {
        background: var(--white);
        border-radius: 16px;
        margin: 12px 0;
        overflow: hidden
    }

    .step summary {
        list-style: none;
        cursor: pointer;
        padding: 16px 18px;
        display: flex;
        gap: 14px;
        align-items: center
    }

    .step summary::-webkit-details-marker {
        display: none
    }

    .num {
        flex: 0 0 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--cream);
        color: var(--terra);
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: var(--serif);
        font-size: 18px
    }

    .step.done .num {
        background: var(--terra);
        color: var(--white)
    }

    .step .body {
        padding: 0 18px 18px
    }

    ul.check {
        list-style: none;
        padding: 0;
        margin: 12px 0 0
    }

    ul.check li {
        display: flex;
        gap: 12px;
        padding: 9px 0;
        border-top: 1px solid var(--coolwhite)
    }

    ul.check input {
        accent-color: var(--terra);
        width: 20px;
        height: 20px;
        flex: 0 0 20px;
        margin-top: 2px
    }

    .progress {
        height: 6px;
        background: var(--coolwhite);
        border-radius: 6px;
        overflow: hidden;
        margin: 10px 0 4px
    }

    .progress i {
        display: block;
        height: 100%;
        background: var(--terra);
        width: 0;
        transition: width .3s
    }

    .tip {
        background: var(--cream);
        border-radius: 12px;
        padding: 12px 14px;
        font-size: 15px;
        margin-top: 10px
    }

    .tip b {
        font: 500 11px var(--sans);
        letter-spacing: .14em;
        text-transform: uppercase;
        color: var(--terra);
        display: block;
        margin-bottom: 2px
    }

    .lib {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 0;
        border-top: 1px solid var(--coolwhite)
    }

    nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--white);
        border-top: 1px solid var(--coolwhite);
        display: flex;
        justify-content: space-around;
        padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
        z-index: 10
    }

    nav a {
        flex: 1;
        text-align: center;
        text-decoration: none;
        color: var(--sage);
        font-size: 11px;
        letter-spacing: .04em;
        padding: 4px 0
    }

    nav a svg {
        display: block;
        margin: 0 auto 3px;
        width: 22px;
        height: 22px;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.6
    }

    nav a.on {
        color: var(--terra)
    }

    .photo {
        display: block;
        width: 100%;
        border-radius: 18px;
        margin: 18px 0 6px;
        aspect-ratio: 16/9;
        object-fit: cover
    }

    .cap {
        font-size: 13px;
        color: var(--sage);
        margin: 0 0 8px
    }

    section {
        display: none
    }

    section.on {
        display: block
    }

    .foot {
        font-size: 13px;
        color: var(--sage);
        text-align: center;
        margin-top: 28px
    }
    </style>
</head>
<body>

    <section id="week">
        <div class="wrap" id="weekWrap"></div>
    </section>

    <section id="meditate">
        <div class="wrap">
            <div class="eyebrow">Meditate</div>
            <h2>Sit with me</h2>
            <p class="muted">Play this week’s guided meditation, or sit in silence with the bell.</p>

            <div class="player" id="guided">
                <div class="eyebrow">This week’s meditation</div>
                <h2 id="medTitle"></h2>
                <div class="muted" style="color:#cfc6b2" id="medLen"></div>
                <div class="clock" id="medClock">0:00</div>
                <input type="range" id="medSeek" min="0" max="100" value="0" step="1" aria-label="Position">
                <div class="row" style="justify-content:center;margin-top:14px">
                    <button class="btn" id="medPlay">Play</button>
                    <button class="btn ghost" id="medBack">Back 15s</button>
                </div>
            </div>

            <div class="player" style="margin-top:16px">
                <div class="eyebrow">Silent sit</div>
                <h2>Just the bell</h2>
                <div class="seg" id="seg">
                    <button data-m="5">5 min</button>
                    <button data-m="10" class="on">10 min</button>
                    <button data-m="20">20 min</button>
                </div>
                <div class="clock" id="sitClock">10:00</div>
                <div class="muted" style="color:#cfc6b2;font-size:14px">Three bells to begin, three bells to end.</div>
                <div class="row" style="justify-content:center;margin-top:14px">
                    <button class="btn" id="sitGo">Begin</button>
                    <button class="btn ghost" id="sitReset">Reset</button>
                </div>
            </div>
            <p class="muted" style="font-size:13px">Tip: turn your ringer up and keep the screen awake. Phones can pause sound when the screen locks.</p>
        </div>
    </section>

    <section id="reflect">
        <div class="wrap">
            <div class="eyebrow">Reflect</div>
            <h2>Today’s question</h2>
            <div class="card">
                <div class="eyebrow" id="qDay"></div>
                <p class="prompt" id="qText"></p>
                <textarea id="qNote" rows="4" placeholder="A few words is enough…"></textarea>
                <p class="muted" style="font-size:12px;margin:6px 0 0">Your notes stay private, saved only on this device.</p>
            </div>
            <div class="card" id="notesCard" style="display:none">
                <div class="eyebrow">Your notes this week</div>
                <div id="notes"></div>
            </div>
        </div>
    </section>

    <section id="practice">
        <div class="wrap">
            <div class="eyebrow">Your home practice</div>
            <h2>Set up your practice</h2>
            <p class="muted">You don’t need to be an experienced meditator, sit on the floor, or belong to a certain religion. This is secular and simple. Check things off as you go.</p>
            <div class="progress">
                <i id="bar"></i>
            </div>
            <div id="stepList"></div>
        </div>
    </section>

    <section id="past">
        <div class="wrap" id="pastWrap"></div>
    </section>

    <section id="join">
        <div class="wrap">
            <div class="eyebrow">Practice together</div>
            <h2>One sangha body</h2>
            <img class="photo" src="sangha-circle.jpg" alt="A sangha circle meditating together on cushions and chairs in a gallery">
            <p class="cap">Our Santa Barbara sangha, meditating under the paintings.</p>
            <p>Practicing at home, you’re still part of the larger sangha. Join us live.</p>
            <div class="card">
                <h3>Sangha with Dr. Diana Hill</h3>
                <p style="margin:6px 0 0">
                    <b style="font-weight:500">Mondays, 12–1 PM Pacific.</b>
                     Live stream every week. The first Monday of each month we also gather in person in Santa Barbara, meditating under the paintings at Art and Soul Gallery, 1323 State Street.
                </p>
                <div class="row" style="margin-top:14px">
                    <a class="btn small" href="https://drdianahill.com/sangha">Join the Sangha</a>
                </div>
            </div>
            <div class="card">
                <div class="eyebrow">Past words</div>
                <div id="library"></div>
                <p class="muted" style="font-size:13px;margin:8px 0 0">
                    A new word every week. More at 
                    <a href="https://drdianahill.com/word-of-the-week">drdianahill.com/word-of-the-week</a>
                    .
                </p>
            </div>
            <div class="quote" style="font-size:19px">When we collectively focus our energy, we alleviate suffering, feel more connected, and create a world we all want to live in.</div>
            <p class="foot">Sangha at Home · Dr. Diana Hill · drdianahill.com/sangha</p>
        </div>
    </section>

    <nav>
        <a href="#week" data-v="week">
            <svg viewBox="0 0 24 24">
                <path d="M4 6h16M4 12h10M4 18h13"/>
            </svg>
            This Week
        </a>
        <a href="#meditate" data-v="meditate">
            <svg viewBox="0 0 24 24">
                <path d="M7 15a5 5 0 0 1 10 0v2H7z"/>
                <path d="M12 6v4M5 20h14"/>
            </svg>
            Meditate
        </a>
        <a href="#reflect" data-v="reflect">
            <svg viewBox="0 0 24 24">
                <path d="M5 19l1-4L16 5l3 3L9 18z"/>
            </svg>
            Reflect
        </a>
        <a href="#practice" data-v="practice">
            <svg viewBox="0 0 24 24">
                <path d="M4 11l8-7 8 7v9H4z"/>
            </svg>
            My Practice
        </a>
        <a href="#join" data-v="join">
            <svg viewBox="0 0 24 24">
                <circle cx="8" cy="10" r="3"/>
                <circle cx="16" cy="10" r="3"/>
                <path d="M3 19c1-3 9-3 10 0M11 19c1-3 9-3 10 0"/>
            </svg>
            Together
        </a>
    </nav>

    <script>
    /* =========================================================
       WEEKLY CONTENT — swap this block each week
       ========================================================= */
    const WEEK = {
        word: "Ennui",
        dates: "Week of November 2, 2026",
        hook: "Sometimes we fall flat. Listless. Not in the depths of despair, more just: I don’t want to. It doesn’t sound good. Nothing really sounds good, in fact.",
        teaching: [
        "Last week Kelly McGonigal’s <i>Joy Is a Risk Worth Taking</i> showed up in my mail, bright yellow with JOY in giant letters. I quickly put it down on my ottoman. <i>I don’t really want to read about joy right now,</i> I thought. Well, at least my inner ennui didn’t want to.",
        "When you’re in ennui, or what psychologists call anhedonia, you’ve lost pleasure in the things you usually enjoy. It’s hard to muster the energy to even want to be joyful. So why do we emotionally flatline? And what can we do about it?"
        ],
        whyTitle: "Why we fall flat",
        why: [
        ["You got what you wanted.", "The arrival fallacy: we think joy comes when we arrive, then something’s still missing."],
        ["You’ve drifted from your values.", "Sometimes ennui whispers a truth: you’re off track with yourself."],
        ["You’ve been pushing hard things away.", "Suppress the bad feelings and you suppress the good ones too."],
        ["You’ve overstimulated dopamine.", "Too much reward and everything ordinary falls flat."],
        ["You’re pushing too hard.", "Your demands outweigh your resources. You need to rest, to winter."],
        ["You’ve been knocked off your feet.", "Grief, health, heartbreak. Give yourself time."],
        ["You’re feeling the sorrows of the world.", "Of course you are. That is what makes you human."],
        ["Your biology is off.", "Food, sleep, movement. Sometimes you work from the bottom up."]
        ],
        quote: "Joy is a values-based act of courage. — Kelly McGonigal",
        practiceTitle: "This week’s practice",
        practice: [
        ["Listen for joy.", "Collect three sounds today that make life feel most lifey."],
        ["Find one yes.", "In a sea of no’s, say yes to one small thing that points back toward what matters."],
        ["Don’t fake it.", "Ask yourself: what am I pushing away that I need to feel?"],
        ["Shock your biology.", "A cold shower, a hard walk, a few rounds of Wim Hof breathing. Something that makes you feel something."],
        ["Find the “we” in ennui.", "Spend time with someone who’s in joy, and let it rub off."]
        ],
        image: "week-ennui.jpg",
        /* main photo from this week's blog post */
        meditation: {
            title: "Meditation on Ennui",
            src: "ennui-meditation.mp3",
            minutes: 25
        },
        questions: [/* Sunday → Saturday */
        "What small thing brought you back to life this week?",
        "Where in your life are you feeling flat right now?",
        "What three sounds made life feel most lifey today?",
        "What’s one small yes you could say today?",
        "What might you be pushing away that you need to feel?",
        "Who around you is in joy? How could you spend a little time with them?",
        "What would it look like to take joy as an act of courage this week?"
        ]
    };
    const PAST = [/* newest first; add last week's word here when the new week goes in */
    {
        slug: "voice",
        image: "week-voice.jpg",
        word: "Voice",
        when: "October 2026",
        circle: "https://wise-effort-community.circle.so/c/library/voice",
        hook: "So, I lost my voice somewhere in Ohio. For two whole days, no sound came out of my mouth. To be honest, it was a blessing. It stopped me long enough to really think about this word: the ways we lose our voice, and how we find it again.",
        practiceTitle: "Doctor’s orders",
        practice: [["Don’t yell, don’t whisper.", "Catch one moment this week where you’re about to force your point, or where you’re hinting and hedging. Say it plainly."],
        ["Go quiet and listen.", "Take ten minutes of silence. No podcast, no phone, no talking. Listen for the subtle things."],
        ["Let yourself be humiliated.", "When you feel embarrassed or brought low, breathe it in, tonglen-style, instead of explaining it away."],
        ["Don’t push it.", "Pick one thing you’re straining at and let up by ten percent."],
        ["Speak from the gut.", "Before a hard conversation, put a hand on your belly, take three low breaths, and let your voice come from down there."]]
    },
    {
        slug: "scattered",
        image: "week-scattered.jpg",
        word: "Scattered",
        when: "October 2026",
        circle: "https://wise-effort-community.circle.so/c/library/scattered",
        hook: "When we’re scattered, our attention, feelings and motivations are all over the place, like seeds blown across a hillside. The idea isn’t to get rid of the scatter. It’s to be with it in a different way.",
        practiceTitle: "Five ways back",
        practice: [["Expand the space.", "Make room around the scatter instead of squeezing it."],
        ["Get oriented through self-appreciation.", "Notice what you’re already doing well."],
        ["Practice selective engagement.", "Choose what gets your attention, and let the rest wait."],
        ["Let things incubate.", "Not everything needs an answer today."],
        ["Trust that something inside you knows how to connect the dots.", ""],
        ["This week’s practice:", "Fold a piece of paper in half. Draw what scattered looks like on one side and what oriented looks like on the other. Then open it up and see how you might connect the dots."]]
    },
    {
        slug: "current",
        image: "week-current.jpg",
        word: "Current",
        when: "October 2026",
        circle: "https://wise-effort-community.circle.so/c/library/current",
        hook: "When I was a little girl, my mom used to warn me about the undertow. But what lifeguards worry about isn’t you being pulled under. It’s you being pulled out, so far you don’t even know it. So if the advice isn’t to fight the current, what can we do instead?",
        practiceTitle: "Riding the current",
        practice: [["Float.", "If you float long enough, you may drift right back to shore. Marriages sometimes do this. So does grief."],
        ["Find the shoreline and swim parallel to it.", "You may not get back to shore right away, but you won’t go further out."],
        ["Enter the bigger current.", "Notice the eddies you get stuck in, and find your way into a current of wonder and presence."]]
    },
    {
        slug: "self-doubt",
        image: "week-self-doubt.jpg",
        word: "Self-Doubt",
        when: "September 2026",
        circle: "https://wise-effort-community.circle.so/c/library/self-doubt",
        hook: "Who do you think you are? That’s the voice of self-doubt. Self-doubt isn’t good or bad. It isn’t something you’re going to escape. And if you’re doubting yourself, it may be a sign you’re onto something.",
        practiceTitle: "Five ways to work with self-doubt",
        practice: [["See it as a sign of self-authorship.", "When self-doubt shows up, you’re probably entering a larger life."],
        ["Bring warmth.", "You don’t have to change the doubt. You can change how you relate to yourself with it."],
        ["Welcome the doubt as inquiry.", "Do I have the skill set? Am I missing something? Let doubt do its useful work."],
        ["Step back from the story.", "Defensive pessimism, self-handicapping, over-efforting: that’s the story, not the truth."],
        ["Engage with life, doubt included.", "I have it. You have it. The person next to you at the grocery store has it."]]
    },
    {
        slug: "relief",
        image: "week-relief.jpg",
        word: "Relief",
        when: "September 2026",
        circle: "https://wise-effort-community.circle.so/c/library/relief",
        hook: "When I was in third grade, I used to catch butterflies in a jar. And once that butterfly was in the jar, it lost all of its magic. Relief is like that. As soon as we try to force it or catch it, we lose the relief of it just coming to us.",
        practiceTitle: "Six ways to let the butterfly land",
        practice: [["Watch for relief.", "When do you feel even a little relief? Don’t chase it. Just notice where the butterfly lands."],
        ["Try the butterfly breath.", "Cross your hands at the thumbs, rest them on your chest. Breathe in and open your wings, breathe out and close them."],
        ["Use your voice.", "Hum, sing, sing a lullaby to whatever’s anxious in you."],
        ["Keep the pain clean.", "Name the clean pain: this is hard. Then notice what you’re adding, and zoom out."],
        ["Confide one truth.", "Tell yourself what’s true. Then tell someone who’s on your side."],
        ["Follow a generous impulse.", "The next time you feel the urge to give, act on it right away."]]
    },
    {
        slug: "endings",
        image: "week-endings.jpg",
        word: "Endings",
        when: "September 2026",
        circle: "https://wise-effort-community.circle.so/c/library/endings",
        hook: "Endings aren’t a clean break. They’re part of a natural cycle: beginning, middle, end, begin again. And most of us handle them badly. We get stuck in rumination, avoidance and inflexibility.",
        practiceTitle: "Ways through an ending",
        practice: [["Allow new beginnings,", "without expecting them to replace what was lost."],
        ["Use ritual", "to mark closure."],
        ["Trust re-engagement.", "The second pancake is part of renewal."],
        ["Remember nothing truly ends.", "It transforms and continues. So be it, and so it is."]]
    }
    ];

    /* ========================================================= */
    const store = {
        get(k, d) {
            try {
                const v = localStorage.getItem('sah:' + k);
                return v === null ? d : JSON.parse(v)
            } catch (e) {
                return d
            }
        },
        set(k, v) {
            try {
                localStorage.setItem('sah:' + k, JSON.stringify(v))
            } catch (e) {}
        }
    };
    const esc = s => String(s).replace(/[&<>]/g, c => ({
        '&': '&',
        '<': '<',
        '>': '>'
    }[c]));

    /* ---------- This Week ---------- */
    function renderWeek() {
        const w = WEEK;
        document.getElementById('weekWrap').innerHTML = `
          <div class="hero">
            ${w.image ? `<img src="${w.image}" alt="Photo for ${esc(w.word)}" style="display:block;width:100%;aspect-ratio:4/3;object-fit:cover;object-position:center top;border-radius:14px;margin:0 0 18px">` : ''}
            <div class="eyebrow">Word of the Week · ${esc(w.dates)}</div>
            <h1>${esc(w.word)}</h1>
            <p>${esc(w.hook)}</p>
          </div>
          ${w.teaching.map(p => `<p>${p}</p>`).join('')}
          <div class="card">
            <div class="eyebrow">${esc(w.whyTitle)}</div>
            <div class="why">${w.why.map(x => `<div><b>${esc(x[0])}</b> ${esc(x[1])}</div>`).join('')}</div>
          </div>
          <div class="quote">${esc(w.quote)}</div>
          <div class="card">
            <div class="eyebrow">${esc(w.practiceTitle)}</div>
            <ol class="practice">${w.practice.map(x => `<li><div><b>${esc(x[0])}</b> ${esc(x[1])}</div></li>`).join('')}</ol>
          </div>
          <div class="row"><a class="btn" href="#meditate">Meditate on ${esc(w.word.toLowerCase())}</a><a class="btn ghost" href="#reflect">Today’s question</a></div>`;
    }

    /* ---------- bell ---------- */
    let AC = null;
    function ctx() {
        if (!AC) {
            try {
                AC = new (window.AudioContext || window.webkitAudioContext)()
            } catch (e) {}
        }
        if (AC && AC.state === 'suspended')
            AC.resume();
        return AC
    }
    function synth() {
        const a = ctx();
        if (!a)
            return;
        const t = a.currentTime + .02,
            out = a.createGain();
        out.gain.value = .3;
        out.connect(a.destination);
        [[1, 1, 9], [2.32, .45, 6], [4.25, .28, 4], [6.63, .16, 2.6]].forEach(([r, amp, dec]) => {
            const o = a.createOscillator(),
                g = a.createGain();
            o.frequency.value = 196 * r;
            g.gain.setValueAtTime(0, t);
            g.gain.linearRampToValueAtTime(amp, t + .008);
            g.gain.exponentialRampToValueAtTime(.0001, t + dec);
            o.connect(g);
            g.connect(out);
            o.start(t);
            o.stop(t + dec + .1)
        })
    }
    function bell() {
        try {
            const b = new Audio('bell.mp3');
            const p = b.play();
            if (p && p.catch)
                p.catch(synth)
        } catch (e) {
            synth()
        }
    }
    let bt = [];
    function ring(n) {
        ctx();
        bt.forEach(clearTimeout);
        bt = [];
        for (let i = 0; i < n; i++)
            bt.push(setTimeout(bell, i * 9000))
    }

    /* ---------- guided meditation ---------- */
    const fmt = s => {
        s = Math.max(0, Math.floor(s));
        return Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0')
    };
    let med = null;
    document.getElementById('medTitle').textContent = WEEK.meditation.title;
    document.getElementById('medLen').textContent = WEEK.meditation.minutes + ' minutes · ends with three bells';
    document.getElementById('medClock').textContent = fmt(WEEK.meditation.minutes * 60);
    function getMed() {
        if (med)
            return med;
        med = new Audio(WEEK.meditation.src);
        med.preload = 'metadata';
        med.addEventListener('timeupdate', () => {
            const d = med.duration || 1;
            document.getElementById('medClock').textContent = fmt(d - med.currentTime);
            document.getElementById('medSeek').value = Math.round(med.currentTime / d * 100);
            store.set('medpos:' + WEEK.word, med.currentTime)
        });
        med.addEventListener('ended', () => {
            document.getElementById('medPlay').textContent = 'Play again';
            store.set('medpos:' + WEEK.word, 0)
        });
        const pos = store.get('medpos:' + WEEK.word, 0);
        if (pos > 5)
            med.addEventListener('loadedmetadata', () => {
                med.currentTime = pos
            }, {
                once: true
            });
        return med;
    }
    document.getElementById('medPlay').onclick = () => {
        const m = getMed();
        if (m.paused) {
            const p = m.play();
            if (p && p.catch)
                p.catch(() => {});
            document.getElementById('medPlay').textContent = 'Pause'
        }
        else {
            m.pause();
            document.getElementById('medPlay').textContent = 'Play'
        }
    };
    document.getElementById('medBack').onclick = () => {
        const m = getMed();
        m.currentTime = Math.max(0, m.currentTime - 15)
    };
    document.getElementById('medSeek').oninput = e => {
        const m = getMed();
        if (m.duration)
            m.currentTime = m.duration * e.target.value / 100
    };

    /* ---------- silent sit ---------- */
    let sitMin = 10,
        sitLeft = 600,
        sitEnd = 0,
        sitTick = null,
        sitRun = false,
        sitStarted = false;
    document.querySelectorAll('#seg button').forEach(b => b.onclick = () => {
        if (sitRun)
            return;
        document.querySelectorAll('#seg button').forEach(x => x.classList.remove('on'));
        b.classList.add('on');
        sitMin = +b.dataset.m;
        resetSit()
    });
    function resetSit() {
        clearInterval(sitTick);
        sitRun = false;
        sitStarted = false;
        sitLeft = sitMin * 60;
        drawSit()
    }
    function drawSit() {
        document.getElementById('sitClock').textContent = fmt(Math.ceil(sitLeft));
        document.getElementById('sitGo').textContent = sitRun ? 'Pause' : (sitStarted ? 'Resume' : 'Begin')
    }
    document.getElementById('sitGo').onclick = () => {
        ctx();
        if (sitRun) {
            sitRun = false;
            sitLeft = (sitEnd - Date.now()) / 1000;
            clearInterval(sitTick)
        }
        else {
            if (!sitStarted)
                ring(3);
            sitStarted = true;
            sitRun = true;
            sitEnd = Date.now() + sitLeft * 1000;
            sitTick = setInterval(() => {
                sitLeft = (sitEnd - Date.now()) / 1000;
                if (sitLeft <= 0) {
                    clearInterval(sitTick);
                    sitRun = false;
                    sitLeft = 0;
                    ring(3);
                    const log = store.get('sits', []);
                    log.push({
                        d: new Date().toISOString(),
                        m: sitMin
                    });
                    store.set('sits', log);
                    drawSit();
                    document.getElementById('sitGo').textContent = 'Begin again';
                    sitStarted = false;
                    sitLeft = sitMin * 60;
                    return
                }
                drawSit()
            }, 250)
        }
        drawSit()
    };
    document.getElementById('sitReset').onclick = resetSit;

    /* ---------- reflect ---------- */
    const DAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
    const today = new Date(),
        dkey = today.toISOString().slice(0, 10),
        dow = today.getDay();
    document.getElementById('qDay').textContent = DAYS[dow] + ' · ' + WEEK.word;
    document.getElementById('qText').textContent = WEEK.questions[dow];
    const notes = store.get('notes:' + WEEK.word, {});
    const qn = document.getElementById('qNote');
    qn.value = (notes[dkey] || {}).t || '';
    qn.addEventListener('input', () => {
        notes[dkey] = {
            q: WEEK.questions[dow],
            t: qn.value
        };
        store.set('notes:' + WEEK.word, notes);
        renderNotes()
    });
    function renderNotes() {
        const ks = Object.keys(notes).filter(k => k !== dkey && notes[k].t.trim()).sort().reverse();
        document.getElementById('notesCard').style.display = ks.length ? 'block' : 'none';
        document.getElementById('notes').innerHTML = ks.map(k => `<div class="note"><div class="muted">${k} · ${esc(notes[k].q)}</div>${esc(notes[k].t)}</div>`).join('');
    }

    /* ---------- my practice ---------- */
    const STEPS = [
    {
        t: "Choose your spot",
        x: "A corner, a chair, a cushion by the window. Make it a little beautiful: a flower in a jar, a candle, something from your garden.",
        i: ["Pick one spot I can return to", "Add one beautiful thing"]
    },
    {
        t: "Choose your time",
        x: "Same time, every day, is easier than the perfect time. Tie it to something you already do, like after your morning coffee.",
        i: ["Pick my time of day", "Link it to something I already do"]
    },
    {
        t: "Start small",
        x: "Five minutes counts. Lying down counts. Walking counts. Keep it so easy you can’t say no.",
        i: ["Start with 5 or 10 minutes", "Let myself sit, lie down, or walk"]
    },
    {
        t: "Begin and end with the bell",
        x: "Three rings to begin, three breaths. Repetition turns routine into something sacred. Close with three bows: to your wise self for showing up, to the teachers and teachings, and to the sangha you’re part of.",
        i: ["Use the bell to begin and end", "Try the three bows"]
    },
    {
        t: "Set your intention",
        x: "Why are you practicing? What are you longing for? Distill it into one sentence and keep it where you’ll see it.",
        i: ["Write my intention in one sentence"],
        intention: true
    },
    {
        t: "Carry the word into your week",
        x: "Each week there’s a new word and a few small practices. Pick one and try it between sits.",
        i: ["Read this week’s word", "Try one of this week’s practices"]
    },
    {
        t: "Practice with us",
        x: "Home practice gets easier when you know others are sitting too. Join the live Sangha on Mondays, and keep returning. That returning is at the heart of belonging.",
        i: ["Join a live Monday Sangha", "Keep returning, even after a missed week"]
    }
    ];
    const checks = store.get('checks', {});
    const done = (s, j) => s.i.every((_, k) => checks[j + '-' + k]);
    function renderSteps() {
        const el = document.getElementById('stepList');
        el.innerHTML = STEPS.map((s, j) => `<details class="step${done(s, j) ? ' done' : ''}"><summary><div class="num">${j + 1}</div><h3>${s.t}</h3></summary><div class="body"><p style="margin-top:0">${s.x}</p>
           ${s.intention ? `<textarea id="intent" rows="2" placeholder="My intention is…" style="margin-top:0"></textarea>` : ''}
           <ul class="check">${s.i.map((it, k) => `<li><input type="checkbox" id="c${j}-${k}" data-id="${j}-${k}" ${checks[j + '-' + k] ? 'checked' : ''}><label for="c${j}-${k}">${it}</label></li>`).join('')}</ul></div></details>`).join('');
        el.querySelectorAll('input[type=checkbox]').forEach(c => c.onchange = e => {
            checks[e.target.dataset.id] = e.target.checked;
            store.set('checks', checks);
            const j = +e.target.dataset.id.split('-')[0];
            e.target.closest('details').classList.toggle('done', done(STEPS[j], j));
            bar()
        });
        const it = document.getElementById('intent');
        it.value = store.get('intention', '');
        it.oninput = () => store.set('intention', it.value);
        bar();
    }
    function bar() {
        document.getElementById('bar').style.width = (STEPS.filter((s, j) => done(s, j)).length / STEPS.length * 100) + '%'
    }

    /* ---------- library ---------- */
    document.getElementById('library').innerHTML =
    `<div class="lib" style="border-top:0"><span><b style="font-weight:500">${esc(WEEK.word)}</b> <span class="muted">· this week</span></span><a href="#week">Open</a></div>` +
    PAST.map(p => `<div class="lib"><span>${esc(p.word)} <span class="muted">· ${esc(p.when)}</span></span><a href="#w-${p.slug}">Open</a></div>`).join('');
    function renderPast(slug) {
        const p = PAST.find(x => x.slug === slug);
        if (!p)
            return false;
        document.getElementById('pastWrap').innerHTML = `
          <div class="hero">${p.image ? `<img src="${p.image}" alt="Photo for ${esc(p.word)}" style="display:block;width:100%;aspect-ratio:4/3;object-fit:cover;object-position:center top;border-radius:14px;margin:0 0 18px">` : ''}<div class="eyebrow">Word of the Week · ${esc(p.when)}</div><h1>${esc(p.word)}</h1><p>${esc(p.hook)}</p></div>
          <div class="card"><div class="eyebrow">${esc(p.practiceTitle)}</div>
           <ol class="practice">${p.practice.map(x => `<li><div><b>${esc(x[0])}</b> ${esc(x[1])}</div></li>`).join('')}</ol></div>
          <div class="card"><h3>Listen to the talk and meditation</h3><p style="margin:6px 0 12px">The full ${esc(p.word.toLowerCase())} talk and meditation are in the Sangha library on Circle.</p>
           <a class="btn small" href="${p.circle}">Open in Circle</a></div>
          <div class="row"><a class="btn ghost small" href="#join">All words</a><a class="btn ghost small" href="#meditate">Sit with the bell</a></div>`;
        return true;
    }

    /* ---------- views ---------- */
    const VIEWS = ['week', 'meditate', 'reflect', 'practice', 'join'];
    function show() {
        let v = location.hash.slice(1);
        if (v.startsWith('w-') && renderPast(v.slice(2)))
            v = 'past';
        else if (!VIEWS.includes(v))
            v = 'week';
        document.querySelectorAll('section').forEach(s => s.classList.toggle('on', s.id === v));
        document.querySelectorAll('nav a').forEach(a => a.classList.toggle('on', a.dataset.v === (v === 'past' ? 'join' : v)));
        window.scrollTo(0, 0)
    }
    window.addEventListener('hashchange', show);
    renderWeek();
    renderSteps();
    renderNotes();
    show();
    </script>
</body>
</html>

Meditate

Sit with me

Play this week’s guided meditation, or sit in silence with the bell.

This week’s meditation

0:00

Silent sit

Just the bell

10:00

Three bells to begin, three bells to end.

Tip: turn your ringer up and keep the screen awake. Phones can pause sound when the screen locks.

Reflect

Today’s question

Your notes stay private, saved only on this device.

Your notes this week

Your home practice

Set up your practice

You don’t need to be an experienced meditator, sit on the floor, or belong to a certain religion. This is secular and simple. Check things off as you go.

Practice together

One sangha body

A sangha circle meditating together on cushions and chairs in a gallery

Our Santa Barbara sangha, meditating under the paintings.

Practicing at home, you’re still part of the larger sangha. Join us live.

Sangha with Dr. Diana Hill

Mondays, 12–1 PM Pacific. Live stream every week. The first Monday of each month we also gather in person in Santa Barbara, meditating under the paintings at Art and Soul Gallery, 1323 State Street.

Join the Sangha

Past words

A new word every week. More at drdianahill.com/word-of-the-week.

When we collectively focus our energy, we alleviate suffering, feel more connected, and create a world we all want to live in.

Sangha at Home · Dr. Diana Hill · drdianahill.com/sangha

This Week Meditate Reflect My Practice Together