// HotelCraft — responsive static landing page
const { useEffect, useState } = React;

const TWEAKS_DEFAULTS = /*EDITMODE-BEGIN*/{
  "accent": "#492AED",
  "ctaCopy": "Get early access",
  "haloOpacity": 1,
  "heroOverlay": 0.3,
  "cardImageOpacity": 1
}/*EDITMODE-END*/;

const AREAS = [
  { title: "Guest reporting & compliance", blurb: "Government reporting, audit trails, and operational\nworkflows.", img: "assets/area-1.png" },
  { title: "Lost & found operations", blurb: "Item tracking, recovery workflows, and internal\ncoordination.", img: "assets/area-2.png" },
  { title: "Security operations", blurb: "Incident reporting, patrol workflows, and operational\nvisibility.", img: "assets/area-3.png" },
  { title: "Hotel operations systems", blurb: "Tools designed to simplify internal hospitality workflows.", img: "assets/area-4.png" },
];

// Add the deployed Google Apps Script Web App URL here after creating it.
const GOOGLE_LEADS_ENDPOINT = "https://script.google.com/a/macros/hotelcraft.co/s/AKfycbxQF5Mj_n6WFgQud1YdEiK9-s9zWVjZEPEFqZsvi78SIyfUDsYn9PbTw2Z9YEOsgXndDw/exec";

function wait(ms) {
  return new Promise((resolve) => setTimeout(resolve, ms));
}

async function submitLeadToGoogle({ email, source }) {
  if (!GOOGLE_LEADS_ENDPOINT) {
    await wait(800);
    return;
  }

  const payload = new URLSearchParams({
    email,
    source,
    page: window.location.href,
    userAgent: navigator.userAgent,
  });

  await Promise.all([
    fetch(GOOGLE_LEADS_ENDPOINT, {
      method: "POST",
      mode: "no-cors",
      body: payload,
    }),
    wait(500),
  ]);
}

function useRevealOnScroll() {
  useEffect(() => {
    const items = Array.from(document.querySelectorAll(".hc-reveal"));
    if (!items.length) return undefined;

    const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
    if (reducedMotion || !("IntersectionObserver" in window)) {
      items.forEach((item) => item.classList.add("is-visible"));
      return undefined;
    }

    const revealElement = (entry, observerInstance) => {
      const target = entry.target;
      const cardNeedsMoreVisibility = target.classList.contains("hc-card") && entry.intersectionRatio < 0.32;
      if (!entry.isIntersecting || cardNeedsMoreVisibility) return;

      target.classList.add("is-visible");
      observerInstance.unobserve(target);
    };

    const observer = new IntersectionObserver((entries) => {
      entries.forEach((entry) => {
        revealElement(entry, observer);
      });
    }, {
      threshold: 0.16,
      rootMargin: "0px 0px -8% 0px",
    });

    const cardObserver = new IntersectionObserver((entries) => {
      entries.forEach((entry) => {
        revealElement(entry, cardObserver);
      });
    }, {
      threshold: 0.32,
      rootMargin: "0px 0px -18% 0px",
    });

    items.forEach((item) => {
      if (item.classList.contains("hc-card")) {
        cardObserver.observe(item);
        return;
      }
      observer.observe(item);
    });
    return () => {
      observer.disconnect();
      cardObserver.disconnect();
    };
  }, []);
}

