// Ambition landing page — root composition
const { useState, useEffect, useRef } = React;

const LogoFull = () => (
  <svg viewBox="0 0 178 36" fill="none">
    <path
      d="M52.2604 20.0896H45.7011L44.4505 23.1184H41.0977L47.3962 8.9881H50.6265L56.9429 23.1184H53.5111L52.2604 20.0896ZM51.2311 17.6062L48.9906 12.1967L46.7502 17.6062H51.2311Z"
      fill="#205FA6"
    />
    <path
      d="M75.313 23.1184L75.2933 14.6406L71.1344 21.6248H69.6605L65.5214 14.8224V23.1184H62.4551V8.9881H65.1598L70.4488 17.7682L75.6568 8.9881H78.3418L78.3813 23.1184H75.313Z"
      fill="#205FA6"
    />
    <path
      d="M98.0417 17.051C98.4981 17.6496 98.7273 18.3866 98.7273 19.2618C98.7273 20.5006 98.2452 21.4509 97.283 22.1187C96.3209 22.7845 94.9181 23.1184 93.0747 23.1184H85.7686V8.9881H92.6717C94.3945 8.9881 95.7163 9.31804 96.6389 9.97793C97.5616 10.6378 98.0219 11.5328 98.0219 12.6629C98.0219 13.3485 97.858 13.961 97.528 14.5003C97.1981 15.0397 96.7377 15.4625 96.145 15.7727C96.9511 16.0256 97.5833 16.4523 98.0417 17.051ZM89.0186 11.4498V14.7809H92.2687C93.0767 14.7809 93.6892 14.6406 94.1061 14.3561C94.5229 14.0736 94.7324 13.6567 94.7324 13.1055C94.7324 12.5543 94.5229 12.1394 94.1061 11.8647C93.6892 11.5881 93.0767 11.4518 92.2687 11.4518H89.0186V11.4498ZM94.7818 20.2319C95.2184 19.9494 95.4377 19.5127 95.4377 18.92C95.4377 17.7484 94.5704 17.1636 92.8337 17.1636H89.0186V20.6547H92.8337C93.6951 20.6547 94.3432 20.5144 94.7818 20.2319Z"
      fill="#205FA6"
    />
    <path d="M105.247 8.9881H108.517V23.1184H105.247V8.9881Z" fill="#205FA6" />
    <path
      d="M118.832 11.6514H114.31V8.98615H126.622V11.6514H122.1V23.1165H118.83V11.6514H118.832Z"
      fill="#205FA6"
    />
    <path d="M132.417 8.9881H135.687V23.1184H132.417V8.9881Z" fill="#205FA6" />
    <path
      d="M145.951 22.4111C144.773 21.7789 143.851 20.9076 143.185 19.7972C142.519 18.6869 142.185 17.4382 142.185 16.0533C142.185 14.6683 142.519 13.4196 143.185 12.3093C143.851 11.1989 144.773 10.3276 145.951 9.69541C147.128 9.06318 148.45 8.74707 149.918 8.74707C151.384 8.74707 152.704 9.06318 153.873 9.69541C155.045 10.3276 155.966 11.1989 156.639 12.3093C157.311 13.4196 157.649 14.6683 157.649 16.0533C157.649 17.4402 157.313 18.6869 156.639 19.7972C155.966 20.9076 155.045 21.7789 153.873 22.4111C152.702 23.0433 151.384 23.3595 149.918 23.3595C148.45 23.3595 147.128 23.0433 145.951 22.4111ZM152.178 19.9988C152.85 19.6155 153.379 19.0801 153.763 18.3945C154.146 17.7089 154.338 16.9285 154.338 16.0533C154.338 15.178 154.146 14.3976 153.763 13.712C153.379 13.0265 152.852 12.491 152.178 12.1078C151.505 11.7245 150.752 11.5328 149.918 11.5328C149.084 11.5328 148.33 11.7245 147.658 12.1078C146.984 12.491 146.457 13.0265 146.073 13.712C145.69 14.3976 145.498 15.18 145.498 16.0533C145.498 16.9285 145.69 17.7089 146.073 18.3945C146.457 19.0801 146.984 19.6155 147.658 19.9988C148.33 20.3821 149.084 20.5737 149.918 20.5737C150.752 20.5737 151.505 20.3821 152.178 19.9988Z"
      fill="#205FA6"
    />
    <path
      d="M177.108 8.9881V23.1184H174.423L167.378 14.5399V23.1184H164.147V8.9881H166.852L173.876 17.5667V8.9881H177.108Z"
      fill="#205FA6"
    />
    <path
      d="M14.0895 30.2605C15.2038 33.3821 16.2431 36 16.2431 36C16.2431 36 17.2823 33.3821 18.3966 30.2605C18.9281 28.7728 17.8217 27.2061 16.2431 27.2061C14.6625 27.208 13.5581 28.7728 14.0895 30.2605Z"
      fill="#205FA6"
    />
    <path
      d="M16.2432 22.6284C17.306 22.6284 18.1675 21.7668 18.1675 20.704C18.1675 19.6412 17.306 18.7797 16.2432 18.7797C15.1804 18.7797 14.3188 19.6412 14.3188 20.704C14.3188 21.7668 15.1804 22.6284 16.2432 22.6284Z"
      fill="#205FA6"
    />
    <path
      d="M29.2315 29.4189H23.6007L20.7873 25.6038C20.9888 24.5507 21.1074 23.4483 21.1074 22.3083C21.1074 15.0693 16.2431 9.2014 16.2431 9.2014C16.2431 9.2014 11.375 15.0693 11.375 22.3083C11.375 23.4483 11.4935 24.5507 11.699 25.6038L8.88163 29.4189H3.25084C0.751559 29.4189 -0.811226 26.7141 0.441378 24.5488L13.7992 1.40918C14.8858 -0.469726 17.6005 -0.469726 18.6831 1.40918L32.0449 24.5488C33.2936 26.7141 31.7308 29.4189 29.2315 29.4189Z"
      fill="#205FA6"
    />
  </svg>
);

