import type { ReactNode } from "react";

import "./home-search.css";

/**
 * The banner at the top of both home pages (LEIS-1015, reskinned by LEIS-1046).
 *
 * Shared by E0 and D0 because the two differ only in their words — the
 * greeting and the line under it. Everything structural is the same, and the
 * search card is positioned against this band, so two copies would drift in
 * exactly the place a drift is most visible.
 *
 * ── Why this is the SRP's band and not a navy one ───────────────────────
 *
 * It used to be a flat `--fra-navy` block with a white Tailwind card below it.
 * That made the home page the only screen in the product where searching for a
 * flight looked like a different app from the page the results land on — the
 * SRP band is a photograph under a pale blue wash, with the product tabs
 * floating on it and a notched white panel beneath. LEIS-1046 asks for the two
 * to match, so this renders the same `.hero-banner-section` markup
 * `FlightSearchPanelV3` and `HotelSearchFormV3` already use: the same image,
 * the same `hero-banner-overlay-light`, the same rounded lower edge.
 *
 * The greeting is corp's own and has no counterpart on the SRP, so it sits
 * above the tabs in its own block, aligned to them rather than to the card —
 * `.corp-home-hero-intro` in home-search.css carries that and the colours,
 * which must be stated rather than inherited (leisure-new-style.css styles `*`
 * with `color: var(--color-content)`, which beats anything a parent passes
 * down).
 *
 * `children` is the search panel. It is nested rather than a sibling because
 * `.search-panel-container` positions itself against this section's lower edge
 * with a negative margin, and the tabs' notch is drawn by a `.shape-element`
 * absolutely positioned inside it.
 */
export function HomeHero({
  title,
  subtitle,
  children,
}: {
  title: ReactNode;
  /** Company and policy group for an employee; the admin's role line for D0. */
  subtitle: ReactNode;
  /** The search panel, which straddles this band's lower edge. */
  children: ReactNode;
}) {
  return (
    <section className="hero-banner-section corp-home-hero">
      <div className="hero-banner-bg">
        {/* eslint-disable-next-line @next/next/no-img-element */}
        <img src="/images/v3/v748-toon-103.jpg" alt="" />
      </div>
      <div className="hero-banner-overlay hero-banner-overlay-light" />

      <div className="corp-home-hero-intro">
        <h1 className="corp-home-hero-title">{title}</h1>
        <p className="corp-home-hero-sub">{subtitle}</p>
      </div>

      {children}
    </section>
  );
}