function EmailForm({ accent, ctaCopy, variant = "light", className = "", style, successCard, source = "landing" }) {
  const [email, setEmail] = useState("");
  const [state, setState] = useState("idle");
  const [msg, setMsg] = useState("");

  const onSubmit = async (e) => {
    e.preventDefault();
    if (state === "submitting" || state === "ok") return;
    const trimmed = email.trim();
    if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(trimmed)) {
      setState("error");
      setMsg("Please enter a valid email.");
      return;
    }
    setState("submitting");
    setMsg("");
    try {
      await submitLeadToGoogle({ email: trimmed, source });
      setState("ok");
      setMsg("You're on the list — we'll be in touch.");
    } catch (error) {
      setState("error");
      setMsg("Something went wrong. Please try again.");
    }
  };

  const dark = variant === "dark";
  const showSuccessCard = successCard ?? variant === "light";
  const successIconColor = dark ? "#c9c2ff" : accent;
  const successIconFill = dark ? "rgba(201,194,255,0.16)" : `${accent}1f`;

  if (state === "ok" && showSuccessCard) {
    return (
      <div className={`hc-success-card hc-success-card--${variant}`} role="status" aria-live="polite">
        <style>{`
          .hc-success-card {
            width: 100%;
            max-width: 460px;
            padding: 22px 28px 24px;
            border-radius: 24px;
            backdrop-filter: blur(4px);
            animation: hcsuccess 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
          }
          .hc-success-card--light {
            border: 1px solid rgba(148, 163, 184, 0.28);
            background: rgba(255,255,255,0.58);
            box-shadow: 0 1px 2px rgba(15,23,42,0.04);
          }
          .hc-success-card--dark {
            border: 1px solid rgba(255,255,255,0.10);
            background: rgba(255,255,255,0.07);
            box-shadow: 0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.05);
          }
          .hc-success-title {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-family: 'Outfit', sans-serif;
            font-size: 16px;
            font-weight: 700;
            line-height: 1.2;
            margin-bottom: 12px;
          }
          .hc-success-card--light .hc-success-title { color: #020617; }
          .hc-success-card--dark .hc-success-title { color: #fff; }
          .hc-success-title img {
            width: 18px;
            height: 18px;
            flex: 0 0 auto;
          }
          .hc-success-icon {
            width: 18px;
            height: 18px;
            flex: 0 0 auto;
            display: block;
          }
          .hc-success-text {
            font-family: 'DM Sans', sans-serif;
            font-size: 14px;
            line-height: 1.55;
            margin: 0;
            text-align: center;
            white-space: pre-line;
          }
          .hc-success-card--light .hc-success-text { color: #6b7280; }
          .hc-success-card--dark .hc-success-text { color: rgba(255,255,255,0.62); }
          @keyframes hcsuccess {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
          }
          @media (max-width: 520px) {
            .hc-success-card {
              max-width: min(100%, 340px);
              padding: 20px 24px 22px;
            }
          }
          @media (prefers-reduced-motion: reduce) {
            .hc-success-card {
              animation: none;
            }
          }
        `}</style>
        <div className="hc-success-title">
          <svg className="hc-success-icon" width="18" height="18" viewBox="0 0 18 18" fill="none" aria-hidden="true">
            <path opacity="0.9" d="M9 16.5C13.1421 16.5 16.5 13.1421 16.5 9C16.5 4.85786 13.1421 1.5 9 1.5C4.85786 1.5 1.5 4.85786 1.5 9C1.5 13.1421 4.85786 16.5 9 16.5Z" fill={successIconFill} />
            <path d="M5.625 9L7.875 11.25L12.375 6.75M16.5 9C16.5 13.1421 13.1421 16.5 9 16.5C4.85786 16.5 1.5 13.1421 1.5 9C1.5 4.85786 4.85786 1.5 9 1.5C13.1421 1.5 16.5 4.85786 16.5 9Z" stroke={successIconColor} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
          </svg>
          <span>You're on the list</span>
        </div>
        <p className="hc-success-text">
          {"We’ll share updates as we explore\nbetter systems for hotel operations."}
        </p>
      </div>
    );
  }

  return (
    <form className={`hc-form hc-form--${variant} ${className}`.trim()} style={style} onSubmit={onSubmit} noValidate>
      <style>{`
        .hc-form { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 460px; }
        .hc-form-row { display: flex; gap: 8px; align-items: stretch; }
        .hc-form--light .hc-input {
          background: #fff; border: 1px solid #e2e8f0; color: #0f172a;
        }
        .hc-form--light .hc-input::placeholder { color: #94a3b8; }
        .hc-form--dark .hc-input {
          background: rgba(255,255,255,0.10); border: 1px solid transparent; color: #fff;
        }
        .hc-form--dark .hc-input::placeholder { color: #6d6885; }
        .hc-input {
          flex: 1 1 auto; min-width: 0; width: 100%; height: 49px; border-radius: 30000px;
          padding: 0 22px;
          font-family: 'DM Sans', sans-serif; font-size: 15px;
          outline: none; transition: border-color .18s, box-shadow .18s;
        }
        .hc-input:focus { border-color: ${accent}; box-shadow: 0 0 0 4px ${accent}22; }
        .hc-form--dark .hc-input:focus { box-shadow: 0 0 0 4px rgba(255,255,255,0.10); }
        .hc-submit {
          flex: 0 0 auto; height: 49px; padding: 0 24px; border-radius: 30000px;
          background: ${accent}; color: #fff; border: none; cursor: pointer;
          font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 15px;
          display: inline-flex; align-items: center; justify-content: center; gap: 8px;
          transition: transform .15s, filter .18s;
          white-space: nowrap;
        }
        .hc-submit:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
        .hc-submit:active { transform: translateY(0); }
        .hc-submit:disabled,
        .hc-input:disabled {
          cursor: not-allowed;
          opacity: 0.78;
        }
        .hc-msg {
          font-family: 'DM Sans', sans-serif; font-size: 13px;
          padding: 0 12px; min-height: 16px; text-align: center;
          color: ${dark ? "rgba(255,255,255,0.6)" : "#475569"};
        }
        .hc-form--light .hc-msg.is-error { color: #991b1b; }
        .hc-form--dark .hc-msg.is-error { color: #ffb4c1; }
        .hc-msg.is-ok { color: ${dark ? "#a3f5c8" : "#0e8a4f"}; }
        @keyframes hcspin { to { transform: rotate(360deg); } }
        .hc-spin { width: 14px; height: 14px; border-radius: 50%;
          border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
          animation: hcspin .8s linear infinite; }
        @media (max-width: 520px) {
          .hc-form { max-width: min(100%, 340px); }
          .hc-form-row { flex-direction: column; gap: 10px; }
          .hc-input,
          .hc-submit {
            width: 100%;
          }
        }
      `}</style>
      <div className="hc-form-row">
        <input
          className="hc-input"
          type="email"
          name="email"
          inputMode="email"
          autoComplete="email"
          placeholder="your@hotel.com"
          value={email}
          onChange={(e) => { setEmail(e.target.value); if (state === "error") { setState("idle"); setMsg(""); } }}
          aria-label="Email"
          aria-invalid={state === "error"}
          aria-describedby={msg ? `hc-${variant}-email-msg` : undefined}
          disabled={state === "submitting" || state === "ok"}
        />
        <button className="hc-submit" type="submit" disabled={state === "submitting" || state === "ok"}>
          {state === "submitting" ? <span className="hc-spin" /> : null}
          {state === "ok" ? (dark ? "✓ On the list" : ctaCopy) : ctaCopy}
        </button>
      </div>
      {msg && (state !== "ok" || dark) ? (
        <div
          id={`hc-${variant}-email-msg`}
          className={`hc-msg ${state === "error" ? "is-error" : ""} ${state === "ok" ? "is-ok" : ""}`}
          role={state === "error" ? "alert" : "status"}
          aria-live="polite"
        >
          {msg}
        </div>
      ) : null}
    </form>
  );
}

