/* global React, IMG, SYNONYM_CYCLE, SAMPLE_WORD, SAMPLE_DRAFT, SAMPLE_REWRITE, CRAFT_MOVE, useCycler, useTyper, RippedEdge, Img */

// ─────────────────────────────────────────────────────────────────────────────
// Direction C — "The Bound Volume"
// B's cinematic layout (full-bleed library hero, oversized bleeding wordmark,
// vertical alternating six-step flow, gilded ceiling for the quote)
// + A's editorial content (commonplace-book voice, specimen card, marginalia,
//   handwritten notes, ribbon meta, ripped paper sections).
// Replaces the library image with a grander, older one and uses the new
// improved RippedEdge.
// ─────────────────────────────────────────────────────────────────────────────

const C = {
  ink:       "#0E0710",
  plum:      "#1F0A22",
  aubergine: "#2E0820",
  emerald:   "#0B2A28",
  bronze:    "#A8843D",   // antique gold/bronze — wordmark
  bronzeHi:  "#D4B068",   // highlight
  ember:     "#D8642E",
  gold:      "#C99A4A",
  parchment: "#EFE3C9",   // slightly warmer for ripped pages
  paperLite: "#F5EAD2",
  muted:     "#9A8870",
  inkOnPaper:"#1A0810",
  thread:    "rgba(242,231,208,0.14)",
};

const cStyles = {
  page: {
    width: 1440,
    background: C.ink,
    color: C.parchment,
    fontFamily: "'EB Garamond', Georgia, serif",
    position: "relative",
    overflow: "hidden",
  },
  script: {
    fontFamily: "'Italianno', 'Pinyon Script', cursive",
    fontWeight: 400,
  },
  display: {
    fontFamily: "'Bodoni Moda', 'Cormorant Garamond', Georgia, serif",
    fontWeight: 400,
    letterSpacing: "-0.015em",
    lineHeight: 0.88,
  },
  hand: {
    fontFamily: "'Caveat', cursive",
  },
  mono: {
    fontFamily: "'JetBrains Mono', ui-monospace, monospace",
    letterSpacing: "0.04em",
  },
};

// ── NAV ─────────────────────────────────────────────────────────────────────
function CNav() {
  return (
    <nav style={{
      position: "absolute", top: 0, left: 0, right: 0, zIndex: 10,
      display: "flex", justifyContent: "space-between", alignItems: "center",
      padding: "26px 56px",
    }}>
      <span className="lex-script" style={{
        ...cStyles.script, fontSize: 56, lineHeight: 1.2, letterSpacing: "0.005em",
        background: `linear-gradient(180deg, ${C.bronzeHi} 0%, #A8843D 50%, #6E5224 100%)`,
        WebkitBackgroundClip: "text", backgroundClip: "text", WebkitTextFillColor: "transparent",
        paddingRight: 14, paddingBottom: 16, display: "inline-block",
      }}>
        Lexicon
      </span>
      <div style={{ display: "flex", gap: 28 }}>
        {["The Premise", "The Method", "Specimens", "Open the App"].map((l, i) => (
          <a key={l} href="#" style={{
            ...cStyles.mono, fontSize: 10.5, color: i === 3 ? C.ember : C.parchment,
            letterSpacing: "0.22em", textTransform: "uppercase", textDecoration: "none",
            opacity: i === 3 ? 1 : 0.78,
          }}>{l}</a>
        ))}
      </div>
    </nav>
  );
}

