/* eslint-disable */

// ─── Hero ──────────────────────────────────────────────────────────────────
const AccomHero = () => (
  <section className="types-hero">
    <div className="hero-bg" style={{ backgroundImage: `url(https://images.unsplash.com/photo-1582719508461-905c673771fd?w=2400&q=80)` }}></div>
    <div className="hero-scrim"></div>
    <Nav />
    <div className="container">
      <div className="types-crumbs">
        <a href="/">Home</a>
        <span className="sep">/</span>
        <a href="/en/book/">Book</a>
        <span className="sep">/</span>
        <span className="here">Accommodation</span>
      </div>
      <div className="types-mast">
        <div>
          <div className="kicker-row">
            <span className="layer-tag">THE BOOKING DESK · ACCOMMODATION · 10 GUIDES</span>
          </div>
          <h1>Accommodation<em>right room, right block.</em></h1>
        </div>
        <p className="lede">
          Hotels for short stays, rentals for long ones. <em>Neighborhood beats stars.</em> Always read the cancellation policy first. A four-star in the wrong block is a worse trip than a two-star on the right one.
        </p>
      </div>

      <div className="types-rail">
        {[
          { label: "I · Hotels & OTAs", id: "hotels" },
          { label: "II · The Four Rules", id: "rules" },
          { label: "III · Stay Types", id: "stay-types" },
          { label: "IV · The Zoe Files", id: "zoe" },
          { label: "V · Reading List", id: "reading" },
          { label: "VI · FAQ", id: "faq" },
        ].map(l => (
          <a key={l.id} href={`#${l.id}`}>
            <span className="t">{l.label}</span>
          </a>
        ))}
      </div>
    </div>

    <div className="hero-coord">43°46′N · 11°15′E · FLORENCE</div>
    <div className="hero-credit">PHOTO — FIELD DESK Nº 092</div>
  </section>
);

// ─── Card grid ──────────────────────────────────────────────────────────────
const AccomCard = ({ card }) => (
  <a href={card.href} className={`lane ${card.size}`}>
    <div className="img" style={{ backgroundImage: `url(${card.img})` }}></div>
    <div className="scrim"></div>
    <span className="corner-num">{card.num}</span>
    {card.badge && (
      <span
        className="corner-tag"
        style={card.badgeType === "zoe"
          ? { background: "rgba(180,120,20,0.92)", color: "#fff3cc", fontWeight: 600 }
          : {}}
      >
        {card.badge}
      </span>
    )}
    <div className="body">
      <div className="topic"><span className="dot"></span>{card.topic}</div>
      <h3>{card.title}{card.titleEm && <em> {card.titleEm}</em>}</h3>
      <p className="desc">{card.desc}</p>
      <div className="meta">
        <span>{card.count}</span>
        <span>·</span>
        <span>{card.read}</span>
        <span className="arrow"><Icon name="arrow" size={14} /></span>
      </div>
    </div>
  </a>
);

// ─── Section I — Hotels & OTAs ───────────────────────────────────────────────
const AccomHotels = () => {
  const cards = ACCOM_CARDS.filter(c => ["tourist-trap","hotels-vs-rentals","neighborhood-first","otas-vs-direct"].includes(c.id));
  return (
    <section className="types-lanes" id="hotels">
      <div className="container">
        <div className="types-section-head">
          <div className="num">I</div>
          <div className="titles">
            <h2>Hotels, OTAs, <em>and the booking stack.</em></h2>
            <p>When to book direct, when to use the OTA, and the one thing you always check before you click.</p>
          </div>
          <div className="right">All guides <Icon name="arrow" size={12} /></div>
        </div>
        <div className="lane-grid">
          {cards.map(c => <AccomCard key={c.id} card={c} />)}
        </div>
      </div>
    </section>
  );
};