const LogoIcon = ({ color = "#205FA6" }) => (
  <svg width="109" height="120" viewBox="0 0 109 120" fill="none">
    <path
      d="M46.9581 100.872C50.6735 111.276 54.1385 120 54.1385 120C54.1385 120 57.6016 111.274 61.317 100.872C63.088 95.9132 59.403 90.6934 54.1385 90.6934C48.8721 90.6934 45.1872 95.9114 46.9581 100.872Z"
      fill={color}
    />
    <path
      d="M54.1393 75.4271C57.6821 75.4271 60.5541 72.5552 60.5541 69.0124C60.5541 65.4696 57.6821 62.5977 54.1393 62.5977C50.5966 62.5977 47.7246 65.4696 47.7246 69.0124C47.7246 72.5552 50.5966 75.4271 54.1393 75.4271Z"
      fill={color}
    />
    <path
      d="M97.4329 98.0613H78.6645L69.2857 85.3481C69.9565 81.8366 70.3536 78.1606 70.3536 74.3629C70.3536 50.2352 54.1396 30.6744 54.1396 30.6744C54.1396 30.6744 37.915 50.2352 37.915 74.3629C37.915 78.1606 38.3121 81.8366 38.9936 85.3481L29.6041 98.0613H10.8375C2.50512 98.0613 -2.70216 89.0456 1.46939 81.8259L45.9951 4.69702C49.6157 -1.56567 58.6654 -1.56567 62.2752 4.69702L106.812 81.8259C110.972 89.0456 105.765 98.0613 97.4329 98.0613Z"
      fill={color}
    />
  </svg>
);

// ── Brand mark ────────────────────────────────────────────────────
const LogoMark = ({ color = "#fff", size = 18 }) => (
  <svg width={size} height={size * 1.15} viewBox="0 0 100 115" fill="none">
    {/* A-shape (rocket exterior) */}
    <path
      d="M50 5 L92 90 H8 Z M50 28 L28 78 H72 Z"
      fill={color}
      fillRule="evenodd"
    />
    {/* astronaut head */}
    <circle cx="50" cy="58" r="6" fill={color} />
    {/* rocket fin/tail */}
    <path d="M44 67 L50 92 L56 67 Z" fill={color} />
  </svg>
);

// ── Tweak defaults (persisted to disk) ────────────────────────────
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/ {
  accent: "#205FA6",
  headline: "real-life",
  ctaCopy: "Get Ambition",
  heroLayout: "split",
  heroScreen: "dashboard",
  darkMode: false,
}; /*EDITMODE-END*/

const HEADLINES = {
  "real-life": {
    h1: (
      <>
        Help your teen <span className="accent">get ready</span> for real life.
      </>
    ),
    sub: "Ambition turns career exploration and life-skill learning into short, rewarding lessons teens actually stick with — and gives you the tools to support them.",
  },
  "future-now": {
    h1: (
      <>
        Their future <span className="serif accent">starts</span> now.
      </>
    ),
    sub: "Short career internships, life lessons, and guided conversations — all designed to get teens thinking seriously about what comes next.",
  },
  "actually-use": {
    h1: (
      <>
        Career and life skills they'll{" "}
        <span className="accent">actually use.</span>
      </>
    ),
    sub: "Built for the gap between school and adulthood — money, work, relationships, decisions. The stuff teens need but rarely get.",
  },
  "you-help": {
    h1: (
      <>
        You want to help. <span className="serif accent">Ambition</span> shows
        you how.
      </>
    ),
    sub: "Most parents don't know where to start. We give your family a structure — learn, set goals, talk, and reward — that makes preparing for adulthood feel doable.",
  },
};