function Logo() {
  return (
    <div className="hc-logo">
      <style>{`
        .hc-logo {
          display: flex;
          align-items: center;
          gap: 8px;
          justify-content: center;
          min-width: 0;
        }
        .hc-logo img {
          height: clamp(24px, 7vw, 30px);
          width: auto;
          display: block;
          flex: 0 0 auto;
        }
        .hc-logo span {
          font-family: "Outfit", sans-serif;
          font-weight: 600;
          font-size: clamp(23px, 7vw, 28px);
          color: #09121f;
          line-height: 1;
        }
      `}</style>
      <img src="assets/logo.png" alt="" />
      <span style={{
        letterSpacing: 0,
      }}>HotelCraft</span>
    </div>
  );
}

function Hero({ accent, ctaCopy, heroOverlay }) {
  return (
    <section className="hc-hero">
      <style>{`
        .hc-hero {
          position: relative;
          min-height: clamp(640px, 82vw, 880px);
          display: flex; flex-direction: column; align-items: center;
          padding: clamp(24px, 5vw, 32px) clamp(20px, 5vw, 24px) 96px;
          text-align: center;
          overflow: hidden;
          background:
            linear-gradient(180deg,
              #ffffff 0%,
              #ffffff 56%,
              rgba(250,235,245,0.92) 82%,
              rgba(226,219,249,0.96) 100%
            );
        }
        .hc-hero-bg {
          position: absolute; inset: 0;
          background: linear-gradient(rgba(255,255,255,${heroOverlay}), rgba(255,255,255,${heroOverlay})), url('assets/hero.png') center / cover no-repeat;
          transform: scaleY(-1);
          z-index: 0;
        }
        .hc-hero-inner {
          position: relative; z-index: 1; width: 100%;
          display: flex; flex-direction: column; align-items: center;
        }
        .hc-hero-logo { margin-top: 8px; margin-bottom: clamp(96px, 16vw, 168px); }
        .hc-h1 {
          font-family: 'Outfit', sans-serif; font-weight: 700;
          font-size: clamp(42px, 8vw, 56px);
          line-height: 1.04; letter-spacing: 0;
          color: #0f172a; margin: 0 0 20px;
          white-space: pre-line;
          max-width: min(100%, 720px);
          overflow-wrap: anywhere;
        }
        .hc-sub {
          font-family: 'DM Sans', sans-serif; font-size: clamp(15px, 2.7vw, 16px);
          line-height: 1.85; color: #334155;
          max-width: 563px; margin: 0 auto 36px;
        }
        @media (max-width: 600px) {
          .hc-hero {
            min-height: 720px;
            padding-bottom: 112px;
          }
          .hc-hero-bg {
            background-position: center top;
          }
          .hc-hero-logo { margin-bottom: 124px; }
          .hc-h1 {
            font-size: clamp(34px, 9vw, 36px);
            width: min(100%, 350px);
            max-width: 18ch;
            overflow-wrap: normal;
            word-break: normal;
          }
          .hc-sub {
            max-width: 34ch;
            line-height: 1.75;
            margin-bottom: 32px;
          }
        }
        @media (max-width: 360px) {
          .hc-h1 { font-size: 34px; }
        }
      `}</style>
      <div className="hc-hero-bg" />
      <div className="hc-hero-inner">
        <div className="hc-hero-logo hc-reveal" style={{ "--reveal-delay": "80ms" }}><Logo /></div>
        <h1 className="hc-h1 hc-reveal" style={{ "--reveal-delay": "180ms" }}>{"Modern systems for\nhotel operations"}</h1>
        <p className="hc-sub hc-reveal" style={{ "--reveal-delay": "280ms" }}>
          We build modern tools for hospitality operations — guest compliance,
          lost &amp; found, security, and the internal workflows hotels run on every day.
        </p>
        <EmailForm accent={accent} ctaCopy={ctaCopy} variant="light" className="hc-reveal" style={{ "--reveal-delay": "380ms" }} successCard source="hero" />
      </div>
    </section>
  );
}

