/* global React, ReactDOM, AnnouncementBar, Nav, Footer, RUTHLESS, STANDALONES */
/* TORI STONE — Rights page app */

function RightsSection() {
  const allBooks = [...RUTHLESS, ...STANDALONES];
  return (
    <section id="rights" className="section">
      <div className="frame frame--narrow">
        <div className="section__head">
          <div className="section__eyebrow">Subsidiary Rights · Inquiries</div>
          <h2 className="section__title">Rights <span className="ital">available</span></h2>
          <p className="section__sub">Foreign translation, audio, film and television adaptation, dramatic, and large-print rights are open for licensing inquiry. All rights remain the property of Tori Stone and are granted only by written agreement.</p>
        </div>

        <div className="rights">
          <div className="rights__block">
            <h3 className="rights__h">Catalog at a glance</h3>
            <table className="rights__table">
              <thead>
                <tr>
                  <th>Title</th>
                  <th>Series</th>
                  <th>Year</th>
                  <th>Status</th>
                </tr>
              </thead>
              <tbody>
                {allBooks.map((b) => (
                  <tr key={b.id}>
                    <td>{b.title}</td>
                    <td>{b.subtitle || b.sub || "Standalone"}</td>
                    <td>{b.release || b.year || "—"}</td>
                    <td className="rights__status">Available for inquiry</td>
                  </tr>
                ))}
              </tbody>
            </table>
          </div>

          <div className="rights__block">
            <h3 className="rights__h">Submit an inquiry</h3>
            <p className="rights__body">Send title(s) of interest, territory, scope of rights, proposed terms, and your imprint or production company. Inquiries are reviewed personally. No rights are granted, transferred, or implied until both parties sign a written agreement.</p>
            <a href="Contact.html?reason=rights" className="btn">Open a rights inquiry <span className="arrow"></span></a>
            <p className="rights__note">Direct: <a href="mailto:tori@toristonebooks.com?subject=Rights%20Inquiry" className="rights__link">tori@toristonebooks.com</a> · Subject line: Rights Inquiry — [Title]</p>
          </div>

          <div className="rights__notice">
            <p>© Tori Stone. All works, including titles, manuscripts, characters, and cover designs, are the intellectual property of the author. All rights remain reserved and are granted only by written agreement. This page is informational and does not constitute an offer, license, or transfer of rights.</p>
          </div>
        </div>
      </div>
    </section>
  );
}

function RightsApp() {
  React.useEffect(() => {
    document.documentElement.setAttribute("data-variation", "luxe");
    document.documentElement.setAttribute("data-density", "regular");
    document.body.setAttribute("data-atmosphere", "on");
  }, []);

  return (
    <>
      <AnnouncementBar />
      <Nav />
      <RightsSection />
      <Footer />
    </>
  );
}

ReactDOM.createRoot(document.getElementById("root")).render(<RightsApp />);