// ── HERO ────────────────────────────────────────────────────────────────────
function CHero() {
  const [cur, idx] = useCycler(SYNONYM_CYCLE, 2800);

  return (
    <section style={{ position: "relative", height: 940, overflow: "hidden", background: C.ink }}>
      <Img src={IMG.libraryStacks} alt="" style={{ position: "absolute", inset: 0 }} />
      <div style={{
        position: "absolute", inset: 0,
        background: `
          linear-gradient(180deg, rgba(14,7,16,0.5) 0%, rgba(14,7,16,0.25) 40%, rgba(14,7,16,0.96) 100%),
          radial-gradient(ellipse at 25% 60%, rgba(46,8,32,0.55), transparent 65%)
        `,
      }} />

      <CNav />

      {/* Massive wordmark — bleeds left edge */}
      <div className="lex-script" style={{
        position: "absolute", left: -28, bottom: 230,
        ...cStyles.script, fontSize: 460,
        lineHeight: 1.0, letterSpacing: "0.005em",
        background: `linear-gradient(180deg, ${C.bronzeHi} 0%, ${C.bronze} 45%, #6E5224 100%)`,
        WebkitBackgroundClip: "text", backgroundClip: "text", WebkitTextFillColor: "transparent",
        filter: "drop-shadow(0 8px 40px rgba(0,0,0,0.7))",
        zIndex: 3, paddingRight: 100, paddingBottom: 80,
      }}>
        Lexicon
      </div>

      {/* Cycler — bottom left */}
      <div style={{
        position: "absolute", left: 56, bottom: 130, zIndex: 4,
        display: "flex", alignItems: "baseline", gap: 22,
      }}>
        <span style={{ ...cStyles.mono, fontSize: 11, color: C.ember, letterSpacing: "0.24em", textTransform: "uppercase" }}>
          See also —
        </span>
        <span key={idx} style={{
          ...cStyles.display, fontSize: 50, color: C.parchment, fontStyle: "italic",
          animation: "cFade 2800ms ease",
          minWidth: 240, display: "inline-block",
        }}>
          {cur.word}
        </span>
        <span style={{ fontSize: 14, color: C.muted, fontStyle: "italic", maxWidth: 380 }}>
          {cur.gloss}
        </span>
      </div>

      {/* Tagline + CTA — bottom right, in commonplace-book voice */}
      <div style={{
        position: "absolute", right: 56, bottom: 60, zIndex: 4,
        textAlign: "right",
      }}>
        <p style={{ fontSize: 19, color: C.parchment, maxWidth: 380, marginLeft: "auto", lineHeight: 1.5, marginBottom: 22, fontStyle: "italic" }}>
          A vocabulary practice for writers who would rather <em style={{ color: C.ember, fontStyle: "italic" }}>deploy</em> a word than recognise it.
        </p>
        <a href="#" style={{
          ...cStyles.mono, fontSize: 11, color: C.parchment, textTransform: "uppercase",
          letterSpacing: "0.22em", textDecoration: "none",
          padding: "14px 26px", border: `1px solid ${C.ember}`, background: C.ember + "30",
          display: "inline-block",
        }}>Begin the practice →</a>
      </div>

      {/* corner meta */}
      <div style={{
        position: "absolute", left: 56, top: 100, zIndex: 4,
        ...cStyles.mono, fontSize: 10, color: C.muted, letterSpacing: "0.22em", textTransform: "uppercase",
      }}>
        Vol. I · No. 01 · MMXXVI<br />
        <span style={{ color: C.ember }}>· · ·</span>
      </div>
    </section>
  );
}