// ── Reveal-on-scroll hook ────────────────────────────────────────
function useReveal() {
  useEffect(() => {
    const els = document.querySelectorAll(".reveal");
    const io = new IntersectionObserver(
      (entries) => {
        entries.forEach((e) => {
          if (e.isIntersecting) {
            e.target.classList.add("in");
            io.unobserve(e.target);
          }
        });
      },
      { rootMargin: "0px 0px -10% 0px" },
    );
    els.forEach((el) => io.observe(el));
    return () => io.disconnect();
  }, []);
}

// ── Sticky nav scroll-state ──────────────────────────────────────
function useScrollClass() {
  useEffect(() => {
    const nav = document.querySelector(".nav");
    const fn = () => nav?.classList.toggle("scrolled", window.scrollY > 8);
    fn();
    window.addEventListener("scroll", fn, { passive: true });
    return () => window.removeEventListener("scroll", fn);
  }, []);
}

// ── App store buttons (real-looking) ─────────────────────────────
const AppleSVG = (
  <svg viewBox="0 0 24 24" fill="currentColor">
    <path d="M17.05 11.97c-.03-2.83 2.31-4.19 2.42-4.26-1.32-1.93-3.38-2.19-4.11-2.22-1.75-.18-3.42 1.03-4.31 1.03-.91 0-2.27-1.01-3.74-.98-1.92.03-3.7 1.12-4.69 2.84-2 3.47-.51 8.6 1.44 11.42.95 1.38 2.08 2.92 3.55 2.87 1.43-.06 1.97-.92 3.7-.92 1.72 0 2.21.92 3.71.89 1.54-.03 2.51-1.4 3.45-2.78 1.09-1.6 1.54-3.15 1.56-3.23-.03-.01-2.99-1.14-3.02-4.54zm-2.83-8.34c.78-.94 1.31-2.25 1.16-3.55-1.13.05-2.49.75-3.3 1.69-.72.83-1.36 2.16-1.19 3.44 1.26.1 2.55-.64 3.33-1.58z" />
  </svg>
);

const GoogleSVG = (
  <svg viewBox="0 0 64 64" strokeWidth="3" stroke="currentColor" fill="none">
    <path d="M12.36,53.33V10.67a1,1,0,0,1,1.56-.91L51.11,31a1,1,0,0,1,0,1.81L13.93,54.24A1.05,1.05,0,0,1,12.36,53.33Z" />
    <line x1="12.36" y1="10.67" x2="42.07" y2="38.02" />
    <line x1="12.36" y1="53.33" x2="41.24" y2="25.35" />
  </svg>
);

const StoreButton = ({ store = "apple", accent }) => {
  const storeLinks = {
    apple:
      "https://apps.apple.com/us/app/ambition-shape-your-future/id1557562279",
    google:
      "https://play.google.com/store/apps/details?id=com.theambitionapp.ambitionappRN",
  };
  return (
    <a
      href={storeLinks[store]}
      className="store-btn"
      style={accent ? { background: accent } : undefined}
      target="_blank"
    >
      {store === "apple" ? AppleSVG : GoogleSVG}
      <div>
        <div className="small">
          {store === "apple" ? "Download on the" : "Get it on"}
        </div>
        <div className="big">
          {store === "apple" ? "App Store" : "Google Play"}
        </div>
      </div>
    </a>
  );
};

// ── Section: Nav ─────────────────────────────────────────────────
function Nav({ ctaCopy, accent }) {
  return (
    <nav className="nav">
      <div className="container nav-row">
        <a href="#" className="nav-logo">
          {/* <span className="mark" style={{ background: accent }}>
            <LogoMark color="#fff" />
          </span>
          <span>Ambition</span> */}
          <LogoFull />
        </a>
        <div className="nav-links">
          <a href="#how">How it works</a>
          <a href="#features">Features</a>
          <a href="#pricing">Pricing</a>
        </div>
        <div className="nav-actions">
          {/* <a
            href="#"
            className="ghost-cta"
            style={{ fontSize: 14, fontWeight: 500, color: "var(--ink-2)" }}
          >
            Sign in
          </a> */}
          <a
            href="#cta"
            className="btn btn-primary"
            style={{ padding: "10px 18px", fontSize: 14 }}
          >
            {ctaCopy}
          </a>
        </div>
      </div>
    </nav>
  );
}