// ─── Section II — Four Rules ─────────────────────────────────────────────────
const AccomRules = () => (
  <section className="types-essay" id="rules">
    <div className="container">
      <div className="types-section-head">
        <div className="num">II</div>
        <div className="titles">
          <h2>The four rules <em>we never break.</em></h2>
          <p>Everything else in accommodation is preference. These four aren't.</p>
        </div>
        <div className="right">Print this <Icon name="arrow" size={12} /></div>
      </div>
      <div className="essay-spread">
        <div className="essay-lhs">
          <p className="pull">"Spend an hour with a map and a coffee <em>before</em> you spend an hour with Booking.com."</p>
          <div className="byline">
            <div className="who">
              <div className="name">Book Desk</div>
              <div className="role">Senior Editor · HowTo: Travel</div>
            </div>
          </div>
        </div>
        <div className="essay-rhs">
          {ACCOM_RULE_CARDS.map(r => (
            <div key={r.n} style={{ marginBottom: "1.6rem" }}>
              <div style={{ fontFamily: "DM Mono, monospace", fontSize: "0.7rem", color: "#999", letterSpacing: "0.12em", marginBottom: "0.3rem" }}>RULE {r.n}</div>
              <p style={{ margin: 0 }}><strong>{r.title}.</strong> {r.body}</p>
            </div>
          ))}
        </div>
      </div>
      <div className="essay-stats">
        <div className="item"><div className="n">4–3</div><div className="l">Nights where<br />rental beats hotel</div></div>
        <div className="item"><div className="n">10%</div><div className="l">Gap where refundable<br />always wins</div></div>
        <div className="item"><div className="n">94%</div><div className="l">Our picks that<br />are refundable</div></div>
        <div className="item"><div className="n">$487</div><div className="l">Average saved<br />per trip by the rules</div></div>
      </div>
    </div>
  </section>
);

// ─── Section III — Stay Types ────────────────────────────────────────────────
const AccomStayTypes = () => {
  const cards = ACCOM_CARDS.filter(c => ["boutique-stays","long-stay-discount","airbnb-ethics","cancellation-policy","loyalty-programs"].includes(c.id));
  return (
    <section className="types-lanes" id="stay-types" style={{ paddingTop: 0 }}>
      <div className="container">
        <div className="types-section-head">
          <div className="num">III</div>
          <div className="titles">
            <h2>Stay types <em>matched to the trip.</em></h2>
            <p>Boutiques, vacation rentals, long-stay apartments, loyalty programs. Each one earns its place under specific conditions.</p>
          </div>
          <div className="right">All guides <Icon name="arrow" size={12} /></div>
        </div>
        <div className="lane-grid">
          {cards.map(c => <AccomCard key={c.id} card={c} />)}
        </div>
      </div>
    </section>
  );
};

// ─── Section IV — Zoe Files ──────────────────────────────────────────────────
const ZoeFilesSection = () => {
  const zoeCards = ACCOM_CARDS.filter(c => c.badgeType === "zoe");
  return (
    <section className="roundtrips-section" id="zoe">
      <div className="container">
        <div className="rt-top">
          <div>
            <div className="rt-brand-row">
              <span className="lbl" style={{ background: "rgba(180,120,20,0.15)", color: "#9a6a00", borderColor: "rgba(180,120,20,0.3)" }}>
                CONTRIBUTOR · ZOE CHEN
              </span>
            </div>
            <h2>The Zoe Files.<em>First-person accommodation.</em></h2>
          </div>
          <p>Zoe travels for the stay. She has slept in riads, capsule hotels, a converted train carriage in Portugal, and more Airbnbs than she'd like to count. <em>Amber badge = her byline.</em></p>
        </div>

        <div className="rt-grid">
          {zoeCards.map(card => (
            <a key={card.id} href={card.href} className={`rt-panel ${card.size === "xl" ? "wide" : "md"}`}>
              <div className="pic" style={{ backgroundImage: `url(${card.img})` }}></div>
              <div className="body">
                <span className="pill" style={{ background: "rgba(180,120,20,0.15)", color: "#9a6a00", border: "1px solid rgba(180,120,20,0.3)" }}>
                  {card.badge} · {card.topic}
                </span>
                <h4>{card.title}{card.titleEm && <em> {card.titleEm}</em>}</h4>
                <p>{card.desc}</p>
              </div>
            </a>
          ))}
        </div>

        <div className="rt-footer">
          <div className="note">
            Zoe Chen is a contributing editor at HowTo: Travel. She writes on accommodation, long-stay travel, and the ethics of short-term rentals. Her reserved article on tourist-trap hotels is the first read we assign every new traveler.
          </div>
          <div className="actions">
            <a href="/journal/how-to-book-accommodation-that-isnt-a-tourist-trap" className="btn-rt">Read Zoe's lead piece →</a>
            <a href="/en/book/" className="link-rt">Back to Book</a>
          </div>
        </div>
      </div>
    </section>
  );
};