// ── MANIFESTO — A's editor's-note + drop-cap + sidebar specimen card ────────
function CManifesto() {
  return (
    <section style={{
      background: `linear-gradient(180deg, ${C.ink} 0%, ${C.plum} 50%, ${C.ink} 100%)`,
      color: C.parchment,
      padding: "130px 56px 130px",
      position: "relative",
    }}>

      <div style={{ display: "grid", gridTemplateColumns: "200px 1fr 360px", gap: 56, alignItems: "start" }}>
        {/* drop-cap column with handwritten note */}
        <div>
          <div style={{ ...cStyles.mono, fontSize: 10, color: C.ember, textTransform: "uppercase", letterSpacing: "0.22em", marginBottom: 12 }}>
            § Editor's note
          </div>
          <div style={{ ...cStyles.hand, fontSize: 24, color: C.aubergine, lineHeight: 1.3, transform: "rotate(-2deg)", marginTop: 36, paddingLeft: 8 }}>
            "knowing a word and<br />
            using a word are two<br />
            different appetites."
          </div>
          <div style={{ ...cStyles.mono, fontSize: 9, color: C.muted, letterSpacing: "0.18em", textTransform: "uppercase", marginTop: 28, paddingLeft: 8 }}>
            — margin, in pencil
          </div>
        </div>

        <div>
          <h2 style={{ ...cStyles.display, fontSize: 92, color: C.parchment, marginBottom: 36, fontWeight: 400, lineHeight: 0.96 }}>
            Most tools test if you <em style={{ color: C.ember, fontStyle: "italic" }}>recognise</em> a word.
            Lexicon tests if you can <em style={{ color: C.gold, fontStyle: "italic" }}>wield</em> one.
          </h2>
          <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 36 }}>
            <p style={{ fontSize: 17.5, lineHeight: 1.7, color: C.muted }}>
              The practice is built around active retrieval. You name synonyms before they are
              shown to you. You choose which to work with. You write the sentence. <em>Then</em> the
              machine speaks — not to praise you, but to show you a more precise version of
              the line you almost made.
            </p>
            <p style={{ fontSize: 17.5, lineHeight: 1.7, color: C.muted }}>
              Claude rewrites your draft and names the craft move it used: a compression, a
              voice shift, a rhythm change. You decide whether to take it. The feedback is
              honest. The session is short. The intervals are merciless.
            </p>
          </div>
        </div>

        {/* specimen card — slightly tilted, taped */}
        <aside style={{
          background: "rgba(20,8,18,0.85)", color: C.parchment,
          padding: "32px 28px", position: "relative",
          transform: "rotate(1.5deg)",
          boxShadow: "0 14px 32px -8px rgba(0,0,0,0.55)",
          border: `1px solid ${C.thread}`,
        }}>
          {/* tape */}
          <div style={{
            position: "absolute", top: -14, left: 24, width: 70, height: 22,
            background: "rgba(217,150,90,0.45)", transform: "rotate(-6deg)",
          }} />
          <div style={{ ...cStyles.mono, fontSize: 9.5, color: C.ember, textTransform: "uppercase", letterSpacing: "0.2em", marginBottom: 18 }}>
            Specimen card
          </div>
          {[
            ["Form",     "Single-page web app"],
            ["Engine",   "Claude (Sonnet 4.6)"],
            ["Storage",  "Browser, localStorage"],
            ["Hosting",  "Cloudflare Worker"],
            ["Status",   "Live · personal use"],
          ].map(([k, v]) => (
            <div key={k} style={{
              display: "flex", justifyContent: "space-between",
              padding: "10px 0", borderBottom: `1px dashed ${C.thread}`,
              fontSize: 13,
            }}>
              <span style={{ ...cStyles.mono, fontSize: 10, color: C.muted, textTransform: "uppercase", letterSpacing: "0.14em" }}>{k}</span>
              <span style={{ fontStyle: "italic", color: C.parchment }}>{v}</span>
            </div>
          ))}
        </aside>
      </div>

    </section>
  );
}