// ── Section: HERO ────────────────────────────────────────────────
function Hero({ t }) {
  const headline = HEADLINES[t.headline] || HEADLINES["real-life"];

  return (
    <section className="hero" data-layout={t.heroLayout}>
      <div className="container">
        <div className="hero-grid">
          <div className="hero-copy reveal">
            <div className="eyebrow">For parents & adults who care</div>
            <h1 style={{ marginTop: 20 }}>{headline.h1}</h1>
            <p className="lead hero-sub">{headline.sub}</p>

            <div className="hero-cta-row">
              <StoreButton store="apple" accent={t.accent} />
              <StoreButton store="google" accent={t.accent} />
            </div>
            <div
              style={{
                marginTop: 14,
                fontSize: 13,
                color: "var(--mute)",
                display: "flex",
                alignItems: "center",
                gap: 14,
              }}
            >
              <span>✦ Free 14-day trial</span>
              <span>✦ Cancel anytime</span>
              <span>✦ Designed for ages 14–19</span>
            </div>

            <div className="hero-stats">
              <div className="hero-stat">
                <strong>4.9 ★</strong>
                <span>App Store rating</span>
              </div>
              <div className="hero-stat-divider"></div>
              <div className="hero-stat">
                <strong>3,000+</strong>
                <span>Families</span>
              </div>
              <div className="hero-stat-divider"></div>
              <div className="hero-stat">
                <strong>7-MIN</strong>
                <span>Daily lessons</span>
              </div>
            </div>
          </div>

          <div className="hero-phone-stage reveal">
            <div className="hero-blob"></div>
            {t.heroLayout === "gallery" ? (
              <div className="phone-cluster">
                <Phone screen="agreement" />
                <Phone screen="dashboard" />
                <Phone screen="conversation" />
              </div>
            ) : (
              <Phone
                screen={t.heroScreen}
                style={{ position: "relative", zIndex: 1 }}
              />
            )}
          </div>
        </div>
      </div>
    </section>
  );
}