function Card({ area, accent, cardImageOpacity, revealDelay = "0ms" }) {
  return (
    <div className="hc-card hc-reveal" style={{ "--reveal-delay": revealDelay }}>
      <style>{`
        .hc-card {
          position: relative;
          min-height: 226px;
          border-radius: clamp(22px, 4vw, 32px);
          background: #fff;
          border: 1px solid rgba(255,255,255,0.9);
          box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px rgba(15,23,42,0.04);
          overflow: hidden;
          transition: transform .25s ease, box-shadow .3s ease;
        }
        .hc-card:hover {
          transform: translateY(-3px);
          box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 18px 40px rgba(15,23,42,0.10);
        }
        .hc-card-bg {
          position: absolute; inset: -2px;
          background-position: center; background-size: cover; background-repeat: no-repeat;
        }
        .hc-card-content {
          position: absolute; left: clamp(22px, 5vw, 33px); top: 50%;
          transform: translateY(-50%);
          width: calc(100% - clamp(44px, 10vw, 66px));
          max-width: 394px;
          display: flex; flex-direction: column; gap: 8px;
          z-index: 2;
        }
        .hc-card-title {
          font-family: 'Outfit', sans-serif; font-weight: 700; font-size: clamp(18px, 3.5vw, 20px);
          line-height: 1.1; letter-spacing: 0;
          color: #0f172a;
        }
        .hc-card-blurb {
          font-family: 'DM Sans', sans-serif; font-size: 16px;
          line-height: 1.55; color: #64748b;
          white-space: pre-line;
        }
        @media (max-width: 760px) {
          .hc-card {
            min-height: 204px;
          }
          .hc-card-bg {
            background-position: center;
          }
        }
        @media (max-width: 520px) {
          .hc-card {
            min-height: 180px;
          }
          .hc-card-content {
            max-width: 78%;
          }
          .hc-card-blurb {
            line-height: 1.55;
            white-space: normal;
          }
        }
      `}</style>
      <div className="hc-card-bg" style={{ backgroundImage: `url(${area.img})`, opacity: cardImageOpacity }} />
      <div className="hc-card-content">
        <div className="hc-card-title">{area.title}</div>
        <div className="hc-card-blurb">{area.blurb}</div>
      </div>
    </div>
  );
}