// ── SAMPLE — A's specimen card + B's bordered rewrite block ─────────────────
function CSample() {
  const drafts = [
    SAMPLE_DRAFT,
    "She walked into the room with the quiet kind of bright that old houses have at night.",
    "The light from the lamp was small but it filled the room.",
  ];
  const rewrites = [
    SAMPLE_REWRITE,
    "She entered with a lambent quiet — the kind old houses keep after dark.",
    "A lambent pool from the lamp sufficed.",
  ];
  const draftStr = useTyper(drafts, { typeMs: 24, holdMs: 2600, eraseMs: 12 });
  const rewriteStr = useTyper(rewrites, { typeMs: 30, holdMs: 2600, eraseMs: 14 });

  return (
    <section style={{
      position: "relative",
      background: C.plum,
      padding: "120px 56px 130px",
      overflow: "hidden",
    }}>
      <Img src={IMG.candle} alt="" style={{
        position: "absolute", right: -120, top: -60, width: 600, height: 800, opacity: 0.16,
      }} />
      <div style={{
        position: "absolute", inset: 0,
        background: `linear-gradient(90deg, ${C.plum} 50%, transparent 100%)`,
      }} />

      <div style={{ position: "relative", display: "grid", gridTemplateColumns: "440px 1fr", gap: 70, alignItems: "start" }}>
        {/* dictionary specimen — A's card */}
        <div>
          <div style={{ ...cStyles.mono, fontSize: 10, color: C.ember, letterSpacing: "0.24em", textTransform: "uppercase", marginBottom: 20 }}>
            Specimen № 47 — Word of the day
          </div>
          <div style={{ borderTop: `2px solid ${C.ember}`, paddingTop: 30 }}>
            <div style={{ display: "flex", alignItems: "baseline", gap: 14, marginBottom: 6 }}>
              <h3 style={{ ...cStyles.display, fontSize: 104, color: C.parchment, fontWeight: 400, lineHeight: 0.9 }}>{SAMPLE_WORD.word}</h3>
              <span style={{ fontSize: 18, fontStyle: "italic", color: C.muted }}>{SAMPLE_WORD.pos}</span>
            </div>
            <div style={{ ...cStyles.mono, fontSize: 11, color: C.gold, letterSpacing: "0.18em", marginBottom: 24 }}>
              /ˈlæm.bənt/
            </div>
            <p style={{ fontSize: 19, lineHeight: 1.55, color: C.parchment, fontStyle: "italic", marginBottom: 28, maxWidth: 400 }}>
              {SAMPLE_WORD.definition}
            </p>
            <div style={{ paddingTop: 20, borderTop: `1px solid ${C.thread}` }}>
              <div style={{ ...cStyles.mono, fontSize: 9, color: C.muted, letterSpacing: "0.2em", textTransform: "uppercase", marginBottom: 14 }}>
                Synonyms recalled <span style={{ color: C.ember }}>· 2 of 5</span>
              </div>
              <div style={{ display: "flex", flexWrap: "wrap", gap: 10 }}>
                {SAMPLE_WORD.synonyms.map((s, i) => (
                  <span key={s} style={{
                    fontSize: 15, padding: "5px 12px",
                    border: `1px solid ${i < 2 ? C.ember : C.muted + "60"}`,
                    color: i < 2 ? C.ember : C.muted,
                    fontStyle: "italic",
                  }}>{s}{i < 2 && " ✓"}</span>
                ))}
              </div>
            </div>
            {/* handwritten note next to the card */}
            <div style={{ ...cStyles.hand, fontSize: 19, color: C.gold, transform: "rotate(-3deg)", marginTop: 36, marginLeft: 8, opacity: 0.8 }}>
              "from L. lambere — to lick"
            </div>
          </div>
        </div>

        {/* rewrite */}
        <div>
          <div style={{ ...cStyles.mono, fontSize: 10, color: C.ember, letterSpacing: "0.24em", textTransform: "uppercase", marginBottom: 20 }}>
            Stage 05 — The rewrite
          </div>
          <h3 style={{ ...cStyles.display, fontSize: 64, color: C.parchment, fontWeight: 400, marginBottom: 44, lineHeight: 1, maxWidth: 720 }}>
            You write the draft.<br />
            <em style={{ color: C.gold, fontStyle: "italic" }}>The machine names the move.</em>
          </h3>

          <div style={{ marginBottom: 24 }}>
            <div style={{ ...cStyles.mono, fontSize: 10, color: C.muted, letterSpacing: "0.2em", textTransform: "uppercase", marginBottom: 10 }}>
              Your draft
            </div>
            <div style={{
              padding: "20px 0", borderTop: `1px solid ${C.thread}`, borderBottom: `1px solid ${C.thread}`,
              fontSize: 24, lineHeight: 1.5, color: C.parchment, fontStyle: "italic", minHeight: 96,
            }}>
              {draftStr}<span style={{ color: C.ember, animation: "cBlink 1s steps(2) infinite" }}>▍</span>
            </div>
          </div>

          <div style={{ display: "flex", gap: 12, alignItems: "center", marginBottom: 16 }}>
            <span style={{ ...cStyles.mono, fontSize: 10, color: C.ember, letterSpacing: "0.2em", textTransform: "uppercase" }}>
              ↓ Claude · craft move
            </span>
            <span style={{
              fontSize: 11, padding: "4px 10px",
              border: `1px solid ${C.ember}`, color: C.ember,
              ...cStyles.mono, letterSpacing: "0.1em",
            }}>{CRAFT_MOVE.name}</span>
          </div>

          <div style={{
            background: C.ink, padding: "26px 28px",
            borderLeft: `3px solid ${C.ember}`,
          }}>
            <div style={{ ...cStyles.display, fontSize: 30, color: C.gold, lineHeight: 1.3, fontStyle: "italic", marginBottom: 14 }}>
              {rewriteStr}<span style={{ color: C.ember, animation: "cBlink 1s steps(2) infinite" }}>▍</span>
            </div>
            <div style={{ fontSize: 14, color: C.muted, lineHeight: 1.65, paddingTop: 14, borderTop: `1px solid ${C.thread}` }}>
              <span style={{ ...cStyles.mono, fontSize: 10, color: C.ember, textTransform: "uppercase", letterSpacing: "0.18em", marginRight: 10 }}>
                Note —
              </span>
              {CRAFT_MOVE.note}
            </div>
          </div>

          <div style={{ display: "flex", gap: 12, marginTop: 22 }}>
            <button style={{
              ...cStyles.mono, fontSize: 11, padding: "12px 22px",
              background: C.ember, color: C.parchment, border: "none",
              textTransform: "uppercase", letterSpacing: "0.22em", cursor: "pointer",
            }}>Take it</button>
            <button style={{
              ...cStyles.mono, fontSize: 11, padding: "12px 22px",
              background: "transparent", color: C.parchment, border: `1px solid ${C.thread}`,
              textTransform: "uppercase", letterSpacing: "0.22em", cursor: "pointer",
            }}>Keep mine</button>
          </div>
        </div>
      </div>
    </section>
  );
}