// ── Section: Problem ─────────────────────────────────────────────
function Problem() {
  const cards = [
    {
      num: "01",
      label: "The blank stare",
      body: '"What do you want to do after school?" — and your teen has no idea where to begin.',
    },
    {
      num: "02",
      label: "Phone, all day",
      body: "Hours of scrolling, not much that prepares them for life beyond the screen.",
    },
    {
      num: "03",
      label: "Future feels far",
      body: "Adulthood is around the corner. Motivation to think seriously about it isn't.",
    },
    {
      num: "04",
      label: "The hard talks",
      body: "Money, careers, choices — you want to start them but never know quite how.",
    },
  ];

  return (
    <section className="section" style={{ paddingBottom: 0 }}>
      <div className="container">
        <div className="section-head reveal">
          <div className="eyebrow">Sound familiar?</div>
          <h2 style={{ marginTop: 16, maxWidth: "100%" }}>
            You're not alone.{" "}
            <span className="serif" style={{ color: "var(--mute)" }}>
              Almost every parent of a teen is here.
            </span>
          </h2>
          <p className="lead" style={{ marginTop: 18 }}>
            Schools teach a lot. But the bridge from teenager to capable adult —
            careers, money, life decisions — that one's mostly on you. Ambition
            makes that bridge shorter.
          </p>
        </div>
        <div className="problem-grid reveal">
          {cards.map((c, i) => (
            <div className="problem-card" key={i}>
              <div className="num">{c.num}</div>
              <div className="label">{c.label}</div>
              <div className="body">{c.body}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ── Section: How it works ────────────────────────────────────────
function HowItWorks({ accent }) {
  const steps = [
    {
      num: 1,
      title: "They browse a library of topics",
      body: "Career internships and life lessons across dozens of topics — your teen picks whatever catches their eye.",
      art: (
        <div style={{ padding: 18, width: "100%" }}>
          <div
            style={{
              background: "#fff",
              borderRadius: 10,
              padding: 14,
              border: "1px solid var(--line)",
            }}
          >
            <div
              style={{
                fontSize: 11,
                color: "var(--mute)",
                fontWeight: 600,
                letterSpacing: "0.08em",
              }}
            >
              EXPLORE
            </div>
            <div
              style={{
                display: "flex",
                flexWrap: "wrap",
                gap: 5,
                marginTop: 8,
              }}
            >
              {["Entrepreneurship", "Healthcare", "Filmmaking", "Money"].map(
                (x, i) => (
                  <span
                    key={x}
                    style={{
                      fontSize: 10,
                      padding: "3px 8px",
                      borderRadius: 999,
                      background: i < 2 ? accent : "transparent",
                      color: i < 2 ? "#fff" : "var(--ink-2)",
                      border: i < 2 ? "none" : "1px solid var(--line)",
                      fontWeight: 500,
                    }}
                  >
                    {x}
                  </span>
                ),
              )}
            </div>
          </div>
        </div>
      ),
    },
    {
      num: 2,
      title: "They complete short lessons",
      body: 'Short, video-based "internships" and life skills they can do on the bus or in line. No homework feel.',
      art: (
        <div style={{ width: "100%", padding: 18 }}>
          <div
            style={{
              background: "#0A1A2E",
              borderRadius: 10,
              padding: 14,
              color: "#fff",
            }}
          >
            <div style={{ fontSize: 11, opacity: 0.7, fontWeight: 600 }}>
              DAY 4 OF 30 · ENTREPRENEUR
            </div>
            <div
              style={{
                fontSize: 14,
                fontWeight: 700,
                marginTop: 6,
                letterSpacing: "-0.01em",
              }}
            >
              Intro to a Business Model
            </div>
            <div
              style={{
                marginTop: 10,
                height: 6,
                borderRadius: 3,
                background: "rgba(255,255,255,0.15)",
              }}
            >
              <div
                style={{
                  ...{
                    width: "50%",
                    height: "100%",
                    background: accent,
                    borderRadius: 3,
                  },
                  background: "rgb(152, 179, 209)",
                }}
              ></div>
            </div>
            <div
              style={{
                ...{
                  fontSize: 10,
                  marginTop: 8,
                  color: accent,
                  fontWeight: 600,
                },
                color: "rgb(255, 255, 255)",
              }}
            >
              ▶ 1:32 min remaining
            </div>
          </div>
        </div>
      ),
    },
    {
      num: 3,
      title: "You set rewards & track",
      body: "Pick a real reward — gift card, privileges, something they'll want — and watch progress in real time.",
      art: (
        <div style={{ padding: 18, width: "100%" }}>
          <div
            style={{
              background: "#fff",
              borderRadius: 10,
              padding: 14,
              border: "1px solid var(--line)",
            }}
          >
            <div
              style={{
                fontSize: 11,
                color: "var(--mute)",
                fontWeight: 600,
                letterSpacing: "0.08em",
              }}
            >
              REWARD
            </div>
            <div style={{ fontWeight: 700, fontSize: 13, marginTop: 2 }}>
              1 hr extended curfew
            </div>
            <div
              style={{
                fontSize: 11,
                color: "var(--mute)",
                fontWeight: 600,
                letterSpacing: "0.08em",
                marginTop: 10,
              }}
            >
              PROGRESS
            </div>
            <div
              style={{
                marginTop: 6,
                height: 8,
                borderRadius: 4,
                background: "#EAF2FB",
              }}
            >
              <div
                style={{
                  width: "62%",
                  height: "100%",
                  background: "#388E3C",
                  borderRadius: 4,
                }}
              ></div>
            </div>
            <div
              style={{
                fontSize: 10,
                fontWeight: 700,
                marginTop: 4,
                color: "#388E3C",
              }}
            >
              18 of 30 lessons complete
            </div>
          </div>
        </div>
      ),
    },
    {
      num: 4,
      title: "Talk about the future",
      body: "Use guided prompts to talk with your teen about careers, money, lifestyle, goals, and the future they want.",
      art: (
        <div style={{ padding: 18, width: "100%" }}>
          <div
            style={{
              background: "#fff",
              borderRadius: 10,
              padding: 14,
              border: "1px solid var(--line)",
            }}
          >
            <div style={{ fontSize: 22, marginBottom: 6 }}>💵</div>
            <div style={{ fontSize: 13, fontWeight: 700 }}>
              Future Lifestyle
            </div>
            <div
              style={{
                fontSize: 11,
                color: "var(--mute)",
                marginTop: 4,
                lineHeight: 1.4,
              }}
            >
              "Different careers lead to different lifestyles. What do you want
              yours to look like?"
            </div>
          </div>
        </div>
      ),
    },
  ];

  return (
    <section className="section" id="how">
      <div className="container">
        <div className="section-head reveal">
          <div className="eyebrow">How it works</div>
          <h2 style={{ marginTop: 16, width: "800px", maxWidth: "100%" }}>
            A simple structure for the most important conversation.
          </h2>
        </div>
        <div className="steps reveal">
          {steps.map((s) => (
            <div className="step" key={s.num}>
              <div className="step-num" style={{ background: accent }}>
                {s.num}
              </div>
              <h3>{s.title}</h3>
              <p>{s.body}</p>
              <div className="step-art">{s.art}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ── Section: Features (dark) ─────────────────────────────────────
function Features({ accent }) {
  const features = [
    {
      tag: "Career Internships",
      title: "Real careers, a few minutes at a time.",
      body: 'Short video "internships" that show what real careers look like — entrepreneurship, healthcare, design, tech, trades, sports business. Teens explore at their own pace.',
      screen: "internships",
    },
    {
      tag: "Life Lessons",
      title: "The stuff school skips.",
      body: 'Money. Taxes. Resumes. Healthy relationships. Confidence. The practical skills teens are supposed to "figure out somehow."',
      screen: "lesson",
    },
    {
      tag: "Family Agreements",
      title: "Real rewards. Real motivation.",
      body: "You set the goal and the reward — a privilege, an experience, a milestone bonus. Your teen approves it. Then both of you watch progress climb.",
      screen: "agreement",
    },
    {
      tag: "Guided Conversations",
      title: "Better talks, less awkward.",
      body: "Prompts on big topics — money, work, what they want from life — that you both answer privately in the app, then can discuss together.",
      screen: "conversation",
    },
  ];

  return (
    <section className="features" id="features">
      <div className="container">
        <div className="section-head reveal" style={{ maxWidth: 760 }}>
          <div className="eyebrow">What's inside</div>
          <h2 style={{ marginTop: 16 }}>
            Four things, working together. <br />
            <span className="serif" style={{ color: "rgba(244,239,228,0.55)" }}>
              So you're not piecing it together yourself.
            </span>
          </h2>
        </div>
        <div className="feature-grid reveal">
          {features.map((f, i) => (
            <div className="feature-card" key={i}>
              <div>
                <span className="tag">{f.tag}</span>
                <h3>{f.title}</h3>
                <p>{f.body}</p>
              </div>
              <div className="art">
                <div
                  style={{
                    transform: "scale(0.62)",
                    transformOrigin: "top center",
                    width: 320,
                    marginLeft: -50,
                  }}
                >
                  <Phone screen={f.screen} style={{ transform: "none" }} />
                </div>
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ── Section: Testimonials ───────────────────────────────────────
function Testimonials() {
  const quotes = [
    {
      body: "My 16-year-old was completely directionless last fall. Two months in, he's telling me about cost of living and asking real questions. I have no idea who this kid is and I love it.",
      name: "Rachel M.",
      meta: "Mom of 2 · Austin, TX",
    },
    {
      body: "The prompts gave me a window into how she thinks about her future. Her responses help me start conversations we probably would have avoided.",
      name: "David T.",
      meta: "Dad of 1 · Atlanta, GA",
    },
    {
      body: "I was skeptical that another app was the answer. But this one has structure, the lessons are short, and the rewards actually motivate him. It earned its place.",
      name: "Priya K.",
      meta: "Mom of 1 · New York, NY",
    },
  ];

  return (
    <section className="section testimonials">
      <div className="container">
        <div className="section-head reveal">
          <div className="eyebrow">From parents using it now</div>
          <h2 style={{ marginTop: 16 }}>
            <span className="serif" style={{ color: "var(--mute)" }}>
              What we hear most:
            </span>{" "}
            "I wish we'd had this sooner."
          </h2>
        </div>
        <div className="quote-grid reveal">
          {quotes.map((q, i) => (
            <div className="quote" key={i}>
              <div className="body">{q.body}</div>
              <div className="quote-foot">
                <div className="avatar">
                  {q.name
                    .split(" ")
                    .map((w) => w[0])
                    .join("")
                    .slice(0, 2)}
                </div>
                <div>
                  <div className="name">{q.name}</div>
                  <div className="meta">{q.meta}</div>
                </div>
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ── Section: Pricing ─────────────────────────────────────────────
function Pricing({ ctaCopy, accent }) {
  return (
    <section className="section" id="pricing">
      <div className="container">
        <div className="section-head reveal">
          <div className="eyebrow">Pricing</div>
          <h2 style={{ marginTop: 16 }}>One plan. The whole family.</h2>
          <p className="lead" style={{ marginTop: 18 }}>
            Start with a free 2-week trial in the app. After that, pick the plan
            that fits your family.
          </p>
        </div>

        <div
          className="pricing-grid reveal"
          style={{ gridTemplateColumns: "repeat(3, 1fr)", maxWidth: 1100 }}
        >
          {/* Free trial */}
          <div className="plan">
            <div className="name">Free Trial</div>
            <div className="price-row">
              <div className="price">$0</div>
              <div className="per">for 14 days</div>
            </div>
            <div className="desc">
              Full access for the whole family. Cancel anytime — no charge until
              the trial ends.
            </div>
            <ul>
              <li>Every internship & lesson</li>
              <li>Guided conversations</li>
              <li>Family agreements & rewards</li>
            </ul>
            <div
              style={{
                marginTop: "auto",
                paddingTop: 18,
                fontSize: 12,
                color: "var(--mute)",
              }}
            >
              Trial begins when you sign up in the app.
            </div>
          </div>

          {/* Monthly */}
          <div className="plan">
            <div className="name">Monthly</div>
            <div className="price-row">
              <div className="price">$9.99</div>
              <div className="per">/ month</div>
            </div>
            <div className="desc">
              Pay month to month. Cancel anytime from your account.
            </div>
            <ul>
              <li>Everything in the trial</li>
              <li>Add up to 4 teens</li>
              <li>Add up to 4 adults</li>
            </ul>
            <div
              style={{
                marginTop: "auto",
                paddingTop: 18,
                fontSize: 12,
                color: "var(--mute)",
              }}
            >
              No commitment.
            </div>
          </div>

          {/* Yearly (featured) */}
          <div className="plan featured">
            <div className="plan-badge">Best value</div>
            <div className="name">Yearly</div>
            <div className="price-row">
              <div className="price">$99.99</div>
              <div className="per">/ year</div>
            </div>
            <div className="desc">
              Everything in Monthly, billed once a year. The price of two
              months.
            </div>
            <ul>
              <li>Everything in Monthly</li>
              <li>Save over 80% vs monthly</li>
              <li>12 months of access</li>
            </ul>
            <div
              style={{
                marginTop: "auto",
                paddingTop: 18,
                fontSize: 12,
                color: "rgba(244,239,228,0.7)",
              }}
            >
              Most families choose yearly.
            </div>
          </div>
        </div>

        <div
          className="reveal"
          style={{
            marginTop: 28,
            fontSize: 13,
            color: "var(--mute)",
            textAlign: "center",
            display: "flex",
            justifyContent: "center",
            gap: 24,
            flexWrap: "wrap",
          }}
        >
          <span>✦ Cancel anytime</span>
          <span>✦ No ads, ever</span>
          <span>✦ Your teen's data stays private</span>
          <span>
            School district?{" "}
            <a
              href="mailto:info@theambitionapp.com"
              style={{
                color: "var(--accent, var(--brand))",
                textDecoration: "underline",
                textUnderlineOffset: 3,
              }}
            >
              Reach out
            </a>
          </span>
        </div>
      </div>
    </section>
  );
}

// ── Section: FAQ ────────────────────────────────────────────────
function FAQ() {
  const faqs = [
    {
      q: "What age is Ambition for?",
      a: "Ambition is designed for teens ages 13 to 19. The content scales — early teens start with simpler career and money lessons, older teens get into deeper material like resumes, financial planning, and life decisions.",
    },
    {
      q: "How much time does it take?",
      a: "Lessons are 5 minutes. Most teens use the app 3–4 times a week on their own once they get going. Adults check in for a minute or two when they want — Ambition pings you when there's new progress or a conversation reply.",
    },
    {
      q: 'My teen won\'t use another "learning" app.',
      a: "Fair. Ambition is built around real motivation: short videos with real people, real rewards you set with them, and topics teens actually care about (money, lifestyle, what work feels like). It doesn't feel like school.",
    },
    {
      q: "What if I don't know what to talk about?",
      a: 'That\'s exactly what guided conversations are for. You both answer the same prompt privately, then can compare and discuss. No "how was your day" energy.',
    },
    {
      q: "How does the reward system work?",
      a: "You set a goal (say, 30 internship days + 10 life lessons) and a reward (say, $50 Amazon gift card or a special privilege). Your teen has to agree to it before it starts. When they hit the goal, you fulfill the reward.",
    },
    {
      q: "Is my teen's data private?",
      a: "Yes. Their reflections and conversation answers are shared only with the adult supporters they invite — not used for advertising, not sold to anyone, not used to train AI. Full details on our privacy page.",
    },
  ];

  const [open, setOpen] = useState(0);
  return (
    <section className="section" id="faq">
      <div className="container">
        <div className="faq-wrap">
          <div className="reveal">
            <div className="eyebrow">FAQ</div>
            <h2 style={{ marginTop: 16, fontSize: "clamp(30px, 3vw, 42px)" }}>
              Questions parents ask before signing up.
            </h2>
            <p className="lead" style={{ marginTop: 18 }}>
              Don't see yours?{" "}
              <a
                href="mailto:hello@theambitionapp.com"
                style={{
                  color: "var(--accent, var(--brand))",
                  textDecoration: "underline",
                  textUnderlineOffset: 3,
                }}
              >
                Email us
              </a>{" "}
              — we read everything.
            </p>
          </div>
          <div className="faq-list reveal">
            {faqs.map((f, i) => (
              <div key={i} className={`faq-item ${open === i ? "open" : ""}`}>
                <button
                  className="faq-q"
                  onClick={() => setOpen(open === i ? -1 : i)}
                >
                  <span>{f.q}</span>
                  <span className="ico">+</span>
                </button>
                <div className="faq-a">
                  <div className="faq-a-inner">{f.a}</div>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

// ── Section: Final CTA ──────────────────────────────────────────
function FinalCTA({ accent, ctaCopy }) {
  return (
    <section className="cta-final" id="cta">
      <div className="container">
        <div className="logo-glow" style={{ background: accent }}>
          <LogoIcon color="#fff" />
        </div>
        <div className="eyebrow" style={{ color: "rgba(244,239,228,0.7)" }}>
          Ready when you are
        </div>
        <h2 style={{ marginTop: 18 }}>
          Your teen's future matters. <br />
          <span className="serif" style={{ color: "rgba(244,239,228,0.7)" }}>
            Help them start preparing for it now.
          </span>
        </h2>
        <p className="lead" style={{ marginTop: 22 }}>
          Free for 14 days. Set up your family in under 5 minutes.
        </p>
        <div className="hero-cta-row">
          <StoreButton store="apple" accent={accent} />
          <StoreButton store="google" accent={accent} />
        </div>
        <div
          style={{
            marginTop: 16,
            fontSize: 13,
            color: "rgba(244,239,228,0.6)",
          }}
        >
          No credit card. Cancel anytime.
        </div>
      </div>
    </section>
  );
}

// ── Footer ──────────────────────────────────────────────────────
function Footer({ accent }) {
  return (
    <footer>
      <div className="container">
        <div className="footer-main">
          <div>
            <div className="nav-logo">
              <span className="mark" style={{ background: accent }}>
                <LogoIcon color="#fff" />
              </span>
              <span>Ambition</span>
            </div>
            <p className="footer-tagline">
              The app that helps families prepare teens for adulthood — through
              career exploration, life skills, and real conversations.
            </p>
          </div>
          <div className="footer-contact">
            <h4>Get in touch</h4>
            <a href="mailto:info@theambitionapp.com" className="footer-email">
              info@theambitionapp.com
            </a>
            <p className="footer-note">
              Questions, press, partnerships, or school inquiries — we read
              everything.
            </p>
          </div>
        </div>
        <div className="footer-bottom">
          <div>© 2026 Ambition, Inc. Made for families who care.</div>
        </div>
      </div>
    </footer>
  );
}

// ── Tweaks panel ────────────────────────────────────────────────
function Tweaks({ tweaks, setTweak }) {
  return (
    <TweaksPanel>
      <TweakSection
        title="Headline"
        subtitle="Try different voices for the hero H1."
      >
        <TweakRadio
          value={tweaks.headline}
          onChange={(v) => setTweak("headline", v)}
          options={[
            { value: "real-life", label: "Real-life" },
            { value: "future-now", label: "Future" },
            { value: "actually-use", label: "Skills" },
            { value: "you-help", label: "You help" },
          ]}
        />

        <div
          style={{ fontSize: 11, color: "#999", marginTop: 6, lineHeight: 1.4 }}
        >
          {HEADLINES[tweaks.headline] && (
            <em>
              "
              {typeof HEADLINES[tweaks.headline].h1 === "string"
                ? HEADLINES[tweaks.headline].h1
                : (HEADLINES[tweaks.headline].sub || "").slice(0, 70) + "…"}
              "
            </em>
          )}
        </div>
      </TweakSection>

      <TweakSection title="Accent color">
        <TweakColor
          value={tweaks.accent}
          onChange={(v) => setTweak("accent", v)}
          options={["#205FA6", "#E26A4A", "#2F7D5C", "#5B3A8E"]}
        />
      </TweakSection>

      <TweakSection title="Hero layout">
        <TweakRadio
          value={tweaks.heroLayout}
          onChange={(v) => setTweak("heroLayout", v)}
          options={[
            { value: "split", label: "Split" },
            { value: "centered", label: "Center" },
            { value: "gallery", label: "Gallery" },
          ]}
        />
      </TweakSection>

      {tweaks.heroLayout !== "gallery" && (
        <TweakSection title="Phone on display">
          <TweakSelect
            value={tweaks.heroScreen}
            onChange={(v) => setTweak("heroScreen", v)}
            options={[
              { value: "dashboard", label: "Parent dashboard" },
              { value: "internships", label: "Career internships" },
              { value: "conversation", label: "Conversations" },
              { value: "lesson", label: "Life lesson" },
              { value: "rewards", label: "Pick a reward" },
              { value: "agreement", label: "New agreement" },
            ]}
          />
        </TweakSection>
      )}

      <TweakSection title="CTA button copy">
        <TweakRadio
          value={tweaks.ctaCopy}
          onChange={(v) => setTweak("ctaCopy", v)}
          options={[
            { value: "Get Ambition", label: "Get Ambition" },
            { value: "Download free", label: "Download free" },
            { value: "Start with your teen", label: "Start with teen" },
          ]}
        />
      </TweakSection>
    </TweaksPanel>
  );
}

// ── App root ────────────────────────────────────────────────────
function App() {
  const [tweaks, setTweak] = useTweaks(TWEAK_DEFAULTS);
  useReveal();
  useScrollClass();

  // Apply accent color as CSS variable
  useEffect(() => {
    document.documentElement.style.setProperty("--accent", tweaks.accent);
  }, [tweaks.accent]);

  return (
    <>
      <Nav ctaCopy={tweaks.ctaCopy} accent={tweaks.accent} />
      <Hero t={tweaks} />
      <Problem />
      <HowItWorks accent={tweaks.accent} />
      <Features accent={tweaks.accent} />
      <Testimonials />
      <Pricing ctaCopy={tweaks.ctaCopy} accent={tweaks.accent} />
      <FinalCTA accent={tweaks.accent} ctaCopy={tweaks.ctaCopy} />
      <Footer accent={tweaks.accent} />
      <Tweaks tweaks={tweaks} setTweak={setTweak} />
    </>
  );
}

ReactDOM.createRoot(document.getElementById("app")).render(<App />);