function Areas({ accent, haloOpacity, cardImageOpacity }) {
  return (
    <section className="hc-areas">
      <style>{`
        .hc-areas {
          position: relative;
          background: #fff;
          border-radius: 64px 64px 0 0;
          margin-top: clamp(-88px, -8vw, -46px);
          padding: 140px clamp(20px, 5vw, 24px) calc(140px + clamp(118px, 10vw, 152px));
          overflow: hidden;
          z-index: 2;
        }
        .hc-areas::before, .hc-areas::after {
          content: ''; position: absolute; border-radius: 50%;
          pointer-events: none; filter: blur(150px);
          z-index: 0;
        }
        .hc-areas::before {
          left: -80px; top: 220px; width: 620px; height: 620px;
          background: rgba(244, 196, 232, ${0.28 * haloOpacity});
        }
        .hc-areas::after {
          right: -60px; top: 180px; width: 640px; height: 640px;
          background: rgba(151, 130, 240, ${0.18 * haloOpacity});
        }
        .hc-areas-inner { position: relative; z-index: 1; max-width: 940px; margin: 0 auto; }
        .hc-areas-title {
          font-family: 'Outfit', sans-serif; font-weight: 700;
          font-size: clamp(32px, 6vw, 40px);
          letter-spacing: 0;
          color: #0f172a;
          line-height: 1.2;
          text-align: center;
          margin: 0 0 14px;
        }
        .hc-areas-subtitle {
          font-family: 'DM Sans', sans-serif;
          font-size: 16px;
          line-height: 1.7;
          color: #64748b;
          text-align: center;
          max-width: 560px;
          margin: 0 auto 44px;
          white-space: pre-line;
        }
        .hc-areas-grid {
          display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
        }
        @media (max-width: 760px) {
          .hc-areas-grid { grid-template-columns: 1fr; gap: 16px; }
        }
        @media (max-width: 520px) {
          .hc-areas {
            border-radius: 48px 48px 0 0;
            padding-left: 20px;
            padding-right: 20px;
            padding-top: 72px;
            padding-bottom: calc(92px + 72px);
          }
          .hc-areas-title {
            font-size: clamp(32px, 8.5vw, 35px);
            max-width: 12ch;
            margin-left: auto;
            margin-right: auto;
          }
          .hc-areas-subtitle {
            max-width: 31ch;
            margin-bottom: 34px;
          }
        }
      `}</style>
      <div className="hc-areas-inner">
        <h2 className="hc-areas-title hc-reveal">Areas we are exploring</h2>
        <p className="hc-areas-subtitle hc-reveal" style={{ "--reveal-delay": "100ms" }}>
          Areas where hospitality operations still feel more complicated than they should.
        </p>
        <div className="hc-areas-grid">
          {AREAS.map((a, i) => (
            <Card
              key={i}
              area={a}
              accent={accent}
              cardImageOpacity={cardImageOpacity}
              revealDelay={`${160 + i * 90}ms`}
            />
          ))}
        </div>
      </div>
    </section>
  );
}