// ── STAIRS INTERLUDE — spiral stairs photo + intro to the method ────────────
function CStairsInterlude() {
  return (
    <section style={{ background: C.ink, position: "relative", overflow: "hidden" }}>
      <div style={{ display: "grid", gridTemplateColumns: "560px 1fr", minHeight: 720 }}>
        {/* spiral stairs photo — full-bleed left column */}
        <div style={{ position: "relative", overflow: "hidden" }}>
          <Img src={IMG.spiralStairs} alt="" style={{ position: "absolute", inset: 0 }} />
          <div style={{
            position: "absolute", inset: 0,
            background: `linear-gradient(90deg, transparent 60%, ${C.ink} 100%),
                         radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(14,7,16,0.55) 100%)`,
          }} />
          {/* handwritten caption tucked at the bottom of the photo */}
          <div style={{
            position: "absolute", left: 28, bottom: 28, right: 28,
            ...cStyles.hand, fontSize: 22, color: C.parchment,
            transform: "rotate(-2deg)", lineHeight: 1.3,
            textShadow: "0 2px 12px rgba(0,0,0,0.9)",
          }}>
            "the stack goes up. the work, downward — into the word."
          </div>
          <div style={{
            position: "absolute", left: 28, bottom: 8, ...cStyles.mono,
            fontSize: 9, color: C.muted, letterSpacing: "0.18em", textTransform: "uppercase",
            textShadow: "0 1px 6px rgba(0,0,0,0.9)",
          }}>
            Plate ii · Trinity Long Room, spiral
          </div>
        </div>

        {/* text — right column on dark plum */}
        <div style={{
          background: `linear-gradient(180deg, ${C.ink} 0%, ${C.plum} 100%)`,
          padding: "110px 80px 110px 80px",
          display: "flex", flexDirection: "column", justifyContent: "center",
          position: "relative",
        }}>
          <div style={{ ...cStyles.mono, fontSize: 10, color: C.ember, letterSpacing: "0.28em", textTransform: "uppercase", marginBottom: 22 }}>
            § An interlude
          </div>
          <h2 style={{ ...cStyles.display, fontSize: 84, color: C.parchment, fontWeight: 400, lineHeight: 0.98, marginBottom: 32 }}>
            A vocabulary is not a <em style={{ color: C.ember, fontStyle: "italic" }}>shelf</em>.
            <br />
            It is a <em style={{ color: C.gold, fontStyle: "italic" }}>staircase</em>.
          </h2>
          <p style={{ fontSize: 18, lineHeight: 1.75, color: C.muted, maxWidth: 520, marginBottom: 18 }}>
            You don't acquire words the way you acquire books — by lining them up and admiring
            the spines. You acquire them the way you climb: one tread at a time, with the next
            one always slightly out of reach, and the view a little different from each landing.
          </p>
          <p style={{ fontSize: 18, lineHeight: 1.75, color: C.muted, maxWidth: 520 }}>
            What follows is the staircase — six treads, no skipping. The next session always
            starts where the last one stopped.
          </p>

          {/* small ornamental rule */}
          <div style={{ display: "flex", alignItems: "center", gap: 14, marginTop: 40 }}>
            <div style={{ width: 60, height: 1, background: C.ember }} />
            <span style={{ ...cStyles.mono, fontSize: 9.5, color: C.ember, letterSpacing: "0.28em", textTransform: "uppercase" }}>
              » Continue downward
            </span>
          </div>
        </div>
      </div>
    </section>
  );
}