// ─── Section V — Reading List ────────────────────────────────────────────────
const AccomReading = () => (
  <section className="types-reading" id="reading">
    <div className="container">
      <div className="types-section-head">
        <div className="num">V</div>
        <div className="titles">
          <h2>The reading list <em>before you book.</em></h2>
          <p>Six pieces from the accommodation desk. Good for the research phase, better for the second-night regret phase.</p>
        </div>
        <div className="right">All essays <Icon name="arrow" size={12} /></div>
      </div>
      <div>
        {ACCOM_READING.map((r, i) => (
          <a key={i} href="/journal/" className="reading-row-t">
            <div className="num">{String(i + 1).padStart(2, "0")}</div>
            <div className="title">{r.title}{r.em && <em> {r.em}</em>}</div>
            <div className="tag">{r.tag}</div>
            <div className="duration">{r.duration}</div>
          </a>
        ))}
      </div>
    </div>
  </section>
);

// ─── Section VI — FAQ ────────────────────────────────────────────────────────
const AccomFAQ = () => {
  const [open, setOpen] = React.useState(0);
  return (
    <section className="types-faq" id="faq">
      <div className="container">
        <div className="faq-grid">
          <div className="faq-lhs">
            <div className="lbl">FREQUENTLY · BUT QUIETLY · ASKED</div>
            <h3>What people<em>actually ask.</em></h3>
            <p>Reader letters, lightly edited. The accommodation questions we get most — answered without hedging.</p>
          </div>
          <div className="faq-list">
            {ACCOM_FAQS.map((f, i) => (
              <div key={i} className={`faq-item ${open === i ? "open" : ""}`} onClick={() => setOpen(open === i ? -1 : i)}>
                <div className="q">
                  <span>{f.q}</span>
                  <span className="toggle">+</span>
                </div>
                <div className="a">{f.a}</div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
};

// ─── CTA ─────────────────────────────────────────────────────────────────────
const AccomCTA = () => (
  <section className="types-cta">
    <div className="bg" style={{ backgroundImage: `url(https://images.unsplash.com/photo-1520250497591-112f2f40a3f4?w=2000&q=80)` }}></div>
    <div className="inner">
      <div className="kicker">BOOK ANYTHING · START WITH THE BLOCK</div>
      <h2>Right room.<em>Right neighborhood.</em></h2>
      <p>The desk has done the research. The rules are written. Pick a guide and let it collapse the decision to one hotel on one street.</p>
      <div className="actions">
        <a href="/en/book/accommodation/neighborhood-first-stars-second/" className="btn-p">Find your neighborhood →</a>
        <a href="/en/book/" className="btn-g">Back to Book</a>
      </div>
    </div>
  </section>
);

// ─── Root ─────────────────────────────────────────────────────────────────────
const AccomApp = () => (
  <>
    <AccomHero />
    <AccomHotels />
    <AccomRules />
    <AccomStayTypes />
    <ZoeFilesSection />
    <AccomReading />
    <AccomFAQ />
    <AccomCTA />
    <Footer />
  </>
);

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