function CTA({ accent, ctaCopy }) {
  return (
    <div className="hc-cta-overlap">
      <style>{`
        .hc-cta-overlap {
          --cta-lift: clamp(118px, 10vw, 152px);
          --cta-radius: 64px;
          position: relative;
          z-index: 3;
          margin-top: calc(var(--cta-lift) * -1);
          background: transparent;
        }
        .hc-cta {
          position: relative;
          z-index: 1;
          background:
            linear-gradient(rgba(5,0,34,0.36), rgba(5,0,34,0.42)),
            url('assets/bg-footer.png') center / cover no-repeat,
            rgb(5,0,34);
          color: #fff;
          border-radius: var(--cta-radius) var(--cta-radius) 0 0;
          padding: clamp(86px, 10vw, 118px) 0 0;
          text-align: center;
          overflow: hidden;
          opacity: 0.98;
        }
        .hc-cta-inner {
          position: relative; width: 100%; max-width: 620px; margin: 0 auto;
          padding: 0 clamp(20px, 5vw, 24px) clamp(72px, 10vw, 96px);
          display: flex; flex-direction: column; align-items: center;
        }
        .hc-cta-title {
          font-family: 'Outfit', sans-serif; font-weight: 700;
          font-size: clamp(32px, 6vw, 40px);
          line-height: 1.05; letter-spacing: 0;
          color: #fff; margin: 0 0 32px;
        }
        @media (max-width: 520px) {
          .hc-areas {
            padding-bottom: 148px;
          }
          .hc-cta-overlap {
            --cta-lift: 72px;
            --cta-radius: 48px;
          }
          .hc-cta {
            padding-top: 74px;
            background-position: center, calc(100% + 150px) 90%, center;
            background-size: auto, 180%, auto;
          }
          .hc-cta-inner { max-width: 340px; }
          .hc-cta-title { max-width: 11ch; }
        }
      `}</style>
      <section className="hc-cta">
        <div className="hc-cta-inner">
          <h2 className="hc-cta-title hc-reveal">Interested in early access?</h2>
          <EmailForm accent={accent} ctaCopy={ctaCopy} variant="dark" className="hc-reveal" style={{ "--reveal-delay": "120ms" }} successCard source="footer-cta" />
        </div>
        <Footer />
      </section>
    </div>
  );
}

function Footer() {
  return (
    <footer className="hc-footer">
      <style>{`
        .hc-footer {
          width: 100%;
          border-top: 1px solid rgba(255, 255, 255, 0.08);
          padding: 24px clamp(24px, 5vw, 48px);
          display: flex;
          justify-content: center;
          align-items: center;
          gap: 12px;
          color: rgba(255, 255, 255, 0.5);
          font-family: 'DM Sans', sans-serif;
          font-size: 13px;
        }
        .hc-footer-logo {
          height: 20px;
          display: block;
        }
        .hc-footer-separator {
          width: 1px;
          height: 14px;
          background: rgba(255, 255, 255, 0.15);
        }
        @media (max-width: 600px) {
          .hc-footer {
            padding: 20px 24px;
          }
          .hc-footer-slogan, .hc-footer-separator.mobile-hide {
            display: none;
          }
        }
      `}</style>
      <img src="assets/logo-footer.png" alt="HotelCraft" className="hc-footer-logo" />
      <div className="hc-footer-separator mobile-hide" />
      <div className="hc-footer-slogan">Modern systems for hotel operations</div>
      <div className="hc-footer-separator" />
      <div className="hc-footer-copy">© 2026 HotelCraft</div>
    </footer>
  );
}