// ── SIX STEPS — B's vertical alternating layout ─────────────────────────────
function CFlow() {
  const steps = [
    { n: "I",   name: "Review",    sub: "Spaced repetition surface",
      body: "If a word is due, it surfaces here. Intervals run 1, 3, 7, 14, 30 days. You rate your recall; the calendar adjusts.",
      img: IMG.oldBooks },
    { n: "II",  name: "Choose",    sub: "Three doors, one practice",
      body: "Work from your list, drop in a word you encountered in the wild, or take a plain word and elevate it.",
      img: IMG.bookSpines },
    { n: "III", name: "Recall",    sub: "Active retrieval first",
      body: "Before anything is shown, you try to name synonyms from memory. The retrieval is where the learning lives — not the review that follows.",
      img: IMG.manuscript },
    { n: "IV",  name: "Reveal",    sub: "Synonyms + register",
      body: "Claude surfaces synonyms with definitions. You pick one or two — the choice forces a judgement about meaning and tone.",
      img: IMG.bustProfile },
    { n: "V",   name: "Refine",    sub: "Draft → craft move",
      body: "You write the sentence. The machine rewrites it with a named craft move and explains what it did and why.",
      img: IMG.quillInk },
    { n: "VI",  name: "Synthesis", sub: "Bring the session together",
      body: "A final line gathers the session's words. The verdict is honest — what landed, what softened, where the word earned its keep.",
      img: IMG.libraryAisle },
  ];

  return (
    <section style={{ background: C.ink, padding: "120px 56px 130px" }}>
      <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-end", marginBottom: 70, borderBottom: `1px solid ${C.thread}`, paddingBottom: 28 }}>
        <div>
          <div style={{ ...cStyles.mono, fontSize: 10, color: C.ember, letterSpacing: "0.24em", textTransform: "uppercase", marginBottom: 16 }}>
            § The Method · in six movements
          </div>
          <h2 style={{ ...cStyles.display, fontSize: 110, color: C.parchment, fontWeight: 400, lineHeight: 0.92 }}>
            One session.<br />
            <em style={{ color: C.ember, fontStyle: "italic" }}>No skipping.</em>
          </h2>
        </div>
        <div style={{ ...cStyles.hand, fontSize: 24, color: C.parchment, transform: "rotate(-3deg)", maxWidth: 280, textAlign: "right" }}>
          ~ takes about<br />
          eight minutes ~
        </div>
      </div>

      <div style={{ display: "grid", gap: 0 }}>
        {steps.map((s, i) => (
          <div key={s.n} style={{
            display: "grid",
            gridTemplateColumns: i % 2 === 0 ? "1fr 280px 100px" : "100px 280px 1fr",
            alignItems: "center",
            gap: 48,
            padding: "36px 0",
            borderTop: i === 0 ? "none" : `1px solid ${C.thread}`,
          }}>
            {i % 2 === 0 ? (
              <>
                <div>
                  <div style={{ display: "flex", alignItems: "baseline", gap: 18, marginBottom: 10 }}>
                    <span style={{ ...cStyles.mono, fontSize: 11, color: C.ember, letterSpacing: "0.22em" }}>{s.n}.</span>
                    <h3 style={{ ...cStyles.display, fontSize: 64, color: C.parchment, fontWeight: 400, fontStyle: "italic" }}>{s.name}</h3>
                  </div>
                  <div style={{ ...cStyles.mono, fontSize: 9.5, color: C.muted, letterSpacing: "0.2em", textTransform: "uppercase", marginBottom: 14 }}>
                    {s.sub}
                  </div>
                  <p style={{ fontSize: 17, color: C.muted, lineHeight: 1.7, maxWidth: 540 }}>{s.body}</p>
                </div>
                <Img src={s.img} alt={s.name} style={{ width: 280, height: 200 }} vignette />
                <div style={{ ...cStyles.display, fontSize: 100, color: C.thread, fontStyle: "italic", textAlign: "right" }}>{s.n}</div>
              </>
            ) : (
              <>
                <div style={{ ...cStyles.display, fontSize: 100, color: C.thread, fontStyle: "italic" }}>{s.n}</div>
                <Img src={s.img} alt={s.name} style={{ width: 280, height: 200 }} vignette />
                <div style={{ textAlign: "right" }}>
                  <div style={{ display: "flex", alignItems: "baseline", gap: 18, marginBottom: 10, justifyContent: "flex-end" }}>
                    <h3 style={{ ...cStyles.display, fontSize: 64, color: C.parchment, fontWeight: 400, fontStyle: "italic" }}>{s.name}</h3>
                    <span style={{ ...cStyles.mono, fontSize: 11, color: C.ember, letterSpacing: "0.22em" }}>{s.n}.</span>
                  </div>
                  <div style={{ ...cStyles.mono, fontSize: 9.5, color: C.muted, letterSpacing: "0.2em", textTransform: "uppercase", marginBottom: 14 }}>
                    {s.sub}
                  </div>
                  <p style={{ fontSize: 17, color: C.muted, lineHeight: 1.7, maxWidth: 540, marginLeft: "auto" }}>{s.body}</p>
                </div>
              </>
            )}
          </div>
        ))}
      </div>
    </section>
  );
}

// ── PULL QUOTE — B's gilded ceiling ─────────────────────────────────────────
function CQuote() {
  return (
    <section style={{ position: "relative", height: 640, overflow: "hidden", background: C.ink }}>
      <Img src={IMG.ceiling} alt="" style={{ position: "absolute", inset: 0 }} />
      <div style={{
        position: "absolute", inset: 0,
        background: `radial-gradient(ellipse at center, rgba(14,7,16,0.45) 0%, rgba(14,7,16,0.95) 80%)`,
      }} />
      <div style={{
        position: "relative", height: "100%", display: "flex", alignItems: "center", justifyContent: "center",
        padding: "0 80px", textAlign: "center", zIndex: 2,
      }}>
        <div style={{ maxWidth: 1100 }}>
          <p style={{
            ...cStyles.display, fontSize: 60, color: C.parchment,
            lineHeight: 1.18, fontStyle: "italic", marginBottom: 30,
          }}>
            "The difference between the almost right word and the right word is really a large matter — 'tis the difference between the <span style={{ color: C.ember }}>lightning-bug</span> and the <span style={{ color: C.gold }}>lightning</span>."
          </p>
          <div style={{ ...cStyles.mono, fontSize: 11, color: C.muted, letterSpacing: "0.28em", textTransform: "uppercase" }}>
            — Mark Twain · in a letter, 1888
          </div>
        </div>
      </div>
    </section>
  );
}