function App() {
  const [t, setTweak] = window.useTweaks(TWEAKS_DEFAULTS);
  useRevealOnScroll();

  return (
    <div className="hc-root">
      <style>{`
        html, body, .hc-root {
          width: 100%;
          min-width: 0;
          overflow-x: hidden;
          background:
            linear-gradient(180deg,
              #ffffff 0%,
              #fbeaf3 30%,
              #ece4fb 60%,
              #d9cef5 90%,
              #d9cef5 100%
            );
          color: #0f172a;
        }
        body { margin: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
        * { box-sizing: border-box; }
        img { max-width: 100%; }
        .hc-reveal {
          opacity: 0;
          transform: translateY(14px);
          filter: blur(3px);
          transition:
            opacity 900ms cubic-bezier(0.22, 1, 0.36, 1),
            transform 900ms cubic-bezier(0.22, 1, 0.36, 1),
            filter 900ms cubic-bezier(0.22, 1, 0.36, 1);
          transition-delay: var(--reveal-delay, 0ms);
          will-change: opacity, transform, filter;
        }
        .hc-reveal.is-visible {
          opacity: 1;
          transform: translateY(0);
          filter: blur(0);
          will-change: auto;
        }
        .hc-card.hc-reveal.is-visible:hover {
          transform: translateY(-3px);
        }
        @media (prefers-reduced-motion: reduce) {
          .hc-reveal,
          .hc-reveal.is-visible {
            opacity: 1;
            transform: none;
            filter: none;
            transition: none;
            transition-delay: 0ms;
            will-change: auto;
          }
          .hc-card.hc-reveal.is-visible:hover {
            transform: none;
          }
        }
        ::selection { background: ${t.accent}33; }
      `}</style>
      <Hero accent={t.accent} ctaCopy={t.ctaCopy} heroOverlay={t.heroOverlay} />
      <Areas accent={t.accent} haloOpacity={t.haloOpacity} cardImageOpacity={t.cardImageOpacity} />
      <CTA accent={t.accent} ctaCopy={t.ctaCopy} />

      <window.TweaksPanel title="Tweaks">
        <window.TweakSection label="Brand">
          <window.TweakColor
            label="Accent"
            value={t.accent}
            onChange={(v) => setTweak("accent", v)}
            options={["#492AED", "#0E8A4F", "#C32B5A", "#E07A1F", "#0F172A"]}
          />
        </window.TweakSection>
        <window.TweakSection label="Background">
          <window.TweakSlider
            label="Card halo opacity"
            value={t.haloOpacity}
            min={0}
            max={1.5}
            step={0.05}
            onChange={(v) => setTweak("haloOpacity", v)}
          />
          <window.TweakSlider
            label="Hero overlay"
            value={t.heroOverlay}
            min={0}
            max={1}
            step={0.05}
            onChange={(v) => setTweak("heroOverlay", v)}
          />
          <window.TweakSlider
            label="Card image opacity"
            value={t.cardImageOpacity}
            min={0}
            max={1}
            step={0.05}
            onChange={(v) => setTweak("cardImageOpacity", v)}
          />
        </window.TweakSection>
        <window.TweakSection label="Copy">
          <window.TweakText
            label="CTA button"
            value={t.ctaCopy}
            onChange={(v) => setTweak("ctaCopy", v)}
          />
        </window.TweakSection>
      </window.TweaksPanel>
    </div>
  );
}

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App />);