// ── FOOTER ──────────────────────────────────────────────────────────────────
function CFooter() {
  return (
    <footer style={{ background: C.ink, padding: "60px 56px 50px", borderTop: `1px solid ${C.thread}` }}>
      <div style={{ display: "grid", gridTemplateColumns: "1.4fr 1fr 1fr 1fr", gap: 40, alignItems: "start", paddingBottom: 40, borderBottom: `1px solid ${C.thread}` }}>
        <div>
          <div className="lex-script" style={{
            ...cStyles.script, fontSize: 96, lineHeight: 1.05, marginBottom: 14, letterSpacing: "0.005em",
            background: `linear-gradient(180deg, ${C.bronzeHi} 0%, ${C.bronze} 60%, #6E5224 100%)`,
            WebkitBackgroundClip: "text", backgroundClip: "text", WebkitTextFillColor: "transparent",
            paddingRight: 20, paddingBottom: 16, display: "inline-block",
          }}>
            Lexicon
          </div>
          <p style={{ fontSize: 14, color: C.muted, lineHeight: 1.6, maxWidth: 320, fontStyle: "italic" }}>
            For the writers who would rather make a sentence good than make it long.
          </p>
        </div>
        {[
          { h: "The Practice", l: ["Open the app", "Word list", "Settings"] },
          { h: "The Method",   l: ["The six steps", "Spaced repetition", "Craft moves"] },
          { h: "Colophon",     l: ["Source code", "Built with Claude", "On Cloudflare"] },
        ].map((g) => (
          <div key={g.h}>
            <div style={{ ...cStyles.mono, fontSize: 9.5, color: C.ember, letterSpacing: "0.22em", textTransform: "uppercase", marginBottom: 14 }}>
              {g.h}
            </div>
            {g.l.map((x) => (
              <a key={x} href="#" style={{
                display: "block", fontSize: 14, color: C.parchment, textDecoration: "none",
                padding: "5px 0", fontStyle: "italic",
              }}>{x}</a>
            ))}
          </div>
        ))}
      </div>
      <div style={{ display: "flex", justifyContent: "space-between", marginTop: 26 }}>
        <span style={{ ...cStyles.mono, fontSize: 10, color: C.muted, letterSpacing: "0.22em", textTransform: "uppercase" }}>
          MMXXVI · A vocabulary press
        </span>
        <span style={{ ...cStyles.mono, fontSize: 10, color: C.muted, letterSpacing: "0.22em", textTransform: "uppercase" }}>
          Vol. I · No. 01
        </span>
      </div>
    </footer>
  );
}

function DirectionC() {
  return (
    <div style={cStyles.page}>
      <style>{`
        @keyframes cFade { 0% { opacity: 0; transform: translateY(6px); } 25%, 75% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-3px); } }
        @keyframes cBlink { 50% { opacity: 0; } }
      `}</style>
      <CHero />
      <CManifesto />
      <CSample />
      <CStairsInterlude />
      <CFlow />
      <CQuote />
      <CFooter />
    </div>
  );
}

window.DirectionC = DirectionC;
